1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
43 bool operator <(const StateOverride::ChunkElement &lhs,
44 const StateOverride::ChunkElement &rhs)
46 return lhs.first < rhs.first;
50 void StateOverride::fillFrom(StateOverride *pState)
52 _vChunks = pState->_vChunks;
55 _pShader = pState->_pShader;
56 _pShaderVar = pState->_pShaderVar;
59 _vProgChunks = pState->_vProgChunks;
60 _vProgIds = pState->_vProgIds;
62 _vProgVarChunks = pState->_vProgVarChunks;
63 _vProgVarIds = pState->_vProgVarIds;
66 _uiSortKey = pState->_uiSortKey;
67 _uiKeyGen = pState->_uiKeyGen;
68 _uiKeyMask = pState->_uiKeyMask;
72 void StateOverride::setKeyGen(UInt32 uiKeyGen)
78 void StateOverride::updateSortKey(UInt32 &uiSortKey,
81 if(_uiKeyGen != uiKeyGen && uiKeyGen < SkipRebuild)
88 if(_uiSortKey != 0x0000)
90 uiSortKey = (uiSortKey & _uiKeyMask) | _uiKeyGen;
95 void StateOverride::reset(void)
103 _vProgChunks.clear();
106 _vProgVarChunks.clear();
107 _vProgVarIds .clear();
116 bool StateOverride::empty(void)
118 return _vChunks.empty();
122 bool StateOverride::isTransparent(void)
124 ChunkStoreIt cIt = _vChunks.begin();
125 ChunkStoreIt cEnd = _vChunks.end ();
127 for(; cIt != cEnd; ++cIt)
129 if(cIt->second != NULL && cIt->second->isTransparent() == true)
139 StateOverride::ChunkStoreConstIt StateOverride::begin(void) const
141 return _vChunks.begin();
145 StateOverride::ChunkStoreConstIt StateOverride::end(void) const
147 return _vChunks.end();
151 SizeT StateOverride::size(void) const
153 return _vChunks.size();
157 UInt32 StateOverride::size32(void) const
159 return UInt32(_vChunks.size());
163 const StateOverride::IdStore &StateOverride::getProgIds(void)
169 const StateOverride::ProgramChunkStore &StateOverride::getPrograms(void)
175 const StateOverride::IdStore &StateOverride::getVarIds(void)
181 const StateOverride::ProgramVarChunkStore &StateOverride::getVariables(void)
183 return _vProgVarChunks;
187 void StateOverride::setShader(ShaderExecutableChunk *pShader)
193 ShaderExecutableChunk *StateOverride::getShader(void)
199 void StateOverride::setShaderVar(ShaderExecutableVarChunk *pVar)
205 ShaderExecutableVarChunk *StateOverride::getShaderVar(void)