; ShaderColor 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 sphere=CreateSphere(32) ; The shader declares a colour parameter named Tint shader=LoadShader("assets/help_surface.b3shader") EntityShader sphere,shader angle#=0 paused=False While Not KeyDown(1) ; Press Space to pause the colour cycle If KeyHit(57) Then paused=Not paused If Not paused Then angle=angle+1 ; Feed a cycling colour into the shader's Tint parameter red=128+Sin(angle)*127 green=128+Sin(angle+120)*127 blue=128+Sin(angle+240)*127 ShaderColor shader,"Tint",red,green,blue TurnEntity sphere,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: pause colour cycle Arrow keys: move camera Esc: exit" Text 0,20,"ShaderColor shader,"+Chr$(34)+"Tint"+Chr$(34)+","+red+","+green+","+blue Flip Wend FreeShader shader End