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 

MD2Lib troubles

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



Joined: 23 Jul 2007
Posts: 87
Location: wilmington, NC

PostPosted: Sat Jul 19, 2008 3:35 pm    Post subject: MD2Lib troubles Reply with quote

im trying to code a MD2Library for the psp using this page here http://en.wikipedia.org/wiki/MD2_%28file_format%29

and here is my code so far

EDIT: i already know i havent added the other headers

Code:


#include "stdio.h"

#ifdef __cplusplus__
extern "C" {
#endif /* __cplusplus */


typedef struct MD2_Header{
int ident;
int version
int skinwidth;
int skinheight;
int framesize;
int num_skins;
int num_xyz;
int num_st;
int num_tris;
int num_glcmds;
int num_frames;
int ofs_skins;
int ofs_st;
int ofs_tris;
int ofs_frames;
int ofs_glcmds;
int ofs_end;
}MD2_Header;

/* at offset ofs_st its num_st * this struct */
typedef struct MD2_ofs1{
short s;
short t;
}MD2_ofs1

/*
typedef struct MD2_


int Load_MD2(char *target){

MD2_Header *header;

if(Load_MD2(char *target)
   {
   printf("file %d loaded sucessfully!\n\n", char *target);
   printf("verifying struct...\n");
   printf("%d"

   }

/* this function decompresses a single frame and displays it
 *
 */
int Decompress_Frame(int frame)
{




}


int MD2GetMagic(void)
{
return ident;
}


int MD2GetVersion(void)
{
return version;
}


int MD2GetSkinWidth(void)
{
return skinwidth;
}


int MD2GetSkinHeight(void)
{
return skinheight;
}


int MD2GetFrameSize(void)
{
return framesize;
}


int MD2GetNumSkins(void)
{
return num_skins;
}


int MD2GetNumXYZ(void)
{
return num_xyz
}


int MD2GetNumST(void)
{
return num_st;
}


int MD2GetNumTri(void)
{
return num_tris;
}


int MD2GetNumGL(void)
{
return num_glcmds;
}


int MD2GetNumFrames(void)
{
return num_frames;
}


int MD2GetSkinOffs(void)
{
return ofs_skins;

if(ofs_skins << unsigned char[64])
   {
   printf("error at %d", ofs_skins);
   }

else if(ofs_skins == unsigned char[64])
   {
   printf("%d", ofs_skins);
   }
return ofs_skins;
}


int MD2GetSTOffs(void)
{
ofs_st = (num_st * (MD2_ofs1 *header));

return ofs_st;
}


int MD2GetTrigOffs(void)
{
return ofs_tris;
}


int MD2GetFrameOffs(void)
{
return ofs_frames;
}


int MD2GetGLOffs(void)
{
return ofs_glcmds;
}


int MD2GetEndOffs(void)
{
return ofs_end;
}


im still only a noob right now when it comes to 3D graphics, but i decided to give it a try and now im so freaking confused now and asking some advice if im doing something right or wrong...
_________________
the questions of today are awnswered by the blood and bullets of tomorrow! ---EagleEye--- (Socom FTB2)
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
Smong



Joined: 04 Sep 2007
Posts: 82

PostPosted: Sat Jul 19, 2008 9:20 pm    Post subject: Re: MD2Lib troubles Reply with quote

You didn't say where you were going wrong. This also doesn't look like a PSP specific question.

I noticed this part has strange commenting:
Rangu2057 wrote:
Code:
/*
typedef struct MD2_


int Load_MD2(char *target){

MD2_Header *header;

if(Load_MD2(char *target)
   {
   printf("file %d loaded sucessfully!\n\n", char *target);
   printf("verifying struct...\n");
   printf("%d"

   }

/* this function decompresses a single frame and displays it
 *
 */
int Decompress_Frame(int frame)
{




}


There is a MD2 in Open GL sample at Cone3D:
http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/ogladv/tut2
You'll need to remove the PCX loader and convert the glVertex/glNormal to instead generate a list of vertices that can be passed to sceGumDrawArray.

pspdev\psp\sdk\samples\gu\common\geometry.h has a bunch of structs you may find useful for storing the vertices in on PSP.
_________________
(+[__]%)
Back to top
View user's profile Send private message
Rangu2057



Joined: 23 Jul 2007
Posts: 87
Location: wilmington, NC

PostPosted: Sun Jul 20, 2008 12:01 am    Post subject: Reply with quote

ok, thanks for the help :)
_________________
the questions of today are awnswered by the blood and bullets of tomorrow! ---EagleEye--- (Socom FTB2)
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
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