ALBA
|
#include <albaCameraTransform.h>
Public Types | |
enum | AutoPositionModalities { ATTACH_TO_FOCAL_POINT , ATTACH_TO_CAMERA , ATTACH_TO_CLIPPING_PLANE } |
enum | AutoFittingModalities { MAX_SCALE , MIN_SCALE , FIT_X , FIT_Y , ANISOTROPIC , NUM_OF_MAPPINGS } |
enum | AutoScalingModalities { AUTO_FITTING , PRESERVE_SIZE } |
Public Member Functions | |
albaCameraTransform () | |
virtual | ~albaCameraTransform () |
albaTypeMacro (albaCameraTransform, albaTransformBase) | |
void | SetRenderer (vtkRenderer *ren) |
vtkRenderer * | GetRenderer () |
void | SetBounds (albaOBB *bounds) |
albaOBB * | GetBounds () |
void | SetFollowPosition (int flag) |
int | GetFollowPosition () |
void | FollowPositionOn () |
void | FollowPositionOff () |
void | SetFollowOrientation (int flag) |
int | GetFollowOrientation () |
void | FollowOrientationOn () |
void | FollowOrientationOff () |
void | SetFollowScale (int flag) |
int | GetFollowScale () |
void | FollowScaleOn () |
void | FollowScaleOff () |
void | SetPositionMode (int type) |
int | GetPositionMode () |
void | SetPositionModeToAttachToFocalPoint () |
void | SetPositionModeToAttachToCamera () |
void | SetPositionModeToAttachToClippingPlane () |
void | SetScalingMode (int mode) |
int | GetScalingMode () |
void | SetScalingModeToAutoFitting () |
void | SetScalingModeToPreserveSize () |
void | SetFittingMode (int mode) |
int | GetFittingMode () |
virtual unsigned long | GetMTime () |
virtual int | DeepCopy (albaCameraTransform *trans) |
void | UpdatePoseMatrix (albaMatrix *matrix, albaMatrix *old_view_matrix, albaMatrix *new_view_matrix) |
void | AutoOrientation () |
void | AutoPosition () |
void | AutoFitting () |
void | AutoFitting2 () |
void | RecomputeAll () |
Public Member Functions inherited from albaTransformBase | |
albaTransformBase () | |
~albaTransformBase () | |
albaTransformBase (const albaTransformBase &) | |
albaAbstractTypeMacro (albaTransformBase, albaReferenceCounted) | |
virtual void | Print (std::ostream &os, const int indent=0) const |
virtual const albaMatrix & | GetMatrix () |
albaMatrix * | GetMatrixPointer () |
void | TransformPoint (const float in[3], float out[3]) |
void | TransformPoint (const double in[3], double out[3]) |
void | TransformNormalAtPoint (const float point[3], const float in[3], float out[3]) |
void | TransformNormalAtPoint (const double point[3], const double in[3], double out[3]) |
void | TransformVectorAtPoint (const float point[3], const float in[3], float out[3]) |
void | TransformVectorAtPoint (const double point[3], const double in[3], double out[3]) |
virtual void | Update () |
void | Modified () |
virtual void | InternalTransformPoint (const double in[3], double out[3]) |
virtual void | InternalTransformPoint (const float in[3], float out[3]) |
virtual unsigned long | GetMTime () |
virtual unsigned long | GetUpdateTime () |
void | SetTimeStamp (albaTimeStamp t) |
albaTimeStamp | GetTimeStamp () |
Public Member Functions inherited from albaReferenceCounted | |
albaReferenceCounted () | |
virtual | ~albaReferenceCounted () |
albaAbstractTypeMacro (albaReferenceCounted, albaObject) | |
virtual void | Delete () |
void | Register (void *obj) |
virtual void | UnRegister (void *obj) |
int | GetReferenceCount () |
void | SetReferenceCount (int) |
Public Member Functions inherited from albaObject | |
albaObject () | |
virtual | ~albaObject () |
virtual void | Delete () |
virtual const char * | GetTypeName () const |
virtual bool | IsA (const char *type_name) const |
virtual bool | IsA (const albaTypeID &type_id) const |
virtual albaObject * | NewObjectInstance () const =0 |
virtual const albaTypeID & | GetTypeId () const |
virtual void | Print (std::ostream &os, const int indent=0) const |
albaObject (const albaObject &c) | |
Public Member Functions inherited from albaEventBroadcaster | |
albaEventBroadcaster (void *owner=NULL) | |
virtual | ~albaEventBroadcaster () |
albaEventBroadcaster (const albaEventBroadcaster &c) | |
void | AddObserver (albaObserver *obj) |
void | AddObserver (albaObserver &obj) |
albaObserverCallback * | AddObserverCallback (void(*f)(void *sender, albaID eid, void *clientdata, void *calldata)) |
bool | RemoveObserver (albaObserver *obj) |
void | RemoveAllObservers () |
bool | IsObserver (albaObserver *obj) |
bool | HasObservers () |
void | GetObservers (std::vector< albaObserver * > &olist) |
void | InvokeEvent (albaEventBase &e) |
void | InvokeEvent (albaEventBase *e) |
void | InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL) |
void | SetChannel (albaID ch) |
albaID | GetChannel () |
virtual void | SetListener (albaObserver *o) |
Public Member Functions inherited from albaEventSender | |
albaEventSender () | |
virtual void | SetListener (albaObserver *o) |
virtual albaObserver * | GetListener () |
virtual bool | HasListener () |
virtual void | InvokeEvent (albaEventBase &e) |
virtual void | InvokeEvent (albaEventBase *e) |
virtual void | InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL) |
Static Public Member Functions | |
static void | AutoOrientation (albaMatrix *matrix, vtkRenderer *ren) |
static void | AutoPosition (albaMatrix *matrix, vtkRenderer *ren, int mode=ATTACH_TO_FOCAL_POINT) |
static void | AutoFitting (albaMatrix *matrix, albaOBB *tracked_bounds, vtkRenderer *ren, int mode=MIN_SCALE) |
static void | AutoFitting2 (albaMatrix *matrix, albaOBB *tracked_bounds, vtkRenderer *ren, int mode=ANISOTROPIC) |
static void | ComputeScaling (albaOBB *inBox, albaOBB *outBox, double *scale, int mode=MIN_SCALE) |
Static Public Member Functions inherited from albaObject | |
static const char * | GetStaticTypeName () |
static bool | IsStaticType (const char *type_name) |
static bool | IsStaticType (const albaTypeID &type_id) |
static const albaTypeID & | GetStaticTypeId () |
static albaObject * | SafeDownCast (albaObject *o) |
Protected Member Functions | |
virtual void | InternalUpdate () |
virtual void | InternalUpdate ()=0 |
Static Protected Member Functions | |
static void | InternalProcessEvents (vtkObject *sender, unsigned long channel, void *clientdata, void *calldata) |
Protected Attributes | |
vtkRenderer * | m_Renderer |
vtkCamera * | m_Camera |
int | m_FollowPosition |
int | m_FollowOrientation |
int | m_FollowScale |
int | m_PositionMode |
int | m_ScalingMode |
int | m_FittingMode |
albaOBB * | m_Bounds |
float | m_OldViewAngle |
double | m_OldDistance |
albaMatrix * | m_OldViewMatrix |
vtkCallbackCommand * | m_EventRouter |
Protected Attributes inherited from albaTransformBase | |
albaAutoPointer< albaMatrix > | m_Matrix |
albaMTime | m_MTime |
albaMTime | m_UpdateTime |
albaMutexLock | m_UpdateMutex |
albaTimeStamp | m_TimeStamp |
Protected Attributes inherited from albaReferenceCounted | |
int | m_ReferenceCount |
Protected Attributes inherited from albaObject | |
bool | m_HeapFlag |
Protected Attributes inherited from albaEventBroadcaster | |
albaObserversList | m_Observers |
albaID | m_Channel |
Protected Attributes inherited from albaEventSender | |
albaObserver * | m_Listener |
Additional Inherited Members | |
Protected Types inherited from albaEventBroadcaster | |
typedef std::list< albaObserver * > | albaObserversList |
Implement transform between view coordinates to world coordinates.
albaCameraTransform is a class implementing transform between view coordinate system to world coordinate system. The renderer storing the coordinate system must be provided as input. This transforms maps points from the view coordinate system to a specified coordinate system. By default (TargetFrame=I) to the World coordinate system. In general the view coordinate system has the following spawning: X [-1,1] , where -1 is left frustum plane Y [-1,1] , where -1 is the bottom frustum plane Z [-1,1] , for Z there can be different mapping strategies:
You can enable single features:
With orientation enabled the transform will always try to take the input matrix and rotate it such that it points to the camera (supposed 0,0,0 means orientated toward the camera). The original orientation is cumulated. With position enabled the transform will try to translate the matrix to be in the same position when the camera moves. 0,0,0 means in the focus point.
Definition at line 64 of file albaCameraTransform.h.
Enumerator | |
---|---|
ATTACH_TO_FOCAL_POINT | Follow the focal point. |
ATTACH_TO_CAMERA | Follow the camera position. |
ATTACH_TO_CLIPPING_PLANE | Follow the neat clipping plane. |
Definition at line 72 of file albaCameraTransform.h.
Definition at line 79 of file albaCameraTransform.h.
Enumerator | |
---|---|
AUTO_FITTING | scale the bounds to fit the camera frustum |
PRESERVE_SIZE | scale the bounds to appear at constant size (use with ATTACH_TO_CAMERA) |
Definition at line 89 of file albaCameraTransform.h.
albaCameraTransform::albaCameraTransform | ( | ) |
|
virtual |
albaCameraTransform::albaTypeMacro | ( | albaCameraTransform | , |
albaTransformBase | |||
) |
void albaCameraTransform::SetRenderer | ( | vtkRenderer * | ren | ) |
Set the renderer used as input for this transform.
|
inline |
Return the renderer used as input for this transform.
Definition at line 99 of file albaCameraTransform.h.
|
inline |
Set the bounds of the object that should follow the camera.
This is necessary to allow the the right scaling.
Definition at line 104 of file albaCameraTransform.h.
|
inline |
Definition at line 105 of file albaCameraTransform.h.
|
inline |
Enable/Disable following of the camera position.
Definition at line 108 of file albaCameraTransform.h.
References albaTransformBase::Modified().
|
inline |
Definition at line 109 of file albaCameraTransform.h.
|
inline |
Definition at line 110 of file albaCameraTransform.h.
|
inline |
Definition at line 111 of file albaCameraTransform.h.
|
inline |
Enable/Disable following of the camera orientation.
Definition at line 114 of file albaCameraTransform.h.
References albaTransformBase::Modified().
|
inline |
Definition at line 115 of file albaCameraTransform.h.
|
inline |
Definition at line 116 of file albaCameraTransform.h.
|
inline |
Definition at line 117 of file albaCameraTransform.h.
|
inline |
Enable/Disable following of the camera scaling.
Definition at line 120 of file albaCameraTransform.h.
References albaTransformBase::Modified().
|
inline |
Definition at line 121 of file albaCameraTransform.h.
|
inline |
Definition at line 122 of file albaCameraTransform.h.
|
inline |
Definition at line 123 of file albaCameraTransform.h.
|
inline |
Set the modality to fit the Z coordinate.
See class comment.
Definition at line 126 of file albaCameraTransform.h.
References albaTransformBase::Modified().
|
inline |
Definition at line 127 of file albaCameraTransform.h.
|
inline |
Definition at line 128 of file albaCameraTransform.h.
|
inline |
Definition at line 129 of file albaCameraTransform.h.
|
inline |
Definition at line 130 of file albaCameraTransform.h.
|
inline |
Set which kind of scaling should be applied to the transform.
Definition at line 133 of file albaCameraTransform.h.
|
inline |
Definition at line 134 of file albaCameraTransform.h.
void albaCameraTransform::SetScalingModeToAutoFitting | ( | ) |
Set scaling mode to AUTO_FITTING: the transform try to fit the given m_Bounds (see SetBounds() ) to the view frustum.
Fitting can occur in different ways (see SetFittingMode() ). Notice the m_Bounds can be any size, the transform will provide the right scaling.
void albaCameraTransform::SetScalingModeToPreserveSize | ( | ) |
(not yet implemented) Set scaling mode to PRESERVE_SIZE.
This should scale the 3D object to keep display size fixed with respect to the view port. In this case the m_Bounds (see SetBounds() ) should be expressed in normalized coordinates, where X and Y represent view port coords, and Z... yet to be defined :-) .
|
inline |
set which kind of AutoFitting strategy should be used
Definition at line 152 of file albaCameraTransform.h.
References albaTransformBase::Modified().
|
inline |
Definition at line 153 of file albaCameraTransform.h.
|
virtual |
Get the MTime: this is the bit of magic that makes everything work.
This MTime takes in consideration also the camera's MTime
Reimplemented from albaTransformBase.
|
virtual |
void albaCameraTransform::UpdatePoseMatrix | ( | albaMatrix * | matrix, |
albaMatrix * | old_view_matrix, | ||
albaMatrix * | new_view_matrix | ||
) |
Change the given matrix to follow camera movements.
|
static |
change matrix orientation to create a transform making points to be oriented according to camera orientation.
Translation is left unchanged while scale is reset to 1. The input matrix posiiton is used to compute the direction, in case call AutoPosition() before of this.
|
inline |
Definition at line 170 of file albaCameraTransform.h.
References AutoOrientation().
Referenced by AutoOrientation().
|
static |
change matrix translation to create a transform making points to be centered into the camera's focal point.
Orientation and scale are left unchanged
|
inline |
Definition at line 176 of file albaCameraTransform.h.
References AutoPosition().
Referenced by AutoPosition().
|
static |
Change matrix scale to create a transform making two boxes to fit.Translation and Orientation are left unchanged.
Fitting can occur according to different modalities.
|
inline |
Definition at line 183 of file albaCameraTransform.h.
References AutoFitting().
Referenced by AutoFitting().
|
static |
Change matrix scale to create a transform making two boxes to fit.
Translation and Orientation are left unchanged. This specific algrothim is thought to be used with AutoPosition() and ATTACH_TO_FOCAL_POINT mode. Fitting can occur according to different modalities.
|
inline |
Definition at line 191 of file albaCameraTransform.h.
References AutoFitting2().
Referenced by AutoFitting2().
|
static |
Compute scale between two boxes according to given modality:
void albaCameraTransform::RecomputeAll | ( | ) |
|
protectedvirtual |
Updates the internal matrix.
Implements albaTransformBase.
|
staticprotected |
|
protected |
This stores the renderer used as input.
Definition at line 210 of file albaCameraTransform.h.
|
protected |
this is to find if the render's active camera is changed
Definition at line 211 of file albaCameraTransform.h.
|
protected |
Flag for enabling the translation according to camera position.
Definition at line 212 of file albaCameraTransform.h.
|
protected |
Flag for enabling the re-orientation according to camera position.
Definition at line 213 of file albaCameraTransform.h.
|
protected |
Flag for enabling the scaling according to camera frustum.
Definition at line 214 of file albaCameraTransform.h.
|
protected |
Modality defining the rule to set the position with respect to the camera.
Definition at line 215 of file albaCameraTransform.h.
|
protected |
Kind of scaling policy (.
Definition at line 216 of file albaCameraTransform.h.
|
protected |
Kind of scaling used to fit the view frustum.
Definition at line 217 of file albaCameraTransform.h.
|
protected |
m_Bounds of the object that should follow the camera
Definition at line 219 of file albaCameraTransform.h.
|
protected |
Definition at line 221 of file albaCameraTransform.h.
|
protected |
Definition at line 222 of file albaCameraTransform.h.
|
protected |
Definition at line 223 of file albaCameraTransform.h.
|
protected |
Definition at line 225 of file albaCameraTransform.h.