tried scaling just prior to this reply...no luck, heres the source
;Init Window
Graphics3D 800,600
AppTitle "Mega Terrain 1.0"
Include "includes/b3dfile.bb"
Global number_brushes=8
Dim brush(number_brushes-1),my_surf(number_brushes-1),vx#(2),vy#(2),vz#(2)
Global ground_mesh
Global my_mesh
Global water,water_texture
Global ground_texture
Global sky
Global sky_image
my_mesh = CreateMesh ()
camera = CreateCamera ()
PositionEntity camera,0,1,0
CameraRange camera,.1,3000
;fog
;CameraFogMode camera,1
;CameraFogRange camera,10,2600
;CameraFogColor camera,100,100,100
light = CreateLight()
PositionEntity light,0,6,0
AmbientLight 255,255,255
radius#=1500
altitude#=20
speed#=-0.1
oangle#=90
Load_Ground_Mesh ("meshes/ground.3ds")
Load_Ground_Texture ("gfx/ground.bmp",number_brushes,128)
Paint_Ground_Mesh ()
Load_Water()
Load_Sky()
Gosub saveit
sun = LoadSprite ("gfx/sun.bmp")
PositionEntity sun,0,1,2000
ScaleSprite sun,1000,1000
EntityFX sun,1
EntityShininess sun, 1
moon = LoadSprite ("gfx/moon.bmp")
PositionEntity moon,0,1,-2000
ScaleSprite moon,100,100
;Main Loop
While Not KeyDown(1)
If KeyDown( 205 )=True Then TurnEntity camera,0,-1,0
If KeyDown( 203 )=True Then TurnEntity camera,0,1,0
If KeyDown( 208 )=True Then MoveEntity camera,0,0,-.1
If KeyDown( 200 )=True Then MoveEntity camera,0,0,.1
y#=0
If linepick(EntityX# (camera),200,EntityZ# (camera),0,-201,0)
y#=PickedY# ()+1-EntityY# (camera)
End If
TranslateEntity camera,0,y#,0
;Update Water
EntityTexture water,water_texture,index
index=index+1:if index>14 Then index=0
;Update Clouds
PositionTexture sky_image,u_position#,v_position#
u_position#=u_position#+.0001
;Update Sun
oy#=radius#*cos(oangle#)
oz#=radius#*sin(oangle#)
oangle#=oangle#+speed#
oangle#= oangle# Mod 360
PositionEntity sun,altitude#,oy#,oz#
oy#=radius#*cos(oangle#+180)
oz#=radius#*sin(oangle#+180)
PositionEntity moon,altitude#,oy#,oz#
;Show It
UpdateWorld
RenderWorld
Flip
Wend
Function Load_Ground_Texture(File$,Frames,FrameSize)
ground_texture=LoadAnimTexture ( File$,1,FrameSize,FrameSize,0,Frames )
For f=0 To Frames-1
brush(f)=CreateBrush ( 255,255,255 )
BrushTexture brush(f),ground_texture,f
my_surf(f) = CreateSurface ( my_mesh,brush(f))
DebugLog "creating Brush : "+f
Next
End Function
Function Load_Ground_Mesh(File$)
ground_mesh=LoadMesh ( File$)
End Function
Function Paint_Ground_Mesh()
mesh_Height#=MeshHeight# (ground_mesh )
factor#=number_brushes/mesh_Height#
For f=1 To CountSurfaces ( ground_mesh )
surface=GetSurface ( ground_mesh, f )
For g=0 To CountTriangles ( surface )-1
average#=0
For vertex=0 To 2
vertex_index = TriangleVertex ( surface,g,vertex )
vx#(vertex)=VertexX# ( surface,vertex_index )
vy#(vertex)=VertexY# ( surface,vertex_index ):average#=average#+vy#(vertex)
vz#(vertex)=VertexZ# ( surface,vertex_index )
Next
index=average#/3*factor#
index=index+rnd(-1,1)
If index<0 Then index=0
If index>number_brushes-1 Then index=number_brushes-1
If even
v0 = AddVertex (my_surf(index), vx#(0),vy#(0),vz#(0), 1, 0)
v1 = AddVertex (my_surf(index), vx#(1),vy#(1),vz#(1), 1 ,1)
v2 = AddVertex (my_surf(index), vx#(2),vy#(2),vz#(2), 0 ,0)
Else
v0 = AddVertex (my_surf(index), vx#(0),vy#(0),vz#(0), 0 ,1)
v1 = AddVertex (my_surf(index), vx#(1),vy#(1),vz#(1), 0, 0)
v2 = AddVertex (my_surf(index), vx#(2),vy#(2),vz#(2), 1, 1)
End If
tri = AddTriangle (my_surf(index),v0,v2,v1)
even=not even
DebugLog "triangle : "+g+" brush = "+index+" "+v0+", "+v2+" ,"+v1
Next
Next
FreeEntity ground_mesh
UpdateNormals my_mesh
PositionEntity my_mesh,0,0,0
EntityPickMode my_mesh,2
EntityAutoFade my_mesh,100,300
End Function
Function Load_Water()
water_texture=LoadAnimTexture ( "gfx/water.bmp",1,128,128,0,15 )
water_texture2=LoadTexture ( "gfx/seafloor.bmp")
ScaleTexture water_texture2,1000,1000
water= CreatePlane ()
water2= CreatePlane ()
EntityTexture water2,water_texture2,0,0
EntityFX water2,1
PositionEntity water2,0,-2,0
EntityTexture water,water_texture,0,1
EntityAlpha water,.75
EntityShininess water, 1
End Function
Function Load_Sky()
sky=CreateSphere(32)
ScaleEntity sky,2500,2500,2500
sky_image=LoadTexture( "gfx/sky0.bmp" )
EntityTexture sky,sky_image
FlipMesh sky
End Function
.saveit
Global c_surfs=CountSurfaces(my_mesh)
Dim c_surf(c_surfs)
Dim c_brush(c_surfs)
Dim c_tex(c_surfs)
Dim c_tex_name$(c_surfs)
; track down used textures (thanks Mark!)
For i=1 To c_surfs
c_surf(i)= GetSurface(my_mesh,i)
c_brush(i)=GetSurfaceBrush( c_surf(i) )
c_tex(i)=GetBrushTexture( c_brush(i) )
c_tex_name$(i)=Lower$(TextureName$( c_tex(i))) ; Full (!) Texture Path
curdir$=Lower$(CurrentDir$())
c_tex_name$(i)= Replace$(c_tex_name$(i),curdir$,"") ;<<<<<<<<<<<<<<<<<<<
If c_tex_name$(i)="" Then Print "Error: Surface No."+i+" has no Texture"
If FileType(c_tex_name$(i))<>1 Then Print "Warning: Surface No."+i+" uses nonexistant Texture ("+c_tex_name$(i)+")."
Next
WriteBB3D( "meshes/wip.b3d",my_mesh )
For i=1 To c_surfs
FreeBrush c_brush(i); release memory
FreeTexture c_tex(i)
Next
Return
Function WriteBB3D( f_name$,mesh )
file=WriteFile( f_name$ )
b3dSetFile( file )
b3dBeginChunk( "BB3D" )
b3dWriteInt( 1 ) ;version
b3dBeginChunk( "TEXS" ) ; list all textures used by the mesh
For i=1 To c_surfs
b3dWriteString( c_tex_name$(i) ) ;texture file
b3dWriteInt( 1 ) ;flags
b3dWriteInt( 2 ) ;blend
b3dWriteFloat( 0 ) ;x in tex 0 (hu?)
b3dWriteFloat( 0 ) ;y in tex 0
b3dWriteFloat( 1 ) ;x scale 1
b3dWriteFloat( 1 ) ;y scale 1
b3dWriteFloat( 0 ) ;rotation 0
Next
b3dEndChunk() ;end of TEXS chunk
For i=1 To c_surfs
b3dBeginChunk( "BRUS" ) ; describe all brushes used by the mesh
b3dWriteInt( 1 ) ;number of textures per brush ; (eg 2 with lightmap)
b3dWriteString( "brush"+(i-1) ) ;brushname
b3dWriteFloat( 1 ) ;red
b3dWriteFloat( 1 ) ;green
b3dWriteFloat( 1 ) ;blue
b3dWriteFloat( 1 ) ;alpha
b3dWriteFloat( 0 ) ;shininess
b3dWriteInt( 1 ) ;blendmode
b3dWriteInt( 0 ) ;FX
b3dWriteInt( i-1 ) ;used texture index
b3dEndChunk() ;end of BRUS chunk
Next
b3dBeginChunk( "NODE" )
b3dWriteString( "my_mesh" )
b3dWriteFloat( 0 ) ;x_pos
b3dWriteFloat( 0 ) ;y_pos
b3dWriteFloat( 0 ) ;z_pos
b3dWriteFloat( 1 ) ;x_scale
b3dWriteFloat( 1 ) ;y_scale
b3dWriteFloat( 1 ) ;z_scale
b3dWriteFloat( 1 ) ;rot_w
b3dWriteFloat( 0 ) ;rot_x
b3dWriteFloat( 0 ) ;rot_y
b3dWriteFloat( 0 ) ;rot_z
WriteMESH( mesh )
b3dEndChunk() ;end of NODE chunk
b3dEndChunk() ;end of BB3D chunk
CloseFile file
End Function
Function WriteMESH( mesh )
n_surfs=CountSurfaces( mesh )
b3dBeginChunk( "MESH" )
b3dWriteInt( -1 ) ;no 'entity' brush -1
b3dBeginChunk( "VRTS" )
b3dWriteInt( 0 ) ;flags - 0=no normal/color
b3dWriteInt( 1 ) ;number of tex_coord sets (eg: 2 with lightmap)
b3dWriteInt( 2 ) ;coords per set (u,v,w?) 2 with uv, 3 with uvw
For k=1 To n_surfs
surf=GetSurface( mesh,k )
n_verts=CountVertices( surf )-1
For j=0 To n_verts
b3dWriteFloat( VertexX( surf,j ) )
b3dWriteFloat( VertexY( surf,j ) )
b3dWriteFloat( VertexZ( surf,j ) )
b3dWriteFloat( VertexU#( surf,j,0 ) )
b3dWriteFloat( VertexV#( surf,j,0 ) )
Next
Next
b3dEndChunk() ;end of VRTS chunk
first_vert=0
For k=1 To n_surfs
surf=GetSurface( mesh,k )
n_tris=CountTriangles( surf )-1
b3dBeginChunk( "TRIS" )
b3dWriteInt( k-1 ) ;brush for these triangles (surf -1 !!!)
For j=0 To n_tris
b3dWriteInt( first_vert+TriangleVertex( surf,j,0 ) )
b3dWriteInt( first_vert+TriangleVertex( surf,j,1 ) )
b3dWriteInt( first_vert+TriangleVertex( surf,j,2 ) )
Next
b3dEndChunk() ;end of TRIS chunk
first_vert=first_vert+CountVertices( surf )
Next
b3dEndChunk() ;end of MESH chunk
End Function