void TextureProjectorNode::removeAllScopes() { while (!m_oldTexUnitMap.empty()) { MeshNode* meshNode = m_oldTexUnitMap.begin()->first; Appearance* appearance = meshNode->getAppearance(); TextureUnitState* texUnit = m_oldTexUnitMap.begin()->second; appearance->setTextureUnitState(0,texUnit); m_oldTexUnitMap.erase(m_oldTexUnitMap.begin()); } }
void TextureProjectorNode::removeScope( MeshNode* meshNode ) { // While removing the Meshnode from the scope list, we need to restore the original TextureUnit. if ( m_oldTexUnitMap.find(meshNode) != m_oldTexUnitMap.end() ) { Appearance* appearance = 0; appearance = meshNode->getAppearance(); if ( appearance ) { appearance->setTextureUnitState(0,m_oldTexUnitMap.find(meshNode)->second); } m_oldTexUnitMap.erase(meshNode); } }
void TextureProjectorNode::addScope( MeshNode* meshNode ) { // Save TextureUnit of this meshNode, so that it can be recovered while removing this meshnode from the Scope. if( meshNode ) { Appearance* appearance = 0; appearance = meshNode->getAppearance(); TextureUnitState *texUnit = 0; if ( appearance ) { // Save the old texture unit texUnit = appearance->getTextureUnitState(0); // Set the projector Texture Unit appearance->setTextureUnitState(0,projectorTexUnitState); } //if(texUnit) m_oldTexUnitMap[meshNode] = texUnit; } }