floor.c
4.4 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
/*
* 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: floor.c
* Creator: hsa@sgi.com
* Create Date: Tue Oct 31 15:06:56 PST 1995
*
*/
#include <ultra64.h>
#include "gtdemo.h"
static void
force_translate(Mtx *mp, int x, int y, int z)
{
mp->m[1][2] = (((short int)x << 16) | ((short int)y));
mp->m[1][3] = ((short int)z << 16) | (1);
}
/* builds the display list for the floor */
void
draw_floor(Dynamic *dynamicp)
{
gSPDisplayList(glistp++, floor_setup_dl);
#define FLOOR_SCALE 2.0
guScale(&dynamicp->floor_model[0], FLOOR_SCALE, 1.0, FLOOR_SCALE);
guScale(&dynamicp->floor_model[1], FLOOR_SCALE, 1.0, FLOOR_SCALE);
guScale(&dynamicp->floor_model[2], FLOOR_SCALE, 1.0, FLOOR_SCALE);
guScale(&dynamicp->floor_model[3], FLOOR_SCALE, 1.0, FLOOR_SCALE);
guScale(&dynamicp->floor_model[4], FLOOR_SCALE, 1.0, FLOOR_SCALE);
guScale(&dynamicp->floor_model[5], FLOOR_SCALE, 1.0, FLOOR_SCALE);
guScale(&dynamicp->floor_model[6], FLOOR_SCALE, 1.0, FLOOR_SCALE);
guScale(&dynamicp->floor_model[7], FLOOR_SCALE, 1.0, FLOOR_SCALE);
guScale(&dynamicp->floor_model[8], FLOOR_SCALE, 1.0, FLOOR_SCALE);
force_translate(&dynamicp->floor_model[0], -128.0*FLOOR_SCALE, 0.0, -128.0*FLOOR_SCALE);
force_translate(&dynamicp->floor_model[1], 0.0, 0.0, -128.0*FLOOR_SCALE);
force_translate(&dynamicp->floor_model[2], 128.0*FLOOR_SCALE, 0.0, -128.0*FLOOR_SCALE);
force_translate(&dynamicp->floor_model[3], -128.0*FLOOR_SCALE, 0.0, 0.0);
force_translate(&dynamicp->floor_model[4], 0.0, 0.0, 0.0);
force_translate(&dynamicp->floor_model[5], 128.0*FLOOR_SCALE, 0.0, 0.0);
force_translate(&dynamicp->floor_model[6], -128.0*FLOOR_SCALE, 0.0, 128.0*FLOOR_SCALE);
force_translate(&dynamicp->floor_model[7], 0.0, 0.0, 128.0*FLOOR_SCALE);
force_translate(&dynamicp->floor_model[8], 128.0*FLOOR_SCALE, 0.0, 128.0*FLOOR_SCALE);
#undef FLOOR_SCALE
gSPMatrix(glistp++, OS_K0_TO_PHYSICAL(&(dynamicp->floor_model[0])),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, floor_geom_dl);
gSPMatrix(glistp++, OS_K0_TO_PHYSICAL(&(dynamicp->floor_model[1])),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, floor_geom_dl);
gSPMatrix(glistp++, OS_K0_TO_PHYSICAL(&(dynamicp->floor_model[2])),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, floor_geom_dl);
gSPMatrix(glistp++, OS_K0_TO_PHYSICAL(&(dynamicp->floor_model[3])),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, floor_geom_dl);
gSPMatrix(glistp++, OS_K0_TO_PHYSICAL(&(dynamicp->floor_model[4])),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, floor_geom_dl);
gSPMatrix(glistp++, OS_K0_TO_PHYSICAL(&(dynamicp->floor_model[5])),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, floor_geom_dl);
gSPMatrix(glistp++, OS_K0_TO_PHYSICAL(&(dynamicp->floor_model[6])),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, floor_geom_dl);
gSPMatrix(glistp++, OS_K0_TO_PHYSICAL(&(dynamicp->floor_model[7])),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, floor_geom_dl);
gSPMatrix(glistp++, OS_K0_TO_PHYSICAL(&(dynamicp->floor_model[8])),
G_MTX_MODELVIEW|G_MTX_LOAD|G_MTX_NOPUSH);
gSPDisplayList(glistp++, floor_geom_dl);
gSPTexture(glistp++, 0, 0, 0, G_TX_RENDERTILE, G_OFF); /* done; turn texture off */
}