problem about changing the material shared by many objects

Problems building or running the engine, queries about how to use features etc.
Post Reply
azuretttc
Gnoblar
Posts: 1
Joined: Fri Aug 19, 2011 3:45 am

problem about changing the material shared by many objects

Post by azuretttc »

I have 7 manualobjects using the same material ,e.g. the name: 7054.material, the material is like this:

material Mat_33_1
{
technique
{
pass
{
ambient 0.32549 0.32549 0.32549 1
diffuse 0.32549 0.32549 0.32549 1
specular 0.0243538 0.0243538 0.0243538 1 0.704
scene_blend alpha_blend
depth_write off

texture_unit
{
texture A6-31-1-2BLM.tga
}
}

}
}

However, I want to rotate a manualobject's texture by 45 degrees while not affecting other planes, I use this code:
mo->begin()
......
mo->getSection(0)->getMaterial()->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureRotate( Ogre::Degree(45*m_ps[surf_id].m_rotationTex) );
mo->end()

mo->getSection(0) is a subsection of a manual object mo. this code will rotate all the manualobjects by 45 degrees, but I don't want to affect the other 6 objects, how to acheive this?
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: problem about changing the material shared by many objec

Post by syedhs »

Clone the material, do texture rotation on it, and then assign this material to the manual object that need it.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
Post Reply