VAPOR3 3.9.4
Public Types | 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::ParamsBase Wasp::MyBase

Public Types

enum  ProjectionType { Perspective , Orthographic , MapOrthographic }
 
- Public Types inherited from Wasp::MyBase
typedef void(* ErrMsgCB_T) (const char *msg, int err_code)
 
typedef void(* DiagMsgCB_T) (const char *msg)
 

Public Member Functions

 ViewpointParams (ParamsBase::StateSave *ssave)
 
 ViewpointParams (ParamsBase::StateSave *ssave, XmlNode *node)
 
 ViewpointParams (const ViewpointParams &rhs)
 
ViewpointParamsoperator= (const ViewpointParams &rhs)
 
virtual ~ViewpointParams ()
 
void rescale (vector< double > scaleFac)
 
int getNumLights () const
 
double getExponent () const
 
void setNumLights (size_t nlights)
 
double getLightDirection (int lightNum, int dir) const
 
void setLightDirection (int lightNum, int dir, double val)
 
double getDiffuseCoeff (int lightNum) const
 
double getSpecularCoeff (int lightNum) const
 
double getAmbientCoeff () const
 
void setDiffuseCoeff (int lightNum, double val)
 
void setSpecularCoeff (int lightNum, double val)
 
void setExponent (double val)
 
void setAmbientCoeff (double val)
 
void SetCurrentViewpoint (Viewpoint *newVP)
 
void SetWindowSize (size_t width, size_t height)
 
void GetWindowSize (size_t &width, size_t &height) const
 
void SetFOV (float v)
 
double GetFOV () const
 
void SetOrthoProjectionSize (float f)
 
double GetOrthoProjectionSize () const
 
void SetProjectionType (ProjectionType type)
 
ProjectionType GetProjectionType () const
 
vector< double > GetStretchFactors () const
 Method to get stretch factors.
 
void SetStretchFactors (vector< double > factors)
 
virtual ViewpointgetCurrentViewpoint () const
 
void GetModelViewMatrix (double m[16]) const
 Return the current 4x4 model-view matrix.
 
std::vector< double > GetModelViewMatrix () const
 
void SetModelViewMatrix (const double matrix[16])
 
void SetModelViewMatrix (const std::vector< double > mvec)
 
void GetProjectionMatrix (double m[16]) const
 
void SetProjectionMatrix (const double m[16])
 
bool ReconstructCamera (const double m[16], double position[3], double upVec[3], double viewDir[3]) const
 
std::vector< double > GetRotationCenter () const
 
void GetRotationCenter (double c[3]) const
 
void SetRotationCenter (vector< double > c)
 
void SetRotationCenter (const double c[3])
 
virtual TransformGetTransform (string dataSetName)
 
vector< string > GetTransformNames () const
 
int SetCameraFromFile (const std::string &path)
 
int SaveCameraToFile (const std::string &path)
 
- Public Member Functions inherited from VAPoR::ParamsBase
 ParamsBase (StateSave *ssave, const string &classname)
 
 ParamsBase (StateSave *ssave, XmlNode *node)
 
 ParamsBase (const ParamsBase &rhs)
 Copy constructor.
 
ParamsBaseoperator= (const ParamsBase &rhs)
 
 ParamsBase (ParamsBase &&)=delete
 
ParamsBaseoperator= (ParamsBase &)=delete
 
bool operator== (const ParamsBase &rhs) const
 Equivalence operator.
 
bool operator!= (const ParamsBase &rhs) const
 
virtual ~ParamsBase ()
 
void SetParent (ParamsBase *parent)
 
XmlNodeGetNode () const
 
void BeginGroup (const string &description)
 
void EndGroup ()
 
void IntermediateChange ()
 
virtual vector< long > GetValueLongVec (const string tag) const
 
virtual vector< long > GetValueLongVec (const string tag, const vector< long > &defaultVal) const
 
virtual long GetValueLong (const string tag, long defaultVal) const
 
virtual vector< double > GetValueDoubleVec (const string tag) const
 
virtual vector< double > GetValueDoubleVec (const string tag, const vector< double > &defaultVal) const
 
virtual double GetValueDouble (const string tag, double defaultVal) const
 
virtual vector< string > GetValueStringVec (const string tag) const
 
virtual vector< string > GetValueStringVec (const string tag, const vector< string > &defaultVal) const
 
virtual string GetValueString (const string tag, string defaultVal) const
 
virtual void SetValueLongVec (const string &tag, string description, const vector< long > &values)
 
virtual void SetValueLong (const string &tag, string description, long value)
 
virtual void SetValueDoubleVec (const string &tag, string description, const vector< double > &values)
 
virtual void SetValueDouble (const string &tag, string description, double value)
 
virtual void SetValueStringVec (const string &tag, string description, const vector< string > &values)
 
virtual void SetValueString (const string &tag, string description, const string &value)
 
string GetName () const
 
- Public Member Functions inherited from Wasp::MyBase
 MyBase ()
 
const string & getClassName () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Wasp::MyBase
static void SetErrMsg (const char *format,...)
 Record a formatted error message.
 
static void SetErrMsg (int errcode, const char *format,...)
 Record a formatted error message and an error code.
 
static const char * GetErrMsg ()
 
static void SetErrCode (int err_code)
 Record an error code.
 
static int GetErrCode ()
 Retrieve the current error code.
 
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.
 
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 bool GetEnableErrMsg ()
 
- Static Public Attributes inherited from Wasp::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::ParamsBase
 ParamsBase (StateSave *ssave)
 
void Remove (const string &name)
 
const map< string, string > & GetAttributes ()
 
void Clear ()
 
- Protected Member Functions inherited from Wasp::MyBase
void SetClassName (const string &name)
 
- Protected Attributes inherited from VAPoR::ParamsBase
StateSave_ssave
 
XmlNode_node
 

Detailed Description

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

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.

Author
Alan Norton
Version
3.0
Date
February 2014

Definition at line 43 of file ViewpointParams.h.

Member Enumeration Documentation

◆ ProjectionType

Enumerator
Perspective 
Orthographic 
MapOrthographic 

Definition at line 160 of file ViewpointParams.h.

Constructor & Destructor Documentation

◆ ViewpointParams() [1/3]

VAPoR::ViewpointParams::ViewpointParams ( ParamsBase::StateSave ssave)

◆ ViewpointParams() [2/3]

VAPoR::ViewpointParams::ViewpointParams ( ParamsBase::StateSave ssave,
XmlNode node 
)

◆ ViewpointParams() [3/3]

VAPoR::ViewpointParams::ViewpointParams ( const ViewpointParams rhs)

◆ ~ViewpointParams()

virtual VAPoR::ViewpointParams::~ViewpointParams ( )
virtual

Member Function Documentation

◆ getAmbientCoeff()

double VAPoR::ViewpointParams::getAmbientCoeff ( ) const
inline

Optain the ambient lighting coefficient of the lights

Return values
doubleambient coefficient

Definition at line 111 of file ViewpointParams.h.

◆ getCurrentViewpoint()

virtual Viewpoint * VAPoR::ViewpointParams::getCurrentViewpoint ( ) const
inlinevirtual

Obtain the current viewpoint

See also
Viewpoint
Return values
Viewpoint*current viewpoint.

Definition at line 174 of file ViewpointParams.h.

References VAssert.

◆ getDiffuseCoeff()

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

Optain the diffuse lighting coefficient of a light source

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

◆ getExponent()

double VAPoR::ViewpointParams::getExponent ( ) const
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 74 of file ViewpointParams.h.

◆ GetFOV()

double VAPoR::ViewpointParams::GetFOV ( ) const

◆ getLightDirection()

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

get one component of a light direction vector

Parameters
[in]intlightNum identifies which light source
[in]intdir coordinate of direction vector (0..3)
Return values
doublerequested component of light direction vector

◆ GetModelViewMatrix() [1/2]

std::vector< double > VAPoR::ViewpointParams::GetModelViewMatrix ( ) const
inline

Definition at line 184 of file ViewpointParams.h.

◆ GetModelViewMatrix() [2/2]

void VAPoR::ViewpointParams::GetModelViewMatrix ( double  m[16]) const
inline

Return the current 4x4 model-view matrix.

Definition at line 183 of file ViewpointParams.h.

◆ getNumLights()

int VAPoR::ViewpointParams::getNumLights ( ) const
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)

Definition at line 63 of file ViewpointParams.h.

◆ GetOrthoProjectionSize()

double VAPoR::ViewpointParams::GetOrthoProjectionSize ( ) const

◆ GetProjectionMatrix()

void VAPoR::ViewpointParams::GetProjectionMatrix ( double  m[16]) const
inline

Definition at line 200 of file ViewpointParams.h.

◆ GetProjectionType()

ProjectionType VAPoR::ViewpointParams::GetProjectionType ( ) const

◆ GetRotationCenter() [1/2]

std::vector< double > VAPoR::ViewpointParams::GetRotationCenter ( ) const
inline

Definition at line 205 of file ViewpointParams.h.

References GetRotationCenter().

Referenced by GetRotationCenter().

◆ GetRotationCenter() [2/2]

void VAPoR::ViewpointParams::GetRotationCenter ( double  c[3]) const
inline

Definition at line 207 of file ViewpointParams.h.

References VAssert.

◆ getSpecularCoeff()

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

Optain the specular lighting coefficient of a light source

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

◆ GetStretchFactors()

vector< double > VAPoR::ViewpointParams::GetStretchFactors ( ) const

Method to get stretch factors.

◆ GetTransform()

virtual Transform * VAPoR::ViewpointParams::GetTransform ( string  dataSetName)
virtual

Access the transform for a data set

Access the transform for data set dataSetName

Return values
Returnsa new transform if one does not exist

◆ GetTransformNames()

vector< string > VAPoR::ViewpointParams::GetTransformNames ( ) const
inline

Return list of transform names.

Return the list of transform names added with AddDatasetTransform()

Definition at line 233 of file ViewpointParams.h.

◆ GetWindowSize()

void VAPoR::ViewpointParams::GetWindowSize ( size_t &  width,
size_t &  height 
) const

Get widow width and height

Parameters
[out]widthwidth of window in pixels
[out]heightheight of window in pixels

◆ operator=()

ViewpointParams & VAPoR::ViewpointParams::operator= ( const ViewpointParams rhs)

◆ ReconstructCamera()

bool VAPoR::ViewpointParams::ReconstructCamera ( const double  m[16],
double  position[3],
double  upVec[3],
double  viewDir[3] 
) const
inline

Definition at line 203 of file ViewpointParams.h.

References ReconstructCamera().

Referenced by ReconstructCamera().

◆ rescale()

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.

◆ SaveCameraToFile()

int VAPoR::ViewpointParams::SaveCameraToFile ( const std::string &  path)

Save the current camera position, direction, up vector, and origin to an xml file

Return values
integerindicating success (0) or failure (-1)

◆ setAmbientCoeff()

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

Set the ambient lighting coefficient

Parameters
[in]doubleambient coefficient
Return values
int0 if successful

Definition at line 133 of file ViewpointParams.h.

◆ SetCameraFromFile()

int VAPoR::ViewpointParams::SetCameraFromFile ( const std::string &  path)

Set the current camera position, direction, up vector, and origin from a given xml file

Return values
integerindicating success (0) or failure (-1)

◆ SetCurrentViewpoint()

void VAPoR::ViewpointParams::SetCurrentViewpoint ( Viewpoint newVP)

Set the current viewpoint to another viewpoint

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

◆ setDiffuseCoeff()

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

Set the diffuse lighting coefficient of a light source

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

◆ setExponent()

void 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 128 of file ViewpointParams.h.

◆ SetFOV()

void VAPoR::ViewpointParams::SetFOV ( float  v)

◆ setLightDirection()

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

Set one component of a light direction vector

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

◆ SetModelViewMatrix() [1/2]

void VAPoR::ViewpointParams::SetModelViewMatrix ( const double  matrix[16])
inline

Definition at line 191 of file ViewpointParams.h.

◆ SetModelViewMatrix() [2/2]

void VAPoR::ViewpointParams::SetModelViewMatrix ( const std::vector< double >  mvec)
inline

Definition at line 192 of file ViewpointParams.h.

References VAssert.

◆ setNumLights()

void VAPoR::ViewpointParams::setNumLights ( size_t  nlights)
inline

Set the number of directional light sources

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

Definition at line 79 of file ViewpointParams.h.

◆ SetOrthoProjectionSize()

void VAPoR::ViewpointParams::SetOrthoProjectionSize ( float  f)

◆ SetProjectionMatrix()

void VAPoR::ViewpointParams::SetProjectionMatrix ( const double  m[16])
inline

Definition at line 201 of file ViewpointParams.h.

◆ SetProjectionType()

void VAPoR::ViewpointParams::SetProjectionType ( ProjectionType  type)

◆ SetRotationCenter() [1/2]

void VAPoR::ViewpointParams::SetRotationCenter ( const double  c[3])
inline

Definition at line 215 of file ViewpointParams.h.

◆ SetRotationCenter() [2/2]

void VAPoR::ViewpointParams::SetRotationCenter ( vector< double >  c)
inline

Definition at line 214 of file ViewpointParams.h.

◆ setSpecularCoeff()

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

Set the specular lighting coefficient of a light source

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

◆ SetStretchFactors()

void VAPoR::ViewpointParams::SetStretchFactors ( vector< double >  factors)

method to set stretch factors

Parameters
[in]factors3-vector of stretch factors

◆ SetWindowSize()

void VAPoR::ViewpointParams::SetWindowSize ( size_t  width,
size_t  height 
)

Set widow width and height

Parameters
[in]widthwidth of window in pixels
[in]heightheight of window in pixels

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