![]() |
![]() |
![]() |
Mash Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces |
MashLightBox;
MashLightBoxClass;
ClutterActor * mash_light_box_new (ClutterLayoutManager *layout_manager
);
MashLightBox implements ClutterScriptable, ClutterAnimatable, AtkImplementorIface and ClutterContainer.
MashLightBox is a subclass of ClutterBox with the special property that it will apply a lighting model to all of its children. The intention is that the children will be MashModels but it can apply the lighting to any actors. All of the builtin light types depend on a ‘normal’ attribute being defined on each vertex of the children so it would only make sense to use these with MashModels containing normals.
The box implements the Blinn-Phong lighting model which is the standard model used in fixed function version of OpenGL and Direct3D. The lighting calculations are performed per-vertex and then interpolated across the surface of the primitives.
Lights are positioned within the light box by adding MashLights to the container. The lights must be direct children of the box to work (ie, they can be within another container in the box). The lights are subclasses of ClutterActor so they can be positioned and animated using the usual Clutter animation framework.
The lighting implementation requires GLSL support from Clutter. If
the application can still work without lighting it would be worth
checking for shader support by passing COGL_FEATURE_SHADERS_GLSL
to cogl_features_available()
.
It should be possible to extend the lighting model and implement
application-specific lighting algorithms by subclassing MashLight
and adding shader snippets by overriding
mash_light_generate_shader()
.
typedef struct _MashLightBox MashLightBox;
The MashLightBox structure contains only private data.
typedef struct { } MashLightBoxClass;
The MashLightBoxClass structure contains only private data.
ClutterActor * mash_light_box_new (ClutterLayoutManager *layout_manager
);
Constructs a new MashLightBox. A layout manager must be specified
with layout_manager
. To get similar fixed positioning semantics as
ClutterGroup, a ClutterFixedLayout instance could be used like
so:
ClutterActor *box = mash_light_box_new (clutter_fixed_layout_new ());
For details of other layouts that can be used, see
clutter_box_new()
.
|
A ClutterLayoutManager subclass |
Returns : |
a new MashLightBox. |