//----------------------------------------------------------------------- void PrimitiveShapeSet::rotateTexture(Ogre::Real speed) { // Get the material and rotate it, assume the material is loaded already, otherwise skip. Ogre::MaterialPtr material = getMaterial(); if (material.isNull()) return; Ogre::TextureUnitState::EffectMap::const_iterator it; unsigned short numberOfTechniques = material->getNumTechniques(); for (unsigned short u = 0; u < numberOfTechniques; ++u) { Ogre::Technique* technique = material->getTechnique(u); unsigned short numberOfPasses = technique->getNumPasses(); for (unsigned short v = 0; v < numberOfPasses; ++v) { Ogre::Pass* pass = technique->getPass(v); unsigned short numberOfTextureUnitStates = pass->getNumTextureUnitStates(); for (unsigned short w = 0; w < numberOfTextureUnitStates; ++w) { // Set the rotation if not already available. // This can only be done once! Changing the rotationspeed or removing the rotation // and resetting it doesn´t seem to work. Ogre::TextureUnitState* textureUnitState = pass->getTextureUnitState(w); it = textureUnitState->getEffects().find(Ogre::TextureUnitState::ET_ROTATE); if (it == textureUnitState->getEffects().end()) { textureUnitState->setRotateAnimation(speed); } } } } }
//----------------------------------------------------------------------- void EntityRenderer::_rotateTexture(VisualParticle* particle, Ogre::Entity* entity) { Ogre::TextureUnitState::EffectMap::const_iterator it; // Get the material and rotate it unsigned int numberOfSubEntities = entity->getNumSubEntities(); for (unsigned short u = 0; u < numberOfSubEntities; ++u) { Ogre::MaterialPtr material = entity->getSubEntity(u)->getMaterial(); unsigned short numberOfTechniques = material->getNumTechniques(); for (unsigned short v = 0; v < numberOfTechniques; ++v) { Ogre::Technique* technique = material->getTechnique(v); unsigned short numberOfPasses = technique->getNumPasses(); for (unsigned short w = 0; w < numberOfPasses; ++w) { Ogre::Pass* pass = technique->getPass(w); unsigned short numberOfTextureUnitStates = pass->getNumTextureUnitStates(); for (unsigned short x = 0; x < numberOfTextureUnitStates; ++x) { // Set the rotation if not already available. // This can only be done once! Changing the rotationspeed or removing the rotation // and resetting it doesn´t seem to work. Ogre::TextureUnitState* textureUnitState = pass->getTextureUnitState(x); it = textureUnitState->getEffects().find(Ogre::TextureUnitState::ET_ROTATE); if (it == textureUnitState->getEffects().end()) { textureUnitState->setRotateAnimation((particle->zRotationSpeed.valueRadians())); } } } } } }
GBufferSchemeHandler::PassProperties GBufferSchemeHandler::inspectPass( Ogre::Pass* pass, unsigned short lodIndex, const Ogre::Renderable* rend) { PassProperties props; //TODO : Use renderable to indicate whether this has skinning. //Probably use same const cast that renderSingleObject uses. if (pass->hasVertexProgram()) { props.isSkinned = pass->getVertexProgram()->isSkeletalAnimationIncluded(); } else { props.isSkinned = false; } for (unsigned short i=0; i<pass->getNumTextureUnitStates(); i++) { Ogre::TextureUnitState* tus = pass->getTextureUnitState(i); Ogre::String texName = tus->getTextureName(); if (!checkNormalMap(tus, props)) { props.regularTextures.push_back(tus); } if (tus->getEffects().size() > 0) { props.isDeferred = false; } } if (pass->getDiffuse() != Ogre::ColourValue::White) { props.hasDiffuseColour = true; } //Check transparency if (pass->getDestBlendFactor() != Ogre::SBF_ZERO) { //TODO : Better ways to do this props.isDeferred = false; } return props; }