dd77975eea70030fe543501d4cb8aa05e780b277
[simavr] / examples / board_reprap / src / c3 / c3object.h
1 /*
2         c3object.h
3
4         Copyright 2008-2012 Michel Pollet <buserror@gmail.com>
5
6         This file is part of simavr.
7
8         simavr is free software: you can redistribute it and/or modify
9         it under the terms of the GNU General Public License as published by
10         the Free Software Foundation, either version 3 of the License, or
11         (at your option) any later version.
12
13         simavr is distributed in the hope that it will be useful,
14         but WITHOUT ANY WARRANTY; without even the implied warranty of
15         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16         GNU General Public License for more details.
17
18         You should have received a copy of the GNU General Public License
19         along with simavr.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22
23 #ifndef __C3OBJECT_H___
24 #define __C3OBJECT_H___
25
26 #include <stdbool.h>
27 #include "c3/c3transform.h"
28 #include "c3/c3geometry.h"
29
30 struct c3object_t;
31
32 DECLARE_C_ARRAY(struct c3object_t*, c3object_array, 4);
33
34 typedef struct c3object_t {
35         str_p name;
36         int     dirty : 1, visible : 1 /* TODO: Implement visible */;
37         struct c3context_t * context;
38         struct c3object_t * parent;
39         const struct c3driver_object_t ** driver;
40         c3transform_array_t     transform;
41         c3object_array_t        objects;
42         c3geometry_array_t      geometry;
43 } c3object_t, *c3object_p;
44
45 c3object_p
46 c3object_new(
47                 c3object_p o /* = NULL */);
48 void
49 c3object_dispose(
50                 c3object_p o);
51 void
52 c3object_clear(
53                 c3object_p o);
54
55 c3object_p
56 c3object_init(
57                 c3object_p o /* = NULL */,
58                 c3object_p parent);
59
60 void
61 c3object_set_dirty(
62                 c3object_p o,
63                 bool dirty);
64 void
65 c3object_add_geometry(
66                 c3object_p o,
67                 c3geometry_p g);
68 void
69 c3object_add_object(
70                 c3object_p o,
71                 c3object_p sub);
72 c3transform_p
73 c3object_add_transform(
74                 c3object_p o );
75 void
76 c3object_get_geometry(
77                 c3object_p o,
78                 c3geometry_array_p array );
79 void
80 c3object_project(
81                 c3object_p o,
82                 const c3mat4p m);
83
84 IMPLEMENT_C_ARRAY(c3object_array);
85
86 #endif /* __C3OBJECT_H___ */