I'm new in Ogre3D. but I used DirectX before.
I need 100 spheres. They has a same shape. btw if I load them from resources, it wasts a memory.
so I want reuse mesh. I found a method, "createEntity(const MeshPtr& pMesh);".
so I appled that code like this.
Code: Select all
int gNumObjects = 120;//120;
int i;
// Load Mesh from resources
Ogre::Entity* entity = m_sceneManager->createEntity( "Entity", "SphereNormal.mesh" );
for (i=0;i<gNumObjects;i++)
{
// making node ID
char buf[8];
itoa( i, buf, 10 );
string str = "Node";
str = str + buf;
[color=#004080][b] Ogre::Entity* entity2 = m_sceneManager->createEntity( entity->getMesh() );[/b][/color]
Ogre::SceneNode* node = m_sceneManager->getRootSceneNode()->createChildSceneNode( str );
node->attachObject(entity2);
m_arrObject.push_back(node);
}
1. Am I right that using that code?
2. How can i check reuse mesh or not?
Thanks.