Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::MaterialChunk Class Reference
[OpenGL State Handling]

State chunk for material properties. See MaterialChunk for a description. More...

#include <OSGMaterialChunk.h>

Inheritance diagram for osg::MaterialChunk:

osg::MaterialChunkBase osg::StateChunk osg::StateChunkBase osg::Attachment osg::FieldContainer List of all members.

Public Types

typedef MaterialChunkPtr Ptr
enum  {
  DiffuseFieldId = Inherited::NextFieldId, AmbientFieldId = DiffuseFieldId + 1, SpecularFieldId = AmbientFieldId + 1, EmissionFieldId = SpecularFieldId + 1,
  ShininessFieldId = EmissionFieldId + 1, LitFieldId = ShininessFieldId + 1, ColorMaterialFieldId = LitFieldId + 1, BackMaterialFieldId = ColorMaterialFieldId + 1,
  BackDiffuseFieldId = BackMaterialFieldId + 1, BackAmbientFieldId = BackDiffuseFieldId + 1, BackSpecularFieldId = BackAmbientFieldId + 1, BackEmissionFieldId = BackSpecularFieldId + 1,
  BackShininessFieldId = BackEmissionFieldId + 1, BackColorMaterialFieldId = BackShininessFieldId + 1, NextFieldId = BackColorMaterialFieldId + 1
}

Public Member Functions

Chunk Class Access
*virtual const StateChunkClassgetClass (void) const
Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
State
*virtual void activate (DrawActionBase *action, UInt32 index=0)
virtual void changeFrom (DrawActionBase *action, StateChunk *old, UInt32 index=0)
virtual void deactivate (DrawActionBase *action, UInt32 index=0)
virtual bool isTransparent (void) const
Comparison
*virtual Real32 switchCost (StateChunk *chunk)
virtual bool operator< (const StateChunk &other) const
virtual bool operator== (const StateChunk &other) const
virtual bool operator!= (const StateChunk &other) const
FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get
*SFColor4fgetSFDiffuse (void)
 Get the MaterialChunk::_sfDiffuse field.
SFColor4fgetSFAmbient (void)
 Get the MaterialChunk::_sfAmbient field.
SFColor4fgetSFSpecular (void)
 Get the MaterialChunk::_sfSpecular field.
SFColor4fgetSFEmission (void)
 Get the MaterialChunk::_sfEmission field.
SFReal32getSFShininess (void)
 Get the MaterialChunk::_sfShininess field.
SFBoolgetSFLit (void)
 Get the MaterialChunk::_sfLit field.
SFGLenumgetSFColorMaterial (void)
 Get the MaterialChunk::_sfColorMaterial field.
SFBoolgetSFBackMaterial (void)
 Get the MaterialChunk::_sfBackMaterial field.
SFColor4fgetSFBackDiffuse (void)
 Get the MaterialChunk::_sfBackDiffuse field.
SFColor4fgetSFBackAmbient (void)
 Get the MaterialChunk::_sfBackAmbient field.
SFColor4fgetSFBackSpecular (void)
 Get the MaterialChunk::_sfBackSpecular field.
SFColor4fgetSFBackEmission (void)
 Get the MaterialChunk::_sfBackEmission field.
SFReal32getSFBackShininess (void)
 Get the MaterialChunk::_sfBackShininess field.
SFGLenumgetSFBackColorMaterial (void)
 Get the MaterialChunk::_sfBackColorMaterial field.
Color4fgetDiffuse (void)
 Get the value of the MaterialChunk::_sfDiffuse field.
const Color4fgetDiffuse (void) const
 Get the value of the MaterialChunk::_sfDiffuse field.
Color4fgetAmbient (void)
 Get the value of the MaterialChunk::_sfAmbient field.
const Color4fgetAmbient (void) const
 Get the value of the MaterialChunk::_sfAmbient field.
Color4fgetSpecular (void)
 Get the value of the MaterialChunk::_sfSpecular field.
const Color4fgetSpecular (void) const
 Get the value of the MaterialChunk::_sfSpecular field.
Color4fgetEmission (void)
 Get the value of the MaterialChunk::_sfEmission field.
const Color4fgetEmission (void) const
 Get the value of the MaterialChunk::_sfEmission field.
Real32getShininess (void)
 Get the value of the MaterialChunk::_sfShininess field.
const Real32getShininess (void) const
 Get the value of the MaterialChunk::_sfShininess field.
bool & getLit (void)
 Get the value of the MaterialChunk::_sfLit field.
const bool & getLit (void) const
 Get the value of the MaterialChunk::_sfLit field.
GLenumgetColorMaterial (void)
 Get the value of the MaterialChunk::_sfColorMaterial field.
const GLenumgetColorMaterial (void) const
 Get the value of the MaterialChunk::_sfColorMaterial field.
bool & getBackMaterial (void)
 Get the value of the MaterialChunk::_sfBackMaterial field.
const bool & getBackMaterial (void) const
 Get the value of the MaterialChunk::_sfBackMaterial field.
Color4fgetBackDiffuse (void)
 Get the value of the MaterialChunk::_sfBackDiffuse field.
const Color4fgetBackDiffuse (void) const
 Get the value of the MaterialChunk::_sfBackDiffuse field.
Color4fgetBackAmbient (void)
 Get the value of the MaterialChunk::_sfBackAmbient field.
const Color4fgetBackAmbient (void) const
 Get the value of the MaterialChunk::_sfBackAmbient field.
Color4fgetBackSpecular (void)
 Get the value of the MaterialChunk::_sfBackSpecular field.
const Color4fgetBackSpecular (void) const
 Get the value of the MaterialChunk::_sfBackSpecular field.
Color4fgetBackEmission (void)
 Get the value of the MaterialChunk::_sfBackEmission field.
const Color4fgetBackEmission (void) const
 Get the value of the MaterialChunk::_sfBackEmission field.
Real32getBackShininess (void)
 Get the value of the MaterialChunk::_sfBackShininess field.
const Real32getBackShininess (void) const
 Get the value of the MaterialChunk::_sfBackShininess field.
GLenumgetBackColorMaterial (void)
 Get the value of the MaterialChunk::_sfBackColorMaterial field.
const GLenumgetBackColorMaterial (void) const
 Get the value of the MaterialChunk::_sfBackColorMaterial field.
Field Set
*void setDiffuse (const Color4f &value)
 Set the value of the MaterialChunk::_sfDiffuse field.
void setAmbient (const Color4f &value)
 Set the value of the MaterialChunk::_sfAmbient field.
void setSpecular (const Color4f &value)
 Set the value of the MaterialChunk::_sfSpecular field.
void setEmission (const Color4f &value)
 Set the value of the MaterialChunk::_sfEmission field.
void setShininess (const Real32 &value)
 Set the value of the MaterialChunk::_sfShininess field.
void setLit (const bool &value)
 Set the value of the MaterialChunk::_sfLit field.
void setColorMaterial (const GLenum &value)
 Set the value of the MaterialChunk::_sfColorMaterial field.
void setBackMaterial (const bool &value)
 Set the value of the MaterialChunk::_sfBackMaterial field.
void setBackDiffuse (const Color4f &value)
 Set the value of the MaterialChunk::_sfBackDiffuse field.
void setBackAmbient (const Color4f &value)
 Set the value of the MaterialChunk::_sfBackAmbient field.
void setBackSpecular (const Color4f &value)
 Set the value of the MaterialChunk::_sfBackSpecular field.
void setBackEmission (const Color4f &value)
 Set the value of the MaterialChunk::_sfBackEmission field.
void setBackShininess (const Real32 &value)
 Set the value of the MaterialChunk::_sfBackShininess field.
void setBackColorMaterial (const GLenum &value)
 Set the value of the MaterialChunk::_sfBackColorMaterial field.
Binary Access
*virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Copy
*virtual FieldContainerPtr shallowCopy (void) const

Static Public Member Functions

Static Chunk Class Access
*static UInt32 getStaticClassId (void)
static const StateChunkClassgetStaticClass (void)
Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static MaterialChunkPtr create (void)
 create a new instance of the class
static MaterialChunkPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype

Static Public Attributes

static const osg::BitVector DiffuseFieldMask
static const osg::BitVector AmbientFieldMask
static const osg::BitVector SpecularFieldMask
static const osg::BitVector EmissionFieldMask
static const osg::BitVector ShininessFieldMask
static const osg::BitVector LitFieldMask
static const osg::BitVector ColorMaterialFieldMask
static const osg::BitVector BackMaterialFieldMask
static const osg::BitVector BackDiffuseFieldMask
static const osg::BitVector BackAmbientFieldMask
static const osg::BitVector BackSpecularFieldMask
static const osg::BitVector BackEmissionFieldMask
static const osg::BitVector BackShininessFieldMask
static const osg::BitVector BackColorMaterialFieldMask
static const osg::BitVector MTInfluenceMask
static const BitVector InternalFieldMask = (1 << Attachment::InternalFieldId)
static const BitVector ParentsFieldMask = (1 << Attachment::ParentsFieldId)
static const BitVector NextFieldMask

Protected Member Functions

Constructors
MaterialChunk (void)
 MaterialChunk (const MaterialChunk &source)
Destructors
*virtual ~MaterialChunk (void)
Sync
*void executeSyncImpl (MaterialChunkBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)

Protected Attributes

Fields
*SFColor4f _sfDiffuse
SFColor4f _sfAmbient
SFColor4f _sfSpecular
SFColor4f _sfEmission
SFReal32 _sfShininess
SFBool _sfLit
SFGLenum _sfColorMaterial
SFBool _sfBackMaterial
SFColor4f _sfBackDiffuse
SFColor4f _sfBackAmbient
SFColor4f _sfBackSpecular
SFColor4f _sfBackEmission
SFReal32 _sfBackShininess
SFGLenum _sfBackColorMaterial

Private Types

typedef MaterialChunkBase Inherited

Private Member Functions

void operator= (const MaterialChunk &source)

Static Private Member Functions

static void initMethod (void)

Static Private Attributes

static char cvsid []
static StateChunkClass _class

Friends

class FieldContainer
class MaterialChunkBase

Detailed Description

See MaterialChunk for details.

This chunk wraps glMaterial() (osg::MaterialChunk::_sfDiffuse, osg::MaterialChunk::_sfSpecular, osg::MaterialChunk::_sfEmission, osg::MaterialChunk::_sfShininess, osg::MaterialChunk::_sfAmbient), glEnable(GL_LIGHTING)(osg::MaterialChunk::_sfLit) and glColorMaterial() (osg::MaterialChunk::_sfColorMaterial).

Definition at line 55 of file OSGMaterialChunk.h.


Member Typedef Documentation

typedef MaterialChunkBase osg::MaterialChunk::Inherited [private]
 

Reimplemented from osg::MaterialChunkBase.

Definition at line 140 of file OSGMaterialChunk.h.

typedef MaterialChunkPtr osg::MaterialChunkBase::Ptr [inherited]
 

Reimplemented from osg::StateChunkBase.

Definition at line 103 of file OSGMaterialChunkBase.h.


Member Enumeration Documentation

anonymous enum [inherited]
 

Enumerator:
DiffuseFieldId 
AmbientFieldId 
SpecularFieldId 
EmissionFieldId 
ShininessFieldId 
LitFieldId 
ColorMaterialFieldId 
BackMaterialFieldId 
BackDiffuseFieldId 
BackAmbientFieldId 
BackSpecularFieldId 
BackEmissionFieldId 
BackShininessFieldId 
BackColorMaterialFieldId 
NextFieldId 

Reimplemented from osg::Attachment.

Definition at line 105 of file OSGMaterialChunkBase.h.

00106     {
00107         DiffuseFieldId           = Inherited::NextFieldId,
00108         AmbientFieldId           = DiffuseFieldId           + 1,
00109         SpecularFieldId          = AmbientFieldId           + 1,
00110         EmissionFieldId          = SpecularFieldId          + 1,
00111         ShininessFieldId         = EmissionFieldId          + 1,
00112         LitFieldId               = ShininessFieldId         + 1,
00113         ColorMaterialFieldId     = LitFieldId               + 1,
00114         BackMaterialFieldId      = ColorMaterialFieldId     + 1,
00115         BackDiffuseFieldId       = BackMaterialFieldId      + 1,
00116         BackAmbientFieldId       = BackDiffuseFieldId       + 1,
00117         BackSpecularFieldId      = BackAmbientFieldId       + 1,
00118         BackEmissionFieldId      = BackSpecularFieldId      + 1,
00119         BackShininessFieldId     = BackEmissionFieldId      + 1,
00120         BackColorMaterialFieldId = BackShininessFieldId     + 1,
00121         NextFieldId              = BackColorMaterialFieldId + 1
00122     };


Constructor & Destructor Documentation

MaterialChunk::MaterialChunk void   )  [protected]
 

Definition at line 94 of file OSGMaterialChunk.cpp.

00094                                  :
00095     Inherited()
00096 {
00097 }

MaterialChunk::MaterialChunk const MaterialChunk source  )  [protected]
 

Definition at line 99 of file OSGMaterialChunk.cpp.

00099                                                         :
00100     Inherited(source)
00101 {
00102 }

MaterialChunk::~MaterialChunk void   )  [protected, virtual]
 

Definition at line 104 of file OSGMaterialChunk.cpp.

00105 {
00106 }


Member Function Documentation

const StateChunkClass * MaterialChunk::getClass void   )  const [virtual]
 

Reimplemented from osg::StateChunk.

Definition at line 110 of file OSGMaterialChunk.cpp.

References _class.

00111 {
00112     return &_class;
00113 }

UInt32 osg::MaterialChunk::getStaticClassId void   )  [inline, static]
 

Reimplemented from osg::StateChunk.

Definition at line 46 of file OSGMaterialChunk.inl.

References osg::StateChunkClass::getId(), and getStaticClass().

Referenced by osg::VRMLWriteAction::writeMaterial().

00047 {
00048     return getStaticClass()->getId();
00049 }

const StateChunkClass * osg::MaterialChunk::getStaticClass void   )  [inline, static]
 

Reimplemented from osg::StateChunk.

Definition at line 52 of file OSGMaterialChunk.inl.

References _class.

Referenced by getStaticClassId().

00053 {
00054     return &MaterialChunk::_class;
00055 }

void MaterialChunk::changed BitVector  whichField,
UInt32  origin
[virtual]
 

Reimplemented from osg::StateChunk.

Definition at line 117 of file OSGMaterialChunk.cpp.

References osg::StateChunk::changed().

00118 {
00119     Inherited::changed(whichField, origin);
00120 }

void MaterialChunk::dump UInt32  uiIndent = 0,
const BitVector  bvFlags = 0
const [virtual]
 

Reimplemented from osg::StateChunk.

Definition at line 124 of file OSGMaterialChunk.cpp.

References SLOG.

00126 {
00127     SLOG << "Dump MaterialChunk NI" << std::endl;
00128 }

void MaterialChunk::activate DrawActionBase action,
UInt32  index = 0
[virtual]
 

Activate the chunk, i.e. set the OpenGl state covered by the chunk which is different from the default state to the given state.

Reimplemented from osg::StateChunk.

Definition at line 132 of file OSGMaterialChunk.cpp.

References osg::MaterialChunkBase::_sfAmbient, osg::MaterialChunkBase::_sfBackAmbient, osg::MaterialChunkBase::_sfBackDiffuse, osg::MaterialChunkBase::_sfBackEmission, osg::MaterialChunkBase::_sfBackShininess, osg::MaterialChunkBase::_sfBackSpecular, osg::MaterialChunkBase::_sfDiffuse, osg::MaterialChunkBase::_sfEmission, osg::MaterialChunkBase::_sfShininess, osg::MaterialChunkBase::_sfSpecular, osg::MaterialChunkBase::getBackColorMaterial(), osg::MaterialChunkBase::getBackMaterial(), osg::MaterialChunkBase::getColorMaterial(), osg::MaterialChunkBase::getLit(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), GLenum, and glErr.

00133 {
00134     glErr("material:activate:precheck");
00135 
00136     GLenum target;
00137 
00138     if(getBackMaterial())
00139     {
00140         target = GL_FRONT;
00141     }
00142     else
00143     {
00144         target = GL_FRONT_AND_BACK;
00145     }
00146         
00147     if(getColorMaterial() == GL_NONE)
00148     {
00149         glDisable(GL_COLOR_MATERIAL);
00150     }
00151     else
00152     {
00153         glColorMaterial(target, getColorMaterial());
00154         if(getBackMaterial())
00155         {
00156             glColorMaterial(GL_BACK, getBackColorMaterial());
00157         }
00158         glEnable(GL_COLOR_MATERIAL);
00159     }
00160 
00161     glColor4fv(_sfDiffuse.getValue().getValuesRGBA());
00162 
00163     if(getLit())
00164     {
00165         glMaterialfv(target, GL_DIFFUSE,
00166                       _sfDiffuse.getValue().getValuesRGBA());
00167         glMaterialfv(target, GL_AMBIENT,
00168                       _sfAmbient.getValue().getValuesRGBA());
00169         glMaterialfv(target, GL_SPECULAR,
00170                       _sfSpecular.getValue().getValuesRGBA());
00171         glMaterialfv(target, GL_EMISSION,
00172                       _sfEmission.getValue().getValuesRGBA());
00173         glMaterialf (target, GL_SHININESS, _sfShininess.getValue());
00174 
00175         if(getBackMaterial())
00176         {
00177             glMaterialfv(GL_BACK, GL_DIFFUSE,
00178                           _sfBackDiffuse.getValue().getValuesRGBA());
00179             glMaterialfv(GL_BACK, GL_AMBIENT,
00180                           _sfBackAmbient.getValue().getValuesRGBA());
00181             glMaterialfv(GL_BACK, GL_SPECULAR,
00182                           _sfBackSpecular.getValue().getValuesRGBA());
00183             glMaterialfv(GL_BACK, GL_EMISSION,
00184                           _sfBackEmission.getValue().getValuesRGBA());
00185             glMaterialf (GL_BACK, GL_SHININESS, _sfBackShininess.getValue());
00186         }
00187         
00188         glEnable(GL_LIGHTING);
00189     }
00190     else
00191     {
00192         glDisable(GL_LIGHTING);
00193     }
00194 
00195     glErr("material:activate:postcheck");
00196 }

void MaterialChunk::changeFrom DrawActionBase action,
StateChunk old_chunk,
UInt32  index = 0
[virtual]
 

Change from an old chunk of the same type to this chunk. Note that in general no type checking is done, make sure to use this on a legal combination of chunks!

Reimplemented from osg::StateChunk.

Definition at line 198 of file OSGMaterialChunk.cpp.

References osg::MaterialChunkBase::_sfAmbient, osg::MaterialChunkBase::_sfBackAmbient, osg::MaterialChunkBase::_sfBackDiffuse, osg::MaterialChunkBase::_sfBackEmission, osg::MaterialChunkBase::_sfBackShininess, osg::MaterialChunkBase::_sfBackSpecular, osg::MaterialChunkBase::_sfDiffuse, osg::MaterialChunkBase::_sfEmission, osg::MaterialChunkBase::_sfShininess, osg::MaterialChunkBase::_sfSpecular, osg::MaterialChunkBase::getBackColorMaterial(), osg::MaterialChunkBase::getBackMaterial(), osg::MaterialChunkBase::getBackShininess(), osg::MaterialChunkBase::getColorMaterial(), osg::MaterialChunkBase::getLit(), osg::MaterialChunkBase::getShininess(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), GLenum, glErr, and osg::osgabs().

00199 {
00200     glErr("material:changed:precheck");
00201 
00202     MaterialChunk const *old = dynamic_cast<MaterialChunk const*>(old_chunk);
00203 
00204     // change from me to me?
00205     // this assumes I haven't changed in the meantime. is that a valid assumption?
00206     if(old == this)
00207     {
00208         // Reset it, as Geometry colors might have changed it
00209         if(getColorMaterial() != GL_NONE || 
00210            (getBackMaterial() && getBackColorMaterial() != GL_NONE)
00211           )
00212             glColor4fv(_sfDiffuse.getValue().getValuesRGBA());
00213 
00214         return;
00215     }
00216 
00217     if(getColorMaterial() == GL_NONE && 
00218         ((getBackColorMaterial() == GL_NONE) || ! getBackMaterial())  &&
00219        (old->getColorMaterial()     != GL_NONE || 
00220         old->getBackColorMaterial() != GL_NONE
00221        )
00222       )
00223     {
00224         glDisable(GL_COLOR_MATERIAL);
00225     }
00226     else if(getColorMaterial()     != old->getColorMaterial() || 
00227             getBackColorMaterial() != old->getBackColorMaterial()
00228            )
00229     {
00230         if(getBackMaterial())
00231         {
00232             glColorMaterial(GL_FRONT, getColorMaterial());
00233             glColorMaterial(GL_BACK,  getBackColorMaterial());
00234         }
00235         else
00236         {
00237              glColorMaterial(GL_FRONT_AND_BACK, getColorMaterial());
00238       
00239         }
00240         glEnable(GL_COLOR_MATERIAL);
00241     }
00242     
00243     if(getColorMaterial() != GL_NONE || getBackColorMaterial() != GL_NONE)
00244         glColor4fv(_sfDiffuse.getValue().getValuesRGBA());
00245 
00246     if(getLit() && ! old->getLit())
00247         glEnable(GL_LIGHTING);
00248     else if(! getLit() && old->getLit())
00249         glDisable(GL_LIGHTING);
00250 
00251     if(getLit())
00252     {
00253         GLenum target;
00254 
00255         if(getBackMaterial())
00256         {
00257             target = GL_FRONT;
00258         }
00259         else
00260         {
00261             target = GL_FRONT_AND_BACK;
00262         }
00263         
00264         glMaterialfv(target, GL_DIFFUSE,
00265                       _sfDiffuse.getValue().getValuesRGBA());
00266         glMaterialfv(target, GL_AMBIENT,
00267                       _sfAmbient.getValue().getValuesRGBA());
00268         glMaterialfv(target, GL_SPECULAR,
00269                       _sfSpecular.getValue().getValuesRGBA());
00270         glMaterialfv(target, GL_EMISSION,
00271                       _sfEmission.getValue().getValuesRGBA());
00272         // adjust shininess only if it differs enough
00273         if(osgabs(_sfShininess.getValue() - old->getShininess()) > 1e-4)
00274             glMaterialf( target, GL_SHININESS, _sfShininess.getValue());
00275         
00276         if(getBackMaterial())
00277         {
00278             glMaterialfv(GL_BACK, GL_DIFFUSE,
00279                           _sfBackDiffuse.getValue().getValuesRGBA());
00280             glMaterialfv(GL_BACK, GL_AMBIENT,
00281                           _sfBackAmbient.getValue().getValuesRGBA());
00282             glMaterialfv(GL_BACK, GL_SPECULAR,
00283                           _sfBackSpecular.getValue().getValuesRGBA());
00284             glMaterialfv(GL_BACK, GL_EMISSION,
00285                           _sfBackEmission.getValue().getValuesRGBA());
00286             // adjust shininess only if it differs enough
00287             if(osgabs(_sfBackShininess.getValue() - 
00288                       old->getBackShininess()
00289                      ) > 1e-4)
00290                 glMaterialf( GL_BACK, GL_SHININESS, _sfBackShininess.getValue());
00291         }
00292     }
00293 
00294     glErr("material:changed:precheck");
00295 }

void MaterialChunk::deactivate DrawActionBase action,
UInt32  index = 0
[virtual]
 

Deactivate the chunk, i.e. set the OpenGl state covered by the chunk which is different from the default state to the default state.

Reimplemented from osg::StateChunk.

Definition at line 297 of file OSGMaterialChunk.cpp.

References osg::MaterialChunkBase::getColorMaterial(), and osg::MaterialChunkBase::getLit().

00298 {
00299     if(getLit())
00300         glDisable(GL_LIGHTING);
00301 
00302     if(getColorMaterial() != GL_NONE)
00303         glDisable(GL_COLOR_MATERIAL);
00304 }

bool MaterialChunk::isTransparent void   )  const [virtual]
 

Check if the chunk is transparent, i.e. needs to be rendered after the opaque objects.

Reimplemented from osg::StateChunk.

Definition at line 314 of file OSGMaterialChunk.cpp.

References osg::Eps, and osg::MaterialChunkBase::getDiffuse().

00315 {
00316     return(getDiffuse()[3] <(1. - Eps));
00317 }

Real32 MaterialChunk::switchCost StateChunk chunk  )  [virtual]
 

Calculate how expensive it is to switch from one instance of the chunk class to another. In most cases not implemented yet, will return 0.

Reimplemented from osg::StateChunk.

Definition at line 309 of file OSGMaterialChunk.cpp.

00310 {
00311     return 0;
00312 }

bool MaterialChunk::operator< const StateChunk other  )  const [virtual]
 

Calculate how expensive it is to switch from one instance of the chunk class to another. In most cases not implemented yet, will return 0.

Reimplemented from osg::StateChunk.

Definition at line 320 of file OSGMaterialChunk.cpp.

00321 {
00322     return this < &other;
00323 }

bool MaterialChunk::operator== const StateChunk other  )  const [virtual]
 

Compare two chunks. In most cases not implemented yet, will return false.

Reimplemented from osg::StateChunk.

Definition at line 325 of file OSGMaterialChunk.cpp.

References osg::Eps, osg::Color4< ValueTypeT >::equals(), osg::MaterialChunkBase::getAmbient(), osg::MaterialChunkBase::getColorMaterial(), osg::MaterialChunkBase::getDiffuse(), osg::MaterialChunkBase::getEmission(), osg::MaterialChunkBase::getLit(), osg::MaterialChunkBase::getShininess(), and osg::MaterialChunkBase::getSpecular().

00326 {
00327     MaterialChunk const *tother = dynamic_cast<MaterialChunk const*>(&other);
00328 
00329     if(!tother)
00330         return false;
00331 
00332     if(tother == this)
00333         return true;
00334 
00335     if(!getAmbient  ().equals(tother->getAmbient  (), Eps) ||
00336        !getDiffuse  ().equals(tother->getDiffuse  (), Eps) ||
00337        !getSpecular ().equals(tother->getSpecular (), Eps) ||
00338        !getEmission ().equals(tother->getEmission (), Eps) ||
00339         getShininess()     != tother->getShininess()       ||
00340         getLit()           != tother->getLit()             ||
00341         getColorMaterial() != tother->getColorMaterial()
00342       )
00343         return false;
00344 
00345     return true;
00346 }

bool MaterialChunk::operator!= const StateChunk other  )  const [virtual]
 

Calculate how expensive it is to switch from one instance of the chunk class to another. In most cases not implemented yet, will return 0.

Reimplemented from osg::