Manual 3D Animation With Ogre

Problems building or running the engine, queries about how to use features etc.
Post Reply
sigvatr
Gnoblar
Posts: 1
Joined: Fri Jan 09, 2015 12:53 am

Manual 3D Animation With Ogre

Post by sigvatr »

Hi there,

I am using my own file system and generic 3d model/mesh format powered by ASSIMP to load 3d models and animation data into the game. Now I am trying to figure out how to use Ogre to create and render them.

I've got some very rudimentary beginnings here, which I borrowed from one of the few tutorials I could find on the subject:

Code: Select all

	const aiScene* scene = aiImportFile( filename().c_str(), aiProcessPreset_TargetRealtime_MaxQuality );

	if( !scene )
	{
		return 0;
	}

	Ogre::MeshPtr mesh = Ogre::MeshManager::getSingleton().createManual( filename(), "General" );

	Ogre::SubMesh* subMesh = mesh->createSubMesh();

	mesh->sharedVertexData = new Ogre::VertexData;

	mesh->sharedVertexData->vertexCount = 3;

	Ogre::VertexDeclaration* decl = mesh->sharedVertexData->vertexDeclaration;

	size_t offset = 0;

	decl->addElement( 0, offset, Ogre::VET_FLOAT3, Ogre::VES_POSITION );

	offset += Ogre::VertexElement::getTypeSize( Ogre::VET_FLOAT3 );
So I take it that this is creating a very simple mesh with only a single vertex. But from here, I do not know how to move on. I do not need color information in these meshes, but skeleton/bone stuff, normals, texture coordinates and so forth.

I can manually use OpenGL to create vertex buffer objects (VBOs), but as far as I can tell this is only for static 3d models.

Any pointers?
User avatar
Herb
Orc
Posts: 412
Joined: Thu Jun 04, 2009 3:21 am
Location: Kalamazoo,MI
x 38

Re: Manual 3D Animation With Ogre

Post by Herb »

Take a look at Ogre's ManualObject. There's several articles in the wiki on it. I use it for mesh creation. It's really a nice helper object and has a method for converting to a Ogre Mesh object.
Post Reply