; BrushEnvironmentMap 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 tiny 2:1 equirectangular environment: sky, horizon and sun environment=CreateTexture(64,32,1+8+32) SetBuffer TextureBuffer(environment) ClsColor 30,80,180 Cls Color 255,160,60 Rect 0,16,64,16,True Color 255,240,180 Oval 44,4,8,8,True SetBuffer BackBuffer() ; A smooth metal sphere reflects the environment strongly brush=CreateStandardBrush(220,220,220) BrushPBR brush,1,0.15 sphere=CreateSphere(32) strength#=1.0 While Not KeyDown(1) ; Press [ / ] to change the environment lighting strength If KeyDown(26) And strength>0 Then strength=strength-0.02 If KeyDown(27) And strength<3 Then strength=strength+0.02 ; Light the sphere from the image and repaint it BrushEnvironmentMap brush,environment,0,strength PaintEntity sphere,brush ; 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,"[ / ] : strength Arrow keys: move camera Esc: exit" Text 0,20,"BrushEnvironmentMap brush,environment,0,"+strength Flip Wend FreeBrush brush End