/* ========================================================================== * ÀÛ ¼º ÀÚ : À̼ø±Ô * ÀÛ ¼º ÀÏ : 2006.12.13 * ³» ¿ë : ÁöÇü ÆíÁýÀÚ * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #include "Lines.h" class cBox; class cFreeCamera; class cSceneNode; class cTerrainLeafNode; class cTerrainBuildDialog; class cTerrainPaintDialog; class cTerrainOptionDialog; class cTerrainInfoDialog; class cStringTable; /// ÁöÇü ·»´õ¸µ ¸ðµå enum eTerrainViewMode { eTERRAIN_VIEW_WIREFRAME, eTERRAIN_VIEW_SOLID, eTERRAIN_VIEW_TEXTURED, eTERRAIN_VIEW_WIRETEXTURED }; /// ŸÀÏ ±×·ì /// ¼±ÅÃµÈ ÁöÇü ¸®ÇÁ ³ëµåµéÀ» Çϳª·Î ¹­´Â ¿ªÇÒÀ» ÇÑ´Ù. class cTileGroup { friend class cTerrainEditor; public: cTileGroup(); ~cTileGroup(); /// Áö¿ò void Clear(); /// ·»´õ¸µ void Render(); /// ¸®ÇÁ ³ëµå¸¦ ¼±Åà bool Select( cTerrainLeafNode* node ); bool Add( cTerrainLeafNode* node ); bool Remove( cTerrainLeafNode* node ); /// µðÅ×ÀÏ ÅØ½ºÃ³ int GetTextureIndex0() const; int GetTextureIndex1() const; int GetTextureIndex2() const; /// °æ°è »óÀÚ¸¦ ¸®ÅÏ cBox GetBoundBox() const; /// ¸®ÇÁ ³ëµå ¼ö¸¦ ¸®ÅÏ unsigned int GetSize() const; /// ºñ¾îÀÖ´ÂÁö ¿©ºÎ¸¦ ¸®ÅÏ bool IsEmpty() const; /// ¼±ÅÃµÈ ¸®ÇÁ ³ëµå ™VÀ» ¸®ÅÏ const tHashSet& GetSelectedSet() const; private: /// °¡½Ã ¿©ºÎ void SetVisible( bool visible ); /// µðÅ×ÀÏ ÅØ½ºÃ³ void SetDetailTextures( unsigned int index0, unsigned int index1, unsigned int index2 ); private: /// °æ°è »óÀÚ /// ¼±ÅÃµÈ ¸®ÇÁ ³ëµåµéÀ» Ç¥½ÃÇϴµ¥ »ç¿ëÇÑ´Ù. NiMeshPtr mBoxLines; NiMaterialPropertyPtr mMatProp; NiWireframePropertyPtr mWireProp; /// ¼±ÅÃµÈ ¸®ÇÁ ³ëµå ™V typedef tHashSet cSelectedSet; cSelectedSet mSelectedSet; }; inline unsigned int cTileGroup::GetSize() const { return mSelectedSet.GetSize(); } inline bool cTileGroup::IsEmpty() const { return mSelectedSet.IsEmpty(); } inline const tHashSet& cTileGroup::GetSelectedSet() const { return mSelectedSet; } /// ÁöÇü ÆíÁýÀÚ /// ¸Ê»óÀÇ ÁöÇü ¸®ÇÁ ³ëµåµéÀ» ÆíÁýÇϰí /// ÁöÇü ÆÄÀÏ(*.terrain)À» ÀúÀå, ·ÎµùÇÑ´Ù. class cTerrainEditor { static cTerrainEditor* mSingleton; friend class cMapEditorView; public: cTerrainEditor(); ~cTerrainEditor(); /// Áö¿ò void Clear(); /// ó¸® void Process(); /// ·»´õ¸µ void Render( bool group ); /// ÃʱâÈ­ void Init( unsigned int resolution, float metersPerVertex = 1.0f, unsigned int unitsPerMeter = 100 ); /// ·Îµù bool Load( const cString& pathName ); /// ÁöÇü bool Save(); bool SaveAs( const cString& pathName ); /// ·Î±× void ExportLog( cStringTable& table, unsigned int& row ); /// ÁÜ Ä«¸Þ¶ó void ZoomPersp( cFreeCamera* cam ); void ZoomOrtho( cFreeCamera* cam ); /// ³ôÀÌ¸Ê void ClearHeightMap(); bool ImportHeightMap( const cString& pathName ); bool ExportHeightMap( const cString& pathName ); /// ¾ËÆÄ¸Ê void ClearAlphaMap(); bool ImportAlphaMap( const cString& pathName ); bool ExportAlphaMap( const cString& pathName ); /// »ö»ó¸Ê void ClearColorMap(); bool ImportColorMap( const cString& pathName ); bool ExportColorMap( const cString& pathName ); /// ½ºÄÉÀÏ void AdjustHeight( float scale ); /// ³×ºñ¸Þ½Ã void SyncAllToNaviMesh(); /// ´ÙÀ̾ó·Î±× void SetBuildDialog( cTerrainBuildDialog* dlg ); void SetPaintDialog( cTerrainPaintDialog* dlg ); void SetOptionDialog( cTerrainOptionDialog* dlg ); void SetInfoDialog( cTerrainInfoDialog* dlg ); /// Level of detail void SetLodEnabled( bool enabled ); /// °¡½Ã ¿©ºÎ void SetVisible( bool visible ); /// ÅØ½ºÃ³ bool LoadTexture( const cString& pathName ); void UnLoadTexture( unsigned int index ); void SetDetailTextures( unsigned int index0, unsigned int index1, unsigned int index2 ); void SetDetailTexturesToAll( unsigned int index0, unsigned int index1, unsigned int index2 ); /// ÁÖº¯±¤ void SetAmbientLightAmbient( const NiColor& color ); void SetAmbientLightDiffuse( const NiColor& color ); void SetAmbientLightDimmer( float dimmer ); NiAmbientLight* GetAmbientLight() const; /// ¾È°³ void SetFog( bool enabled, const NiColor& color, float depth ); void SetFogColor( const NiColor& color ); void SetFogDepth( float depth ); /// ºä ¸ðµå void SetViewMode( eTerrainViewMode viewMode ); /// ÇÈÅ· À§Ä¡ º¯°æ ¿©ºÎ void SetPickPosChanged( bool changed ); /// °æ·Î À̸§ const cString& GetPathName() const; /// ÇØ»óµµ unsigned int GetResolution() const; /// Á¤Á¡´ç ¹ÌÅͼö float GetMetersPerVertex() const; /// ¹ÌÅÍ´ç ´ÜÀ§¼ö unsigned int GetUnitsPerMeter() const; private: /// ¸Þ½ÃÁö¸¦ ó¸® void OnTimer_Build(); void OnTimer_Paint(); void OnMouseMove_Build( CPoint point ); void OnMouseMove_Paint( CPoint point ); void OnLButtonDown_Build( CPoint point ); void OnLButtonDown_Paint( CPoint point ); void OnLButtonUp(); void OnKeyDown( UINT c ); public: /// ´ÜÀÏü static cTerrainEditor* GetSingleton(); protected: /// ´ÙÀ̾ó·Î±× cTerrainBuildDialog* mBuildDialog; cTerrainPaintDialog* mPaintDialog; cTerrainOptionDialog* mOptionDialog; cTerrainInfoDialog* mInfoDialog; /// ÇÈÅ·µÈ Àå¸é ³ëµå ¹è¿­ typedef tArray cPickedArray; cPickedArray mPickedArray; /// ±×·ì ÁöÇü cTileGroup* mGroup; /// µå·ÎÀ× ¿©ºÎ bool mDrawing; /// ÇÈÅ· À§Ä¡ NiPoint3 mPickPos; NiPoint3 mPickOldPos; bool mPickPosChanged; /// ÆíÁý ¿ø /// ¼±Åà ¹üÀ§¸¦ Ç¥½ÃÇϴµ¥ »ç¿ëÇÑ´Ù. cCircleLines mInnerLines; cCircleLines mOuterLines; /// ¸¶¿ì½º ÁÂÇ¥ CPoint mMousePos; /// °æ·Î À̸§ cString mPathName; }; inline void cTerrainEditor::SetBuildDialog( cTerrainBuildDialog* dlg ) { assert( dlg ); mBuildDialog = dlg; } inline void cTerrainEditor::SetPaintDialog( cTerrainPaintDialog* dlg ) { assert( dlg ); mPaintDialog = dlg; } inline void cTerrainEditor::SetOptionDialog( cTerrainOptionDialog* dlg ) { assert( dlg ); mOptionDialog = dlg; } inline void cTerrainEditor::SetInfoDialog( cTerrainInfoDialog* dlg ) { assert( dlg ); mInfoDialog = dlg; } inline void cTerrainEditor::SetPickPosChanged( bool changed ) { mPickPosChanged = changed; } inline const cString& cTerrainEditor::GetPathName() const { return mPathName; } inline cTerrainEditor* cTerrainEditor::GetSingleton() { return mSingleton; } #define TERRAINEDIT cTerrainEditor::GetSingleton()