arsa  2.7
Public Member Functions | List of all members
irr::video::IMaterialRenderer Class Reference

Interface for material rendering. More...

#include <IMaterialRenderer.h>

Inheritance diagram for irr::video::IMaterialRenderer:
irr::IReferenceCounted

Public Member Functions

virtual void OnSetMaterial (const SMaterial &material, const SMaterial &lastMaterial, bool resetAllRenderstates, IMaterialRendererServices *services)
 Called by the IVideoDriver implementation the let the renderer set its needed render states. More...
 
virtual bool OnRender (IMaterialRendererServices *service, E_VERTEX_TYPE vtxtype)
 Called every time before a new bunch of geometry is being drawn using this material with for example drawIndexedTriangleList() call. More...
 
virtual void OnUnsetMaterial ()
 Called by the IVideoDriver to unset this material. More...
 
virtual bool isTransparent () const
 Returns if the material is transparent. More...
 
virtual s32 getRenderCapability () const
 Returns the render capability of the material. More...
 
virtual IShaderConstantSetCallBackgetShaderConstantSetCallBack () const
 Access the callback provided by the users when creating shader materials. More...
 
- Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor. More...
 
virtual ~IReferenceCounted ()
 Destructor. More...
 
void grab () const
 Grabs the object. Increments the reference counter by one. More...
 
bool drop () const
 Drops the object. Decrements the reference counter by one. More...
 
s32 getReferenceCount () const
 Get the reference count. More...
 
const c8getDebugName () const
 Returns the debug name of the object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from irr::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object. More...
 

Detailed Description

Interface for material rendering.

Can be used to extend the engine with new materials. Refer to IVideoDriver::addMaterialRenderer() for more information on how to extend the engine with new materials.

Definition at line 25 of file IMaterialRenderer.h.

Member Function Documentation

◆ getRenderCapability()

virtual s32 irr::video::IMaterialRenderer::getRenderCapability ( ) const
inlinevirtual

Returns the render capability of the material.

Because some more complex materials are implemented in multiple ways and need special hardware capabilities, it is possible to query how the current material renderer is performing on the current hardware with this function.

Returns
Returns 0 if everything is running fine. Any other value is material renderer specific and means for example that the renderer switched back to a fall back material because it cannot use the latest shaders. More specific examples: Fixed function pipeline materials should return 0 in most cases, parallax mapped material will only return 0 when at least pixel shader 1.4 is available on that machine.

Definition at line 94 of file IMaterialRenderer.h.

94 { return 0; }

◆ getShaderConstantSetCallBack()

virtual IShaderConstantSetCallBack* irr::video::IMaterialRenderer::getShaderConstantSetCallBack ( ) const
inlinevirtual

Access the callback provided by the users when creating shader materials.

Returns
Returns either the users provided callback or 0 when no such callback exists. Non-shader materials will always return 0.

Definition at line 99 of file IMaterialRenderer.h.

99 { return 0; }

◆ isTransparent()

virtual bool irr::video::IMaterialRenderer::isTransparent ( ) const
inlinevirtual

Returns if the material is transparent.

The scene management needs to know this for being able to sort the materials by opaque and transparent.

Definition at line 82 of file IMaterialRenderer.h.

82 { return false; }

◆ OnRender()

virtual bool irr::video::IMaterialRenderer::OnRender ( IMaterialRendererServices service,
E_VERTEX_TYPE  vtxtype 
)
inlinevirtual

Called every time before a new bunch of geometry is being drawn using this material with for example drawIndexedTriangleList() call.

OnSetMaterial should normally only be called if the renderer decides that the renderstates should be changed, it won't be called if for example two drawIndexedTriangleList() will be called with the same material set. This method will be called every time. This is useful for example for materials with shaders, which don't only set new renderstates but also shader constants.

Parameters
servicePointer to interface providing methods for setting constants and other things.
vtxtypeVertex type with which the next rendering will be done. This can be used by the material renderer to set some specific optimized shaders or if this is an incompatible vertex type for this renderer, to refuse rendering for example.
Returns
Returns true if everything is OK, and false if nothing should be rendered. The material renderer can choose to return false for example if he doesn't support the specified vertex type. This is actually done in D3D9 when using a normal mapped material with a vertex type other than EVT_TANGENTS.

Definition at line 72 of file IMaterialRenderer.h.

72 { return true; }

◆ OnSetMaterial()

virtual void irr::video::IMaterialRenderer::OnSetMaterial ( const SMaterial material,
const SMaterial lastMaterial,
bool  resetAllRenderstates,
IMaterialRendererServices services 
)
inlinevirtual

Called by the IVideoDriver implementation the let the renderer set its needed render states.

This is called during the IVideoDriver::setMaterial() call. When overriding this, you can set some renderstates or for example a vertex or pixel shader if you like.

Parameters
materialThe new material parameters to be set. The renderer may change the material flags in this material. For example if this material does not accept the zbuffer = true, it can set it to false. This is useful, because in the next lastMaterial will be just the material in this call.
lastMaterialThe material parameters which have been set before this material.
resetAllRenderstatesTrue if all renderstates should really be reset. This is usually true if the last rendering mode was not a usual 3d rendering mode, but for example a 2d rendering mode. You should reset really all renderstates if this is true, no matter if the lastMaterial had some similar settings. This is used because in most cases, some common renderstates are not changed if they are already there, for example bilinear filtering, wireframe, gouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and fogenable.
servicesInterface providing some methods for changing advanced, internal states of a IVideoDriver.

Definition at line 51 of file IMaterialRenderer.h.

52  {}

◆ OnUnsetMaterial()

virtual void irr::video::IMaterialRenderer::OnUnsetMaterial ( )
inlinevirtual

Called by the IVideoDriver to unset this material.

Called during the IVideoDriver::setMaterial() call before the new material will get the OnSetMaterial() call.

Definition at line 77 of file IMaterialRenderer.h.

77 {}

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