ground.c
3.57 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
/**************************************************************************
* *
* Copyright (C) 1994, 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. *
* *
*************************************************************************/
#include <ultra64.h>
#include "topgun.h"
static Vtx v[] = {
/* Ground */
{ -2048, 0, -2048, 0, 0<<9, 0<<9, 255, 255, 255, 255 },
{ 2047, 0, -2048, 0, 0<<9, 31<<9, 255, 255, 255, 255 },
{ 2047, 0, 2047, 0, 31<<9, 31<<9, 255, 255, 255, 255 },
{ -2048, 0, 2047, 0, 31<<9, 0<<9, 255, 255, 255, 255 },
/* First (bottom) layer of clouds */
{ -2048, 28, -2048, 0, 0<<9, 0<<9, 255, 255, 255, 255 },
{ 2047, 28, -2048, 0, 0<<9, 31<<9, 255, 255, 255, 255 },
{ 2047, 28, 2047, 0, 31<<9, 31<<9, 255, 255, 255, 255 },
{ -2048, 28, 2047, 0, 31<<9, 0<<9, 255, 255, 255, 255 },
/* Second (middle) layer of clouds */
{ -2048, 44, -2048, 0, 31<<9, 31<<9, 255, 255, 255, 255 },
{ 2047, 44, -2048, 0, 31<<9, 0<<9, 255, 255, 255, 255 },
{ 2047, 44, 2047, 0, 0<<9, 0<<9, 255, 255, 255, 255 },
{ -2048, 44, 2047, 0, 0<<9, 31<<9, 255, 255, 255, 255 },
/* Third (top) layer of clouds */
{ -2048, 56, -2048, 0, 0<<9, 0<<9, 255, 255, 255, 255 },
{ 2047, 56, -2048, 0, 31<<9, 0<<9, 255, 255, 255, 255 },
{ 2047, 56, 2047, 0, 31<<9, 31<<9, 255, 255, 255, 255 },
{ -2048, 56, 2047, 0, 0<<9, 31<<9, 255, 255, 255, 255 },
};
#include "ground.h"
#include "sky.h"
#include "tree.h"
Gfx ground[] = {
gsSPTexture(0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON),
gsDPPipeSync(),
gsDPSetRenderMode(G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2),
gsDPSetCombineMode(G_CC_MODULATERGBA, G_CC_MODULATERGBA),
gsDPSetTextureFilter(G_TF_BILERP),
gsDPLoadTextureBlock(tex_ground, G_IM_FMT_RGBA, G_IM_SIZ_16b,
32, 32, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR,
4, 4, G_TX_NOLOD, G_TX_NOLOD),
gsSPVertex(&v, 4, 0),
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
gsSPTexture (0x8000, 0x8000, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsSPEndDisplayList(),
};
Gfx sky[] = {
gsSPTexture (0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_MODULATEIA, G_CC_MODULATEIA),
gsDPLoadTextureBlock(tex_sky, G_IM_FMT_IA, G_IM_SIZ_16b,
32, 32, 0,
G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR,
4, 4, G_TX_NOLOD, G_TX_NOLOD),
/* Turn on transparency */
gsDPSetRenderMode(G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2),
gsSPVertex(&v[4], 12, 0),
/* Top layer -- draw this first */
gsSP1Triangle(8, 9, 10, 0),
gsSP1Triangle(8, 10, 11, 0),
/* Middle layer */
gsSP1Triangle(4, 5, 6, 0),
gsSP1Triangle(4, 6, 7, 0),
/* Bottom layer -- draw this last */
gsSP1Triangle(0, 1, 2, 0),
gsSP1Triangle(0, 2, 3, 0),
/* Turn off transparency */
gsDPPipeSync(),
gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
/* Turn off texturing */
gsSPTexture (0x8000, 0x8000, 0, G_TX_RENDERTILE, G_OFF),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsSPEndDisplayList(),
};