Class TMaterialRendererServices

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TMaterialRendererServices = class(TWrapper)

Description

Interface providing some methods for changing advanced, internal states of a TVideoDriver.

Hierarchy

Overview

Methods

Public constructor Create(NRef: Pointer; NDriver: TReferenceCounted);
Public procedure SetBasicRenderStates(Material, LastMaterial: PMaterial; ResetAllRenderStates: Boolean); inline;
Public procedure SetPixelShaderConstant(StartRegister: LongInt; Data: PSingle; Registers: LongInt); overload; inline;
Public procedure SetPixelShaderConstant(const Name: AnsiString; Data: PSingle; Registers: LongInt); overload; inline;
Public procedure SetPixelShaderConstant(const Name: AnsiString; Data: array of Single); overload;
Public procedure SetPixelShaderConstant(StartRegister: LongInt; Data: array of Single); overload;
Public procedure SetVertexShaderConstant(const Name: AnsiString; Data: PSingle; Registers: LongInt); overload; inline;
Public procedure SetVertexShaderConstant(StartRegister: LongInt; Data: PSingle; Registers: LongInt); overload; inline;
Public procedure SetVertexShaderConstant(StartRegister: LongInt; Data: array of Single); overload;
Public procedure SetVertexShaderConstant(const Name: AnsiString; Data: array of Single); overload;

Properties

Public property VideoDriver: TReferenceCounted read FDriver;

Description

Methods

Public constructor Create(NRef: Pointer; NDriver: TReferenceCounted);

Constructor. Only used internally.

Public procedure SetBasicRenderStates(Material, LastMaterial: PMaterial; ResetAllRenderStates: Boolean); inline;

Can be called by an IMaterialRenderer to make its work easier.
Sets all basic renderstates if needed. Basic render states are diffuse, ambient, specular, and emissive color, specular power, bilinear and trilinear filtering, wireframe mode, grouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and fog enabling.

Parameters
Material
The new material to be used.
LastMaterial
The material used until now.
ResetAllRenderstates
Set to true if all renderstates should be set, regardless of their current state.
Public procedure SetPixelShaderConstant(StartRegister: LongInt; Data: PSingle; Registers: LongInt); overload; inline;

Sets a pixel shader constant.
Can be used if you created a shader using pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program.

Parameters
StartRegister
First register to be set.
Data
Data to be set in the constants. One register consists of 4 floats.
Registers
The number of registers Data is pointing to. One register consists of 4 floats.
Public procedure SetPixelShaderConstant(const Name: AnsiString; Data: PSingle; Registers: LongInt); overload; inline;

Sets a constant by pointer for the pixel shader based on a name.
This can be used if you used a high level shader language like GLSL or HLSL to create a shader. See SetVertexShaderConstant() for an example on how to use this.

Parameters
Name
variable name.
Data
Data to be set in the constants.
Registers
The number of registers Data is pointing to. One register consists of 4 floats.
Public procedure SetPixelShaderConstant(const Name: AnsiString; Data: array of Single); overload;

Sets a constant for the pixel shader based on a name.
This can be used if you used a high level shader language like GLSL or HLSL to create a shader. See SetVertexShaderConstant() for an example on how to use this.

Parameters
Name
variable name.
Data
Data to be set in the constants.
Public procedure SetPixelShaderConstant(StartRegister: LongInt; Data: array of Single); overload;

Sets a pixel shader constant.
Can be used if you created a shader using pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program.

Parameters
StartRegister
First register to be set.
Data
Data to be set in the constants. One register consists of 4 floats.
Public procedure SetVertexShaderConstant(const Name: AnsiString; Data: PSingle; Registers: LongInt); overload; inline;

Sets a constant by pointer for the vertex shader based on a name.
This can be used if you used a high level shader language like GLSL or HLSL to create a shader. See SetVertexShaderConstant() for an example on how to use this.
This can be used if you used a high level shader language like GLSL or HLSL to create a shader.
Example: If you created a shader which has variables named 'mWorldViewProj' (containing the WorldViewProjection matrix) and another one named 'fTime' containing one float, you can set them in your TShaderConstantSetCallBack derived class like this:

        procedure HandleSetConstants(Services: TMaterialRendererServices; UserData: LongWord);
        var Time: array[0..0] of Single;
            WorldViewProj: TMatrix4;
        begin
            with Services do begin
                Time[0] = TTimer.Time/100000;
                SetVertexShaderConstant("fTime", Time);

                WorldViewProj := VideoDriver.GetTransform(tsProjection) * 
                                 VideoDriver.GetTransform(tsView) * 
                                 VideoDriver.GetTransform(tsWorld);
                SetVertexShaderConstant("mWorldViewProj", WorldViewProj);
        end;
                

Parameters
Name
variable name.
Data
Data to be set in the constants.
Registers
The number of floats Data is pointing to.
Public procedure SetVertexShaderConstant(StartRegister: LongInt; Data: PSingle; Registers: LongInt); overload; inline;

Sets a vertex shader constant by pointer.
Can be used if you created a shader using pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program.

Parameters
StartRegister
First register to be set.
Data
Data to be set in the constants. One register consists of 4 floats.
Registers
The number of floats Data is pointing to.
Public procedure SetVertexShaderConstant(StartRegister: LongInt; Data: array of Single); overload;

Sets a vertex shader constant.
Can be used if you created a shader using pixel/vertex shader assembler or ARB_fragment_program or ARB_vertex_program.

Parameters
StartRegister
First register to be set.
Data
Data to be set in the constants. One register consists of 4 floats.
Public procedure SetVertexShaderConstant(const Name: AnsiString; Data: array of Single); overload;

Sets a constant for the vertex shader based on a name.
This can be used if you used a high level shader language like GLSL or HLSL to create a shader. See SetVertexShaderConstant() for an example on how to use this.

Properties

Public property VideoDriver: TReferenceCounted read FDriver;

The associated video driver.


Generated by PasDoc 0.12.1 on 2012-09-14 17:32:22