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

📄 guiobjectview.h

📁 五行MMORPG引擎系统V1.0
💻 H
字号:
//guiObjectView.h
/*/////////////////////////////////////////////////////////////////

   李亦
	liease@163.com 4040719
	2006-7-26
/*/////////////////////////////////////////////////////////////////
#ifndef _GUIOBJECTVIEW_H_
#define _GUIOBJECTVIEW_H_

#ifndef _GUITSCONTROL_H_
#include "gui/core/guiTSControl.h"
#endif
#ifndef _TSSHAPEINSTANCE_H_
#include "ts/tsShapeInstance.h"
#endif
#ifndef _GAMEBASE_H_
#include "game/gameBase.h"
#endif
#ifndef _CAMERA_H_
#include "game/camera.h"
#endif

#ifndef _RESMANAGER_H_
#include "core/resManager.h"
#endif

#ifndef _TSSHAPE_H_
#include "ts/tsShape.h"
#endif

class TSThread;
namespace RPG
{
	class GPlayer;
}
//class TSSkinMan;

//////////////////////////////////////////////////////////////
//模型查看
class GuiObjectView : public GuiTSCtrl
{
private:
	typedef GuiTSCtrl Parent;

protected:
	enum GuiOVMouseStates
	{
		GOV_NORMAL,
		GOV_HILIGHT,
		GOV_SELECTED,
		GOV_MAX
	};

	RPG::GPlayer*		m_pGPlayer;
	StringTableEntry	m_arSequences[GOV_MAX];

	enum MouseState
	{
		None,
		Rotating,
		Zooming
	};
	bool		m_bAllowRot;
	bool		m_bAllowZoom;
	//bool		m_bDragging;
	//bool		m_bRightDragging;

	MouseState  mMouseState;

	bool mZoom;
	bool mSpin;

	Point3F  mCameraPos;
	MatrixF  mCameraMatrix;
	EulerF   mCameraRot;
	Point3F  mOrbitPos;
	F32      mMinOrbitDist;
	F32      mOrbitDist;

	Point2I  mLastMousePoint;

	//StringTableEntry	m_pCursorName;
	GuiCursor*			m_pCursor;


public:
	struct meshObjects 
	{
	private:

	public:
		meshObjects();
		~meshObjects();

		enum Constants
		{
			MESH_NUM	= 33
		};

		////////////////////////////////////////////////////
		struct meshs 
		{
		public:
			void initMeshs();
			void destroyMeshs();

			TSShapeInstance*	mesh;
			char					name[32];
			U32					mode; // 0 = normal, 1 = animated
			S32					node;
			S32					parentNode;
			U32					detail;
			TSThread				*thread;
			S32					lastRenderTime;

			void loadDSQ(const char* dsq);
			void setSequence(const char* seq, F32 time);

		} mMesh[MESH_NUM];

		//TSSkinMan			*m_pSkinMan;
		TSShapeInstance	*mMainObject;
		U32					mDetail;
		BOOL					m_bAttachShapeInst;


		void load(S32 index, const char* name, const char* shape, const char* skin, S32 pNode, S32 detail);
		void load(S32 index, const char* name, Resource<TSShape>& hShape, S32 pNode, S32 detail);
		void setTSInstance(S32 index, const char* name, TSShapeInstance* pShapeInst, S32 pNode, S32 detail);
		void unLoad(S32 index);

		S32 findOpen();
		S32 findMeshByName(const char* name);
		S32 findMeshByNode(const char* node);
		void Clear();

	} mMeshObjects;

public:
	DECLARE_CONOBJECT( GuiObjectView );
	GuiObjectView();
	~GuiObjectView();

public:


	static void consoleInit();
	static void initPersistFields();

	//void inspectPostApply();
	void getCursor(GuiCursor *&cursor, bool &visible, const GuiEvent &event);

	bool onWake();

	void onMouseEnter( const GuiEvent &event );
	void onMouseLeave( const GuiEvent &event );

	void onMouseDown( const GuiEvent &event );
	void onMouseUp( const GuiEvent &event );
	void onMouseDragged( const GuiEvent &event );
	void onRightMouseDown( const GuiEvent &event );
	void onRightMouseUp( const GuiEvent &event );
	void onRightMouseDragged( const GuiEvent &event );
	void setMouseOptions( bool zoom, bool spin );

	void fitToCamera();
	bool processCameraQuery( CameraQuery *query );
	void renderWorld( const RectI &updateRect );
	void getObjectTransform( MatrixF *mat, S32 index);

	void loadObject(const char* name, const char* shape, const char* skin, const char* nodeName, S32 detail);
	void unLoadObject(const char* name, const char* node);
	void loadDSQ(const char* name, const char* dsq);
	void setSequence(const char* name, const char* seq, F32 time);
	void Clear();

	bool AttachPlayer(RPG::GPlayer* pPlayer,CSTR pName,int detail);
	void LoadDefaultDSQ(CSTR sTag);
};

#endif // _GUIOBJECTVIEW_H_

⌨️ 快捷键说明

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