view::View Class Reference

View class (data struct). More...

#include <_src_view_view.hh>

List of all members.

Public Member Functions

 View (const bool enable, const Rect< int > &rect, shptr< Viewpoint > viewpoint, RefPtr< osg::Camera > camera=new osg::Camera)
virtual ~View ()
void Enable (const bool enable=true)
bool IfEnabled (void)
CLASS_METHOD void EnableObjectInMainView (Object &object, const bool enableInMainView=true)
const Matrix & GetViewMatrix (void)
void SetViewMatrix (const Matrix &matrix)
void ComputeViewMatrix (void)
WorldVertex GetPosition (void)
void SetViewpoint (shptr< Viewpoint > viewpoint)
void LookAt (const Vector3 &target, const Vector3 &viewpoint)
EyeVertex TransformWorld2Eye (const WorldVertex &wv)
Vector2 Project (const WorldVertex &wv)
bool IF_Z_FACING (const WorldVertex &wv)
void SetRect (const Rect< int > &rect)
Rect< int > GetRect (void)
Degree GetRollDegree (void)
void SetOutlineColor (const RGBA outlineColor)
RGBA GetOutlineColor (void)
RefPtr< osg::Camera > OsgGetCamera (void)

Private Attributes

bool mEnabled
 if false, not rendered
Rect< int > mRect
 will change by reshape event
shptr< ViewpointmViewpoint
 computes view matrix
RefPtr< osg::Camera > mCamera
 correlates to OpenGL modelview matrix
Matrix mViewMatrix
 modelview matrix
Matrix mProjectionMatrix
 3D --> 2D projection
bool mComputedViewMatrix
 if ComputeViewMatrix() was ever called
Degree mRollDegree
 supports Sprites
RGBA mOutlineColor
 outline is draw around 2D viewpoint


Detailed Description

View class (data struct).

View defines both a 2D viewport and 3D viewpoint. The order of rendering Views is the same order Views were attached to Window.

OSG: The View class abstracts osg::Camera (not osg::View). osg::Camera defines the modelview matrix and viewport which is what this View class is supposed to abstract.


Constructor & Destructor Documentation

view::View::View ( const bool  enable,
const Rect< int > &  rect,
shptr< Viewpoint viewpoint,
RefPtr< osg::Camera >  camera = new osg::Camera 
)

view::View::~View (  )  [virtual]


Member Function Documentation

void view::View::Enable ( const bool  enable = true  ) 

Enable/disable View.

bool view::View::IfEnabled ( void   )  [inline]

CLASS_METHOD void view::View::EnableObjectInMainView ( Object object,
const bool  enableInMainView = true 
)

const Matrix& view::View::GetViewMatrix ( void   )  [inline]

void view::View::SetViewMatrix ( const Matrix &  matrix  ) 

void view::View::ComputeViewMatrix ( void   ) 

Recompute view matrix. This is called every frame by the graphics main loop. Defers to the Viewpoint (a functor).

WorldVertex view::View::GetPosition ( void   ) 

Returns:
Position of view matrix in world space.

void view::View::SetViewpoint ( shptr< Viewpoint viewpoint  ) 

void view::View::LookAt ( const Vector3 &  target,
const Vector3 &  viewpoint 
)

Look at a point.

EyeVertex view::View::TransformWorld2Eye ( const WorldVertex &  wv  )  [inline]

Vector2 view::View::Project ( const WorldVertex &  wv  ) 

Project a 3D vertex to a 2D point.

Gollum originally wrote this function.

This is a highly-optimized version of Mesa 6.3.2 gluProject(). The major improvement is bypassing multiplying the modelview matrix since Palomino identity-maps it. Minor improvements are streamling the function args, bypassing unneeded calculations, and using single-precision.

GLint GLAPIENTRY gluProject(GLdouble objx, GLdouble objy, GLdouble objz, const GLdouble modelMatrix[OPENGL_MATRIX_ELEMS], const GLdouble projMatrix[OPENGL_MATRIX_ELEMS], const GLint viewport[4], GLdouble *winx, GLdouble *winy, GLdouble *winz) { double in[4]; double out[4];

in[0]=objx; in[1]=objy; in[2]=objz; in[3]=1.0; __gluMultMatrixVecd(modelMatrix, in, out); __gluMultMatrixVecd(projMatrix, out, in); if (in[3] == 0.0) return(GL_FALSE); in[0] /= in[3]; in[1] /= in[3]; in[2] /= in[3]; // Map x, y and z to range 0-1 in[0] = in[0] * 0.5 + 0.5; in[1] = in[1] * 0.5 + 0.5; in[2] = in[2] * 0.5 + 0.5;

// Map x,y to viewport in[0] = in[0] * viewport[2] + viewport[0]; in[1] = in[1] * viewport[3] + viewport[1];

*winx=in[0]; *winy=in[1]; *winz=in[2]; return(GL_TRUE); }

INTERN void __gluMultMatrixVecd(const GLdouble matrix[OPENGL_MATRIX_ELEMS], const GLdouble in[4], GLdouble out[4]) { int i;

for (i=0; i<4; i++) { out[i] = in[0] * matrix[0*4+i] + in[1] * matrix[1*4+i] + in[2] * matrix[2*4+i] + in[3] * matrix[3*4+i]; } }

bool view::View::IF_Z_FACING ( const WorldVertex &  wv  ) 

Returns:
True if 3D position is in front of viewpoint.

void view::View::SetRect ( const Rect< int > &  rect  ) 

Rect<int> view::View::GetRect ( void   )  [inline]

Degree view::View::GetRollDegree ( void   ) 

Support for cloud sprites.

void view::View::SetOutlineColor ( const RGBA  outlineColor  )  [inline]

RGBA view::View::GetOutlineColor ( void   )  [inline]

RefPtr<osg::Camera> view::View::OsgGetCamera ( void   )  [inline]


Member Data Documentation

bool view::View::mEnabled [private]

if false, not rendered

Rect<int> view::View::mRect [private]

will change by reshape event

computes view matrix

RefPtr<osg::Camera> view::View::mCamera [private]

correlates to OpenGL modelview matrix

Matrix view::View::mViewMatrix [private]

modelview matrix

3D --> 2D projection

if ComputeViewMatrix() was ever called

Degree view::View::mRollDegree [private]

supports Sprites

outline is draw around 2D viewpoint


The documentation for this class was generated from the following files:
Palomino Flight Simulator documents generated by doxygen 1.5.6 on Tue Sep 28 11:37:50 2010