ShaderSource

Represents the source of a shader. This class can be used to load a source from an input stream, and provides pre-compilation functionality such as parsing shader type, attribute layout and texture layout tokens. These tokens can be used to declare various parameters directly in the shader code instead of in the software code, which simplifies loading.

Constructors

this
this(string source, bool directSource)

Constructs a new shader source from the input stream.

Members

Functions

getAttributeLayouts
uint[string] getAttributeLayouts()

Returns the attribute layouts, either parsed from the source or set manually using {@link #setAttributeLayout(String, int)}.

getSource
string getSource()

Returns the raw character sequence source of this shader source.

getTextureLayouts
string[uint] getTextureLayouts()

Returns the texture layouts, either parsed from the source or set manually using {@link #setTextureLayout(int, String)}.

getType
ShaderType getType()

Returns the type of this shader. If the type was declared in the source using a shader type token, it will have been loaded from it. Else this returns null and it must be set manually using {@link #setType(org.spout.renderer.api.gl.Shader.ShaderType)}.

isComplete
bool isComplete()

Returns true if the shader source is complete and ready to be used in a {@link org.spout.renderer.api.gl.Shader} object, false if otherwise. If this method returns false, than information such as the type is missing.

setAttributeLayout
void setAttributeLayout(string attribute, uint layout)

Sets an attribute layout.

setTextureLayout
void setTextureLayout(uint unit, string sampler)

Sets a texture layout.

setType
void setType(ShaderType type)

Sets the shader type. It's not necessary to do this manually if it was declared in the source using a shader type token.

Meta