Page 1 of 1

Multi-surface meshes using mesh creation commands

Posted: Sat Jun 12, 2010 9:17 pm
by EdzUp
Would it be possible to have a multi-surface mesh using PureBasic's SetMeshData and createmesh commands, maybe adding something like:

Code: Select all

MyMesh = CreateMesh( 0, 100, 3 ) ;create a mesh with three surfaces
;surface 1
SetMeshData(0, 0, #PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_Color, ?CubeData2, 8)
SetMeshData(0, 0, #PB_Mesh_Face, ?CubeDataIndex, 12)
CreateMaterial(0, 0, LoadTexture(0, "clouds.jpg"))
MaterialAmbientColor(0, #PB_Material_AmbientColors)

;surface 2
SetMeshData(0, 1, #PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_Color, ?CubeData2, 8)
SetMeshData(0, 1, #PB_Mesh_Face, ?CubeDataIndex, 12)
CreateMaterial(0, 1, LoadTexture(1, "clouds.jpg"))
MaterialAmbientColor(1, #PB_Material_AmbientColors)

;surface 3
SetMeshData(0, 2, #PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_Color, ?CubeData2, 8)
SetMeshData(0, 2, #PB_Mesh_Face, ?CubeDataIndex, 12)
CreateMaterial(0, 2, LoadTexture(0, "clouds.jpg"))
MaterialAmbientColor(2, #PB_Material_AmbientColors)

CreateEntity(0, MeshID(0), MaterialID(0))
As you can see there is a surface Id added to the creation and material commands this would allow for multisurface meshes. In Tombstone my engine I have a vector for the surfaces each surface catering for upto eight textures this is something that I think that PB would benefit from as nobody uses single surface meshes anymore.

Re: Multi-surface meshes using mesh creation commands

Posted: Mon Jun 21, 2010 3:21 pm
by Innesoft
I looked briefly at the integrated Ogre, and found it too limited for my needs. While you wait for more Ogre features, give Next-D (irrlicht wrapper) a try. It's pretty much been abandoned (AFAIK) but it allows multiple mesh buffers (surfaces), and although it comes with limitations of it's own.. it does the job nicely.

I also want a more complete implementation of Ogre in PB, so +1 here.