Mercurial > hg > old > magoroku_racing
comparison ps2util.c @ 95:b0249b856488
change_ps2util
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 May 2011 18:13:40 +0900 |
parents | cb6c6de125dc |
children | 0b65ca27f113 |
comparison
equal
deleted
inserted
replaced
94:30d89b592bc0 | 95:b0249b856488 |
---|---|
51 return tex; | 51 return tex; |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 | 55 |
56 void ps2util_tex_Set(TEXTURE* tex) | 56 int ps2util_tex_Set(TEXTURE* tex) |
57 { | 57 { |
58 //none | 58 return -1; |
59 } | |
60 | |
61 int ps2util_sprite_Create(ps2utilSprite sp, TEXTURE *sprite_tex) | |
62 { | |
63 return -1; | |
59 } | 64 } |
60 | 65 |
61 | 66 |
62 void ps2util_obj_Set_texture(OBJECT* car_body, TEXTURE *tex) | 67 void ps2util_obj_Set_texture(OBJECT* car_body, TEXTURE *tex) |
63 { | 68 { |
64 //none | 69 //none |
65 } | 70 } |
66 | 71 |
67 void ps2_vu0_unit_matrix(FMATRIX rot) | 72 void ps2_vu0_unit_matrix(FMATRIX m) |
68 { | 73 { |
69 //none | 74 m[0][1] = m[0][2] = m[0][3] = 0; |
70 } | 75 m[1][0] = m[1][2] = m[1][3] = 0; |
71 | 76 m[2][0] = m[2][1] = m[2][3] = 0; |
72 void ps2_vu0_rot_matrix_y(FMATRIX rot1, FMATRIX rot2, float radian) | 77 m[3][0] = m[3][1] = m[3][2] = 0; |
73 { | 78 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0; |
74 //none | 79 } |
75 } | 80 |
76 | 81 void ps2_vu0_rot_matrix_y(FMATRIX result, FMATRIX m, float radian) |
77 | 82 { |
78 void ps2_vu0_apply_matrix(FVECTOR direction, FMATRIX rot, FVECTOR v) | 83 FMATRIX rot; |
79 { | 84 m[0][1] = m[0][2] = m[0][3] = 0; |
80 //none | 85 m[1][0] = m[1][2] = m[1][3] = 0; |
86 m[2][0] = m[2][1] = m[2][3] = 0; | |
87 m[3][0] = m[3][1] = m[3][2] = 0; | |
88 m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0; | |
89 | |
90 m[0][0] = fsign(radian); | |
91 m[2][2] = fsign(radian); | |
92 m[0][2] = -fcos(radian); | |
93 m[2][0] = fcos(radian); | |
94 | |
95 FMATRIX m1 = m; | |
96 | |
97 ps2_vu0_mul_matrix(result, m1, m); | |
98 | |
99 } | |
100 | |
101 | |
102 void ps2_vu0_apply_matrix(FVECTOR result, FMATRIX m, FVECTOR v) | |
103 { | |
104 result[0] = m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2] + m[0][3] * v[3] ; | |
105 result[1] = m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2] + m[1][3] * v[3] ; | |
106 result[2] = m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2] + m[2][3] * v[3] ; | |
107 result[3] = m[3][0] * v[0] + m[3][1] * v[1] + m[3][2] * v[2] + m[3][3] * v[3] ; | |
81 } | 108 } |
82 | 109 |
83 | 110 |
84 void ps2_vu0_scale_vector(FVECTOR mov, FVECTOR car_direction, float car_speed) | 111 void ps2_vu0_scale_vector(FVECTOR mov, FVECTOR car_direction, float car_speed) |
85 { | 112 { |
86 //none | 113 mov[0] = car_direction[0] * car_speed ; |
114 mov[1] = car_direction[1] * car_speed ; | |
115 mov[2] = car_direction[2] * car_speed ; | |
116 mov[3] = car_direction[3]; | |
87 } | 117 } |
88 | 118 |
89 void ps2_vu0_add_vector(FVECTOR car_location1, FVECTOR car_location2,FVECTOR mov) | 119 void ps2_vu0_add_vector(FVECTOR car_location1, FVECTOR car_location2,FVECTOR mov) |
90 { | 120 { |
91 //none | 121 //none |
92 } | 122 } |
93 | 123 |
94 | 124 |
95 void ps2_vu0_outer_product(FVECTOR rotaxis, FVECTOR car_vertical, FVECTOR yd) | 125 void ps2_vu0_outer_product(FVECTOR result, FVECTOR v0, FVECTOR v1) |
96 { | 126 { |
97 //none | 127 result[0] = v0[1] * v1[2] - v0[2] * v1[1] ; |
98 } | 128 result[1] = v0[0] * v1[2] - v0[2] * v1[0] ; |
99 | 129 result[2] = v0[0] * v1[1] - v0[1] * v1[0] ; |
100 | 130 result[3] = 1; |
101 float ps2_vu0_inner_product(FVECTOR yd, FVECTOR car_vertical) | 131 } |
102 { | 132 |
103 float ret; | 133 |
104 return ret; | 134 float ps2_vu0_inner_product(FVECTOR v0, FVECTOR v1) |
135 { | |
136 return v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2]; | |
105 } | 137 } |
106 | 138 |
107 | 139 |
108 void ps2_vu0_mul_matrix(FMATRIX pose1, FMATRIX yrot, FMATRIX pose2) | 140 void ps2_vu0_mul_matrix(FMATRIX pose1, FMATRIX yrot, FMATRIX pose2) |
109 { | 141 { |
110 //none | 142 //none |
111 } | 143 } |
112 | 144 |
113 void ps2_vu0_copy_matrix(FMATRIX car_body_transfer, FMATRIX pose) | 145 void ps2_vu0_copy_matrix(FMATRIX from, FMATRIX to) |
114 { | 146 { |
115 //none | 147 to = from; |
116 } | 148 } |
117 | 149 |
118 | 150 |
119 void ps2util_tex_Exclude(TEXTURE* t) | 151 void ps2util_tex_Exclude(TEXTURE* t) |
120 { | 152 { |
121 //none | 153 //none |
122 } | 154 } |
123 | 155 |
124 void ps2util_obj_Free(OBJECT* p_body) | 156 void ps2util_obj_Free(OBJECT* obj) |
125 { | 157 { |
126 //none | 158 free(obj); |
127 } | 159 } |
128 | 160 |
129 | 161 |
130 | 162 |
131 void ps2_vu0_sub_vector(FVECTOR o0, FVECTOR p, FVECTOR p0) | 163 void ps2_vu0_sub_vector(FVECTOR o0, FVECTOR p, FVECTOR p0) |
134 } | 166 } |
135 | 167 |
136 | 168 |
137 | 169 |
138 | 170 |
139 void ps2_vu0_normalize(FVECTOR colface_normal1, FVECTOR colface_normal2) | 171 void ps2_vu0_normalize(FVECTOR result, FVECTOR v) |
140 { | 172 { |
141 //none | 173 float d = fsqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); |
174 result[0] = v[0] / d; | |
175 result[1] = v[1] / d; | |
176 result[2] = v[2] / d; | |
177 result[3] = 1; | |
142 } | 178 } |
143 | 179 |
144 | 180 |
145 void xml_free(PolygonInfo xml) | 181 void xml_free(PolygonInfo xml) |
146 { | 182 { |
162 | 198 |
163 void ps2util_sprite_Destroy(ps2utilSprite *title_sprite ) | 199 void ps2util_sprite_Destroy(ps2utilSprite *title_sprite ) |
164 { | 200 { |
165 //none | 201 //none |
166 } | 202 } |
203 | |
204 | |
205 | |
206 | |
207 void ps2util_sprite_Set_basicAttribute(ps2utilSprite *p, | |
208 unsigned short x, unsigned short y, | |
209 unsigned short sptable_tw1, unsigned short sptable_th1, | |
210 unsigned short sptable_tx, unsigned short sptable_ty, | |
211 unsigned short sptable_tw2, unsigned short sptable_th2, | |
212 int sprite_prio_foreground) | |
213 { | |
214 //none | |
215 } | |
216 | |
217 void ps2util_sprite_Request(ps2utilSprite *p) | |
218 { | |
219 //none | |
220 } | |
221 | |
222 | |
223 void ps2util_sprite_Unuse_alpha(ps2utilSprite *sp) | |
224 { | |
225 //none | |
226 } | |
227 | |
228 void ps2util_graphic_Init() | |
229 { | |
230 //none | |
231 } | |
232 | |
233 | |
234 /* | |
235 ps2 依存関係の sprite.c より引用。 | |
236 */ | |
237 inline void | |
238 sprite_disappear( SPRITE* sprite ) | |
239 { | |
240 | |
241 int i; | |
242 GsSpritePacket* packet = sprite->gs_packet; | |
243 for (i=0; i<SPRITE_HAS_4VERTEXIS; i++) | |
244 packet->primData[i].xyz_addr = PS2_GS_XYZ3; | |
245 | |
246 } | |
247 | |
167 | 248 |
168 | 249 |
169 | 250 |
170 | 251 |
171 | 252 |
221 | 302 |
222 | 303 |
223 /* | 304 /* |
224 ps2 依存関係内の、texture.c から拝借 | 305 ps2 依存関係内の、texture.c から拝借 |
225 この malloc によるメモリ取得をあちこちで行っているっぽい | 306 この malloc によるメモリ取得をあちこちで行っているっぽい |
307 cerium にある。 | |
226 */ | 308 */ |
227 int malloc_align16(void *free, void *aligned, int size) | 309 int malloc_align16(void *free, void *aligned, int size) |
228 { | 310 { |
229 char *index; | 311 char *index; |
230 unsigned int *f=(unsigned int *)free,*a=(unsigned int *)aligned; | 312 unsigned int *f=(unsigned int *)free,*a=(unsigned int *)aligned; |