Mutitexturing terrain

Blitz3D Forums/Blitz3D Beginners Area/Mutitexturing terrain

Should get you going...

Const TERRAIN_SIZE=16
Graphics3D 800,600,0,2
SetBuffer BackBuffer()
cam=CreateCamera(): PositionEntity cam,(TERRAIN_SIZE*.5)-1,10,-TERRAIN_SIZE
light=CreateLight(1,cam): PositionEntity light,40,40,-40
worldPiv=CreatePivot(): PositionEntity worldPiv,(TERRAIN_SIZE*.5),0,(TERRAIN_SIZE*.5)
EntityParent cam,worldPiv

terrain=CreateTerrain(TERRAIN_SIZE)
TerrainShading terrain,True
For x=0 To TERRAIN_SIZE-1
For z=0 To TERRAIN_SIZE-1
	ModifyTerrain terrain,x,z,Rnd(1,10)
Next
Next

terrainTex=CreateTexture(64,64)
Color 50,100,50
Rect 0,0,64,64,True
Color 70,140,70
For x=0 To 127
	Plot Rand(0,63),Rand(0,63)
Next
CopyRect 0,0,64,64,0,0,BackBuffer(),TextureBuffer(terrainTex)
EntityTexture terrain,terrainTex,0,0

trackTex=CreateTexture(256,256)
Color 255,255,255
Cls
Oval 0,0,255,255,False
CopyRect 0,0,256,256,0,0,BackBuffer(),TextureBuffer(trackTex)
EntityTexture terrain,trackTex,0,1
ScaleTexture trackTex,TERRAIN_SIZE,TERRAIN_SIZE
TextureBlend trackTex,3

PointEntity cam,worldPiv

While Not KeyHit(1)
	TurnEntity worldPiv,0,1,0
	RenderWorld
	Flip
Wend