0

I have loaded an entity in my Ogre program. Then list Elements in vertexDeclaration like below.

Ogre::VertexDeclaration::VertexElementList lst = vertex_data->vertexDeclaration->getElements();

In the list i have seen VES_POSITION and VES_NORMAL only. Therefor when i run below code,

const Ogre::VertexElement* posElem = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_DIFFUSE);

posElem is contained nothing or null. How to access this kind of element that is not exist? is it possible?then i have added material like below to my entity. This time model loaded successfully with material and diffuse property. but the problem persists. This means that VertexDeclaration does not contain an element with VES_DEFFUSE semantic (only VES_POSITION and VES_NORMAL). Also i loaded some another models, but none of them had such an element with VES_DEFFUSE semantic.

material base_mesh
{

technique
{
pass
{
lighting on
ambient 0.3 0.3 0.3 1
diffuse 0.1 0.7 0.2 1
emissive 0 0 0 1


}
}
}
  • If mesh don't have specific attribute - why would it be present in runtime? What is your mesh data and specific problem you have? – keltar Dec 26 '14 at 09:55

1 Answers1

0

I convert my mesh file with OgreXmlConverter to xml file. Then edit xml file and add colour_diffuse tag to each vertex tag like below (example):

<vertex>
<position y="2.779611" x="0.272802" z="0.245147"/>
<normal y="-0.291635" x="0.955870" z="0.034669"/>
<colour_diffuse value="1 1 1 1" /></vertex>
<vertex>

Then convert back to mesh file.Now in VertexDeclaration we have VES_DEFFUSE semantic element.