#include <OSGDVRAppearance.h>
Inheritance diagram for osg::DVRAppearance:

Rendering | |
| StatePtr | getState (void) |
| *typedef TypedFunctor1Base< Action::ResultE, PtrCallArg< DrawActionBase > > | DrawFunctor |
Public Types | |
| typedef DVRAppearancePtr | Ptr |
| enum | { ChunksFieldId = Inherited::NextFieldId, SlotsFieldId = ChunksFieldId + 1, NextFieldId = SlotsFieldId + 1 } |
Public Member Functions | |
Sync | |
| *virtual void | changed (BitVector whichField, UInt32 from) |
| react to field changes | |
Output | |
| *virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
| output the instance for debug purposes | |
FieldContainer Get | |
| *virtual FieldContainerType & | getType (void) |
| virtual const FieldContainerType & | getType (void) const |
| virtual UInt32 | getContainerSize (void) const |
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 |
Rendering | |
| *virtual void | draw (DrawFunctor &func, DrawActionBase *action) |
| virtual void | draw (Geometry *geo, DrawActionBase *action) |
| virtual StatePtr | makeState (void) |
| virtual void | rebuildState (void) |
| virtual bool | isTransparent (void) const |
Access | |
| *bool | addChunk (StateChunkPtr chunk, Int32 slot=State::AutoSlotReplace) |
| bool | subChunk (StateChunkPtr chunk, Int32 slot=State::AutoSlotReplace) |
| Int32 | find (StateChunkPtr chunk) |
| StateChunkPtr | find (const FieldContainerType &type, Int32 slot=State::AutoSlotReplace) |
| virtual bool | operator== (const Material &other) |
Comparison | |
| virtual bool | operator== (const Material &other) const |
| *virtual bool | operator< (const Material &other) const |
| virtual bool | operator!= (const Material &other) const |
Field Get | |
| *MFStateChunkPtr * | getMFChunks (void) |
| Get the ChunkMaterial::_mfChunks field. | |
| MFInt32 * | getMFSlots (void) |
| Get the ChunkMaterial::_mfSlots field. | |
| StateChunkPtr & | getChunks (const UInt32 index) |
| Get the value of the index element the ChunkMaterial::_mfChunks field. | |
| MFStateChunkPtr & | getChunks (void) |
| Get the ChunkMaterial::_mfChunks field. | |
| const MFStateChunkPtr & | getChunks (void) const |
| Get the ChunkMaterial::_mfChunks field. | |
| Int32 & | getSlots (const UInt32 index) |
| Get the value of the index element the ChunkMaterial::_mfSlots field. | |
| MFInt32 & | getSlots (void) |
| Get the ChunkMaterial::_mfSlots field. | |
| const MFInt32 & | getSlots (void) const |
| Get the ChunkMaterial::_mfSlots field. | |
Field Get | |
| *SFInt32 * | getSFSortKey (void) |
| Get the Material::_sfSortKey field. | |
| Int32 & | getSortKey (void) |
| Get the value of the Material::_sfSortKey field. | |
| const Int32 & | getSortKey (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 FieldContainerType & | getClassType (void) |
| access the type of the class | |
| static UInt32 | getClassTypeId (void) |
| access the numerical type of the class | |
Construction | |
| *static DVRAppearancePtr | create (void) |
| create a new instance of the class | |
| static DVRAppearancePtr | 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 | MTInfluenceMask |
| static const osg::BitVector | ChunksFieldMask |
| static const osg::BitVector | SlotsFieldMask |
| static const osg::BitVector | SortKeyFieldMask |
| static const BitVector | AttachmentsFieldMask |
| static const BitVector | NextFieldMask |
Constants | |
| *static const Int32 | NoStateSorting = 0x7fffffff |
Protected Member Functions | |
Constructors | |
| * | DVRAppearance (void) |
| Constructor. | |
| DVRAppearance (const DVRAppearance &source) | |
| Copy Constructor. | |
Destructors | |
| *virtual | ~DVRAppearance (void) |
| Destructor. | |
Sync | |
| *void | executeSyncImpl (DVRAppearanceBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (ChunkMaterialBase *pOther, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (MaterialBase *pOther, const BitVector &whichField) |
Protected Attributes | |
| StatePtr | _pState |
Fields | |
| *MFStateChunkPtr | _mfChunks |
| MFInt32 | _mfSlots |
Fields | |
| *SFInt32 | _sfSortKey |
Private Types | |
| typedef DVRAppearanceBase | Inherited |
Private Member Functions | |
| void | operator= (const DVRAppearance &source) |
Static Private Member Functions | |
| static void | initMethod (void) |
| initialize the static features of the class, e.g. action callbacks | |
Friends | |
| class | FieldContainer |
| class | DVRAppearanceBase |
Definition at line 54 of file OSGDVRAppearance.h.
|
|
Reimplemented from osg::DVRAppearanceBase. Definition at line 58 of file OSGDVRAppearance.h. |
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 89 of file OSGDVRAppearanceBase.h. |
|
|
Reimplemented from osg::MaterialBase. Definition at line 93 of file OSGChunkMaterialBase.h. 00094 { 00095 ChunksFieldId = Inherited::NextFieldId, 00096 SlotsFieldId = ChunksFieldId + 1, 00097 NextFieldId = SlotsFieldId + 1 00098 };
|
|
|
Definition at line 62 of file OSGDVRAppearance.cpp. 00062 : 00063 Inherited() 00064 { 00065 }
|
|
|
Definition at line 68 of file OSGDVRAppearance.cpp. 00068 : 00069 Inherited(source) 00070 { 00071 }
|
|
|
Definition at line 74 of file OSGDVRAppearance.cpp.
|
|
||||||||||||
|
Reimplemented from osg::ChunkMaterial. Definition at line 86 of file OSGDVRAppearance.cpp. References osg::ChunkMaterial::changed(). 00087 { 00088 Inherited::changed(whichField, origin); 00089 }
|
|
||||||||||||
|
Reimplemented from osg::ChunkMaterial. Definition at line 92 of file OSGDVRAppearance.cpp. References SLOG. 00094 { 00095 SLOG << "Dump DVRAppearance NI" << std::endl; 00096 }
|
|
|
Reimplemented from osg::ChunkMaterial. Definition at line 81 of file OSGDVRAppearance.cpp.
|
|
|
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 58 of file OSGDVRAppearanceBase.inl. References osg::DVRAppearanceBase::_type. Referenced by osg::DVRAppearanceBase::create(). 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 65 of file OSGDVRAppearanceBase.inl. References osg::DVRAppearanceBase::_type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 86 of file OSGDVRAppearanceBase.cpp. References osg::DVRAppearanceBase::_type. 00087 { 00088 return _type; 00089 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 91 of file OSGDVRAppearanceBase.cpp. References osg::DVRAppearanceBase::_type. 00092 { 00093 return _type; 00094 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 106 of file OSGDVRAppearanceBase.cpp. 00107 { 00108 return sizeof(DVRAppearance); 00109 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 166 of file OSGDVRAppearanceBase.cpp. References osg::ChunkMaterialBase::getBinSize(). 00167 { 00168 UInt32 returnValue = Inherited::getBinSize(whichField); 00169 00170 00171 return returnValue; 00172 }
|
|
||||||||||||
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 174 of file OSGDVRAppearanceBase.cpp. References osg::ChunkMaterialBase::copyToBin(). 00176 { 00177 Inherited::copyToBin(pMem, whichField); 00178 00179 00180 }
|
|
||||||||||||
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 182 of file OSGDVRAppearanceBase.cpp. References osg::ChunkMaterialBase::copyFromBin(). 00184 { 00185 Inherited::copyFromBin(pMem, whichField); 00186 00187 00188 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 72 of file OSGDVRAppearanceBase.inl. References osg::AttachmentContainerPtr::dcast(), osg::DVRAppearanceBase::getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and osg::DVRAppearanceBase::shallowCopy(). 00073 { 00074 DVRAppearancePtr fc; 00075 00076 if(getClassType().getPrototype() != OSG::NullFC) 00077 { 00078 fc = DVRAppearancePtr::dcast( 00079 getClassType().getPrototype()-> shallowCopy()); 00080 } 00081 00082 return fc; 00083 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 87 of file OSGDVRAppearanceBase.inl. References osg::FieldContainer::newPtr(). 00088 { 00089 DVRAppearancePtr returnValue; 00090 00091 newPtr(returnValue); 00092 00093 return returnValue; 00094 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 97 of file OSGDVRAppearanceBase.cpp. References osg::FieldContainer::newPtr(). Referenced by osg::DVRAppearanceBase::create(). 00098 { 00099 DVRAppearancePtr returnValue; 00100 00101 newPtr(returnValue, dynamic_cast<const DVRAppearance *>(this)); 00102 00103 return returnValue; 00104 }
|
|
||||||||||||
|
Definition at line 191 of file OSGDVRAppearanceBase.cpp. References osg::ChunkMaterialBase::executeSyncImpl(). Referenced by osg::DVRAppearanceBase::executeSync(). 00193 { 00194 00195 Inherited::executeSyncImpl(pOther, whichField); 00196 00197 00198 }
|
|
||||||||||||
|
Definition at line 258 of file OSGChunkMaterialBase.cpp. References osg::ChunkMaterialBase::_mfChunks, osg::ChunkMaterialBase::_mfSlots, osg::ChunkMaterialBase::ChunksFieldMask, osg::MaterialBase::executeSyncImpl(), osg::FieldBits::NoField, osg::ChunkMaterialBase::SlotsFieldMask, and osg::MField< FieldTypeT, fieldNameSpace >::syncWith(). Referenced by osg::ChunkMaterialBase::executeSync(), osg::SimpleMaterialBase::executeSyncImpl(), osg::PhongMaterialBase::executeSyncImpl(), osg::FresnelMaterialBase::executeSyncImpl(), and osg::DVRAppearanceBase::executeSyncImpl(). 00260 { 00261 00262 Inherited::executeSyncImpl(pOther, whichField); 00263 00264 if(FieldBits::NoField != (ChunksFieldMask & whichField)) 00265 _mfChunks.syncWith(pOther->_mfChunks); 00266 00267 if(FieldBits::NoField != (SlotsFieldMask & whichField)) 00268 _mfSlots.syncWith(pOther->_mfSlots); 00269 00270 00271 }
|
|
||||||||||||
|
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(), osg::MultiPassMaterialBase::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 }
|
|
||||||||||||
|
||||||||||||
|
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().
|
|
||||||||||||
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 113 of file OSGDVRAppearanceBase.cpp. References osg::DVRAppearanceBase::executeSyncImpl(). 00115 { 00116 this->executeSyncImpl((DVRAppearanceBase *) &other, whichField); 00117 }
|
|
|
Reimplemented from osg::Material. Reimplemented in osg::SimpleMaterial. Definition at line 64 of file OSGChunkMaterial.h.
|
|
||||||||||||
|
Draw the function behind the functor with this material. The functored function should be very careful changing OpenGL state, better just use glBegin(), glEnd() and the standard stuff in between. Implements osg::Material. Definition at line 274 of file OSGChunkMaterial.cpp. References osg::addRefCP(), osg::ChunkMaterial::makeState(), and osg::subRefCP(). 00275 { 00276 StatePtr state = makeState(); 00277 00278 addRefCP(state); 00279 00280 state->activate(action); 00281 00282 func.call(action); 00283 00284 state->deactivate(action); 00285 00286 subRefCP(state); // kill it 00287 }
|
|
||||||||||||
|
Draw the geometry with this material. Implements osg::Material. Definition at line 254 of file OSGChunkMaterial.cpp. References osg::addRefCP(), osg::Geometry::drawPrimitives(), osg::ChunkMaterial::makeState(), and osg::subRefCP(). 00255 { 00256 StatePtr state = makeState(); 00257 00258 addRefCP(state); 00259 00260 state->activate(action); 00261 00262 geo->drawPrimitives(action); 00263 00264 state->deactivate(action); 00265 00266 subRefCP(state); // kill it 00267 }
|
|
|
Create a osg::State that represents this Material and return it. Implements osg::Material. Reimplemented in osg::FresnelMaterial, osg::PhongMaterial, osg::SimpleMaterial, and osg::SimpleTexturedMaterial. Definition at line 292 of file OSGChunkMaterial.cpp. References osg::ChunkMaterialBase::_mfChunks, osg::ChunkMaterialBase::_mfSlots, osg::State::AutoSlotReplace, osg::StateBase::create(), and osg::MField< FieldTypeT, fieldNameSpace >::size(). Referenced by osg::ChunkMaterial::draw(). 00293 { 00294 StatePtr state = State::create(); 00295 UInt32 i; 00296 00297 for(i = 0; i < _mfChunks.size(); ++i) 00298 state->addChunk(_mfChunks[i], 00299 (i < _mfSlots.size()) ? _mfSlots[i] 00300 : State::AutoSlotReplace); 00301 00302 return state; 00303 }
|
|
|
Rebuild the internal State. Just collects the chunks in the State. Implements osg::Material. Reimplemented in osg::FresnelMaterial, osg::PhongMaterial, osg::SimpleMaterial, and osg::SimpleTexturedMaterial. Definition at line 308 of file OSGChunkMaterial.cpp. References osg::ChunkMaterialBase::_mfChunks, osg::ChunkMaterialBase::_mfSlots, osg::Material::_pState, osg::addRefCP(), osg::State::AutoSlotReplace, osg::StateBase::create(), osg::NullFC, and osg::MField< FieldTypeT, fieldNameSpace >::size(). 00309 { 00310 if(_pState != NullFC) 00311 { 00312 _pState->clearChunks(); 00313 } 00314 else 00315 { 00316 _pState = State::create(); 00317 00318 addRefCP(_pState); 00319 } 00320 00321 UInt32 i; 00322 00323 for(i = 0; i < _mfChunks.size(); ++i) 00324 _pState->addChunk(_mfChunks[i], 00325 (i < _mfSlots.size()) ? _mfSlots[i] 00326 : State::AutoSlotReplace); 00327 }
|
|
|
Check if the Material (i.e. any of its chunks) is transparent.. Implements osg::Material. Reimplemented in osg::FresnelMaterial, osg::PhongMaterial, osg::SimpleMaterial, and osg::SimpleTexturedMaterial. Definition at line 332 of file OSGChunkMaterial.cpp. References osg::ChunkMaterialBase::_mfChunks, osg::MField< FieldTypeT, fieldNameSpace >::begin(), and osg::MField< FieldTypeT, fieldNameSpace >::end(). Referenced by osg::SimpleMaterial::isTransparent(), osg::PhongMaterial::isTransparent(), and osg::FresnelMaterial::isTransparent(). 00333 { 00334 bool returnValue = false; 00335 00336 MFStateChunkPtr::const_iterator it = _mfChunks.begin(); 00337 MFStateChunkPtr::const_iterator chunksEnd = _mfChunks.end(); 00338 00339 for(; it != chunksEnd && returnValue == false; ++it) 00340 { 00341 returnValue =(*it)->isTransparent(); 00342 } 00343 00344 return returnValue; 00345 }
|
|
||||||||||||
|
Add the given chunk to the material. It is possible to specify which slot this chunk should be associated with. See StateChunkClass for a general description of the slots concept. The default slot is State::AutoSlotReplace. Definition at line 144 of file OSGChunkMaterial.cpp. References osg::ChunkMaterialBase::_mfChunks, osg::ChunkMaterialBase::_mfSlots, osg::addRefCP(), osg::State::AutoSlotReplace, osg::MField< FieldTypeT, fieldNameSpace >::push_back(), and osg::MField< FieldTypeT, fieldNameSpace >::size(). 00145 { 00146 if(slot != State::AutoSlotReplace) 00147 { 00148 while(_mfSlots.size() < _mfChunks.size()) 00149 _mfSlots.push_back(State::AutoSlotReplace); 00150 } 00151 00152 _mfChunks.push_back(chunk); 00153 00154 if(slot != State::AutoSlotReplace) 00155 _mfSlots.push_back(slot); 00156 00157 addRefCP(chunk); 00158 00159 return true; 00160 }
|
|
||||||||||||
|
Remove the given chunk from the material. If the slot is not State::AutoSlotReplace, only the given slot will be searched and removed if found. Returns true if the chunk couldn't be found. Definition at line 166 of file OSGChunkMaterial.cpp. References osg::ChunkMaterialBase::_mfChunks, osg::ChunkMaterialBase::_mfSlots, osg::State::AutoSlotReplace, osg::MField< FieldTypeT, fieldNameSpace >::begin(), osg::MField< FieldTypeT, fieldNameSpace >::erase(), osg::MField< FieldTypeT, fieldNameSpace >::size(), osg::subRefCP(), and SWARNING. 00167 { 00168 UInt32 i; 00169 00170 for(i = 0; i < _mfChunks.size(); ++i) 00171 { 00172 if(_mfChunks[i] == chunk && 00173 ((i < _mfSlots.size() && _mfSlots[i] == slot) || 00174 slot == State::AutoSlotReplace)) 00175 { 00176 subRefCP(chunk); 00177 _mfChunks.erase(_mfChunks.begin() + i); 00178 if(i < _mfSlots.size()) 00179 _mfSlots.erase(_mfSlots.begin() + i); 00180 return false; 00181 } 00182 } 00183 00184 SWARNING << "ChunkMaterial::subChunk(" << this << ") has no chunk " 00185 << chunk << " with slot " << slot << std::endl; 00186 00187 return true; 00188 }
|
|
|
Search the list of chunks for the given chunk. Returns its index, -1 if the chunk is not used in the material. Definition at line 194 of file OSGChunkMaterial.cpp. References osg::ChunkMaterialBase::_mfChunks, and osg::MField< FieldTypeT, fieldNameSpace >::size(). 00195 { 00196 UInt32 i; 00197 00198 for(i = 0; i < _mfChunks.size(); ++i) 00199 { 00200 if(_mfChunks[i] == chunk) 00201 return i; 00202 } 00203 00204 return -1; 00205 }
|
|
||||||||||||
|
Search the list of chunks for a chunk of the given type and the given slot. If slot is State::AutoSlotReplace, all slots are searched and the first found chunk is returned. Definition at line 212 of file OSGChunkMaterial.cpp. References osg::ChunkMaterialBase::_mfChunks, osg::State::AutoSlotReplace, osg::ChunkMaterialBase::getSlots(), osg::NullFC, p, and osg::MField< FieldTypeT, fieldNameSpace >::size(). 00214 { 00215 UInt32 index = 0; 00216 for(UInt32 i = 0; i < _mfChunks.size(); ++i) 00217 { 00218 StateChunkPtr p = _mfChunks[i]; 00219 Int32 s = State::AutoSlotReplace; 00220 00221 if(i < getSlots().size()) 00222 s = getSlots(i); 00223 00224 if(s == State::AutoSlotReplace) 00225 s = index; 00226 00227 if(p->getType() == type) 00228 { 00229 if(slot == State::AutoSlotReplace || slot == s) 00230 return (p); 00231 ++index; 00232 } 00233 } 00234 return NullFC; 00235 }
|
|