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

📄 object.h

📁 一个3D的保龄球的源代码
💻 H
字号:
// Object.h: interface for the CObject class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_OBJECT_H__FC5A1E3F_04F7_41D5_9481_857A58F98C02__INCLUDED_)
#define AFX_OBJECT_H__FC5A1E3F_04F7_41D5_9481_857A58F98C02__INCLUDED_

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

#include "..\3d\Render3d.h"
#include "def.h"

enum OBJ_TYPE
{
	OBJ_NORMAL = 0,
	OBJ_PLAYER,
	OBJ_BALL,
	OBJ_PIN,
	OBJ_TYPE_COUNT,
};

class CObject  
{
public:
	inline void SetCurrentFrame(int curFrame){ m_iCurFrame = curFrame; };
	inline void SetHideProperty(bool hide){	m_bHide = hide; };

	virtual void Render(CRender3D *pR3d);
	virtual void Render(CRender3D *pR3d, int texId);
	virtual void Step(short interval);
	virtual void Update(short interval);

	inline CMatrix44 & GetWorldMatrix() { return m_matWorld; };
	Vector4s & GetPosition();
	Vector4s & GetRegPosition();
	inline Vector4s & GetRotation() { return m_vRot; };
	inline bool GetHideProperty() { return m_bHide; };

	inline void SetPosition(const Vector4s & pos) { m_vPos = pos; };
	inline void SetRotation(const Vector4s & rot) { m_vRot = rot; };
	inline void SetPositionX(int x) { m_vPos.x = x; };
	inline void SetPositionY(int y) { m_vPos.y = y; };
	inline void SetPositionZ(int z) { m_vPos.z = z; };
	inline void SetRotationX(int x) { m_vRot.x = x; };
	inline void SetRotationY(int y) { m_vRot.y = y; };
	inline void SetRotationZ(int z) { m_vRot.z = z; };

	inline void SetModelID(int id) {m_iModelID = id;	};
	inline int GetModelID() { return m_iModelID;	};
	inline int GetCurFrame() { return m_iCurFrame;	};	

	inline void UpdateWorldMat() 
	{
		Vector4s temp ;
		temp.x = (m_vPos.x );
		temp.y = (m_vPos.y);
		temp.z = (m_vPos.z);
		m_matWorld.Identity();
		CRender3D::GetWorldMat(&(temp), &m_vRot, &m_matWorld);
	};//(&m_vPos, &m_vRot, &m_matWorld);};
	
	CObject();
	CObject(int type);
	virtual ~CObject();

protected:
//	friend class CCollision;
	friend class CScene;
	Vector4s m_vRendPos;
	Vector4s m_vPos;
	Vector4s m_vRot;
	
	CMatrix44 m_matWorld;

	int m_iModelID;
	int m_iCurFrame;

	int m_iType;  //object type
	bool m_bHide;

};

#endif // !defined(AFX_OBJECT_H__FC5A1E3F_04F7_41D5_9481_857A58F98C02__INCLUDED_)

⌨️ 快捷键说明

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