For the "said" example one poly is enough, but the finality is to have many poly (like 2 poly of different color). Then mesh can contain a second poly with 2 color, color1 (green), color2 (red). And this second poly will be green if exposed to ambient only, red to diffuse only, and yellow if exposed to both. And a mix of these 2 color in general. In fact the 2 color is blend with the texture of material first, then used for lighting.
I want something equivalent to something like this I guess. But this code below is not possible, can we make same behavior another way ?
Ogre::MaterialPtr mMat = Ogre::MaterialManager::getSingleton().create("MyMaterial", "General", true);
Ogre::Technique* mTech = mMat->getTechnique(0);
Ogre::Pass* mPass = mTech->getPass(0);
mPass->setDiffuse(Ogre::ColourValue(1, 1, 1));
--> mPass->setVertexColour1Tracking(Ogre::TVC_AMBIENT);
--> mPass->setVertexColour2Tracking(Ogre::TVC_DIFFUSE);
Ogre::Image ogreImage;
ogreImage.load("Textures.bmp", "General");
Ogre::TexturePtr mTex = Ogre::TextureManager::getSingleton().loadImage("MyTexture", "General", ogreImage);
Ogre::TextureUnitState* mTexUnitState = mPass->createTextureUnitState("MyTexture");
Ogre::ManualObject* ogreMan = scene->createManualObject("MyMan");
ogreMan->begin("MyMaterial", Ogre::RenderOperation::OT_TRIANGLE_LIST);
for (int i = 0; i < 4; ++i)
{
ogreMan->position(...);
ogreMan->normal(...);
ogreMan->textureCoord(...);
--> ogreMan->colour1(Ogre::ColourValue(0, 0.5, 0));
--> ogreMan->colour2(Ogre::ColourValue(0, 0, 0.5));
}
ogreMan->quad(0, 1, 2, 3);
ogreMan->end();
...