# @fnet/glsl-processor

> The project related to the source code provided is **@fnet/glsl-processor**. This project functions as a **GLSL (OpenGL Shading Language) program code handler**, designed to parse, manipulate, and generate GLSL source code. It leverages a package called *

Latest version **0.1.3** (published 2023-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fnet/glsl-processor
pnpm add @fnet/glsl-processor
yarn add @fnet/glsl-processor
bun add @fnet/glsl-processor
```

Provides the commands `glsl-`, `fnet-glsl-processor`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2023-10-29 |
| First published | 2023-10-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 534.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | gboyraz |

## Links

- npm: https://www.npmjs.com/package/@fnet/glsl-processor
- npm.io page: https://npm.io/package/@fnet/glsl-processor

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^4
- [yargs](https://npm.io/package/yargs.md) ^17
- [@shaderfrog/glsl-parser](https://npm.io/package/@shaderfrog/glsl-parser.md) ^2.0

## Recent versions

- 0.1.3 (latest) — 2023-10-29
- 0.1.2 — 2023-10-29
- 0.1.1 — 2023-10-29

## README

# @fnet/glsl-processor

The project related to the source code provided is **@fnet/glsl-processor**. This project functions as a **GLSL (OpenGL Shading Language) program code handler**, designed to parse, manipulate, and generate GLSL source code. It leverages a package called *ShaderFrog GLSL Parser*.

## Functionality

Primarily, this GLSL processor operates in three core stages: **Parsing**, **Resolving Includes,** and **Code Generation.**

- **Parsing:** In this stage, the processor tackles the received GLSL source code, converting it into an Abstract Syntax Tree (AST), which is a neat representation of the program's structure.

- **Resolving Includes:** Once the AST is obtained, the processor attempts to resolve any **#include directives** contained within the initial source code. These instructions indicate that the content of another file should be inserted at that particular point in the source code. **@fnet/glsl-processor** is capable of handling these instructions and properly integrates the content from other files.

- **Code Generation:** After all #include directives are resolved, the processor generates the modified GLSL source code back from the manipulated AST and finally returns the transpiled source code.

Thus, the main purpose of **@fnet/glsl-processor** is to allow for handling and editing GLSL source code programmatically, taking care of resolving dependencies, and offering the necessary infrastructure to make further transformations or analyses on the GLSL code. This makes it a valuable tool for developing graphical applications where GLSL shader manipulation may be required.

## Usage 

From an end-user perspective, using **@fnet/glsl-processor** involves providing the necessary GLSL file and a specific fileLoader function while calling the **index** function. The fileLoader works as a custom file loading mechanic, and should be a function that takes a filename and returns the content of that file. This function is used to load any files referenced by #include directives. Upon execution, **@fnet/glsl-processor** returns the transpiled GLSL code.

---
_Source: https://npm.io/package/@fnet/glsl-processor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
