HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GlslMaterial Class Reference

#include <GlslMaterial.h>

+ Inheritance diagram for GlslMaterial:

Public Member Functions

 GlslMaterial ()
 
 ~GlslMaterial ()
 
bool loadSource (const FilePath &vertexShaderFile, const FilePath &pixelShaderFile, bool hasTransparency) override
 Load shader source from file. More...
 
bool generateShader (GenContext &context) override
 
bool generateShader (ShaderPtr hwShader) override
 Generate a shader from the given hardware shader. More...
 
void copyShader (MaterialPtr material) override
 Copy shader from one material to this one. More...
 
GlslProgramPtr getProgram () const
 Return the underlying GLSL program. More...
 
bool bindShader () const override
 Bind shader. More...
 
void bindViewInformation (CameraPtr camera) override
 Bind viewing information for this material. More...
 
void bindImages (ImageHandlerPtr imageHandler, const FileSearchPath &searchPath, bool enableMipmaps=true) override
 Bind all images for this material. More...
 
void unbindImages (ImageHandlerPtr imageHandler) override
 Unbbind all images for this material. More...
 
ImagePtr bindImage (const FilePath &filePath, const std::string &uniformName, ImageHandlerPtr imageHandler, const ImageSamplingProperties &samplingProperties) override
 Bind a single image. More...
 
void bindLighting (LightHandlerPtr lightHandler, ImageHandlerPtr imageHandler, const ShadowState &shadowState) override
 Bind lights to shader. More...
 
void bindMesh (MeshPtr mesh) override
 Bind the given mesh to this material. More...
 
bool bindPartition (MeshPartitionPtr part) const override
 Bind a mesh partition to this material. More...
 
void drawPartition (MeshPartitionPtr part) const override
 Draw the given mesh partition. More...
 
void unbindGeometry () override
 Unbind all geometry from this material. More...
 
VariableBlockgetPublicUniforms () const override
 Return the block of public uniforms for this material. More...
 
ShaderPortfindUniform (const std::string &path) const override
 Find a public uniform from its MaterialX path. More...
 
void modifyUniform (const std::string &path, ConstValuePtr value, std::string valueString=EMPTY_STRING) override
 Modify the value of the uniform with the given path. More...
 
- Public Member Functions inherited from ShaderMaterial
 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 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...
 

Static Public Member Functions

static GlslMaterialPtr create ()
 

Protected Member Functions

void clearShader () override
 

Protected Attributes

GlslProgramPtr _glProgram
 
- Protected Attributes inherited from ShaderMaterial
ShaderPtr _hwShader
 
MeshPtr _boundMesh
 
DocumentPtr _doc
 
TypedElementPtr _elem
 
NodePtr _materialNode
 
std::string _udim
 
bool _hasTransparency
 
ImageVec _boundImages
 

Detailed Description

Helper class for GLSL generation and rendering of a material

Definition at line 24 of file GlslMaterial.h.

Constructor & Destructor Documentation

GlslMaterial::GlslMaterial ( )
inline

Definition at line 27 of file GlslMaterial.h.

GlslMaterial::~GlslMaterial ( )
inline

Definition at line 31 of file GlslMaterial.h.

Member Function Documentation

ImagePtr GlslMaterial::bindImage ( const FilePath filePath,
const std::string uniformName,
ImageHandlerPtr  imageHandler,
const ImageSamplingProperties samplingProperties 
)
overridevirtual

Bind a single image.

Implements ShaderMaterial.

void GlslMaterial::bindImages ( ImageHandlerPtr  imageHandler,
const FileSearchPath searchPath,
bool  enableMipmaps = true 
)
overridevirtual

Bind all images for this material.

Implements ShaderMaterial.

void GlslMaterial::bindLighting ( LightHandlerPtr  lightHandler,
ImageHandlerPtr  imageHandler,
const ShadowState shadowState 
)
overridevirtual

Bind lights to shader.

Implements ShaderMaterial.

void GlslMaterial::bindMesh ( MeshPtr  mesh)
overridevirtual

Bind the given mesh to this material.

Implements ShaderMaterial.

bool GlslMaterial::bindPartition ( MeshPartitionPtr  part) const
overridevirtual

Bind a mesh partition to this material.

Implements ShaderMaterial.

bool GlslMaterial::bindShader ( ) const
overridevirtual

Bind shader.

Implements ShaderMaterial.

void GlslMaterial::bindViewInformation ( CameraPtr  camera)
overridevirtual

Bind viewing information for this material.

Implements ShaderMaterial.

void GlslMaterial::clearShader ( )
overrideprotectedvirtual

Implements ShaderMaterial.

void GlslMaterial::copyShader ( MaterialPtr  material)
inlineoverridevirtual

Copy shader from one material to this one.

Implements ShaderMaterial.

Definition at line 51 of file GlslMaterial.h.

static GlslMaterialPtr GlslMaterial::create ( )
inlinestatic

Definition at line 33 of file GlslMaterial.h.

void GlslMaterial::drawPartition ( MeshPartitionPtr  part) const
overridevirtual

Draw the given mesh partition.

Implements ShaderMaterial.

ShaderPort* GlslMaterial::findUniform ( const std::string path) const
overridevirtual

Find a public uniform from its MaterialX path.

Implements ShaderMaterial.

bool GlslMaterial::generateShader ( GenContext context)
overridevirtual

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

Implements ShaderMaterial.

bool GlslMaterial::generateShader ( ShaderPtr  hwShader)
overridevirtual

Generate a shader from the given hardware shader.

Implements ShaderMaterial.

GlslProgramPtr GlslMaterial::getProgram ( ) const
inline

Return the underlying GLSL program.

Definition at line 58 of file GlslMaterial.h.

VariableBlock* GlslMaterial::getPublicUniforms ( ) const
overridevirtual

Return the block of public uniforms for this material.

Implements ShaderMaterial.

bool GlslMaterial::loadSource ( const FilePath vertexShaderFile,
const FilePath pixelShaderFile,
bool  hasTransparency 
)
overridevirtual

Load shader source from file.

Implements ShaderMaterial.

void GlslMaterial::modifyUniform ( const std::string path,
ConstValuePtr  value,
std::string  valueString = EMPTY_STRING 
)
overridevirtual

Modify the value of the uniform with the given path.

Implements ShaderMaterial.

void GlslMaterial::unbindGeometry ( )
overridevirtual

Unbind all geometry from this material.

Implements ShaderMaterial.

void GlslMaterial::unbindImages ( ImageHandlerPtr  imageHandler)
overridevirtual

Unbbind all images for this material.

Implements ShaderMaterial.

Member Data Documentation

GlslProgramPtr GlslMaterial::_glProgram
protected

Definition at line 115 of file GlslMaterial.h.


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