Blitz 3D Dragon example ported to mmEngine3D (easy!!)
Posted: Mon Jul 16, 2007 6:15 pm
I dld mmEngine3D (from some link i found here in the forums yesterday) and try to port the Dragon example that comes with the trial version of Blitz3D... was so easy!!
Yes!!!

Yes!!!

Code: Select all
Procedure Main()
; ;environment cube
Graphics3D_ (800, 600, 0, 2) ; open Graphics window (windowed)
cube = CreateCube_() ; create simple cube
FitMesh_(cube,-250,0,-250,500,500,500)
FlipMesh_(cube)
tex = LoadTexture_("chorme-2.bmp") ; load texture
ScaleTexture_(tex,1.0/3,1.0/3)
EntityTexture_(cube,tex)
EntityAlpha_(cube,0.4)
;EntityFX__(cube,1)
;floor mirror
m=CreateMirror_()
;simple light
light=CreateLight_()
TurnEntity_(light,45,45,0)
;camera
camera = CreateCamera_() ; create camera and light
cam_xr=30:cam_yr=0:cam_zr=0:cam_z=-100
PositionEntity_(camera, 0, 0, 0)
;cool dragon model!
tex=LoadTexture_( "model\dragon.bmp" )
dragon=LoadMD2_( "model\dragon.md2" )
EntityTexture_(dragon,tex)
PositionEntity_(dragon,0,25,0)
TurnEntity_(dragon,0,150,0)
AnimateMD2_(dragon,1,0.05,0,40)
While Not GetKey_() = 27; wait hit any key or close window
If KeyDown_(203)
cam_yr=cam_yr-2
ElseIf KeyDown_(205)
cam_yr=cam_yr+2
EndIf
If KeyDown_(200)
cam_xr=cam_xr+2
If cam_xr>90 : cam_xr=90 : EndIf
ElseIf KeyDown_(208)
cam_xr=cam_xr-2
If cam_xr<5: cam_xr=5 : EndIf
EndIf
If KeyDown_(26)
cam_zr=cam_zr+2
ElseIf KeyDown_(27)
cam_zr=cam_zr-2
EndIf
If KeyDown_(30)
cam_z=cam_z+1:If cam_z>-10: cam_z=-10 : EndIf
ElseIf KeyDown_(44)
cam_z=cam_z-1:If cam_z<-180: cam_z=-180 : EndIf
EndIf
PositionEntity_(camera,0,0,0)
RotateEntity_(camera,cam_xr,cam_yr,cam_zr)
MoveEntity_(camera,0,0,cam_z)
UpdateWorld_()
RenderWorld_()
Flip_()
Wend
EndProcedure
;----------------------------- RUN
; start mmEngine3D
_EngineStart_(@Main())
; free engine
EngineEnd_()