annotate Renderer/Engine/SceneGraphRoot.h @ 792:f2497e0ecd7c

add light switch
author yutaka@localhost.localdomain
date Sun, 02 May 2010 04:17:34 +0900
parents 10a8a80c2ea7
children c260205d3185
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
792
f2497e0ecd7c add light switch
yutaka@localhost.localdomain
parents: 762
diff changeset
67
f2497e0ecd7c add light switch
yutaka@localhost.localdomain
parents: 762
diff changeset
68
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
69 // SceneGraphIterator
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
70 SceneGraphIteratorPtr iterator;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
71
678
e201be3f6897 add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 656
diff changeset
72 // 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
73 int tid;
591
7cbffb81e214 send linda not work...
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents: 580
diff changeset
74
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
75 // move task test flag
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
76 int move_finish_flag;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
77
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
78 // 関数ポインタ
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
79 regist_func regist;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
80 // application で実行する task
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
81 HTaskPtr move_exec_task;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
82
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
83 // とりあえず
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
84 int screen_w;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
85 int screen_h;
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
86
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
87
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
88 /**
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
89 * Functions
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
90 */
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
91 /* User API */
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
92 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
93 void createFromXMLmemory(TaskManager *manager, SceneGraph * node, char *data, int len);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
94 SceneGraphPtr createSceneGraph(int id);
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
95 SceneGraphPtr createSceneGraph();
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
96 SceneGraphPtr createSceneGraph(const char *name);
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
97 int getSgid(const char *name);
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
98 void appTaskRegist(regist_func new_regist);
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
99
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
100 void setSceneData(SceneGraphPtr sg);
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
101 Pad *getController();
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
102 SceneGraphIteratorPtr getIterator();
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
103 SceneGraphIteratorPtr getIterator(SceneGraphPtr list);
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
104 CameraPtr getCamera();
762
10a8a80c2ea7 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 760
diff changeset
105 SceneGraphPtr getLight(int id);
678
e201be3f6897 add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 656
diff changeset
106 float* getLightVector();
792
f2497e0ecd7c add light switch
yutaka@localhost.localdomain
parents: 762
diff changeset
107 int* getLightSwitch();
f2497e0ecd7c add light switch
yutaka@localhost.localdomain
parents: 762
diff changeset
108 int getLightSysSwitch();
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
109
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
110 /* Other System API */
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
111 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
112 void oneExecute(int screen_w, int screen_h);
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
113 void checkRemove();
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
114 SceneGraphPtr getExecuteSceneGraph();
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
115 SceneGraphPtr getDrawSceneGraph();
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
116 void updateControllerState();
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
117 void regist_execute();
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 759
diff changeset
118 void move_finish();
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
119
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
120 void speExecute(int screen_w, int screen_h);
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
121 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
122
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
123 /* System API */
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
124 void registSceneGraph(SceneGraphPtr sg);
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
125 void registSceneGraphList(SceneGraphPtr sg);
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
126 void addSceneGraphList(TaskManager *manager, SceneGraphPtr tmp);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
127 void addNext(SceneGraphPtr sg);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
128 void allRemove(SceneGraphPtr list);
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
129
575
0f13810d4492 Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
130 int getLast() ;
565
2e1b6c5e4f8f linda API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
131
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
132 };
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
133
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
134 typedef SceneGraphRoot *SceneGraphRootPtr;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
135
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
136
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
137 // 大域変数は無くすこと
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
138 //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
139 //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
140 //extern SceneGraphRoot *sgroot_B;
562
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
141
a5fda4e51498 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
142 #endif
558
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
143
b05bae017029 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 509
diff changeset
144 /* end */