Page 1 of 1

Creating custom mesh in 2.1

Posted: Wed Oct 07, 2015 1:09 am
by ashleybeshir
Hello everyone ,

I know how to create custom mesh in 1.8,1.9 using manualobject and stuff but i have no clue when it comes to 2.1 ? any good ideas where to start. Trying to make small voxel world .

Regards Ashley

Re: Creating custom mesh in 2.1

Posted: Wed Oct 07, 2015 1:20 am
by dark_sylinc
See CustomRenderable & DynamicGeometry samples.

There is also a community-ported version of ManualObject, but it works a little different (see http://www.ogre3d.org/forums/viewtopic. ... ct#p519713) and CustomRenderable probably has what you need.

Re: Creating custom mesh in 2.1

Posted: Wed Oct 07, 2015 1:53 am
by ashleybeshir
dark_sylinc wrote:See CustomRenderable & DynamicGeometry samples.

There is also a community-ported version of ManualObject, but it works a little different (see http://www.ogre3d.org/forums/viewtopic. ... ct#p519713) and CustomRenderable probably has what you need.
Thank you for your reply . I checked the samples but couldnt find these two ? is it in the 2.1 - samples file ?

Re: Creating custom mesh in 2.1

Posted: Wed Oct 07, 2015 2:01 am
by dark_sylinc
Yes.

CustomRenderable, DynamicGeometry

Maybe you didn't enable OGRE_BUILD_SAMPLES2?

Cheers.
Matias.

Re: Creating custom mesh in 2.1

Posted: Wed Oct 07, 2015 2:40 am
by ashleybeshir
dark_sylinc wrote:Yes.

CustomRenderable, DynamicGeometry

Maybe you didn't enable OGRE_BUILD_SAMPLES2?

Cheers.
Matias.
unchecked it by mistake . what is the difference between customrenderable and dynamicgeometry ?

Re: Creating custom mesh in 2.1

Posted: Wed Oct 07, 2015 2:50 am
by dark_sylinc
DynamicGeometry sample shows how to construct a v2 Mesh and create an Item from it, while still being able to modify the mesh after the Item was created (unless the buffers were created with the immutable flag for performance).
Decreasing the vertex/count afterwards is easy, but increasing the vertex/index count is almost impossible with this method unless you recreate the items or update its inner structure (though if you know the upper limit, you can create a vertex buffer large enough, then only use a fraction by calling VertexArrayObject::setPrimitiveRange)

CustomRenderable shows how to derive from MovableObject & Renderable to render geometry in a more customized way, similar to what deriving from v1::SimpleRenderable used to provide.

Re: Creating custom mesh in 2.1

Posted: Wed Oct 07, 2015 9:15 am
by ashleybeshir
dark_sylinc wrote:DynamicGeometry sample shows how to construct a v2 Mesh and create an Item from it, while still being able to modify the mesh after the Item was created (unless the buffers were created with the immutable flag for performance).
Decreasing the vertex/count afterwards is easy, but increasing the vertex/index count is almost impossible with this method unless you recreate the items or update its inner structure (though if you know the upper limit, you can create a vertex buffer large enough, then only use a fraction by calling VertexArrayObject::setPrimitiveRange)

CustomRenderable shows how to derive from MovableObject & Renderable to render geometry in a more customized way, similar to what deriving from v1::SimpleRenderable used to provide.
Thank you very much for your help. If i wanted to add uv for texturing . how would i go about ?

Re: Creating custom mesh in 2.1

Posted: Wed Oct 07, 2015 3:12 pm
by dark_sylinc
Just add an extra element:

Code: Select all

vertexElements.push_back( VertexElement2( VET_FLOAT2, VES_TEXTURE_COORDINATES) );

Re: Creating custom mesh in 2.1

Posted: Wed Oct 07, 2015 3:55 pm
by xrgo
maybe this thread could help you:
http://www.ogre3d.org/forums/viewtopic.php?f=25&t=83999
the uv part is commented out but its there