old_landscape.h

来自「c++程序」· C头文件 代码 · 共 67 行

H
67
字号
// Landscape.h: Schnittstelle f黵 die Klasse CLandscape.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_LANDSCAPE_H__5D8FD502_79AF_11D1_8F4C_206373C10800__INCLUDED_)
#define AFX_LANDSCAPE_H__5D8FD502_79AF_11D1_8F4C_206373C10800__INCLUDED_

#include "Texture.h"	// Hinzugef黦t von der Klassenansicht
#include "DynamicArray2D.h"
#include "DynamicArray3D.h"
#include "LandscapeTriangle.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// Size of the surface & triangle array
// (a size of 100 is enough to hold 20K polygons)
#define ARRAY_SIZE 200

// Maximum of loadable textures
#define MAX_TEXTURE_COUNT 10

class CLandscape  
{
public:
	float GetHeightScaling();
	void SetHeightScaling(float fHeightScaling);
	// Member data acess functions
	float GetStepSize();
	void SetStepSize(float fStepSize);
	float GetSurfaceHeight(float fX, float fY);
	void GetLandscapeDimensions(LPRECT lpRect);
	// Add a texture to the list
	bool RegisterTexture(char sFileName[]);
	// Call the class's display list
	void DrawLandscape();
	// Generate the landscape
	void GenerateLandscape(const char sHeightMapFileName[], const short int iArrayWidth,
		                   const short int iArrayHeight);
	CLandscape();
	virtual ~CLandscape();
	
private:
	void CalculateSurface(CDynamicArray3D *cVertexNormals, CLandscapeTriangle ***cTriangles);
	void RenderToDisplayList(CDynamicArray3D *cVertexNormals, CLandscapeTriangle ***cTriangles);
	float m_HeightMapHeightScaling;
	// Load the terrain heightmap
	void LoadHeightmap(const char sHeightMapFileName[]);
	// Distance between two calculated points (size)
	float m_StepSize; 
	// Index for display list
	unsigned int m_LandscapeList;
	// Texture list
	CTexture m_TextureList[MAX_TEXTURE_COUNT];
	short int m_TextureCount;
	// Random
	int Rnd(int iMax);
	// Array that hold surface height data
	CDynamicArray2D *m_Surface;
	// Dimensions of the surface height data array
	int m_ArrayWidth;
	int m_ArrayHeight;
};

#endif // !defined(AFX_LANDSCAPE_H__5D8FD502_79AF_11D1_8F4C_206373C10800__INCLUDED_)

⌨️ 快捷键说明

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