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

osg::MultiPassMaterialBase Class Reference

MultiPassMaterial Base Class.

#include <OSGMultiPassMaterialBase.h>

Inheritance diagram for osg::MultiPassMaterialBase:

osg::Material osg::MaterialBase osg::AttachmentContainer osg::FieldContainer osg::MultiPassMaterial List of all members.

Rendering

virtual void draw (DrawFunctor &func, DrawActionBase *action)=0
virtual void draw (Geometry *geo, DrawActionBase *action)=0
virtual StatePtr makeState (void)=0
virtual void rebuildState (void)=0
StatePtr getState (void)
virtual bool isTransparent (void) const =0
*typedef TypedFunctor1Base<
Action::ResultE, PtrCallArg<
DrawActionBase > > 
DrawFunctor

Public Types

typedef MultiPassMaterialPtr Ptr
enum  { MaterialsFieldId = Inherited::NextFieldId, NextFieldId = MaterialsFieldId + 1 }

Public Member Functions

Field Get
*SFInt32getSFSortKey (void)
 Get the Material::_sfSortKey field.
Int32getSortKey (void)
 Get the value of the Material::_sfSortKey field.
const Int32getSortKey (void) const
 Get the value of the Material::_sfSortKey field.
Field Set
*void setSortKey (const Int32 &value)
 Set the value of the Material::_sfSortKey field.
FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get
*MFMaterialPtrgetMFMaterials (void)
 Get the MultiPassMaterial::_mfMaterials field.
MaterialPtrgetMaterials (const UInt32 index)
 Get the value of the index element the MultiPassMaterial::_mfMaterials field.
MFMaterialPtrgetMaterials (void)
 Get the MultiPassMaterial::_mfMaterials field.
const MFMaterialPtrgetMaterials (void) const
 Get the MultiPassMaterial::_mfMaterials 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
Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
Comparison
*virtual bool operator< (const Material &other) const
virtual bool operator== (const Material &other) const
virtual bool operator!= (const Material &other) const
Field Get
*SFInt32getSFSortKey (void)
 Get the Material::_sfSortKey field.
Int32getSortKey (void)
 Get the value of the Material::_sfSortKey field.
const Int32getSortKey (void) const
 Get the value of the Material::_sfSortKey field.
Field Set
*void setSortKey (const Int32 &value)
 Set the value of the Material::_sfSortKey field.

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 MultiPassMaterialPtr create (void)
 create a new instance of the class
static MultiPassMaterialPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype
Class Get
*static const char * getClassname (void)

Static Public Attributes

static const osg::BitVector MaterialsFieldMask
static const osg::BitVector MTInfluenceMask
static const osg::BitVector SortKeyFieldMask
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask
Constants
*static const Int32 NoStateSorting = 0x7fffffff

Protected Member Functions

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

Protected Attributes

StatePtr _pState
Fields
*SFInt32 _sfSortKey
Fields
*MFMaterialPtr _mfMaterials
Fields
*SFInt32 _sfSortKey

Private Types

typedef Material Inherited

Private Member Functions

void operator= (const MultiPassMaterialBase &source)

Static Private Attributes

static FieldDescription_desc []
 MultiPassMaterial description.
static FieldContainerType _type

Friends

class FieldContainer

Detailed Description

Definition at line 81 of file OSGMultiPassMaterialBase.h.


Member Typedef Documentation

typedef Material osg::MultiPassMaterialBase::Inherited [private]
 

Reimplemented from osg::Material.

Reimplemented in osg::MultiPassMaterial.

Definition at line 85 of file OSGMultiPassMaterialBase.h.

typedef MultiPassMaterialPtr osg::MultiPassMaterialBase::Ptr
 

Reimplemented from osg::MaterialBase.

Definition at line 90 of file OSGMultiPassMaterialBase.h.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
MaterialsFieldId 
NextFieldId 

Reimplemented from osg::MaterialBase.

Definition at line 92 of file OSGMultiPassMaterialBase.h.


Constructor & Destructor Documentation

MultiPassMaterialBase::MultiPassMaterialBase void   )  [protected]
 

Definition at line 165 of file OSGMultiPassMaterialBase.cpp.

00165                                                  :
00166     _mfMaterials              (), 
00167     Inherited() 
00168 {
00169 }

MultiPassMaterialBase::MultiPassMaterialBase const MultiPassMaterialBase source  )  [protected]
 

Definition at line 175 of file OSGMultiPassMaterialBase.cpp.

00175                                                                                 :
00176     _mfMaterials              (source._mfMaterials              ), 
00177     Inherited                 (source)
00178 {
00179 }

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

Definition at line 183 of file OSGMultiPassMaterialBase.cpp.

00184 {
00185 }


Member Function Documentation

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

Reimplemented from osg::MaterialBase.

Definition at line 58 of file OSGMultiPassMaterialBase.inl.

References _type.

Referenced by create().

00059 {
00060     return _type; 
00061 } 

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

Reimplemented from osg::MaterialBase.

Definition at line 65 of file OSGMultiPassMaterialBase.inl.

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

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

FieldContainerType & MultiPassMaterialBase::getType void   )  [virtual]
 

Reimplemented from osg::MaterialBase.

Definition at line 106 of file OSGMultiPassMaterialBase.cpp.

References _type.

00107 {
00108     return _type; 
00109 } 

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

Reimplemented from osg::MaterialBase.

Definition at line 111 of file OSGMultiPassMaterialBase.cpp.

References _type.

00112 {
00113     return _type;
00114 } 

UInt32 MultiPassMaterialBase::getContainerSize void   )  const [virtual]
 

Reimplemented from osg::MaterialBase.

Definition at line 126 of file OSGMultiPassMaterialBase.cpp.

00127 { 
00128     return sizeof(MultiPassMaterial); 
00129 }

MFMaterialPtr * osg::MultiPassMaterialBase::getMFMaterials void   )  [inline]
 

Definition at line 101 of file OSGMultiPassMaterialBase.inl.

References _mfMaterials.

00102 {
00103     return &_mfMaterials;
00104 }

MaterialPtr & osg::MultiPassMaterialBase::getMaterials const UInt32  index  )  [inline]
 

Definition at line 110 of file OSGMultiPassMaterialBase.inl.

References _mfMaterials.

00111 {
00112     return _mfMaterials[index];
00113 }

MFMaterialPtr & osg::MultiPassMaterialBase::getMaterials void   )  [inline]
 

Definition at line 117 of file OSGMultiPassMaterialBase.inl.

References _mfMaterials.

00118 {
00119     return _mfMaterials;
00120 }

const MFMaterialPtr & osg::MultiPassMaterialBase::getMaterials void   )  const [inline]
 

Definition at line 124 of file OSGMultiPassMaterialBase.inl.

References _mfMaterials.

00125 {
00126     return _mfMaterials;
00127 }

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

Reimplemented from osg::MaterialBase.

Definition at line 189 of file OSGMultiPassMaterialBase.cpp.

References _mfMaterials, osg::MField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::MaterialBase::getBinSize(), MaterialsFieldMask, and osg::FieldBits::NoField.

00190 {
00191     UInt32 returnValue = Inherited::getBinSize(whichField);
00192 
00193     if(FieldBits::NoField != (MaterialsFieldMask & whichField))
00194     {
00195         returnValue += _mfMaterials.getBinSize();
00196     }
00197 
00198 
00199     return returnValue;
00200 }

void MultiPassMaterialBase::copyToBin BinaryDataHandler pMem,
const BitVector whichField
[virtual]
 

Reimplemented from osg::MaterialBase.

Definition at line 202 of file OSGMultiPassMaterialBase.cpp.

References _mfMaterials, osg::MField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::MaterialBase::copyToBin(), MaterialsFieldMask, and osg::FieldBits::NoField.

00204 {
00205     Inherited::copyToBin(pMem, whichField);
00206 
00207     if(FieldBits::NoField != (MaterialsFieldMask & whichField))
00208     {
00209         _mfMaterials.copyToBin(pMem);
00210     }
00211 
00212 
00213 }

void MultiPassMaterialBase::copyFromBin BinaryDataHandler pMem,
const BitVector whichField
[virtual]
 

Reimplemented from osg::MaterialBase.

Definition at line 215 of file OSGMultiPassMaterialBase.cpp.

References _mfMaterials, osg::MField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::MaterialBase::copyFromBin(), MaterialsFieldMask, and osg::FieldBits::NoField.

00217 {
00218     Inherited::copyFromBin(pMem, whichField);
00219 
00220     if(FieldBits::NoField != (MaterialsFieldMask & whichField))
00221     {
00222         _mfMaterials.copyFromBin(pMem);
00223     }
00224 
00225 
00226 }

MultiPassMaterialPtr osg::MultiPassMaterialBase::create void   )  [inline, static]
 

Definition at line 72 of file OSGMultiPassMaterialBase.inl.

References osg::AttachmentContainerPtr::dcast(), getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and shallowCopy().

00073 {
00074     MultiPassMaterialPtr fc; 
00075 
00076     if(getClassType().getPrototype() != OSG::NullFC) 
00077     {
00078         fc = MultiPassMaterialPtr::dcast(
00079             getClassType().getPrototype()-> shallowCopy()); 
00080     }
00081     
00082     return fc; 
00083 }

MultiPassMaterialPtr osg::MultiPassMaterialBase::createEmpty void   )  [inline, static]
 

Definition at line 87 of file OSGMultiPassMaterialBase.inl.

References osg::FieldContainer::newPtr().

00088 { 
00089     MultiPassMaterialPtr returnValue; 
00090     
00091     newPtr(returnValue); 
00092 
00093     return returnValue; 
00094 }

FieldContainerPtr MultiPassMaterialBase::shallowCopy void   )  const [virtual]
 

Implements osg::FieldContainer.

Definition at line 117 of file OSGMultiPassMaterialBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by create().

00118 { 
00119     MultiPassMaterialPtr returnValue; 
00120 
00121     newPtr(returnValue, dynamic_cast<const MultiPassMaterial *>(this)); 
00122 
00123     return returnValue; 
00124 }

void MultiPassMaterialBase::executeSyncImpl MultiPassMaterialBase pOther,
const BitVector whichField
[protected]
 

Definition at line 229 of file OSGMultiPassMaterialBase.cpp.

References _mfMaterials, osg::MaterialBase::executeSyncImpl(), MaterialsFieldMask, osg::FieldBits::NoField, and osg::MField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by executeSync().

00231 {
00232 
00233     Inherited::executeSyncImpl(pOther, whichField);
00234 
00235     if(FieldBits::NoField != (MaterialsFieldMask & whichField))
00236         _mfMaterials.syncWith(pOther->_mfMaterials);
00237 
00238 
00239 }

void MultiPassMaterialBase::executeSync FieldContainer other,
const BitVector whichField
[protected, virtual]
 

Reimplemented from osg::MaterialBase.

Definition at line 133 of file OSGMultiPassMaterialBase.cpp.

References executeSyncImpl().

00135 {
00136     this->executeSyncImpl((MultiPassMaterialBase *) &other, whichField);
00137 }

void osg::MultiPassMaterialBase::operator= const MultiPassMaterialBase source  )  [private]
 

* static const char* osg::Material::getClassname void   )  [inline, static, inherited]
 

Reimplemented in osg::ChunkMaterial, and osg::SimpleMaterial.

Definition at line 71 of file OSGMaterial.h.

00071 { return "Material"; };

void Material::changed BitVector  whichField,
UInt32  origin
[virtual, inherited]
 

Reimplemented from osg::AttachmentContainer.

Reimplemented in osg::ChunkMaterial, osg::FresnelMaterial, osg::MultiPassMaterial, osg::PhongMaterial, osg::SimpleMaterial, osg::SimpleTexturedMaterial, and osg::DVRAppearance.

Definition at line 157 of file OSGMaterial.cpp.

References osg::AttachmentContainer::changed(), and osg::Material::rebuildState().

Referenced by osg::MultiPassMaterial::changed(), and osg::ChunkMaterial::changed().

00158 {
00159     Inherited::changed(whichField, origin);
00160 
00161     rebuildState();
00162 }

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

Reimplemented from osg::AttachmentContainer.

Reimplemented in osg::ChunkMaterial, osg::FresnelMaterial, osg::MultiPassMaterial, osg::PhongMaterial, osg::SimpleMaterial, osg::SimpleTexturedMaterial, and osg::DVRAppearance.

Definition at line 166 of file OSGMaterial.cpp.

References SLOG.

00168 {
00169     SLOG << "Material::dump called: NIY!" << std::endl;
00170 //   Inherited::dump(uiIndent, bvFlags);
00171 }

virtual void osg::Material::draw DrawFunctor func,
DrawActionBase action
[pure virtual, inherited]
 

Implemented in osg::ChunkMaterial, and osg::MultiPassMaterial.

Referenced by osg::DVRVolume::doDraw(), and osg::MaterialDrawable::drawActionHandler().

virtual void osg::Material::draw Geometry geo,
DrawActionBase action
[pure virtual, inherited]
 

Implemented in osg::ChunkMaterial, and osg::MultiPassMaterial.

osg::Material::makeState void   )  [pure virtual, inherited]
 

Creates an instance of a osg::State that is used to represent the material. This is used by the osg::DrawAction.

Implemented in osg::ChunkMaterial, osg::FresnelMaterial, osg::MultiPassMaterial, osg::PhongMaterial, osg::SimpleMaterial, and osg::SimpleTexturedMaterial.

osg::Material::rebuildState void   )  [pure virtual, inherited]
 

Update the internal osg::State.

Implemented in osg::ChunkMaterial, osg::FresnelMaterial, osg::MultiPassMaterial, osg::PhongMaterial, osg::SimpleMaterial, and osg::SimpleTexturedMaterial.

Referenced by osg::Material::changed(), osg::RenderAction::dropFunctor(), and osg::RenderAction::dropGeometry().

StatePtr Material::getState void   )  [inherited]
 

Access the internal osg::State, used by the osg::RenderAction.

Definition at line 152 of file OSGMaterial.cpp.

References osg::Material::_pState.

Referenced by osg::RenderAction::dropFunctor(), and osg::RenderAction::dropGeometry().

00153 {
00154     return _pState;
00155 }

osg::Material::isTransparent void   )  const [pure virtual, inherited]
 

Check if the Material is transparent and thus has to be rendered afte the opaque ones.

Implemented in osg::ChunkMaterial, osg::FresnelMaterial, osg::MultiPassMaterial, osg::PhongMaterial, osg::SimpleMaterial, and osg::SimpleTexturedMaterial.

Referenced by osg::RenderAction::dropFunctor(), and osg::RenderAction::dropGeometry().

bool Material::operator< const Material other  )  const [virtual, inherited]
 

Definition at line 175 of file OSGMaterial.cpp.

00176 {
00177     return this < &other;
00178 }

bool Material::operator== const Material other  )  const [virtual, inherited]
 

Definition at line 180 of file OSGMaterial.cpp.

References osg::Material::_pState.

00181 {
00182     return _pState == other._pState;
00183 }

bool Material::operator!= const Material other  )  const [virtual, inherited]
 

Definition at line 185 of file OSGMaterial.cpp.

00186 {
00187     return ! (*this == other);
00188 }

SFInt32 * osg::MaterialBase::getSFSortKey void   )  [inline, inherited]
 

Definition at line 75 of file OSGMaterialBase.inl.

References osg::MaterialBase::_sfSortKey.

00076 {
00077     return &_sfSortKey;
00078 }

Int32 & osg::MaterialBase::getSortKey void   )  [inline, inherited]
 

Definition at line 83 of file OSGMaterialBase.inl.

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

Referenced by osg::RenderAction::dropFunctor(), and osg::RenderAction::dropGeometry().

00084 {
00085     return _sfSortKey.getValue();
00086 }

const Int32 & osg::MaterialBase::getSortKey void   )  const [inline, inherited]
 

Definition at line 90 of file OSGMaterialBase.inl.

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

00091 {
00092     return _sfSortKey.getValue();
00093 }

void osg::MaterialBase::setSortKey const Int32 value  )  [inline, inherited]
 

Definition at line 97 of file OSGMaterialBase.inl.

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

00098 {
00099     _sfSortKey.setValue(value);
00100 }

void MaterialBase::executeSyncImpl MaterialBase pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 219 of file OSGMaterialBase.cpp.

References osg::MaterialBase::_sfSortKey, osg::AttachmentContainer::executeSyncImpl(), osg::FieldBits::NoField, osg::MaterialBase::SortKeyFieldMask, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by osg::MaterialBase::executeSync(), executeSyncImpl(), and osg::ChunkMaterialBase::executeSyncImpl().

00221 {
00222 
00223     Inherited::executeSyncImpl(pOther, whichField);
00224 
00225     if(FieldBits::NoField != (SortKeyFieldMask & whichField))
00226         _sfSortKey.syncWith(pOther->_sfSortKey);
00227 
00228 
00229 }

void AttachmentContainer::executeSyncImpl AttachmentContainer pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 316 of file OSGAttachmentContainer.cpp.

References osg::AttachmentContainer::_attachmentMap, osg::AttachmentContainer::AttachmentsFieldMask, osg::FieldContainer::executeSyncImpl(), osg::FieldBits::NoField, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by osg::AttachmentContainer::executeSync(), osg::WindowBase::executeSyncImpl(), osg::ViewportBase::executeSyncImpl(), osg::ShaderParameterBase::executeSyncImpl(), osg::Node::executeSyncImpl(), osg::NodeCore::executeSyncImpl(), osg::MaterialBase::executeSyncImpl(), osg::ImageComposerBase::executeSyncImpl(), osg::ImageBase::executeSyncImpl(), osg::ForegroundBase::executeSyncImpl(), osg::DisplayCalibrationBase::executeSyncImpl(), osg::CameraBase::executeSyncImpl(), and osg::BackgroundBase::executeSyncImpl().

00319 {
00320     Inherited::executeSyncImpl(pOther, whichField);
00321 
00322     if (FieldBits::NoField != (AttachmentsFieldMask & whichField))
00323     {
00324         _attachmentMap.syncWith(pOther->_attachmentMap);
00325     }
00326 }

void osg::FieldContainer::executeSyncImpl FieldContainer pOther,
const BitVector whichField
[inline, protected, inherited]
 

Definition at line 333 of file OSGFieldContainerImpl.inl.

Referenced by osg::StateBase::executeSyncImpl(), osg::DVRShaderBase::executeSyncImpl(), osg::DVRClipGeometryBase::executeSyncImpl(), osg::AttachmentContainer::executeSyncImpl(), and osg::Attachment::executeSyncImpl().

00335 {
00336 }

void AttachmentContainer::addAttachment const AttachmentPtr fieldContainerP,
UInt16  binding = 0
[inherited]
 

Definition at line 84 of file OSGAttachmentContainer.cpp.

References osg::addRefCP(), osg::beginEditCP(), osg::endEditCP(), osg::NullFC, and osg::subRefCP().

Referenced by osg::AttachmentContainer::AttachmentContainer(), osg::Node::onCreate(), and osg::Image::setAttachmentField().

00086 {
00087     UInt32 key;
00088 
00089     if(fieldContainerP == NullFC)
00090         return;
00091 
00092     key = (UInt32 (fieldContainerP->getGroupId()) << 16) | binding;
00093 
00094     addRefCP(fieldContainerP);
00095 
00096     beginEditCP(fieldContainerP, Attachment::ParentsFieldMask);
00097     {
00098         fieldContainerP->addParent(getPtr());
00099     }
00100     endEditCP  (fieldContainerP, Attachment::ParentsFieldMask);
00101 
00102     AttachmentMap::iterator fcI = _attachmentMap.getValue().find(key);
00103 
00104     if(fcI != _attachmentMap.getValue().end())
00105     {
00106         beginEditCP((*fcI).second, Attachment::ParentsFieldMask);
00107         {
00108             (*fcI).second->subParent(getPtr());
00109         }
00110         endEditCP  ((*fcI).second, Attachment::ParentsFieldMask);
00111 
00112         subRefCP((*fcI).second);
00113 
00114         (*fcI).second = fieldContainerP;
00115     }
00116     else
00117     {
00118         _attachmentMap.getValue()[key] = fieldContainerP;
00119     }
00120 }

void AttachmentContainer::subAttachment const AttachmentPtr fieldContainerP,
UInt16  binding = 0
[inherited]
 

Definition at line 122 of file OSGAttachmentContainer.cpp.

References osg::AttachmentContainer::_attachmentMap, osg::beginEditCP(), osg::endEditCP(), osg::AttachmentContainer::getPtr(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), osg::NullFC, osg::Attachment::ParentsFieldMask, and osg::subRefCP().

00124 {
00125     UInt32 key;
00126 
00127     AttachmentMap::iterator fcI;
00128 
00129     if(fieldContainerP == NullFC)
00130         return;
00131 
00132     key = (UInt32(fieldContainerP->getGroupId()) << 16) | binding;
00133 
00134     fcI = _attachmentMap.getValue().find(key);
00135 
00136     if(fcI != _attachmentMap.getValue().end())
00137     {
00138         beginEditCP(fieldContainerP, Attachment::ParentsFieldMask);
00139         {
00140             (*fcI).second->subParent(getPtr());
00141         }
00142         endEditCP  (fieldContainerP, Attachment::ParentsFieldMask);
00143 
00144         subRefCP((*fcI).second);
00145 
00146         _attachmentMap.getValue().erase(fcI);
00147     }
00148 }

AttachmentPtr AttachmentContainer::findAttachment UInt32  groupId,
UInt16