20#ifndef VIEWPOINTPARAMS_H
21#define VIEWPOINTPARAMS_H
65 size_t n = (size_t)GetValueLong(_numLightsTag, _defaultNumLights);
74 double getExponent()
const {
return (GetValueDouble(_specularExpTag, _defaultSpecularExp)); }
81 if (nlights > 2) nlights = 2;
82 SetValueLong(_numLightsTag,
"Set number of lights", nlights);
111 double getAmbientCoeff()
const {
return GetValueDouble(_ambientCoeffTag, _defaultAmbientCoeff); }
128 void setExponent(
double val) { SetValueDouble(_specularExpTag,
"Set specular lighting", val); }
133 void setAmbientCoeff(
double val) { SetValueDouble(_ambientCoeffTag,
"Set ambient lighting", val); }
187 getCurrentViewpoint()->GetModelViewMatrix(m);
188 vector<double> vec(m, m +
sizeof(m) /
sizeof(m[0]));
191 void SetModelViewMatrix(
const double matrix[16]) { getCurrentViewpoint()->SetModelViewMatrix(matrix); }
196 for (
int i = 0; i < mvec.size(); i++) m[i] = mvec[i];
197 getCurrentViewpoint()->SetModelViewMatrix(m);
203 bool ReconstructCamera(
const double m[16],
double position[3],
double upVec[3],
double viewDir[3])
const {
return (getCurrentViewpoint()->
ReconstructCamera(m, position, upVec, viewDir)); }
209 vector<double> val = GetRotationCenter();
211 for (
int i = 0; i < val.size(); i++) c[i] = val[i];
217 std::vector<double> vec = {c[0], c[1], c[2]};
218 SetRotationCenter(vec);
243#ifdef VAPOR3_0_0_ALPHA
247 double GetCurrentViewDiameter(vector<double> stretchFactors)
const;
250#ifndef DOXYGEN_SKIP_THIS
252 static const double *getDefaultLightDirection(
int lightNum) {
return _defaultLightDirection[lightNum]; }
253 static double getDefaultAmbientCoeff() {
return _defaultAmbientCoeff; }
254 static double getDefaultSpecularExp() {
return _defaultSpecularExp; }
255 static int getDefaultNumLights() {
return _defaultNumLights; }
256 static const double *getDefaultDiffuseCoeff() {
return _defaultDiffuseCoeff; }
257 static const double *getDefaultSpecularCoeff() {
return _defaultSpecularCoeff; }
258 static void setDefaultLightDirection(
int lightNum,
double val[3])
260 for (
int i = 0; i < 3; i++) _defaultLightDirection[lightNum][i] = val[i];
262 static void setDefaultSpecularCoeff(
double val[3])
264 for (
int i = 0; i < 3; i++) _defaultSpecularCoeff[i] = val[i];
266 static void setDefaultDiffuseCoeff(
double val[3])
268 for (
int i = 0; i < 3; i++) _defaultDiffuseCoeff[i] = val[i];
270 static void setDefaultAmbientCoeff(
double val) { _defaultAmbientCoeff = val; }
271 static void setDefaultSpecularExp(
double val) { _defaultSpecularExp = val; }
272 static void setDefaultNumLights(
int val) { _defaultNumLights = val; }
276 static string GetClassType() {
return (
"ViewpointParams"); }
278 static const string UseCustomFramebufferTag;
279 static const string CustomFramebufferWidthTag;
280 static const string CustomFramebufferHeightTag;
283 ParamsContainer *m_VPs =
nullptr;
284 ParamsContainer *_transforms =
nullptr;
286 static const string _viewPointsTag;
287 static const string _transformsTag;
288 static const string _currentViewTag;
289 static const string _lightDirectionsTag;
290 static const string _diffuseCoeffTag;
291 static const string _specularCoeffTag;
292 static const string _specularExpTag;
293 static const string _ambientCoeffTag;
294 static const string _numLightsTag;
295 static const string m_windowSizeTag;
296 static const string m_stretchFactorsTag;
297 static const string m_fieldOfView;
298 static const string _orthoProjectionSizeTag;
299 static const string _projectionTypeTag;
302 static double _defaultLightDirection[3][4];
303 static double _defaultDiffuseCoeff[3];
304 static double _defaultSpecularCoeff[3];
305 static double _defaultAmbientCoeff;
306 static double _defaultSpecularExp;
307 static int _defaultNumLights;
Nodes with state in Xml tree representation.
A class for describing the viewpoint and lights in a 3D VAPOR scene.
vector< string > GetTransformNames() const
int SaveCameraToFile(const std::string &path)
double getDiffuseCoeff(int lightNum) const
virtual ~ViewpointParams()
double getAmbientCoeff() const
virtual Viewpoint * getCurrentViewpoint() const
void setNumLights(size_t nlights)
bool ReconstructCamera(const double m[16], double position[3], double upVec[3], double viewDir[3]) const
void SetModelViewMatrix(const double matrix[16])
void SetModelViewMatrix(const std::vector< double > mvec)
void GetModelViewMatrix(double m[16]) const
Return the current 4x4 model-view matrix.
void setDiffuseCoeff(int lightNum, double val)
void setLightDirection(int lightNum, int dir, double val)
ViewpointParams & operator=(const ViewpointParams &rhs)
void GetRotationCenter(double c[3]) const
std::vector< double > GetModelViewMatrix() const
double GetOrthoProjectionSize() const
void SetStretchFactors(vector< double > factors)
void SetProjectionType(ProjectionType type)
void SetOrthoProjectionSize(float f)
double getSpecularCoeff(int lightNum) const
int SetCameraFromFile(const std::string &path)
void SetRotationCenter(const double c[3])
void setSpecularCoeff(int lightNum, double val)
double getLightDirection(int lightNum, int dir) const
vector< double > GetStretchFactors() const
Method to get stretch factors.
void setExponent(double val)
ViewpointParams(const ViewpointParams &rhs)
std::vector< double > GetRotationCenter() const
double getExponent() const
void SetRotationCenter(vector< double > c)
ViewpointParams(ParamsBase::StateSave *ssave)
virtual Transform * GetTransform(string dataSetName)
void setAmbientCoeff(double val)
ProjectionType GetProjectionType() const
void rescale(vector< double > scaleFac)
void SetWindowSize(size_t width, size_t height)
ViewpointParams(ParamsBase::StateSave *ssave, XmlNode *node)
void SetProjectionMatrix(const double m[16])
void GetWindowSize(size_t &width, size_t &height) const
void SetCurrentViewpoint(Viewpoint *newVP)
void GetProjectionMatrix(double m[16]) const
class that indicates location and direction of view