Mercurial > hg > old > magoroku_racing.bad
annotate ps2util.cc @ 139:00d7de7fe9df default tip
fix collision
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 21 Jul 2011 22:49:57 +0900 |
parents | 2cc2796b3681 |
children |
rev | line source |
---|---|
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
1 /* ps2util.c */ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
2 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
3 #include <string.h> |
91 | 4 #include <stdio.h> |
5 #include <stdlib.h> | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
6 #include <math.h> |
91 | 7 #include "libps2.h" |
8 #include "ps2util.h" | |
101
67c843471b77
add name_dictionary.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
9 #include "name_dictionary.h" |
91 | 10 |
130 | 11 #include "matrix_calc.h" |
12 | |
128 | 13 #include "gSprite.h" |
14 | |
15 | |
91 | 16 /* |
17 たぶん、本当は読み込んだ xml file から情報を取得するとかそんなんだと思う | |
18 どんな処理か分からないので、とりあえず、初期化している。 | |
19 */ | |
100 | 20 OBJECT *ps2util_obj_Create_fromXML(const char *filename) |
91 | 21 { |
22 OBJECT *body; | |
124 | 23 //body->matrix = { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} }; |
24 | |
91 | 25 /* |
118 | 26 body->xyz = {0,0,0,0}; |
27 body->angle = {0,0,0,0}; | |
28 body->transfer = { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} }; | |
29 body->*name = filename; | |
30 body->*free_me = NULL; | |
91 | 31 */ |
128 | 32 |
91 | 33 return body; |
34 } | |
35 | |
36 | |
37 | |
38 void ps2util_obj_Set_effect(OBJECT *body, int def) | |
39 { | |
40 //none | |
41 } | |
42 | |
128 | 43 // ベクトル v1 をベクトル v2 にコピーする |
91 | 44 void ps2_vu0_copy_vector(FVECTOR directionA, FVECTOR directionB) |
45 { | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
46 memcpy(directionA, directionB, sizeof(FVECTOR)); |
91 | 47 } |
48 | |
49 | |
50 void ps2util_obj_Renew_transMatrix(OBJECT *car){ | |
51 //none | |
52 } | |
53 | |
54 | |
115 | 55 |
128 | 56 /* |
57 ps2 内の texture.c から | |
58 */ | |
59 /* | |
60 TEXTURE* read_png_file(const char *texname) | |
61 { | |
62 printf("trace\n"); | |
63 //とりあえず戻り値を返してエラーをどうにか | |
64 TEXTURE* tex; | |
65 | |
66 return tex; | |
67 } | |
68 */ | |
91 | 69 |
116 | 70 |
71 int ps2util_tex_Set(OBJECT* tex) | |
91 | 72 { |
95 | 73 return -1; |
74 } | |
75 | |
116 | 76 int ps2util_sprite_Create(ps2utilSprite *Sp, OBJECT *sprite_tex) |
95 | 77 { |
78 return -1; | |
91 | 79 } |
80 | |
81 | |
116 | 82 void ps2util_obj_Set_texture(OBJECT* car_body, OBJECT *tex) |
91 | 83 { |
84 //none | |
85 } | |
86 | |
115 | 87 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
88 // 与えられた行列を単位行列に変換する |
95 | 89 void ps2_vu0_unit_matrix(FMATRIX m) |
91 | 90 { |
95 | 91 m[0][1] = m[0][2] = m[0][3] = 0; |
92 m[1][0] = m[1][2] = m[1][3] = 0; | |
93 m[2][0] = m[2][1] = m[2][3] = 0; | |
94 m[3][0] = m[3][1] = m[3][2] = 0; | |
95 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0; | |
91 | 96 } |
97 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
98 /* |
128 | 99 Y軸を中心とした行列の回転 |
100 回転角 rx より X 軸を中心とした回転マトリックスを求めて、マトリックス m1 に左側から乗算して、その結果をマトリックス m0 に与える。 | |
101 X 軸だけでなく Y 軸、Z 軸を中心とした関数もある。また3ついっんに回転させる関数もある。 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
102 */ |
95 | 103 void ps2_vu0_rot_matrix_y(FMATRIX result, FMATRIX m, float radian) |
91 | 104 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
105 // 回転行列を作ってかけてやれば良い |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
106 |
95 | 107 m[0][1] = m[0][2] = m[0][3] = 0; |
108 m[1][0] = m[1][2] = m[1][3] = 0; | |
109 m[2][0] = m[2][1] = m[2][3] = 0; | |
110 m[3][0] = m[3][1] = m[3][2] = 0; | |
111 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0; | |
128 | 112 |
131 | 113 // |
114 /* | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
115 m[0][0] = sinf(radian); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
116 m[2][2] = sinf(radian); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
117 m[0][2] = -cosf(radian); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
118 m[2][0] = cosf(radian); |
131 | 119 */ |
120 | |
121 m[0][0] = cosf(radian); | |
122 m[2][2] = cosf(radian); | |
123 m[0][2] = -sinf(radian); | |
124 m[2][0] = sinf(radian); | |
128 | 125 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
126 FMATRIX m1;// = m; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
127 memcpy(&m1, m, sizeof(FMATRIX)); |
95 | 128 |
129 ps2_vu0_mul_matrix(result, m1, m); | |
91 | 130 } |
131 | |
131 | 132 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
133 // ベクトルの計算 |
124 | 134 // マトリックス m にベクトルを右から乗算して result に与える |
95 | 135 void ps2_vu0_apply_matrix(FVECTOR result, FMATRIX m, FVECTOR v) |
91 | 136 { |
128 | 137 result[0] = m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2] + m[0][3] * v[3]; |
138 result[1] = m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2] + m[1][3] * v[3]; | |
139 result[2] = m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2] + m[2][3] * v[3]; | |
140 result[3] = m[3][0] * v[0] + m[3][1] * v[1] + m[3][2] * v[2] + m[3][3] * v[3]; | |
91 | 141 } |
142 | |
143 void ps2_vu0_scale_vector(FVECTOR mov, FVECTOR car_direction, float car_speed) | |
144 { | |
128 | 145 mov[0] = car_direction[0] * car_speed; |
146 mov[1] = car_direction[1] * car_speed; | |
147 mov[2] = car_direction[2] * car_speed; | |
95 | 148 mov[3] = car_direction[3]; |
91 | 149 } |
150 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
151 // ベクトル v1 の各要素とベクトル v2 の各要素を各々加算してv0に与える |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
152 // v0 = v1+v2 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
153 void ps2_vu0_add_vector(FVECTOR result, FVECTOR v0, FVECTOR v1) |
91 | 154 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
155 result[0] = v0[0] + v1[0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
156 result[1] = v0[1] + v1[1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
157 result[2] = v0[2] + v1[2]; |
98 | 158 // result[3] = v0[3] + v1[3]; |
159 result[3] = v0[3]; | |
91 | 160 } |
161 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
162 // 外積 |
95 | 163 void ps2_vu0_outer_product(FVECTOR result, FVECTOR v0, FVECTOR v1) |
91 | 164 { |
95 | 165 result[0] = v0[1] * v1[2] - v0[2] * v1[1] ; |
166 result[1] = v0[0] * v1[2] - v0[2] * v1[0] ; | |
167 result[2] = v0[0] * v1[1] - v0[1] * v1[0] ; | |
168 result[3] = 1; | |
91 | 169 } |
170 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
171 // 内積 |
95 | 172 float ps2_vu0_inner_product(FVECTOR v0, FVECTOR v1) |
91 | 173 { |
95 | 174 return v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2]; |
91 | 175 } |
176 | |
177 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
178 void ps2_vu0_mul_matrix(FMATRIX result, FMATRIX m0, FMATRIX m1) |
91 | 179 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
180 result[0][0] = m0[0][0] * m1[0][0] + m0[0][1] * m1[1][0] + m0[0][2] * m1[2][0] + m0[0][3] * m1[3][0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
181 result[0][1] = m0[0][0] * m1[0][1] + m0[0][1] * m1[1][1] + m0[0][2] * m1[2][1] + m0[0][3] * m1[3][1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
182 result[0][2] = m0[0][0] * m1[0][2] + m0[0][1] * m1[1][2] + m0[0][2] * m1[2][2] + m0[0][3] * m1[3][2]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
183 result[0][3] = m0[0][0] * m1[0][3] + m0[0][1] * m1[1][3] + m0[0][2] * m1[2][3] + m0[0][3] * m1[3][3]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
184 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
185 result[1][0] = m0[1][0] * m1[0][0] + m0[1][1] * m1[1][0] + m0[1][2] * m1[2][0] + m0[1][3] * m1[3][0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
186 result[1][1] = m0[1][0] * m1[0][1] + m0[1][1] * m1[1][1] + m0[1][2] * m1[2][1] + m0[1][3] * m1[3][1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
187 result[1][2] = m0[1][0] * m1[0][2] + m0[1][1] * m1[1][2] + m0[1][2] * m1[2][2] + m0[1][3] * m1[3][2]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
188 result[1][3] = m0[1][0] * m1[0][3] + m0[1][1] * m1[1][3] + m0[1][2] * m1[2][3] + m0[1][3] * m1[3][3]; |
91 | 189 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
190 result[2][0] = m0[2][0] * m1[0][0] + m0[2][1] * m1[1][0] + m0[2][2] * m1[2][0] + m0[2][3] * m1[3][0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
191 result[2][1] = m0[2][0] * m1[0][1] + m0[2][1] * m1[1][1] + m0[2][2] * m1[2][1] + m0[2][3] * m1[3][1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
192 result[2][2] = m0[2][0] * m1[0][2] + m0[2][1] * m1[1][2] + m0[2][2] * m1[2][2] + m0[2][3] * m1[3][2]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
193 result[2][3] = m0[2][0] * m1[0][3] + m0[2][1] * m1[1][3] + m0[2][2] * m1[2][3] + m0[2][3] * m1[3][3]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
194 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
195 result[3][0] = m0[3][0] * m1[0][0] + m0[3][1] * m1[1][0] + m0[3][2] * m1[2][0] + m0[3][3] * m1[3][0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
196 result[3][1] = m0[3][0] * m1[0][1] + m0[3][1] * m1[1][1] + m0[3][2] * m1[2][1] + m0[3][3] * m1[3][1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
197 result[3][2] = m0[3][0] * m1[0][2] + m0[3][1] * m1[1][2] + m0[3][2] * m1[2][2] + m0[3][3] * m1[3][2]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
198 result[3][3] = m0[3][0] * m1[0][3] + m0[3][1] * m1[1][3] + m0[3][2] * m1[2][3] + m0[3][3] * m1[3][3]; |
91 | 199 } |
200 | |
201 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
202 void ps2_vu0_copy_matrix(FMATRIX transfer, FMATRIX pose) |
91 | 203 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
204 memcpy(transfer, pose, sizeof(FMATRIX)); |
91 | 205 } |
206 | |
95 | 207 void ps2util_obj_Free(OBJECT* obj) |
91 | 208 { |
95 | 209 free(obj); |
91 | 210 } |
211 | |
212 | |
213 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
214 void ps2_vu0_sub_vector(FVECTOR result, FVECTOR v0, FVECTOR v1) |
91 | 215 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
216 result[0] = v0[0] - v1[0]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
217 result[1] = v0[1] - v1[1]; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
218 result[2] = v0[2] - v1[2]; |
98 | 219 result[3] = v0[3];// - v1[3]; |
91 | 220 } |
221 | |
222 | |
223 | |
95 | 224 void ps2_vu0_normalize(FVECTOR result, FVECTOR v) |
91 | 225 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
226 // 大きさで割ってるだけって |
98 | 227 float d = sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); |
95 | 228 result[0] = v[0] / d; |
229 result[1] = v[1] / d; | |
230 result[2] = v[2] / d; | |
231 result[3] = 1; | |
91 | 232 } |
233 | |
234 | |
235 void xml_free(PolygonInfo xml) | |
236 { | |
237 //none | |
124 | 238 printf("xml_free\n"); |
91 | 239 } |
240 | |
116 | 241 |
130 | 242 // scenegraで |
243 /* | |
244 ただgSprite_PutSprite呼び出してるだけだから、 | |
245 呼び出し先で直接gSprite_PutSprite関数を呼び出す事にしました | |
246 */ | |
91 | 247 void ps2util_obj_Draw(OBJECT *object) |
248 { | |
130 | 249 //gSprite_PutObject(object); |
128 | 250 |
251 // gSprite_PutSprite(false, 100, object->xyz[0], object->xyz[1], object->xyz[2], 1 ); | |
124 | 252 |
128 | 253 // PutSprite を持ってくれば? |
254 /* | |
255 // char *name = "test"; | |
256 // SceneGraphPtr object = droot->createSceneGraph("test"); | |
257 | |
118 | 258 root->addChild(object); // 画像の数数えとく |
128 | 259 |
124 | 260 static float my_scale = 5; |
261 | |
262 float scale[] = {my_scale,my_scale,1}; | |
263 | |
128 | 264 //親の回転、座標から、子の回転、座標を算出 |
124 | 265 get_matrix_scale(object->matrix, object->angle, object->xyz, scale, root->matrix); |
128 | 266 |
267 //法線用の行列。Cameraの行列を抜いている(Cameraのコンストラクタで、単位行列にしている) | |
124 | 268 get_matrix(object->real_matrix, object->angle, object->xyz, root->real_matrix); |
128 | 269 */ |
270 | |
91 | 271 } |
272 | |
273 | |
274 void ps2util_sprite_Destroy(ps2utilSprite *title_sprite ) | |
275 { | |
276 //none | |
277 } | |
278 | |
279 | |
113 | 280 //putSprite で置き換え? |
95 | 281 void ps2util_sprite_Set_basicAttribute(ps2utilSprite *p, |
282 unsigned short x, unsigned short y, | |
283 unsigned short sptable_tw1, unsigned short sptable_th1, | |
284 unsigned short sptable_tx, unsigned short sptable_ty, | |
285 unsigned short sptable_tw2, unsigned short sptable_th2, | |
286 int sprite_prio_foreground) | |
287 { | |
288 //none | |
289 } | |
290 | |
291 void ps2util_sprite_Request(ps2utilSprite *p) | |
292 { | |
293 //none | |
294 } | |
295 | |
296 | |
297 void ps2util_sprite_Unuse_alpha(ps2utilSprite *sp) | |
298 { | |
299 //none | |
300 } | |
301 | |
302 void ps2util_graphic_Init() | |
303 { | |
304 //none | |
305 } | |
306 | |
307 | |
308 /* | |
309 ps2 依存関係の sprite.c より引用。 | |
310 */ | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
311 #define SPRITE_HAS_4VERTEXIS 4 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
312 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
313 #define PS2_GS_XYZ3 1 // なにかわからん定数だから適当に作りました |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
314 |
97
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
315 void |
95 | 316 sprite_disappear( SPRITE* sprite ) |
317 { | |
318 int i; | |
319 GsSpritePacket* packet = sprite->gs_packet; | |
320 for (i=0; i<SPRITE_HAS_4VERTEXIS; i++) | |
321 packet->primData[i].xyz_addr = PS2_GS_XYZ3; | |
322 } | |
323 | |
324 | |
91 | 325 /* |
326 ps2 依存関係から持ってきた。 | |
327 テクスチャに割り振ったメモリの解放処理? | |
328 元ファイル:texture.c | |
329 */ | |
116 | 330 /* |
91 | 331 void free_texture(TEXTURE *tex) |
332 { | |
333 if (tex == NULL) return; | |
101
67c843471b77
add name_dictionary.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
334 |
67c843471b77
add name_dictionary.cc
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
335 //delete_name_dictionary(tex->name); |
91 | 336 free(tex->free_texenv); |
337 free(tex->free_image); | |
338 free(tex); | |
339 } | |
116 | 340 */ |
91 | 341 |
115 | 342 |
91 | 343 /* |
344 ps2 依存関係内の、texture.c から拝借 | |
345 この malloc によるメモリ取得をあちこちで行っているっぽい | |
95 | 346 cerium にある。 |
91 | 347 */ |
348 int malloc_align16(void *free, void *aligned, int size) | |
349 { | |
350 char *index; | |
139 | 351 unsigned long *f=(unsigned long *)free, *a=(unsigned long *)aligned; |
91 | 352 |
353 if (free == NULL || aligned == NULL || size <= 0) return(-1); | |
354 | |
355 index = (char *)malloc(size + ALIGN_16BYTE); | |
356 if (index == NULL) { | |
357 return(-1); | |
358 } | |
359 | |
360 *f = *a = (unsigned long int)index; | |
361 if (((unsigned long int)index % ALIGN_16BYTE) != 0) { | |
362 index += ALIGN_16BYTE - ((unsigned long int)index % ALIGN_16BYTE); | |
363 *a = (unsigned long int)index; | |
364 } | |
365 | |
366 return(0); | |
367 } | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
368 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
369 |
116 | 370 /* |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
371 void ps2util_tex_Exclude( TEXTURE* t ) |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
372 { |
110
8a525ec378fc
bool.h change stdbool.h
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
101
diff
changeset
|
373 //const char *test = "test"; |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
374 } |
116 | 375 */ |
115 | 376 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
377 void ps2util_sprite_Draw() |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
378 { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
379 printf("ps2util_sprite_Draw()\n"); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
380 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
381 |
97
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
382 void ps2util_graphic_Finish() |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
383 { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
384 printf("ps2util_graphic_Finish()\n"); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
385 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
386 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
387 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
388 // title.cに書いてた |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
389 void ps2util_sprite_Use_alpha( ps2utilSprite *title ) |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
390 { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
391 printf("ps2util_sprite_Use_alpha()\n"); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
392 } |