⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tiledefinitions.h

📁 游戏编程精粹2第四章源码
💻 H
字号:
/* Copyright (C) Greg Snook, 2001. 
 * All rights reserved worldwide.
 *
 * This software is provided "as is" without express or implied
 * warranties. You may freely copy and compile this source into
 * applications you distribute provided that the copyright text
 * below is included in the resulting source code, for example:
 * "Portions Copyright (C) Greg Snook, 2001"
 */
#ifndef TILEDEFINITIONS_H
#define TILEDEFINITIONS_H
/****************************************************************************************\

	TileDefinitions.h

	SimpleTerrain component interface for a basic terrain manager.

	Part of the Gems II sample code library.
	Created 3/27/2001 by Greg Snook

    ------------------------------------------------------------------------------------- 
	Notes/Revisions:

\****************************************************************************************/

//
// These are index buffer definitions for our sample app.
//

enum SIDES
{
	TOP=0,
	LEFT,
	RIGHT,
	BOTTOM,
	TOTAL_SIDES
};

//
// DETAIL LEVEL 0
//

// a two-poly quad for the lowest detail tile
WORD BaseTile0[6]=
{
	0,8,72,
	72,8,80
};


//
// DETAIL LEVEL 1
//

WORD SidesOfLevel1[TOTAL_SIDES][6]=
{
	//Top
	{
		40,0,4,
		40,4,8
	},
	//Left
	{
		36,0,40,
		72,36,40
	},
	//Right
	{
		40,8,44,
		40,44,80
	},
	//Bottom
	{
		72,40,76,
		76,40,80
	}
};

WORD Connect1to0[TOTAL_SIDES][3]=
{
	//Top
	{
		0,8,40
	},
	//Left
	{
		72,0,40
	},
	//Right
	{
		40,8,80
	},
	//Bottom
	{
		72,40,80
	}
};

//
// DETAIL LEVEL 2
//

WORD Level2_Center[24]=
{
	38,20,40,
	40,20,22,
	40,22,24,
	40,24,42,
	56,38,40,
	56,40,58,
	58,40,60,
	60,40,42
};

WORD SidesOfLevel2[TOTAL_SIDES][18]=
{
	//Top
	{
		0,2,20,
		20,2,22,
		22,2,4,
		22,4,6,
		22,6,24,
		24,6,8
	},
	//Left
	{
		18,0,20,
		18,20,38,
		36,18,38,
		36,38,54,
		54,38,56,
		72,54,56
	},
	//Right
	{
		24,8,26,
		42,24,26,
		42,26,44,
		42,44,62,
		60,42,62,
		60,62,80
	},
	//Bottom
	{
		72,56,74,
		74,56,58,
		74,58,76,
		76,58,78,
		58,60,78,
		78,60,80
	}
};

WORD Connect2to1[TOTAL_SIDES][12]=
{
	//Top
	{
		0,4,20,
		20,4,22,
		22,4,8,
		22,8,24
	},
	//Left
	{
		36,0,20,
		36,20,38,
		36,38,72,
		72,38,56
	},
	//Right
	{
		24,8,42,
		42,8,44,
		42,44,80,
		42,80,60
	},
	//Bottom
	{
		72,56,58,
		72,58,76,
		76,58,80,
		80,58,60
	}
};

WORD Connect2to0[TOTAL_SIDES][9]=
{
	//Top
	{
		20,0,22,
		22,0,8,
		22,8,24
	},
	//Left
	{
		0,20,38,
		72,0,38,
		72,38,56
	},
	//Right
	{
		24,8,42,
		42,8,80,
		60,42,80
	},
	//Bottom
	{
		72,56,58,
		72,58,80,
		58,60,80
	}
};


//
// DETAIL LEVEL 3
//

WORD Level3_Center[216]=
{
	10,11,20,
	11,12,21,
	12,13,22,
	13,14,22,
	14,15,23,
	15,16,24,
	19,10,20,
	20,11,21,
	21,12,22,
	22,14,23,
	23,15,24,
	24,16,25,
	19,20,29,
	20,21,30,
	21,22,31,
	22,23,31,
	23,24,32,
	24,25,33,
	28,19,29,
	29,20,30,
	30,21,31,
	31,23,32,
	32,24,33,
	33,25,34,
	28,29,38,
	29,30,39,
	30,31,40,
	31,32,40,
	32,33,41,
	33,34,42,
	37,28,38,
	38,29,39,
	39,30,40,
	40,32,41,
	41,33,42,
	42,34,43,
	37,38,46,
	38,39,47,
	39,40,48,
	40,41,50,
	41,42,51,
	42,43,52,
	46,38,47,
	47,39,48,
	48,40,49,
	49,40,50,
	50,41,51,
	51,42,52,
	46,47,55,
	47,48,56,
	48,49,57,
	49,50,59,
	50,51,60,
	51,52,61,
	55,47,56,
	56,48,57,
	57,49,58,
	58,49,59,
	59,50,60,
	60,51,61,
	55,56,64,
	56,57,65,
	57,58,66,
	58,59,68,
	59,60,69,
	60,61,70,
	64,56,65,
	65,57,66,
	66,58,67,
	67,58,68,
	68,59,69,
	69,60,70,
};

WORD SidesOfLevel3[TOTAL_SIDES][42]=
{
	//Top
	{
		0,1,10,
		1,2,11,
		2,3,12,
		3,4,13,
		4,5,13,
		5,6,14,
		6,7,15,
		7,8,16,
		10,1,11,
		11,2,12,
		12,3,13,
		13,5,14,
		14,6,15,
		15,7,16,
	},
	//Left
	{
		9,10,19,
		18,19,28,
		27,28,37,
		36,37,45,
		45,46,54,
		54,55,63,
		63,64,72,
		0,10,9,
		9,19,18,
		18,28,27,
		27,37,36,
		37,46,45,
		46,55,54,
		55,64,63,
	},
	//Right
	{
		16,17,25,
		25,26,34,
		34,35,43,
		43,44,53,
		52,53,62,
		61,62,71,
		70,71,80,
		8,17,16,
		17,26,25,
		26,35,34,
		35,44,43,
		43,53,52,
		52,62,61,
		61,71,70,
	},
	//Bottom
	{
		64,65,73,
		65,66,74,
		66,67,75,
		67,68,77,
		68,69,78,
		69,70,79,
		72,64,73,
		73,65,74,
		74,66,75,
		75,67,76,
		76,67,77,
		77,68,78,
		78,69,79,
		79,70,80,
	}
};

WORD Connect3to2[TOTAL_SIDES][30]=
{
	//Top
	{
		10,0,11,
		11,0,2,
		11,2,12,
		12,2,13,
		13,2,4,
		13,4,6,
		13,6,14,
		14,6,15,
		15,6,8,
		15,8,16
	},
	//Left
	{
		19,0,10,
		19,18,0,
		28,18,19,
		37,18,28,
		37,36,18,
		36,37,54,
		54,37,46,
		54,46,55,
		54,55,72,
		72,55,64
	},
	//Right
	{
		8,25,16,
		8,26,25,
		26,34,25,
		26,43,34,
		26,44,43,
		62,43,44,
		62,52,43,
		62,61,52,
		80,61,62,
		80,70,61,
	},
	//Bottom
	{
		72,64,65,
		72,65,74,
		74,65,66,
		74,66,67,
		74,67,76,
		78,76,67,
		78,67,68,
		78,68,69,
		80,78,69,
		80,69,70
	}
};


WORD Connect3to1[TOTAL_SIDES][24]=
{
	//Top
	{
		0,11,10,
		0,12,11,
		0,13,12,
		0,4,13,
		8,13,4,
		8,14,13,
		8,15,14,
		8,16,15
	},
	//Left
	{
		0,37,36,
		0,28,37,
		0,28,19,
		0,10,19,
		72,36,37,
		72,37,46,
		72,46,55,
		72,55,64
	},
	//Right
	{
		8,44,43,
		8,43,34,
		8,34,25,
		8,25,16,
		80,43,44,
		80,52,43,
		80,61,52,
		80,70,61
	},
	//Bottom
	{
		72,67,76,
		72,66,67,
		72,65,66,
		72,64,65,
		80,76,67,
		80,67,68,
		80,68,69,
		80,69,70
	}
};

WORD Connect3to0[TOTAL_SIDES][21]=
{
	//Top
	{
		0,11,10,
		0,12,11,
		0,13,12,
		0,8,13,
		8,14,13,
		8,15,14,
		8,16,15
	},
	//Left
	{
		0,28,37,
		0,28,19,
		0,10,19,
		72,0,37,
		72,37,46,
		72,46,55,
		72,55,64
	},
	//Right
	{
		8,80,43,
		8,43,34,
		8,34,25,
		8,25,16,
		80,52,43,
		80,61,52,
		80,70,61
	},
	//Bottom
	{
		72,67,80,
		72,66,67,
		72,65,66,
		72,64,65,
		80,67,68,
		80,68,69,
		80,69,70
	}
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -