O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Light Range

You can control how “strong” a light is by adjusting its range. The stronger the range is, the farther it will reach. In the next example, we’ll create a sphere that is far off in the distance and is lit by a spotlight. We’ll then change the light range to see how it affects our image. The code used to adjust the range is LightRange followed by the name of the light and the amount of range. Open the file called demo07-08.bb or enter this code:

;demo07-08.bb - Lights and Cameras ; –––––––––––––––– Graphics3D 640,480 SetBuffer BackBuffer() Const ESC_KEY = 1 ; Create camera camera=CreateCamera() ; Create a light light=CreateLight(3) LightRange light, 50 ; This is the code for creating the sphere sphere=CreateSphere() PositionEntity ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required