static.c 6.67 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:	static.c
 * Creator:	hsa@sgi.com
 * Create Date:	Sun Jun  4 18:49:42 PDT 1995
 *
 *
 * This file holds tiny display list segments that are 'static' data.
 *
 */

#include <ultra64.h>
#include "teapot.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 ),
    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),
    gsDPSetBlendMask(0xff),
    gsDPSetColorDither(G_CD_ENABLE),
    gsDPSetCycleType(G_CYC_1CYCLE),
    gsDPPipeSync(),
    gsSPEndDisplayList(),
};

#ifdef USE_HIGHLIGHT
/* texture for the specular highlight: */
#include "IA8phong.h"
#endif

#include "teapot_vtx.h"

Lights2 litc2 = gdSPDefLights2(0x5, 0x5, 0x5,		/* ambient color */
			       100, 100, 0,		/* light color */
			       -32, -64, -32, 			/* normal */
			       50, 50, 0,		/* light color */
			       50, 100, 400); 			/* normal */

Lights1 litc1 = gdSPDefLights1(0x5, 0x5, 0x5,		/* ambient color */
			       100, 100, 0,		/* light color */
			       50, 100, 400); 			/* normal */


Gfx teapot_setup_dl[] = {
    gsDPPipeSync(),
    gsDPSetCycleType(G_CYC_1CYCLE),
    gsSPSetGeometryMode(G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH | 
			G_CULL_BACK | G_LIGHTING),
    gsSPSetLights2(litc2),
#ifdef USE_HIGHLIGHT
    gsSPSetGeometryMode(G_TEXTURE_GEN),
    gsSPTexture(0x07c0, 0x07c0, 0, G_TX_RENDERTILE, G_ON),
    gsDPSetTexturePersp(G_TP_PERSP),
    gsDPSetTextureFilter(G_TF_BILERP),
    gsDPSetPrimColor(0, 0, 255, 255, 255, 255),
    gsDPSetCombineMode(G_CC_HILITERGBA, G_CC_HILITERGBA),
    gsDPLoadTextureBlock(IA8phong, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0,
			 G_TX_WRAP | G_TX_NOMIRROR, G_TX_WRAP | G_TX_NOMIRROR,
			 5, 5, G_TX_NOLOD, G_TX_NOLOD),
#else
    gsDPSetCombineMode (G_CC_SHADE, G_CC_SHADE),
#endif

    gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2),
    gsSPEndDisplayList(),
};

Gfx teapot_geom_dl[] = {

#include "teapot_tri.h"

    gsSPEndDisplayList(),
};

Gfx setting_setup_dl[] = {

    gsDPPipeSync (),
    gsDPSetCycleType(G_CYC_1CYCLE),
    gsDPSetTextureLOD(G_TL_TILE),
    gsSPClearGeometryMode(G_SHADE | G_SHADING_SMOOTH | G_CULL_BOTH |
			  G_ZBUFFER | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
			  G_TEXTURE_GEN_LINEAR | G_LOD ),
    gsSPSetGeometryMode(G_SHADING_SMOOTH | G_SHADE ),
    gsDPSetColorDither(G_CD_DISABLE),
    gsDPSetTexturePersp(G_TP_PERSP),
    gsDPSetTextureFilter(G_TF_BILERP),
    gsSPTexture(0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON),
    gsDPSetRenderMode(G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2),
    gsDPSetCombineMode(G_CC_MODULATERGBA, G_CC_MODULATERGBA),

    gsSPEndDisplayList(),
};

#include "tv2_00.h"
#include "tv2_01.h"
#include "tv2_02.h"
#include "tv2_03.h"
#include "tv2_04.h"
#include "tv2_05.h"
#include "tv2_06.h"
#include "tv2_07.h"
#include "tv2_08.h"
#include "tv2_09.h"

#include "tv2_10.h"
#include "tv2_11.h"
#include "tv2_12.h"
#include "tv2_13.h"
#include "tv2_14.h"
#include "tv2_15.h"
#include "tv2_16.h"
#include "tv2_17.h"
#include "tv2_18.h"
#include "tv2_19.h"

#include "tv2_20.h"
#include "tv2_21.h"
#include "tv2_22.h"
#include "tv2_23.h"
#include "tv2_24.h"
#include "tv2_25.h"
#include "tv2_26.h"
#include "tv2_27.h"
#include "tv2_28.h"
#include "tv2_29.h"

static Vtx va[] = {
	{ -16, -16, 0, 0, 0<<6,   0<<6,   255, 255, 255, 255 },
	{   0, -16, 0, 0, (TEX_WD/2 - 1)<<6,   0<<6, 255, 255, 255, 255 },
	{   0,   0, 0, 0, (TEX_WD/2 - 1)<<6, (TEX_HT/2 - 1)<<6, 255, 255, 255, 255 },
	{ -16,   0, 0, 0, 0<<6, (TEX_HT/2 - 1)<<6,   255, 255, 255, 255 },
};

static Vtx vb[] = {
	{   0, -16, 0, 0, (TEX_WD/2 - 1)<<6, 0<<6,   255, 255, 255, 255 },
	{  16, -16, 0, 0, (TEX_WD - 2)<<6, 0<<6, 255, 255, 255, 255 },
	{  16,   0, 0, 0, (TEX_WD - 2)<<6, (TEX_HT/2 - 1)<<6, 255, 255, 255, 255 },
	{   0,   0, 0, 0, (TEX_WD/2 - 1)<<6, (TEX_HT/2 - 1)<<6,   255, 255, 255, 255 },
};

static Vtx vc[] = {
	{ -16,   0, 0, 0, 0<<6, (TEX_HT/2 - 1)<<6,   255, 255, 255, 255 },
	{   0,   0, 0, 0, (TEX_WD/2 - 1)<<6, (TEX_HT/2 - 1)<<6, 255, 255, 255, 255 },
	{   0,  16, 0, 0, (TEX_WD/2 - 1)<<6, (TEX_HT - 2)<<6, 255, 255, 255, 255 },
	{ -16,  16, 0, 0, 0<<6, (TEX_HT - 2)<<6,   255, 255, 255, 255 },
};

static Vtx vd[] = {
	{   0,   0, 0, 0, (TEX_WD/2 - 1)<<6, (TEX_HT/2 - 1)<<6,   255, 255, 255, 255 },
	{  16,   0, 0, 0, (TEX_WD - 2)<<6, (TEX_HT/2 - 1)<<6, 255, 255, 255, 255 },
	{  16,  16, 0, 0, (TEX_WD - 2)<<6, (TEX_HT - 2)<<6, 255, 255, 255, 255 },
	{   0,  16, 0, 0, (TEX_WD/2 - 1)<<6, (TEX_HT - 2)<<6,   255, 255, 255, 255 },
};

Gfx setting_geom_a_dl[] = {
	gsSPVertex(&va, 4, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(0, 2, 3, 0),
	gsSPEndDisplayList(),
};

Gfx setting_geom_b_dl[] = {
	gsSPVertex(&vb, 4, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(0, 2, 3, 0),
	gsSPEndDisplayList(),
};

Gfx setting_geom_c_dl[] = {
	gsSPVertex(&vc, 4, 0),
	gsSP1Triangle(0, 1, 2, 0),
	gsSP1Triangle(0, 2, 3, 0),
	gsSPEndDisplayList(),
};

Gfx setting_geom_d_dl[] = {
	gsSPVertex(&vd, 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),
        gsDPSetColorDither(G_CD_ENABLE),
	gsSPEndDisplayList(),
};