Hi!
I have a Cube and Plane class that inherit from Actor class. These classes have a mesh variable that I give a value calling the Content.Load method. The Plane class load perfectly, but the Cube class, when loaded, it "copy" his mesh data to plane mesh. It is very strange: before load Cube, Plane mesh have the correctly values; before return the cube mesh it having the correct values. But when it exit from Content.Load, plane mesh have the cube mesh data.
Can anybody help me and explain me this problem?
The code:
Cube.cpp
1 2 3 4 5 6 7
void Cube::Load(void)
{
std::cout<<"BEFORE LOAD OBJ IN CUBE PLANE IS"<<getParent()->getEngine()->pln->mesh->meshparts[0]->vtn.size()<<std::endl;
mesh = getParent()->getEngine()->content.Load<Mesh>("Models/untitled.obj"); // Have the correct value
std::cout<<"AFTER LOAD OBJ IN CUBE PLANE IS"<<getParent()->getEngine()->pln->mesh->meshparts[0]->vtn.size()<<std::endl; // Have the cube mesh data
ApplyMaterials();
}
http://cplusplus.com/doc/tutorial/classes2/
Static data members of a class are also known as "class variables", because there is only one unique value for all the objects of that same class. Their content is not different from one object of this class to another.