models.c 5.1 KB

/**************************************************************************
 *                                                                        *
 *               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(),
};