d3d_light_define_direction(ind, dx, dy, dz, col)
Argument | Description |
---|---|
ind | The index number of the light. |
dx | The x component of the light vector. |
dy | The y component of the light vector. |
dz | The z component of the light vector. |
col | The colour of the light. |
Returns: N/A
To use lighting you obviously need to define lights. In GameMaker: Studio two different lights exist: directional lights (like the sun), and positional lights. This function is for a directional light, and the direction and intensity are
set by the values input for the x,y and z unit vector (meaning that they must be between -1 and 1, where 1 or -1 is full intensity, and 0 is no intensity). The lights can also be given a colour, which will also affect the
perceived intensity of the light as certain colours appear "darker" than others. You must also give the light an index number which what will be used in other functions to reference it.
Note: There are only 8 hardware lights available, so you should use these functions to define and manage "active" lights, not all lights in the scene.
d3d_set_lighting(true);
d3d_light_define_direction(1, 0, 1, 0, c_white);
d3d_light_enable(1, true);
The above code will enable lighting for the whole scene, then define a white light and finally turn that light on.