#include <baseManip.h>
Inheritance diagram for gutz::BaseManip:
Manipulators and Cameras handle transformations and interactions with objects/camera. We define several important spaces:
Here is how a MODEL/LOCAL space point is projected to the screen: reads from right to left
SCREEN<-(divide w)PROJECTION(camera)<-EYE(camera/view)<-WORLD<-MANIP(s...)<-point
That is, the point is multiplied by all Manip objects in chain to get it into WORLD space, then it is multiplied by the camera's view matrix to get it into EYE space, then it is multiplied by the camera's projection matrix to get it into PROJECTION space, finally a Viewport transform is applied to get it into SCREEN space. The inverse of this transform takes a screen space point into world space. Notice that after we apply the projection matrix we must divide all components by the "w" component of the resulting position, only then can we apply the screen transform. You should notice that in the Transform functions you can get the total transform from "LOCAL" space to "PROJECTION" space but not to "SCREEN" space, this is because you need to divide by "w" to get into projection space. This is why you can only get the matrix from SCREEN<-PROJECTION and visa/versa; you have two steps for a transformation from SCREEN<-LOCAL:
vec3f myPt = ....; /// transform a local point to the screen myPt = getProjectionTransform() * myPt; /// apply PROJECTION<-LOCAL myPt /= myPt.w /// divide by w myPt = getScreenTransform() * myPt; /// apply SCREEN<-PROJECTION /// now myPt is in screen space
Transformation chains are constructed by setting a manipulators parent to be another BaseManip, that means that the manipulator "lives" in it's parents space. Its parent could either be another manipulator or a Camera. Cameras can only be attached at the top of a transformation chain. See gutz::Manip for the interface for managing chains.
Definition at line 82 of file baseManip.h.
RTTI (Run-Time Type Information) | |
virtual bool | isCamera () const=0 |
virtual bool | isManip () const=0 |
Screen size functions | |
Valid (non zero) only if this object is a Camera, or if this is a Manip, the Camera has either been set during a mouse event or by the user. | |
virtual gutz::vec2ui | getScreen () const=0 |
virtual unsigned int | getScreenX () const=0 |
virtual unsigned int | getScreenY () const=0 |
Transformations | |
virtual gutz::mat4f | getProjectTransform () const=0 |
get the projection transform, PROJECTION<-LOCAL | |
virtual gutz::mat4f | getInvProjectTransform () const=0 |
get the inverse projection transform, PROJECTION->LOCAL | |
virtual gutz::mat4f | getScreenTransform () const=0 |
get the screen transform, SCREEN<-PROJECT this is weird because you must apply the Project transform, then divide by w, then apply the screen transform. | |
virtual gutz::mat4f | getInvScreenTransform () const=0 |
get the inverse screen transform, SCREEN->PROJECT | |
virtual gutz::mat4f | getEyeTransform () const=0 |
get the eye transform, EYE<-LOCAL, | |
virtual gutz::mat4f | getInvEyeTransform () const=0 |
get the inverse eye transform: EYE->LOCAL | |
virtual gutz::mat4f | getWorldTransform () const=0 |
get the world transform, WORLD<-LOCAL | |
virtual gutz::mat4f | getInvWorldTransform () const=0 |
get the inverse world transform: WORLD->LOCAL | |
virtual gutz::mat4f | getLocalTransform () const=0 |
get the LOCAL transform that this manipulator defines | |
virtual gutz::mat4f | getInvLocalTransform () const=0 |
get the inverse transform that this manipulator defines | |
virtual gutz::mat4f | getProjection () const=0 |
get the projection matrix currently associated with this transform chain | |
virtual gutz::mat4f | getInvProjection () const=0 |
get the inverse projection matrix (inverse of getProjection()) | |
virtual gutz::quatf | getEyeQuat () const=0 |
get the quaternion that expresses the total rotation: EYE<-LOCAL | |
virtual gutz::quatf | getInvEyeQuat () const=0 |
get the inverse quaternion for rotation: EYE->LOCAL | |
virtual gutz::quatf | getWorldQuat () const=0 |
get the quaternion for rotation: WORLD<-LOCAL | |
virtual gutz::quatf | getInvWorldQuat () const=0 |
get the inverse quaternion for rotation: WORLD->LOCAL | |
virtual gutz::quatf | getLocalQuat () const=0 |
get the local quaternion for rotation | |
virtual gutz::quatf | getInvLocalQuat () const=0 |
get the inverse local quaterinion for rotation | |
Position & orientation | |
virtual gutz::vec3f | getLocalPos () const=0 |
virtual void | setLocalPos (const vec3f &pos)=0 |
virtual gutz::mat3f | getLocalOrient () const=0 |
virtual void | setLocalQuat (const quatf &lq)=0 |
gutz::vec3f | getWorldPos () const |
virtual void | setWorldPos (const vec3f &wpos) |
gutz::mat3f | getWorldOrient () const |
Events | |
Maps buttons & modifiers to actions, speed determines the rate of the action for that button, state combo.
Concrete class, camera, object, light etc... will define valid actions. | |
virtual bool | mouse (const MouseEvent &me)=0 |
virtual bool | move (const MouseMoveEvent &mme)=0 |
Tumble. | |
enable/disable rotations with inertia | |
void | setTumble (bool on) |
bool | getTumble () const |
virtual void | tumble (float speed=1) |
Update tumble "speed" amout. | |
Projections: Mapping a point from one space to another | |
Given either a "WORLD", "EYE", "SCREEN", or "LOCAL" space pos.
Read it like this: get{A}Pos{B} means "map a point to space {A} from space {B} (ie A<-B)" | |
virtual gutz::vec3f | getLocalPosWorld (const gutz::vec3f &wpos) const=0 |
WORLD->LOCAL, You have a point in WORLD space and now you want it in LOCAL space. | |
virtual gutz::vec3f | getLocalDirWorld (const gutz::vec3f &wdir) const=0 |
WORLD->LOCAL dir, You have a vector (direction) in WORLD, you want it in LOCAL. | |
virtual gutz::vec3f | getWorldPosLocal (const gutz::vec3f &lpos) const=0 |
WORLD<-LOCAL, You have a LOCAL point and you want it in WORLD space. | |
virtual gutz::vec3f | getWorldDirLocal (const gutz::vec3f &ldir) const=0 |
WORLD<-LOCAL dir, You have a vector (direction) in WORLD, you want it in LOCAL. | |
virtual gutz::vec3f | getLocalPosEye (const gutz::vec3f &epos) const=0 |
EYE->LOCAL, You have an EYE space point and want it in LOCAL space. | |
virtual gutz::vec3f | getEyePosLocal (const gutz::vec3f &lpos) const=0 |
EYE<-LOCAL, You have a LOCAL space point and want it in EYE space. | |
virtual gutz::vec3f | getLocalPosScreen (const gutz::vec3f &spos) const=0 |
SCREEN->LOCAL, You have a point in SCREEN space and now you want it in "this" space. | |
virtual gutz::vec3f | getScreenPosLocal (const gutz::vec3f &lpos) const=0 |
SCREEN<-LOCAL, You have a point in LOCAL space and want it in SCREEN space. | |
Vectors | |
Simmilar to Projections, but rather than projecting a point you are projecting/deriving a direction vector.
This is needed since our Camera class supports both perspective and orthographic projections, this affects how we view rays "from the eye" through any other point, in ortho the direction is always the same, in perspective, the direction depends on the eye's position. | |
virtual gutz::vec3f | getLocalEyeRayLocal (const gutz::vec3f &lpos) const=0 |
get a LOCAL direction (ray) through a LOCAL point from the eye | |
virtual gutz::vec3f | getLocalEyeRayScreen (const gutz::vec3f &spos) const=0 |
get a LOCAL direction through a SCREEN point from the eye | |
virtual gutz::vec3f | getWorldEyeRayScreen (const gutz::vec3f &spos) const=0 |
get a World direction through a Screen point from the eye | |
virtual gutz::vec3f | getWorldEyeRayWorld (const gutz::vec3f &wpos) const=0 |
get a World direction through a World point from the eye | |
virtual gutz::vec3f | getLocalViewDir () const=0 |
get the View direction in LOCAL space | |
Serialization. returns true if fail, false if success | |
virtual bool | serialize (std::ostream &os, const std::string indent=std::string("")) |
write. | |
virtual bool | unserialize (std::istream &is) |
read. | |
virtual bool | serialData (std::ostream &os, const std::string indent=std::string("")) |
specific parts of this object serialize the data parts of this guy for momentos & transmission | |
virtual bool | unserialData (std::istream &is) |
Public Types | |
typedef gutz::SmartPtr< BaseManip > | BaseManipSP |
Public Member Functions | |
virtual | ~BaseManip () |
virtual gutz::SmartPtr< BaseManip > | getParent () const |
Tranformation chains (for Manip) interface Manip basically implements a linked list of manipulators that can be strung together. | |
virtual void | setParent (const BaseManipSP parent) |
virtual void | insertParent (const BaseManipSP parent) |
virtual Camera * | getCamera () const=0 |
Protected Member Functions | |
BaseManip () | |
BaseManip (const BaseManip &bm) | |
copy constructor copies data & behavior | |
BaseManip & | operator= (const BaseManip &bm) |
assignment doesn't copy behavior, just data! | |
virtual void | _incCount () |
gutz::Counted interface, increment reference count by one. | |
virtual void | _decCount () |
gutz::Counted interface, decrement reference count by one. | |
virtual int | _getCount () const |
gutz::Counted interface, get the current reference count. | |
Protected Attributes | |
bool | _tumble |
Tumble on??? | |
unsigned int | _currentMode |
Current mode. | |
float | _currentSpeed |
Current speed. | |
float | _lastd |
Last distance traveled. | |
Friends | |
class | SmartPtr |
class | SmartPtrRef |
|
Definition at line 85 of file baseManip.h. Referenced by gutz::Manip::setCamera(). |
|
Definition at line 87 of file baseManip.h. |
|
Definition at line 283 of file baseManip.h. References _tumble. |
|
copy constructor copies data & behavior
Definition at line 287 of file baseManip.h. References _tumble. |
|
gutz::Counted interface, decrement reference count by one. Not generaly used by subclasses, mostly for collaboration with gutz::SmartPtr. Sometimes you need to call this though, see the documentation for gutz::SmartPtr Definition at line 54 of file smartptr.h. Referenced by TFImage::clear(), NrroImage::fBlendOverRGBA(), and Nrro::updateMinMax(). |
|
gutz::Counted interface, get the current reference count. Not generaly used by subclasses, mostly for collaboration with gutz::SmartPtr. Definition at line 58 of file smartptr.h. |
|
gutz::Counted interface, increment reference count by one. Not generaly used by subclasses, mostly for collaboration with gutz::SmartPtr. Sometimes you need to call this though, see the documentation for gutz::SmartPtr Definition at line 48 of file smartptr.h. Referenced by TFImage::clear(), NrroImage::fBlendOverRGBA(), and Nrro::updateMinMax(). |
|
Implemented in gutz::Camera, and gutz::Manip. |
|
EYE<-LOCAL, You have a LOCAL space point and want it in EYE space.
Implemented in gutz::Camera, and gutz::Manip. |
|
get the quaternion that expresses the total rotation: EYE<-LOCAL
Implemented in gutz::Camera, and gutz::Manip. |
|
get the eye transform, EYE<-LOCAL,
Implemented in gutz::Camera, and gutz::Manip. |
|
get the inverse quaternion for rotation: EYE->LOCAL
Implemented in gutz::Camera, and gutz::Manip. |
|
get the inverse eye transform: EYE->LOCAL
Implemented in gutz::Camera, and gutz::Manip. |
|
get the inverse local quaterinion for rotation
Implemented in gutz::Camera, and gutz::Manip. |
|
get the inverse transform that this manipulator defines
Implemented in gutz::Camera, and gutz::Manip. |
|
get the inverse projection matrix (inverse of getProjection())
Implemented in gutz::Camera, and gutz::Manip. |
|
get the inverse projection transform, PROJECTION->LOCAL
Implemented in gutz::Camera, and gutz::Manip. |
|
get the inverse screen transform, SCREEN->PROJECT
Implemented in gutz::Camera, and gutz::Manip. |
|
get the inverse quaternion for rotation: WORLD->LOCAL
Implemented in gutz::Camera, and gutz::Manip. |
|
get the inverse world transform: WORLD->LOCAL
Implemented in gutz::Camera, and gutz::Manip. |
|
WORLD->LOCAL dir, You have a vector (direction) in WORLD, you want it in LOCAL.
Implemented in gutz::Camera, and gutz::Manip. |
|
get a LOCAL direction (ray) through a LOCAL point from the eye
Implemented in gutz::Camera, and gutz::Manip. |
|
get a LOCAL direction through a SCREEN point from the eye
Implemented in gutz::Camera, and gutz::Manip. |
|
Implemented in gutz::Camera, and gutz::Manip. Referenced by getWorldOrient(). |
|
Implemented in gutz::Camera, and gutz::Manip. Referenced by getWorldPos(). |
|
EYE->LOCAL, You have an EYE space point and want it in LOCAL space.
Implemented in gutz::Camera, and gutz::Manip. |
|
SCREEN->LOCAL, You have a point in SCREEN space and now you want it in "this" space.
Implemented in gutz::Camera, and gutz::Manip. |
|
WORLD->LOCAL, You have a point in WORLD space and now you want it in LOCAL space.
Implemented in gutz::Camera, and gutz::Manip. Referenced by setWorldPos(). |
|
get the local quaternion for rotation
Implemented in gutz::Camera, and gutz::Manip. |
|
get the LOCAL transform that this manipulator defines
Implemented in gutz::Camera, and gutz::Manip. |
|
get the View direction in LOCAL space
Implemented in gutz::Camera, and gutz::Manip. |
|
Tranformation chains (for Manip) interface Manip basically implements a linked list of manipulators that can be strung together. If you set your parent to be 0, then you effectively nuke the chain above this manipulator. Cameras are special, there can only be one, and it is always at the very top of the chain (ie has no parent). See gutz::Manip for the rest of this interface Reimplemented in gutz::Manip. Definition at line 105 of file baseManip.h. Referenced by getWorldPos(), and setWorldPos(). |
|
get the projection matrix currently associated with this transform chain
Implemented in gutz::Camera, and gutz::Manip. |
|
get the projection transform, PROJECTION<-LOCAL
Implemented in gutz::Camera, and gutz::Manip. |
|
Implemented in gutz::Camera, and gutz::Manip. |
|
SCREEN<-LOCAL, You have a point in LOCAL space and want it in SCREEN space.
Implemented in gutz::Camera, and gutz::Manip. |
|
get the screen transform, SCREEN<-PROJECT this is weird because you must apply the Project transform, then divide by w, then apply the screen transform.
Implemented in gutz::Camera, and gutz::Manip. |
|
Implemented in gutz::Camera, and gutz::Manip. |
|
Implemented in gutz::Camera, and gutz::Manip. |
|
Definition at line 209 of file baseManip.h. References _tumble. |
|
WORLD<-LOCAL dir, You have a vector (direction) in WORLD, you want it in LOCAL.
Implemented in gutz::Camera, and gutz::Manip. |
|
get a World direction through a Screen point from the eye
Implemented in gutz::Camera, and gutz::Manip. |
|
get a World direction through a World point from the eye
Implemented in gutz::Camera, and gutz::Manip. |
|
Definition at line 187 of file baseManip.h. References getLocalOrient(), getWorldQuat(), and gutz::mat3f. |
|
Definition at line 177 of file baseManip.h. References getLocalPos(), and getParent(). Referenced by gutz::Camera::getLocalEyeRayLocal(), and gutz::Camera::getLocalEyeRayScreen(). |
|
WORLD<-LOCAL, You have a LOCAL point and you want it in WORLD space.
Implemented in gutz::Camera, and gutz::Manip. |
|
get the quaternion for rotation: WORLD<-LOCAL
Implemented in gutz::Camera, and gutz::Manip. Referenced by getWorldOrient(). |
|
get the world transform, WORLD<-LOCAL
Implemented in gutz::Camera, and gutz::Manip. |
|
Reimplemented in gutz::Manip. Definition at line 108 of file baseManip.h. |
|
Implemented in gutz::Camera, and gutz::Manip. |
|
Implemented in gutz::Camera, and gutz::Manip. |
|
Implemented in gutz::Camera, and gutz::Manip. |
|
Implemented in gutz::Camera, and gutz::Manip. |
|
assignment doesn't copy behavior, just data!
Definition at line 291 of file baseManip.h. |
|
specific parts of this object serialize the data parts of this guy for momentos & transmission frustum clips Reimplemented in gutz::Camera, and gutz::Manip. Definition at line 87 of file baseManip.cpp. Referenced by serialize(). |
|
write. serial data Reimplemented in gutz::Camera, gutz::Light, and gutz::Manip. Definition at line 44 of file baseManip.cpp. References DATA_STR(), END_SECTION_STR(), serialData(), and string. |
|
Implemented in gutz::Camera, and gutz::Manip. Referenced by setWorldPos(). |
|
Implemented in gutz::Camera, and gutz::Manip. |
|
Reimplemented in gutz::Manip. Definition at line 107 of file baseManip.h. |
|
Definition at line 208 of file baseManip.h. References _tumble. |
|
Definition at line 181 of file baseManip.h. References getLocalPosWorld(), getParent(), and setLocalPos(). |
|
Update tumble "speed" amout.
Reimplemented in gutz::Camera, and gutz::Manip. Definition at line 211 of file baseManip.h. |
|
frustum clips Reimplemented in gutz::Camera, and gutz::Manip. Definition at line 99 of file baseManip.cpp. Referenced by unserialize(). |
|
read. unserial data Reimplemented in gutz::Camera, gutz::Light, and gutz::Manip. Definition at line 63 of file baseManip.cpp. References DATA_STR(), END_SECTION_STR(), string, unserialData(), and unserialKeyCheck(). |
|
Definition at line 40 of file smartptr.h. Referenced by Nrro::NrroIter< T >::NrroIter(). |
|
Definition at line 41 of file smartptr.h. |
|
Current mode.
Definition at line 303 of file baseManip.h. Referenced by gutz::Camera::mouse(), and gutz::Camera::tumble(). |
|
Current speed.
Definition at line 304 of file baseManip.h. Referenced by gutz::Camera::cameraRotAxis(), gutz::Camera::cameraTrans(), and gutz::Camera::mouse(). |
|
Last distance traveled.
Definition at line 307 of file baseManip.h. Referenced by gutz::Camera::handleCamera(), and gutz::Camera::tumble(). |
|
Tumble on???
Definition at line 299 of file baseManip.h. Referenced by BaseManip(), getTumble(), setTumble(), and gutz::Camera::tumble(). |