VAPoR  3.0.0
Classes | Public Member Functions | Static Public Member Functions | List of all members
VAPoR::Visualizer Class Reference

A class for performing OpenGL rendering in VAPOR GUI Window. More...

#include <visualizer.h>

Inheritance diagram for VAPoR::Visualizer:
VetsUtil::MyBase

Public Member Functions

 Visualizer (int winnum)
 
 ~Visualizer ()
 
ViewpointParamsgetActiveViewpointParams ()
 
RegionParamsgetActiveRegionParams ()
 
AnimationParamsgetActiveAnimationParams ()
 
VizFeatureParams * getActiveVizFeatureParams ()
 
void initializeGL ()
 Method to initialize GL rendering. Must be called from a GL context. More...
 
Trackball * GetTrackball ()
 
void SetTrackballCoordsChanged (bool val)
 
int paintEvent ()
 
void resizeGL (int w, int h)
 
int getWindowNum ()
 
void resetTrackball ()
 Reset the trackball, creating a new trackball in default state for this visualizer. More...
 
void resetNearFar (ViewpointParams *vpParams)
 
bool projectPointToWin (double userCoords[3], double winCoords[2])
 
int pointIsOnBox (double corners[8][3], double pickPt[2])
 
bool pixelToVector (double winCoords[2], const vector< double > cameraPos, double dirVec[3])
 
RenderergetRenderer (int i)
 
int getNumRenderers ()
 
RenderergetRenderer (RenderParams *p)
 
VizFeatureRenderer * getVizFeatureRenderer ()
 
int insertSortedRenderer (RenderParams *p, Renderer *ren)
 
bool removeRenderer (RenderParams *p)
 
void removeAllRenderers ()
 Remove (and delete) all the renderers in the renderer queue. More...
 
void removeDisabledRenderers ()
 Remove all disabled renderers from the queue. More...
 
TranslateStretchManip * getManip (const std::string &paramTag)
 
double getPixelSize ()
 
int getWidth ()
 
int getHeight ()
 
double * getModelViewMatrix ()
 
void setImageCaptureEnabled (bool onOff, string filename)
 
- Public Member Functions inherited from VetsUtil::MyBase
 MyBase ()
 
const string & getClassName () const
 

Static Public Member Functions

static void setActiveWinNum (int winnum)
 
static void setRegionShareFlag (bool regionIsShared)
 
- Static Public Member Functions inherited from VetsUtil::MyBase
static void SetErrMsg (const char *format,...)
 Record a formatted error message. More...
 
static void SetErrMsg (int errcode, const char *format,...)
 Record a formatted error message and an error code. More...
 
static const char * GetErrMsg ()
 
static void SetErrCode (int err_code)
 Record an error code. More...
 
static int GetErrCode ()
 Retrieve the current error code. More...
 
static void SetErrMsgCB (ErrMsgCB_T cb)
 
static ErrMsgCB_T GetErrMsgCB ()
 
static void SetErrMsgFilePtr (FILE *fp)
 
static const FILE * SetErrMsgFilePtr ()
 
static void SetDiagMsg (const char *format,...)
 Record a formatted diagnostic message. More...
 
static const char * GetDiagMsg ()
 
static void SetDiagMsgCB (DiagMsgCB_T cb)
 
static DiagMsgCB_T GetDiagMsgCB ()
 
static void SetDiagMsgFilePtr (FILE *fp)
 
static bool EnableErrMsg (bool enable)
 

Additional Inherited Members

- Public Types inherited from VetsUtil::MyBase
typedef void(* ErrMsgCB_T) (const char *msg, int err_code)
 
typedef void(* DiagMsgCB_T) (const char *msg)
 
- Static Public Attributes inherited from VetsUtil::MyBase
static char * ErrMsg
 
static int ErrCode
 
static int ErrMsgSize
 
static FILE * ErrMsgFilePtr
 
static ErrMsgCB_T ErrMsgCB
 
static char * DiagMsg
 
static int DiagMsgSize
 
static FILE * DiagMsgFilePtr
 
static DiagMsgCB_T DiagMsgCB
 
static bool Enabled
 
- Protected Member Functions inherited from VetsUtil::MyBase
void SetClassName (const string &name)
 

Detailed Description

A class for performing OpenGL rendering in VAPOR GUI Window.

Author
Alan Norton
Version
3.0
Date
October 2013

The Visualizer class performs OpenGL rendering for the main VAPOR visualizers. The Visualizer class is not a GL Window itself, however it will issue the OpenGL calls to perform rendering in a context that is already current.

Definition at line 61 of file visualizer.h.

Constructor & Destructor Documentation

VAPoR::Visualizer::Visualizer ( int  winnum)
VAPoR::Visualizer::~Visualizer ( )

Member Function Documentation

AnimationParams* VAPoR::Visualizer::getActiveAnimationParams ( )

Method that returns the AnimationParams that is active in this window.

Return values
AnimationParams*current active AnimationParams
RegionParams* VAPoR::Visualizer::getActiveRegionParams ( )

Method that returns the RegionParams that is active in this window.

Return values
RegionParams*current active RegionParams
ViewpointParams* VAPoR::Visualizer::getActiveViewpointParams ( )

Method that returns the ViewpointParams that is active in this window.

Return values
ViewpointParams*current active ViewpointParams
VizFeatureParams* VAPoR::Visualizer::getActiveVizFeatureParams ( )

Method that returns the VizFeatureParams that is active in this window.

Return values
VizFeatureParams*current active VizFeatureParams
int VAPoR::Visualizer::getHeight ( )
inline

Determine the height of this visualizer

Returns
visualizer height in pixels

Definition at line 212 of file visualizer.h.

TranslateStretchManip* VAPoR::Visualizer::getManip ( const std::string &  paramTag)
inline

Obtain the manip that is associated with a specified Params type

Parameters
[in]tagassociated with the Params that owns the manip
Returns
pointer to the Manip

Definition at line 188 of file visualizer.h.

References VAPoR::MouseModeParams::getModeFromParams().

double* VAPoR::Visualizer::getModelViewMatrix ( )

Identify the current modelview matrix as an array of doubles Return pointer to the current 4x4 model-view matrix

int VAPoR::Visualizer::getNumRenderers ( )
inline

Determine the number of renderers in the renderer list

Returns
number of renderers

Definition at line 156 of file visualizer.h.

double VAPoR::Visualizer::getPixelSize ( )

Determine the approximate size of a pixel in terms of user coordinates, at the center of the scene.

Renderer* VAPoR::Visualizer::getRenderer ( int  i)
inline

Determine the renderer in the renderer list associated with a specific index

Parameters
[in]index
Returns
Renderer* associated with the index

Definition at line 152 of file visualizer.h.

Renderer* VAPoR::Visualizer::getRenderer ( RenderParams p)

Determine the renderer associated with a particular RenderParams instance

Parameters
[in]RenderParamsto be checked for renderer
Returns
associated RenderParams instance
Trackball* VAPoR::Visualizer::GetTrackball ( )

Obtain the current trackball (either shared or local) based on current viewpoint params

Returns
Trackball instance that is currently being used.
VizFeatureRenderer* VAPoR::Visualizer::getVizFeatureRenderer ( )
inline

Identify the VizFeatureRenderer associated with this Visualizer

Returns
associated RenderParams instance

Definition at line 165 of file visualizer.h.

int VAPoR::Visualizer::getWidth ( )
inline

Determine the width of this visualizer

Returns
visualizer width in pixels

Definition at line 208 of file visualizer.h.

int VAPoR::Visualizer::getWindowNum ( )
inline

Identify the visualizer index associated with this visualizer

Return values
visualizerindex;

Definition at line 111 of file visualizer.h.

void VAPoR::Visualizer::initializeGL ( )

Method to initialize GL rendering. Must be called from a GL context.

int VAPoR::Visualizer::insertSortedRenderer ( RenderParams p,
Renderer ren 
)
inline

Insert a renderer in the queue using the default (5) render order

See also
Visualizer::insertRenderer
Parameters
[in]RenderParamsinstance associated with the renderer
[out]Rendererinstance that is inserted in the queue
Returns
position in the renderer queue

Definition at line 172 of file visualizer.h.

int VAPoR::Visualizer::paintEvent ( )

all the OpenGL rendering is performed in the paintEvent method. It must be invoked from a current OpenGL context.

Returns
zero if successful.
bool VAPoR::Visualizer::pixelToVector ( double  winCoords[2],
const vector< double >  cameraPos,
double  dirVec[3] 
)

Determine a unit direction vector associated with a pixel, pointing from the camera, through the pixel into the scene. Uses OpenGL screencoords I.e. y = 0 at bottom. Returns false on failure. Used during mouseMoveEvent.

Parameters
[in]winCoordspixel coordinates (converted to double)
[in]cameraPoscurrent camera position in world coordinates.
[out]dirVecresulting unit direction vector
Returns
true if successful
int VAPoR::Visualizer::pointIsOnBox ( double  corners[8][3],
double  pickPt[2] 
)

Determine if a point is over (and not inside) a box, specified by 8 3-D coords. the first four corners are the counter-clockwise (from outside) vertices of one face, the last four are the corresponding back vertices, clockwise from outside Returns index of face (0..5), or -1 if not on Box

Parameters
[in]cornersEight 3D coordinates of box corners in required order
[in]pickPttest point coordinates
Returns
faceIndex (0..5), or -1 if not on Box
bool VAPoR::Visualizer::projectPointToWin ( double  userCoords[3],
double  winCoords[2] 
)

Project a 3D point (in user coord system) to window coords. Return true if in front of camera. Used by pointIsOnQuad, as well as in building Axis labels.

Parameters
[in]userCoords[3]coordinates of point
[out]winCoords[2]window coordinates of projection
Returns
true if point is in front of camera.
void VAPoR::Visualizer::removeAllRenderers ( )

Remove (and delete) all the renderers in the renderer queue.

void VAPoR::Visualizer::removeDisabledRenderers ( )

Remove all disabled renderers from the queue.

bool VAPoR::Visualizer::removeRenderer ( RenderParams p)

Remove a specific renderer from the renderer queue

Parameters
[in]RenderParamswhose renderer will be removed
Returns
true if successful.
void VAPoR::Visualizer::resetNearFar ( ViewpointParams vpParams)

Reset the near/far clipping, so that the near and far clipping planes are wide enough to view twice the entire region from the current camera position. If the camera is inside the doubled region, make the near clipping plane 1% of the region size.

Parameters
[in]vpParamsViewpointParams* used to determine current camera position.
void VAPoR::Visualizer::resetTrackball ( )

Reset the trackball, creating a new trackball in default state for this visualizer.

void VAPoR::Visualizer::resizeGL ( int  w,
int  h 
)

Issue the OpenGL resize call. Must be called from an OpenGL context.

Parameters
[in]wWindow width in pixels.
[in]hWindow height in pixels.
static void VAPoR::Visualizer::setActiveWinNum ( int  winnum)
inlinestatic

Set the current active visualizer

Parameters
[in]activevisualizer number

Definition at line 198 of file visualizer.h.

void VAPoR::Visualizer::setImageCaptureEnabled ( bool  onOff,
string  filename 
)
inline

Turn on or off the capture enablement. If on, the next paintEvent will result in capture Also saves the capture file name

Definition at line 220 of file visualizer.h.

static void VAPoR::Visualizer::setRegionShareFlag ( bool  regionIsShared)
inlinestatic

Set the region share flag, indicating whether the active visualizer is sharing the Region. This is needed for Manip rendering, and is set whenever the active visualizer is changed.

Parameters
[in]trueif the active visualizer uses the shared (global) Region

Definition at line 204 of file visualizer.h.

void VAPoR::Visualizer::SetTrackballCoordsChanged ( bool  val)
inline

Set/clear a flag indicating that the trackball has changed the viewpoint. This implies that the new viewpoint needs to be saved at render time.

Parameters
[in]boolflag indicating whether the values have changed

Definition at line 95 of file visualizer.h.


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