Import sidesign.minib3d
Local width = 1024 , height = 768 , depth = 32 , mode = 0
Graphics3D width,height,depth,mode,Canvass
Local cam=CreateCamera()
PositionEntity cam,0,0,-30
Local light = CreateLight()
texfile$ = RequestFile("Pick Base Texture","bmp,png,jpg")
DebugLog texfile$
BaseTex = LoadTexture(texfile$)
Local ent1=LoadAnimMesh( "base.b3d" )
EntityTexture ent1,Basetex,0,0
PositionEntity ent1,0,0,150
ScaleEntity ent1,5,5,5
'glShadeModel(GL_SMOOTH)
AmbientLight 128,128,128
light_sun = CreateLight(1)
LightColor light_sun,200,200,100
RotateEntity light_sun,60,-90,0
CameraClsColor cam,0,0,128
Local cx#=0
Local cy#=0
Local cz#=0
Local pitch#=30
Local yaw#=40
Local roll#=130
' used by fps code
Local old_ms=MilliSecs()
Local renders
Local fps
While Not KeyDown(KEY_ESCAPE)
If KeyHit(KEY_ENTER) Then DebugStop
' control camera
If KeyDown(KEY_UP) Then cz#=cz#+1.0
If KeyDown(KEY_LEFT) Then cx#=cx#-1.0
If KeyDown(KEY_RIGHT) Then cx#=cx#+1.0
If KeyDown(KEY_DOWN) Then cz#=cz#-1.0
If KeyDown(KEY_W) Then pitch#=pitch#-1.0
If KeyDown(KEY_A) Then yaw#=yaw#+1.0
If KeyDown(KEY_S) Then pitch#=pitch#+1.0
If KeyDown(KEY_D) Then yaw#=yaw#-1.0
MoveEntity cam,cx#*0.5,cy#*0.5,cz#*0.5
RotateEntity ent1,pitch#,yaw#,roll#
cx#=0
cy#=0
cz#=0
RenderWorld
renders=renders+1
' calculate fps
If MilliSecs()-old_ms>=1000
old_ms=MilliSecs()
fps=renders
renders=0
EndIf
' DebugText 0,0,"FPS: "+String(fps)
Flip
Wend
End
Try that it doesn't seem to work.
|