|
Exactly like STATE_engine_create_shadow() only that it is faster
The disadvantage is that dynamic shadows can only be deleted with
STATE_engine_delete_dynamic_shadows() which delete all the existing dynamic shadow.
(STATE_group_delete_patches() wont work here)
We suggest that you use this function to create shadows that can be changed from
one render to another. For example in our world we might have several source
of lights some of them will be moving and some are fixed. We could also have some moving objects
in our world (so their shadow is moving too). The shadow that is created
from the fixed light sources and by the fixed object can be created only once at the beginning of
the program. To create the fixed shadows use STATE_engine_create_shadow()
The shadows that are created by the moving light sources or from the moving objects will have to be
deleted and recreated for each render cycle. Use STATE_engine_create_dynamic_shadow()
to create them. To delete them use STATE_engine_delete_dynamic_shadows().
Here is an example:
creating the static shadow. Create the shadow that the trees project on the ground
double sun[3]={10000, 10000, 30000};
STATE_engine_create_shadow(ground, trees, sun, 255);
while(Escape key is not pressed) {
STATE_engine_delete_dynamic_shadows();
move_our_ball(ball);
STATE_engine_create_dynamic_shadow(ground, ball, light_source);
STATE_engine_render(NULL, camera);
}
See also STATE_engine_set_patches_offset()
|