214 sceVu0CopyVector(world[3], this->
pos);
218 sceVu0ApplyMatrix(max, world, this->
bound.
max);
219 sceVu0ApplyMatrix(min, world, this->
bound.
min);
220 VectorMaxMin(max, min, max, min);
222 if (max[0] < box->
min[0]) {
226 if (max[2] < box->
min[2]) {
230 if (min[0] > box->
max[0]) {
234 if (min[2] > box->
max[2]) {
243 sceVu0FVECTOR corner[4];
251 sceVu0CopyVector(corner[0], this->
bound.
min);
252 sceVu0CopyVector(corner[1], this->
bound.
min);
253 sceVu0CopyVector(corner[2], this->
bound.
max);
254 sceVu0CopyVector(corner[3], this->
bound.
max);
258 sceVu0CopyVector(world[3], this->
pos);
262 sceVu0ApplyMatrix(corner[0], world, corner[0]);
263 sceVu0ApplyMatrix(corner[1], world, corner[1]);
264 sceVu0ApplyMatrix(corner[2], world, corner[2]);
265 sceVu0ApplyMatrix(corner[3], world, corner[3]);
266 VectorMaxMin(max, min, corner[0], corner[1], corner[2], corner[3]);
268 if (max[0] < box->
min[0]) {
272 if (max[2] < box->
min[2]) {
276 if (min[0] > box->
max[0]) {
280 if (min[2] > box->
max[2]) {
288 sceVu0FVECTOR saved_pos;
289 sceVu0FVECTOR lifted_pos;
291 sceVu0FVECTOR saved_rotation;
302 sceVu0CopyVector(saved_pos, this->
pos);
303 sceVu0CopyVector(saved_rotation, (
float *) &this->
rotation);
304 sceVu0CopyVector(lifted_pos, saved_pos);
309 if (this->
lift > 0.0f) {
310 lifted_pos[3] = 1.0f;
311 sceVu0ApplyMatrix(eye, mgRenderInfo.
view_scaled, lifted_pos);
312 depth = eye[2] / 1000.0f;
322 if (this->
lift > 1.0f) {
323 lifted_pos[1] += 0.1f;
325 lifted_pos[1] += depth * this->
lift;
329 sceVu0CopyVector(this->
pos, lifted_pos);
330 sceVu0CopyVector((
float *) &this->rotation, saved_rotation);
332 sceVu0CopyVector(this->
pos, saved_pos);
336 sceVu0FVECTOR ambient;
337 sceVu0FVECTOR saved_ambient;
338 float light_direction[4][4];
339 float light_colour[4][4];
340 float saved_light_colour[4][4];
341 float saved_light_direction[4][4];
342 sceVu0FVECTOR part_pos;
343 sceVu0FVECTOR part_rotation;
344 float parts_distance[4];
345 sceVu0FVECTOR effect_pos;
346 sceVu0FVECTOR direction;
366 for (i = 0; i < 4; i++) {
367 parts_distance[i] = extent + distance[i];
379 effect_info = this->
effect[i];
381 if (effect_info == NULL) {
385 if (effect_info->
kind != EDIT_EFFECT_UNK_5) {
389 if (!CheckEditEffect(effect_info, time)) {
393 if (effect_info->
frame == NULL) {
400 MGGetAmbient(ambient);
401 MGGetPLight(light_direction, light_colour);
402 sceVu0CopyMatrix(saved_light_colour, light_colour);
403 sceVu0CopyMatrix(saved_light_direction, light_direction);
404 sceVu0CopyVector(saved_ambient, ambient);
405 sceVu0CopyVector(part_pos, this->
pos);
406 sceVu0CopyVector(part_rotation, (
float *) &this->
rotation);
408 if (this->
frame[0] != NULL) {
409 this->
frame[0]->SetPosition(part_pos);
410 this->
frame[0]->SetRotation(part_rotation[0], part_rotation[1], part_rotation[2]);
416 effect_info->
frame->GetWorldPosition(effect_pos, effect_info->
offset);
417 sceVu0SubVector(direction, effect_pos, part_pos);
418 sceVu0Normalize(direction, direction);
419 light_direction[0][light] = direction[0];
420 light_direction[1][light] = direction[1];
421 light_direction[2][light] = direction[2];
422 light_colour[light][0] = effect_info->
colour[0];
423 light_colour[light][1] = effect_info->
colour[1];
424 light_colour[light][2] = effect_info->
colour[2];
425 light_colour[light][3] = 128.0f;
435 MGSetPLight(light_direction, light_colour);
441 MGSetAmbient(saved_ambient);
442 MGSetPLight(saved_light_direction, saved_light_colour);
447 sceVu0FVECTOR part_pos;
448 sceVu0FVECTOR part_rotation;
469 effect_info = this->
effect[i];
471 if (effect_info == NULL) {
475 if (!CheckEditEffect(effect_info, time)) {
479 sceVu0CopyVector(part_pos, this->
pos);
480 sceVu0CopyVector(part_rotation, (
float *) &this->
rotation);
482 if (this->
frame[0] != NULL) {
483 this->
frame[0]->SetPosition(part_pos);
484 this->
frame[0]->SetRotation(part_rotation[0], part_rotation[1], part_rotation[2]);
487 DrawEditEffect(effect_info, camera, group);