A3DL::Material Class Reference
[libmetaobject_a3dl]
#include <vos/metaobjects/a3dl/material.hh>
Inheritance diagram for A3DL::Material:

Detailed Description
Contains material (appearence) information for a 3D object.Materials hold one or more texture layers, solid colors, transparency value and various lighting parameters.
- Todo:
- Need to add functions for setting shading (CS mixmode |= CS_FX_GORAUD), keycolor (CS mixmode |= CS_FX_KEYCOLOR), tiling (CS mixmode |= CS_FX_TILING)
Definition at line 50 of file material.hh.
Public Types
- BLEND_ADD
- BLEND_MULTIPLY
- BLEND_DOUBLE_MULTIPLY
- BLEND_NORMAL
- enum BlendMode { BLEND_ADD,
BLEND_MULTIPLY,
BLEND_DOUBLE_MULTIPLY,
BLEND_NORMAL
}
- Special blend modes for setBlendMode() and getBlendMode(). More...
- Special blend modes for setBlendMode() and getBlendMode(). More...
Public Member Functions
- Material (VOS::VobjectBase *superobject)
- virtual ~Material ()
- virtual const std::string getVOSType ()
- virtual TextureIterator getTextureLayers ()
- virtual VUtil::vRef< Texture > getTextureLayer (int idx)
- Use a VUtil::vRef or call release on the returned object.
- Use a VUtil::vRef or call release on the returned object.
- virtual void insertTextureLayer (int idx, Texture &t)
- virtual VUtil::vRef< Texture > insertTextureLayerFromFile (int idx, const std::string &filename, const std::string &datatype)
- virtual VUtil::vRef< Texture > insertTextureLayer (int idx, const std::string &data, const std::string &datatype, double alpha=1.0, BlendMode blendMode=BLEND_NORMAL)
- Create a new Texture object using given image data and datatype identifiel, and insert it into this material at the given index.
- Create a new Texture object using given image data and datatype identifiel, and insert it into this material at the given index.
- virtual void replaceTextureLayer (int idx, Texture &t)
- virtual void replaceTextureLayer (int idx, Texture *t)
- virtual void removeTextureLayer (int idx)
- virtual void setColor (float r, float g, float b)
- virtual void getColor (float &r, float &g, float &b)
- virtual void setAlpha (double t)
- virtual double getAlpha ()
- virtual VUtil::vRef< VOS::Property > getAlphaObj ()
- virtual void setAlphaObj (VOS::Property *obj)
- virtual void setBlendMode (BlendMode mode)
- virtual BlendMode getBlendMode ()
- virtual VUtil::vRef< VOS::Property > getBlendModeObj ()
- virtual void setBlendModeObj (VOS::Property *obj)
- virtual void setBlendColor (float r, float g, float b)
- virtual void getBlendColor (float &r, float &g, float &b)
- virtual void setBlendColorObj (VOS::Property *obj)
- virtual VUtil::vRef< VOS::Property > getBlendColorObj ()
Static Public Member Functions
- static VOS::MetaObject * new_Material (VOS::VobjectBase *superobject, const std::string &type)
- static void hexStringToFloats (const std::string &str, float &r, float &g, float &b)
- static void floatsToHexString (float r, float g, float b, std::string &str)
Member Enumeration Documentation
Special blend modes for setBlendMode() and getBlendMode().
Definition at line 55 of file material.hh.
Constructor & Destructor Documentation
| A3DL::Material::Material | ( | VOS::VobjectBase * | superobject | ) |
| virtual A3DL::Material::~Material | ( | ) | [virtual] |
Member Function Documentation
| static void A3DL::Material::floatsToHexString | ( | float | r, | |
| float | g, | |||
| float | b, | |||
| std::string & | str | |||
| ) | [static] |
| virtual double A3DL::Material::getAlpha | ( | ) | [virtual] |
Get alpha.
Will be between 0 (fully transparent) and 1 (no transparency)
- Exceptions:
-
Vobject:NoSuchObjectError if there is no "a3dl:alpha" object.
| virtual VUtil::vRef<VOS::Property> A3DL::Material::getAlphaObj | ( | ) | [virtual] |
Get transparency property.
| virtual void A3DL::Material::getBlendColor | ( | float & | r, | |
| float & | g, | |||
| float & | b | |||
| ) | [virtual] |
Get blend color
- Exceptions:
-
Vobject::NoSuchObjectError if there is no "a3dl:blend-mode" property.
| virtual VUtil::vRef<VOS::Property> A3DL::Material::getBlendColorObj | ( | ) | [virtual] |
Get a3dl:blende-color property object.
| virtual BlendMode A3DL::Material::getBlendMode | ( | ) | [virtual] |
Get special blend mode.
These blend modes determine how the background affects the object's material.
- Exceptions:
-
Vobject::NoSuchObjectError if there is no "a3dl:blend-mode" property.
| virtual VUtil::vRef<VOS::Property> A3DL::Material::getBlendModeObj | ( | ) | [virtual] |
Get blend mode property object.
| virtual void A3DL::Material::getColor | ( | float & | r, | |
| float & | g, | |||
| float & | b | |||
| ) | [virtual] |
Get the "base" color of the material: a color to use if there are no texture layers.
| virtual VUtil::vRef<Texture> A3DL::Material::getTextureLayer | ( | int | idx | ) | [virtual] |
Use a VUtil::vRef or call release on the returned object.
- Returns:
- 0 if idx is greater than the number of texture layers.
| virtual TextureIterator A3DL::Material::getTextureLayers | ( | ) | [virtual] |
Get pointers to texture layers.
| virtual const std::string A3DL::Material::getVOSType | ( | ) | [virtual] |
- Returns:
- the specific VOS type name that represents the VOS interface this object is supplying. This should always be overridden by the subclass.
Reimplemented from VOS::MetaObject.
| static void A3DL::Material::hexStringToFloats | ( | const std::string & | str, | |
| float & | r, | |||
| float & | g, | |||
| float & | b | |||
| ) | [static] |
| virtual VUtil::vRef<Texture> A3DL::Material::insertTextureLayer | ( | int | idx, | |
| const std::string & | data, | |||
| const std::string & | datatype, | |||
| double | alpha = 1.0, |
|||
| BlendMode | blendMode = BLEND_NORMAL | |||
| ) | [virtual] |
Create a new Texture object using given image data and datatype identifiel, and insert it into this material at the given index.
| virtual void A3DL::Material::insertTextureLayer | ( | int | idx, | |
| Texture & | t | |||
| ) | [virtual] |
Insert a texture layer at the given index.
Textures are applied to an object from lowest to highest index.
| virtual VUtil::vRef<Texture> A3DL::Material::insertTextureLayerFromFile | ( | int | idx, | |
| const std::string & | filename, | |||
| const std::string & | datatype | |||
| ) | [virtual] |
Insert a new texture layer into this material at the given index, using the given file as the image backend source (using FileProperty).
- See also:
- FileProperty
- Exceptions:
-
FileAccessError if there is an error opening the file
| static VOS::MetaObject* A3DL::Material::new_Material | ( | VOS::VobjectBase * | superobject, | |
| const std::string & | type | |||
| ) | [static] |
| virtual void A3DL::Material::removeTextureLayer | ( | int | idx | ) | [virtual] |
| virtual void A3DL::Material::replaceTextureLayer | ( | int | idx, | |
| Texture * | t | |||
| ) | [inline, virtual] |
Definition at line 93 of file material.hh.
| virtual void A3DL::Material::replaceTextureLayer | ( | int | idx, | |
| Texture & | t | |||
| ) | [virtual] |
| virtual void A3DL::Material::setAlpha | ( | double | t | ) | [virtual] |
Set alpha transparency of the object.
- Parameters:
-
t A value between 0 (fully transparent) and 1 (no transparency). Some renderers may round to certain values (e.g. 1.0, 0.75, 0.5, 0.25, 0.0) If t is > 1, 1 will be used. If t < 0, 0 will be used.
| virtual void A3DL::Material::setAlphaObj | ( | VOS::Property * | obj | ) | [virtual] |
Set transparency property object.
| virtual void A3DL::Material::setBlendColor | ( | float | r, | |
| float | g, | |||
| float | b | |||
| ) | [virtual] |
Set blend color: this color modifies the blending of this object against its background.
| virtual void A3DL::Material::setBlendColorObj | ( | VOS::Property * | obj | ) | [virtual] |
Set a3dl:blend-color property object.
| virtual void A3DL::Material::setBlendMode | ( | BlendMode | mode | ) | [virtual] |
Set special blend mode.
These blend modes determine how the background affects the object's material.
| virtual void A3DL::Material::setBlendModeObj | ( | VOS::Property * | obj | ) | [virtual] |
Set blend mode property object.
| virtual void A3DL::Material::setColor | ( | float | r, | |
| float | g, | |||
| float | b | |||
| ) | [virtual] |
Set the "base" color of the material: a color to use if there are no texture layers.
The documentation for this class was generated from the following file:
- /home/tetron/hack/vos/libs/vos/metaobjects/a3dl/material.hh