Thats right, but my reason is that DeepMesh software does not export the toy submeshes to *,ply correctly so i have tried to provide it as one mesh version.
for the one big mesh version there is a choice to color some parts with a different color, if we use "Ogre Meshy" viewer version 1.5 it show use that there is 3 submeshes with vertex counts 258, 257, 1066. in the following code version we color the bottom and top in red and green. but the color will not displayed until we use either worldshadow, or DisableMaterialLighting(2, #True) or the two together.
Code: Select all
InitEngine3D():InitSprite():InitKeyboard():InitMouse()
ExamineDesktops()
Global bitplanes.a=DesktopDepth(0),FRX.u=DesktopWidth(0),FRY.u=DesktopHeight(0),RX.u,RY.u
If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
OpenWindow(0,0,0,RX,RY,"switch screen size",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Textures",#PB_3DArchive_FileSystem)
Add3DArchive("media/",#PB_3DArchive_FileSystem)
Parse3DScripts()
CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0.5,3,#PB_Absolute)
CameraLookAt(0,0,0,0)
CreateMaterial(2, LoadTexture(2, "madera2.jpg"))
CreateMaterial(3, LoadTexture(3, "Geebee2.bmp"))
CreateMaterial(4, LoadTexture(4, "snow_1024.jpg"))
;DisableMaterialLighting(2, #True)
CreatePlane(7, 100,100, 1,1,1,1)
CreateEntity(7, MeshID(7), MaterialID(4), 0,-1.1,0)
LoadMesh(1,"top_ply_ply.mesh")
Dim MeshData.PB_MeshVertex(0)
Dim MeshDataInd.PB_MeshFace(0)
GetMeshData(1,0, MeshData(), #PB_Mesh_Vertex | #PB_Mesh_UVCoordinate | #PB_Mesh_Normal | #PB_Mesh_Color, 0, MeshVertexCount(1)-1)
GetMeshData(1,0, MeshDataInd(), #PB_Mesh_Face, 0, MeshIndexCount(1, 0)-1)
FreeMesh(1)
CreateMesh(0, #PB_Mesh_TriangleList, #PB_Mesh_Dynamic)
ArrSize = ArraySize(MeshData())
;Debug ArrSize
For c=0 To ArrSize
x.f = MeshData(c)\x
y.f = MeshData(c)\y
z.f = MeshData(c)\z
MeshVertexPosition(x,y,z)
If c<=257
MeshVertexColor(RGB(255,0,0))
ElseIf c>257 And c<257+258
MeshVertexColor(RGB(0,255,0))
Else
MeshVertexColor(RGB(255,255,255))
EndIf
MeshVertexNormal(MeshData(c)\NormalX, MeshData(c)\NormalY, MeshData(c)\NormalZ)
MeshVertexTextureCoordinate(MeshData(c)\u, MeshData(c)\v)
Next
ArrSizeInd = ArraySize(MeshDataInd())
For i=0 To ArrSizeInd Step 3
MeshFace(MeshDataInd(i)\Index, MeshDataInd(i+1)\Index,MeshDataInd(i+2)\Index)
Next
FinishMesh(#True)
SetMeshMaterial(0, MaterialID(2))
CreateEntity(0, MeshID(0), MaterialID(2), 0,40,0)
ScaleEntity(0, 40,40,40)
;*****************************************************************************
BuildMeshShadowVolume(0)
UpdateMeshBoundingBox(0)
;NormalizeMesh(1)
;CreateEntity(0,MeshID(0),#PB_Material_None,0,0,0)
CreateEntity(0,MeshID(0),MaterialID(2),0,0,0)
;WorldShadows(#PB_Shadow_Modulative)
WorldShadows(#PB_Shadow_Additive)
EntityRenderMode(0, #PB_Entity_CastShadow )
Repeat
ExamineKeyboard()
WindowEvent()
RotateEntity(0,0,1,0,#PB_Relative)
TimeSinceLastFrame.i=RenderWorld(50)
FlipBuffers()
Delay(8)
Until KeyboardPushed(#PB_Key_Escape)