annotate Renderer/Engine/SceneGraphRoot.cc @ 759:45f7ab7101ea draft

first of all commit, not work Rendering/Test/create_task
author hiroki
date Thu, 04 Feb 2010 14:46:09 +0900
parents 77f936380930
children c0a8af52fa43
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 "SGList.h"
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
10 #include "Application.h"
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
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);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
28 light = new SceneGraph;
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;
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
41 //int size = 4;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
42 //light_vector = (float*)malloc(sizeof(float)*size);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
43
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
44 light->xyz[0] = 0;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
45 light->xyz[1] = 0;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
46 light->xyz[2] = 0;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
47
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
48 move_finish_flag = 0;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 // TODO
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 // 今はとりあえず camera を Root にしています
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 // 今はそれすらもしてません
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 //sg_exec_tree = camera;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
55 SceneGraphRoot::~SceneGraphRoot()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 SceneGraphPtr p = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 while (p) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 SceneGraphPtr tmp = p->next;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 delete p;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 p = tmp;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 cnt--;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 }
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 p = sg_remove_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) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 SceneGraphPtr tmp = p->next;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 delete p;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 p = tmp;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 cnt--;
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
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
75 free(sg_src);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 delete camera;
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
77 delete light;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 delete iterator;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 delete controller;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81
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 * xml ファイルから生成された SceneGraph を sg_src に登録する。
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 *
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 * @param sg SceneGraph created by xmlfile
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 SceneGraphRoot::registSceneGraph(SceneGraphPtr sg)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 {
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
90 int dup;
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
91 if ((dup = getSgid(sg->name))>=0) { // while...
576
9b6d0da1c12d minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 575
diff changeset
92 sg_src[dup]->name = "";
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
93 // 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
94 }
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
95 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
96 sg_src_size *= 2;
582
4ee1d40823b8 fix realloc
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 580
diff changeset
97 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
98 }
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
99 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
100 sg_src[sg->sgid] = sg;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 }
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::addNext(SceneGraphPtr sg)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 SceneGraphPtr last = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 if (!last) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 sg_available_list = sg;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 } else {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 while (last->next) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 last = last->next;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 last->next = sg;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 sg->prev = last;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 }
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 cnt++;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 /* XMLファイルからポリゴンを作成 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 SceneGraphRoot::createFromXMLfile(TaskManager *manager, const char *xmlfile)
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 xmlDocPtr doc;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 xmlNodePtr cur;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 SceneGraphPtr tmp;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
128
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 /* パース DOM生成 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 doc = xmlParseFile(xmlfile);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 cur = xmlDocGetRootElement(doc);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
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 xmlStrcmp(cur->name,(xmlChar*)"OBJECT-3D");
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 /* XMLのノードを一つずつ解析 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 for (cur=cur->children; cur; cur=cur->next) {
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
138 /* 扱うのはsurfaceオンリー */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
139 if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
140 continue;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
141 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
143 /* ポリゴン(SceneGraph)生成 */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
144 tmp = new SceneGraph(manager, cur);
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
145 registSceneGraph(tmp);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 xmlFreeDoc(doc);
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
148 }
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
149
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
150 void
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
151 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
152 {
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
153 xmlDocPtr doc;
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
154 xmlNodePtr cur;
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
155
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
156 // size は取れるはず、テスト用に mmap したデータを使う
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
157 /* パース DOM生成 */
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
158
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
159 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
160 cur = xmlDocGetRootElement(doc);
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
161
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
162 /* ?? */
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
163 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
164
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
165 /* XMLのノードを一つずつ解析 */
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
166 for (cur=cur->children; cur; cur=cur->next) {
586
7e33deb9d3f4 dynamic not work
kazz@kazz187.st.ie.u-ryukyu.ac.jp
parents: 582
diff changeset
167 /* 扱うのはsurfaceオンリー */
7e33deb9d3f4 dynamic not work
kazz@kazz187.st.ie.u-ryukyu.ac.jp
parents: 582
diff changeset
168 if (xmlStrcmp(cur->name,(xmlChar*)"surface") != 0) {
7e33deb9d3f4 dynamic not work
kazz@kazz187.st.ie.u-ryukyu.ac.jp
parents: 582
diff changeset
169 continue;
7e33deb9d3f4 dynamic not work
kazz@kazz187.st.ie.u-ryukyu.ac.jp
parents: 582
diff changeset
170 }
7e33deb9d3f4 dynamic not work
kazz@kazz187.st.ie.u-ryukyu.ac.jp
parents: 582
diff changeset
171 /* ポリゴン(SceneGraph)生成 */
7e33deb9d3f4 dynamic not work
kazz@kazz187.st.ie.u-ryukyu.ac.jp
parents: 582
diff changeset
172 SceneGraphPtr original = new SceneGraph(manager, cur);
7e33deb9d3f4 dynamic not work
kazz@kazz187.st.ie.u-ryukyu.ac.jp
parents: 582
diff changeset
173 registSceneGraph(original);
7e33deb9d3f4 dynamic not work
kazz@kazz187.st.ie.u-ryukyu.ac.jp
parents: 582
diff changeset
174 SceneGraphPtr clone = createSceneGraph(original->sgid);
7e33deb9d3f4 dynamic not work
kazz@kazz187.st.ie.u-ryukyu.ac.jp
parents: 582
diff changeset
175 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
176 }
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
177 xmlFreeDoc(doc);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
179
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 SceneGraphPtr
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 SceneGraphRoot::createSceneGraph(int id)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 SceneGraphPtr src;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 SceneGraphPtr p;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
186 if (id < 0 || id > sg_src_size) {
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 return NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
189
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 /* オリジナルの SceneGraph */
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
191 src = sg_src[id];
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
192
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 /* ユーザーにはオリジナルの clone を返す */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 p = src->clone();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
195
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
196 /* 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
197 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
198
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 addNext(p);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 return p;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
203
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
204
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
205
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
206
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
207 SceneGraphPtr
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
208 SceneGraphRoot::createSceneGraph(const char *name)
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
209 {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
210 SceneGraphPtr src;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
211 SceneGraphPtr p;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
212
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
213 int id = getSgid(name);
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
214 if (id < 0) {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
215 return NULL;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
216 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
217
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
218 /* オリジナルの SceneGraph */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
219 src = sg_src[id];
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
220
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
221 /* ユーザーにはオリジナルの clone を返す */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
222 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
223
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
224 /* 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
225 p->sgroot = (void *)this;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
226
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
227 addNext(p);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
228
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
229 return p;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
230 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
231
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
232 int
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
233 SceneGraphRoot::getSgid(const char *name)
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
234 {
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
235 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
236 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
237 return i;
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
238 }
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
239 return -1;
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
240 }
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
241
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
242 int
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
243 SceneGraphRoot::getLast()
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
244 {
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 565
diff changeset
245 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
246 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
247 return -1;
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
248 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
249
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 /**
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 * 何も表示しない、move,collision もしない SceneGraph を生成
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 * いずれ、Transform3D 的なものに回す予定
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 SceneGraphPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
255 SceneGraphRoot::createSceneGraph()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 SceneGraphPtr p = new SceneGraph;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
258
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
259 /* 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
260 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
261
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 addNext(p);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 p->flag_drawable = 0;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
264
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 return p;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
267
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 SceneGraphRoot::speExecute(int screen_w, int screen_h)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
271
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 SceneGraphPtr list = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 // SceneGraphPtr t = sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 // SceneGraphPtr cur_parent = camera;
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 // 前フレームで描画した SceneGraph は削除
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 allRemove(sg_remove_list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
278
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 // 前フレームに作られた SceneGraph は描画用に移行
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 // 現フレームでの操作は以下の tree,list には適用されない
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 sg_draw_tree = sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 sg_remove_list = sg_available_list;
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 // 現フレームで新しく SceneGraph がコピーされるので初期化
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 sg_exec_tree = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 sg_available_list = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
287
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 camera->move_execute(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 camera->update(screen_w, screen_h);
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 camera->children = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
292 camera->lastChild = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
293
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 list->move_execute(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
295 list->collision_check(screen_w, screen_h, list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
296
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 list->frame++;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 list = list->next;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
299
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 if(sg_exec_tree != NULL) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 return;
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
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 /*removeのflagをもとにtreeを形成*/
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
305 /* spe から送り返されてきた property の配列を見て生成する for()*/
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 /*
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
307 for (Property *t = (Property*)app->property[0]; is_end(t); t++){
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
308 SceneGraphPtr s = app->scenegraph_factory(t); // SceneGraphNode を作る
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
309 t->scenegraph = s; // property list には SceneGraphへのポインタが入っている
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
310 app->scenegraph_connector(property[0], s); // add する
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
311 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
312 */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
313
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
314
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
315 // 現在、allExecute が終わった時点では
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
316 // camera->children が User SceneGraph の root になる
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
317
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
318 /**
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
319 * NULL じゃなかったら、setSceneData が呼ばれてるから
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
320 * そっちを次の Scene にする
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
321 */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
322
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
323 sg_exec_tree = camera->children;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
324 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
325
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
326 void
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
327 SceneGraphRoot::speExecute(int screen_w, int screen_h, Application *app)
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
328 {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
329 // SceneGraphPtr t = sg_exec_tree;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
330 // SceneGraphPtr cur_parent = camera;
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 // 前フレームで描画した SceneGraph は削除
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
333 allRemove(sg_remove_list);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
334
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
335 // 前フレームに作られた SceneGraph は描画用に移行
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
336 // 現フレームでの操作は以下の tree,list には適用されない
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
337 sg_draw_tree = sg_exec_tree;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
338 sg_remove_list = sg_available_list;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
339
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
340 // 現フレームで新しく SceneGraph がコピーされるので初期化
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
341 sg_exec_tree = NULL;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
342 sg_available_list = NULL;
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 camera->move_execute(screen_w, screen_h);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
345 camera->update(screen_w, screen_h);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
346
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
347 camera->children = NULL;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
348 camera->lastChild = NULL;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
349
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
350
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
351 if(sg_exec_tree != NULL) {
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
352 return;
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
353 }
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
354
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
355 /*removeのflagをもとにtreeを形成*/
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
356 /* spe から送り返されてきた property の配列を見て生成する for()*/
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
357 /* Application内に移動 */
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
358
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
359 // app->property_ope(sg_available_list);
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
360
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
361 /*
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
362 for (Property *t = (Property *)properties[0]; is_end(t); t++){
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
363 SceneGraphPtr s = app->scenegraph_factory(t); // SceneGraphNode を作る
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
364 t->scenegraph = s; // property list には SceneGraphへのポインタが入っている
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
365 app->scenegraph_connector(property[0], s); // add する
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
366 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
367 */
562
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
368
d65f21b18165 name search
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 558
diff changeset
369
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
370
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
371 // 現在、allExecute が終わった時点では
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 // camera->children が User SceneGraph の root になる
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
373
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 * NULL じゃなかったら、setSceneData が呼ばれてるから
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
376 * そっちを次の Scene にする
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
378
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
379 sg_exec_tree = camera->children;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
381
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
382
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
383 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 SceneGraphRoot::allExecute(int screen_w, int screen_h)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
385 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
386 SceneGraphPtr list = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
387 SceneGraphPtr t = sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
388 SceneGraphPtr cur_parent = camera;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
389
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
390 // 前フレームで描画した SceneGraph は削除
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
391 allRemove(sg_remove_list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
392
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
393 // 前フレームに作られた SceneGraph は描画用に移行
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 // 現フレームでの操作は以下の tree,list には適用されない
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
395 sg_draw_tree = sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 sg_remove_list = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
397
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
398 // 現フレームで新しく SceneGraph がコピーされるので初期化
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
399 sg_exec_tree = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
400 sg_available_list = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
401
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
402 camera->move_execute(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
403 camera->update(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
404
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 camera->children = NULL;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 camera->lastChild = NULL;
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 /*まずは全部動作させる*/
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 while (list) {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
410
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 list->move_execute(screen_w, screen_h);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 list->collision_check(screen_w, screen_h, list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
413
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
414 list->frame++;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
415 list = list->next;
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
416 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
417
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
418 get_matrix(light->matrix, light->angle, light->xyz, camera->matrix);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
419
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
420 light_vector[0] = 0.0f;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
421 light_vector[1] = 0.0f;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
422 light_vector[2] = 0.0f;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
423 light_vector[3] = 1.0f;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
424
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
425 ApplyMatrix(light_vector, light->matrix);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
426
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
427 light_vector[0] /= light_vector[2];
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
428 light_vector[1] /= light_vector[2];
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
429
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
430 if(sg_exec_tree != NULL) {
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
431 return;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
432 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
433
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
434 /*removeのflagをもとにtreeを形成*/
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
435 while (t) {
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
436 SceneGraphPtr c = NULL;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
437 if (!t->isRemoved()) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
438 c = t->clone();
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
439 addNext(c);
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
440 cur_parent->addChild(c);
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
441 c->frame = t->frame;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
442 /*親の回転、座標から、子の回転、座標を算出*/
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
443 get_matrix(c->matrix, c->angle, c->xyz, cur_parent->matrix);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
444 /*法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている)*/
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
445 get_matrix(c->real_matrix, c->angle, c->xyz, cur_parent->real_matrix);
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
446 }
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
447
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
448 if (t->children != NULL && c != NULL) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
449 cur_parent = c;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
450 t = t->children;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
451 } else if (t->brother != NULL) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
452 t = t->brother;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
453 } else {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
454 while (t) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
455 if (t->brother != NULL) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
456 t = t->brother;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
457 break;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
458 } else {
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
459 if (t->parent == NULL) {
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
460 t = NULL;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
461 break;
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
462 } else {
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
463 cur_parent = cur_parent->parent;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 t = t->parent;
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
465 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
466 }
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
467 }
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
468 }
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
470
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
471
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
472
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 // 現在、allExecute が終わった時点では
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 // camera->children が User SceneGraph の root になる
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
475
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 /**
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
477 * NULL じゃなかったら、setSceneData が呼ばれてるから
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 * そっちを次の Scene にする
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 */
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
480
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
481 sg_exec_tree = camera->children;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
483
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
484 void
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
485 SceneGraphRoot::oneExecute(int screen_w, int screen_h)
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
486 {
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
487 SceneGraphPtr list = sg_available_list;
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
488 //SceneGraphPtr t = sg_exec_tree;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
489 //SceneGraphPtr cur_parent = camera;
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
490
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
491 // 前フレームで描画した SceneGraph は削除
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
492 allRemove(sg_remove_list);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
493
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
494 // 前フレームに作られた SceneGraph は描画用に移行
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
495 // 現フレームでの操作は以下の tree,list には適用されない
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
496 sg_draw_tree = sg_exec_tree;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
497 sg_remove_list = sg_available_list;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
498
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
499 // 現フレームで新しく SceneGraph がコピーされるので初期化
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
500 sg_exec_tree = NULL;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
501 sg_available_list = NULL;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
502
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
503 camera->move_execute(screen_w, screen_h);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
504 camera->update(screen_w, screen_h);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
505
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
506 camera->children = NULL;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
507 camera->lastChild = NULL;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
508
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
509 /* ここから */
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
510 list->move_execute(screen_w, screen_h);
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
511 // ここで move_execute から実行される move_task の処理が終わるまで待ちたい
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
512 //while(move_finish_flag == 0) {}
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
513 //move_finish_flag = 0;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
514
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
515 list->create_sg_execute();
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
516
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
517 list->collision_check(screen_w, screen_h, list);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
518 /* ここまで exec_task にする */
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
519
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
520
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
521 /* ここから下を exec_task の post_func に*/
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
522 list->frame++;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
523 list = list->next;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
524
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
525 get_matrix(light->matrix, light->angle, light->xyz, camera->matrix);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
526
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
527 light_vector[0] = 0.0f;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
528 light_vector[1] = 0.0f;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
529 light_vector[2] = 0.0f;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
530 light_vector[3] = 1.0f;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
531
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
532 ApplyMatrix(light_vector, light->matrix);
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
533
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
534 light_vector[0] /= light_vector[2];
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
535 light_vector[1] /= light_vector[2];
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
536
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
537 if(sg_exec_tree != NULL) {
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
538 return;
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
539 }
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
540 }
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
541
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
542 /*
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
543 ExecMove task の post func として呼んでやる
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
544 */
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
545 void
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
546 SceneGraphRoot::move_finish()
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
547 {
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
548 list->collision_check(screen_w, screen_h, list);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
549
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
550 list->frame++;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
551 //list = list->next;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
552
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
553 get_matrix(light->matrix, light->angle, light->xyz, camera->matrix);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
554
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
555 light_vector[0] = 0.0f;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
556 light_vector[1] = 0.0f;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
557 light_vector[2] = 0.0f;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
558 light_vector[3] = 1.0f;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
559
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
560 ApplyMatrix(light_vector, light->matrix);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
561
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
562 light_vector[0] /= light_vector[2];
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
563 light_vector[1] /= light_vector[2];
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
564
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
565 //sgchange->viewer->light_xyz_stock = getLightVector();
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
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 void
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
570 SceneGraphRoot::appTaskRegist(regist_func new_register)
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
571 {
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
572 this->regist = new_register;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
573 }
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
574
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
575 void
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
576 SceneGraphRoot::regist_execute()
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
577 {
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
578 (*regist)(this);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
579 }
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
580
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
581 void
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
582 SceneGraphRoot::allRemove(SceneGraphPtr list)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
583 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
584 SceneGraphPtr p = list;
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
585
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
586 while (p) {
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
587 SceneGraphPtr p1 = p->next;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
588 delete p;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
589 p = p1;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
590 cnt--;
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
591 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
592 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
593
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
594 void
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
595 SceneGraphRoot::checkRemove()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 SceneGraphPtr p = sg_available_list;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 SceneGraphPtr p1;
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
599
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 while (p) {
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
601 p1 = p->next;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
602 if (p->isRemoved()) {
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
603 sg_exec_tree = p->realRemoveFromTree(sg_exec_tree);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
604 sg_available_list = p->realRemoveFromList(sg_available_list);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
605 }
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
606 delete p;
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
607 p = p1;
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 }
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 SceneGraphPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
612 SceneGraphRoot::getExecuteSceneGraph()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 return sg_exec_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
615 }
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 SceneGraphPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
618 SceneGraphRoot::getDrawSceneGraph()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
619 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
620 return sg_draw_tree;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 }
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 void
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
624 SceneGraphRoot::updateControllerState()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
625 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 controller->check();
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
627 }
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 void
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
630 SceneGraphRoot::setSceneData(SceneGraphPtr sg)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
631 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
632 sg_exec_tree = sg;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
633 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
634
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
635 Pad*
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
636 SceneGraphRoot::getController()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
637 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
638 return controller;
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
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
641 SceneGraphIteratorPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
642 SceneGraphRoot::getIterator()
539
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 iterator->set(sg_remove_list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
645 return iterator;
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
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
648 SceneGraphIteratorPtr
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
649 SceneGraphRoot::getIterator(SceneGraphPtr list)
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
650 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
651 iterator->set(list);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
652 return iterator;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
653 }
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
654
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
655 CameraPtr
541
1a31b8820a4d Cerium Rendering Library
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
656 SceneGraphRoot::getCamera()
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
657 {
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
658 return camera;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
659 }
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
660
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
661
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
662 SceneGraphPtr
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
663 SceneGraphRoot::getLight()
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
664 {
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
665
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
666 return light;
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
667
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents: 586
diff changeset
668 }
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
669
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
670
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
671 float*
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
672 SceneGraphRoot::getLightVector()
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
673 {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
674 return light_vector;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
675 }