VAPoR  3.0.0
Public Member Functions | List of all members
VAPoR::ViewpointParams Class Reference

A class for describing the viewpoint and lights in a 3D VAPOR scene. More...

#include <viewpointparams.h>

Inheritance diagram for VAPoR::ViewpointParams:
VAPoR::Params VetsUtil::MyBase VAPoR::ParamsBase

Public Member Functions

int getNumLights ()
 
double getExponent ()
 
const vector< double > getCameraPosLocal ()
 
void getStretchedCamPosLocal (double *vec)
 
int setStretchedCamPosLocal (const double *vec)
 
void getStretchedRotCtrLocal (double *vec)
 
int setStretchedRotCtrLocal (const double *vec)
 
const vector< double > getViewDir ()
 
const vector< double > getUpVec ()
 
const vector< double > getRotationCenterLocal ()
 
void setCurrentVPToHome ()
 Set the current viewpoint to be the home viewpoint. More...
 
double getCameraPosLocal (int coord)
 
int setCameraPosLocal (const vector< double > &val, int)
 
int setViewDir (int coord, double val)
 
int setViewDir (const vector< double > &val)
 
int setUpVec (int i, double val)
 
int setUpVec (const vector< double > &val)
 
double getRotationCenterLocal (int coord)
 
int setRotationCenterLocal (const vector< double > &vec)
 
int setNumLights (int nlights)
 
double getLightDirection (int lightNum, int dir)
 
int setLightDirection (int lightNum, int dir, double val)
 
double getDiffuseCoeff (int lightNum)
 
double getSpecularCoeff (int lightNum)
 
double getAmbientCoeff ()
 
int setDiffuseCoeff (int lightNum, double val)
 
int setSpecularCoeff (int lightNum, double val)
 
int setExponent (double val)
 
int setAmbientCoeff (double val)
 
int setCurrentViewpoint (Viewpoint *newVP)
 
int setHomeViewpoint (Viewpoint *newVP)
 
void centerFullDomain (int timestep)
 
virtual ViewpointgetHomeViewpoint ()
 
void VPSetChanged (bool val)
 
bool VPHasChanged (int viz=-1)
 
- Public Member Functions inherited from VAPoR::Params
 Params (const Params &p)
 Default copy constructor. More...
 
virtual ~Params ()
 
bool isRenderParams () const
 
bool isBasicParams () const
 
virtual int GetVizNum ()
 
virtual int SetLocal (bool lg)
 
virtual bool IsLocal ()
 
virtual BoxGetBox ()
 
 Params (XmlNode *parent, const string &name, int winNum)
 
 Params (int winNum, const string &name)
 Deprecated constructor, needed for built-in classes that do not have associated XML node: More...
 
virtual int GetInstanceIndex ()
 
virtual void SetVizNum (int vnum)
 
- Public Member Functions inherited from VetsUtil::MyBase
 MyBase ()
 
const string & getClassName () const
 
- Public Member Functions inherited from VAPoR::ParamsBase
 ParamsBase (XmlNode *parent, const string &name)
 
 ParamsBase (const string &name)
 Default constructor. More...
 
 ParamsBase (const ParamsBase &pbase)
 Copy constructor. More...
 
virtual ~ParamsBase ()
 destructor..destroys the xml tree based at the root node. More...
 
ParamNodeGetRootNode () const
 
const string GetName () const
 
virtual long GetValueLong (const string &tag, const vector< long > &defaultVal=_emptyLongVec)
 
virtual double GetValueDouble (const string &tag, const vector< double > &defaultVal=_emptyDoubleVec)
 
virtual const string GetValueString (const string &tag, const string &defaultVal=_emptyString)
 
virtual const vector< long > GetValueLongVec (const string &tag, const vector< long > &defaultVal=_emptyLongVec)
 
virtual const vector< double > GetValueDoubleVec (const string &tag, const vector< double > &defaultVal=_emptyDoubleVec)
 
virtual void GetValueStringVec (const string &tag, vector< string > &vec, const vector< string > &defaultVal=_emptyStringVec)
 
virtual int SetValueLong (string tag, const char *description, long value, Params *p)
 
virtual int SetValueLong (string tag, const char *description, const vector< long > &value, Params *p)
 
virtual int SetValueDouble (string tag, const char *description, double value, Params *p)
 
virtual int SetValueDouble (string tag, const char *description, const vector< double > &value, Params *p)
 
virtual int SetValueString (string tag, const char *description, const string &value, Params *p)
 
virtual int SetValueStringVec (string tag, const char *description, const vector< string > &value, Params *p)
 
ParamsBaseType GetParamsBaseTypeId ()
 
virtual void SetRootParamNode (ParamNode *pn)
 
ParamsBaseGetParamsBase (const vector< string > &path) const
 
int SetParamsBase (const vector< string > &path, ParamsBase *pbase)
 
int RemoveParamsBase (const vector< string > &path, ParamsBase *pbase)
 
void SetParent (XmlNode *parent)
 
virtual bool elementStartHandler (ExpatParseMgr *pm, int depth, string &tag, const char **attribs)
 
virtual bool elementEndHandler (ExpatParseMgr *pm, int depth, string &tag)
 
virtual ParamNodebuildNode ()
 
ParamNodeGetCurrentNode ()
 
ParamNodePush (string &tag, ParamsBase *pBase=0)
 
ParamNodePop ()
 
void Remove (const string &name)
 
const map< string, string > & GetAttributes ()
 
void Clear ()
 

Internal

Internal methods not intended for general use

 ViewpointParams (XmlNode *parent, int winnum)
 
virtual ~ViewpointParams ()
 Destructor. More...
 
const std::string getShortName ()
 
void rescale (vector< double > scaleFac)
 
void getFarNearDist (float *boxFar, float *boxNear)
 
virtual void Validate (int type)
 
virtual void restart ()
 Put a ViewpointParams into default state in the absence of data. More...
 
const double * getModelViewMatrix ()
 
const double * getProjectionMatrix ()
 
void setProjectionMatrix (const double *mtx)
 
void setModelViewMatrix (const double *mtx)
 
static ParamsBaseCreateDefaultInstance ()
 

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)
 
- Public Types inherited from VAPoR::ParamsBase
typedef int ParamsBaseType
 
- Static Public Member Functions inherited from VAPoR::Params
static bool IsRenderingEnabled (int winnum)
 
static int GetCurrentParamsInstanceIndex (int pType, int winnum)
 
static int GetCurrentParamsInstanceIndex (const std::string tag, int winnum)
 
static void SetCurrentParamsInstanceIndex (int pType, int winnum, int instance)
 
static ParamsGetParamsInstance (int pType, int winnum=-1, int instance=-1)
 
static ParamsGetParamsInstance (const std::string tag, int winnum=-1, int instance=-1)
 
static ParamsGetCurrentParamsInstance (int pType, int winnum)
 
static ParamsGetDefaultParams (ParamsBase::ParamsBaseType pType)
 
static ParamsGetDefaultParams (const string &tag)
 
static void SetDefaultParams (int pType, Params *p)
 
static void SetDefaultParams (const string &tag, Params *p)
 
static ParamsCreateDefaultParams (int pType)
 
static int GetNumParamsInstances (int pType, int winnum)
 
static int GetNumParamsInstances (const std::string tag, int winnum)
 
static void AppendParamsInstance (int pType, int winnum, Params *p)
 
static void AppendParamsInstance (const std::string tag, int winnum, Params *p)
 
static void RemoveParamsInstance (int pType, int winnum, int instance)
 
static vector< Params * > & GetAllParamsInstances (int pType, int winnum)
 
static int GetAllParamsInstances (string tag, vector< Params * > &)
 
static int DeleteVisualizer (int viznum)
 
static vector< Params * > & GetAllParamsInstances (const std::string tag, int winnum)
 
static map< int, vector< Params * > > * cloneAllParamsInstances (int winnum)
 
static vector< Params * > * cloneAllDefaultParams ()
 
- 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)
 
- Static Public Member Functions inherited from VAPoR::ParamsBase
static ParamsBaseType GetTypeFromTag (const string &tag)
 
static const string GetTagFromType (ParamsBaseType t)
 
static ParamsBaseCreateDefaultParamsBase (int pType)
 
static ParamsBaseCreateDefaultParamsBase (const string &tag)
 
static int RegisterParamsBaseClass (const string &tag, BaseCreateFcn fcn, bool isParams)
 
static int ReregisterParamsBaseClass (const string &tag, const string &newtag, bool isParams)
 
static int GetNumParamsClasses ()
 
static int GetNumBasicParamsClasses ()
 
static bool IsParamsTag (const string &tag)
 
- 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 VAPoR::Params
virtual int SetValueLong (string tag, const char *description, long value)
 
virtual int SetValueLong (string tag, const char *description, const vector< long > &value)
 
virtual int SetValueDouble (string tag, const char *description, double value)
 
virtual int SetValueDouble (string tag, const char *description, const vector< double > &value)
 
virtual int SetValueString (string tag, const char *description, const string &value)
 
virtual int SetValueStringVec (string tag, const char *description, const vector< string > &value)
 
- Protected Member Functions inherited from VetsUtil::MyBase
void SetClassName (const string &name)
 

Detailed Description

A class for describing the viewpoint and lights in a 3D VAPOR scene.

Author
Alan Norton
Version
3.0
Date
February 2014
This class describes the state of viewpoints and and the properties of light sources. If the ViewpointParams is shared (i.e. not local), all windows can use the same viewpoint and lights. Local viewpoints are just applicable in one visualizer.

Definition at line 45 of file viewpointparams.h.

Constructor & Destructor Documentation

VAPoR::ViewpointParams::ViewpointParams ( XmlNode *  parent,
int  winnum 
)

Constructor

Parameters
[in]intwindow num, indicates the visualizer number, or -1 for a shared ViewpointParams
virtual VAPoR::ViewpointParams::~ViewpointParams ( )
virtual

Destructor.

Member Function Documentation

void VAPoR::ViewpointParams::centerFullDomain ( int  timestep)

Center the viewpoint so as to view the full domain at a timestep Modifies the camera position and the rotation center, maintaining the current camera direction and distance from center. param[in] int timestep

static ParamsBase* VAPoR::ViewpointParams::CreateDefaultInstance ( )
inlinestatic

Required static method (for extensibility):

Return values
ParamsBase*pointer to a default Params instance

Definition at line 58 of file viewpointparams.h.

double VAPoR::ViewpointParams::getAmbientCoeff ( )
inline

Optain the ambient lighting coefficient of the lights

Return values
doubleambient coefficient

Definition at line 265 of file viewpointparams.h.

const vector<double> VAPoR::ViewpointParams::getCameraPosLocal ( )
inline

This method gives the current camera position in world coordinates.

Return values
vector<double>camera position

Definition at line 122 of file viewpointparams.h.

double VAPoR::ViewpointParams::getCameraPosLocal ( int  coord)
inline

Obtain one coordinate of the camera position in local coords

Parameters
[in]coord(0,1,2)
Return values
valueof the camera position coordinate

Definition at line 169 of file viewpointparams.h.

double VAPoR::ViewpointParams::getDiffuseCoeff ( int  lightNum)
inline

Optain the diffuse lighting coefficient of a light source

Parameters
[in]intlight number (0..2)
Return values
doublediffuse coefficient

Definition at line 250 of file viewpointparams.h.

double VAPoR::ViewpointParams::getExponent ( )
inline

Obtain the current specular exponent. This value should be used in setting the material properties of all geometry being rendered.

Return values
floatSpecular exponent

Definition at line 115 of file viewpointparams.h.

void VAPoR::ViewpointParams::getFarNearDist ( float *  boxFar,
float *  boxNear 
)

determine far and near distance to region based on current viewpoint

Parameters
[out]float*boxFar far distance to box
[out]float*boxNear near distance to box
virtual Viewpoint* VAPoR::ViewpointParams::getHomeViewpoint ( )
inlinevirtual

Obtain the current home viewpoint

See also
Viewpoint
Return values
Viewpoint*current home viewpoint.

Definition at line 340 of file viewpointparams.h.

double VAPoR::ViewpointParams::getLightDirection ( int  lightNum,
int  dir 
)
inline

get one component of a light direction vector

Parameters
[in]intlightNum identifies which light source
[in]intdir coordinate of direction vector
Return values
doublerequested component of light direction vector

Definition at line 233 of file viewpointparams.h.

const double* VAPoR::ViewpointParams::getModelViewMatrix ( )
inline

Get the current OpenGL ModelView Matrix (4x4) Needed for picking

Return values
constdouble matrix[16]

Definition at line 82 of file viewpointparams.h.

int VAPoR::ViewpointParams::getNumLights ( )
inline

This method tells how many lights are specified and whether lighting is on or not (i.e. if there are more than 0 lights). Note that only the first (light 0) is used in DVR and Isosurface rendering.

Return values
intnumber of lights (0,1,2, or 3)

Definition at line 106 of file viewpointparams.h.

const double* VAPoR::ViewpointParams::getProjectionMatrix ( )
inline

Get the current OpenGL Projection Matrix (4x4) Needed for calculating ray interections in scene

Return values
constdouble matrix[16]

Definition at line 86 of file viewpointparams.h.

const vector<double> VAPoR::ViewpointParams::getRotationCenterLocal ( )
inline

Method returns the position used as the center for rotation. Usually this is in the center of the view, but it can be changed by user translation.

Return values
vector<double>Rotation center coordinates

Definition at line 158 of file viewpointparams.h.

double VAPoR::ViewpointParams::getRotationCenterLocal ( int  coord)
inline

Obtain a coordinate of the current rotation center

Parameters
[in]coordinate
Return values
doublecomponent of rotation center

Definition at line 214 of file viewpointparams.h.

const std::string VAPoR::ViewpointParams::getShortName ( )
inlinevirtual

Pure virtual method on Params. Provide a short name suitable for use in the GUI

Return values
stringname

Implements VAPoR::Params.

Definition at line 61 of file viewpointparams.h.

double VAPoR::ViewpointParams::getSpecularCoeff ( int  lightNum)
inline

Optain the specular lighting coefficient of a light source

Parameters
[in]intlight number (0..2)
Return values
doublespecular coefficient

Definition at line 258 of file viewpointparams.h.

void VAPoR::ViewpointParams::getStretchedCamPosLocal ( double *  vec)
inline

Obtain stretched camera position in local coordinates

Parameters
[out]3-vectorof stretched local coordinates

Definition at line 126 of file viewpointparams.h.

void VAPoR::ViewpointParams::getStretchedRotCtrLocal ( double *  vec)
inline

Obtain rotation center in stretched local coordinates

Parameters
[out]double[3]Position of rotation center in stretched local coordinates.

Definition at line 137 of file viewpointparams.h.

const vector<double> VAPoR::ViewpointParams::getUpVec ( )
inline

Method that specifies the upward-pointing vector of the current viewpoint.

Return values
vector<double>up vector

Definition at line 152 of file viewpointparams.h.

const vector<double> VAPoR::ViewpointParams::getViewDir ( )
inline

This method gives the direction vector of the viewer, pointing from the camera into the scene.

Return values
vector<double>view direction

Definition at line 148 of file viewpointparams.h.

void VAPoR::ViewpointParams::rescale ( vector< double >  scaleFac)

Rescale viewing parameters, e.g. when the scene stretch factors change

Parameters
[in]vector<double>scaleFac scale factors to be applied, relative to previous scaling.
virtual void VAPoR::ViewpointParams::restart ( )
virtual

Put a ViewpointParams into default state in the absence of data.

Implements VAPoR::Params.

int VAPoR::ViewpointParams::setAmbientCoeff ( double  val)
inline

Set the ambient lighting coefficient

Parameters
[in]doubleambient coefficient
Return values
int0 if successful

Definition at line 298 of file viewpointparams.h.

int VAPoR::ViewpointParams::setCameraPosLocal ( const vector< double > &  val,
int   
)
inline

Set the camera position in local coordinates at a specified time

Parameters
[in]vector<double>&coordinates to be set
[in]inttimestep to be used
Return values
int0 if successful

Definition at line 177 of file viewpointparams.h.

int VAPoR::ViewpointParams::setCurrentViewpoint ( Viewpoint newVP)
inline

Set the current viewpoint to another viewpoint

Parameters
[in]Viewpoint*viewpoint to be set
Return values
int0 if successful
See also
Viewpoint

Definition at line 305 of file viewpointparams.h.

References VAPoR::Command::CaptureEnd(), and VAPoR::Command::CaptureStart().

void VAPoR::ViewpointParams::setCurrentVPToHome ( )
inline

Set the current viewpoint to be the home viewpoint.

Definition at line 161 of file viewpointparams.h.

int VAPoR::ViewpointParams::setDiffuseCoeff ( int  lightNum,
double  val 
)
inline

Set the diffuse lighting coefficient of a light source

Parameters
[in]intlight number (0..2)
[in]doublediffuse coefficent
Return values
int0 if successful

Definition at line 273 of file viewpointparams.h.

int VAPoR::ViewpointParams::setExponent ( double  val)
inline

Set the specular lighting exponent of all light sources

Parameters
[in]doublespecular exponent
Return values
int0 if successful

Definition at line 292 of file viewpointparams.h.

int VAPoR::ViewpointParams::setHomeViewpoint ( Viewpoint newVP)
inline

Set the home viewpoint

Parameters
[in]Viewpoint*home viewpoint to be set
Return values
int0 if successful
See also
Viewpoint

Definition at line 320 of file viewpointparams.h.

References VAPoR::Command::CaptureEnd(), and VAPoR::Command::CaptureStart().

int VAPoR::ViewpointParams::setLightDirection ( int  lightNum,
int  dir,
double  val 
)
inline

Set one component of a light direction vector

Parameters
[in]intlightNum identifies which light source
[in]intdir coordinate of direction vector
[in]doublevalue to be set
Return values
int0 on success

Definition at line 241 of file viewpointparams.h.

void VAPoR::ViewpointParams::setModelViewMatrix ( const double *  mtx)
inline

Set the current OpenGL ModelView Matrix Needed for picking

Parameters
[in]doublematrix[16]

Definition at line 96 of file viewpointparams.h.

int VAPoR::ViewpointParams::setNumLights ( int  nlights)
inline

Set the number of directional light sources

Parameters
[in]intnumber of lights (0,1,2,3)
Return values
0on success

Definition at line 226 of file viewpointparams.h.

void VAPoR::ViewpointParams::setProjectionMatrix ( const double *  mtx)
inline

Set the current OpenGL Projection Matrix Needed for ray-casting

Parameters
[in]doublematrix[16]

Definition at line 90 of file viewpointparams.h.

int VAPoR::ViewpointParams::setRotationCenterLocal ( const vector< double > &  vec)
inline

Specify the location of the rotation center in local coordinates.

Parameters
[in]vector<double>position
Return values
0on success

Definition at line 219 of file viewpointparams.h.

int VAPoR::ViewpointParams::setSpecularCoeff ( int  lightNum,
double  val 
)
inline

Set the specular lighting coefficient of a light source

Parameters
[in]intlight number (0..2)
[in]doublespecular coefficent
Return values
int0 if successful

Definition at line 283 of file viewpointparams.h.

int VAPoR::ViewpointParams::setStretchedCamPosLocal ( const double *  vec)
inline

Specify camera position in stretched local coordinates

Parameters
[in]double[3]camera position in stretched local coordinates
Return values
int0 if successful

Definition at line 132 of file viewpointparams.h.

int VAPoR::ViewpointParams::setStretchedRotCtrLocal ( const double *  vec)
inline

Specify rotation center in stretched local coordinates

Parameters
[in]double[3]rotation center in stretched local coordinates
Return values
int0 if successful

Definition at line 143 of file viewpointparams.h.

int VAPoR::ViewpointParams::setUpVec ( int  i,
double  val 
)
inline

Set a component of upward direction vector in the current viewpoint

Parameters
[in]intcoordinate (0,1,2)
[in]doublevalue to be set
Return values
int0 on success

Definition at line 200 of file viewpointparams.h.

int VAPoR::ViewpointParams::setUpVec ( const vector< double > &  val)
inline

Set upward direction vector in the current viewpoint

Parameters
[in]vector<double>value to be set
Return values
int0 on success

Definition at line 207 of file viewpointparams.h.

int VAPoR::ViewpointParams::setViewDir ( int  coord,
double  val 
)
inline

Set a component of viewer direction in the current viewpoint

Parameters
[in]intcoordinate (0,1,2)
[in]doublevalue to be set
Return values
int0 on success

Definition at line 185 of file viewpointparams.h.

int VAPoR::ViewpointParams::setViewDir ( const vector< double > &  val)
inline

Set the viewer direction in the current viewpoint

Parameters
[in]vector<double>direction vector to be set
Return values
int0 on success

Definition at line 192 of file viewpointparams.h.

virtual void VAPoR::ViewpointParams::Validate ( int  type)
virtual

Virtual method to check that values in Params are valid, and forces them either to valid or default values.

Implements VAPoR::Params.

bool VAPoR::ViewpointParams::VPHasChanged ( int  viz = -1)

method to test if there has been a change. checks the bit associated with the visualizer.

Parameters
[in]vizindex of visualizer, only needed for shared params
Return values
booltrue if changed
void VAPoR::ViewpointParams::VPSetChanged ( bool  val)

Method indicates that a viewpointparams instance has changed, e.g. during Undo/Redo Must be cleared after all users of the instance have checked it. Setting on a shared params results in it being set for all the different visualizers that share it;

Parameters
[in]valindicates that a change has occurred

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