Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

RmShader Class Reference

Shader. More...

#include <RmEffect.h>

Inheritance diagram for RmShader:

RmNode RmHLShader RmGLShader RmHLSLShader List of all members.

Public Member Functions

 RmShader ()
 Default Constructor.

virtual ~RmShader ()
 Destructor.

virtual void Update (RmNodeUpdateType nodeUpdateType, RmNode *pRmUpdateRootNode)
 Update.

virtual bool LoadXMLData (int hDoc, const RM_TCHAR *strXPath, const RM_TCHAR *strRmXMLVersion)
 Load node data from XML.

virtual bool SaveXMLData (int hDoc, const RM_TCHAR *strXPath)
 Save node data to XML.

virtual const RM_TCHAR * GetDescription ()
virtual RmNodeClone (bool bIncludeLoadedData)
 Clone this node.

virtual bool IsHighLevel ()
 Is high level.

virtual void DeleteConstant (int nRegister)
 Delete shader constant.

virtual void DeleteConstant (const RM_TCHAR *strConstantName)
 Delete constant.

virtual void DeleteAllConstants ()
 Delete alll constants.

virtual bool AddConstant (RmShaderConstant *pConstant)
 Add constant.

virtual RmShaderConstantGetConstant (int nRegister)
 Get constant.

virtual RmShaderConstantGetConstant (const RM_TCHAR *strConstantName)
 Get constant.

virtual RmShaderConstantGetConstantByIndex (int nIndex)
 Get constant.

virtual int GetNumConstants () const
 Get number of constants.

virtual RmShaderConstantListIterator BeginConstants ()
 Begin iterator.

virtual RmShaderConstantListConstIterator BeginConstants () const
 Begin iterator.

virtual RmShaderConstantListIterator EndConstants ()
 End iterator.

virtual RmShaderConstantListConstIterator EndConstants () const
 End iterator.

void SetCode (const RM_TCHAR *strCode)
 Set code.

const RmStringT & GetShaderCode () const
 Get shader code.

void GetMaxInstructionInfo (int &nMaxALUInstructions, int &nMaxTexInstructions)
 Get max instruction info.

void SetMaxInstructionInfo (int nMaxALUInstructions, int nMaxTexInstructions)
 Set max instruction info.

RM_TCHAR * GetFullName ()
 Get full name.

RM_TCHAR * GetFullNameWithAPI ()
 Get fulll name with API.

int GetHandle ()
 Get handle.

void SetHandle (int nHandle)
 Set Handle.

bool IsModified () const
 Is modified.

void SetModified (bool bModified)
 Set modify flag.

bool IsPixelShader ()
 Is pixekl shader.

bool IsVertexShader ()
 Is vertex shader.

void SetIsPixelShader (bool bPixelShader)
 Set is pixel shader.


Protected Member Functions

virtual void CopyNodeData (RmNode *pDestinationNode, bool bIncludeLoadedData)
 Copy node data.

virtual void SetType (const RM_TCHAR *strNewType)
 Set type.

virtual RmNodeTypeChildRuleListGetNodeTypeChildRuleList ()
 Parent / Child rule list function.

virtual void SetNodeTypeChildRuleList (RmNodeTypeChildRuleList *pRmNodeChildRuleList)
 Sets the node child rule list for the given node.


Protected Attributes

RmStringT m_strCode
 Shader.

bool m_bModified
 Denotes whether this shader has been modified and needs to be compiled before using.

int m_nHandle
 Handle to the compiled.

RmShaderConstantList m_constantList
 List of shader constants (variables.

bool m_bPixelShader
 A flag that denotes whether this shader is a pixel or a vertex shader.

int m_nMaxALUInstructions
 Max number of arithmetic shader instructions.

int m_nMaxTexInstructions
 Max number of texture shader instructions.


Detailed Description

Shader.

RmShader is the base class for representing shaders in the RenderMonkey effect database. However RmShader is n o t an abstract class since assembly shaders can be represented by using this class. High level shaders will be represented by other derived classes specific for their API.


Constructor & Destructor Documentation

RmShader::RmShader  ) 
 

Default Constructor.

Default constructor

virtual RmShader::~RmShader  )  [virtual]
 

Destructor.

Destructor


Member Function Documentation

virtual bool RmShader::AddConstant RmShaderConstant pConstant  )  [virtual]
 

Add constant.

Add new constant to the shader. Note that if the shader already has a constant with the same name or mapped to the same register (unless its register nIndex is set to -1) the old constant node will be deleted and replaced with the newly specified constant.

Parameters:
pConstant Shader Constant to delete
See also:
RmShaderConstant
Returns:
True on success

virtual RmShaderConstantListConstIterator RmShader::BeginConstants  )  const [inline, virtual]
 

Begin iterator.

Begin Iterator

Returns:
Begin Iterator

virtual RmShaderConstantListIterator RmShader::BeginConstants  )  [inline, virtual]
 

Begin iterator.

Begin Iterator

Returns:
Begin Iterator

virtual RmNode* RmShader::Clone bool  bIncludeLoadedData  )  [virtual]
 

Clone this node.

Creates a clone of this node

Returns:
Cloned node. Returns NULL if cloning failed.

Reimplemented from RmNode.

Reimplemented in RmHLShader, RmHLSLShader, and RmGLShader.

virtual void RmShader::CopyNodeData RmNode pDestinationNode,
bool  bIncludeLoadedData
[protected, virtual]
 

Copy node data.

Copies this node's contents (not including children) into the destination node. See RmNode::CopyNodeData for details

Parameters:
pDestinationNode the destination node
Returns:
None

Reimplemented from RmNode.

Reimplemented in RmHLShader, RmHLSLShader, and RmGLShader.

virtual void RmShader::DeleteAllConstants  )  [virtual]
 

Delete alll constants.

Delete all constants for this shader

Returns:
None

virtual void RmShader::DeleteConstant const RM_TCHAR *  strConstantName  )  [virtual]
 

Delete constant.

Delete shader constant with a given name

Parameters:
strConstantName Constant name to delete
Returns:
None

virtual void RmShader::DeleteConstant int  nRegister  )  [virtual]
 

Delete shader constant.

Delete shader constant linked to a given register (by nIndex)

Parameters:
nRegistr Index of shader constant to delete
Returns:
None

virtual RmShaderConstantListConstIterator RmShader::EndConstants  )  const [inline, virtual]
 

End iterator.

End Iterator

Returns:
End Iterator

virtual RmShaderConstantListIterator RmShader::EndConstants  )  [inline, virtual]
 

End iterator.

End Iterator

Returns:
End Iterator

virtual RmShaderConstant* RmShader::GetConstant const RM_TCHAR *  strConstantName  )  [virtual]
 

Get constant.

Retrieve shader constant given its name. Returns NULL if no matching constant is found

Parameters:
strConstantName name of constant
Returns:
ShaderConstant
See also:
RmShaderConstant

virtual RmShaderConstant* RmShader::GetConstant int  nRegister  )  [virtual]
 

Get constant.

Retrieve shader constant that's mapped to the specified register (using register nIndex). Returns NULL if no matching constant is found.

Parameters:
nRegister Index of constants
Returns:
ShaderConstant
See also:
RmShaderConstant

virtual RmShaderConstant* RmShader::GetConstantByIndex int  nIndex  )  [virtual]
 

Get constant.

Retrieve shader constant by nIndex.

Parameters:
nIndex Index to constants
Returns:
ShaderConstant
See also:
RmShaderConstant

virtual const RM_TCHAR* RmShader::GetDescription  )  [virtual]
 

Returns description of the node: used for displaying a tooltip in the workspace tree view for the given node.

Returns:
Returns description string

Reimplemented from RmNode.

Reimplemented in RmHLShader, RmHLSLShader, and RmGLShader.

RM_TCHAR* RmShader::GetFullName  ) 
 

Get full name.

Retrieve full name of the shader in the form "Effect_Name / Pass_Name / Shader_Name "

Returns:
Full name string

RM_TCHAR* RmShader::GetFullNameWithAPI  ) 
 

Get fulll name with API.

Retrieve full name of the shader with the API string for the shader in the form: "API(x) /Effect_Name / Pass_Name / Shader_Name "

Returns:
Fulll name string with API

int RmShader::GetHandle  )  [inline]
 

Get handle.

Retrieve handle to the compiled shader

Returns:
Handle to shader

void RmShader::GetMaxInstructionInfo int &  nMaxALUInstructions,
int &  nMaxTexInstructions
[inline]
 

Get max instruction info.

Returns the maximum instruction counts (set by compiler)

Parameters:
nMaxALUInstructions max ALU instructions
nMaxTexInstructions max Tex instructions

virtual RmNodeTypeChildRuleList* RmShader::GetNodeTypeChildRuleList  )  [inline, protected, virtual]
 

Parent / Child rule list function.

Retrieves the rule list for adding child nodes for a given node type

Returns:
Returns node type child list rules

Reimplemented from RmNode.

Reimplemented in RmHLShader, RmHLSLShader, and RmGLShader.

virtual int RmShader::GetNumConstants  )  const [inline, virtual]
 

Get number of constants.

Returns number of samplers

const RmStringT& RmShader::GetShaderCode  )  const [inline]
 

Get shader code.

Retrieve shader code string

Returns:
Shader code string

virtual bool RmShader::IsHighLevel  )  [inline, virtual]
 

Is high level.

Returns whether this shader is an assembly shader or a high level language shader. True means it is a high level language shader and false means that it's an assembly shader

Returns:
True if this Shader is high level

RmShader itself is always an assembly shader:

Reimplemented in RmHLShader.

bool RmShader::IsModified  )  const [inline]
 

Is modified.

Returns whether a shader has been modified

Returns:
True if shader is modified

bool RmShader::IsPixelShader  )  [inline]
 

Is pixekl shader.

Returns whether this shader node is a pixel shader

Returns:
True if this shader is a pixel shader

bool RmShader::IsVertexShader  )  [inline]
 

Is vertex shader.

Returns whether this shader node is a vertex shader

Returns:
True if this shader is a vertex shader

virtual bool RmShader::LoadXMLData int  hDoc,
const RM_TCHAR *  strXPath,
const RM_TCHAR *  strRmXMLVersion
[virtual]
 

Load node data from XML.

Loads versioned XML node data. Note that this method will only load the contents of each node, not the data for all of the children nodes. Each child will have its own XML loading function called by the API.

Parameters:
hDoc Handle to the XML document
strXPath Node path in XML
strRmXMLVersion XML version
Returns:
True if load succeeded. False otherwise.

Reimplemented from RmNode.

Reimplemented in RmHLShader, RmHLSLShader, and RmGLShader.

virtual bool RmShader::SaveXMLData int  hDoc,
const RM_TCHAR *  strXPath
[virtual]
 

Save node data to XML.

Saves node's contents to XML. Note that this method will only save the contents of each node, not the data for all of the children nodes. Each child will have its own XML saving function called by the API.

Parameters:
hDoc Handle to the XML document
strXPath Node path in XML
Returns:
True if save succeeded. False otherwise.

Reimplemented from RmNode.

Reimplemented in RmHLShader, RmHLSLShader, and RmGLShader.

void RmShader::SetCode const RM_TCHAR *  strCode  ) 
 

Set code.

Set new code string - if code string already exists, it gets replaced

Parameters:
strCode Code to set
Returns:
None

void RmShader::SetHandle int  nHandle  )  [inline]
 

Set Handle.

Set handle to the compiled shader resource

Parameters:
nHandle Handle to shader
Returns:
None

void RmShader::SetIsPixelShader bool  bPixelShader  )  [inline]
 

Set is pixel shader.

Sets whether this shader node is a pixel shader: true means that it is a pixel shader, false - that it's a vertex shader

Parameters:
bPixelShader Flag to be pixel shader or not

void RmShader::SetMaxInstructionInfo int  nMaxALUInstructions,
int  nMaxTexInstructions
[inline]
 

Set max instruction info.

Sets the maximum instruction counts (set by compiler)

Parameters:
nMaxALUInstructions max ALU instructions
nMaxTexInstructions max Tex instructions

void RmShader::SetModified bool  bModified  )  [inline]
 

Set modify flag.

Sets whether the shader has been modified or not

Parameters:
bModified Modify flag
Returns:
None

virtual void RmShader::SetNodeTypeChildRuleList RmNodeTypeChildRuleList pRmNodeChildRuleList  )  [inline, protected, virtual]
 

Sets the node child rule list for the given node.

Sets the child addition rule list for the given node.

Parameters:
pRmNodeChildRuleList new node rules list
None 

Reimplemented from RmNode.

Reimplemented in RmHLShader, RmHLSLShader, and RmGLShader.

virtual void RmShader::SetType const RM_TCHAR *  strNewType  )  [inline, protected, virtual]
 

Set type.

Compose the type string chain

Parameters:
strNewType New type string

Reimplemented from RmNode.

Reimplemented in RmHLShader, RmHLSLShader, and RmGLShader.

virtual void RmShader::Update RmNodeUpdateType  nodeUpdateType,
RmNode pRmUpdateRootNode
[virtual]
 

Update.

Updates the internal values of the node

Parameters:
nodeUpdateType Update type
See also:
RmNodeUpdateType
Parameters:
pRmUpdateRootNode Root node for update
Returns:
None

Reimplemented from RmNode.

Reimplemented in RmHLShader, RmHLSLShader, and RmGLShader.


The documentation for this class was generated from the following file:
Generated on Fri Feb 25 16:09:21 2005 for RenderMonkey SDK by doxygen 1.3.6