; PaintEntity Example ; ------------------- ; PaintEntity applies a brush at the ENTITY level - it works on any ; entity, including loaded models. (PaintMesh paints every surface of ; a mesh; PaintSurface paints just one surface.) Here we tint a ; textured oil drum: the brush colour combines with its texture. Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,0,-4 light=CreateLight() RotateEntity light,30,40,0 ; Load a textured model and fit it into a 2-unit box drum=LoadMesh("media/oil-drum/oildrum.3ds") FitMesh drum,-1,-1,-1,2,2,2,1 ; Three tint brushes red_brush=CreateBrush() BrushColor red_brush,255,90,90 blue_brush=CreateBrush() BrushColor blue_brush,90,140,255 white_brush=CreateBrush() BrushColor white_brush,255,255,255 tint$="none yet" While Not KeyDown(1) ; 1/2/3 repaint the whole entity - the documented command If KeyHit(2) Then PaintEntity drum,red_brush : tint="1: red" If KeyHit(3) Then PaintEntity drum,blue_brush : tint="2: blue" If KeyHit(4) Then PaintEntity drum,white_brush : tint="3: white" TurnEntity drum,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"1 / 2 / 3 : tint the drum Arrow keys: move camera Esc: exit" Text 0,20,"PaintEntity drum with brush "+tint Flip Wend End