annotate Renderer/Engine/SceneGraphRoot.h @ 761:c0a8af52fa43 draft

add lights
author yutaka@henri.cr.ie.u-ryukyu.ac.jp
date Sat, 06 Feb 2010 03:02:48 +0900
parents 45f7ab7101ea
children b480fc04206f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
1 #ifndef INCLUDED_SCENE_GRAPH_ROOT
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2 #define INCLUDED_SCENE_GRAPH_ROOT
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
4 #include "SceneGraph.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
5 #include "SceneGraphArray.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
6 #include "Camera.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
7 #include "SceneGraphIterator.h"
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
8 #include <sys/types.h>
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
9
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
10 typedef struct {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
11 caddr_t file_mmap;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
12 off_t size;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
13 } st_mmap_t;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
14
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
15 class Application;
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
16
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
17 class SceneGraphRoot;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
18 typedef void (*regist_func)(SceneGraphRoot *sgroot);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
19
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 class SceneGraphRoot {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
21 public:
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
22 /* Constructor, Destructor */
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
23 SceneGraphRoot(float w, float h);
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
24 ~SceneGraphRoot();
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
25
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
26 /* Variables */
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
27 TaskManager *tmanager;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
28
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
29 // xml から読み込んだ、オリジナルの SceneGraph
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
30 // Static Singleton
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
31 // SceneGraphPtr *sg_src;
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
32 // int sg_src_length;
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
33 SceneGraphPtr list;
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
34
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
35 // move, collision 用の SceneGraph (tree)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
36 SceneGraphPtr sg_exec_tree;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
37
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
38 // 描画用の SceneGraph List (tree)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
39 SceneGraphPtr sg_draw_tree;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
40
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
41 // sg_exec_tree に対応する list
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
42 SceneGraphPtr sg_available_list;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
43
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
44 // sg_draw_tree に対応する list
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
45 // draw_tree は描画後削除される
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
46 SceneGraphPtr sg_remove_list;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
47
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
48 SceneGraphArrayPtr sg_array1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
49 SceneGraphArrayPtr sg_array2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
50 SceneGraphArrayPtr sg_curArray;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
51
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
52 // コントローラーオブジェクト (Keyboard, Joystick, ..)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
53 Pad *controller;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
54
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
55 // カメラオブジェクト
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
56 Camera *camera;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
57
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 591
diff changeset
58 // 光源のオブジェクト
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
59 SceneGraphPtr light[4];
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
60 // 光源の疑似 xml file
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
61 // 光源は4つで決め打ち。
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
62 // 4 * lightnum (4) = 16;
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
63 float light_vector[16];
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 591
diff changeset
64
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
65 // SceneGraphIterator
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
66 SceneGraphIteratorPtr iterator;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
67
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
68 // fd of Linda taple space
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
69 int tid;
591
65e52fd2c2e2 send linda not work...
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents: 580
diff changeset
70
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
71 // move task test flag
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
72 int move_finish_flag;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
73
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
74 // 関数ポインタ
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
75 regist_func regist;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
76 // application で実行する task
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
77 HTaskPtr move_exec_task;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
78
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
79 // とりあえず
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
80 int screen_w;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
81 int screen_h;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
82
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
83
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
84 /**
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
85 * Functions
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
86 */
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
87 /* User API */
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
88 void createFromXMLfile(TaskManager *manager, const char *);
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 575
diff changeset
89 void createFromXMLmemory(TaskManager *manager, SceneGraph * node, char *data, int len);
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
90 SceneGraphPtr createSceneGraph(int id);
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
91 SceneGraphPtr createSceneGraph();
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
92 SceneGraphPtr createSceneGraph(const char *name);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
93 int getSgid(const char *name);
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
94 void appTaskRegist(regist_func new_regist);
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
95
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
96 void setSceneData(SceneGraphPtr sg);
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
97 Pad *getController();
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
98 SceneGraphIteratorPtr getIterator();
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
99 SceneGraphIteratorPtr getIterator(SceneGraphPtr list);
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
100 CameraPtr getCamera();
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
101 SceneGraphPtr getLight(int id);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
102 float* getLightVector();
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
103
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
104 /* Other System API */
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
105 void allExecute(int screen_w, int screen_h);
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
106 void oneExecute(int screen_w, int screen_h);
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
107 void checkRemove();
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
108 SceneGraphPtr getExecuteSceneGraph();
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
109 SceneGraphPtr getDrawSceneGraph();
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
110 void updateControllerState();
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
111 void regist_execute();
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
112 void move_finish();
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
113
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
114 void speExecute(int screen_w, int screen_h);
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
115 void speExecute(int screen_w, int screen_h, Application *app);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
116
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
117 /* System API */
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
118 void registSceneGraph(SceneGraphPtr sg);
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
119 void registSceneGraphList(SceneGraphPtr sg);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
120 void addSceneGraphList(TaskManager *manager, SceneGraphPtr tmp);
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
121 void addNext(SceneGraphPtr sg);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
122 void allRemove(SceneGraphPtr list);
565
5193d51294a2 linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
123
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
124 int getLast() ;
565
5193d51294a2 linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
125
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
126 };
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
127
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
128 typedef SceneGraphRoot *SceneGraphRootPtr;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
129
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
130
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
131 // 大域変数は無くすこと
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 597
diff changeset
132 //extern SceneGraphRoot *sgroot;
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 597
diff changeset
133 //extern SceneGraphRoot *sgroot_A;
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 597
diff changeset
134 //extern SceneGraphRoot *sgroot_B;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
135
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
136 #endif
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
137
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 541
diff changeset
138 /* end */