PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
draw3d.h File Reference
#include <tamtypes.h>
#include <draw_primitives.h>
#include <draw_types.h>
#include <gif_tags.h>
+ Include dependency graph for draw3d.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DRAW_XYZ_REGLIST
 
#define DRAW_RGBAQ_REGLIST
 
#define DRAW_UV_REGLIST
 
#define DRAW_RGBAQ_UV_REGLIST
 
#define DRAW_STQ_REGLIST
 
#define DRAW_STQ2_REGLIST
 

Functions

qword_t * draw_prim_start (qword_t *q, int context, prim_t *prim, color_t *color)
 
qword_t * draw_prim_end (qword_t *q, int nreg, u64 reglist)
 
int draw_convert_rgbq (color_t *output, int count, vertex_f_t *vertices, color_f_t *colours, unsigned char alpha)
 
int draw_convert_rgbaq (color_t *output, int count, vertex_f_t *vertices, color_f_t *colours)
 
int draw_convert_st (texel_t *output, int count, vertex_f_t *vertices, texel_f_t *coords)
 
int draw_convert_xyz (xyz_t *output, float x, float y, int z, int count, vertex_f_t *vertices)
 

Detailed Description

Draw library 3D functions

Definition in file draw3d.h.

Macro Definition Documentation

◆ DRAW_XYZ_REGLIST

#define DRAW_XYZ_REGLIST
Value:
((u64)GIF_REG_XYZ2) << 0 | \
((u64)GIF_REG_XYZ2) << 4
#define GIF_REG_XYZ2
Definition gif_tags.h:52

Register lists

Definition at line 16 of file draw3d.h.

◆ DRAW_RGBAQ_REGLIST

#define DRAW_RGBAQ_REGLIST
Value:
((u64)GIF_REG_RGBAQ) << 0 | \
((u64)GIF_REG_XYZ2) << 4
#define GIF_REG_RGBAQ
Definition gif_tags.h:44

Definition at line 20 of file draw3d.h.

◆ DRAW_UV_REGLIST

#define DRAW_UV_REGLIST
Value:
((u64)GIF_REG_UV) << 0 | \
((u64)GIF_REG_XYZ2) << 4
#define GIF_REG_UV
Definition gif_tags.h:48

Definition at line 24 of file draw3d.h.

◆ DRAW_RGBAQ_UV_REGLIST

#define DRAW_RGBAQ_UV_REGLIST
Value:
((u64)GIF_REG_RGBAQ) << 0 | \
((u64)GIF_REG_UV) << 4 | \
((u64)GIF_REG_XYZ2) << 8

Definition at line 28 of file draw3d.h.

◆ DRAW_STQ_REGLIST

#define DRAW_STQ_REGLIST
Value:
((u64)GIF_REG_RGBAQ) << 0 | \
((u64)GIF_REG_ST) << 4 | \
((u64)GIF_REG_XYZ2) << 8
#define GIF_REG_ST
Definition gif_tags.h:46

Definition at line 33 of file draw3d.h.

◆ DRAW_STQ2_REGLIST

#define DRAW_STQ2_REGLIST
Value:
((u64)GIF_REG_ST) << 0 | \
((u64)GIF_REG_RGBAQ) << 4 | \
((u64)GIF_REG_XYZ2) << 8

Sandro: Similar to DRAW_STQ_REGLIST, but order of ST and RGBAQ is swapped. Needed for REGLIST mode which is used mostly in VU1, because of nature of 128bit registers. Without that, texture perspective correction will not work. Bad example:

  1. RGBA -> RGBAQ (q was not set!)
  2. STQ -> ST
  3. XYZ2 Good example:
  1. STQ -> ST
  2. RGBA -> RGBAQ (q grabbed from STQ)
  3. XYZ2 For more details, please check: EE_Overview_Manual.pdf - 3.3 Data transfer to GS GS_Users_Manual.pdf - 3.4.10 Perspective correction

Definition at line 55 of file draw3d.h.

Function Documentation

◆ draw_prim_start()

qword_t * draw_prim_start ( qword_t *  q,
int  context,
prim_t prim,
color_t *  color 
)

Begins a primitive, allowing for vertex data to be filled in the packet directly

Definition at line 11 of file draw3d.c.

References draw_prim_start(), GIF_FLG_PACKED, GIF_REG_AD, GIF_REG_RGBAQ, and GS_REG_PRIM.

Referenced by draw_prim_start(), fontstudio_print_string(), fontx_print_ascii(), and fontx_print_sjis().

◆ draw_prim_end()

qword_t * draw_prim_end ( qword_t *  q,
int  nreg,
u64  reglist 
)

Ends a primitive by calculating the number of qwords used, the number of registers, the register list

Definition at line 33 of file draw3d.c.

References draw_prim_end(), and GIF_FLG_REGLIST.

Referenced by draw_prim_end(), fontstudio_print_string(), fontx_print_ascii(), and fontx_print_sjis().

◆ draw_convert_rgbq()

int draw_convert_rgbq ( color_t *  output,
int  count,
vertex_f_t *  vertices,
color_f_t *  colours,
unsigned char  alpha 
)

Converts floating point color, replacing alpha with constant value, and calculates q

Definition at line 56 of file draw3d.c.

References count, and draw_convert_rgbq().

Referenced by draw_convert_rgbq().

◆ draw_convert_rgbaq()

int draw_convert_rgbaq ( color_t *  output,
int  count,
vertex_f_t *  vertices,
color_f_t *  colours 
)

Converts floating point color and calculates q value

Definition at line 88 of file draw3d.c.

References count, and draw_convert_rgbaq().

Referenced by draw_convert_rgbaq().

◆ draw_convert_st()

int draw_convert_st ( texel_t *  output,
int  count,
vertex_f_t *  vertices,
texel_f_t *  coords 
)

Calculates the st coordinates from the perspective coordinate q = 1/w

Definition at line 120 of file draw3d.c.

References count, and draw_convert_st().

Referenced by draw_convert_st().

◆ draw_convert_xyz()

int draw_convert_xyz ( xyz_t *  output,
float  x,
float  y,
int  z,
int  count,
vertex_f_t *  vertices 
)

Converts and translates floating point vertices to fixed point vertices

Definition at line 147 of file draw3d.c.

References count, and draw_convert_xyz().

Referenced by draw_convert_xyz().