00001 #ifndef __MAPEDITORINTERFACE_H__
00002 #define __MAPEDITORINTERFACE_H__
00003
00004 #include "Common/Matrix.h"
00005 #include "Model/ModelDraw.h"
00006 #include "Interface/Interface.h"
00007
00008 class KLandscapeDraw;
00009 class KLandEntity;
00010 class KLandObject;
00011
00012
00013 class KLandModelObject
00014 {
00015 public:
00016 KStr m_sModelName;
00017 KMODEL m_hModel;
00018 KLandEntity* m_pLandEntity;
00019 KLandObject* m_pLandObject;
00020 KMatrix m_WorldMatrix;
00021
00022 KLandModelObject()
00023 {
00024 m_hModel = KMODEL_NO;
00025 m_pLandEntity = NULL;
00026 m_pLandObject = NULL;
00027 }
00028
00029 ~KLandModelObject()
00030 {
00031 }
00032 };
00033
00034
00035 class KMapEditorInterface : public KInterface
00036 {
00037 protected:
00038 KLandscapeDraw* m_pLandscape;
00039
00040 KList<KLandModelObject*> m_LandModels;
00041
00042 KModelDraw* m_pSelectedModel;
00043 KClientModelBank* m_pModelBank;
00044 float m_RotAngle;
00045 KStr m_sSelectedModelName;
00046
00047 bool m_bHighLight;
00048 bool m_bFreeCamera;
00049 KTIME m_LastFrameTime;
00050 KVector m_CamPos;
00051 KVector m_CamRot;
00052 float m_CamZoom;
00053
00054 float m_SunTime;
00055
00056 public:
00057 KMapEditorInterface( HINSTANCE hInstance, HWND hWnd, u32 Adapter, u32 Width, u32 Height, u32 Bpp, u32 bFullScreen, u32 RefreshRate );
00058 virtual ~KMapEditorInterface();
00059
00060 virtual bool Init();
00061 virtual void End();
00062 virtual void Display();
00063 virtual void MoveFrame();
00064
00065 void TranslateCamera( float x, float y, float z );
00066 void RotateCamera( float x, float y, float z );
00067 void SetCameraPos( float x, float y, float z );
00068
00069 bool LoadModel( char* pFileName );
00070 bool CloseModel();
00071
00072 bool NewLandscape( s32 Width, s32 Height );
00073 bool LoadLandscape( char* pFileName );
00074 bool SaveLandscape( char* pFileName );
00075 bool CloseLandscape();
00076 KLandscapeDraw* GetpLandscape() { return m_pLandscape; }
00077
00078 bool IsFreeCamera() { return m_bFreeCamera; }
00079 void SetFreeCamera( bool bFreeCam ) { m_bFreeCamera = bFreeCam; }
00080
00081 void SetBrush( s32 x, s32 y, s32 Size );
00082 void ChangeLevel( s32 Height );
00083 void ChangeTexture( char* pTextureName );
00084 void RotateTexture( float Angle );
00085 KLandModelObject* AddModel( char* pModelName );
00086 void DelModel( KLandModelObject& LandModelObject );
00087
00088 KLandModelObject* GetFirstLandModel() { return m_LandModels.GetFirst(); }
00089 KLandModelObject* GetNextLandModel( KLandModelObject* pLandModel ) { return m_LandModels.GetNext( pLandModel ); }
00090
00091 void SetSelectedModel( KStr& sModelName );
00092 void SetRotModel( float Angle );
00093 void HighLightNearModel( bool bHighLight, bool bEntity = false );
00094 KLandModelObject* GetNearLandModelObject( bool bEntity );
00095
00096 void SetSunTime( float SunTime ) { m_SunTime = SunTime; }
00097
00098 void AddEntity( KLandEntity* pEntity );
00099 void RemoveEntity( KLandEntity* pEntity );
00100 KLandEntity* GetFirstEntity();
00101 KLandEntity* GetNextEntity( KLandEntity* pEntity );
00102
00103 void AddLandEntity( KLandEntity& LandEntity );
00104 void DelLandEntity();
00105 KLandEntity* GetSelectedLandEntity();
00106 void SetSelectedLandEntity( KLandEntity& LandEntity );
00107 };
00108
00109 #endif __MAPEDITORINTERFACE_H__