Duckcpp 2.1.0
Duckcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
dcpp::video::IMaterialRendererServices Class Referenceabstract

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

#include <duckcpp/core/engine/IMaterialRendererServices.hpp>

Public Member Functions

virtual ~IMaterialRendererServices ()
 Destructor.
 
virtual void setBasicRenderStates (const SMaterial &material, const SMaterial &lastMaterial, bool resetAllRenderstates)=0
 Can be called by an IMaterialRenderer to make its work easier.
 
virtual i32 getVertexShaderConstantID (const c8 *name)=0
 Return an index constant for the vertex shader based on a name.
 
virtual bool setVertexShaderConstant (i32 index, const f32 *floats, int count)=0
 Sets a constant for the vertex shader based on a name.
 
virtual bool setVertexShaderConstant (i32 index, const i32 *ints, int count)=0
 Int interface for the above.
 
virtual bool setVertexShaderConstant (i32 index, const u32 *ints, int count)=0
 Uint interface for the above.
 
virtual void setVertexShaderConstant (const f32 *data, i32 startRegister, i32 constantAmount=1)=0
 Sets a vertex shader constant.
 
virtual i32 getPixelShaderConstantID (const c8 *name)=0
 Return an index constant for the pixel shader based on a name.
 
virtual bool setPixelShaderConstant (i32 index, const f32 *floats, int count)=0
 Sets a constant for the pixel shader based on a name.
 
virtual bool setPixelShaderConstant (i32 index, const i32 *ints, int count)=0
 Int interface for the above.
 
virtual bool setPixelShaderConstant (i32 index, const u32 *ints, int count)=0
 Uint interface for the above.
 
virtual void setPixelShaderConstant (const f32 *data, i32 startRegister, i32 constantAmount=1)=0
 Sets a pixel shader constant.
 
DCPP_DEPRECATED bool setVertexShaderConstant (const c8 *name, const f32 *floats, int count)
 
DCPP_DEPRECATED bool setVertexShaderConstant (const c8 *name, const i32 *ints, int count)
 
DCPP_DEPRECATED bool setPixelShaderConstant (const c8 *name, const f32 *floats, int count)
 
DCPP_DEPRECATED bool setPixelShaderConstant (const c8 *name, const i32 *ints, int count)
 
virtual IVideoDrivergetVideoDriver ()=0
 Get pointer to the IVideoDriver interface.
 

Detailed Description

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

Member Function Documentation

◆ getVideoDriver()

virtual IVideoDriver * dcpp::video::IMaterialRendererServices::getVideoDriver ( )
pure virtual

Get pointer to the IVideoDriver interface.

Returns
Pointer to the IVideoDriver interface

◆ setBasicRenderStates()

virtual void dcpp::video::IMaterialRendererServices::setBasicRenderStates ( const SMaterial material,
const SMaterial lastMaterial,
bool  resetAllRenderstates 
)
pure virtual

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, gouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and fog enabling.

Parameters
materialThe new material to be used.
lastMaterialThe material used until now.
resetAllRenderstatesSet to true if all renderstates should be set, regardless of their current state.

◆ setPixelShaderConstant() [1/4]

DCPP_DEPRECATED bool dcpp::video::IMaterialRendererServices::setPixelShaderConstant ( const c8 name,
const f32 floats,
int  count 
)
inline
Deprecated:
. This method may be removed by Duckcpp 2.0

◆ setPixelShaderConstant() [2/4]

DCPP_DEPRECATED bool dcpp::video::IMaterialRendererServices::setPixelShaderConstant ( const c8 name,
const i32 ints,
int  count 
)
inline
Deprecated:
. This method may be removed by Duckcpp 2.0

◆ setPixelShaderConstant() [3/4]

virtual void dcpp::video::IMaterialRendererServices::setPixelShaderConstant ( const f32 data,
i32  startRegister,
i32  constantAmount = 1 
)
pure virtual

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
dataData to be set in the constants
startRegisterFirst register to be set.
constantAmountAmount of registers to be set. One register consists of 4 floats.

◆ setPixelShaderConstant() [4/4]

virtual bool dcpp::video::IMaterialRendererServices::setPixelShaderConstant ( i32  index,
const f32 floats,
int  count 
)
pure virtual

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
indexIndex of the variable
floatsPointer to array of floats
countAmount of floats in array.
Returns
True if successful.

◆ setVertexShaderConstant() [1/4]

DCPP_DEPRECATED bool dcpp::video::IMaterialRendererServices::setVertexShaderConstant ( const c8 name,
const f32 floats,
int  count 
)
inline
Deprecated:
. This method may be removed by Duckcpp 2.0

◆ setVertexShaderConstant() [2/4]

DCPP_DEPRECATED bool dcpp::video::IMaterialRendererServices::setVertexShaderConstant ( const c8 name,
const i32 ints,
int  count 
)
inline
Deprecated:
. This method may be removed by Duckcpp 2.0

◆ setVertexShaderConstant() [3/4]

virtual void dcpp::video::IMaterialRendererServices::setVertexShaderConstant ( const f32 data,
i32  startRegister,
i32  constantAmount = 1 
)
pure virtual

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
dataData to be set in the constants
startRegisterFirst register to be set
constantAmountAmount of registers to be set. One register consists of 4 floats.

◆ setVertexShaderConstant() [4/4]

virtual bool dcpp::video::IMaterialRendererServices::setVertexShaderConstant ( i32  index,
const f32 floats,
int  count 
)
pure virtual

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. 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 IShaderConstantSetCallBack derived class like this:

virtual void OnSetConstants(video::IMaterialRendererServices* services, i32 userData)
{
video::IVideoDriver* driver = services->getVideoDriver();
f32 time = (f32)os::Timer::getTime()/100000.0f;
services->setVertexShaderConstant("fTime", &time, 1);
worldViewProj *= driver->getTransform(video::ETS_VIEW);
worldViewProj *= driver->getTransform(video::ETS_WORLD);
services->setVertexShaderConstant("mWorldViewProj", worldViewProj.M, 16);
}
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Definition matrix4.hpp:49
Interface providing some methods for changing advanced, internal states of a IVideoDriver.
Definition IMaterialRendererServices.hpp:21
virtual bool setVertexShaderConstant(i32 index, const f32 *floats, int count)=0
Sets a constant for the vertex shader based on a name.
virtual IVideoDriver * getVideoDriver()=0
Get pointer to the IVideoDriver interface.
Interface to driver which is able to perform 2d and 3d graphics functions.
Definition IVideoDriver.hpp:152
virtual const nub::matrix4 & getTransform(E_TRANSFORMATION_STATE state) const =0
Returns the transformation set by setTransform.
@ ETS_PROJECTION
Projection transformation.
Definition IVideoDriver.hpp:60
@ ETS_VIEW
View transformation.
Definition IVideoDriver.hpp:56
@ ETS_WORLD
World transformation.
Definition IVideoDriver.hpp:58
signed int i32
32 bit signed variable.
Definition irrTypes.hpp:72
float f32
32 bit floating point variable.
Definition irrTypes.hpp:110
Parameters
indexIndex of the variable
floatsPointer to array of floats
countAmount of floats in array.
Returns
True if successful.

The documentation for this class was generated from the following file:

Duckcpp    @cppfx.xyz