Cafu Engine
MapPrimitiveT Class Referenceabstract

This class adds no functionality of its own, but only exists for proper type separation. More...

#include "MapPrimitive.hpp"

Inheritance diagram for MapPrimitiveT:

Public Member Functions

 MapPrimitiveT (const wxColour &Color)
 The default constructor. More...
 
 MapPrimitiveT (const MapPrimitiveT &Prim)
 The copy constructor for copying a primitive. More...
 
virtual MapPrimitiveTClone () const =0
 The virtual copy constructor. More...
 
wxColour GetColor (bool ConsiderGroup=true) const
 This method returns the "inherent" color of this map element. More...
 
virtual const
cf::TypeSys::TypeInfoT
GetType () const
 
- Public Member Functions inherited from MapElementT
 MapElementT ()
 The default constructor. More...
 
 MapElementT (const MapElementT &Elem)
 The copy constructor for copying a map element. More...
 
virtual ~MapElementT ()
 The virtual destructor. More...
 
virtual void Load_cmap (TextParserT &TP, MapDocumentT &MapDoc, bool IgnoreGroups)
 
virtual void Save_cmap (std::ostream &OutFile, unsigned long ElemNr, const MapDocumentT &MapDoc) const
 
MapEditor::CompMapEntityTGetParent () const
 Returns the entity that this element is a part of, or NULL if the element has no parent entity. More...
 
void SetParent (MapEditor::CompMapEntityT *Ent)
 Sets the parent entity that is element is a part of. More...
 
bool IsSelected () const
 Returns whether this element is currently selected in the map document. More...
 
void SetSelected (bool Selected=true)
 Sets the selection state of this element. More...
 
virtual bool IsTranslucent () const
 Returns whether this map element is (entirely or partially) translucent. More...
 
virtual wxString GetDescription () const
 
GroupTGetGroup () const
 Returns NULL when this map element is in no group, or the pionter to the group it is a member of otherwise. More...
 
void SetGroup (GroupT *Group)
 Sets the group this element is a member of (use NULL for "no group"). More...
 
bool IsVisible () const
 Returns whether this map element is currently visible (in the 2D, 3D and other views). More...
 
bool CanSelect () const
 Returns whether this map element can currently be selected (in the 2D, 3D and other views). More...
 
void GetToggleEffects (ArrayT< MapElementT * > &RemoveFromSel, ArrayT< MapElementT * > &AddToSel, bool AutoGroupEntities)
 Computes how the selection must be changed in order to toggle the given element when the element's entity and group memberships are taken into account. More...
 
virtual void AdvanceTime (float t)
 This is periodically called in order to have the element advance its internal clock by t seconds. More...
 
virtual void Render2D (Renderer2DT &Renderer) const
 
virtual void Render3D (Renderer3DT &Renderer) const
 
virtual BoundingBox3fT GetBB () const =0
 Returns the spatial bounding-box of this map element. More...
 
virtual bool TraceRay (const Vector3fT &RayOrigin, const Vector3fT &RayDir, float &Fraction, unsigned long &FaceNr) const
 Traces a ray against this map element, and returns whether it was hit. More...
 
virtual bool TracePixel (const wxPoint &Pixel, int Radius, const ViewWindow2DT &ViewWin) const
 This method determines if this map element is intersected/affected by the specified disc in ViewWin. More...
 
virtual TrafoMementoTGetTrafoState () const
 Returns a memento that encapsulates the transform-related state of this element. More...
 
virtual void RestoreTrafoState (const TrafoMementoT *TM)
 Restores the transform-related state of this element from the given memento. More...
 
virtual void TrafoMove (const Vector3fT &Delta, bool LockTexCoords)
 Translates this element by the given vector (in world-space). More...
 
virtual void TrafoRotate (const Vector3fT &RefPoint, const cf::math::AnglesfT &Angles, bool LockTexCoords)
 Rotates this element about the given reference point (in world-space). More...
 
virtual void TrafoScale (const Vector3fT &RefPoint, const Vector3fT &Scale, bool LockTexCoords)
 Scales this element about the given reference point (in world-space). More...
 
virtual void TrafoMirror (unsigned int NormalAxis, float Dist, bool LockTexCoords)
 Mirrors this element along the given mirror plane (in world-space). More...
 
virtual void Transform (const Matrix4x4fT &Matrix, bool LockTexCoords)
 Why does this method not replace all the other Trafo*() methods? This method is the most generic, allowing transformations that e.g. More...
 
unsigned int GetFrameCount () const
 
void SetFrameCount (unsigned int FrameCount)
 

Static Public Member Functions

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

Static Public Attributes

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

Additional Inherited Members

- Protected Attributes inherited from MapElementT
MapEditor::CompMapEntityTm_Parent
 The entity that this element is a part of. More...
 
bool m_IsSelected
 Is this element currently selected in the map document? More...
 
GroupTm_Group
 The group this element is in, NULL if in no group. More...
 
unsigned int m_FrameCount
 The number of the frame in which this element was last rendered in a 3D view, used in order to avoid processing/rendering it twice. More...
 

Detailed Description

This class adds no functionality of its own, but only exists for proper type separation.

Especially MapBaseEntityT keeps a MapEntRepresT and an array of MapPrimitiveTs, and the two "sets" must not overlap (we don't want MapEntRepresT instances among the "regular" primitives, and no regular primitive should ever be in place of the m_Repres member). In many other regards, all derived classes are considered equivalent and treated the same; then we use arrays of MapElementTs. The clear distinction between MapElementTs and MapPrimitiveTs (the former can also contain MapEntRepresTs, the latter cannot) is also a great help in documentation and communication.

Constructor & Destructor Documentation

MapPrimitiveT::MapPrimitiveT ( const wxColour &  Color)

The default constructor.

MapPrimitiveT::MapPrimitiveT ( const MapPrimitiveT Prim)

The copy constructor for copying a primitive.

Parameters
PrimThe primitive to copy-construct this primitive from.

Member Function Documentation

virtual MapPrimitiveT* MapPrimitiveT::Clone ( ) const
pure virtual

The virtual copy constructor.

Creates a copy of this primitive that is of the same class as the original, even when called via a base class pointer (the caller doesn't need to know the exact derived class).

Implemented in MapBezierPatchT, MapBrushT, MapTerrainT, MapModelT, and MapPlantT.

wxColour MapPrimitiveT::GetColor ( bool  ConsiderGroup = true) const
virtual

This method returns the "inherent" color of this map element.

The returned color should be used for rendering the map element whenever no better (e.g. texture-mapped) alternative is available.

Parameters
ConsiderGroupWhether the map elements group color should be taken into account.
Returns
the "inherent" color of this map element. When the map element is in a group and ConsiderGroup is true, the group color is returned. When the map element is an entity, the color of the entity class is returned. Otherwise (the element is a primitive), when the map element is part of an entity, the entity color is returned. Finally (it's a map primitive that is in the world), its native color is returned.

Implements MapElementT.


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