Gorilla.Material.Default.Nodes
Unit Gorilla.Material.Default.Nodes.pasClasses
- TGorillaNodeBuilder = class ( TObject )
- TGorillaNodeEntity = class ( TObject )
- TGorillaCompositeNode = class ( TGorillaNodeEntity )
- TGorillaUniformsNode = class ( TGorillaCompositeNode )
- TGorillaGlobalsNode = class ( TGorillaCompositeNode )
- TGorillaDeclarationNode = class ( TGorillaCompositeNode )
- TGorillaTypeNode = class ( TGorillaDeclarationNode )
- TGorillaStructTypeNode = class ( TGorillaTypeNode )
- TGorillaVariableNode = class ( TGorillaDeclarationNode )
- TGorillaOperationNode = class ( TGorillaCompositeNode )
- TGorillaConstantNode = class ( TGorillaNodeEntity )
- TGorillaStatementNode = class ( TGorillaCompositeNode )
- TGorillaReferenceNode = class ( TGorillaNodeEntity )
- TGorillaForLoopNode = class ( TGorillaStatementNode )
- TGorillaSurfaceInputNode = class ( TGorillaStructTypeNode )
- TGorillaSurfaceOutputNode = class ( TGorillaStructTypeNode )
- TGorillaSurfaceShaderNode = class ( TGorillaCompositeNode )
- TGorillaEntryPointNode = class ( TGorillaCompositeNode )
Records
- record TGorillaShaderNodeVariable
Enumerations
- enum TGorillaDefOp = ( doEqual, doUnequal, doGreater, doGreaterEqual, doLess, doLessEqual ) ;
- enum TGorillaShaderNodeOperator = ( snopUndefined, snopGrouping, snopArraySubscript, snopFuncCall, snopFieldSel, snopPostInc, snopPostDec, snopPreInc, snopPreDec, snopADD, snopSUB, snopMUL, snopDIV, snopSignPos, snopSignNeg, snopNOT, snopEQ, snopUNEQ, snopGT, snopGEQ, snopLT, snopLEQ, snopLogAND, snopLogOR, snopLogXOR, snopSelection, snopAssign, snopAddAssign, snopSubAssign, snopMulAssign, snopDivAssign ) ;
- enum TGorillaShaderNodeVariableType = ( stCustom, stInt, stFloat, stBool, stBVec2, stBVec3, stBVec4, stIVec2, stIVec3, stIVec4, stUVec2, stUVec3, stUVec4, stVec2, stVec3, stVec4, stMat33, stMat44, stSampler2D, stStruct ) ;
Constants
Mics. types
- type TGorillaNodeEntityClass = class of TGorillaNodeEntity;
TGorillaShaderNodeOperator
Provides operators
Remarks
# OP Description Examples
1 ( ) grouping ( )
2 [ ] array subscript v[2]
( ) function call func()
. field selector, swizzle v.xyz
++ postfix increment i++
-- postfix decrement i--
...TGorillaNodeBuilder
The node builder class provides functionality to easily build a complex shader code by adding nodes and handling defines.
Ancestors
Members
Fields
- protected FMaterial :
TCustomMaterial
- protected FDefines :
TGorillaNodeDefines
- protected FSourceCode :
TGorillaCompositeNode
- protected FGlobals :
TGorillaGlobalsNode
- protected FEntryPoint :
TGorillaEntryPointNode
- protected FSurfaceShader :
TGorillaSurfaceShaderNode
Methods
- public constructor Create ( AMaterial : TCustomMaterial ) ;
- public destructor Destroy ( ) ;
- protected procedure DoSetupDefaultDefines ( ) ; abstract virtual;
- protected procedure DoSetupDefaultNodes ( ) ; abstract virtual;
- protected procedure SetSurfaceShader ( const AValue : TGorillaSurfaceShaderNode ) ; virtual;
- public procedure AddDefine
(
const
AName :
string
)
;
overload virtual;
Adds a simple definition to the builder. This definition will not have a value. It is only allowed to request, if the definition is available.
- public procedure AddDefine
(
const
AName :
string; const
AValue :
TValue
)
;
overload virtual;
Adds a definition with a preset value to the builder. You are allowed to request if the definition is generally set and to request if the value is allowed.
- public procedure RemoveDefine
(
const
AName :
string
)
;
virtual;
Removes a predefined definition from builder.
- public function Defined
(
const
AName :
string
)
: Boolean
;
overload virtual;
Performs a simple availability check for a specific definition. No value will be checked by using this method.
- public function Defined
(
const
AName :
string; const
AValue :
TValue; const
AOp :
TGorillaDefOp
=
doEqual
)
: Boolean
;
overload virtual;
Performs an availability check for a specific definition. If the definition exists, the method will do a value check on the preset value by the supplied operator and value.
- public function ToString ( ) : string ; override;
Properties
- public Material : TCustomMaterial
- public Defines : TDictionary<System.string,System.Rtti.TValue>
- public SourceCode : TGorillaCompositeNode
Returns the main composition node, where all shader code nodes should be attached to in the end.
read FSourceCode - public Globals : TGorillaGlobalsNode
Returns the created globals composite node, where all global declarations are attached to, like types, attributes, uniforms, varyings or functions.
read FGlobals - public EntryPoint : TGorillaEntryPointNode
Returns the entry point function node, which represents the starting point of a shader program.
read FEntryPoint - public SurfaceShader : TGorillaSurfaceShaderNode
Returns the applied surface shader node. If no surface shader was assigned, the property is NIL and the default surface shading will be used.
read FSurfaceShader
write SetSurfaceShader
TGorillaNodeEntity
Basis node entity for all extended node types, providing basic properties like an id and a code string field.
Ancestors
Members
Fields
- public FormatSettings :
TFormatSettings
- protected FBuilder :
TGorillaNodeBuilder
- protected FId :
string
- protected FDefines :
TList<System.string>
- protected FNotDefines :
TList<System.string>
Methods
- public constructor Create ( ABuilder : TGorillaNodeBuilder ) ;
- public destructor Destroy ( ) ;
- public procedure AddDefine
(
const
ADefine :
string
)
;
Adds a define condition this node is available.
- public procedure AddNotDefine
(
const
ADefine :
string
)
;
Adds a negative define condition this node is available.
- public function Defined
(
)
: Boolean
;
Checks added definitions if they are available in the parent builder.
- public function NotDefined ( ) : Boolean ;
- public function ToString
(
)
: string
;
override;
Returns the output shader code.
- class private procedure Create@ ( ) ; class constructor noself;
- class private procedure Destroy@ ( ) ; class destructor noself;
Properties
TGorillaCompositeNode
A basic node to sum up different nodes. The output shader code will be produced by added nodes in order.
Ancestors
Members
Fields
Methods
- public constructor Create ( ABuilder : TGorillaNodeBuilder ) ;
- public destructor Destroy ( ) ;
- public function Add
(
const
ANode :
TGorillaNodeEntity
)
: Integer
;
virtual;
Attach a node to this specific composite node.
- public procedure Remove
(
const
ANode :
TGorillaNodeEntity
)
;
virtual;
Removes a node from current nodes list and destroys the instance.
- public procedure Delete
(
const
AIndex :
Integer
)
;
virtual;
Deletes a node at a specific index and destroys the instance.
- public procedure Insert
(
const
AIndex :
Integer; const
ANode :
TGorillaNodeEntity
)
;
virtual;
Inserts a node at a specific position in the nodes list.
- public function Count
(
)
: Integer
;
virtual;
Returns the number of nodes attached to the composite node.
- public procedure Clear
(
)
;
virtual;
Removes all nodes inside of the nodes list.
- public function FindNode
(
const
AType :
TGorillaNodeEntityClass; const
AId :
string; const
ARecursive :
Boolean
)
: TGorillaNodeEntity
;
virtual;
Tries to find a specific node specified by its class type and an optional identifier.
- public function IndexOf ( const AType : TGorillaNodeEntityClass; const AId : string ) : Integer ; virtual;
- public function ToString ( ) : string ; override;
Properties
TGorillaUniformsNode
Defining a composite node for collecting uniforms. We use a separate node to provide a subnode for texture declarations, to update this code section fast.
Ancestors
Members
TGorillaGlobalsNode
Defining a globals node for having a global section where to declare constants, types, attributes, uniforms, varyings and global functions and global variables.
Ancestors
Members
Fields
- protected FConstants :
TGorillaCompositeNode
- protected FTypes :
TGorillaCompositeNode
- protected FAttributes :
TGorillaCompositeNode
- protected FUniforms :
TGorillaUniformsNode
- protected FVarying :
TGorillaCompositeNode
- protected FFunctions :
TGorillaCompositeNode
- protected FVariables :
TGorillaCompositeNode
Methods
- public constructor Create ( ABuilder : TGorillaNodeBuilder ) ;
- public procedure ClearConstants ( ) ;
- public procedure ClearTypes ( ) ;
- public procedure ClearAttributes ( ) ;
- public procedure ClearUniforms ( ) ;
- public procedure ClearVarying ( ) ;
- public procedure ClearFunctions ( ) ;
- public procedure ClearVariables ( ) ;
Properties
- public Constants : TGorillaCompositeNoderead FConstants
- public Types : TGorillaCompositeNoderead FTypes
- public Attributes : TGorillaCompositeNoderead FAttributes
- public Uniforms : TGorillaUniformsNoderead FUniforms
- public Varying : TGorillaCompositeNoderead FVarying
- public Functions : TGorillaCompositeNoderead FFunctions
- public Variables : TGorillaCompositeNoderead FVariables
TGorillaDeclarationNode
Providing a type / function / defines / variables / ... declaration node.
Remarks
Use this kind of node to represent declaration types, f.e. for types or variables.Ancestors
Members
Methods
- public constructor Create ( ABuilder : TGorillaNodeBuilder ) ;
- public destructor Destroy ( ) ;
- public function AddDeclaration ( const AName : string; const AType : TGorillaShaderNodeVariableType ) : TGorillaVariableNode ; overload virtual;
- public function AddDeclaration ( const AName : string; const AType : TGorillaShaderNodeVariableType; const ACustomTypeName : string ) : TGorillaVariableNode ; overload virtual;
- public function AddDeclaration ( const AName : string; const AType : TGorillaShaderNodeVariableType; const ACustomTypeName : string; const AIsArray : Boolean; const AArrayCount : Integer; const AValue : TValue ) : TGorillaVariableNode ; overload virtual;
- public procedure RemoveDeclaration ( const AName : string ) ; virtual;
- public function IndexOfDeclaration ( const AName : string ) : Integer ; virtual;
TGorillaTypeNode
Basis type for all complex data types inside of a shading language.
Ancestors
TGorillaStructTypeNode
Basis type node for structures inside of a shading language.
Ancestors
TGorillaVariableNode
Representing a variable declaration node, used by different other nodes, like struct, uniform, attributes or varying nodes
Ancestors
Members
Fields
Properties
- public Definition : TGorillaShaderNodeVariable
Get or set internal variable definition structure holding information about the variable type and preset value.
read FDefinition
write FDefinition
TGorillaOperationNode
Providing a operation node used for code calculations and conditions, like addition, multiplication or comparisons.
Ancestors
Members
Fields
Methods
- public constructor Create ( ABuilder : TGorillaNodeBuilder ) ;
- public destructor Destroy ( ) ;
- public function Build
(
const
ABuilder :
TGorillaNodeBuilder; const
AOp :
TGorillaShaderNodeOperator; const
ALeft :
TGorillaNodeEntity; const
ARight :
TGorillaNodeEntity
)
: TGorillaOperationNode
;
class virtual;
Static function to easily build a new operation node. The node is not added anywhere, afterwards you need to attach it to another node, to prevent memory leaks.
- public function ToString ( ) : string ; override;
Properties
TGorillaConstantNode
Providing a constant value node supporting the following types: Boolean, Integer, Single, TPoint, TPointF, TPoint3D, TVector3D, TAlphaColorF, TMatrix3D
Ancestors
Members
Fields
Methods
- public constructor Create ( ABuilder : TGorillaNodeBuilder ) ;
- public destructor Destroy ( ) ;
- public function Build
(
const
ABuilder :
TGorillaNodeBuilder; const
AName :
string; const
AValue :
TValue
)
: TGorillaConstantNode
;
class virtual;
Static function to easily build a new constant node. The node is not added anywhere, afterwards you need to attach it to another node, to prevent memory leaks.
Properties
TGorillaStatementNode
Providing a node for statements / expressions.
Remarks
This node contains statements and operator nodes for building building a shader source code.Ancestors
Members
TGorillaReferenceNode
Ancestors
Members
Fields
Methods
- protected procedure SetOwner ( const AValue : TGorillaNodeEntity ) ;
- public function Build
(
ABuilder :
TGorillaNodeBuilder; AOwner :
TGorillaNodeEntity
)
: TGorillaReferenceNode
;
class virtual;
Static function to easily build a new reference node. The node is not added anywhere, afterwards you need to attach it to another node, to prevent memory leaks.
- public function ToString ( ) : string ; override;
Properties
TGorillaForLoopNode
Representing a for-loop source code with containing statments.
Ancestors
Members
TGorillaSurfaceInputNode
Default surface shader input structure type.
Ancestors
TGorillaSurfaceOutputNode
Default surface shader output structure type. You are allowed to individually define the returned fields.
Ancestors
TGorillaSurfaceShaderNode
The scriptable shader library allows to include individual computation nodes on top of the basis lighting computation. To attach special treatment extend the TGorillaSurfaceShaderNode and add your code.
Remarks
By this shader node you do not need to rewrite lighting computation on your own.
Each SurfaceShaderNode expects an input and output structure, provided as extended classes of TGorillaSurfaceInputNode and TGorillaSurfaceOutputNode types.
Ancestors
Members
Fields
Properties
TGorillaEntryPointNode
Providing a node type for an entry point into the shader program, f.e. by the main() function.
Remarks
In GLSL each shader needs an entry point function which will be executed on startup. From that point on, everything else gets included.
This node type will automatically encapsulate all attached nodes.
void main(){ ... }