Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Jorge Freitas Newsgroups: scea.yaroze.programming.3d_graphics Subject: Re: Creating a TMD on the fly Date: Wed, 28 May 1997 22:13:19 -0400 Organization: SCEA Net Yaroze News Lines: 124 Message-ID: <338CE63F.7F1E@netcom.ca> References: <338C1E17.60C8@netcom.ca> Reply-To: jfreitas@netcom.ca NNTP-Posting-Host: trt-on24-56.netcom.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0 (Win95; I) It's fixed. I made several changes to the structures, changed the scale of the vertecies, and voila... I need to change the code to handle different primitives, and I'm still not sure how the vertex and normal values are stored, is it -1 or -4096? Here is the working code, if anyone is interested, and be sure NOT to call GsMapModelingData when intializing the Object... typedef struct { long int ID; long int FLAGS; long int NOBJ; }TMD_Header; typedef struct { unsigned long int *vert_top; unsigned long int n_vert; unsigned long int *normal_top; unsigned long int n_normal; unsigned long int *primitive_top; unsigned long int n_primitive; long int scale; }TMD_Object; typedef struct { char olen; char ilen; char flag; char mode; unsigned char r; unsigned char g; unsigned char b; unsigned char packet_mode; unsigned short int n; unsigned short int v0; unsigned short int v1; unsigned short int v2; }TMD_Primitive; typedef struct { short int vx; short int vy; short int vz; short int pad; }TMD_Vertex; typedef struct { short int nx; short int ny; short int nz; short int pad; }TMD_Normal; typedef struct { TMD_Header Header; TMD_Object Object; TMD_Primitive Primitive_Table[ 1 ]; TMD_Vertex Vertex_Table[ 3 ]; TMD_Normal Normal_Table[ 1 ]; }TMD; TMD Test_TMD; /************ * Build_TMD * ************/ void Build_TMD( void ) { Test_TMD.Header.ID = 0x41; Test_TMD.Header.FLAGS = 1; Test_TMD.Header.NOBJ = 1; Test_TMD.Object.vert_top = (unsigned long int *)&Test_TMD.Vertex_Table; Test_TMD.Object.n_vert = 3; Test_TMD.Object.normal_top = (unsigned long int *)&Test_TMD.Normal_Table; Test_TMD.Object.n_normal = 1; Test_TMD.Object.primitive_top = (unsigned long int *)&Test_TMD.Primitive_Table; Test_TMD.Object.n_primitive = 1; Test_TMD.Object.scale = 1; Test_TMD.Vertex_Table[ 0 ].vx = 0; Test_TMD.Vertex_Table[ 0 ].vy = -100; Test_TMD.Vertex_Table[ 0 ].vz = 0; Test_TMD.Vertex_Table[ 0 ].pad = 0; Test_TMD.Vertex_Table[ 1 ].vx = -100; Test_TMD.Vertex_Table[ 1 ].vy = 100; Test_TMD.Vertex_Table[ 1 ].vz = 0; Test_TMD.Vertex_Table[ 1 ].pad = 0; Test_TMD.Vertex_Table[ 2 ].vx = 100; Test_TMD.Vertex_Table[ 2 ].vy = 100; Test_TMD.Vertex_Table[ 2 ].vz = 0; Test_TMD.Vertex_Table[ 2 ].pad = 0; Test_TMD.Normal_Table[ 0 ].nx = 0; Test_TMD.Normal_Table[ 0 ].ny = 0; Test_TMD.Normal_Table[ 0 ].nz = -1; Test_TMD.Normal_Table[ 0 ].pad = 0; Test_TMD.Primitive_Table[ 0 ].olen = 4; Test_TMD.Primitive_Table[ 0 ].ilen = 3; Test_TMD.Primitive_Table[ 0 ].flag = 0; Test_TMD.Primitive_Table[ 0 ].mode = 0x20; Test_TMD.Primitive_Table[ 0 ].r = 0xc8; Test_TMD.Primitive_Table[ 0 ].g = 0xc8; Test_TMD.Primitive_Table[ 0 ].b = 0xc8; Test_TMD.Primitive_Table[ 0 ].packet_mode = 0x20; Test_TMD.Primitive_Table[ 0 ].n = 0; Test_TMD.Primitive_Table[ 0 ].v0 = 0; Test_TMD.Primitive_Table[ 0 ].v1 = 2; Test_TMD.Primitive_Table[ 0 ].v2 = 1; }