Path: chuka.playstation.co.uk!news From: Developer Support Newsgroups: scee.yaroze.programming.3d_graphics Subject: TMD Date: Fri, 30 May 1997 11:57:52 +0100 Organization: Sony Computer Entertainment Europe Lines: 684 Message-ID: <338EB2B0.19DF@interactive.sony.com> Reply-To: N/A-Use-Newsgroup NNTP-Posting-Host: 194.203.13.10 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (Win95; I) From markt@mincom.com >Hi Sony gurus! > >I've got a problem and it is a bit embarrassing... I can't get any >graphics to display on my screen! I have been trying to source the >problem for weeks but I am totally stumped. Please Help. > >I am creating a TMD on the fly at program start. Am creating a >TMD header with version, flag = real addresses (1) and number >of objects = 1. The object has NULL and 0 for its fields. Then >I add a flat, non textured triangle (tried the simplest possible) by >allocating memory (from the heap for now, malloc) for a >primitive/packet >data combination and also for vertex data. I have quadmillion checked >the TMD format - in your headers plus in the doco' and am as positive >as I can be that the data is correct (even in debug). The object fields >are updated to point to these malloc'ed addresses. > I set up a TMD like this, using TMD.H: void makeTMD_F_3(u_long *addr, u_char r, u_char g, u_char b, TMD_NORM norm0, TMD_VERT vert0, TMD_VERT vert1, TMD_VERT vert2) { TMD_OBJ *obj_table; // pointer to object table u_long *vert_table; // pointer to vertices table u_long *norm_table; // pointer to normals table u_long *prim_table; // pointer to primative table // ******** TMD header info ******** setTMD_HDR((TMD_HDR *)addr, 0x00000041, 1, 1); addr = (u_long *)((TMD_HDR *)addr + 1); // move to end of header // ******** skip object table, values setup later ******** obj_table = (TMD_OBJ *)addr; addr = (u_long *)((TMD_OBJ *)addr + 1); // ******** primative table ******** prim_table = addr; // primative info, specific to type of primative setPRIM_HDR((PRIM_HDR *)addr, F_3, 0, 3, 4); addr = (u_long *)((PRIM_HDR *)addr + 1); // move to end of primative header // primative data setTMD_F_3((TMD_F_3 *)addr, r, g, b, 0, 0, 1, 2); addr = (u_long *)((TMD_F_3 *)addr + 1); // move to end of primative data // ******** vertices table ******** vert_table = addr; // vertices and normal data setTMD_VERT((TMD_VERT *)addr, vert0.vx, vert0.vy, vert0.vz); addr = (u_long *)((TMD_VERT *)addr + 1); setTMD_VERT((TMD_VERT *)addr, vert1.vx, vert1.vy, vert1.vz); addr = (u_long *)((TMD_VERT *)addr + 1); setTMD_VERT((TMD_VERT *)addr, vert2.vx, vert2.vy, vert2.vz); addr = (u_long *)((TMD_VERT *)addr + 1); // ******** normals table ******** norm_table = addr; setTMD_NORM((TMD_NORM *)addr, norm0.nx, norm0.ny, norm0.nz); // fill in object table details setTMD_OBJ(obj_table, vert_table, 3, norm_table, 1, prim_table, 1, 0); } >OK - all I do then is set a viewpoint to look at it but no go. The >WS world matrix appears OK, LS is 0 which should also be OK. No >graphics appears. The controller changes the view and ref' points but >still no go. > >I do a LinkObject4 only before the 'draw' (SortObject4) so I'm >sure I call it (link) with a totally valid TMD. I pass the address >of the object & the handler which is initialised, object number = 0. > >I have also attempted to do a quad and some lines (in the TMD) and >also have the same problem. Note the PSX doesn't show any signs of >error. > >The projection seems OK also. > >I have provided object files which have debug info and a compiled >executable. Would it be possible to run it thru' debug and discover >the stupid thing I am doing wrong? You can validate my TMD, etc. I >assume you can interrogate at the PSX level calls for bad info/states. > We don't like using debug, especially as you have the code, which you could send. >Sorry 'bout this but I've run out of options and you're my last >resort. Thanks very much. > >By the way, when attempting to do TMD lines (no gradation) the GPU >complains 40hex (code for lines) not assigned... how come? Quite possible the TMD format contains unsupported features. We haven't checked all of them, if anyone else finds something isn't supported we'd like to know, then we can update the TMD doc with this information. I found that gouraud no-texture(gradation) with light sourcing didn't work. > >I don't have direct news access (only via http) so I don't mind if >you broadcast my problem and solution to it so others don't do >anything as stupid. > >Oh yeah, in your doco' for the TMD format it appears the Quad, >Flat, Texture has a bad ilen in the "Packet Configuration" >figure (0x07 should be 0x08) I think? No the size of the quad info on input is 7, bits 31........15....7....0 word 1 CBA V0 U0 2 TSB V1 U1 3 - V2 U2 4 - V3 U3 5 vertex0 normal0 6 vertex2 vertex1 7 - vertex3 > >Mark Stuart PS If you want the TMD.H file its contained in the chrome, morph, clone demos, and others. Alternatively: ---------cut here------ /*************************************************************** * * * Copyright (C) 1997 by Sony Computer Entertainment * * All rights Reserved * * * * S. Ashley 9th Jan 97 * * * ***************************************************************/ #ifndef _tmd_h #define _tmd_h #include // for decoding primative mode #define IIP 0x10 // gouraud shading #define QUAD 0x08 // 4 sided #define TME 0x04 // textured #define ABE 0x02 // semi transparency on #define TGE 0x01 // brightness calculation off // flags for primatives #define GRD 0x04 // gradation #define FCE 0x02 // 2 sided #define LGT 0x01 // no light source calculation // primative modes #define F_3 0x20 // Triangle No-texture #define F_3G 0x20 // Triangle No-texture gradation #define F_3T 0x24 // Triangle Texture #define G_3 0x30 // triangle gouraud #define G_3G 0x30 // triangle gouraud gradation #define G_3T 0x34 // triangle gouraud texture #define F_3_NL 0x21 // triangle no texture no light #define F_3T_NL 0x25 // triangle texture no light #define G_3_NL 0x31 // triangle gouraud no texture no light #define G_3T_NL 0x35 // triangle gouraud texture no light #define F_4 0x28 // Quadangle No-texture #define F_4G 0x28 // Quadangle No-texture gradation #define F_4T 0x2c // Quadangle Texture #define G_4 0x38 // quad gouraud #define G_4G 0x38 // quad gouraud gradation #define G_4T 0x3c // quad gouraud texture #define F_4_NL 0x29 // quad no texture no light #define F_4T_NL 0x2d // quad texture no light #define G_4_NL 0x39 // quad gouraud no texture no light #define G_4T_NL 0x3d // quad gouraud texture no light #define SL 0x40 // straight line no gradation #define SL_G 0x50 // straight line gradation // TMD is made up of header, object tables (one for each object), // primative table, vertices table and normals table typedef struct { u_long id; // 0x00000041 u_long flag; // 1 if addresses real, 0 if offset u_long nobjs; // number of objects in TMD } TMD_HDR; #define setTMD_HDR(t,_i,_f,_n) \ (t)->id = (_i), (t)->flag = (_f), (t)->nobjs = (_n) typedef struct { u_long *vert_top; // vertices table u_long n_vert; // number of vertices u_long *norm_top; // normal table u_long n_norm; // number of normals u_long *prim_top; // primatives table u_long n_prim; // number of primatives long scale; // not used } TMD_OBJ; #define setTMD_OBJ(t,_vt,_vn,_nt,_nn,_pt,_pn,_s) \ (t)->vert_top = (_vt), (t)->n_vert = (_vn), \ (t)->norm_top = (_nt), (t)->n_norm = (_nn), \ (t)->prim_top = (_pt), (t)->n_prim = (_pn), \ (t)->scale = (_s) // primative table is made up of a collection of primatives headers, with there // primative data typedef struct { u_char olen, ilen, flag, mode; } PRIM_HDR; #define setPRIM_HDR(p,_m,_f,_i,_o) \ (p)->mode = (_m), (p)->flag = (_f), (p)->ilen = (_i), (p)->olen = (_o) typedef struct { short vx, vy; short vz, pad; } TMD_VERT; #define setTMD_VERT(t,_x,_y,_z) \ (t)->vx = (_x), (t)->vy = (_y), (t)->vz = (_z) typedef struct { short nx, ny; short nz, pad; } TMD_NORM; #define setTMD_NORM(t,_x,_y,_z) \ (t)->nx = (_x), (t)->ny = (_y), (t)->nz = (_z) // normals and vertices are indices for the normal and vertex tables // r0, g0, b0 are colour values // mode2 is just a repetition of the mode data used as a filler typedef struct // ilen 3 olen 4 { u_char r0, g0, b0, mode2; u_short norm0, vert0; u_short vert1, vert2; } TMD_F_3; #define setTMD_F_3(t,_r,_g,_b,_norm,_vert0,_vert1,_vert2) \ (t)->mode2 = F_3, \ (t)->r0 = (_r), (t)->g0 = (_g), (t)->b0 = (_b), \ (t)->norm0 = (_norm), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) // pad0, pad1 are just padding typedef struct // ilen 5 olen 6 { u_char r0, g0, b0, mode2; u_char r1, g1, b1, pad0; u_char r2, g2, b2, pad1; u_short norm0, vert0; u_short vert1, vert2; } TMD_F_3G; #define setTMD_F_3G(t,_r0,_g0,_b0,_r1,_g1,_b1,_r2,_g2,_b2,_norm,_vert0,_vert1,_vert2) \ (t)->mode2 = F_3G, \ (t)->r0 = (_r0), (t)->g0 = (_g0), (t)->b0 = (_b0), \ (t)->r1 = (_r1), (t)->g1 = (_g1), (t)->b1 = (_b1), \ (t)->r2 = (_r2), (t)->g2 = (_g2), (t)->b2 = (_b2), \ (t)->norm0 = (_norm), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) // CBA clutY * 64 + clutX / 16 // TSB texture page + semitrans rate (0..3) << 5 + colour mode (0..2) << 7 // u, v are texture page coordinates typedef struct // ilen 5 olen 7 { u_char u0, v0; u_short cba; u_char u1, v1; u_short tsb; u_char u2, v2; u_short pad; u_short norm0, vert0; u_short vert1, vert2; } TMD_F_3T; #define setTMD_F_3T(t,_cba,_tsb,_u0,_v0,_u1,_v1,_u2,_v2,_norm,_vert0,_vert1,_vert2) \ (t)->cba = (_cba), (t)->tsb = (_tsb), \ (t)->u0 = (_u0), (t)->v0 = (_v0), \ (t)->u1 = (_u1), (t)->v1 = (_v1), \ (t)->u2 = (_u2), (t)->v2 = (_v2), \ (t)->norm0 = (_norm), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) typedef struct // ilen 4 olen 5 { u_char r0, g0, b0, mode2; u_short norm0, vert0; u_short vert1, vert2; u_short vert3, pad; } TMD_F_4; #define setTMD_F_4(t,_r,_g,_b,_norm,_vert0,_vert1,_vert2,_vert3) \ (t)->mode2 = F_4, \ (t)->r0 = (_r), (t)->g0 = (_g), (t)->b0 = (_b), \ (t)->norm0 = (_norm), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 7 olen 8 { u_char r0, g0, b0, mode2; u_char r1, g1, b1, pad0; u_char r2, g2, b2, pad1; u_char r3, g3, b3, pad2; u_short norm0, vert0; u_short vert1, vert2; u_short vert3, pad3; } TMD_F_4G; #define setTMD_F_4G(t,_r0,_g0,_b0,_r1,_g1,_b1,_r2,_g2,_b2,_r3,_g3,_b3,_norm,_vert0,_vert1,_vert2,_vert3) \ (t)->mode2 = F_4G, \ (t)->r0 = (_r0), (t)->g0 = (_g0), (t)->b0 = (_b0), \ (t)->r1 = (_r1), (t)->g1 = (_g1), (t)->b1 = (_b1), \ (t)->r2 = (_r2), (t)->g2 = (_g2), (t)->b2 = (_b2), \ (t)->r3 = (_r3), (t)->g3 = (_g3), (t)->b3 = (_b3), \ (t)->norm0 = (_norm), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 7 olen 9 { u_char u0, v0; u_short cba; u_char u1, v1; u_short tsb; u_char u2, v2; u_short pad0; u_char u3, v3; u_short pad1; u_short norm0, vert0; u_short vert1, vert2; u_short vert3, pad2; } TMD_F_4T; #define setTMD_F_4T(t,_cba,_tsb,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3,_norm,_vert0,_vert1,_vert2,_vert3) \ (t)->cba = (_cba), (t)->tsb = (_tsb), \ (t)->u0 = (_u0), (t)->v0 = (_v0), \ (t)->u1 = (_u1), (t)->v1 = (_v1), \ (t)->u2 = (_u2), (t)->v2 = (_v2), \ (t)->u3 = (_u3), (t)->v3 = (_v3), \ (t)->norm0 = (_norm), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 4 olen 6 { u_char r0, g0, b0, mode2; u_short norm0, vert0; u_short norm1, vert1; u_short norm2, vert2; } TMD_G_3; #define setTMD_G_3(t,_r,_g,_b,_norm0,_norm1,_norm2,_vert0,_vert1,_vert2) \ (t)->mode2 = G_3, \ (t)->r0 = (_r), (t)->g0 = (_g), (t)->b0 = (_b), \ (t)->norm0 = (_norm0), (t)->norm1 = (_norm1), (t)->norm2 = (_norm2), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) typedef struct // ilen 6 olen 6 { u_char r0, g0, b0, mode2; u_char r1, g1, b1, pad0; u_char r2, g2, b2, pad1; u_short norm0, vert0; u_short norm1, vert1; u_short norm2, vert2; } TMD_G_3G; #define setTMD_G_3G(t,_r0,_g0,_b0,_r1,_g1,_b1,_r2,_g2,_b2,_norm0,_norm1,_norm2,_vert0,_vert1,_vert2) \ (t)->mode2 = G_3G, \ (t)->r0 = (_r0), (t)->g0 = (_g0), (t)->b0 = (_b0), \ (t)->r1 = (_r1), (t)->g1 = (_g1), (t)->b1 = (_b1), \ (t)->r2 = (_r2), (t)->g2 = (_g2), (t)->b2 = (_b2), \ (t)->norm0 = (_norm0), (t)->norm1 = (_norm1), (t)->norm2 = (_norm2), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) typedef struct // ilen 6 olen 9 { u_char u0, v0; u_short cba; u_char u1, v1; u_short tsb; u_char u2, v2; u_short pad; u_short norm0, vert0; u_short norm1, vert1; u_short norm2, vert2; } TMD_G_3T; #define setTMD_G_3T(t,_cba,_tsb,_u0,_v0,_u1,_v1,_u2,_v2,_norm0,_norm1,_norm2,_vert0,_vert1,_vert2) \ (t)->cba = (_cba), (t)->tsb = (_tsb), \ (t)->u0 = (_u0), (t)->v0 = (_v0), \ (t)->u1 = (_u1), (t)->v1 = (_v1), \ (t)->u2 = (_u2), (t)->v2 = (_v2), \ (t)->norm0 = (_norm0), (t)->norm0 = (_norm1), (t)->norm0 = (_norm2), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) typedef struct // ilen 5 olen 8 { u_char r0, g0, b0, mode2; u_short norm0, vert0; u_short norm1, vert1; u_short norm2, vert2; u_short norm3, vert3; } TMD_G_4; #define setTMD_G_4(t,_r,_g,_b,_norm0,_norm1,_norm2,_norm3,_vert0,_vert1,_vert2,_vert3) \ (t)->mode2 = G_4, \ (t)->r0 = (_r), (t)->g0 = (_g), (t)->b0 = (_b), \ (t)->norm0 = (_norm0), (t)->norm1 = (_norm1), \ (t)->norm2 = (_norm2), (t)->norm3 = (_norm3), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 8 olen 8 { u_char r0, g0, b0, mode2; u_char r1, g1, b1, pad0; u_char r2, g2, b2, pad1; u_char r3, g3, b3, pad2; u_short norm0, vert0; u_short norm1, vert1; u_short norm2, vert2; u_short norm3, vert3; } TMD_G_4G; #define setTMD_G_4G(t,_r0,_g0,_b0,_r1,_g1,_b1,_r2,_g2,_b2,_r3,_g3,_b3,_norm0,_norm1,_norm2,_norm3,_vert0,_vert1,_vert2,_vert3) \ (t)->mode2 = G_4G, \ (t)->r0 = (_r0), (t)->g0 = (_g0), (t)->b0 = (_b0), \ (t)->r1 = (_r1), (t)->g1 = (_g1), (t)->b1 = (_b1), \ (t)->r2 = (_r2), (t)->g2 = (_g2), (t)->b2 = (_b2), \ (t)->r3 = (_r3), (t)->g3 = (_g3), (t)->b3 = (_b3), \ (t)->norm0 = (_norm0), (t)->norm1 = (_norm1), \ (t)->norm2 = (_norm2), (t)->norm3 = (_norm3), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 8 olen 12 { u_char u0, v0; u_short cba; u_char u1, v1; u_short tsb; u_char u2, v2; u_short pad0; u_char u3, v3; u_short pad1; u_short norm0, vert0; u_short norm1, vert1; u_short norm2, vert2; u_short norm3, vert3; } TMD_G_4T; #define setTMD_G_4T(t,_cba,_tsb,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3,_norm0,_norm1,_norm2,_norm3,_vert0,_vert1,_vert2,_vert3) \ (t)->cba = (_cba), (t)->tsb = (_tsb), \ (t)->u0 = (_u0), (t)->v0 = (_v0), \ (t)->u1 = (_u1), (t)->v1 = (_v1), \ (t)->u2 = (_u2), (t)->v2 = (_v2), \ (t)->u3 = (_u3), (t)->v3 = (_v3), \ (t)->norm0 = (_norm0), (t)->norm1 = (_norm1), \ (t)->norm2 = (_norm2), (t)->norm3 = (_norm3), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 3 olen 4 { u_char r0, g0, b0, mode2; u_short vert0, vert1; u_short vert2, pad; } TMD_F_3_NL; #define setTMD_F_3_NL(t,_r,_g,_b,_vert0,_vert1,_vert2) \ (t)->mode2 = F_3_NL, \ (t)->r0 = (_r), (t)->g0 = (_g), (t)->b0 = (_b), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) typedef struct // ilen 6 olen 7 { u_char u0, v0; u_short cba; u_char u1, v1; u_short tsb; u_char u2, v2; u_short pad0; u_char r0, g0, b0, pad1; u_short vert0, vert1; u_short vert2, pad2; } TMD_F_3T_NL; #define setTMD_F_3T_NL(t,_cba,_tsb,_u0,_v0,_u1,_v1,_u2,_v2,_r,_g,_b,_vert0,_vert1,_vert2) \ (t)->cba = (_cba), (t)->tsb = (_tsb), \ (t)->u0 = (_u0), (t)->v0 = (_v0), \ (t)->u1 = (_u1), (t)->v1 = (_v1), \ (t)->u2 = (_u2), (t)->v2 = (_v2), \ (t)->r0 = (_r), (t)->g0 = (_g), (t)->b0 = (_b), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) typedef struct // ilen 5 olen 6 { u_char r0, g0, b0, mode2; u_char r1, g1, b1, pad0; u_char r2, g2, b2, pad1; u_short vert0, vert1; u_short vert2, pad2; } TMD_G_3_NL; #define setTMD_G_3_NL(t,_r0,_g0,_b0,_r1,_g1,_b1,_r2,_g2,_b2,_vert0,_vert1,_vert2) \ (t)->mode2 = G_3_NL, \ (t)->r0 = (_r0), (t)->g0 = (_g0), (t)->b0 = (_b0), \ (t)->r1 = (_r1), (t)->g1 = (_g1), (t)->b1 = (_b1), \ (t)->r2 = (_r2), (t)->g2 = (_g2), (t)->b2 = (_b2), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) typedef struct // ilen 8 olen 9 { u_char u0, v0; u_short cba; u_char u1, v1; u_short tsb; u_char u2, v2; u_short pad0; u_char r0, g0, b0, pad1; u_char r1, g1, b1, pad2; u_char r2, g2, b2, pad3; u_short vert0, vert1; u_short vert2, pad4; } TMD_G_3T_NL; #define setTMD_G_3T_NL(t,_cba,_tsb,_u0,_v0,_u1,_v1,_u2,_v2,_r0,_g0,_b0,_r1,_g1,_b1,_r2,_g2,_b2,_vert0,_vert1,_vert2) \ (t)->cba = (_cba), (t)->tsb = (_tsb), \ (t)->u0 = (_u0), (t)->v0 = (_v0), \ (t)->u1 = (_u1), (t)->v1 = (_v1), \ (t)->u2 = (_u2), (t)->v2 = (_v2), \ (t)->r0 = (_r0), (t)->g0 = (_g0), (t)->b0 = (_b0), \ (t)->r1 = (_r1), (t)->g1 = (_g1), (t)->b1 = (_b1), \ (t)->r2 = (_r2), (t)->g2 = (_g2), (t)->b2 = (_b2), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), (t)->vert2 = (_vert2) typedef struct // ilen 3 olen 5 { u_char r0, g0, b0, mode2; u_short vert0, vert1; u_short vert2, vert3; } TMD_F_4_NL; #define setTMD_F_4_NL(t,_r,_g,_b,_vert0,_vert1,_vert2,_vert3) \ (t)->mode2 = F_4_NL, \ (t)->r0 = (_r), (t)->g0 = (_g), (t)->b0 = (_b), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 7 olen 9 { u_char u0, v0; u_short cba; u_char u1, v1; u_short tsb; u_char u2, v2; u_short pad0; u_char u3, v3; u_short pad1; u_char r0, g0, b0, pad2; u_short vert0, vert1; u_short vert2, vert3; } TMD_F_4T_NL; #define setTMD_F_4T_NL(t,_cba,_tsb,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3,_r,_g,_b,_vert0,_vert1,_vert2,_vert3) \ (t)->cba = (_cba), (t)->tsb = (_tsb), \ (t)->u0 = (_u0), (t)->v0 = (_v0), \ (t)->u1 = (_u1), (t)->v1 = (_v1), \ (t)->u2 = (_u2), (t)->v2 = (_v2), \ (t)->u3 = (_u3), (t)->v3 = (_v3), \ (t)->r0 = (_r), (t)->g0 = (_g), (t)->b0 = (_b), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 6 olen 8 { u_char r0, g0, b0, mode2; u_char r1, g1, b1, pad0; u_char r2, g2, b2, pad1; u_char r3, g3, b3, pad2; u_short vert0, vert1; u_short vert2, vert3; } TMD_G_4_NL; #define setTMD_G_4_NL(t,_r0,_g0,_b0,_r1,_g1,_b1,_r2,_g2,_b2,_r3,_g3,_b3,_vert0,_vert1,_vert2,_vert3) \ (t)->mode2 = G_4_NL, \ (t)->r0 = (_r0), (t)->g0 = (_g0), (t)->b0 = (_b0), \ (t)->r1 = (_r1), (t)->g1 = (_g1), (t)->b1 = (_b1), \ (t)->r2 = (_r2), (t)->g2 = (_g2), (t)->b2 = (_b2), \ (t)->r3 = (_r3), (t)->g3 = (_g3), (t)->b3 = (_b3), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 10 olen 12 { u_char u0, v0; u_short cba; u_char u1, v1; u_short tsb; u_char u2, v2; u_short pad0; u_char u3, v3; u_short pad1; u_char r0, g0, b0, pad2; u_char r1, g1, b1, pad3; u_char r2, g2, b2, pad4; u_char r3, g3, b3, pad5; u_short vert0, vert1; u_short vert2, vert3; } TMD_G_4T_NL; #define setTMD_G_4T_NL(t,_cba,_tsb,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3,_r0,_g0,_b0,_r1,_g1,_b1,_r2,_g2,_b2,_r3,_g3,_b3,_vert0,_vert1,_vert2,_vert3) \ (t)->cba = (_cba), (t)->tsb = (_tsb), \ (t)->u0 = (_u0), (t)->v0 = (_v0), \ (t)->u1 = (_u1), (t)->v1 = (_v1), \ (t)->u2 = (_u2), (t)->v2 = (_v2), \ (t)->u3 = (_u3), (t)->v3 = (_v3), \ (t)->r0 = (_r0), (t)->g0 = (_g0), (t)->b0 = (_b0), \ (t)->r1 = (_r1), (t)->g1 = (_g1), (t)->b1 = (_b1), \ (t)->r2 = (_r2), (t)->g2 = (_g2), (t)->b2 = (_b2), \ (t)->r3 = (_r3), (t)->g3 = (_g3), (t)->b3 = (_b3), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1), \ (t)->vert2 = (_vert2), (t)->vert3 = (_vert3) typedef struct // ilen 2 olen 3 { u_char r0, g0, b0, mode2; u_short vert0, vert1; } TMD_SL; #define setTMD_SL(t,_r,_g,_b,_vert0,_vert1) \ (t)->mode2 = SL, \ (t)->r0 = (_r), (t)->g0 = (_g), (t)->b0 = (_b), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1) typedef struct // ilen 3 olen 4 { u_char r0, g0, b0, mode2; u_char r1, g1, b1, pad; u_short vert0, vert1; } TMD_SL_G; #define setTMD_SL_G(t,_r0,_g0,_b0,_r1,_g1,_b1,_vert0,_vert1) \ (t)->mode2 = SL_G, \ (t)->r0 = (_r0), (t)->g0 = (_g0), (t)->b0 = (_b0), \ (t)->r1 = (_r1), (t)->g1 = (_g1), (t)->b1 = (_b1), \ (t)->vert0 = (_vert0), (t)->vert1 = (_vert1) #endif