shiny  0.4
a shader and material management library for OGRE
Public Member Functions | Friends | List of all members
sh::MaterialInstance Class Reference

A specific material instance, which has all required properties set (for example the diffuse & normal map, ambient/diffuse/specular values).
Depending on these properties, the system will automatically select a shader permutation that suits these and create the backend materials / passes (provided by the Platform class). More...

#include <MaterialInstance.hpp>

+ Inheritance diagram for sh::MaterialInstance:

Public Member Functions

 MaterialInstance (const std::string &name, Factory *f)
 
PassVector * getParentPasses ()
 gets the passes of the top-most parent
 
PassVector * getPasses ()
 get our passes (for derived materials, none)
 
MaterialInstancePasscreatePass ()
 
void deletePass (unsigned int index)
 
MaterialgetMaterial ()
 
void setListener (MaterialInstanceListener *l)
 attach a MaterialInstanceListener to this specific material (as opposed to MaterialListener, which listens to all materials)
 
std::string getName ()
 
virtual void setProperty (const std::string &name, PropertyValuePtr value)
 
void setSourceFile (const std::string &sourceFile)
 
std::string getSourceFile ()
 get the name of the file this material was read from, or empty if it was created dynamically by code
 
- Public Member Functions inherited from sh::PropertySetGet
 PropertySetGet (PropertySetGet *parent)
 
void save (std::ofstream &stream, const std::string &indentation)
 
void copyAll (PropertySet *target, PropertySetGet *context, bool copyParent=true)
 call setProperty for each property/value pair stored in this
 
void copyAll (PropertySetGet *target, PropertySetGet *context, bool copyParent=true)
 call setProperty for each property/value pair stored in this
 
void setParent (PropertySetGet *parent)
 
PropertySetGetgetParent ()
 
void setContext (PropertySetGet *context)
 
PropertySetGetgetContext ()
 
PropertyValuePtr & getProperty (const std::string &name)
 
void deleteProperty (const std::string &name)
 
const PropertyMaplistProperties ()
 
bool hasProperty (const std::string &name) const
 

Friends

class Factory
 

Additional Inherited Members

- Protected Attributes inherited from sh::PropertySetGet
PropertySetGetmParent
 
PropertySetGetmContext
 used to retrieve linked property values
 

Detailed Description

A specific material instance, which has all required properties set (for example the diffuse & normal map, ambient/diffuse/specular values).
Depending on these properties, the system will automatically select a shader permutation that suits these and create the backend materials / passes (provided by the Platform class).

Member Function Documentation

◆ getMaterial()

Material* sh::MaterialInstance::getMaterial ( )
Attention
Because the backend material passes are created on demand, the returned material here might not contain anything yet! The only place where you should use this method, is for the MaterialInstance given by the MaterialListener::materialCreated event!

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