3 * Copyright (C) 2011 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "arraylist.h"
29 #include "overlayframe.h"
33 // Main scene graph objects
39 // Base class for all scene objects
44 SceneNode(const char *title);
45 SceneNode(VFrame *image, int private_image, float x, float y);
48 void append(SceneNode *node);
49 SceneNode* get_node(int number);
51 // Copy values & image pointer but not subnodes yet
52 void copy_ref(SceneNode *node);
54 int get_memory_usage();
55 virtual void dump(int indent);
56 void render(VFrame *frame, int do_camera);
57 // 2D coordinate transformation
66 ArrayList<SceneNode*> nodes;
72 // Move. Only x & y are used in 2D.
73 // x,y is the top left corner in 2D
75 // Scale. Only sx & sy are used in 2D
77 // Rotate in degrees. Only ry is used in 2D
79 // causes x,y to be the top right corner in 2D
82 char title[BCTEXTLEN];
89 class SceneGraph : public VFrameScene
93 virtual ~SceneGraph();
95 SceneNode* get_node(int number);
96 void append(SceneNode *node);
97 void append_camera(SceneNode *node);
99 void render(VFrame *frame, int cpus);
101 void transform_camera(VFrame *frame,
109 ArrayList<SceneNode*> nodes;
110 ArrayList<SceneNode*> cameras;
112 AffineEngine *affine;
113 OverlayFrame *overlayer;
119 class SceneTransform : public SceneNode
123 virtual ~SceneTransform();
129 class SceneLight : public SceneNode
133 virtual ~SceneLight();
140 class SceneCamera : public SceneNode
144 virtual ~SceneCamera();
146 virtual void dump(int indent);
148 // Top left of box to look at in 2D
149 double at_x, at_y, at_z;
153 class SceneMaterial : public SceneNode
157 virtual ~SceneMaterial();
166 // Base class for shapes
167 class SceneShape : public SceneNode
174 double pivot_x, pivot_y, pivot_z;
179 class SceneCylinder : public SceneShape
183 virtual ~SceneCylinder();
186 class SceneSphere : public SceneShape
190 virtual ~SceneSphere();
193 class SceneBox : public SceneShape