Murl Engine Lua Addon API  Version 1.0 beta
Murl.Graph.IShader

The IShader graph node interface.

This interface represents a node that holds the source code for either a vertex shader or a fragment shader of a GPU program, or both. If the node is set to a single type (either vertex or fragment shader) and the selected video API allows for runtime shader compilation, the actual shader code may be set directly via SetSource(). Otherwise, a valid Resource::IShader object must be provided, which contains the necessary type(s) of shader data.

See Graph::IShaderProgram for attaching a shader to a program.


Table members

Methods


GetNodeInterface()

Get the constant Graph::INode interface. This method returns a constant pointer to the node's Graph::INode interface, to be able to query common node properties such as active state, visibility or ID.

Murl.Graph.INode GetNodeInterface()

Returns
Murl.Graph.INode The constant Graph::INode interface, or null if not available

GetShaderResourceTarget()

Get a constant Graph::IShaderResourceTarget container. This method returns a constant pointer to a Graph::IShaderResourceTarget container, which allows to query the shader resources referenced by a node implementing this interface.

Murl.Graph.IGenericResourceTarget.ResourceIShader GetShaderResourceTarget()

Returns
Murl.Graph.IGenericResourceTarget.ResourceIShader The constant Graph::IShaderResourceTarget container, or null if not available

GetFallbackShaderNodeTarget()

Get the constant Graph::IShader container storing an optional fallback shader. This method returns a constant pointer to the node's Graph::IShader container that stores an optional reference to another shader node that is used instead, if compilation of the shader object(s) failed.

Murl.Graph.IGenericNodeTarget.GraphIShader GetFallbackShaderNodeTarget()

Returns
Murl.Graph.IGenericNodeTarget.GraphIShader The constant Graph::IShader fallback container, or null if not available.

SetSource(source)

Directly set the shader's source code from a given string.

Boolean SetSource(String source)

Parameters
sourceThe shader source code.
Returns
Boolean true if successful.

GetSource()

Get the shader's source code, if it was explicitly set via SetSource().

String GetSource()

Returns
String The shader source code.

SetType(type)

Set the shader type. If set to IEnums::SHADER_TYPE_ALL, the given shader resource must contain both vertex and fragment shader data valid for the selected video API.

Boolean SetType(Murl.IEnums.ShaderType type)

Parameters
typeThe shader type.
Returns
Boolean true if successful.

GetType()

Get the shader type.

Murl.IEnums.ShaderType GetType()

Returns
Murl.IEnums.ShaderType The shader type.

GetNumberOfStages()

Get the shader's number of stages.

Integer GetNumberOfStages()

Returns
Integer The number of stages.

IsValid(checkFallbacks)

Check if the shader is valid. If creation/compilation of the shader object fails, this method returns false.

Boolean IsValid(Boolean checkFallbacks)

Parameters
checkFallbacksIf false, only the current shader is considered. Otherwise, the method returns true if any of its fallback shaders is valid.
Returns
Boolean true if shader compilation succeeded during initialization.

GetCompilerLog()

Get the shader compiler log. If creation/compilation of the shader object fails, this method returns the output provided by the OS/video API. Otherwise, an empty string is returned.

String GetCompilerLog()

Returns
String The compiler log message.