; BrushBaseColorMap Example ; ------------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,0,-5 light=CreateLight() RotateEntity light,35,-30,0 ; Draw a texture by hand: a yellow sun on a blue sky texture=CreateTexture(64,64,1+8) SetBuffer TextureBuffer(texture) ClsColor 40,130,230 Cls Color 255,220,50 Oval 12,12,40,40,True SetBuffer BackBuffer() brush=CreateStandardBrush() cube=CreateCube() mapped=True While Not KeyDown(1) ; Press Space to attach or remove the base-colour map If KeyHit(57) Then mapped=Not mapped ; Set the map (texture zero removes it) and repaint the cube If mapped Then BrushBaseColorMap brush,texture Else BrushBaseColorMap brush,0 PaintEntity cube,brush TurnEntity cube,0.2,0.4,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 Color 255,255,255 Text 0,0,"Space: toggle map Arrow keys: move camera Esc: exit" If mapped Then Text 0,20,"BrushBaseColorMap brush,texture" Else Text 0,20,"BrushBaseColorMap brush,0 (map removed)" Flip Wend FreeBrush brush End