PS2SDK
PS2 Homebrew Libraries
draw_types.h
Go to the documentation of this file.
1 
6 #ifndef __DRAW_TYPES_H__
7 #define __DRAW_TYPES_H__
8 
9 #include <math3d.h>
10 
11 #ifdef ftoi4
12  #undef ftoi4
13  #define ftoi4(F) ((int)(((float)F)*16.0f))
14 #else
15  #define ftoi4(F) ((int)(((float)F)*16.0f))
16 #endif
17 
18 typedef union {
19  u64 xyz;
20  struct {
21  u16 x;
22  u16 y;
23  u32 z;
24  };
25 } __attribute__((packed,aligned(8))) xyz_t;
26 
27 typedef union {
28  u64 uv;
29  struct {
30  float s;
31  float t;
32  };
33  struct {
34  float u;
35  float v;
36  };
37 } __attribute__((packed,aligned(8))) texel_t;
38 
39 typedef union {
40  u64 rgbaq;
41  struct {
42  u8 r;
43  u8 g;
44  u8 b;
45  u8 a;
46  float q;
47  };
48 } __attribute__((packed,aligned(8))) color_t;
49 
50 // Using shorts complicates things for normal usage
51 typedef struct {
52  float x;
53  float y;
54  unsigned int z;
55 } vertex_t;
56 
57 typedef union {
58  VECTOR strq;
59  struct {
60  float s;
61  float t;
62  float r;
63  float q;
64  };
65 } __attribute__((packed,aligned(16))) texel_f_t;
66 
67 typedef union {
68  VECTOR rgba;
69  struct {
70  float r;
71  float g;
72  float b;
73  float a;
74  };
75 } __attribute__((packed,aligned(16))) color_f_t;
76 
77 typedef union {
78  VECTOR xyzw;
79  struct {
80  float x;
81  float y;
82  float z;
83  float w;
84  };
85 } __attribute__((packed,aligned(16))) vertex_f_t;
86 
87 #endif /* __DRAW_TYPES_H__ */
__attribute__
typedef __attribute__
Definition: tlbfunc.c:60
math3d.h
__attribute__
Definition: gif_registers.h:38
vertex_t
Definition: draw_types.h:51