annotate Renderer/Engine/SceneGraphRoot.cc @ 1006:66f1d3d328a7 draft

correct code.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Tue, 26 Oct 2010 17:41:41 +0900
parents 37842bbd35f0
children a9581a9df440
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <SDL.h>
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include <SDL_image.h>
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include <libxml/parser.h>
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #include "SceneGraphRoot.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 #include "xml.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 #include "sys.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 #include "TextureHash.h"
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 #include "texture.h"
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
9 #include "Application.h"
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
1002
ceca625af064 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
11
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
12 static int cnt = 0;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
13 static const int SGLIST_LENGTH = 138;
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
14 static int sg_src_size = SGLIST_LENGTH ;
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
15 static int sg_src_id = -1;
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
16 static SceneGraphPtr *sg_src;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
17
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
18
558
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
19 SceneGraphRoot *sgroot;
00428ba0ba03 boss1_action
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 544
diff changeset
20
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 SceneGraphRoot::SceneGraphRoot(float w, float h)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 {
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
23 // SGLIST_LENGTH 決め打ちかぁ、動的生成にする場合上限決めておいた方がいいのかな
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
24 //
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
25 sg_src = (SceneGraphPtr*) malloc(sizeof(SceneGraphPtr)*SGLIST_LENGTH);
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
26
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
27 camera = new Camera(w, h, this);
779
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 738 768
diff changeset
28
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 iterator = new SceneGraphIterator;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 controller = create_controller();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 sg_exec_tree = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 sg_draw_tree = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 sg_available_list = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 sg_remove_list = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
37 sgroot = this;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
38
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
39 screen_w = (int)w;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
40 screen_h = (int)h;
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
41 int light_num = 4;
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
42 light_sysswitch = 0;
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
43
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
44 for (int i = 0; i < light_num; i++) {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
45 light[i] = new SceneGraph;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
46 light[i]->xyz[0] = 0;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
47 light[i]->xyz[1] = 0;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
48 light[i]->xyz[2] = 0;
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
49
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
50 light_switch[i] = 0;
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
51
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
52 }
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
53
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
54 move_finish_flag = 0;
677
24054155368c add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 653
diff changeset
55
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
56 gtask_array = NULL;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
57
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 // TODO
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 // 今はとりあえず camera を Root にしています
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 // 今はそれすらもしてません
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 //sg_exec_tree = camera;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
64 SceneGraphRoot::~SceneGraphRoot()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 SceneGraphPtr p = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 while (p) {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
69 SceneGraphPtr tmp = p->next;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
70 delete p;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
71 p = tmp;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
72 cnt--;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 p = sg_remove_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 while (p) {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
78 SceneGraphPtr tmp = p->next;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
79 delete p;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
80 p = tmp;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
81 cnt--;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
84 free(sg_src);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 delete camera;
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
86 int light_num = 4;
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
87 for (int i = 0; i < light_num; i++) {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
88 delete light[i];
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
89 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 delete iterator;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 delete controller;
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
92
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
93 if (gtask_array != NULL) {
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
94 delete gtask_array;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
95 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 /**
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 * xml ファイルから生成された SceneGraph を sg_src に登録する。
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 *
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 * @param sg SceneGraph created by xmlfile
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 SceneGraphRoot::registSceneGraph(SceneGraphPtr sg)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 {
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
106 int dup;
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
107 if ((dup = getSgid(sg->name))>=0) { // while...
576
9b6d0da1c12d minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 575
diff changeset
108 sg_src[dup]->name = "";
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
109 // we should remove this. but some one may use it...
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
110 }
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
111 if (sg_src_id+1> sg_src_size) {
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
112 sg_src_size *= 2;
582
4ee1d40823b8 fix realloc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 580
diff changeset
113 sg_src = (SceneGraphPtr*)realloc(sg_src, sg_src_size*sizeof(SceneGraphPtr));
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
114 }
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
115 sg->sgid = ++sg_src_id;
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
116 sg_src[sg->sgid] = sg;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118
848
a033d464c812 addChild fix
tkaito
parents: 845
diff changeset
119
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 SceneGraphRoot::addNext(SceneGraphPtr sg)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 SceneGraphPtr last = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 if (!last) {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
126 sg_available_list = sg;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 } else {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
128 while (last->next) {
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
129 last = last->next;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
130 }
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
131 last->next = sg;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
132 sg->prev = last;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
134
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 cnt++;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
137
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 /* XMLファイルからポリゴンを作成 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 SceneGraphRoot::createFromXMLfile(TaskManager *manager, const char *xmlfile)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 xmlDocPtr doc;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 xmlNodePtr cur;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 SceneGraphPtr tmp;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
145
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 /* パース DOM生成 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 doc = xmlParseFile(xmlfile);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 cur = xmlDocGetRootElement(doc);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
149
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 /* ?? */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D");
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
152
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 /* XMLのノードを一つずつ解析 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 for (cur=cur->children; cur; cur=cur->next) {
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
155 /* 扱うのはsurfaceオンリー */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
156 if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
157 continue;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
158 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
159
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
160 /* ポリゴン(SceneGraph)生成 */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
161 tmp = new SceneGraph(manager, cur);
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
162 registSceneGraph(tmp);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 xmlFreeDoc(doc);
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
165 }
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
166
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
167 void
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
168 SceneGraphRoot::createFromXMLmemory(TaskManager *manager, SceneGraph *node, char *data, int len)
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
169 {
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
170 xmlDocPtr doc;
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
171 xmlNodePtr cur;
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
172
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
173 // size は取れるはず、テスト用に mmap したデータを使う
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
174 /* パース DOM生成 */
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
175
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
176 doc = xmlParseMemory(data, len);
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
177 cur = xmlDocGetRootElement(doc);
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
178
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
179 /* ?? */
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
180 xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D");
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
181
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
182 /* XMLのノードを一つずつ解析 */
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
183 for (cur=cur->children; cur; cur=cur->next) {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
184 /* 扱うのはsurfaceオンリー */
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
185 if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) {
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
186 continue;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
187 }
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
188 /* ポリゴン(SceneGraph)生成 */
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
189 SceneGraphPtr original = new SceneGraph(manager, cur);
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
190 registSceneGraph(original);
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
191 SceneGraphPtr clone = createSceneGraph(original->sgid);
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
192 node->addChild(clone);
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
193 }
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
194 xmlFreeDoc(doc);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
196
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 SceneGraphPtr
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 SceneGraphRoot::createSceneGraph(int id)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 SceneGraphPtr src;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 SceneGraphPtr p;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
202
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
203 if (id < 0 || id > sg_src_size) {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
204 printf("error: createSceneGraph(int id): id not found.\n");
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
205 return NULL;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 /* オリジナルの SceneGraph */
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
209 src = sg_src[id];
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
210
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 /* ユーザーにはオリジナルの clone を返す */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 p = src->clone();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213
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
214 /* move, collision に sgroot を渡したいのでここで 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
215 p->sgroot = (void *)this;
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
216
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 addNext(p);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
218
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 return p;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
221
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
222
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
223
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
224
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
225 SceneGraphPtr
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
226 SceneGraphRoot::createSceneGraph(const char *name)
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
227 {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
228 SceneGraphPtr src;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
229 SceneGraphPtr p;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
230
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
231 int id = getSgid(name);
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
232 if (id < 0) {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
233 printf("error: createSceneGraph(name): name object not found.\n");
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
234 return NULL;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
235 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
236
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
237 /* オリジナルの SceneGraph */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
238 src = sg_src[id];
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
239
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
240 /* ユーザーにはオリジナルの clone を返す */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
241 p = src->clone();
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
242
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
243 /* move, collision に sgroot を渡したいのでここで 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
244 p->sgroot = (void *)this;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
245
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
246 addNext(p);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
247
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
248 return p;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
249 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
250
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
251 int
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
252 SceneGraphRoot::getSgid(const char *name)
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
253 {
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
254 for(int i =0;i<= sg_src_id; i++) {
576
9b6d0da1c12d minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 575
diff changeset
255 if (sg_src[i] && strcmp(name,sg_src[i]->name) == 0)
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
256 return i;
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
257 }
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
258 return -1;
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
259 }
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
260
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
261 int
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
262 SceneGraphRoot::getLast()
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
263 {
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
264 if (sg_src_id>=0)
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
265 return sg_src[sg_src_id]->sgid;
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
266 return -1;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
267 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
268
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 /**
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 * 何も表示しない、move,collision もしない SceneGraph を生成
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 * いずれ、Transform3D 的なものに回す予定
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 SceneGraphPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
274 SceneGraphRoot::createSceneGraph()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 SceneGraphPtr p = new SceneGraph;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
277
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
278 /* move, collision に sgroot を渡したいのでここで 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
279 p->sgroot = (void *)this;
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
280
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 addNext(p);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 p->flag_drawable = 0;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
283
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 return p;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
286
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 SceneGraphRoot::speExecute(int screen_w, int screen_h)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
290
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 SceneGraphPtr list = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
292 // SceneGraphPtr t = sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
293 // SceneGraphPtr cur_parent = camera;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
294
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 // 前フレームで描画した SceneGraph は削除
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 allRemove(sg_remove_list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
297
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 // 前フレームに作られた SceneGraph は描画用に移行
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 // 現フレームでの操作は以下の tree,list には適用されない
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 sg_draw_tree = sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 sg_remove_list = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
302
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 // 現フレームで新しく SceneGraph がコピーされるので初期化
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 sg_exec_tree = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 sg_available_list = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
306
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
307 camera->move_execute(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 camera->update(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
309
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 camera->children = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 camera->lastChild = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
312
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
313 list->move_execute(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 list->collision_check(screen_w, screen_h, list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
315
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 list->frame++;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 list = list->next;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
318
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 if(sg_exec_tree != NULL) {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
320 return;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
322
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
323 /*removeのflagをもとにtreeを形成*/
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
324 /* spe から送り返されてきた property の配列を見て生成する for()*/
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 /*
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
326 for (Property *t = (Property*)app->property[0]; is_end(t); t++){
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
327 SceneGraphPtr s = app->scenegraph_factory(t); // SceneGraphNode を作る
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
328 t->scenegraph = s; // property list には SceneGraphへのポインタが入っている
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
329 app->scenegraph_connector(property[0], s); // add する
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
330 }
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
331 */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
332
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
333
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
334 // 現在、allExecute が終わった時点では
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
335 // camera->children が User SceneGraph の root になる
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
336
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
337 /**
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
338 * NULL じゃなかったら、setSceneData が呼ばれてるから
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
339 * そっちを次の Scene にする
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
340 */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
341
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
342 sg_exec_tree = camera->children;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
343 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
344
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
345
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
346
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
347 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 SceneGraphRoot::allExecute(int screen_w, int screen_h)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
349 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 SceneGraphPtr list = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
351 SceneGraphPtr t = sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
352 SceneGraphPtr cur_parent = camera;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
353
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
354 // 前フレームで描画した SceneGraph は削除
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
355 allRemove(sg_remove_list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
356
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
357 // 前フレームに作られた SceneGraph は描画用に移行
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
358 // 現フレームでの操作は以下の tree,list には適用されない
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
359 sg_draw_tree = sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
360 sg_remove_list = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
361
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
362 // 現フレームで新しく SceneGraph がコピーされるので初期化
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 sg_exec_tree = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
364 sg_available_list = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
365
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
366 camera->move_execute(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 camera->update(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
368
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 camera->children = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 camera->lastChild = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
371
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 /*まずは全部動作させる*/
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 while (list) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
374
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 list->move_execute(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 list->collision_check(screen_w, screen_h, list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
377
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
378 list->frame++;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
379 list = list->next;
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
380 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
381
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
382 int light_num = 4;
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
383 for (int i = 0; i < light_num; i++) {
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
384
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
385 get_matrix(light[i]->matrix, light[i]->angle, light[i]->xyz, camera->matrix);
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
386
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
387 light_vector[i*4] = 0.0f;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
388 light_vector[i*4+1] = 0.0f;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
389 light_vector[i*4+2] = 0.0f;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
390 light_vector[i*4+3] = 1.0f;
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
391
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
392 ApplyMatrix(&light_vector[i*4], light[i]->matrix);
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
393
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
394 light_vector[i*4] /= light_vector[i*4+2];
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
395 light_vector[i*4+1] /= light_vector[i*4+2];
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
396
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
397 /*SIMD演算のため*/
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
398 light_vector[i*4+2] *= -1;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
399 light_vector[i*4+3] *= -1;
764
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 763
diff changeset
400
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
401 }
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
402
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
403
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
404 if(sg_exec_tree != NULL) {
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
405 return;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
407
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 /*removeのflagをもとにtreeを形成*/
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 while (t) {
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
410 SceneGraphPtr c = NULL;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
411 if (!t->isRemoved()) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
412 c = t->clone();
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
413 addNext(c);
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
414 cur_parent->addChild(c);
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
415 c->frame = t->frame;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
416 /*親の回転、座標から、子の回転、座標を算出*/
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
417 get_matrix(c->matrix, c->angle, c->xyz, cur_parent->matrix);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
418 /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
419 get_matrix(c->real_matrix, c->angle, c->xyz, cur_parent->real_matrix);
845
71afabd4ba5c light bug fix.
Yutaka_Kinjyo
parents: 793
diff changeset
420 //get_matrix(c->real_matrix, c->angle, c->xyz, camera->real_matrix);
908
Yutaka_Kinjyo
parents: 884
diff changeset
421
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
422 }
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
423
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
424 if (t->children != NULL && c != NULL) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
425 cur_parent = c;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
426 t = t->children;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
427 } else if (t->brother != NULL) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
428 t = t->brother;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
429 } else {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
430 while (t) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
431 if (t->brother != NULL) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
432 t = t->brother;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
433 break;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 } else {
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
435 if (t->parent == NULL) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
436 t = NULL;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
437 break;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
438 } else {
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
439 cur_parent = cur_parent->parent;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 t = t->parent;
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
441 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
442 }
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
443 }
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
444 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
446
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
447
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
448
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
449 // 現在、allExecute が終わった時点では
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
450 // camera->children が User SceneGraph の root になる
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
451
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
452 /**
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
453 * NULL じゃなかったら、setSceneData が呼ばれてるから
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 * そっちを次の Scene にする
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
455 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
456
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
457 sg_exec_tree = camera->children;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
458 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
459
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
460 void
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
461 SceneGraphRoot::oneExecute(int screen_w, int screen_h)
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
462 {
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
463 SceneGraphPtr list = sg_available_list;
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
464 //SceneGraphPtr t = sg_exec_tree;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
465 //SceneGraphPtr cur_parent = camera;
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
466
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
467 // 前フレームで描画した SceneGraph は削除
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
468 allRemove(sg_remove_list);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
469
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
470 // 前フレームに作られた SceneGraph は描画用に移行
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
471 // 現フレームでの操作は以下の tree,list には適用されない
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
472 sg_draw_tree = sg_exec_tree;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
473 sg_remove_list = sg_available_list;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
474
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
475 // 現フレームで新しく SceneGraph がコピーされるので初期化
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
476 sg_exec_tree = NULL;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
477 sg_available_list = NULL;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
478
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
479 camera->move_execute(screen_w, screen_h);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
480 camera->update(screen_w, screen_h);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
481
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
482 camera->children = NULL;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
483 camera->lastChild = NULL;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
484
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
485 /* ここから */
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
486 list->move_execute(screen_w, screen_h);
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
487 // ここで move_execute から実行される move_task の処理が終わるまで待ちたい
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
488 //while(move_finish_flag == 0) {}
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
489 //move_finish_flag = 0;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
490
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
491 list->create_sg_execute();
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
492
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
493 list->collision_check(screen_w, screen_h, list);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
494 /* ここまで exec_task にする */
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
495
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
496
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
497 /* ここから下を exec_task の post_func に*/
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
498 list->frame++;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
499 list = list->next;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
500
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
501
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
502 int light_num = 4;
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
503 for (int i = 0; i < light_num; i++) {
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
504
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
505 get_matrix(light[i]->matrix, light[i]->angle, light[i]->xyz, camera->matrix);
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
506
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
507 light_vector[i*4] = 0.0f;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
508 light_vector[i*4+1] = 0.0f;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
509 light_vector[i*4+2] = 0.0f;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
510 light_vector[i*4+3] = 1.0f;
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
511
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
512 ApplyMatrix(&light_vector[i*4], light[i]->matrix);
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
513
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
514 light_vector[i*4] /= light_vector[i*4+2];
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
515 light_vector[i*4+1] /= light_vector[i*4+2];
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
516
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
517 }
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
518
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
519 if(sg_exec_tree != NULL) {
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
520 return;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
521 }
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
522 }
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
523
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
524 /*
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
525 ExecMove task の post func として呼んでやる
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
526 */
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
527 void
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
528 SceneGraphRoot::move_finish()
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
529 {
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
530 list->collision_check(screen_w, screen_h, list);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
531
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
532 list->frame++;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
533 //list = list->next;
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
534
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
535 int light_num = 4;
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
536 for (int i = 0; i < light_num; i++) {
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
537
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
538 get_matrix(light[i]->matrix, light[i]->angle, light[i]->xyz, camera->matrix);
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
539
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
540 light_vector[i*4] = 0.0f;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
541 light_vector[i*4+1] = 0.0f;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
542 light_vector[i*4+2] = 0.0f;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
543 light_vector[i*4+3] = 1.0f;
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
544
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
545 ApplyMatrix(&light_vector[i*4], light[i]->matrix);
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
546
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
547 light_vector[i*4] /= light_vector[i*4+2];
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
548 light_vector[i*4+1] /= light_vector[i*4+2];
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
549
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
550 light_vector[i*4+2] *= -1;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
551 light_vector[i*4+3] *= -1;
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
552 }
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
553
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
554 //sgchange->viewer->light_xyz_stock = getLightVector();
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
555 }
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
556
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
557
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
558 void
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
559 SceneGraphRoot::appTaskRegist(regist_func new_register)
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
560 {
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
561 this->regist = new_register;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
562 }
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
563
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
564 void
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
565 SceneGraphRoot::regist_execute()
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
566 {
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
567 (*regist)(this);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
568 }
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
569
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
570 void
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
571 SceneGraphRoot::allRemove(SceneGraphPtr list)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
572 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
573 SceneGraphPtr p = list;
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
574
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
575 while (p) {
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
576 SceneGraphPtr p1 = p->next;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
577 delete p;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
578 p = p1;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
579 cnt--;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
580 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
581 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
582
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
583 void
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
584 SceneGraphRoot::checkRemove()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
586 SceneGraphPtr p = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
587 SceneGraphPtr p1;
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
588
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
589 while (p) {
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
590 p1 = p->next;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
591 if (p->isRemoved()) {
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
592 sg_exec_tree = p->realRemoveFromTree(sg_exec_tree);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
593 sg_available_list = p->realRemoveFromList(sg_available_list);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
594 }
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
595 delete p;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
596 p = p1;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
599
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 SceneGraphPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
601 SceneGraphRoot::getExecuteSceneGraph()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
602 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
603 return sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
604 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
605
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
606 SceneGraphPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
607 SceneGraphRoot::getDrawSceneGraph()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
608 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
609 return sg_draw_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
611
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
612 void
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
613 SceneGraphRoot::updateControllerState()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
615 controller->check();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
616 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
617
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
618 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
619 SceneGraphRoot::setSceneData(SceneGraphPtr sg)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
620 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 sg_exec_tree = sg;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
622 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
623
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
624 Pad*
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
625 SceneGraphRoot::getController()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
627 return controller;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
629
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
630 SceneGraphIteratorPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
631 SceneGraphRoot::getIterator()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
632 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
633 iterator->set(sg_remove_list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
634 return iterator;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
635 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
636
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
637 SceneGraphIteratorPtr
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 SceneGraphRoot::getIterator(SceneGraphPtr list)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
639 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
640 iterator->set(list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
641 return iterator;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
642 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
643
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
644 CameraPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
645 SceneGraphRoot::getCamera()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
646 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
647 return camera;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
648 }
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
649
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
650
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
651 SceneGraphPtr
761
c0a8af52fa43 add lights
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
652 SceneGraphRoot::getLight(int id)
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
653 {
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
654
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
655 return light[id];
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
656
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
657 }
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
658
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
659
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
660 float*
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
661 SceneGraphRoot::getLightVector()
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
662 {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
663 return light_vector;
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
664 }
779
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 738 768
diff changeset
665
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
666 int*
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
667 SceneGraphRoot::getLightSwitch()
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
668 {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
669 return light_switch;
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
670 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
671
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
672 int
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
673 SceneGraphRoot::getLightSysSwitch()
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
674 {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
675 return light_sysswitch;
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
676 }
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 779
diff changeset
677
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
678 void
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
679 SceneGraphRoot::OnLightSwitch(int id)
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
680 {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
681 light_switch[id] = 1;
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
682 }
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
683
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
684 void
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
685 SceneGraphRoot::OffLightSwitch(int id)
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
686 {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
687 light_switch[id] = 0;
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
688 }
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
689
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
690 void
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
691 SceneGraphRoot::OnLightSysSwitch()
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
692 {
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
693
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
694 light_sysswitch = 1;
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
695
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
696 }
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
697
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
698 void
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
699 SceneGraphRoot::OffLightSysSwitch()
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
700 {
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
701
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
702 light_sysswitch = 0;
793
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
703
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
704 }
66497087393d add light switch api
yutaka@localhost.localdomain
parents: 792
diff changeset
705
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
706 void
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
707 SceneGraphRoot::task_array_init(int id, int task_num, int param, int inData_num, int outData_num)
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
708 {
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
709 gtask_array = new GTaskArray;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
710 gtask_array->init(id, task_num, param, inData_num, outData_num);
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
711 }
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
712
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
713 void
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
714 SceneGraphRoot::create_task_array()
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
715 {
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
716 gtask_array->create_task_array(this->tmanager);
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
717 }
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
718
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
719 void
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
720 SceneGraphRoot::task_array_finish()
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
721 {
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
722 gtask_array->finish();
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
723 }
869
a215927a9885 set_game_task add to SceneGraphRoot.
tkaito
parents: 851
diff changeset
724
a215927a9885 set_game_task add to SceneGraphRoot.
tkaito
parents: 851
diff changeset
725 void
a215927a9885 set_game_task add to SceneGraphRoot.
tkaito
parents: 851
diff changeset
726 SceneGraphRoot::set_game_task(int id, void *property, int size, PostFunction post_func)
1002
ceca625af064 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
727 {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
728 gtask_array->next_task_array(id);
1002
ceca625af064 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
729
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
730 gtask_array->game_task->set_inData(0, property, size);
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
731 gtask_array->game_task->set_outData(0, property, size);
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
732
969
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
733 }
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
734
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
735 void
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
736 SceneGraphRoot::set_game_task(int id, void *property, void *pad, int size, PostFunction post_func)
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
737 {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
738 gtask_array->next_task_array(id);
1002
ceca625af064 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
739
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
740 gtask_array->game_task->set_inData(0, property, size);
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
741 gtask_array->game_task->set_inData(1, pad, sizeof(Pad));
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
742 gtask_array->game_task->set_outData(0, property, size);
1002
ceca625af064 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
743
869
a215927a9885 set_game_task add to SceneGraphRoot.
tkaito
parents: 851
diff changeset
744 }
a215927a9885 set_game_task add to SceneGraphRoot.
tkaito
parents: 851
diff changeset
745
884
efefbff1fd45 obj_move fix
tkaito
parents: 882
diff changeset
746 void
882
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
747 main_task_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
748 {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
749 int size = node->property_size;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
750 void *e = node->propertyptr;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
751 int move = node->move_id;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
752 PostFunction post_func = node->post_func;
1006
66f1d3d328a7 correct code.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1003
diff changeset
753 /*
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
754 ObjPropertyPtr property = (ObjPropertyPtr)node->propertyptr;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
755 property->root = node;
1006
66f1d3d328a7 correct code.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1003
diff changeset
756 */
969
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
757
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
758 SceneGraphRoot *sgroottmp = (SceneGraphRoot*)sgroot_;
1002
ceca625af064 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
759
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
760 sgroottmp->set_game_task(move, (void*)e, size, post_func);
882
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
761 }
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
762
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
763 void
969
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
764 pad_task_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
765 {
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
766 int size = node->property_size;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
767 void *e = node->propertyptr;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
768 int move = node->move_id;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
769 PostFunction post_func = node->post_func;
1006
66f1d3d328a7 correct code.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1003
diff changeset
770 /*
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
771 ObjPropertyPtr property = (ObjPropertyPtr)node->propertyptr;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
772 property->root = node;
1006
66f1d3d328a7 correct code.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1003
diff changeset
773 */
969
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
774
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
775 SceneGraphRoot *sgroottmp = (SceneGraphRoot*)sgroot_;
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
776 void *pad = (void*)sgroottmp->getController();
969
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
777
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
778 sgroottmp->set_game_task(move, (void*)e, pad, size, post_func);
969
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
779 }
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
780
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
781 void
1002
ceca625af064 many changes.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 969
diff changeset
782 SceneGraphRoot::set_move_task(SceneGraphPtr node, int move, void *property, int size,
882
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
783 PostFunction post_func)
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
784 {
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
785 node->move = main_task_move;
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
786 node->post_func = post_func;
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
787 node->move_id = move;
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
788 node->propertyptr = property;
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
789 node->property_size = size;
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 870
diff changeset
790 }
869
a215927a9885 set_game_task add to SceneGraphRoot.
tkaito
parents: 851
diff changeset
791
969
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
792 void
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
793 SceneGraphRoot::set_pad_task(SceneGraphPtr node, int move, void *property, int size,
1003
37842bbd35f0 game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 1002
diff changeset
794 PostFunction post_func)
969
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
795 {
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
796 node->move = pad_task_move;
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
797 node->post_func = post_func;
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
798 node->move_id = move;
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
799 node->propertyptr = property;
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
800 node->property_size = size;
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
801 }
52c4353308e7 add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 913
diff changeset
802
779
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 738 768
diff changeset
803 /* end */