HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ShaderMaterial Class Referenceabstract

#include <ShaderMaterial.h>

+ Inheritance diagram for ShaderMaterial:

Public Member Functions

 ShaderMaterial ()
 
virtual ~ShaderMaterial ()
 
void setDocument (DocumentPtr doc)
 Set the renderable element associated with this ShaderMaterial. More...
 
DocumentPtr getDocument () const
 Return the document associated with this ShaderMaterial. More...
 
void setElement (TypedElementPtr val)
 Set the renderable element associated with this ShaderMaterial. More...
 
TypedElementPtr getElement () const
 Return the renderable element associated with this ShaderMaterial. More...
 
void setMaterialNode (NodePtr node)
 Set the ShaderMaterial node associated with this ShaderMaterial. More...
 
NodePtr getMaterialNode () const
 Return the ShaderMaterial node associated with this ShaderMaterial. More...
 
void setUdim (const std::string &val)
 Set udim identifier. More...
 
const std::stringgetUdim ()
 Get any associated udim identifier. More...
 
virtual bool loadSource (const FilePath &vertexShaderFile, const FilePath &pixelShaderFile, bool hasTransparency)=0
 Load shader source from file. More...
 
virtual bool generateShader (GenContext &context)=0
 
virtual void copyShader (MaterialPtr ShaderMaterial)=0
 Copies shader and API specific generated program from ShaderMaterial to this one. More...
 
virtual bool generateShader (ShaderPtr hwShader)=0
 Generate a shader from the given hardware shader. More...
 
virtual bool generateEnvironmentShader (GenContext &context, const FilePath &filename, DocumentPtr stdLib, const FilePath &imagePath)
 Generate an environment background shader. More...
 
ShaderPtr getShader () const
 Return the underlying hardware shader. More...
 
bool hasTransparency () const
 Return true if this ShaderMaterial has transparency. More...
 
virtual bool bindShader () const =0
 Bind shader. More...
 
virtual void bindViewInformation (CameraPtr camera)=0
 Bind viewing information for this ShaderMaterial. More...
 
virtual void bindImages (ImageHandlerPtr imageHandler, const FileSearchPath &searchPath, bool enableMipmaps=true)=0
 Bind all images for this ShaderMaterial. More...
 
virtual void unbindImages (ImageHandlerPtr imageHandler)=0
 Unbbind all images for this ShaderMaterial. More...
 
virtual ImagePtr bindImage (const FilePath &filePath, const std::string &uniformName, ImageHandlerPtr imageHandler, const ImageSamplingProperties &samplingProperties)=0
 Bind a single image. More...
 
virtual void bindLighting (LightHandlerPtr lightHandler, ImageHandlerPtr imageHandler, const ShadowState &shadowState)=0
 Bind lights to shader. More...
 
virtual void bindMesh (MeshPtr mesh)=0
 Bind the given mesh to this ShaderMaterial. More...
 
virtual bool bindPartition (MeshPartitionPtr part) const =0
 Bind a mesh partition to this ShaderMaterial. More...
 
virtual void drawPartition (MeshPartitionPtr part) const =0
 Draw the given mesh partition. More...
 
virtual void unbindGeometry ()=0
 Unbind all geometry from this ShaderMaterial. More...
 
virtual VariableBlockgetPublicUniforms () const =0
 Return the block of public uniforms for this ShaderMaterial. More...
 
virtual ShaderPortfindUniform (const std::string &path) const =0
 Find a public uniform from its MaterialX path. More...
 
virtual void modifyUniform (const std::string &path, ConstValuePtr value, std::string valueString=EMPTY_STRING)=0
 Modify the value of the uniform with the given path. More...
 

Protected Member Functions

virtual void clearShader ()=0
 

Protected Attributes

ShaderPtr _hwShader
 
MeshPtr _boundMesh
 
DocumentPtr _doc
 
TypedElementPtr _elem
 
NodePtr _materialNode
 
std::string _udim
 
bool _hasTransparency
 
ImageVec _boundImages
 

Detailed Description

Abstract class for shader generation and rendering of a ShaderMaterial

Definition at line 39 of file ShaderMaterial.h.

Constructor & Destructor Documentation

ShaderMaterial::ShaderMaterial ( )
virtual ShaderMaterial::~ShaderMaterial ( )
virtual

Member Function Documentation

virtual ImagePtr ShaderMaterial::bindImage ( const FilePath filePath,
const std::string uniformName,
ImageHandlerPtr  imageHandler,
const ImageSamplingProperties samplingProperties 
)
pure virtual

Bind a single image.

Implemented in GlslMaterial.

virtual void ShaderMaterial::bindImages ( ImageHandlerPtr  imageHandler,
const FileSearchPath searchPath,
bool  enableMipmaps = true 
)
pure virtual

Bind all images for this ShaderMaterial.

Implemented in GlslMaterial.

virtual void ShaderMaterial::bindLighting ( LightHandlerPtr  lightHandler,
ImageHandlerPtr  imageHandler,
const ShadowState shadowState 
)
pure virtual

Bind lights to shader.

Implemented in GlslMaterial.

virtual void ShaderMaterial::bindMesh ( MeshPtr  mesh)
pure virtual

Bind the given mesh to this ShaderMaterial.

Implemented in GlslMaterial.

virtual bool ShaderMaterial::bindPartition ( MeshPartitionPtr  part) const
pure virtual

Bind a mesh partition to this ShaderMaterial.

Implemented in GlslMaterial.

virtual bool ShaderMaterial::bindShader ( ) const
pure virtual

Bind shader.

Implemented in GlslMaterial.

virtual void ShaderMaterial::bindViewInformation ( CameraPtr  camera)
pure virtual

Bind viewing information for this ShaderMaterial.

Implemented in GlslMaterial.

virtual void ShaderMaterial::clearShader ( )
protectedpure virtual

Implemented in GlslMaterial.

virtual void ShaderMaterial::copyShader ( MaterialPtr  ShaderMaterial)
pure virtual

Copies shader and API specific generated program from ShaderMaterial to this one.

Implemented in GlslMaterial.

virtual void ShaderMaterial::drawPartition ( MeshPartitionPtr  part) const
pure virtual

Draw the given mesh partition.

Implemented in GlslMaterial.

virtual ShaderPort* ShaderMaterial::findUniform ( const std::string path) const
pure virtual

Find a public uniform from its MaterialX path.

Implemented in GlslMaterial.

virtual bool ShaderMaterial::generateEnvironmentShader ( GenContext context,
const FilePath filename,
DocumentPtr  stdLib,
const FilePath imagePath 
)
virtual

Generate an environment background shader.

virtual bool ShaderMaterial::generateShader ( GenContext context)
pure virtual

Generate a shader from our currently stored element and the given generator context.

Implemented in GlslMaterial.

virtual bool ShaderMaterial::generateShader ( ShaderPtr  hwShader)
pure virtual

Generate a shader from the given hardware shader.

Implemented in GlslMaterial.

DocumentPtr ShaderMaterial::getDocument ( ) const

Return the document associated with this ShaderMaterial.

TypedElementPtr ShaderMaterial::getElement ( ) const

Return the renderable element associated with this ShaderMaterial.

NodePtr ShaderMaterial::getMaterialNode ( ) const

Return the ShaderMaterial node associated with this ShaderMaterial.

virtual VariableBlock* ShaderMaterial::getPublicUniforms ( ) const
pure virtual

Return the block of public uniforms for this ShaderMaterial.

Implemented in GlslMaterial.

ShaderPtr ShaderMaterial::getShader ( ) const

Return the underlying hardware shader.

const std::string& ShaderMaterial::getUdim ( )

Get any associated udim identifier.

bool ShaderMaterial::hasTransparency ( ) const

Return true if this ShaderMaterial has transparency.

virtual bool ShaderMaterial::loadSource ( const FilePath vertexShaderFile,
const FilePath pixelShaderFile,
bool  hasTransparency 
)
pure virtual

Load shader source from file.

Implemented in GlslMaterial.

virtual void ShaderMaterial::modifyUniform ( const std::string path,
ConstValuePtr  value,
std::string  valueString = EMPTY_STRING 
)
pure virtual

Modify the value of the uniform with the given path.

Implemented in GlslMaterial.

void ShaderMaterial::setDocument ( DocumentPtr  doc)

Set the renderable element associated with this ShaderMaterial.

void ShaderMaterial::setElement ( TypedElementPtr  val)

Set the renderable element associated with this ShaderMaterial.

void ShaderMaterial::setMaterialNode ( NodePtr  node)

Set the ShaderMaterial node associated with this ShaderMaterial.

void ShaderMaterial::setUdim ( const std::string val)

Set udim identifier.

virtual void ShaderMaterial::unbindGeometry ( )
pure virtual

Unbind all geometry from this ShaderMaterial.

Implemented in GlslMaterial.

virtual void ShaderMaterial::unbindImages ( ImageHandlerPtr  imageHandler)
pure virtual

Unbbind all images for this ShaderMaterial.

Implemented in GlslMaterial.

Member Data Documentation

ImageVec ShaderMaterial::_boundImages
protected

Definition at line 158 of file ShaderMaterial.h.

MeshPtr ShaderMaterial::_boundMesh
protected

Definition at line 149 of file ShaderMaterial.h.

DocumentPtr ShaderMaterial::_doc
protected

Definition at line 151 of file ShaderMaterial.h.

TypedElementPtr ShaderMaterial::_elem
protected

Definition at line 152 of file ShaderMaterial.h.

bool ShaderMaterial::_hasTransparency
protected

Definition at line 156 of file ShaderMaterial.h.

ShaderPtr ShaderMaterial::_hwShader
protected

Definition at line 148 of file ShaderMaterial.h.

NodePtr ShaderMaterial::_materialNode
protected

Definition at line 153 of file ShaderMaterial.h.

std::string ShaderMaterial::_udim
protected

Definition at line 155 of file ShaderMaterial.h.


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