Cafu Engine
ToolTerrainEditorT Class Reference
Inheritance diagram for ToolTerrainEditorT:

Public Types

enum  ToolModeE { TOOLMODE_INACTIVE, TOOLMODE_ACTIVE, TOOLMODE_EYEDROPPER }
 
enum  ExportFileTypeE {
  BMP, PNG, JPG, PGM_ASCII,
  PGM_BINARY, TER
}
 

Public Member Functions

 ToolTerrainEditorT (MapDocumentT &MapDoc, ToolManagerT &ToolMan, wxWindow *ParentOptionsBar)
 
void SetToolDialog (TerrainEditorDialogT *TerrainEditorDialog)
 Sets the dialog that is asociated with this tool. More...
 
bool IsTerrainSelected ()
 Checks if the tool has a terrain selected. More...
 
void SetResolution (unsigned long Resolution)
 Updates the resolution of the terrain currently attached to the tool. More...
 
unsigned long GetResolution ()
 Gets the resolution of the terrain currently attached to the tool. More...
 
void GenerateTerrain (int Octaves, double Frequency, double Persistence, double Lacunarity, int Seed)
 Generates the terrains height data using Perlin noise with the given parameters. More...
 
void ImportHeightMap (const wxString &FileName)
 Imports the height data in the passed file into the terrain currently attached to the tool. More...
 
void ExportHeightMap (wxString FileName, ExportFileTypeE ExportFileType)
 Exports the height data to a file in the specified file format. More...
 
void UpdateModifyWeights ()
 Updates the modification matrix using the passed radius and hardness. More...
 
void UpdateNoiseWeights ()
 Updates the noise weights according to the passed radius. More...
 
void UpdateGaussWeights ()
 Updates the gauss kernel according to the passed tool effect. More...
 
int GetWxEventID () const
 Returns the ID of the wxWidgets event (menu selection or toolbar button click) that is associated with activating this tool. More...
 
wxWindow * GetOptionsBar ()
 Returns the options bar window associated with this tool. NULL if no options bar has been assigned. More...
 
void OnActivate (ToolT *OldTool)
 
void OnDeactivate (ToolT *NewTool)
 
bool OnKeyDown2D (ViewWindow2DT &ViewWindow, wxKeyEvent &KE)
 
bool OnKeyUp2D (ViewWindow2DT &ViewWindow, wxKeyEvent &KE)
 
bool OnLMouseDown2D (ViewWindow2DT &ViewWindow, wxMouseEvent &ME)
 Also used for LMB "double-click" events (use ME.ButtonDClick() for distinction). More...
 
bool OnLMouseUp2D (ViewWindow2DT &ViewWindow, wxMouseEvent &ME)
 
bool OnMMouseUp2D (ViewWindow2DT &ViewWindow, wxMouseEvent &ME)
 
bool OnMouseMove2D (ViewWindow2DT &ViewWindow, wxMouseEvent &ME)
 
int OnContextMenu2D (ViewWindow2DT &ViewWindow, wxContextMenuEvent &CE, wxMenu &Menu)
 
bool OnKeyDown3D (ViewWindow3DT &ViewWindow, wxKeyEvent &KE)
 
bool OnKeyUp3D (ViewWindow3DT &ViewWindow, wxKeyEvent &KE)
 
bool OnLMouseDown3D (ViewWindow3DT &ViewWindow, wxMouseEvent &ME)
 Also used for LMB "double-click" events (use ME.ButtonDClick() for distinction). More...
 
bool OnLMouseUp3D (ViewWindow3DT &ViewWindow, wxMouseEvent &ME)
 
bool OnMMouseUp3D (ViewWindow3DT &ViewWindow, wxMouseEvent &ME)
 
bool OnMouseMove3D (ViewWindow3DT &ViewWindow, wxMouseEvent &ME)
 
bool IsHiddenByTool (const MapElementT *Elem) const
 The caller calls this method in order to learn whether it should exempt the given map element Elem from normal 2D and 3D rendering. This is usually true when Elem is currently being modified by the tool and thus rendered (in a special way) by the tool itself. Examples include brushes being morphed and terrains being edited. More...
 
void RenderTool2D (Renderer2DT &Renderer) const
 
void RenderTool3D (Renderer3DT &Renderer) const
 
void NotifySubjectChanged_Deleted (SubjectT *Subject, const ArrayT< MapPrimitiveT * > &Primitives)
 Notifies the observer that one or more map primitives have been deleted. More...
 
void NotifySubjectChanged_Modified (SubjectT *Subject, const ArrayT< MapElementT * > &MapElements, MapElemModDetailE Detail)
 
void NotifySubjectChanged_Modified (SubjectT *Subject, const ArrayT< MapElementT * > &MapElements, MapElemModDetailE Detail, const ArrayT< BoundingBox3fT > &OldBounds)
 
void NotifySubjectDies (SubjectT *dyingSubject)
 This method is called whenever a subject is about the be destroyed (and become unavailable). More...
 
virtual const
cf::TypeSys::TypeInfoT
GetType () const
 
- Public Member Functions inherited from ToolT
 ToolT (MapDocumentT &MapDoc, ToolManagerT &ToolMan)
 The constructor. More...
 
virtual ~ToolT ()
 The destructor. More...
 
void Activate (ToolT *OldTool)
 
void Deactivate (ToolT *NewTool)
 
bool IsActiveTool () const
 
virtual bool CanDeactivate ()
 
virtual bool UpdateStatusBar (ChildFrameT *ChildFrame) const
 
virtual bool OnChar2D (ViewWindow2DT &ViewWindow, wxKeyEvent &KE)
 
virtual bool OnMMouseDown2D (ViewWindow2DT &ViewWindow, wxMouseEvent &ME)
 Also used for MMB "double-click" events (use ME.ButtonDClick() for distinction). More...
 
virtual bool OnRMouseClick2D (ViewWindow2DT &ViewWindow, wxMouseEvent &ME)
 For the RMB, only a "click" event is available, because the RMB is also used for mouse-looking and the context menu. More...
 
virtual bool OnMouseWheel2D (ViewWindow2DT &ViewWindow, wxMouseEvent &ME)
 
virtual bool OnChar3D (ViewWindow3DT &ViewWindow, wxKeyEvent &KE)
 
virtual bool OnMMouseDown3D (ViewWindow3DT &ViewWindow, wxMouseEvent &ME)
 Also used for MMB "double-click" events (use ME.ButtonDClick() for distinction). More...
 
virtual bool OnRMouseClick3D (ViewWindow3DT &ViewWindow, wxMouseEvent &ME)
 For the RMB, only a "click" event is available, because the RMB is also used for mouse-looking and the context menu. More...
 
virtual bool OnMouseWheel3D (ViewWindow3DT &ViewWindow, wxMouseEvent &ME)
 
virtual int OnContextMenu3D (ViewWindow3DT &ViewWindow, wxContextMenuEvent &CE, wxMenu &Menu)
 
virtual bool OnIdle3D (ViewWindow3DT &ViewWindow, const wxPoint &Point)
 
- Public Member Functions inherited from ObserverT
virtual void NotifySubjectChanged (SubjectT *Subject, MapDocOtherDetailT OtherDetail)
 Notifies the observer that some other detail than those specifically addressed below has changed. More...
 
virtual void NotifySubjectChanged_Selection (SubjectT *Subject, const ArrayT< MapElementT * > &OldSelection, const ArrayT< MapElementT * > &NewSelection)
 Notifies the observer that the selection in the current subject has been changed. More...
 
virtual void NotifySubjectChanged_Groups (SubjectT *Subject)
 Notifies the observer that the groups in the current subject have been changed (new group added, group deleted, visibility changed, anything). More...
 
virtual void NotifySubjectChanged_Created (SubjectT *Subject, const ArrayT< IntrusivePtrT< cf::GameSys::EntityT > > &Entities)
 Notifies the observer that one or more entities have been created. More...
 
virtual void NotifySubjectChanged_Created (SubjectT *Subject, const ArrayT< MapPrimitiveT * > &Primitives)
 Notifies the observer that one or more map primitives have been created. More...
 
virtual void NotifySubjectChanged_Deleted (SubjectT *Subject, const ArrayT< IntrusivePtrT< cf::GameSys::EntityT > > &Entities)
 Notifies the observer that one or more entities have been deleted. More...
 
virtual ~ObserverT ()
 The virtual destructor. More...
 
virtual void Notify_EntChanged (SubjectT *Subject, const ArrayT< IntrusivePtrT< MapEditor::CompMapEntityT > > &Entities, EntityModDetailE Detail)
 
virtual void Notify_VarChanged (SubjectT *Subject, const cf::TypeSys::VarBaseT &Var)
 Notifies the observer that a variable has changed. More...
 

Static Public Member Functions

static void * CreateInstance (const cf::TypeSys::CreateParamsT &Params)
 
- Static Public Member Functions inherited from ToolT
static void * CreateInstance (const cf::TypeSys::CreateParamsT &Params)
 

Static Public Attributes

static const cf::TypeSys::TypeInfoT TypeInfo
 
- Static Public Attributes inherited from ToolT
static const cf::TypeSys::TypeInfoT TypeInfo
 

Additional Inherited Members

- Protected Member Functions inherited from ObserverT
 ObserverT ()
 The constructor. It is protected so that only derived classes can create instances of this class. More...
 
- Protected Attributes inherited from ToolT
MapDocumentTm_MapDoc
 The document that is modified by this tool. More...
 
ToolManagerTm_ToolMan
 The tool manager that manages this tool. More...
 

Member Function Documentation

void ToolTerrainEditorT::ExportHeightMap ( wxString  FileName,
ExportFileTypeE  ExportFileType 
)

Exports the height data to a file in the specified file format.

Parameters
FileNameThe full path to the filename in which the height data should be stored.
ExportFileTypeThe file format used to store the height data.
void ToolTerrainEditorT::GenerateTerrain ( int  Octaves,
double  Frequency,
double  Persistence,
double  Lacunarity,
int  Seed 
)

Generates the terrains height data using Perlin noise with the given parameters.

wxWindow * ToolTerrainEditorT::GetOptionsBar ( )
virtual

Returns the options bar window associated with this tool. NULL if no options bar has been assigned.

Reimplemented from ToolT.

unsigned long ToolTerrainEditorT::GetResolution ( )
inline

Gets the resolution of the terrain currently attached to the tool.

Returns
Resolution of the currently attached terrain.
int ToolTerrainEditorT::GetWxEventID ( ) const
inlinevirtual

Returns the ID of the wxWidgets event (menu selection or toolbar button click) that is associated with activating this tool.

Implements ToolT.

void ToolTerrainEditorT::ImportHeightMap ( const wxString &  FileName)

Imports the height data in the passed file into the terrain currently attached to the tool.

If no terrain is attached to the tool nothing is done.

bool ToolTerrainEditorT::IsHiddenByTool ( const MapElementT Elem) const
virtual

The caller calls this method in order to learn whether it should exempt the given map element Elem from normal 2D and 3D rendering. This is usually true when Elem is currently being modified by the tool and thus rendered (in a special way) by the tool itself. Examples include brushes being morphed and terrains being edited.

Reimplemented from ToolT.

bool ToolTerrainEditorT::IsTerrainSelected ( )
inline

Checks if the tool has a terrain selected.

Returns
Whether a terrain is selected by the tool.
void ToolTerrainEditorT::NotifySubjectChanged_Deleted ( SubjectT Subject,
const ArrayT< MapPrimitiveT * > &  Primitives 
)
virtual

Notifies the observer that one or more map primitives have been deleted.

Parameters
SubjectThe map document in which the primitives have been deleted.
PrimitivesList of deleted map primitives.

Reimplemented from ObserverT.

void ToolTerrainEditorT::NotifySubjectChanged_Modified ( SubjectT Subject,
const ArrayT< MapElementT * > &  MapElements,
MapElemModDetailE  Detail 
)
virtual
Parameters
SubjectThe map document in which the elements have been modified.
MapElementsList of modified map elements.
DetailInformation about what has been modified: Can be one of MEMD_PRIMITIVE_PROPS_CHANGED, MEMD_GENERIC, MEMD_ASSIGN_PRIM_TO_ENTITY and MEMD_MATERIAL_CHANGED.

Reimplemented from ObserverT.

void ToolTerrainEditorT::NotifySubjectChanged_Modified ( SubjectT Subject,
const ArrayT< MapElementT * > &  MapElements,
MapElemModDetailE  Detail,
const ArrayT< BoundingBox3fT > &  OldBounds 
)
virtual
Parameters
SubjectThe map document in which the elements have been modified.
MapElementsList of modified map elements.
DetailInformation about what has been modified: Can be MEMD_TRANSFORM or MEMD_PRIMITIVE_PROPS_CHANGED. In the case of MEMD_PRIMITIVE_PROPS_CHANGED one can assume that only map primitives (no entities) are in the MapElements array.
OldBoundsHolds the bounds of each objects BEFORE the modification (has the same size as MapElements).

Reimplemented from ObserverT.

void ToolTerrainEditorT::NotifySubjectDies ( SubjectT dyingSubject)
virtual

This method is called whenever a subject is about the be destroyed (and become unavailable).

Parameters
dyingSubjectThe subject that is being destroyed.

Implements ObserverT.

bool ToolTerrainEditorT::OnLMouseDown2D ( ViewWindow2DT ViewWindow,
wxMouseEvent &  ME 
)
virtual

Also used for LMB "double-click" events (use ME.ButtonDClick() for distinction).

Reimplemented from ToolT.

bool ToolTerrainEditorT::OnLMouseDown3D ( ViewWindow3DT ViewWindow,
wxMouseEvent &  ME 
)
virtual

Also used for LMB "double-click" events (use ME.ButtonDClick() for distinction).

Reimplemented from ToolT.

void ToolTerrainEditorT::SetResolution ( unsigned long  Resolution)

Updates the resolution of the terrain currently attached to the tool.

If no terrain is attached to the tool nothing is done.

void ToolTerrainEditorT::SetToolDialog ( TerrainEditorDialogT TerrainEditorDialog)

Sets the dialog that is asociated with this tool.

Without a dialog certain tool parameters can't be read (like radius etc.) and the tool is not functional. This method should be called as soon as possible after the tool has been created.

Parameters
TerrainEditorDialogThe dialog of this tool.
void ToolTerrainEditorT::UpdateGaussWeights ( )

Updates the gauss kernel according to the passed tool effect.

void ToolTerrainEditorT::UpdateModifyWeights ( )

Updates the modification matrix using the passed radius and hardness.

void ToolTerrainEditorT::UpdateNoiseWeights ( )

Updates the noise weights according to the passed radius.


The documentation for this class was generated from the following files: