Graphics Reference
In-Depth Information
which were directly upon the three-dimensional graphics engine of OpenGL and Direct3D
[1]. OpenGVS offered API based on its own resources, and can easily organize elements
of visual simulation. Light source tools in OpenGVS can be used to control the dynamic
lighting effect in the scene, which was established on the basis of the OpenGL lighting
model. The purpose of the light source tool was to control the light in the scene to simulate
the real-world lighting effects. The light source tool provided color, shading, and con-
trolled the light in simulation scenario. The function of GV_lsr_create could create a light
source. The function returned a handle that can be used in almost all other light utility
functions to manipulate the particular source. The light source can be divided into an
infinite light, local light, spotlight and point light according to the characteristics [2].
2.1
Infinite Light
All the default light sources were infinite light (also called directional light), the con-
cept was from the light source of infinity "light." Since the light source was infinity far
from an object, the light was considered to be parallel. That was very similar to the real
world of sunlight. The light source can be set up by the following statement:
G_Vector sun_direction = {1.0, 0.0, 0.0};// Light direction
GV_Light sun;
GV_lsr_create( &sun );// Create an infinite light
GV_lsr_set_name( sun, "SUN" );// Setting Name
GV_lsr_set_direction( sun, &sun_direction );// Set direction
The infinite light sources could simulate real world when the sun at different times
from sunrise to the downhill, as shown in figure 1.
( a) Noon (b) Evening (c)night
Fig. 1. Simulate different time with unlimited light source
2.2
Local Light
The local light (also known position light) requires precise three-dimensional world
coordinate position, the local light had a local effect depends on the relative strength
and position of the light source. The local lighting effects depended on the location of
the local light and the object and the scope of the local light.
G_Position light_position = {0.0, 5.0, 0.0};
G_Vector light_direction = {1.0, 0.0, 0.0};
GV_Light room_light;
Search WWH ::




Custom Search