NodeObject.h
资源名称:g.rar [点击查看]
上传用户:laitongbao
上传日期:2021-02-20
资源大小:8176k
文件大小:3k
源码类别:
射击游戏
开发平台:
Visual C++
- #pragma once
- #include "CGLApplication.h"
- #include "VECTOR.h"
- #include "CGLDEF.h"
- /*********************************************************************************
- 节点类,所有网格物体的基础类,包含很多共有的基本函数
- *********************************************************************************/
- class NodeObject
- {
- friend class TransitionController;
- friend class ShaderController;
- friend class FileController;
- friend class SceneTree;
- friend class AnimationController;
- friend class Force;
- friend class P_Force;
- friend class Resistance;
- friend class P_Resistance;
- friend class CollisionDetector;
- public:
- NodeObject(NodeObject &obj);
- NodeObject(TCHAR* name, VECTOR3 pos);
- virtual ~NodeObject() ;
- void SetName(TCHAR* name);
- TCHAR* GetName()const;
- void SetVisible(bool visible){m_visible=visible;};
- void SetMass(float mass){this->mass = mass;};
- float GetMass(){return mass;};
- void SetVelocity(VECTOR3 vel);
- VECTOR3 GetVelocity();
- void SetRotateVelocity(VECTOR3 vel);
- VECTOR3 GetRotateVelocity();
- virtual void CleanUp(){};
- OBJ_TYPE GetType()const{return m_type;}
- inline NodeObject* GetParent()const{return m_pParent;}
- inline NodeObject* GetChild()const{return m_pChild;}
- inline NodeObject* GetNext()const{return m_pNext;}
- inline NodeObject* GetPrev()const{return m_pPrev;}
- virtual void DrawObject(){}; //用于绘制虚拟物体线框(如摄像机,灯光,离子发射器)
- virtual void PreDraw(){}; //用于设置网格以外物体的渲染状态(网格及其贴图的渲染状态由ShaderController设置)
- VECTOR3 GetWorldPos(){return gpos;}
- VECTOR3 GetWorldVel(){return gvel;}
- protected:
- NodeObject* FindObject( TCHAR* strName);
- TCHAR* m_strName; //物体名字
- OBJ_TYPE m_type; //物体种类
- NodeObject *m_pChild; //子物体
- NodeObject *m_pParent; //父物体
- NodeObject *m_pNext; //下一个物体
- NodeObject *m_pPrev; //上一个物体
- bool m_visible; //物体可见性
- VECTOR3 pos; //局部位置
- VECTOR3 gpos; //全局位置
- VECTOR3 rot; //局部旋转
- VECTOR3 scale; //局部缩放
- VECTOR3 vel; //物体速度
- VECTOR3 gvel; //全局速度
- VECTOR3 rot_vel; //物体旋转速度
- D3DXMATRIX matrix; //转换矩阵
- float mass; //质量
- public:
- float angle;//旋转时用到的角度
- };