object.h

来自「《OpenGL游戏编程》这本书的配套源码。」· C头文件 代码 · 共 52 行

H
52
字号
//========================================================
/**
*  @file      Object.h
*
*  项目描述: 构造游戏引擎
*  文件描述:  对象实体类的基类
*  适用平台: Windows98/2000/NT/XP
*  
*  作者:     WWBOSS
*  电子邮件:  wwboss123@gmail.com
*  创建日期: 2007-07-26	
*  修改日期: 2007-07-26
*
*/ 
//========================================================

#ifndef __CGW_OBJECT_H__
#define __CGW_OBJECT_H__

#include "mathlib.h"
#include "terrain.h"

/**\brief
 * 所有游戏实体类的基类
 */
class Object
{
public:
	Object(void);
	~Object(void);

	float	r1,r2;		//!< 包围盒的半径,分别是x,y上的分量

	void Render();

	void SetPos(vector3d v)		{m_sPos=v;m_sPos.y = CTerrain::GetSysTerrain()->GetHeight(m_sPos.x ,m_sPos.z);}

	vector3d GetPos(void)		{return m_sPos;}

	void SetHeightAt(float _h)	{m_sPos.y=_h;}


private:
	virtual void OnRender(){}


protected:
	vector3d   m_sPos;

};

#endif

⌨️ 快捷键说明

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