Painting entities

Blitz3D Forums/Blitz3D Beginners Area/Painting entities

Moraldi(Posted 2008) [#1]
Is it possible to 'clear' a brush or a texture from an entity?
If this is an entity created with the LoadMesh/LoadAnimMesh functions then I want to avoid to reload them again

Thanks!


Beaker(Posted 2008) [#2]
br = CreateBrush()
PaintEntity ent,br
??


Moraldi(Posted 2008) [#3]
You mean to create a new brush and repaint the entity?
No it didn't work.


Ross C(Posted 2008) [#4]
I'm pretty sure creating a blank bursh, and painting the entity as beaker suggests works. You simple free the other brush, or change it's properties.


Moraldi(Posted 2008) [#5]
This code does not work:

CreateBrush Example 
; ------------------- 

Graphics3D 640,480 
SetBuffer BackBuffer() 

camera=CreateCamera() 

light=CreateLight() 
RotateEntity light,90,0,0 

cube=CreateCube() 
PositionEntity cube,0,0,5 

; Load texture 
;tex=LoadTexture("anytexture.jpg") 

; Create brush 
;brush=CreateBrush() 
brush = LoadBrush("tex1.jpg")

; Apply texture to brush 
;BrushTexture brush,tex 

; And some shininess 
BrushShininess brush,1
BrushColor brush, 255,0,0

; Paint mesh with brush 
PaintMesh cube,brush 

While Not KeyDown( 1 ) 

	pitch#=0 
	yaw#=0 
	roll#=0 

	If KeyDown( 208 )=True Then pitch#=-1 
	If KeyDown( 200 )=True Then pitch#=1 
	If KeyDown( 203 )=True Then yaw#=-1 
	If KeyDown( 205 )=True Then yaw#=1 
	If KeyDown( 45 )=True Then roll#=-1 
	If KeyDown( 44 )=True Then roll#=1 
	If KeyHit( 57 )=True Then newbrush=CreateBrush() : FreeBrush brush : PaintEntity cube, newbrush : FreeBrush newbrush

	TurnEntity cube,pitch#,yaw#,roll# 

	RenderWorld 
	Flip 

Wend 

End



Kev(Posted 2008) [#6]
try PaintMesh(cube, newbrush)


Ross C(Posted 2008) [#7]
Paintmesh will work properly :o)


Moraldi(Posted 2008) [#8]
Thanks Kev! It works with animated meshes also.