Multi-surface meshes using mesh creation commands
Posted: Sat Jun 12, 2010 9:17 pm
Would it be possible to have a multi-surface mesh using PureBasic's SetMeshData and createmesh commands, maybe adding something like:
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.
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))