Description | Hierarchy | Fields | Methods | Properties |
type TShaderConstantSetCallback = class(TWrapper)
Callback base class making it possible to set constants for GPU programs every frame.
Implement this class and pass an instance of it to one of the methods in TGPUProgrammingServices when creating a shader. The HandleSetConstants method will be called every frame now.
![]() |
constructor Create(NVideoDriver: TReferenceCounted); |
![]() |
destructor Destroy; override; |
![]() |
procedure HandleSetConstants(Services: TMaterialRendererServices; UserData: LongInt); virtual; abstract; |
![]() |
procedure HandleSetMaterial(Material: PMaterial); virtual; |
![]() |
property VideoDriver: TReferenceCounted read FDriver; |
![]() |
constructor Create(NVideoDriver: TReferenceCounted); |
Constructor. Parameters
|
![]() |
destructor Destroy; override; |
Destructor. |
![]() |
procedure HandleSetConstants(Services: TMaterialRendererServices; UserData: LongInt); virtual; abstract; |
Called by the engine when the vertex and/or pixel shader constants for an material renderer should be set. procedure TMyCallback.HandleSetConstants(Services: TMaterialRendererServices; UserData: LongInt); var WorldViewProj: TMatrix4; Col: TFloatColor; begin // set clip matrix at register 4 with Services.VideoDriver as TVideoDriver do WorldViewProj := GetTransform(tsProjection) * GetTransform(tsView) * GetTransform(tsWorld); Services.SetVertexShaderConstant(4, WorldViewProj.Elements); // set some light color at register 9 Col := FloatColor(0, 1, 1, 0); Services.SetVertexShaderConstant(9, @Col.Alpha, 1); end;
Parameters
|
![]() |
procedure HandleSetMaterial(Material: PMaterial); virtual; |
Called to let the callback know the used material (optional method). |
![]() |
property VideoDriver: TReferenceCounted read FDriver; |
The video driver associated with this callback. |