C3DLight::SetDirection |
Top Previous Next |
Syntax:
SetDirection(float x, float y, float z)
Purpose: Changes the lights direction for spot and directional light types.
Parameters: x, y, z - The new direction vector
Returned value(s): None
Application: light1.SetDirection(0.0, -1.0, 0.0)
Class Hierarchy -------C3DLight
Additional Info: Direction vectors are described as distances from a logical origin, regardless of the light's position in a scene. Therefore, a spotlight that points straight into a scene along the positive z-axis has a direction vector of <0,0,1> no matter where its position is defined to be. Similarly, you can simulate sunlight shining directly on a scene by using a directional light whose direction is <0,-1,0>. Obviously, you don't have to create lights that shine along the coordinate axes; you can mix and match values to create lights that shine at more interesting angles.
Note Although you don't need to normalize a light's direction vector, always be sure that it has magnitude. In other words, don't use a <0,0,0> direction vector.
|