Math: renamed Rect to Rectf, implemented Vector2u32 and Rectu32. Scenegraph: implemen...
[fail.git] / scenegraph / scenegraph.aidl
blobb0a3501f19781ce3a26845e56a56e4f5bef9ac21
1 #include "../math/math.aidl"
2 #include "animation.aih"
3 #include "geometry.aih"
4 #include "material.aih"
6 namespace awful { namespace scenegraph
8         // A rendering context. This represent one rendering into one pixmap (either the screen
9         // or a texture). A pointer to a rendering context is passed to the Renderables at evaluation time.
10         // A renderable can choose to create a new rendering context and evaluate a sub-scene into it.
11         // For instance a portal could render its target to a texture, and then append a geometry with just
12         // one quad with this texture into the rendering context it's been given.
13         //
14         // There is a global list of contexts. Each new context is inserted in front of the list, and they
15         // are rendered in order. In effect, it means that any sub context created when evaluating a renderable
16         // will be rendered first (as they are dependencies of the original context)
17         [ storable=false ]
18         class RenderContext
19         {
20                 RenderContext( Pointer< ViewPort > pViewPort );
21         
22                 static void RenderAll();
23                 static void ClearAll();
24                 void clear();
25                 
26                 Pointer< ViewPort > pViewPort;
27         };
28         [ default ]
30         // A high-level renderable object. This is an interface.
31         // It can be a simple mesh, a composite mesh, a character, a world sector,
32         // a terrain, a culling object, a portal etc.
33         // The root object for the world is a Renderable.
34         [ abstract=true ]
35         class Renderable
36         {
37                 void evaluate( Pointer< RenderContext > pContext );
38         };
39         [ default ]
41         // A spatial transformation node. It may have a parent, and a number of children.
42         // The transformation tree represented by those live independently of the tree of
43         // renderable objects, which points to Frames to define their positions.
44         // Object outside of the renderable tree (camera, collision entities, physics objects,
45         // game code objects, lights) will also point to and interact with those.
46         class Frame
47         {
48                 Pointer< Frame > pParent;
50                 [ unmutable=true ]
51                 math::Matrix44f LocalToParent;
52         };
53         
54         // An elementary renderable object. It points to a material, some geometric data, and
55         // some state data (like its position, or the position of all the bones it refers to)
56         // It can be anything from a billboard to a bunch of textured polygons to
57         // a particle system or a piece of terrain, depending on the shaders in the material
58         // and what kind of geometry is actually described.
59         class Drawable : Renderable
60         {
61                 Pointer< Geometry >     pGeometry;
62                 Pointer< Material >     pMaterial;
63                 Pointer< Frame >        pFrame;
64                 
65                 //vector< Input >       Uniforms;
66         };
67         
68         class Camera
69         {
70                 Camera( Pointer< Frame > pFrame );
71                 Pointer< Frame >        pFrame;
72                 float                           FOV;
73         };
74         
75         class ViewPort
76         {
77                 ViewPort( Pointer< Camera > pCamera );
78                 Pointer< Camera >       pCamera;
79                 math::Rectu32           Rect;
80                 float                           ZNear;
81                 float                           ZFar;
82         };