Mercurial > hg > old > magoroku_racing
view camera.c @ 90:8edae89a3877
compile on Mac OS X
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 May 2011 16:41:21 +0900 |
parents | ce9ef7dcf2f0 |
children | cb6c6de125dc |
line wrap: on
line source
#include <stdlib.h> //#include "libps2.h" //#include "ps2util.h" #include "car.h" #include "game.h" #include "controler.h" //大域変数、各部で共有 //extern SGO_PAD pad; //static CAMERA camera, def_camera; void camera_init() { /* //カメラの初期位置設定 def_camera.xyz[0] = 0; def_camera.xyz[1] =-7;// -3; def_camera.xyz[2] =-14; //0; def_camera.xyz[3] = 1; def_camera.zd[0] = 0; def_camera.zd[1] = 2; def_camera.zd[2] = 7; def_camera.zd[3] = 1; def_camera.yd[0] = 0; def_camera.yd[1] = 1; def_camera.yd[2] = 0; def_camera.yd[3] = 1; def_camera.angle[0]=-0.2;//0; //pich def_camera.angle[1]=0; //yoh def_camera.angle[2]=0; //roll def_camera.angle[3]=0; //def_cameraをcameraにコピー memcpy( &camera, &def_camera, sizeof(CAMERA)); set_ camera(&def_camera); */ } /** * pose: カメラの対象物(obj)の座標行列 * カメラがobjについていくように(そのような動きに見せるため) * カメラの位置ベクトル、視点ベクトルを更新 */ void camera_update(Game *game)//FMATRIX pose) { // FVECTOR location, eyes, vertical, angle; // int type = game.camera_type; // ps2_vu0_apply_matrix(location, pose, def_camera.xyz); // ps2_vu0_apply_matrix(eyes, pose, def_camera.zd); // ps2_vu0_apply_matrix(vertical, pose, def_camera.yd); /**When the car bends, the angle of the camera is changed**/ //if(pad.left>0 && game.jiki->speed !=0){ if(game->jiki->speed !=0){ /* if(def_camera.angle[1]<=0.2){ def_camera.angle[1]+=0.02; }*/ } //else if(pad.right>0 && game.jiki->speed !=0){ else if(game->jiki->speed !=0){ /* if(def_camera.angle[1]>=-0.2){ def_camera.angle[1]-=0.02; }*/ } else { /* if(def_camera.angle[1]<-0.01){ def_camera.angle[1]+=0.02; } else if(def_camera.angle[1]>0.01){ def_camera.angle[1]-=0.02; }*/ } /* ps2_vu0_apply_matrix(angle, pose, def_camera.angle); ps2_vu0_copy_vector(camera.xyz, location); ps2_vu0_copy_vector(camera.zd, eyes); ps2_vu0_copy_vector(camera.yd, vertical); ps2_vu0_copy_vector(camera.angle, angle); set_camera(&camera);*/ }