ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
draw_environment.c
Go to the documentation of this file.
1 #include <tamtypes.h>
2 
3 #include <gif_tags.h>
4 #include <gs_gp.h>
5 
6 #include <draw.h>
7 
9 {
10 
12  q++;
13  PACK_GIFTAG(q, GS_SET_PABE(enable), GS_REG_PABE);
14  q++;
15 
16  return q;
17 
18 }
19 
21 {
22 
24  q++;
25  PACK_GIFTAG(q, GS_SET_ALPHA(blend->color1,blend->color2,blend->alpha,
26  blend->color3,blend->fixed_alpha), GS_REG_ALPHA + context);
27  q++;
28 
29  return q;
30 
31 }
32 
34 {
35 
37  q++;
38  PACK_GIFTAG(q, GS_SET_FRAME(frame->address>>11,frame->width>>6,frame->psm,frame->mask), GS_REG_FRAME + context);
39  q++;
40 
41  return q;
42 
43 }
44 
46 {
47 
49  q++;
50  PACK_GIFTAG(q, GS_SET_ZBUF(zbuffer->address>>11,zbuffer->zsm,zbuffer->mask), GS_REG_ZBUF + context);
51  q++;
52 
53  return q;
54 
55 }
56 
58 {
59 
61  {
62  clut->start = 0;
63  }
64 
66  q++;
67 
68  PACK_GIFTAG(q, GS_SET_TEX0(texture->address>>6,texture->width>>6,texture->psm,
69  texture->info.width,texture->info.height,texture->info.components,texture->info.function,
71  q++;
72 
73  return q;
74 
75 }
76 
78 {
79 
81  {
82  clut->start = 0;
83  }
84 
86  q++;
87 
89  q++;
90 
91  return q;
92 
93 }
94 
95 qword_t *draw_clut_offset(qword_t *q, int cbw, int u, int v)
96 {
97 
99  q++;
100 
102  q++;
103 
104  return q;
105 
106 }
107 
109 {
110 
112  q++;
113 
114  PACK_GIFTAG(q, GS_SET_DTHE(enable), GS_REG_DTHE);
115  q++;
116 
117  return q;
118 
119 }
120 
122 {
123 
125  q++;
126 
127  PACK_GIFTAG(q, GS_SET_DIMX(dm[0], dm[1], dm[2], dm[3],
128  dm[4], dm[5], dm[6], dm[7],
129  dm[8], dm[9], dm[10],dm[11],
130  dm[12],dm[13],dm[14],dm[15]), GS_REG_DIMX);
131  q++;
132 
133  return q;
134 
135 }
136 
137 qword_t *draw_fog_color(qword_t *q, unsigned char r, unsigned char g, unsigned char b)
138 {
139 
141  q++;
142 
144  q++;
145 
146  return q;
147 
148 }
149 
151 {
152 
154  q++;
155 
157  q++;
158 
159  return q;
160 
161 }
162 
164 {
165 
167  q++;
168 
170  q++;
171 
172  return q;
173 
174 }
175 
177 {
178 
180  q++;
181 
183  q++;
184 
185  return q;
186 
187 }
188 
190 {
191 
193  q++;
194 
195  PACK_GIFTAG(q, GS_SET_XYOFFSET((int)(x*16.0f),(int)(y*16.0f)), GS_REG_XYOFFSET + context);
196  q++;
197 
198  return q;
199 
200 }
201 
203 {
204 
206  q++;
207 
209  q++;
210 
211  return q;
212 
213 }
214 
216 {
217 
219  q++;
220 
224  q++;
225 
226  return q;
227 
228 }
229 
231 {
232 
234  q++;
235 
237  q++;
238 
239  return q;
240 
241 }
242 
244 {
245 
247  q++;
248 
249  PACK_GIFTAG(q, GS_SET_MIPTBP1(mipmap->address1,mipmap->width1,
250  mipmap->address2,mipmap->width2,
251  mipmap->address3,mipmap->width3), GS_REG_MIPTBP1 + context);
252  q++;
253 
254  return q;
255 
256 }
257 
259 {
260 
262  q++;
263 
264  PACK_GIFTAG(q, GS_SET_MIPTBP2(mipmap->address1,mipmap->width1,
265  mipmap->address2,mipmap->width2,
266  mipmap->address3,mipmap->width3), GS_REG_MIPTBP2 + context);
267  q++;
268 
269  return q;
270 
271 }
272 
273 qword_t *draw_scissor_area(qword_t *q, int context, int x0, int x1, int y0, int y1)
274 {
275 
277  q++;
278 
279  PACK_GIFTAG(q, GS_SET_SCISSOR(x0,x1,y0,y1), GS_REG_SCISSOR + context);
280  q++;
281 
282  return q;
283 
284 }
285 
286 qword_t *draw_pixel_test(qword_t *q, int context, atest_t *atest, dtest_t *dtest, ztest_t *ztest)
287 {
288 
290  q++;
291 
292  PACK_GIFTAG(q, GS_SET_TEST(atest->enable,atest->method,atest->compval,atest->keep,
293  dtest->enable,dtest->pass,
294  ztest->enable,ztest->method), GS_REG_TEST + context);
295  q++;
296 
297  return q;
298 
299 }
300 
302 {
303 
305  q++;
306 
307  PACK_GIFTAG(q, GS_SET_CLAMP(wrap->horizontal,wrap->vertical,wrap->minu,
308  wrap->maxu,wrap->minv,wrap->maxv), GS_REG_CLAMP + context);
309  q++;
310 
311  return q;
312 
313 }
314 
315 qword_t *draw_texture_expand_alpha(qword_t *q, unsigned char zero_value, int expand, unsigned char one_value)
316 {
317 
319  q++;
320 
321  PACK_GIFTAG(q, GS_SET_TEXA(zero_value,expand,one_value), GS_REG_TEXA);
322  q++;
323 
324  return q;
325 
326 }
lod_t lod
Definition: main.c:86
prim_t prim
Definition: main.c:74
u8 context
Definition: main.c:71
clutbuffer_t clut
Definition: main.c:80
#define CLUT_STORAGE_MODE2
Definition: draw_buffers.h:23
qword_t * draw_pixel_alpha_control(qword_t *q, int enable)
qword_t * draw_primitive_override_setting(qword_t *q, int context, prim_t *prim)
qword_t * draw_clut_offset(qword_t *q, int cbw, int u, int v)
qword_t * draw_dithering(qword_t *q, int enable)
qword_t * draw_alpha_blending(qword_t *q, int context, blend_t *blend)
qword_t * draw_dither_matrix(qword_t *q, char *dm)
qword_t * draw_texture_sampling(qword_t *q, int context, lod_t *lod)
qword_t * draw_texture_expand_alpha(qword_t *q, unsigned char zero_value, int expand, unsigned char one_value)
qword_t * draw_mipmap1(qword_t *q, int context, mipmap_t *mipmap)
qword_t * draw_texture_wrapping(qword_t *q, int context, texwrap_t *wrap)
qword_t * draw_zbuffer(qword_t *q, int context, zbuffer_t *zbuffer)
qword_t * draw_primitive_override(qword_t *q, int mode)
qword_t * draw_mipmap2(qword_t *q, int context, mipmap_t *mipmap)
qword_t * draw_clutbuffer(qword_t *q, int context, int psm, clutbuffer_t *clut)
qword_t * draw_scissor_area(qword_t *q, int context, int x0, int x1, int y0, int y1)
qword_t * draw_texturebuffer(qword_t *q, int context, texbuffer_t *texture, clutbuffer_t *clut)
qword_t * draw_framebuffer(qword_t *q, int context, framebuffer_t *frame)
qword_t * draw_scan_masking(qword_t *q, int mask)
qword_t * draw_pixel_test(qword_t *q, int context, atest_t *atest, dtest_t *dtest, ztest_t *ztest)
qword_t * draw_primitive_xyoffset(qword_t *q, int context, float x, float y)
qword_t * draw_color_clamping(qword_t *q, int enable)
qword_t * draw_alpha_correction(qword_t *q, int context, int alpha)
qword_t * draw_fog_color(qword_t *q, unsigned char r, unsigned char g, unsigned char b)
#define PACK_GIFTAG(Q, D0, D1)
Definition: gif_tags.h:76
#define GIF_SET_TAG(NLOOP, EOP, PRE, PRIM, FLG, NREG)
Definition: gif_tags.h:80
#define GIF_REG_AD
Definition: gif_tags.h:72
#define GIF_FLG_PACKED
Definition: gif_tags.h:35
#define GS_SET_TEXA(A0, AM, A1)
Definition: gs_gp.h:300
#define GS_SET_PRMODECONT(CTRL)
Definition: gs_gp.h:250
#define GS_REG_SCANMSK
Definition: gs_gp.h:67
#define GS_REG_SCISSOR
Definition: gs_gp.h:87
#define GS_REG_DTHE
Definition: gs_gp.h:101
#define GS_REG_ZBUF
Definition: gs_gp.h:125
#define GS_SET_TEXCLUT(CBW, CU, CV)
Definition: gs_gp.h:304
#define GS_SET_TEX2(PSM, CBA, CPSM, CSM, CSA, CLD)
Definition: gs_gp.h:295
#define GS_REG_PRMODECONT
Definition: gs_gp.h:61
#define GS_SET_DTHE(ENABLE)
Definition: gs_gp.h:197
#define GS_REG_TEX1
Definition: gs_gp.h:43
#define GS_SET_DIMX(D00, D01, D02, D03, D10, D11, D12, D13, D20, D21, D22, D23, D30, D31, D32, D33)
Definition: gs_gp.h:187
#define GS_REG_MIPTBP2
Definition: gs_gp.h:75
#define GS_REG_FBA
Definition: gs_gp.h:113
#define GS_SET_PRMODE(IIP, TME, FGE, ABE, AA1, FST, CTXT, FIX)
Definition: gs_gp.h:244
#define GS_SET_MIPTBP2(TBA4, TBW4, TBA5, TBW5, TBA6, TBW6)
Definition: gs_gp.h:228
#define GS_SET_XYOFFSET(X, Y)
Definition: gs_gp.h:323
#define GS_SET_COLCLAMP(CLAMP)
Definition: gs_gp.h:185
#define GS_REG_TEXCLUT
Definition: gs_gp.h:65
#define GS_SET_TEX0(TBA, TBW, PSM, TW, TH, TCC, TFNCT, CBA, CPSM, CSM, CSA, CLD)
Definition: gs_gp.h:281
#define GS_REG_TEXA
Definition: gs_gp.h:81
#define GS_REG_TEX2
Definition: gs_gp.h:49
#define GS_SET_FRAME(FBA, FBW, PSM, FMSK)
Definition: gs_gp.h:209
#define GS_REG_CLAMP
Definition: gs_gp.h:31
#define GS_REG_TEST
Definition: gs_gp.h:105
#define GS_REG_DIMX
Definition: gs_gp.h:99
#define GS_SET_ZBUF(ZBA, ZSM, ZMSK)
Definition: gs_gp.h:334
#define GS_SET_SCISSOR(X0, X1, Y0, Y1)
Definition: gs_gp.h:259
#define GS_SET_TEST(ATEN, ATMETH, ATREF, ATFAIL, DATEN, DATMD, ZTEN, ZTMETH)
Definition: gs_gp.h:269
#define GS_SET_FOGCOL(R, G, B)
Definition: gs_gp.h:205
#define GS_SET_CLAMP(WMS, WMT, MINU, MAXU, MINV, MAXV)
Definition: gs_gp.h:180
#define GS_REG_FOGCOL
Definition: gs_gp.h:83
#define GS_REG_XYOFFSET
Definition: gs_gp.h:55
#define GS_REG_MIPTBP1
Definition: gs_gp.h:69
#define GS_REG_PABE
Definition: gs_gp.h:111
#define GS_REG_TEX0
Definition: gs_gp.h:25
#define GS_SET_PABE(ENABLE)
Definition: gs_gp.h:235
#define GS_REG_COLCLAMP
Definition: gs_gp.h:103
#define GS_REG_PRMODE
Definition: gs_gp.h:63
#define GS_REG_FRAME
Definition: gs_gp.h:119
#define GS_SET_ALPHA(A, B, C, D, ALPHA)
Definition: gs_gp.h:170
#define GS_SET_FBA(ALPHA)
Definition: gs_gp.h:199
#define GS_SET_TEX1(LCM, MXL, MMAG, MMIN, MTBA, L, K)
Definition: gs_gp.h:289
#define GS_SET_SCANMSK(MSK)
Definition: gs_gp.h:257
#define GS_REG_ALPHA
Definition: gs_gp.h:93
#define GS_SET_MIPTBP1(TBA1, TBW1, TBA2, TBW2, TBA3, TBW3)
Definition: gs_gp.h:223
s32 x
Definition: libmouse.c:34
s32 y
Definition: libmouse.c:34
s32 mode
Definition: rpc_client.c:15
unsigned char compval
Definition: draw_tests.h:40
unsigned char enable
Definition: draw_tests.h:38
unsigned char method
Definition: draw_tests.h:39
unsigned char keep
Definition: draw_tests.h:41
char alpha
Definition: draw_blending.h:29
unsigned char fixed_alpha
Definition: draw_blending.h:31
char color3
Definition: draw_blending.h:30
char color2
Definition: draw_blending.h:28
char color1
Definition: draw_blending.h:27
unsigned int load_method
Definition: draw_buffers.h:68
unsigned int start
Definition: draw_buffers.h:67
unsigned int storage_mode
Definition: draw_buffers.h:66
unsigned int psm
Definition: draw_buffers.h:65
unsigned int address
Definition: draw_buffers.h:64
unsigned char pass
Definition: draw_tests.h:46
unsigned char enable
Definition: draw_tests.h:45
unsigned int address
Definition: draw_buffers.h:41
unsigned int psm
Definition: draw_buffers.h:44
unsigned int mask
Definition: draw_buffers.h:45
unsigned int width
Definition: draw_buffers.h:42
unsigned char mag_filter
Definition: draw_sampling.h:42
float k
Definition: draw_sampling.h:46
unsigned char l
Definition: draw_sampling.h:45
unsigned char calculation
Definition: draw_sampling.h:40
unsigned char mipmap_select
Definition: draw_sampling.h:44
unsigned char min_filter
Definition: draw_sampling.h:43
unsigned char max_level
Definition: draw_sampling.h:41
char width3
Definition: draw_sampling.h:55
int address1
Definition: draw_sampling.h:50
char width2
Definition: draw_sampling.h:54
char width1
Definition: draw_sampling.h:53
int address2
Definition: draw_sampling.h:51
int address3
Definition: draw_sampling.h:52
unsigned char blending
unsigned char antialiasing
unsigned char colorfix
unsigned char shading
unsigned char fogging
unsigned char mapping_type
unsigned char mapping
unsigned int address
Definition: draw_buffers.h:57
unsigned int width
Definition: draw_buffers.h:58
unsigned int psm
Definition: draw_buffers.h:59
texinfo_t info
Definition: draw_buffers.h:60
unsigned char height
Definition: draw_buffers.h:35
unsigned char function
Definition: draw_buffers.h:37
unsigned char components
Definition: draw_buffers.h:36
unsigned char width
Definition: draw_buffers.h:34
unsigned char vertical
Definition: draw_sampling.h:60
unsigned char horizontal
Definition: draw_sampling.h:59
unsigned int mask
Definition: draw_buffers.h:53
unsigned int address
Definition: draw_buffers.h:51
unsigned int zsm
Definition: draw_buffers.h:52
unsigned char method
Definition: draw_tests.h:51
unsigned char enable
Definition: draw_tests.h:50