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