vrj::TrackedSurfaceProjection Class Reference

Wall-specific class for viewport definitions. More...

#include <vrj/Display/TrackedSurfaceProjection.h>

Inheritance diagram for vrj::TrackedSurfaceProjection:

Inheritance graph
[legend]
Collaboration diagram for vrj::TrackedSurfaceProjection:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TrackedSurfaceProjection (const gmtl::Point3f &llCorner, const gmtl::Point3f &lrCorner, const gmtl::Point3f &urCorner, const gmtl::Point3f &ulCorner, const std::string &trackerName)
 Constructs a Tracked wall projection.
virtual ~TrackedSurfaceProjection ()
virtual void config (jccl::ConfigElementPtr element)
 Configures the projection using the element given.
virtual void calcViewMatrix (const gmtl::Matrix44f &eyePos, const float scaleFactor)
 Recalculate the projection matrix.
void updateSurfaceParams (const float scaleFactor)
 Update the parameters of the tracked surface.
std::ostream & outStream (std::ostream &out, const unsigned int indentLevel=0)
 Virtual output oporators.

Detailed Description

Wall-specific class for viewport definitions.

This class behaves the same as the SurfaceProjection class except that it is tracked. This means that all parameters are relative to a tracked (moving) frame of reference.

Definition at line 55 of file TrackedSurfaceProjection.h.


Constructor & Destructor Documentation

vrj::TrackedSurfaceProjection::TrackedSurfaceProjection ( const gmtl::Point3f &  llCorner,
const gmtl::Point3f &  lrCorner,
const gmtl::Point3f &  urCorner,
const gmtl::Point3f &  ulCorner,
const std::string &  trackerName 
) [inline]

Constructs a Tracked wall projection.

Parameters:
llCorner Lower left corner.
lrCorner Lower right corner.
urCorner Upper right corner.
ulCorner Upper left corner.
trackerName Name of the tracker tracking the screen.

Definition at line 67 of file TrackedSurfaceProjection.h.

00072       : SurfaceProjection(llCorner, lrCorner, urCorner, ulCorner)
00073       , mOriginalLLCorner(llCorner)
00074       , mOriginalLRCorner(lrCorner)
00075       , mOriginalURCorner(urCorner)
00076       , mOriginalULCorner(ulCorner)
00077    {
00078       //XXX: Watch for timing problems here if trakcer is not inited first.
00079       //     It shoulbe be though from dependency checking
00080       mTracker.init(trackerName);              // Intialize the tracker
00081    }

virtual vrj::TrackedSurfaceProjection::~TrackedSurfaceProjection (  )  [inline, virtual]

Definition at line 83 of file TrackedSurfaceProjection.h.

00084    {
00085       /* Do nothing. */ ;
00086    }


Member Function Documentation

virtual void vrj::TrackedSurfaceProjection::config ( jccl::ConfigElementPtr  element  )  [inline, virtual]

Configures the projection using the element given.

Reimplemented from vrj::SurfaceProjection.

Definition at line 88 of file TrackedSurfaceProjection.h.

References vrj::Projection::config().

00089    {
00090       Projection::config(element);        // Call base class config first
00091    }

void vrj::TrackedSurfaceProjection::calcViewMatrix ( const gmtl::Matrix44f &  eyePos,
const float  scaleFactor 
) [virtual]

Recalculate the projection matrix.

Precondition:
eyePos is scaled by position factor. scaleFactor is the scale currently used.
Postcondition:
Frustum has been recomputed for given eyePos.

Reimplemented from vrj::SurfaceProjection.

Definition at line 50 of file TrackedSurfaceProjection.cpp.

References vrj::SurfaceProjection::calcViewMatrix(), and updateSurfaceParams().

00052 {
00053    updateSurfaceParams(scaleFactor);
00054 
00055    SurfaceProjection::calcViewMatrix(eyePos,scaleFactor);
00056 }

void vrj::TrackedSurfaceProjection::updateSurfaceParams ( const float  scaleFactor  ) 

Update the parameters of the tracked surface.

Definition at line 58 of file TrackedSurfaceProjection.cpp.

References vrj::SurfaceProjection::calculateOffsets(), vrj::SurfaceProjection::mLLCorner, vrj::SurfaceProjection::mLRCorner, vrj::SurfaceProjection::mULCorner, and vrj::SurfaceProjection::mURCorner.

Referenced by calcViewMatrix().

00059 {
00060    /* Here we rotate the original screen corners, and then have SurfaceProjection::calculateOffsets
00061    *  handle the calculation of mOriginToScreen, etc.
00062    */
00063 
00064    // Get the tracking data for the surface offset
00065    gmtl::Matrix44f trackerMatrix = mTracker->getData(scaleFactor);
00066 
00067    gmtl::Vec3f trans=gmtl::makeTrans<gmtl::Vec3f>(trackerMatrix);
00068    trans=trans/scaleFactor;
00069    gmtl::setTrans(trackerMatrix,trans);
00070 
00071    mLLCorner=trackerMatrix * mOriginalLLCorner;
00072    mLRCorner=trackerMatrix * mOriginalLRCorner;
00073    mURCorner=trackerMatrix * mOriginalURCorner;
00074    mULCorner=trackerMatrix * mOriginalULCorner;
00075 
00076    calculateOffsets();
00077 }

std::ostream & vrj::TrackedSurfaceProjection::outStream ( std::ostream &  out,
const unsigned int  indentLevel = 0 
) [virtual]

Virtual output oporators.

Every class derived from us shoudl just define this, and the opertetor<< will "just work".

Reimplemented from vrj::SurfaceProjection.

Definition at line 79 of file TrackedSurfaceProjection.cpp.

References vrj::SurfaceProjection::outStream().

00081 {
00082    const int pad_width_dot(20 - indentLevel);
00083    out.setf(std::ios::left);
00084 
00085    const std::string indent_text(indentLevel, ' ');
00086 
00087    out << indent_text << "vrj::TrackedSurfaceProjection:\n";
00088    out << indent_text << std::setw(pad_width_dot)
00089        << "  Pos Proxy " << " " << mTracker.getProxyName() << std::endl;
00090 
00091    return SurfaceProjection::outStream(out, indentLevel);
00092 }


The documentation for this class was generated from the following files:
Generated on Thu Jan 4 10:58:09 2007 for VR Juggler by  doxygen 1.5.1