sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
gsPrimitive.h
Go to the documentation of this file.
1
5// ____ ___ | / _____ _____
6// | __ | |___/ | |
7// |___| ___| | \ __|__ | gsKit Open Source Project.
8// ----------------------------------------------------------------------
9// Copyright 2004 - Chris "Neovanglist" Gilbert <Neovanglist@LainOS.org>
10// Licenced under Academic Free License version 2.0
11// Review gsKit README & LICENSE files for further details.
12//
13// gsPrimitive.h - Header for gsPrimitive.c
14//
15// Parts taken from emoon's BreakPoint Demo Library
16//
17
18#ifndef __GSPRIMITIVE_H__
19#define __GSPRIMITIVE_H__
20
21#include "gsKit.h"
22
23#define GS_SETREG_PRIM(prim, iip, tme, fge, abe, aa1, fst, ctxt, fix) \
24 ((u64)(prim) | ((u64)(iip) << 3) | ((u64)(tme) << 4) | \
25 ((u64)(fge) << 5) | ((u64)(abe) << 6) | ((u64)(aa1) << 7) | \
26 ((u64)(fst) << 8) | ((u64)(ctxt) << 9) | ((u64)(fix) << 10))
27
28#define GS_SETREG_PRMODE(iip, tme, fge, abe, aa1, fst, ctxt, fix) \
29 (((u64)(iip) << 3) | ((u64)(tme) << 4) | \
30 ((u64)(fge) << 5) | ((u64)(abe) << 6) | ((u64)(aa1) << 7) | \
31 ((u64)(fst) << 8) | ((u64)(ctxt) << 9) | ((u64)(fix) << 10))
32
33#define GS_SETREG_PRMODECONT(ac) ((u64)(ac))
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39void gsKit_prim_point(GSGLOBAL *gsGlobal, float x, float y, int iz, u64 color);
40void gsKit_prim_list_points(GSGLOBAL *gsGlobal, int count, const GSPRIMPOINT *vertices);
41
42void gsKit_prim_line_3d(GSGLOBAL *gsGlobal, float x1, float y1, int iz1,
43 float x2, float y2, int iz2, u64 color);
44
45void gsKit_prim_line_goraud_3d(GSGLOBAL *gsGlobal, float x1, float y1, int iz1, float x2, float y2, int iz2, u64 color1, u64 color2);
46void gsKit_prim_list_line_goraud_3d(GSGLOBAL *gsGlobal, int count, const GSPRIMPOINT *vertices);
47
48void gsKit_prim_line_strip(GSGLOBAL *gsGlobal, float *LineStrip, int segments, int iz, u64 color);
49
50void gsKit_prim_line_strip_3d(GSGLOBAL *gsGlobal, float *LineStrip, int segments, u64 color);
51
52void gsKit_prim_sprite(GSGLOBAL *gsGlobal, float x1, float y1, float x2, float y2, int iz, u64 color);
53void gsKit_prim_list_sprite_gouraud_3d(GSGLOBAL *gsGlobal, int count, const GSPRIMPOINT *vertices);
54void gsKit_prim_list_sprite_flat(GSGLOBAL *gsGlobal, int count, const u128 *flatContent);
55void gsKit_prim_list_sprite_flat_color(GSGLOBAL *gsGlobal, gs_rgbaq color, int count, const gs_xyz2 *vertices);
56
57void gsKit_prim_triangle_3d(GSGLOBAL *gsGlobal, float x1, float y1, int iz1,
58 float x2, float y2, int iz2,
59 float x3, float y3, int iz3, u64 color);
60
61void gsKit_prim_triangle_strip(GSGLOBAL *gsGlobal, float *TriStrip, int segments, int iz, u64 color);
62
63void gsKit_prim_triangle_strip_3d(GSGLOBAL *gsGlobal, float *TriStrip, int segments, u64 color);
64
65void gsKit_prim_triangle_fan(GSGLOBAL *gsGlobal, float *TriFan, int verticies, int iz, u64 color);
66
67void gsKit_prim_triangle_fan_3d(GSGLOBAL *gsGlobal, float *TriFan, int verticies, u64 color);
68
69void gsKit_prim_triangle_gouraud_3d(GSGLOBAL *gsGlobal, float x1, float y1, int iz1,
70 float x2, float y2, int iz2,
71 float x3, float y3, int iz3,
72 u64 color1, u64 color2, u64 color3);
73
74void gsKit_prim_list_triangle_gouraud_3d(GSGLOBAL *gsGlobal, int count, const GSPRIMPOINT *vertices);
75
76void gsKit_prim_quad_3d(GSGLOBAL *gsGlobal, float x1, float y1, int iz1,
77 float x2, float y2, int iz2,
78 float x3, float y3, int iz3,
79 float x4, float y4, int iz4, u64 color);
80
81void gsKit_prim_quad_gouraud_3d(GSGLOBAL *gsGlobal, float x1, float y1, int iz1,
82 float x2, float y2, int iz2,
83 float x3, float y3, int iz3,
84 float x4, float y4, int iz4,
85 u64 color1, u64 color2,
86 u64 color3, u64 color4);
87
88
89#define gsKit_prim_line(gsGlobal, x1, y1, \
90 x2, y2, \
91 z, color) \
92 gsKit_prim_line_3d(gsGlobal, x1, y1, z, \
93 x2, y2, z, color);
94
95#define gsKit_prim_line_goraud(gsGlobal, x1, y1, \
96 x2, y2, \
97 z, color1, color2) \
98 gsKit_prim_line_goraud_3d(gsGlobal, x1, y1, z, \
99 x2, y2, z, color1, color2);
100
101#define gsKit_prim_triangle(gsGlobal, x1, y1, \
102 x2, y2, \
103 x3, y3, \
104 z, color) \
105 gsKit_prim_triangle_3d(gsGlobal, x1, y1, z, \
106 x2, y2, z, \
107 x3, y3, z, color);
108
109#define gsKit_prim_triangle_gouraud(gsGlobal, x1, y1, \
110 x2, y2, \
111 x3, y3, z, \
112 color1, color2, color3) \
113 gsKit_prim_triangle_gouraud_3d(gsGlobal, x1, y1, z, \
114 x2, y2, z, \
115 x3, y3, z, \
116 color1, color2, color3); \
117
118#define gsKit_prim_quad(gsGlobal, x1, y1, \
119 x2, y2, \
120 x3, y3, \
121 x4, y4, \
122 z, color) \
123 gsKit_prim_quad_3d(gsGlobal, x1, y1, z, \
124 x2, y2, z, \
125 x3, y3, z, \
126 x4, y4, z, color);
127
128#define gsKit_prim_quad_gouraud(gsGlobal, x1, y1, \
129 x2, y2, \
130 x3, y3, \
131 x4, y4, \
132 z, color1, color2, color3, color4) \
133 gsKit_prim_quad_gouraud_3d(gsGlobal, x1, y1, z, \
134 x2, y2, z, \
135 x3, y3, z, \
136 x4, y4, z, \
137 color1, color2, color3, color4);
138
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif /* __GSPRIMITIVE_H__ */