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

osg::PhongMaterialBase Class Reference

PhongMaterial Base Class.

#include <OSGPhongMaterialBase.h>

Inheritance diagram for osg::PhongMaterialBase:

osg::ChunkMaterial osg::ChunkMaterialBase osg::Material osg::MaterialBase osg::AttachmentContainer osg::FieldContainer osg::PhongMaterial List of all members.

Rendering

StatePtr getState (void)
*typedef TypedFunctor1Base<
Action::ResultE, PtrCallArg<
DrawActionBase > > 
DrawFunctor

Public Types

typedef PhongMaterialPtr Ptr
enum  {
  AmbientFieldId = Inherited::NextFieldId, DiffuseFieldId = AmbientFieldId + 1, SpecularFieldId = DiffuseFieldId + 1, ShininessFieldId = SpecularFieldId + 1,
  EmissionFieldId = ShininessFieldId + 1, TransparencyFieldId = EmissionFieldId + 1, LitFieldId = TransparencyFieldId + 1, ColorMaterialFieldId = LitFieldId + 1,
  NextFieldId = ColorMaterialFieldId + 1
}

Public Member Functions

FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get
*SFColor3fgetSFAmbient (void)
 Get the PhongMaterial::_sfAmbient field.
SFColor3fgetSFDiffuse (void)
 Get the PhongMaterial::_sfDiffuse field.
SFColor3fgetSFSpecular (void)
 Get the PhongMaterial::_sfSpecular field.
SFReal32getSFShininess (void)
 Get the PhongMaterial::_sfShininess field.
SFColor3fgetSFEmission (void)
 Get the PhongMaterial::_sfEmission field.
SFReal32getSFTransparency (void)
 Get the PhongMaterial::_sfTransparency field.
SFBoolgetSFLit (void)
 Get the PhongMaterial::_sfLit field.
SFGLenumgetSFColorMaterial (void)
 Get the PhongMaterial::_sfColorMaterial field.
Color3fgetAmbient (void)
 Get the value of the PhongMaterial::_sfAmbient field.
const Color3fgetAmbient (void) const
 Get the value of the PhongMaterial::_sfAmbient field.
Color3fgetDiffuse (void)
 Get the value of the PhongMaterial::_sfDiffuse field.
const Color3fgetDiffuse (void) const
 Get the value of the PhongMaterial::_sfDiffuse field.
Color3fgetSpecular (void)
 Get the value of the PhongMaterial::_sfSpecular field.
const Color3fgetSpecular (void) const
 Get the value of the PhongMaterial::_sfSpecular field.
Real32getShininess (void)
 Get the value of the PhongMaterial::_sfShininess field.
const Real32getShininess (void) const
 Get the value of the PhongMaterial::_sfShininess field.
Color3fgetEmission (void)
 Get the value of the PhongMaterial::_sfEmission field.
const Color3fgetEmission (void) const
 Get the value of the PhongMaterial::_sfEmission field.
Real32getTransparency (void)
 Get the value of the PhongMaterial::_sfTransparency field.
const Real32getTransparency (void) const
 Get the value of the PhongMaterial::_sfTransparency field.
bool & getLit (void)
 Get the value of the PhongMaterial::_sfLit field.
const bool & getLit (void) const
 Get the value of the PhongMaterial::_sfLit field.
GLenumgetColorMaterial (void)
 Get the value of the PhongMaterial::_sfColorMaterial field.
const GLenumgetColorMaterial (void) const
 Get the value of the PhongMaterial::_sfColorMaterial field.
Field Set
*void setAmbient (const Color3f &value)
 Set the value of the PhongMaterial::_sfAmbient field.
void setDiffuse (const Color3f &value)
 Set the value of the PhongMaterial::_sfDiffuse field.
void setSpecular (const Color3f &value)
 Set the value of the PhongMaterial::_sfSpecular field.
void setShininess (const Real32 &value)
 Set the value of the PhongMaterial::_sfShininess field.
void setEmission (const Color3f &value)
 Set the value of the PhongMaterial::_sfEmission field.
void setTransparency (const Real32 &value)
 Set the value of the PhongMaterial::_sfTransparency field.
void setLit (const bool &value)
 Set the value of the PhongMaterial::_sfLit field.
void setColorMaterial (const GLenum &value)
 Set the value of the PhongMaterial::_sfColorMaterial 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

Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static PhongMaterialPtr create (void)
 create a new instance of the class
static PhongMaterialPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype

Static Public Attributes

static const osg::BitVector AmbientFieldMask
static const osg::BitVector DiffuseFieldMask
static const osg::BitVector SpecularFieldMask
static const osg::BitVector ShininessFieldMask
static const osg::BitVector EmissionFieldMask
static const osg::BitVector TransparencyFieldMask
static const osg::BitVector LitFieldMask
static const osg::BitVector ColorMaterialFieldMask
static const osg::BitVector MTInfluenceMask
static const osg::BitVector ChunksFieldMask
static const osg::BitVector SlotsFieldMask
static const osg::BitVector SortKeyFieldMask
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask

Protected Member Functions

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

Protected Attributes

StatePtr _pState
Fields
*SFColor3f _sfAmbient
SFColor3f _sfDiffuse
SFColor3f _sfSpecular
SFReal32 _sfShininess
SFColor3f _sfEmission
SFReal32 _sfTransparency
SFBool _sfLit
SFGLenum _sfColorMaterial

Private Types

typedef ChunkMaterial Inherited

Private Member Functions

void operator= (const PhongMaterialBase &source)

Static Private Attributes

static FieldDescription_desc []
 PhongMaterial description.
static FieldContainerType _type

Friends

class FieldContainer

Detailed Description

Definition at line 88 of file OSGPhongMaterialBase.h.


Member Typedef Documentation

typedef ChunkMaterial osg::PhongMaterialBase::Inherited [private]
 

Reimplemented from osg::ChunkMaterial.

Reimplemented in osg::PhongMaterial.

Definition at line 92 of file OSGPhongMaterialBase.h.

typedef PhongMaterialPtr osg::PhongMaterialBase::Ptr
 

Reimplemented from osg::ChunkMaterialBase.

Definition at line 97 of file OSGPhongMaterialBase.h.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
AmbientFieldId 
DiffuseFieldId 
SpecularFieldId 
ShininessFieldId 
EmissionFieldId 
TransparencyFieldId 
LitFieldId 
ColorMaterialFieldId 
NextFieldId 

Reimplemented from osg::ChunkMaterialBase.

Definition at line 99 of file OSGPhongMaterialBase.h.

00100     {
00101         AmbientFieldId       = Inherited::NextFieldId,
00102         DiffuseFieldId       = AmbientFieldId       + 1,
00103         SpecularFieldId      = DiffuseFieldId       + 1,
00104         ShininessFieldId     = SpecularFieldId      + 1,
00105         EmissionFieldId      = ShininessFieldId     + 1,
00106         TransparencyFieldId  = EmissionFieldId      + 1,
00107         LitFieldId           = TransparencyFieldId  + 1,
00108         ColorMaterialFieldId = LitFieldId           + 1,
00109         NextFieldId          = ColorMaterialFieldId + 1
00110     };


Constructor & Destructor Documentation

PhongMaterialBase::PhongMaterialBase void   )  [protected]
 

Definition at line 242 of file OSGPhongMaterialBase.cpp.

00242                                          :
00243     _sfAmbient                (Color3f(0,0,0)), 
00244     _sfDiffuse                (Color3f(0,0,0)), 
00245     _sfSpecular               (Color3f(0,0,0)), 
00246     _sfShininess              (Real32(1)), 
00247     _sfEmission               (Color3f(0,0,0)), 
00248     _sfTransparency           (Real32(0)), 
00249     _sfLit                    (bool(true)), 
00250     _sfColorMaterial          (GLenum(GL_DIFFUSE)), 
00251     Inherited() 
00252 {
00253 }

PhongMaterialBase::PhongMaterialBase const PhongMaterialBase source  )  [protected]
 

Definition at line 259 of file OSGPhongMaterialBase.cpp.

00259                                                                     :
00260     _sfAmbient                (source._sfAmbient                ), 
00261     _sfDiffuse                (source._sfDiffuse                ), 
00262     _sfSpecular               (source._sfSpecular               ), 
00263     _sfShininess              (source._sfShininess              ), 
00264     _sfEmission               (source._sfEmission               ), 
00265     _sfTransparency           (source._sfTransparency           ), 
00266     _sfLit                    (source._sfLit                    ), 
00267     _sfColorMaterial          (source._sfColorMaterial          ), 
00268     Inherited                 (source)
00269 {
00270 }

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

Definition at line 274 of file OSGPhongMaterialBase.cpp.

00275 {
00276 }


Member Function Documentation

osg::FieldContainerType & osg::PhongMaterialBase::getClassType void   )  [inline, static]
 

Reimplemented from osg::ChunkMaterialBase.

Definition at line 58 of file OSGPhongMaterialBase.inl.

References _type.

Referenced by create().

00059 {
00060     return _type; 
00061 } 

osg::UInt32 osg::PhongMaterialBase::getClassTypeId void   )  [inline, static]
 

Reimplemented from osg::ChunkMaterialBase.

Definition at line 65 of file OSGPhongMaterialBase.inl.

References _type, and osg::TypeBase::getId().

00066 {
00067     return _type.getId(); 
00068 } 

FieldContainerType & PhongMaterialBase::getType void   )  [virtual]
 

Reimplemented from osg::ChunkMaterialBase.

Definition at line 184 of file OSGPhongMaterialBase.cpp.

References _type.

00185 {
00186     return _type; 
00187 } 

const FieldContainerType & PhongMaterialBase::getType void   )  const [virtual]
 

Reimplemented from osg::ChunkMaterialBase.

Definition at line 189 of file OSGPhongMaterialBase.cpp.

References _type.

00190 {
00191     return _type;
00192 } 

UInt32 PhongMaterialBase::getContainerSize void   )  const [virtual]
 

Reimplemented from osg::ChunkMaterialBase.

Definition at line 204 of file OSGPhongMaterialBase.cpp.

00205 { 
00206     return sizeof(PhongMaterial); 
00207 }

SFColor3f * osg::PhongMaterialBase::getSFAmbient void   )  [inline]
 

Definition at line 101 of file OSGPhongMaterialBase.inl.

References _sfAmbient.

00102 {
00103     return &_sfAmbient;
00104 }

SFColor3f * osg::PhongMaterialBase::getSFDiffuse void   )  [inline]
 

Definition at line 108 of file OSGPhongMaterialBase.inl.

References _sfDiffuse.

00109 {
00110     return &_sfDiffuse;
00111 }

SFColor3f * osg::PhongMaterialBase::getSFSpecular void   )  [inline]
 

Definition at line 115 of file OSGPhongMaterialBase.inl.

References _sfSpecular.

00116 {
00117     return &_sfSpecular;
00118 }

SFReal32 * osg::PhongMaterialBase::getSFShininess void   )  [inline]
 

Definition at line 122 of file OSGPhongMaterialBase.inl.

References _sfShininess.

00123 {
00124     return &_sfShininess;
00125 }

SFColor3f * osg::PhongMaterialBase::getSFEmission void   )  [inline]
 

Definition at line 129 of file OSGPhongMaterialBase.inl.

References _sfEmission.

00130 {
00131     return &_sfEmission;
00132 }

SFReal32 * osg::PhongMaterialBase::getSFTransparency void   )  [inline]
 

Definition at line 136 of file OSGPhongMaterialBase.inl.

References _sfTransparency.

00137 {
00138     return &_sfTransparency;
00139 }

SFBool * osg::PhongMaterialBase::getSFLit void   )  [inline]
 

Definition at line 143 of file OSGPhongMaterialBase.inl.

References _sfLit.

00144 {
00145     return &_sfLit;
00146 }

SFGLenum * osg::PhongMaterialBase::getSFColorMaterial void   )  [inline]
 

Definition at line 150 of file OSGPhongMaterialBase.inl.

References _sfColorMaterial.

00151 {
00152     return &_sfColorMaterial;
00153 }

Color3f & osg::PhongMaterialBase::getAmbient void   )  [inline]
 

Definition at line 158 of file OSGPhongMaterialBase.inl.

References _sfAmbient, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::PhongMaterial::makeState(), and osg::PhongMaterial::rebuildState().

00159 {
00160     return _sfAmbient.getValue();
00161 }

const Color3f & osg::PhongMaterialBase::getAmbient void   )  const [inline]
 

Definition at line 165 of file OSGPhongMaterialBase.inl.

References _sfAmbient, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00166 {
00167     return _sfAmbient.getValue();
00168 }

Color3f & osg::PhongMaterialBase::getDiffuse void   )  [inline]
 

Definition at line 179 of file OSGPhongMaterialBase.inl.

References _sfDiffuse, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::PhongMaterial::makeState(), and osg::PhongMaterial::rebuildState().

00180 {
00181     return _sfDiffuse.getValue();
00182 }

const Color3f & osg::PhongMaterialBase::getDiffuse void   )  const [inline]
 

Definition at line 186 of file OSGPhongMaterialBase.inl.

References _sfDiffuse, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00187 {
00188     return _sfDiffuse.getValue();
00189 }

Color3f & osg::PhongMaterialBase::getSpecular void   )  [inline]
 

Definition at line 200 of file OSGPhongMaterialBase.inl.

References _sfSpecular, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::PhongMaterial::makeState(), and osg::PhongMaterial::rebuildState().

00201 {
00202     return _sfSpecular.getValue();
00203 }

const Color3f & osg::PhongMaterialBase::getSpecular void   )  const [inline]
 

Definition at line 207 of file OSGPhongMaterialBase.inl.

References _sfSpecular, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00208 {
00209     return _sfSpecular.getValue();
00210 }

Real32 & osg::PhongMaterialBase::getShininess void   )  [inline]
 

Definition at line 221 of file OSGPhongMaterialBase.inl.

References _sfShininess, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::PhongMaterial::makeState(), and osg::PhongMaterial::rebuildState().

00222 {
00223     return _sfShininess.getValue();
00224 }

const Real32 & osg::PhongMaterialBase::getShininess void   )  const [inline]
 

Definition at line 228 of file OSGPhongMaterialBase.inl.

References _sfShininess, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00229 {
00230     return _sfShininess.getValue();
00231 }

Color3f & osg::PhongMaterialBase::getEmission void   )  [inline]
 

Definition at line 242 of file OSGPhongMaterialBase.inl.

References _sfEmission, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::PhongMaterial::makeState(), and osg::PhongMaterial::rebuildState().

00243 {
00244     return _sfEmission.getValue();
00245 }

const Color3f & osg::PhongMaterialBase::getEmission void   )  const [inline]
 

Definition at line 249 of file OSGPhongMaterialBase.inl.

References _sfEmission, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00250 {
00251     return _sfEmission.getValue();
00252 }

Real32 & osg::PhongMaterialBase::getTransparency void   )  [inline]
 

Definition at line 263 of file OSGPhongMaterialBase.inl.

References _sfTransparency, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::PhongMaterial::isTransparent(), osg::PhongMaterial::makeState(), and osg::PhongMaterial::rebuildState().

00264 {
00265     return _sfTransparency.getValue();
00266 }

const Real32 & osg::PhongMaterialBase::getTransparency void   )  const [inline]
 

Definition at line 270 of file OSGPhongMaterialBase.inl.

References _sfTransparency, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00271 {
00272     return _sfTransparency.getValue();
00273 }

bool & osg::PhongMaterialBase::getLit void   )  [inline]
 

Definition at line 284 of file OSGPhongMaterialBase.inl.

References _sfLit, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::PhongMaterial::makeState(), and osg::PhongMaterial::rebuildState().

00285 {
00286     return _sfLit.getValue();
00287 }

const bool & osg::PhongMaterialBase::getLit void   )  const [inline]
 

Definition at line 291 of file OSGPhongMaterialBase.inl.

References _sfLit, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00292 {
00293     return _sfLit.getValue();
00294 }

GLenum & osg::PhongMaterialBase::getColorMaterial void   )  [inline]
 

Definition at line 305 of file OSGPhongMaterialBase.inl.

References _sfColorMaterial, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::PhongMaterial::makeState(), and osg::PhongMaterial::rebuildState().

00306 {
00307     return _sfColorMaterial.getValue();
00308 }

const GLenum & osg::PhongMaterialBase::getColorMaterial void   )  const [inline]
 

Definition at line 312 of file OSGPhongMaterialBase.inl.

References _sfColorMaterial, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00313 {
00314     return _sfColorMaterial.getValue();
00315 }

void osg::PhongMaterialBase::setAmbient const Color3f value  )  [inline]
 

Definition at line 172 of file OSGPhongMaterialBase.inl.

References _sfAmbient, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00173 {
00174     _sfAmbient.setValue(value);
00175 }

void osg::PhongMaterialBase::setDiffuse const Color3f value  )  [inline]
 

Definition at line 193 of file OSGPhongMaterialBase.inl.

References _sfDiffuse, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00194 {
00195     _sfDiffuse.setValue(value);
00196 }

void osg::PhongMaterialBase::setSpecular const Color3f value  )  [inline]
 

Definition at line 214 of file OSGPhongMaterialBase.inl.

References _sfSpecular, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00215 {
00216     _sfSpecular.setValue(value);
00217 }

void osg::PhongMaterialBase::setShininess const Real32 value  )  [inline]
 

Definition at line 235 of file OSGPhongMaterialBase.inl.

References _sfShininess, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00236 {
00237     _sfShininess.setValue(value);
00238 }

void osg::PhongMaterialBase::setEmission const Color3f value  )  [inline]
 

Definition at line 256 of file OSGPhongMaterialBase.inl.

References _sfEmission, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00257 {
00258     _sfEmission.setValue(value);
00259 }

void osg::PhongMaterialBase::setTransparency const Real32 value  )  [inline]
 

Definition at line 277 of file OSGPhongMaterialBase.inl.

References _sfTransparency, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00278 {
00279     _sfTransparency.setValue(value);
00280 }

void osg::PhongMaterialBase::setLit const bool &  value  )  [inline]
 

Definition at line 298 of file OSGPhongMaterialBase.inl.

References _sfLit, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00299 {
00300     _sfLit.setValue(value);
00301 }

void osg::PhongMaterialBase::setColorMaterial const GLenum value  )  [inline]
 

Definition at line 319 of file OSGPhongMaterialBase.inl.

References _sfColorMaterial, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

00320 {
00321     _sfColorMaterial.setValue(value);
00322 }

UInt32 PhongMaterialBase::getBinSize const BitVector whichField  )  [virtual]
 

Reimplemented from osg::ChunkMaterialBase.

Definition at line 280 of file OSGPhongMaterialBase.cpp.

References _sfAmbient, _sfColorMaterial, _sfDiffuse, _sfEmission, _sfLit, _sfShininess, _sfSpecular, _sfTransparency, AmbientFieldMask, ColorMaterialFieldMask, DiffuseFieldMask, EmissionFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::ChunkMaterialBase::getBinSize(), LitFieldMask, osg::FieldBits::NoField, ShininessFieldMask, SpecularFieldMask, and TransparencyFieldMask.

00281 {
00282     UInt32 returnValue = Inherited::getBinSize(whichField);
00283 
00284     if(FieldBits::NoField != (AmbientFieldMask & whichField))
00285     {
00286         returnValue += _sfAmbient.getBinSize();
00287     }
00288 
00289     if(FieldBits::NoField != (DiffuseFieldMask & whichField))
00290     {
00291         returnValue += _sfDiffuse.getBinSize();
00292     }
00293 
00294     if(FieldBits::NoField != (SpecularFieldMask & whichField))
00295     {
00296         returnValue += _sfSpecular.getBinSize();
00297     }
00298 
00299     if(FieldBits::NoField != (ShininessFieldMask & whichField))
00300     {
00301         returnValue += _sfShininess.getBinSize();
00302     }
00303 
00304     if(FieldBits::NoField != (EmissionFieldMask & whichField))
00305     {
00306         returnValue += _sfEmission.getBinSize();
00307     }
00308 
00309     if(FieldBits::NoField != (TransparencyFieldMask & whichField))
00310     {
00311         returnValue += _sfTransparency.getBinSize();
00312     }
00313 
00314     if(FieldBits::NoField != (LitFieldMask & whichField))
00315     {
00316         returnValue += _sfLit.getBinSize();
00317     }
00318 
00319     if(FieldBits::NoField != (ColorMaterialFieldMask