ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
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 {
20  struct {
21  u16 x;
22  u16 y;
23  u32 z;
24  };
25 } __attribute__((packed,aligned(8))) xyz_t;
26 
27 typedef union {
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 {
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 {
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 {
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 {
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__ */
float VECTOR[4]
Definition: math3d.h:21
float y
Definition: draw_types.h:53
unsigned int z
Definition: draw_types.h:54
float x
Definition: draw_types.h:52
unsigned int u32
Definition: tamtypes.h:30
unsigned short u16
Definition: tamtypes.h:24
unsigned char u8
Definition: tamtypes.h:23
unsigned long u64
Definition: tamtypes.h:34
VECTOR rgba
Definition: draw_types.h:68
float g
Definition: draw_types.h:71
float r
Definition: draw_types.h:70
float b
Definition: draw_types.h:72
float a
Definition: draw_types.h:73
float q
Definition: draw_types.h:46
u64 rgbaq
Definition: draw_types.h:40
float t
Definition: draw_types.h:61
float q
Definition: draw_types.h:63
float s
Definition: draw_types.h:60
float r
Definition: draw_types.h:62
VECTOR strq
Definition: draw_types.h:58
float u
Definition: draw_types.h:34
float t
Definition: draw_types.h:31
float s
Definition: draw_types.h:30
u64 uv
Definition: draw_types.h:28
float v
Definition: draw_types.h:35
VECTOR xyzw
Definition: draw_types.h:78
float y
Definition: draw_types.h:81
float z
Definition: draw_types.h:82
float w
Definition: draw_types.h:83
float x
Definition: draw_types.h:80
u32 z
Definition: draw_types.h:23
u64 xyz
Definition: draw_types.h:19
u16 y
Definition: draw_types.h:22
u16 x
Definition: draw_types.h:21