annotate Renderer/Engine/SceneGraphRoot.h @ 1002:c79651141045

many changes.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Sun, 24 Oct 2010 19:00:47 +0900
parents 9a53faae88d8
children 295b3c79fb44
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
1 #ifndef INCLUDED_SCENE_GRAPH_ROOT
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2 #define INCLUDED_SCENE_GRAPH_ROOT
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
4 #include "SceneGraph.h"
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
5 #include "SceneGraphArray.h"
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
6 #include "Camera.h"
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
7 #include "SceneGraphIterator.h"
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
8 #include <sys/types.h>
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
9
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
10 typedef struct {
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
11 caddr_t file_mmap;
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
12 off_t size;
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
13 } st_mmap_t;
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
14
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
15 class Application;
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
16
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
17 class SceneGraphRoot;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
18 typedef void (*regist_func)(SceneGraphRoot *sgroot);
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
19
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 class SceneGraphRoot {
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
21 public:
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
22 /* Constructor, Destructor */
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
23 SceneGraphRoot(float w, float h);
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
24 ~SceneGraphRoot();
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
25
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
26 /* Variables */
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
27 TaskManager *tmanager;
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
28
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
29 // xml から読み込んだ、オリジナルの SceneGraph
575
0f13810d4492 Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
30 // Static Singleton
0f13810d4492 Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
31 // SceneGraphPtr *sg_src;
0f13810d4492 Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
32 // int sg_src_length;
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
33 SceneGraphPtr list;
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
34
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
35 // move, collision 用の SceneGraph (tree)
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
36 SceneGraphPtr sg_exec_tree;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
37
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
38 // 描画用の SceneGraph List (tree)
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
39 SceneGraphPtr sg_draw_tree;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
40
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
41 // sg_exec_tree に対応する list
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
42 SceneGraphPtr sg_available_list;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
43
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
44 // sg_draw_tree に対応する list
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
45 // draw_tree は描画後削除される
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
46 SceneGraphPtr sg_remove_list;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
47
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
48 SceneGraphArrayPtr sg_array1;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
49 SceneGraphArrayPtr sg_array2;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
50 SceneGraphArrayPtr sg_curArray;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
51
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
52 // コントローラーオブジェクト (Keyboard, Joystick, ..)
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
53 Pad *controller;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
54
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
55 // カメラオブジェクト
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
56 Camera *camera;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
57
597
5c5cd31b9d43 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 591
diff changeset
58 // 光源のオブジェクト
762
10a8a80c2ea7 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 760
diff changeset
59 SceneGraphPtr light[4];
792
f2497e0ecd7c add light switch
yutaka@localhost.localdomain
parents: 762
diff changeset
60 int light_switch[4];
f2497e0ecd7c add light switch
yutaka@localhost.localdomain
parents: 762
diff changeset
61 int light_sysswitch;
678
e201be3f6897 add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 656
diff changeset
62 // 光源の疑似 xml file
762
10a8a80c2ea7 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 760
diff changeset
63 // 光源は4つで決め打ち。
10a8a80c2ea7 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 760
diff changeset
64 // 4 * lightnum (4) = 16;
10a8a80c2ea7 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 760
diff changeset
65 float light_vector[16];
597
5c5cd31b9d43 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 591
diff changeset
66
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
67 // SceneGraphIterator
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
68 SceneGraphIteratorPtr iterator;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
69
678
e201be3f6897 add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 656
diff changeset
70 // fd of Linda taple space
e201be3f6897 add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 656
diff changeset
71 int tid;
591
7cbffb81e214 send linda not work...
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents: 580
diff changeset
72
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
73 // move task test flag
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
74 int move_finish_flag;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
75
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
76 // 関数ポインタ
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
77 regist_func regist;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
78 // application で実行する task
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
79 HTaskPtr move_exec_task;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
80
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
81 // とりあえず
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
82 int screen_w;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
83 int screen_h;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
84
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
85
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
86 /**
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
87 * Functions
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
88 */
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
89 /* User API */
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
90 void createFromXMLfile(TaskManager *manager, const char *);
580
da82a47ece92 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 575
diff changeset
91 void createFromXMLmemory(TaskManager *manager, SceneGraph * node, char *data, int len);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
92 SceneGraphPtr createSceneGraph(int id);
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
93 SceneGraphPtr createSceneGraph();
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
94 SceneGraphPtr createSceneGraph(const char *name);
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
95 int getSgid(const char *name);
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
96 void appTaskRegist(regist_func new_regist);
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
97
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
98 void setSceneData(SceneGraphPtr sg);
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
99 Pad *getController();
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
100 SceneGraphIteratorPtr getIterator();
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
101 SceneGraphIteratorPtr getIterator(SceneGraphPtr list);
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
102 CameraPtr getCamera();
762
10a8a80c2ea7 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 760
diff changeset
103 SceneGraphPtr getLight(int id);
793
c260205d3185 add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
104 void OnLightSwitch(int id);
c260205d3185 add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
105 void OffLightSwitch(int id);
c260205d3185 add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
106 void OnLightSysSwitch();
c260205d3185 add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
107 void OffLightSysSwitch();
969
9a53faae88d8 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 882
diff changeset
108
9a53faae88d8 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 882
diff changeset
109 /* GameTask 生成用 */
1002
c79651141045 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
110 HTaskPtr game_task_array;
c79651141045 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
111 TaskPtr game_task;
c79651141045 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
112 void task_array_init(int id, int task_num, int param, int inData_num, int outData_num);
c79651141045 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
113 void task_array_finish();
869
bcc81531a672 set_game_task add to SceneGraphRoot.
tkaito
parents: 848
diff changeset
114 void set_game_task(int id, void *property, int size, PostFunction post_func);
969
9a53faae88d8 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 882
diff changeset
115 void set_game_task(int id, void *property, void* pad, int size, PostFunction post_func);
882
f525427ae30f SceneGraphRoot::set_move_task add.
tkaito
parents: 869
diff changeset
116 void set_move_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func);
969
9a53faae88d8 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 882
diff changeset
117 void set_pad_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
118
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
119 /* Other System API */
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
120 void allExecute(int screen_w, int screen_h);
759
bb47827c04c1 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 678
diff changeset
121 void oneExecute(int screen_w, int screen_h);
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
122 void checkRemove();
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
123 SceneGraphPtr getExecuteSceneGraph();
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
124 SceneGraphPtr getDrawSceneGraph();
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
125 void updateControllerState();
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
126 void regist_execute();
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
127 void move_finish();
793
c260205d3185 add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
128 float* getLightVector();
c260205d3185 add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
129 int* getLightSwitch();
c260205d3185 add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
130 int getLightSysSwitch();
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
131
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
132 void speExecute(int screen_w, int screen_h);
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
133 void speExecute(int screen_w, int screen_h, Application *app);
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
134
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
135 /* System API */
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
136 void registSceneGraph(SceneGraphPtr sg);
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
137 void registSceneGraphList(SceneGraphPtr sg);
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
138 void addSceneGraphList(TaskManager *manager, SceneGraphPtr tmp);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
139 void addNext(SceneGraphPtr sg);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
140 void allRemove(SceneGraphPtr list);
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
141
575
0f13810d4492 Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
142 int getLast() ;
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
143
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
144 };
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
145
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
146 typedef SceneGraphRoot *SceneGraphRootPtr;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
147
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
148
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
149 // 大域変数は無くすこと
656
d0b8860c17f8 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
150 //extern SceneGraphRoot *sgroot;
d0b8860c17f8 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
151 //extern SceneGraphRoot *sgroot_A;
d0b8860c17f8 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
152 //extern SceneGraphRoot *sgroot_B;
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
153
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
154 #endif
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
155
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
156 /* end */