Ogre Mesh Viewer
Posted: Sun Sep 02, 2012 3:44 pm
there are Ogre Meshy http://www.ogre3d.org/tikiwiki/Ogre+Meshy to view mesh files. and below another Ogre mesh viewer with several facilities
, the program can be used to view 3d mesh files the easy way.
look the keys you can use at the title bar
download the program with the textures necessary to run the program and 7 mesh samples: arrow, chinese (3D chars), fish, helicopter, purebasic (3D chars), ring, teapot:
http://www.mediafire.com/?8rq1tt8loi1nf95
the purebasic (3D chars) made using purebasic MP3D library using this code:
mesh = MP_Create3DText ("Times", "PureBasic")
MP_ScaleMesh(mesh,1,1,3)
MP_SaveMesh("purebasic.x",mesh)
after that importing the file purebasic.x by milkshape and exporting it to Ogre mesh file, but the attached chinese chars i can't make it this way, but after installing chinese fonts , and using google sketchUp http://sketchup.google.com/download/ i succeed to make 3D chinese chars by using the menu Tools -> 3D Text (using google translator the ch3.mesh meaning is karate school)
more info for working with mesh files:
a program to export 3D files to *.mesh files is MilkShape , download a shareware from here http://chumbalum.swissquake.ch/ and after install. download the "Milkshape3D Exporter" from http://www.ogre3d.org/download/tools
now open any 3D file from milkshape and File->Export->Ogre Mesh/skeleton, it is near the bottom of the List, and don't forget to choose Export material.
now what if the 3D file can't be accepted by milkshape because it has too many vertices. then use the freeware utility MeshLab from http://meshlab.sourceforge.net/ go down the page to see different downloads:
Download V1.3.2
- Windows
- Windows (x64)
- Linux (src)
- MacOSX (intel only)
let us make a practical experiment with it, go to this site wich convert your 3D files to physical model using a 3D printer
http://www.shapeways.com/gallery?downloadable=1
download a 3d file i suggest
http://www.shapeways.com/model/52936/on ... -ball.html
it is *.stl file 7MB
use MeshLab to open the 3d file you want to reduce its polygons, if you tried to export this huge file to 3ds the program will issue an error "you can't save more than 65535 vertices for the 3DS format"
so reduce its Polygons like this
Filters > Remeshing, simplification and construction > Quadratic Edge Collapse Detection
Target Number of faces 10000 (just a suggestion)
after that i got a very small 3ds file just a 190KB, now you can use milkshape to import this 3ds file and Export to Mesh file easily.
the above MeshLab info from: http://www.shapeways.com/tutorials/poly ... th_meshlab
, the program can be used to view 3d mesh files the easy way.
look the keys you can use at the title bar
download the program with the textures necessary to run the program and 7 mesh samples: arrow, chinese (3D chars), fish, helicopter, purebasic (3D chars), ring, teapot:
http://www.mediafire.com/?8rq1tt8loi1nf95
the purebasic (3D chars) made using purebasic MP3D library using this code:
mesh = MP_Create3DText ("Times", "PureBasic")
MP_ScaleMesh(mesh,1,1,3)
MP_SaveMesh("purebasic.x",mesh)
after that importing the file purebasic.x by milkshape and exporting it to Ogre mesh file, but the attached chinese chars i can't make it this way, but after installing chinese fonts , and using google sketchUp http://sketchup.google.com/download/ i succeed to make 3D chinese chars by using the menu Tools -> 3D Text (using google translator the ch3.mesh meaning is karate school)
more info for working with mesh files:
a program to export 3D files to *.mesh files is MilkShape , download a shareware from here http://chumbalum.swissquake.ch/ and after install. download the "Milkshape3D Exporter" from http://www.ogre3d.org/download/tools
now open any 3D file from milkshape and File->Export->Ogre Mesh/skeleton, it is near the bottom of the List, and don't forget to choose Export material.
now what if the 3D file can't be accepted by milkshape because it has too many vertices. then use the freeware utility MeshLab from http://meshlab.sourceforge.net/ go down the page to see different downloads:
Download V1.3.2
- Windows
- Windows (x64)
- Linux (src)
- MacOSX (intel only)
let us make a practical experiment with it, go to this site wich convert your 3D files to physical model using a 3D printer
http://www.shapeways.com/gallery?downloadable=1
download a 3d file i suggest
http://www.shapeways.com/model/52936/on ... -ball.html
it is *.stl file 7MB
use MeshLab to open the 3d file you want to reduce its polygons, if you tried to export this huge file to 3ds the program will issue an error "you can't save more than 65535 vertices for the 3DS format"
so reduce its Polygons like this
Filters > Remeshing, simplification and construction > Quadratic Edge Collapse Detection
Target Number of faces 10000 (just a suggestion)
after that i got a very small 3ds file just a 190KB, now you can use milkshape to import this 3ds file and Export to Mesh file easily.
the above MeshLab info from: http://www.shapeways.com/tutorials/poly ... th_meshlab
Code: Select all
Enumeration
#MESH
#TEX
#TEX_plane
#MAT
#MAT_plane
#plane
#model
#node
#LIGHT
#CAMERA_ONE
#BUTTON
#BUTTON_OPEN
#mainwin
#CheckBox
EndEnumeration
Global Quit.b = #False
Procedure textured()
CreateEntity(#model, MeshID(#MESH), MaterialID(#MAT))
meshsize.f = MeshRadius(#MESH)
ScaleEntity(#model,3/meshsize,3/meshsize,3/meshsize)
AttachNodeObject(#node,EntityID(#model),#PB_Node_Entity)
NodeLocate(#node,0,1.5,3)
EndProcedure
Procedure textured_no()
FreeEntity(#model)
CreateEntity(#model, MeshID(#MESH), #PB_Material_None )
AttachNodeObject(#node,EntityID(#model),#PB_Node_Entity)
NodeLocate(#node,0,1.5,3)
meshsize.f = MeshRadius(#MESH)
ScaleEntity(#model,3/meshsize,3/meshsize,3/meshsize)
EndProcedure
ExamineDesktops()
If OpenWindow(#mainwin, 0, 0, DesktopWidth(0), DesktopHeight(0), "PgUp PgD scale model..Arrows for rotation, space: stop/rotate, QA Up/Down, WS far/near", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#BUTTON, 0, 420, 50, 30, "stop")
ButtonGadget(#BUTTON_OPEN, 70, 420, 50, 30, "Open File")
CheckBoxGadget(#CheckBox, 200, 420, 250, 20, "Default Texture") :SetGadgetState(#CheckBox, #PB_Checkbox_Checked)
;Initialize environment
InitEngine3D()
InitSprite()
OpenWindowedScreen(WindowID(#mainwin), 0, 0, DesktopWidth(0), DesktopHeight(0)-70, 0, 0, 0)
WorldShadows(#PB_Shadow_Additive)
InitKeyboard()
SetFrameRate(60)
Add3DArchive("Data/", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Textures\", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Scripts", #PB_3DArchive_FileSystem)
Parse3DScripts()
LoadTexture(#TEX, "steelhead.png")
CreateMaterial(#MAT, TextureID(#TEX))
CreateMaterial(#MAT_plane, LoadTexture(#TEX_plane, "mosaic.png"))
;CreatePlane(#Mesh, TileSizeX, TileSizeZ, TileCountX, TileCountZ, TextureRepeatCountX, TextureRepeatCountZ)
CreatePlane(#plane, 10, 10, 1, 1, 1, 1)
CreateEntity (#plane, MeshID(#plane), MaterialID(#MAT_plane))
LoadMesh(#MESH, "helicopter.mesh")
meshsize.f = MeshRadius(#MESH)
CreateNode(#node)
CreateEntity(#model, MeshID(#MESH), MaterialID(#MAT))
ScaleEntity(#model,3/meshsize,3/meshsize,3/meshsize)
AttachNodeObject(#node,EntityID(#model),#PB_Node_Entity)
NodeLocate(#node,0,1.5,3)
CreateLight(0,RGB(255,255,255),-100,40,30)
AmbientColor(RGB(100,100,100))
CreateCamera(#CAMERA_ONE, 0, 0, 400, 400)
CameraLocate(#CAMERA_ONE, 0, 4, 9)
CameraLookAt(#CAMERA_ONE, 0, 2, 0)
RotateCamera(#CAMERA_ONE, -15, 0, 0)
EndIf
rot.l=1
xs.f = 0.3:ys.f = 0.3:zs.f = 0.3
x.f: y.f :z.f: x0.f: y0.f=1 :z0.f
rotx.f:roty.f=1:rotz.f :rotx0.f: roty0.f: rotz0.f
up.f = 1.5: depth.f=3
SetActiveGadget(#BUTTON)
SkyDome("clouds.jpg", 100) ;for blue color background
;Main loop
Repeat
Event = WindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case #BUTTON
If rot = 0
rot = 1
rotx= rotx0:roty=roty0:rotz=rotz0 ; restore rotation status
SetGadgetText(#BUTTON,"stop")
Else
rot = 0
rotx0= rotx:roty0=roty:rotz0=rotz ;back up rotation status
rotx=0:roty=0:rotz=0
SetGadgetText(#BUTTON,"rotate")
EndIf
Case #BUTTON_OPEN
File$ = OpenFileRequester("choose *.mesh file", "", "Mesh files|*.mesh|All Files|*.*", 0)
File$ = GetFilePart(File$)
If File$="":End:EndIf
SetActiveGadget(#BUTTON)
FreeEntity(#model)
FreeMesh(#MESH)
LoadMesh(#MESH, File$)
meshsize.f = MeshRadius(#MESH)
CreateEntity(#model, MeshID(#MESH), MaterialID(#MAT))
ScaleEntity(#model,3/meshsize,3/meshsize,3/meshsize)
;AnimateEntity(#model, "swim") ; if using the animated fish only, , removed and replaced in pb5 by other plan
AttachNodeObject(#node,EntityID(#model),#PB_Node_Entity)
NodeLocate(#node,0,1.5,3)
Case #CheckBox
If GetGadgetState(#CheckBox) = 0
SetActiveGadget(#BUTTON)
textured_no()
NodeLocate(#node,0,up,depth)
Else
SetActiveGadget(#BUTTON)
FreeEntity(#model)
textured()
NodeLocate(#node,0,up,depth)
EndIf
EndSelect
EndIf
x + rotx
y + roty
z + rotz
RotateEntity(#model, x, y, z)
RenderWorld()
FlipBuffers()
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Up) ; rotate left
rotx=1:roty=0:rotz=0
rotx0 = rotx: roty0 = roty :rotz0 = rotz
SetGadgetText(#BUTTON,"stop") : rot = 1
ElseIf KeyboardReleased(#PB_Key_Down) ; rotate right
rotx=-1:roty=0:rotz=0
rotx0 = rotx: roty0 = roty :rotz0 = rotz
SetGadgetText(#BUTTON,"stop") : rot = 1
ElseIf KeyboardReleased(#PB_Key_Right) ; rotate up
rotx=0:roty=1:rotz=0
rotx0 = rotx: roty0 = roty :rotz0 = rotz
SetGadgetText(#BUTTON,"stop") : rot = 1
ElseIf KeyboardReleased(#PB_Key_Left) ; rotate down
rotx=0:roty=-1:rotz=0
rotx0 = rotx: roty0 = roty :rotz0 = rotz
SetGadgetText(#BUTTON,"stop") : rot = 1
EndIf
If KeyboardPushed(#PB_Key_PageUp) ; scale up model
xs.f = 1.1:ys.f = 1.1:zs.f = 1.1
ScaleEntity(#model,xs,ys,zs)
ElseIf KeyboardPushed(#PB_Key_PageDown) ; scale down model
xs = 0.9:ys = 0.9:zs= 0.9
ScaleEntity(#model,xs,ys,zs)
EndIf
If KeyboardPushed(#PB_Key_Q) ; up move
up + 0.1
NodeLocate(#node,0,up,depth)
ElseIf KeyboardPushed(#PB_Key_A) ; down move
up - 0.1
NodeLocate(#node,0,up,depth)
ElseIf KeyboardPushed(#PB_Key_W) ; forward move
depth - 0.1
NodeLocate(#node,0,up,depth)
ElseIf KeyboardPushed(#PB_Key_S) ; inward move
depth + 0.1
NodeLocate(#node,0,up,depth)
EndIf
If KeyboardPushed(#PB_Key_Escape)
Quit = #True
EndIf
Until Quit = #True Or Event = #PB_Event_CloseWindow