static.c
6.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*
* Copyright 1995, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
*
* UNPUBLISHED -- Rights reserved under the copyright laws of the United
* States. Use of a copyright notice is precautionary only and does not
* imply publication or disclosure.
*
* U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
* in similar or successor clauses in the FAR, or the DOD or NASA FAR
* Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
* 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
*
* THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
* INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
* DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
* PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
* GRAPHICS, INC.
*
*/
/*
* File: static.c
* Creator: hsa@sgi.com
* Create Date: Tue Oct 31 14:15:44 PST 1995
*
* This file holds tiny display list segments that are 'static' data.
*
*/
#include <ultra64.h>
#include "gtdemo.h"
/*
* Remember, viewport structures have 2 bits of fraction in them.
*/
static Vp vp = {
SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0, /* scale */
SCREEN_WD*2, SCREEN_HT*2, G_MAXZ/2, 0, /* translate */
};
Gfx rspinit_dl[] = {
gsSPViewport(&vp),
gsSPClearGeometryMode(G_SHADE | G_SHADING_SMOOTH | G_CULL_BOTH |
G_FOG | G_LIGHTING | G_TEXTURE_GEN |
G_TEXTURE_GEN_LINEAR | G_LOD | G_ZBUFFER),
gsSPTexture(0, 0, 0, 0, G_OFF),
gsSPSetGeometryMode(G_SHADE | G_SHADING_SMOOTH),
gsSPEndDisplayList(),
};
Gfx rdpinit_dl[] = {
gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, SCREEN_WD, SCREEN_HT),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsDPSetTextureLOD(G_TL_TILE),
gsDPSetTextureLUT(G_TT_NONE),
gsDPSetTextureDetail(G_TD_CLAMP),
gsDPSetTexturePersp(G_TP_PERSP),
gsDPSetTextureFilter(G_TF_BILERP),
gsDPSetTextureConvert(G_TC_FILT),
gsDPSetCombineKey(G_CK_NONE),
gsDPSetAlphaCompare(G_AC_NONE),
gsDPSetRenderMode(G_RM_OPA_SURF, G_RM_OPA_SURF2),
gsDPSetColorDither(G_CD_BAYER),
gsDPSetCycleType(G_CYC_1CYCLE),
gsDPPipeSync(),
gsSPEndDisplayList(),
};
#include "../Texture/RGBA16checkerMM.h"
Gfx floor_setup_dl[] = {
gsDPPipeSync (),
gsSPClearGeometryMode(G_SHADE | G_SHADING_SMOOTH | G_CULL_BOTH |
G_FOG | G_LIGHTING | G_TEXTURE_GEN |
G_TEXTURE_GEN_LINEAR | G_LOD),
gsSPSetGeometryMode(G_ZBUFFER),
gsDPSetTexturePersp(G_TP_PERSP),
gsDPSetTextureFilter(G_TF_BILERP),
gsDPSetRenderMode(G_RM_PASS, G_RM_OPA_SURF2),
gsSPTexture(0x8000, 0x8000, 5, G_TX_RENDERTILE, G_ON),
gsDPSetCombineMode(G_CC_TRILERP, G_CC_DECALRGB2),
gsDPSetTextureDetail (G_TD_CLAMP),
/* set up all the tiles */
gsSPDisplayList(RGBA16checkerMM_dl),
gsDPSetTextureLOD(G_TL_LOD),
gsDPPipelineMode(G_PM_NPRIMITIVE),
gsDPSetCycleType(G_CYC_2CYCLE),
gsSPEndDisplayList(),
};
#define TXT_SHFT 6
static Vtx floor_vtx[25] = {
{ -64, 0, -64, 0, (0 << TXT_SHFT), (0 << TXT_SHFT), 0, 0, 0, 0xff },
{ -32, 0, -64, 0, (31 << TXT_SHFT), (0 << TXT_SHFT), 0, 0, 0, 0xff },
{ 0, 0, -64, 0, (63 << TXT_SHFT), (0 << TXT_SHFT), 0, 0, 0, 0xff },
{ 32, 0, -64, 0, (95 << TXT_SHFT), (0 << TXT_SHFT), 0, 0, 0, 0xff },
{ 64, 0, -64, 0, (127 << TXT_SHFT), (0 << TXT_SHFT), 0, 0, 0, 0xff },
{ -64, 0, -32, 0, (0 << TXT_SHFT), (31 << TXT_SHFT), 0, 0, 0, 0xff },
{ -32, 0, -32, 0, (31 << TXT_SHFT), (31 << TXT_SHFT), 0, 0, 0, 0xff },
{ 0, 0, -32, 0, (63 << TXT_SHFT), (31 << TXT_SHFT), 0, 0, 0, 0xff },
{ 32, 0, -32, 0, (95 << TXT_SHFT), (31 << TXT_SHFT), 0, 0, 0, 0xff },
{ 64, 0, -32, 0, (127 << TXT_SHFT), (31 << TXT_SHFT), 0, 0, 0, 0xff },
{ -64, 0, 0, 0, (0 << TXT_SHFT), (63 << TXT_SHFT), 0, 0, 0, 0xff },
{ -32, 0, 0, 0, (31 << TXT_SHFT), (63 << TXT_SHFT), 0, 0, 0, 0xff },
{ 0, 0, 0, 0, (63 << TXT_SHFT), (63 << TXT_SHFT), 0, 0, 0, 0xff },
{ 32, 0, 0, 0, (95 << TXT_SHFT), (63 << TXT_SHFT), 0, 0, 0, 0xff },
{ 64, 0, 0, 0, (127 << TXT_SHFT), (63 << TXT_SHFT), 0, 0, 0, 0xff },
{ -64, 0, 32, 0, (0 << TXT_SHFT), (95 << TXT_SHFT), 0, 0, 0, 0xff },
{ -32, 0, 32, 0, (31 << TXT_SHFT), (95 << TXT_SHFT), 0, 0, 0, 0xff },
{ 0, 0, 32, 0, (63 << TXT_SHFT), (95 << TXT_SHFT), 0, 0, 0, 0xff },
{ 32, 0, 32, 0, (95 << TXT_SHFT), (95 << TXT_SHFT), 0, 0, 0, 0xff },
{ 64, 0, 32, 0, (127 << TXT_SHFT), (95 << TXT_SHFT), 0, 0, 0, 0xff },
{ -64, 0, 64, 0, (0 << TXT_SHFT), (127 << TXT_SHFT), 0, 0, 0, 0xff },
{ -32, 0, 64, 0, (31 << TXT_SHFT), (127 << TXT_SHFT), 0, 0, 0, 0xff },
{ 0, 0, 64, 0, (63 << TXT_SHFT), (127 << TXT_SHFT), 0, 0, 0, 0xff },
{ 32, 0, 64, 0, (95 << TXT_SHFT), (127 << TXT_SHFT), 0, 0, 0, 0xff },
{ 64, 0, 64, 0, (127 << TXT_SHFT), (127 << TXT_SHFT), 0, 0, 0, 0xff },
};
#undef TXT_SHFT
Gfx floor_geom_dl[] = {
#define floorPatch(a) gsSPVertex(&(floor_vtx[(a)]), 10, 0), \
gsSP1Triangle(0, 1, 5, 0), \
gsSP1Triangle(1, 5, 6, 0), \
gsSP1Triangle(1, 2, 6, 0), \
gsSP1Triangle(2, 6, 7, 0), \
gsSP1Triangle(2, 3, 7, 0), \
gsSP1Triangle(3, 7, 8, 0), \
gsSP1Triangle(3, 4, 8, 0), \
gsSP1Triangle(4, 8, 9, 0)
floorPatch(0),
floorPatch(5),
floorPatch(10),
floorPatch(15),
gsSPEndDisplayList(),
};
/* TURBO DATA */
/* dummy object to send global state: */
gtState dpGlobalObj =
{
0x0, /* renderState */
0x0, /* textureState */
0, /* vtxCount */
0, /* vtxV0 */
0, /* triCount */
0x0, /* pad1 */
NULL, /* RDPCmds */
gsDPClearOtherMode(), /* rdpOthermode */
{ /* integer portion: */
0x00010000, 0x00000000, /* transform */
0x00000001, 0x00000000,
0x00000000, 0x00010000,
0x00000000, 0x00000001,
/* fractional portion: */
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
},
};
/* this finishes the DP with a sync: */
static Gfx finalDPCmds[] =
{
gsDPFullSync(),
gsDPEndDisplayList(),
};
gtState dpFinalObj =
{
0x0, /* renderState */
0x0, /* textureState */
0, /* vtxCount */
0, /* vtxV0 */
0, /* triCount */
0x0, /* pad1 */
(Gfx *)finalDPCmds, /* RDPCmds */
gsDPClearOtherMode(), /* rdpOthermode */
{ /* integer portion: */
0x00010000, 0x00000000, /* transform */
0x00000001, 0x00000000,
0x00000000, 0x00010000,
0x00000000, 0x00000001,
/* fractional portion: */
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
0x00000000, 0x00000000,
}
};