models.c
5.1 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
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
/*
* File: models.c
*
* vert buffers and display lists for models used in stress app.
*
*/
#include <ultra64.h>
#include "texture.h"
#include "stress.h"
/**************************************************************************
* terrain and models
**************************************************************************/
#include "palmtop_vtx.h"
#include "palmtrunk_vtx.h"
#include "palmshade_vtx.h"
#include "sand_vtx.h"
#include "pool_vtx.h"
#include "umbrella_vtx.h"
#include "umbshade_vtx.h"
#include "ridge_vtx.h"
#include "pooldb_mat.h"
#include "ridgedb_mat.h"
/*
* Relax world fixed models
*/
Gfx palmtop_dl[] = {
# include "palmtop_dl.h"
gsSPEndDisplayList()
}; /* end palmtop */
Gfx palmtrunk_dl[] = {
# include "palmtrunk_dl.h"
gsSPEndDisplayList()
}; /* end palmtrunk */
Gfx palmshade_dl[] = {
# include "palmshade_dl.h"
gsSPEndDisplayList()
}; /* end palmshade */
Gfx umbrella_dl[] = {
# include "umbrella_dl.h"
gsSPEndDisplayList()
}; /* end umbrella */
Gfx umbshade_dl[] = {
# include "umbshade_dl.h"
gsSPEndDisplayList()
}; /* end umbshade */
/*
* Relax world
*/
Gfx relax0_dl[] = {
# include "ridge_dl.h"
# include "ridgedb.h"
gsSPMatrix(&stress_identity,
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH),
gsSPEndDisplayList()
};
Gfx relax1_dl[] = {
# include "sand_dl.h"
# include "pool_dl.h"
# include "pooldb.h"
gsSPMatrix(&stress_identity,
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH),
gsSPEndDisplayList()
};
/*
* Specularly lighted object display list
*/
#include "ltsphere_vtx.h"
Lights2 litc1 = gdSPDefLights1(
0x20, 0x00, 0x20, /* ambient color */
0xc0, 0x00, 0x00, 32, 64, 32); /* lt0 color and normal */
/*
* Set up attributes, textures
*/
Gfx ltsphere_att_dl[] = {
gsDPPipeSync(),
gsSPSetLights1(litc1),
gsSPClearGeometryMode(G_CULL_FRONT),
gsSPSetGeometryMode(G_ZBUFFER),
gsSPSetGeometryMode(G_CULL_BACK),
gsSPSetGeometryMode(G_SHADE),
gsSPSetGeometryMode(G_TEXTURE_GEN | G_LIGHTING),
gsSPTexture(0x07c0, 0x07c0, 0, G_TX_RENDERTILE, G_ON),
gsDPSetTexturePersp(G_TP_PERSP),
gsDPSetPrimColor(0, 0, 255, 255, 0, 255),
gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
gsDPSetCombineMode(G_CC_HILITERGBA, G_CC_HILITERGBA),
gsDPSetTextureFilter(G_TF_BILERP),
gsDPLoadTextureBlock_4b(I4spec, G_IM_FMT_I, 32, 32, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR,
5, 5, G_TX_NOLOD, G_TX_NOLOD),
gsSPEndDisplayList()
};
/*
* Actually render lighted sphere
*/
/*
Mtx sphere_matR={
0x00010000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00010000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00010000, 0x00000000,
0x00000000, 0x00640000, 0x00000000, 0x00010000,
};
*/
Mtx sphere_matR={
0x00010000, 0x00000000, 0x00000001, 0x00000000,
0x00000000, 0x00010000, 0x00000064, 0x00000001,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
Gfx ltsphere_dl[] = {
gsSPMatrix(&sphere_matR, G_MTX_MODELVIEW|G_MTX_MUL|G_MTX_NOPUSH),
# include "ltsphere_dl.h"
gsSPEndDisplayList()
};
/*
*
* Draw simple altimeter, uses ortho matrix and line microcode
*
*/
static Vtx
alt_vtx[] = {
{34-160, 229-120, 0, 0, 0, 0, 255, 255, 255, 255},
{30-160, 229-120, 0, 0, 0, 0, 255, 255, 255, 255},
{30-160, 30-120, 0, 0, 0, 0, 255, 255, 255, 255},
{34-160, 30-120, 0, 0, 0, 0, 255, 255, 255, 255},
{36-160, 30-120, 0, 0, 0, 0, 255, 255, 255, 255},
{40-160, 30-120, 0, 0, 0, 0, 255, 255, 255, 255},
{40-160, 229-120, 0, 0, 0, 0, 255, 255, 255, 255},
{36-160, 229-120, 0, 0, 0, 0, 255, 255, 255, 255},
};
/*
* Static part of altimeter
*/
Gfx alt_reticle[] = {
gsDPPipeSync(),
gsSPClearGeometryMode(G_ZBUFFER),
gsSPSetGeometryMode(G_SHADE),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsDPSetRenderMode(G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2),
gsSPVertex(&alt_vtx, 8, 0),
gsSPLine3D(0, 1, 0),
gsSPLine3D(1, 2, 0),
gsSPLine3D(2, 3, 0),
gsSPLine3D(4, 5, 0),
gsSPLine3D(5, 6, 0),
gsSPLine3D(6, 7, 0),
gsSPEndDisplayList(),
};