Linderdaum Engine: clGizmo Class Reference
Updated: Sun Feb 5 2012 22:59:50
clGizmo Class Reference

Generic visual modifier for 3d property tweaking. More...

#include <Gizmos.h>

List of all members.

Public Member Functions

 clGizmo ()
virtual ~clGizmo ()
virtual void AfterConstruction ()
void BindToPropVector (iObject *Obj, const std::string &Prop)
void BindToPropMatrix (iObject *Obj, const std::string &Prop)
void BindToPropQuat (iObject *Obj, const std::string &Prop)
void BindToVarVector (const std::string &VarName)
void BindToVarMatrix (const std::string &VarName)
void BindToVarQuat (const std::string &VarName)
void BindToVectorPtr (LVector3 *Ptr)
void BindToMatrixPtr (LMatrix4 *Ptr)
void BindToQuatPtr (LQuaternion *Ptr)
void Unbind ()
 Tear down any link.
virtual void FetchInitialPropertyValue ()
 Called inside a Bind() call for initial value fetch.
virtual void SetCurrentValue ()
 Called in Update() or somewhere else to store immediate current value.
void Register ()
 Autonomous work mode.
void Unregister ()
 Autonomouse work mode - event handler deregistration.
virtual void AddDebugGeometry (clScene *S)
 Add some debug geometry when entring the scene "OnSceneEnter".
virtual void RemoveDebugGeometry (clScene *S)
 Remove added debug geometry when entring the scene "OnSceneEnter".
virtual void SetTransform (const LMatrix4 &Mtx)
virtual LMatrix4 GetTransform () const
virtual void UpdateTransform ()
 TODO : EulerAngleSystem to .NET export.
void LoadGeoms ()
void ClearGeoms ()
int GetClosestPart (const LMatrix4 &Proj, const LMatrix4 &View, float X, float Y, LVector3 &isect)
bool InstersectsWithPart (int Part, const LMatrix4 &Proj, const LMatrix4 &View, float X, float Y, LVector3 &isect)
virtual bool IntersectsWithRay (const LMatrix4 &Proj, const LMatrix4 &View, const LVector3 &P, const LVector3 &Dir, LVector3 &isect)
 TODO : Heading, Up, Side.
virtual void Update (float DT)
 Hmmm.... Actor/Entity cloning. Yeah, I know.
virtual void OnMouseDown (const LMatrix4 &Proj, const LMatrix4 &View, float MX, float MY)
virtual void OnMouseMove (float MX, float MY)
virtual void OnMouseUp ()
void SetStartTransform (const LMatrix4 &M)
virtual LMatrix4 CalculateTransform (float MX, float MY)
LVector3 GetActivePoint (const LMatrix4 &CoordSys, float MX, float MY)
 Get the point under mouse cursor on the selected plane/line/gizmo_circle.
virtual void Event_TIMER (LEvent Event, const LEventArgs &Args)
virtual void Event_KEY (LEvent Event, const LEventArgs &Args)

Static Public Member Functions

static LMatrix4 AlignToScreen (const LMatrix3 &Cam, const LMatrix4 &Src)

Public Attributes

LMatrix4 FProj
 Cached camera transform and projection.
LMatrix4 FView
LGizmoCoordSys FCoords
clSceneLocalScene
LMatrix4 FLocalTransform
LMatrix4 FLocalTransformInv
std::vector< LMatrix4PartTransform
std::vector< LMatrix4PartTransformInv
std::vector< clGeom * > Parts
std::vector< clMaterial * > Materials
std::vector< intPartID
std::vector< std::string > PartNames
std::vector< std::string > MaterialNames
clMaterialFSelectedColorMaterial
 Yellow material.
bool FPerformingAction
 Are we performing action or not.
int FClickedPart
 Stored index.
float FOldMouseX
float FOldMouseY
float FMouseX
float FMouseY
LVector3 FStartOffset
 Initial 3d point (in MouseDown handler)
LMatrix4 FStartTransform
 Original transformation.
LMatrix4 FCurrentTransform
 Current transformation.

Protected Attributes

bool FUseVector
 Binding to some vector.
bool FUseMatrix
 Binding to the fourth row of some transform matrix.
bool FUseQuat
 Bind to 4-vector with unit quaternion.
clCVarFVar
 Link to variable.
iObjectFObject
 Link to property.
std::string FProp
 Property name.
void * FDirectPtr
 Pointer to "somewhere" where the translation/transform resides.

Private Attributes

bool FHandleEvents
 Autonomous mode.
LEventSubscriber::LEventHandler FTimerHandler
 Local timer/key event handlers.
LEventSubscriber::LEventHandler FKeyHandler

Detailed Description

Generic visual modifier for 3d property tweaking.

Gizmos affect Rotation, Translation and Scale of some object. They can be binded to Matrix4/Vec3/Quat property, direct pointer or console variable.

To modify something in an interactive mode one must use the following template code:

"cl_SomeGizmo" * G = VisScene->Add...PropMtx( Object, "PropName" ); G->Register(); // add event handlers for key/mouse/timer .. the framework itself handles gizmos G->DisposeObject(); // remove after use


Constructor & Destructor Documentation

clGizmo::clGizmo ( )
clGizmo::~clGizmo ( ) [virtual]

Member Function Documentation

void clGizmo::AddDebugGeometry ( clScene S) [virtual]

Add some debug geometry when entring the scene "OnSceneEnter".

Reimplemented from clVisualObject.

void clGizmo::AfterConstruction ( ) [virtual]

Reimplemented from iObject.

LMatrix4 clGizmo::AlignToScreen ( const LMatrix3 Cam,
const LMatrix4 Src 
) [static]
void clGizmo::BindToMatrixPtr ( LMatrix4 Ptr)
void clGizmo::BindToPropMatrix ( iObject Obj,
const std::string &  Prop 
)
void clGizmo::BindToPropQuat ( iObject Obj,
const std::string &  Prop 
)
void clGizmo::BindToPropVector ( iObject Obj,
const std::string &  Prop 
)
void clGizmo::BindToQuatPtr ( LQuaternion Ptr)
void clGizmo::BindToVarMatrix ( const std::string &  VarName)
void clGizmo::BindToVarQuat ( const std::string &  VarName)
void clGizmo::BindToVarVector ( const std::string &  VarName)
void clGizmo::BindToVectorPtr ( LVector3 Ptr)
virtual LMatrix4 clGizmo::CalculateTransform ( float  MX,
float  MY 
) [inline, virtual]

Reimplemented in clRotateGizmo, and clTranslateGizmo.

void clGizmo::ClearGeoms ( )
void clGizmo::Event_KEY ( LEvent  Event,
const LEventArgs Args 
) [virtual]
void clGizmo::Event_TIMER ( LEvent  Event,
const LEventArgs Args 
) [virtual]

Redirect to update

virtual void clGizmo::FetchInitialPropertyValue ( ) [inline, virtual]

Called inside a Bind() call for initial value fetch.

Reimplemented in clRotateGizmo, and clTranslateGizmo.

LVector3 clGizmo::GetActivePoint ( const LMatrix4 CoordSys,
float  MX,
float  MY 
)

Get the point under mouse cursor on the selected plane/line/gizmo_circle.

int clGizmo::GetClosestPart ( const LMatrix4 Proj,
const LMatrix4 View,
float  X,
float  Y,
LVector3 isect 
)
virtual LMatrix4 clGizmo::GetTransform ( ) const [inline, virtual]

Reimplemented from clVisualObject.

bool clGizmo::InstersectsWithPart ( int  Part,
const LMatrix4 Proj,
const LMatrix4 View,
float  X,
float  Y,
LVector3 isect 
)
bool clGizmo::IntersectsWithRay ( const LMatrix4 Proj,
const LMatrix4 View,
const LVector3 P,
const LVector3 Dir,
LVector3 isect 
) [virtual]

TODO : Heading, Up, Side.

To TypeConverters :

LEulerAngleSystem scalar AngleSystemToStr StrToAngleSystem

To NetTypes :

LEulerAngleSystem scalar AngleSystemToString

Reimplemented from clVisualObject.

void clGizmo::LoadGeoms ( )
void clGizmo::OnMouseDown ( const LMatrix4 Proj,
const LMatrix4 View,
float  MX,
float  MY 
) [virtual]

Change color for selected part

void clGizmo::OnMouseMove ( float  MX,
float  MY 
) [virtual]
void clGizmo::OnMouseUp ( ) [virtual]
void clGizmo::Register ( )

Autonomous work mode.

void clGizmo::RemoveDebugGeometry ( clScene S) [virtual]

Remove added debug geometry when entring the scene "OnSceneEnter".

Reimplemented from clVisualObject.

virtual void clGizmo::SetCurrentValue ( ) [inline, virtual]

Called in Update() or somewhere else to store immediate current value.

Reimplemented in clRotateGizmo, and clTranslateGizmo.

void clGizmo::SetStartTransform ( const LMatrix4 M) [inline]
void clGizmo::SetTransform ( const LMatrix4 Mtx) [virtual]

Reimplemented from clVisualObject.

void clGizmo::Unbind ( )

Tear down any link.

void clGizmo::Unregister ( )

Autonomouse work mode - event handler deregistration.

void clGizmo::Update ( float  dt) [virtual]

Hmmm.... Actor/Entity cloning. Yeah, I know.

Reimplemented from clVisualObject.

Reimplemented in clRotateGizmo.

void clGizmo::UpdateTransform ( ) [virtual]

TODO : EulerAngleSystem to .NET export.

Called after something has changed in transformation

Reimplemented from clVisualObject.


Member Data Documentation

Stored index.

Current transformation.

void* clGizmo::FDirectPtr [protected]

Pointer to "somewhere" where the translation/transform resides.

bool clGizmo::FHandleEvents [private]

Autonomous mode.

iObject* clGizmo::FObject [protected]

Link to property.

Are we performing action or not.

Cached camera transform and projection.

std::string clGizmo::FProp [protected]

Property name.

Initial 3d point (in MouseDown handler)

Original transformation.

Local timer/key event handlers.

bool clGizmo::FUseMatrix [protected]

Binding to the fourth row of some transform matrix.

bool clGizmo::FUseQuat [protected]

Bind to 4-vector with unit quaternion.

bool clGizmo::FUseVector [protected]

Binding to some vector.

clCVar* clGizmo::FVar [protected]

Link to variable.

std::vector< std::string > clGizmo::MaterialNames
std::vector<int> clGizmo::PartID
std::vector< std::string > clGizmo::PartNames
std::vector<clGeom*> clGizmo::Parts

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