forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Rotation of View Matrix for SceGumLookAt ... PLEASE HELP!

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
roland



Joined: 11 Feb 2006
Posts: 13

PostPosted: Tue Feb 28, 2006 10:54 am    Post subject: Rotation of View Matrix for SceGumLookAt ... PLEASE HELP! Reply with quote

I am slowly loosing my head on this problem..

I am trying to navigate through a small little world of 3d objects and would like to implement a FPS Like camera using SceGumLookAt.

I read tons of Tutorials and the best I came up with now is an orbiting Camera.. I am a real n00b in regards of Vector Math etc. so I am really hoping that this time, somebody out there can help me..

This is the code I use:

Code:

static void mult_matvec(const ScePspFMatrix4 *m,
                  const ScePspFVector4 *vi, ScePspFVector3 *vo)
{
   vo->x = m->x.x*vi->x+m->y.x*vi->y+m->z.x*vi->z+m->w.x*vi->w;
   vo->y = m->x.y*vi->x+m->y.y*vi->y+m->z.y*vi->z+m->w.y*vi->w;
   vo->z = m->x.z*vi->x+m->y.z*vi->y+m->z.z*vi->z+m->w.z*vi->w;
}

// Camera
   sceGumMatrixMode(GU_VIEW);
   sceGumLoadIdentity();

   sceGumPushMatrix();
   sceGumRotateX(SCEGU_RAD(CurrentRotationX));
   sceGumRotateZ(SCEGU_RAD(CurrentRotationZ));

   sceGumStoreMatrix(&m);


   vec2.x = center.x;
   vec2.y = center.y;
   vec2.z = center.z;
   vec2.w = 1.0f;
   mult_matvec(&m, &vec2, &center);


   vec2.x = eye.x;
   vec2.y = eye.y;
   vec2.z = eye.z;
   vec2.w = 0.0f;
   mult_matvec(&m, &vec2, &eye);

   sceGumPopMatrix();

   sceGumLookAt( &eye, &center, &up ); // Set viewpoint matrix   


Thank you in advance for your help!!

roland
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group