C3DLight::Create |
Top Previous Next |
Syntax:
Create(POINTER pScreen, int nType, int nIndex), int
Purpose: Creates a Direct3D light source.
Parameters: pScreen - A C3DScreen object. Returned value(s): TRUE if the light could be created, FALSE otherwise.
Application: light.Create(s,LIGHT_POINT,1)
Class Hierarchy -------C3DLight
Additional Info: nType can be one of LIGHT_POINT, LIGHT_SPOT or LIGHT_DIRECTIONAL. Point lights have color and position within a scene, but no single direction. They give off light equally in all directions. Directional lights have only color and direction, not position. They emit parallel light. Spotlights have color, position, and direction in which they emit light. Light emitted from a spotlight is made up of a bright inner cone and a larger outer cone, with the light intensity diminishing between the two.
A light must be rendered with the Draw method, or drawn by its parent object, before it effects any other meshes in the scene. The order in which lighting is specified has no effect on the final lighting. A light object can be positioned, orientated, and rotated using the same methods as a C3DObject and can serve as the parent of other objects in the scene.
The nIndex value is used by Direct3D internally. Each light should have its own unique zero based index number however it is ok to have multiple lights with the same index number as long as only one of them is rendered per frame. If two lights containing the same index number are rendered then Direct3D will use the last one specified.
|