; LoadMesh Example ; ---------------- ; LoadMesh loads a model file (.3ds, .x, .b3d ...) and returns it as ; a single rigid mesh, ready to place in the scene like any other ; entity. Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,0,-4 light=CreateLight() RotateEntity light,30,40,0 ; The documented command: load an oil drum model (with its texture) drum=LoadMesh("media/oil-drum/oildrum.3ds") ; Models come in all sizes - scale the ENTITY so the drum is about ; 2 units wide on screen (the mesh data itself is untouched) scale#=2.0/MeshWidth(drum) ScaleEntity drum,scale,scale,scale While Not KeyDown(1) TurnEntity drum,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"Arrow keys: move camera Esc: exit" Text 0,20,"LoadMesh returned handle "+drum Text 0,40,"Model has "+CountSurfaces(drum)+" surface(s), original width "+MeshWidth(drum) Flip Wend End