|
*** useful and a bit advanced
Used to create effects of soft shadows.
This function is used together with STATE_object_auto_add_shadows()
By default the shadows a painted with a black translucent color (using the ALPHA_FILTER)
By calling STATE_layer_use_for_painting_shadows()
You tell the engine to use the setting of this layer to paint the shadows.
When using a layer as a color fill for shadows it is only used for the shadows and not anything else
if there are no shadows then it layer is not drawn at all.
* Note that is works only with shadows that were created using
STATE_object_auto_add_shadows();
* Usually you would want this layer to cover the entire screen because shadows that are not included
in the layer area will not be painted.
* There could only be one layer that is used for painting the shadows
The last layer that is specified in the call to STATE_layer_use_for_painting_shadows()
is the layer that is used for painting.
* Note that calling STATE_layer_use_for_painting_shadows(my_layer, NO)
will convert this layer to a regular layer which is rendered every time
STATE_engine_render() is called. And since usually these layers
cover the entire screen then ... So if it is not what you meant simply
delete this layer or call STATE_polygon_disable(my_layer) to disable it
Example:
DWORD my_bitmap=STATE_bitmap_load("shadow_patern", -1);
if(my_bitmap==NULL) return(VR_ERROR);
DWORD layer_polygon=STATE_layer_create(0,0, 100, 100, my_bitmap, ALPHA_FILTER); cover the whole rendered screen
STATE_layer_use_for_painting_shadows(layer_polygon, YES);
FOREACH_POINT(layer_polygon, pnt)
STATE_point_set_alpha(pnt, 128); make the shadow layer half transparent
|