How to paint a portion of a mesh with a brush?

Blitz3D Forums/Blitz3D Programming/How to paint a portion of a mesh with a brush?

Hi!

The code below is bullocks, but I wanted to show it anyway. What I am trying is this: When a player digs a hole in the ground (mesh) I'd like to paint that part of the mesh with a ground texture. Now I am adding vertices, but I'd like to paint a part of the mesh. How can I accomplish this?

Thanks!

Jeroen


Graphics3D 800,600,32,2
SetBuffer BackBuffer()


mesh = LoadMesh ("meshes/statue.x")

paintTexture = LoadTexture("images/interface/inventory/playerLocation.png",2) 

PositionEntity mesh,0,3,0

camera= CreateCamera()
PositionEntity camera,0,5,-7
RotateEntity camera,0,10,0
plane=CreatePlane()

brush = CreateBrush()
BrushTexture brush,paintTexture 
BrushShininess brush,1 

surface = CreateSurface(mesh)
v0 = AddVertex (surface , -5,-5,0, 0 ,0) 
v1 = AddVertex (surface , 5,-5,0, 1 ,0) 
v2 = AddVertex (surface , 0, 5,0, 0.5,1) 

tri = AddTriangle (surface,v0,v2,v1) 


PaintSurface surface,brush
PaintMesh



While Not KeyHit(1)
	TurnEntity mesh, 0.5, 0.5, 0.5
	RenderWorld
	Flip

Wend
End