Skip to main content

Class: ForgeShaderSource

Defined in: rendering/shaders/pre-processing/forge-shader-source.ts:13

Represents a shader source file with metadata.

Constructors​

Constructor​

new ForgeShaderSource(rawSource): ForgeShaderSource

Defined in: rendering/shaders/pre-processing/forge-shader-source.ts:29

Constructs a new instance of the ForgeShaderSource class. Parses the provided shader source code and extracts metadata.

Parameters​

rawSource​

string

The raw source code of the shader.

Returns​

ForgeShaderSource

Throws​

If the shader source does not contain a valid #property name directive.

Throws​

If any #include or #property directive has invalid syntax.

Properties​

name​

readonly name: string

Defined in: rendering/shaders/pre-processing/forge-shader-source.ts:14

Accessors​

preparedSource​

Get Signature​

get preparedSource(): string

Defined in: rendering/shaders/pre-processing/forge-shader-source.ts:66

Gets the prepared source code of the shader. This is the source code after any preprocessing steps, such as resolving includes.

Returns​

string

The prepared shader source code.


rawSource​

Get Signature​

get rawSource(): string

Defined in: rendering/shaders/pre-processing/forge-shader-source.ts:56

Gets the raw, unprocessed source code of the shader.

Returns​

string

The raw shader source code as provided to the constructor.

Methods​

applyPreProcessor()​

applyPreProcessor(preProcessor): void

Defined in: rendering/shaders/pre-processing/forge-shader-source.ts:76

Applies a single pre-processor to the shader source. The pre-processor can modify the shader source, for example by resolving includes or other transformations.

Parameters​

preProcessor​

ShaderPreProcessor

The pre-processor to apply.

Returns​

void


applyPreProcessors()​

applyPreProcessors(preProcessors): void

Defined in: rendering/shaders/pre-processing/forge-shader-source.ts:86

Applies multiple pre-processors to the shader source in sequence. Each pre-processor can modify the shader source, for example by resolving includes or other transformations.

Parameters​

preProcessors​

ShaderPreProcessor[]

An array of pre-processors to apply.

Returns​

void


getPragmas()​

getPragmas(identifier): ForgeShaderPragma[]

Defined in: rendering/shaders/pre-processing/forge-shader-source.ts:92

Parameters​

identifier​

string

Returns​

ForgeShaderPragma[]