作者pleaselouis (LOUISN)
看板GameDesign
标题[请益] 请问 OGRE Texture 旋转 等特效处理
时间Thu Feb 12 10:53:37 2009
大家好 我又来发问了 <(_ _)> 这次是关於 OGRE Texture 的旋转 等特效问题
程式码如下:
Entity * et = mSceneMgr->createEntity( "Test" , "Test.mesh" );
Ogre::TextureUnitState *texture;
texture = et->getSubEntity(0)->getMaterial()->getTechnique(0)
->getPass(0)->getTextureUnitState(0);
texture->setTextureRotate( Ogre::Degree(180) );
et->getSubEntity(0)->getMaterial()->getTechnique(0)->getPass(0)
->getTextureUnitState(0)->setTextureName( texture->getTextureName() );
我原本认为 这样一来 就会看到 Texture 以180度旋转的情形发生 但是却完全没有动静
搞了好几天 依然没有进展 因此再度上来向各位前辈请益 请大家帮帮忙 <(_ _)>
又 之前有另外实验一段程式码 可以达到 Texture 以180度旋转的效果
但是 Material 的其他属性 如 : Diffuse 等等 设定会跟原本 *.mesh 纪录的不一样
而且还必需每执行一次旋转 都重新产生 Material 这样会消耗无谓资源 ...
程式码如下:
Entity * et = mSceneMgr->createEntity( "Test" , "Test.mesh" );
MaterialPtr material = MaterialManager::getSingleton()
.create("TestMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->getTechnique(0)->getPass(0)->createTextureUnitState
(et->getSubEntity(0)->getMaterial()->getTechnique(0)
->getPass(0)->getTextureUnitState(0)->getTextureName() );
material->getTechnique(0)->getPass(0)->getTextureUnitState(0)
->setTextureRotate(Ogre::Degree(180));
et->setMaterialName( material->getName() );
麻烦大家非常不好意思 但还是希望大家可以多多帮忙 谢谢大家 <(_ _)>
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 211.76.190.21