; LoadBrush Example ; ----------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,45,45,0 ; A crate to paint. A brush is a 'paint recipe' applied with PaintEntity. crate=CreateCube() PositionEntity crate,0,0,5 scale#=1.0 ; LoadBrush loads a texture and returns a ready-made brush in one call. ; Parameters: file$, texture flags (1=color), then u and v texture scale. brush=LoadBrush("media/b3dlogo.jpg",1,scale,scale) PaintEntity crate,brush While Not KeyDown(1) ; Press [ / ] to halve/double the texture scale and reload the brush changed=0 If KeyHit(26) And scale>0.25 scale=scale/2 changed=1 EndIf If KeyHit(27) And scale<4 scale=scale*2 changed=1 EndIf If changed FreeBrush brush brush=LoadBrush("media/b3dlogo.jpg",1,scale,scale) PaintEntity crate,brush EndIf TurnEntity crate,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,"[ / ] : change texture scale Arrows: camera Esc: exit" Text 0,20,"LoadBrush media/b3dlogo.jpg, flags 1, scale "+scale+","+scale Flip Wend End