Hi there,
Can anyone help me with this bit of code;
;////////////
terrain2=LoadTerrain ("Heightmap.bmp")
ScaleEntity terrain2, 1,12,1
PositionEntity terrain2,0,7,0
EntityTexture terrain2,tex1
texbuf=TextureBuffer(tex1)
LockBuffer db
For x=0 To 256
For y=0 To 256
height=TerrainHeight# ( terrain2,x,y )
If height>0.5
Color 255,0,0
WritePixel x,y,(Color),texbuf
EndIf
Next
Next
UnlockBuffer texbuf
;///////////
When the program runs, a large patch of the terrain texture (seemingly unrelated to height) is painted black, and the onscreen text goes red.
I would actually like the texture to write depending on the height of the returned terrain, which could make lots of cool effects (snow on mountains changing with seasons etc), but this deosnt seem to work?
Thanks, :-)
Can anyone help me with this bit of code;
;////////////
terrain2=LoadTerrain ("Heightmap.bmp")
ScaleEntity terrain2, 1,12,1
PositionEntity terrain2,0,7,0
EntityTexture terrain2,tex1
texbuf=TextureBuffer(tex1)
LockBuffer db
For x=0 To 256
For y=0 To 256
height=TerrainHeight# ( terrain2,x,y )
If height>0.5
Color 255,0,0
WritePixel x,y,(Color),texbuf
EndIf
Next
Next
UnlockBuffer texbuf
;///////////
When the program runs, a large patch of the terrain texture (seemingly unrelated to height) is painted black, and the onscreen text goes red.
I would actually like the texture to write depending on the height of the returned terrain, which could make lots of cool effects (snow on mountains changing with seasons etc), but this deosnt seem to work?
Thanks, :-)