Changeset 10597
- Timestamp:
- 09/27/09 17:14:57 (4 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 3 modified
-
include/osg/Texture (modified) (4 diffs)
-
src/osg/Texture.cpp (modified) (4 diffs)
-
src/osgWrappers/osg/Texture.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/Texture
r10594 r10597 976 976 inline void setAllocated(bool allocated=true) { _allocated = allocated; } 977 977 978 inlinevoid setAllocated(GLint numMipmapLevels,978 void setAllocated(GLint numMipmapLevels, 979 979 GLenum internalFormat, 980 980 GLsizei width, 981 981 GLsizei height, 982 982 GLsizei depth, 983 GLint border) 984 { 985 _allocated=true; 986 _profile.set(numMipmapLevels,internalFormat,width,height,depth,border); 987 } 983 GLint border); 988 984 989 985 inline bool isAllocated() const { return _allocated; } … … 1020 1016 void addToBack(TextureObject* to); 1021 1017 void orphan(TextureObject* to); 1018 void remove(TextureObject* to); 1019 1022 1020 unsigned int size() const { return _profile._size * _numOfTextureObjects; } 1023 1021 … … 1025 1023 1026 1024 bool checkConsistency() const; 1025 1026 TextureObjectManager* getParent() { return _parent; } 1027 1027 1028 1028 protected: … … 1086 1086 void releaseTextureObject(TextureObject* to); 1087 1087 1088 TextureObjectSet* getTextureObjectSet(const TextureProfile& profile); 1088 1089 1089 1090 void newFrame(osg::FrameStamp* fs); -
OpenSceneGraph/trunk/src/osg/Texture.cpp
r10595 r10597 77 77 } 78 78 79 void Texture::TextureObject::setAllocated(GLint numMipmapLevels, 80 GLenum internalFormat, 81 GLsizei width, 82 GLsizei height, 83 GLsizei depth, 84 GLint border) 85 { 86 _allocated=true; 87 if (!match(_profile._target,numMipmapLevels,internalFormat,width,height,depth,border)) 88 { 89 _profile.set(numMipmapLevels,internalFormat,width,height,depth,border); 90 91 if (_set) 92 { 93 // remove self from original set 94 _set->remove(this); 95 96 // get the new set for the new profile 97 _set = _set->getParent()->getTextureObjectSet(_profile); 98 99 // register self with new set. 100 _set->addToBack(this); 101 } 102 } 103 } 104 79 105 void Texture::TextureProfile::computeSize() 80 106 { … … 210 236 _orphanedTextureObjects.push_back(to); 211 237 212 if (to->_previous!=0) 213 { 214 (to->_previous)->_next = to->_next; 215 } 216 else 217 { 218 // 'to' was head so assign _head to the next in list 219 _head = to->_next; 220 } 221 222 if (to->_next!=0) 223 { 224 (to->_next)->_previous = to->_previous; 225 } 226 else 227 { 228 // 'to' was tail so assing tail to the previous in list 229 _tail = to->_previous; 230 } 231 232 // reset the 'to' list pointers as it's no longer in the active list. 233 to->_next = 0; 234 to->_previous = 0; 238 remove(to); 235 239 236 240 #if 0 … … 571 575 #endif 572 576 } 577 578 void Texture::TextureObjectSet::remove(Texture::TextureObject* to) 579 { 580 if (to->_previous!=0) 581 { 582 (to->_previous)->_next = to->_next; 583 } 584 else 585 { 586 // 'to' was head so assign _head to the next in list 587 _head = to->_next; 588 } 589 590 if (to->_next!=0) 591 { 592 (to->_next)->_previous = to->_previous; 593 } 594 else 595 { 596 // 'to' was tail so assing tail to the previous in list 597 _tail = to->_previous; 598 } 599 600 // reset the 'to' list pointers as it's no longer in the active list. 601 to->_next = 0; 602 to->_previous = 0; 603 } 604 573 605 574 606 Texture::TextureObjectManager::TextureObjectManager(unsigned int contextID): … … 632 664 633 665 Texture::TextureProfile profile(target,numMipmapLevels,internalFormat,width,height,depth,border); 666 TextureObjectSet* tos = getTextureObjectSet(profile); 667 return tos->takeOrGenerate(const_cast<Texture*>(texture)); 668 } 669 670 Texture::TextureObjectSet* Texture::TextureObjectManager::getTextureObjectSet(const TextureProfile& profile) 671 { 634 672 osg::ref_ptr<Texture::TextureObjectSet>& tos = _textureSetMap[profile]; 635 673 if (!tos) tos = new Texture::TextureObjectSet(this, profile); 636 return tos ->takeOrGenerate(const_cast<Texture*>(texture));674 return tos.get(); 637 675 } 638 676 -
OpenSceneGraph/trunk/src/osgWrappers/osg/Texture.cpp
r10595 r10597 886 886 "", 887 887 ""); 888 I_Method1(osg::Texture::TextureObjectSet *, getTextureObjectSet, IN, const osg::Texture::TextureProfile &, profile, 889 Properties::NON_VIRTUAL, 890 __TextureObjectSet_P1__getTextureObjectSet__C5_TextureProfile_R1, 891 "", 892 ""); 888 893 I_Method1(void, newFrame, IN, osg::FrameStamp *, fs, 889 894 Properties::NON_VIRTUAL, … … 1034 1039 "", 1035 1040 ""); 1041 I_Method1(void, remove, IN, osg::Texture::TextureObject *, to, 1042 Properties::NON_VIRTUAL, 1043 __void__remove__TextureObject_P1, 1044 "", 1045 ""); 1036 1046 I_Method0(unsigned int, size, 1037 1047 Properties::NON_VIRTUAL, … … 1049 1059 "", 1050 1060 ""); 1061 I_Method0(osg::Texture::TextureObjectManager *, getParent, 1062 Properties::NON_VIRTUAL, 1063 __TextureObjectManager_P1__getParent, 1064 "", 1065 ""); 1066 I_SimpleProperty(osg::Texture::TextureObjectManager *, Parent, 1067 __TextureObjectManager_P1__getParent, 1068 0); 1051 1069 END_REFLECTOR 1052 1070
