#include <OSGDVRAppearanceBase.h>
Inheritance diagram for osg::DVRAppearanceBase:

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 | |
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 |
Sync | |
| *virtual void | changed (BitVector whichField, UInt32 origin) |
Output | |
| *virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) 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 | |
| * | DVRAppearanceBase (void) |
| DVRAppearanceBase (const DVRAppearanceBase &source) | |
Destructors | |
| *virtual | ~DVRAppearanceBase (void) |
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 ChunkMaterial | Inherited |
Private Member Functions | |
| void | operator= (const DVRAppearanceBase &source) |
Static Private Attributes | |
| static FieldContainerType | _type |
Friends | |
| class | FieldContainer |
Definition at line 80 of file OSGDVRAppearanceBase.h.
|
|
Reimplemented from osg::ChunkMaterial. Reimplemented in osg::DVRAppearance. Definition at line 84 of file OSGDVRAppearanceBase.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 144 of file OSGDVRAppearanceBase.cpp. 00144 : 00145 Inherited() 00146 { 00147 }
|
|
|
Definition at line 153 of file OSGDVRAppearanceBase.cpp. 00153 : 00154 Inherited (source) 00155 { 00156 }
|
|
|
Definition at line 160 of file OSGDVRAppearanceBase.cpp.
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 58 of file OSGDVRAppearanceBase.inl. References _type. Referenced by create(). 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 65 of file OSGDVRAppearanceBase.inl. References _type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 86 of file OSGDVRAppearanceBase.cpp. References _type. 00087 { 00088 return _type; 00089 }
|
|
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 91 of file OSGDVRAppearanceBase.cpp. References _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(), getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and 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 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 executeSync(). 00193 { 00194 00195 Inherited::executeSyncImpl(pOther, whichField); 00196 00197 00198 }
|
|
||||||||||||
|
Reimplemented from osg::ChunkMaterialBase. Definition at line 113 of file OSGDVRAppearanceBase.cpp. References 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.
|
|
||||||||||||
|
Reimplemented from osg::Material. Reimplemented in osg::FresnelMaterial, osg::PhongMaterial, osg::SimpleMaterial, osg::SimpleTexturedMaterial, and osg::DVRAppearance. Definition at line 118 of file OSGChunkMaterial.cpp. References osg::ChunkMaterialBase::_mfChunks, osg::ChangedOrigin::Abstract, osg::addRefCP(), osg::MField< FieldTypeT, fieldNameSpace >::begin(), osg::Material::changed(), and osg::MField< FieldTypeT, fieldNameSpace >::end(). Referenced by osg::SimpleMaterial::changed(), osg::PhongMaterial::changed(), osg::FresnelMaterial::changed(), and osg::DVRAppearance::changed(). 00119 { 00120 if(origin & ChangedOrigin::Abstract) 00121 { 00122 MFStateChunkPtr::iterator matIt = _mfChunks.begin(); 00123 MFStateChunkPtr::iterator matEnd = _mfChunks.end (); 00124 00125 while(matIt != matEnd) 00126 { 00127 addRefCP(*matIt); 00128 00129 ++matIt; 00130 } 00131 } 00132 00133 Inherited::changed(whichField, origin); 00134 }
|
|
||||||||||||
|
Reimplemented from osg::Material. Reimplemented in osg::FresnelMaterial, osg::PhongMaterial, osg::SimpleMaterial, osg::SimpleTexturedMaterial, and osg::DVRAppearance. Definition at line 349 of file OSGChunkMaterial.cpp. References osg::ChunkMaterialBase::_mfChunks, osg::ChunkMaterialBase::_mfSlots, osg::State::AutoSlotReplace, osg::MField< FieldTypeT, fieldNameSpace >::size(), and SLOG. 00351 { 00352 SLOG << "ChunkMaterial at " << this << std::endl; 00353 SLOG << "Chunks: " << std::endl; 00354 00355 UInt32 i; 00356 00357 for(i = 0; i < _mfChunks.size(); ++i) 00358 SLOG << _mfChunks[i] << " " 00359 << static_cast<Int32>((i < _mfSlots.size()) 00360 ? _mfSlots[i] 00361 : State::AutoSlotReplace) 00362 << std::endl; 00363 }
|
|
||||||||||||
|
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 }
|
|
|
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 237 of file OSGChunkMaterial.cpp. 00238 { 00239 Material& thisBase = *this; 00240 if (!(thisBase == other)) 00241 return false; 00242 00243 const ChunkMaterial* othercm = dynamic_cast<const ChunkMaterial*>(&other); 00244 if (!othercm) 00245 return false; 00246 00247 // ? 00248 return false; 00249 }
|
|
|
Definition at line 180 of file OSGMaterial.cpp. References osg::Material::_pState.
|
|
|
Definition at line 101 of file OSGChunkMaterialBase.inl. References osg::ChunkMaterialBase::_mfChunks. 00102 { 00103 return &_mfChunks; 00104 }
|
|
|
Definition at line 108 of file OSGChunkMaterialBase.inl. References osg::ChunkMaterialBase::_mfSlots. 00109 { 00110 return &_mfSlots; 00111 }
|
|
|
Definition at line 117 of file OSGChunkMaterialBase.inl. References osg::ChunkMaterialBase::_mfChunks. 00118 { 00119 return _mfChunks[index]; 00120 }
|
|
|
Definition at line 124 of file OSGChunkMaterialBase.inl. References osg::ChunkMaterialBase::_mfChunks. 00125 { 00126 return _mfChunks; 00127 }
|
|
|
Definition at line 131 of file OSGChunkMaterialBase.inl. |