Hi. Ok, can someone please help me get this heightmap to look like the surface of the moon?
I tried different width, height, depth, and can't get it to work.
it works with the mars heightmap
here's the code:
;Include "BlitzGeoWallStereoLib.bb"
Global use_fog=True
;If Lower$( Left$( Input$( "Use fog? :" ),1 ) )="y" use_fog=True
;game FPS
Const FPS=30
Global info1$="Terrain demo"
Global info2$="Arrows/A/Z move, F1-F4 change camera"
Global info3$="W toggle wireframe, M toggle morphing"
Global info4$="[ and ] alter detail level"
;Global terrainHeightMap$ = "mars_hmap.bmp"
;Global terrainTextureMap$ = "mars_cmap.bmp"
Global terrainHeightMap$ = "moon4096.png"
Global terrainTextureMap$ = "moon4096.png"
Global terrainScaleX#=40000
Global terrainScaleY#=2000
Global terrainScaleZ#=40000
Global g_eyeSeparation#=0.5
Global farRange=200000
detail=6000:morph=True
Graphics3D 800,600
AmbientLight 255,255,255
;*******************
;grrr..ATI - FIX IT!
; HWMultiTex False ;
;*******************
Type Player
Field entity,camera, camera2
Field ctrl_mode,cam_mode,ignition
Field pitch#,yaw#,pitch_speed#,yaw_speed#,roll#,thrust#
End Type
Collisions 1,10,2,2 ;sphere-to-polygon, colliding collisions
Global terr
CreateScene()
;plane=LoadAirPlane( "biplane.x" )
plane=LoadAirPlane( "fighter.3ds" )
player1.Player=CreatePlayer( plane,0,0,GraphicsWidth(),GraphicsHeight(),1 )
;player1.Player=CreatePlayer( plane,0,0,640,239,1 )
;player2.Player=CreatePlayer( plane,0,240,640,239,2 )
;CameraRange player1\camera,1,40000
period=1000/FPS
time=MilliSecs()-period
TerrainDetail terr,detail,morph
While Not KeyHit(1)
Repeat
elapsed=MilliSecs()-time
Until elapsed
;how many 'frames' have elapsed
ticks=elapsed/period
;fractional remainder
tween#=Float(elapsed Mod period)/Float(period)
For k=1 To ticks
If k=ticks Then CaptureWorld
time=time+period
UpdateGame()
UpdateWorld
;SL_Update()
Next
If KeyHit(17)
wire=Not wire
WireFrame wire
EndIf
If KeyHit(26)
detail=detail-100
If detail<100 Then detail=100
TerrainDetail terr,detail,morph
Else If KeyHit(27)
detail=detail+100
If detail>10000 Then detail=10000
TerrainDetail terr,detail,morph
EndIf
If KeyHit(50)
morph=Not morph
TerrainDetail terr,detail,morph
EndIf
; Switch to mono mode by pressing Z
If KeyHit(46)>0 Then
;SL_SwitchToMono()
EndIf
; Switch to stereo mode by pressing X
If KeyHit(45)>0 Then
;SL_SwitchToStereo()
EndIf
;SL_Update()
RenderWorld tween
Color 255,0,0
If morph t$="Y" Else t$="N"
Text 0,0,"Detail:"+detail+" Morph:"+t$
Text 0,20,"A=Accelerate Z=Decelerate. Arrow keys to navigate."
Text 0,40,"C=Mono X=Stereo."
Flip
Wend
End
Function UpdateGame()
For p.Player=Each Player
UpdatePlayer(p)
Next
End Function
Function UpdatePlayer( p.Player )
Local x_dir,y_dir,z_dir
Select p\ctrl_mode
Case 1:
If KeyDown(203) x_dir=-1
If KeyDown(205) x_dir=1
If KeyDown(200) y_dir=-1
If KeyDown(208) y_dir=1
If KeyDown(30) z_dir=1
If KeyDown(44) z_dir=-1
If KeyHit(59) p\cam_mode=1
If KeyHit(60) p\cam_mode=2
If KeyHit(61) p\cam_mode=3
If KeyHit(62) p\cam_mode=4
Case 2:
x_dir=JoyXDir()
y_dir=JoyYDir()
If JoyDown(1) z_dir=1
If JoyDown(2) z_dir=-1
If KeyHit(63) p\cam_mode=1
If KeyHit(64) p\cam_mode=2
If KeyHit(65) p\cam_mode=3
If KeyHit(66) p\cam_mode=4
End Select
If x_dir<0
p\yaw_speed=p\yaw_speed + (4-p\yaw_speed)*.04
Else If x_dir>0
p\yaw_speed=p\yaw_speed + (-4-p\yaw_speed)*.04
Else
p\yaw_speed=p\yaw_speed + (-p\yaw_speed)*.02
EndIf
If y_dir<0
p\pitch_speed=p\pitch_speed + (2-p\pitch_speed)*.2
Else If y_dir>0
p\pitch_speed=p\pitch_speed + (-2-p\pitch_speed)*.2
Else
p\pitch_speed=p\pitch_speed + (-p\pitch_speed)*.1
EndIf
p\yaw=p\yaw+p\yaw_speed
If p\yaw<-180 Then p\yaw=p\yaw+360
If p\yaw>=180 Then p\yaw=p\yaw-360
p\pitch=p\pitch+p\pitch_speed
If p\pitch<-180 Then p\pitch=p\pitch+360
If p\pitch>=180 Then p\pitch=p\pitch-360
p\roll=p\yaw_speed*30
RotateEntity p\entity,p\pitch,p\yaw,p\roll
;see if y/p/r funcs are working...
t_p#=EntityPitch( p\entity )
t_y#=EntityYaw( p\entity )
t_r#=EntityRoll( p\entity )
RotateEntity p\entity,t_p,t_y,t_r
If p\ignition
If z_dir>0 ;faster?
p\thrust=p\thrust+10
Else If z_dir<0 ;slower?
p\thrust=p\thrust-10
EndIf
MoveEntity p\entity,0,0,p\thrust
Else If z_dir>0
p\ignition=True
EndIf
If p\camera
Select p\cam_mode
Case 1:
EntityParent p\camera,p\entity
EntityParent p\camera2,p\entity
RotateEntity p\camera,0,p\yaw,0,True
PositionEntity p\camera,EntityX(p\entity),EntityY(p\entity),EntityZ(p\entity),True
MoveEntity p\camera,0,1,-5
PointEntity p\camera,p\entity,p\roll/2
Case 2:
EntityParent p\camera,0
EntityParent p\camera2,0
PositionEntity p\camera,EntityX(p\entity),EntityY(p\entity),EntityZ(p\entity)
TranslateEntity p\camera,0,1,-5
PointEntity p\camera,p\entity,0
Case 3:
EntityParent p\camera,p\entity
EntityParent p\camera2,p\entity
PositionEntity p\camera,0,.25,0
RotateEntity p\camera,0,0,0
Case 4:
EntityParent p\camera,0
EntityParent p\camera2,0
PointEntity p\camera,p\entity,0
End Select
EndIf
End Function
Function LoadAirPlane( file$ )
pivot=CreatePivot()
plane=LoadMesh( file$,pivot )
; ScaleMesh plane,.125,.25,.125 ;make it more spherical!
ScaleMesh plane,.004,.004,.004
RotateEntity plane,0,180,0 ;and align to z axis
EntityRadius pivot,1
EntityType pivot,1
HideEntity pivot
Return pivot
End Function
Function CreatePlayer.Player( plane,vp_x,vp_y,vp_w,vp_h,ctrl_mode )
p.Player=New Player
p\ctrl_mode=ctrl_mode
p\cam_mode=1
x#=ctrl_mode*10
z#=ctrl_mode*10-2500
p\entity=CopyEntity( plane )
PositionEntity p\entity,TerrainSize(terr),TerrainY( terr,x,0,z )*5,TerrainSize(terr)
RotateEntity p\entity,0,180,0
ResetEntity p\entity
p\camera=CreateCamera( p\entity )
p\camera2=CreateCamera(p\entity)
;SL_SetLeftCamera(p\camera)
;SL_SetRightCamera(p\camera2)
;SL_SetUpCameras()
;SL_SetEyeSeparation(g_eyeSeparation#)
PositionEntity p\camera,0,3,-10
PositionEntity p\camera2,0,3,-10
;CameraViewport p\camera,vp_x,vp_y,vp_w,vp_h
CameraClsColor p\camera,0,0,0
CameraFogColor p\camera,0,0,0
CameraFogRange p\camera,farRange/2,farRange
CameraRange p\camera,1,farRange
CameraClsColor p\camera2,0,0,0
CameraFogColor p\camera2,0,0,0
CameraFogRange p\camera2,farRange/2,farRange
CameraRange p\camera2,1,farRange
; CameraZoom p\camera,1.5
If use_fog Then CameraFogMode p\camera,1
If use_fog Then CameraFogMode p\camera2,1
Return p
End Function
Function CreateScene()
Text 0,0,"TURN ON YOUR SPEAKERS :)"
Text 0,50,"LOADING TERRAIN HEIGHT MAP:"+terrainHeightMap
Flip
;setup lighting
l=CreateLight()
RotateEntity l,45,45,0
AmbientLight 32,32,32
;Load terrain
terr=LoadTerrain( terrainHeightMap )
ScaleEntity terr,terrainScaleX#/4096, terrainScaleY#, terrainScaleZ#/4096
PositionEntity terr,-(terrainScaleX#*TerrainSize(terr))/2,0,-(terrainScaleZ#*TerrainSize(terr)/2)
;-20*512,0,-20*512
EntityFX terr,1
EntityType terr,10
Text 0,100,"LOADING TERRAIN TEXTURE MAP:"+terrainTextureMap
Flip
Text 0,150,"HERE WE GO...."
Flip
tex2=LoadTexture( terrainTextureMap )
ScaleTexture tex2,TerrainSize(terr),TerrainSize(terr)
EntityTexture terr,tex2,0,0
End Function
i attached the media.
thanks!
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/