Post

ComposedShader

Overview

ComposedShader defines a shader where the individual source files are assembled from contained ShaderPart program sections. All access to shading capabilities is defined through a single interface that applies to all parts.

The ComposedShader node belongs to the Shaders component and requires at least level 1, its default container field is shaders. It is available from X3D version 3.0 or higher.

Hierarchy

1
2
3
4
+ X3DNode
  + X3DAppearanceChildNode
    + X3DShaderNode
      + ComposedShader (X3DProgrammableShaderObject)*

* Derived from multiple interfaces.

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Information about this node can be contained in a MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, MetadataString or MetadataSet node.

Hint

SFBool [in] activate

activate forces the shader to activate the contained objects.

Warning

  • It is an error to define this transient inputOnly field in an X3D file, instead only use it a destination for ROUTE events.

SFBool [out] isSelected

isSelected indicates this shader instance is selected for use by browser

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFBool [out] isValid

isValid indicates whether current shader objects can be run as a shader program.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFString [ ] language “” [“Cg”|”GLSL”|”HLSL”|…]

The language field indicates to the X3D player which shading language is used. The language field may be used to optionally determine the language type if no MIME-type information is available.

Hint

  • Recognized values include “Cg” “GLSL” “HLSL”.

MFNode [in, out] parts [ ] [ShaderPart]

ComposedShader can contain multiple ShaderPart nodes in the parts field.

Advice

Hints

  • ComposedShader contains field declarations and then corresponding IS/connect statements (if any), followed by <ShaderPart containerField='parts'/> nodes.
  • Apply default containerField='shaders' when parent node is Appearance.

Warning

  • ComposedShader does not contain CDATA section of plain-text source code. All source programs are contained in child ShaderPart nodes.

Example

View Source in Playground

See Also

This post is licensed under CC BY 4.0 by the author.