📄 treecollection.h
字号:
// TreeCollection.h: Schnittstelle f黵 die Klasse CTreeCollection.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_TREECOLLECTION_H__0799D8C2_A435_11D1_8F4C_207373C1B105__INCLUDED_)
#define AFX_TREECOLLECTION_H__0799D8C2_A435_11D1_8F4C_207373C1B105__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Texture.h"
#include "Landscape.h"
#include "Tree.h"
#include "Triangle.h"
// Maximum of loadable textures
#define MAX_TEXTURE_COUNT 10
class CTreeCollection
{
public:
void SetMaxTerrainRoughness(float fMaxRoughness);
// Generate the trees
bool GenerateTrees(int iTreeCount, float fTreeSize);
// Draw the trees
bool DrawAllTrees(float fYRotation, float fXViewer, float fYViewer, float fZViewer, float fTreeBrightness);
CTreeCollection();
virtual ~CTreeCollection();
// Register a new tree texture
bool RegisterTexture(char sFileName[]);
// Set the associated landscape
void SetLandscape(CLandscape *pLandscape);
private:
bool IsPlaceEvenEnough(unsigned int iTreeIndex);
bool IsPlaceOccupied(unsigned int iTreeIndex);
// Maximum terrain roughness for a valid tree position
float m_MaxTerrainRoughness;
// Associated landscape
CLandscape* m_Landscape;
// Number of generated trees
int m_TreeCount;
// Texture list
CTexture m_TextureList[MAX_TEXTURE_COUNT];
short int m_TextureCount;
// Random number generator
int Rnd(int iMax);
// Tree array
CTree* m_Trees;
};
// Callback function for tree sorting
static int Compare(const void *arg1, const void *arg2);
#endif // !defined(AFX_TREECOLLECTION_H__0799D8C2_A435_11D1_8F4C_207373C1B105__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -