20 #ifndef VIEWPOINTPARAMS_H
21 #define VIEWPOINTPARAMS_H
65 void rescale(vector<double> scaleFac);
70 void getFarNearDist(
float* boxFar,
float* boxNear);
74 virtual void Validate(
int type);
77 virtual void restart();
91 for (
int i = 0; i<16; i++) _projectionMatrix[i] = mtx[i];
97 for (
int i = 0; i<16; i++) _modelViewMatrix[i] = mtx[i];
107 vector<long> defNumLights(_defaultNumLights,1);
108 return (GetValueLong(_numLightsTag,defNumLights));
116 vector<double> defSpecExp(_defaultSpecularExp,1);
117 return (GetValueDouble(_specularExpTag,defSpecExp));
127 getCurrentViewpoint()->getStretchedCamPosLocal(vec);
133 return getCurrentViewpoint()->setStretchedCamPosLocal(vec,
this);
138 getCurrentViewpoint()->getStretchedRotCtrLocal(vec);
144 return getCurrentViewpoint()->setStretchedRotCtrLocal(vec,
this);
148 const vector<double>
getViewDir() {
return getCurrentViewpoint()->getViewDir();}
152 const vector<double>
getUpVec() {
return getCurrentViewpoint()->getUpVec();}
162 Viewpoint* currentViewpoint = getCurrentViewpoint();
163 setHomeViewpoint((
Viewpoint*)currentViewpoint->deepCopy());
170 return getCurrentViewpoint()->getCameraPosLocal()[coord];
179 return getCurrentViewpoint()->setCameraPosLocal(val,
this);
187 return getCurrentViewpoint()->setViewDir(coord,val,
this);
194 return getCurrentViewpoint()->setViewDir(val,
this);
202 return getCurrentViewpoint()->setUpVec(i,val,
this);
209 return getCurrentViewpoint()->setUpVec(val,
this);
221 return getCurrentViewpoint()->setRotationCenterLocal(vec,
this);
227 return SetValueLong(_numLightsTag,
"Set number of lights", nlights);
234 return GetValueDoubleVec(_lightDirectionsTag)[dir+3*lightNum];
243 vector<double> ldirs = GetValueDoubleVec(_lightDirectionsTag);
244 ldirs[dir+3*lightNum] = val;
245 return SetValueDouble(_lightDirectionsTag,
"Set light direction",ldirs);
251 vector<double> _defaultDiffCoeff;
252 for (
int i = 0; i<3; i++) _defaultDiffCoeff.push_back(_defaultDiffuseCoeff[i]);
253 return GetValueDoubleVec(_diffuseCoeffTag,_defaultDiffCoeff)[lightNum];
259 vector<double> _defaultSpecCoeff;
260 for (
int i = 0; i<3; i++) _defaultSpecCoeff.push_back(_defaultSpecularCoeff[i]);
261 return GetValueDoubleVec(_specularCoeffTag,_defaultSpecCoeff)[lightNum];
266 vector<double> _defaultAmbient(_defaultAmbientCoeff,1);
267 return GetValueDouble(_ambientCoeffTag,_defaultAmbient);
275 vector<double>diffCoeff = GetValueDoubleVec(_diffuseCoeffTag);
276 diffCoeff[lightNum]=val;
277 return SetValueDouble(_diffuseCoeffTag,
"Set diffuse coefficient",diffCoeff);
285 vector<double>specCoeff= GetValueDoubleVec(_specularCoeffTag);
286 specCoeff[lightNum]=val;
287 return SetValueDouble(_specularCoeffTag,
"Set specular coefficient",specCoeff);
293 return SetValueDouble(_specularExpTag,
"Set specular lighting",val);
299 return SetValueDouble(_ambientCoeffTag,
"Set ambient lighting",val);
308 path.push_back(_currentViewTag);
309 path.push_back(Viewpoint::_viewpointTag);
310 int rc = SetParamsBase(path,newVP);
323 path.push_back(_homeViewTag);
324 path.push_back(Viewpoint::_viewpointTag);
325 int rc = SetParamsBase(path,newVP);
334 void centerFullDomain(
int timestep);
342 path.push_back(_homeViewTag);
343 path.push_back(Viewpoint::_viewpointTag);
351 void VPSetChanged(
bool val);
357 bool VPHasChanged(
int viz = -1);
359 #ifndef DOXYGEN_SKIP_THIS
361 static const double* getDefaultViewDir(){
return _defaultViewDir;}
362 static const double* getDefaultUpVec(){
return _defaultUpVec;}
363 static const double* getDefaultLightDirection(
int lightNum){
return _defaultLightDirection[lightNum];}
364 static double getDefaultAmbientCoeff(){
return _defaultAmbientCoeff;}
365 static double getDefaultSpecularExp(){
return _defaultSpecularExp;}
366 static int getDefaultNumLights(){
return _defaultNumLights;}
367 static const double* getDefaultDiffuseCoeff() {
return _defaultDiffuseCoeff;}
368 static const double* getDefaultSpecularCoeff() {
return _defaultSpecularCoeff;}
369 static void setDefaultLightDirection(
int lightNum,
double val[3]){
370 for (
int i = 0; i<3; i++) _defaultLightDirection[lightNum][i] = val[i];
372 static void setDefaultUpVec(
double val[3]){
373 for (
int i = 0; i<3; i++) _defaultUpVec[i] = val[i];
375 static void setDefaultViewDir(
double val[3]){
376 for (
int i = 0; i<3; i++) _defaultViewDir[i] = val[i];
378 static void setDefaultSpecularCoeff(
double val[3]){
379 for (
int i = 0; i<3; i++) _defaultSpecularCoeff[i] = val[i];
381 static void setDefaultDiffuseCoeff(
double val[3]){
382 for (
int i = 0; i<3; i++) _defaultDiffuseCoeff[i] = val[i];
384 static void setDefaultAmbientCoeff(
double val){ _defaultAmbientCoeff = val;}
385 static void setDefaultSpecularExp(
double val){ _defaultSpecularExp = val;}
386 static void setDefaultNumLights(
int val){ _defaultNumLights = val;}
390 static const string _shortName;
391 static const string _currentViewTag;
392 static const string _homeViewTag;
393 static const string _lightDirectionsTag;
394 static const string _diffuseCoeffTag;
395 static const string _specularCoeffTag;
396 static const string _specularExpTag;
397 static const string _ambientCoeffTag;
398 static const string _numLightsTag;
401 virtual Viewpoint* getCurrentViewpoint() {
403 path.push_back(_currentViewTag);
404 path.push_back(Viewpoint::_viewpointTag);
405 return (Viewpoint*)GetParamsBase(path);
408 static double _defaultViewDir[3];
409 static double _defaultUpVec[3];
410 static double _defaultLightDirection[3][3];
411 static double _defaultDiffuseCoeff[3];
412 static double _defaultSpecularCoeff[3];
413 static double _defaultAmbientCoeff;
414 static double _defaultSpecularExp;
415 static int _defaultNumLights;
416 double _modelViewMatrix[16];
417 double _projectionMatrix[16];
418 #endif //DOXYGEN_SKIP_THIS
421 #endif //VIEWPOINTPARAMS_H
void getStretchedCamPosLocal(double *vec)
int setViewDir(int coord, double val)
int setUpVec(int i, double val)
double getRotationCenterLocal(int coord)
void setModelViewMatrix(const double *mtx)
A pure virtual class for managing parameters used in visualization.
int setHomeViewpoint(Viewpoint *newVP)
double getLightDirection(int lightNum, int dir)
int setDiffuseCoeff(int lightNum, double val)
int setExponent(double val)
void getStretchedRotCtrLocal(double *vec)
int setCurrentViewpoint(Viewpoint *newVP)
Nodes with state in Xml tree representation.
static Command * CaptureStart(Params *prevParams, const char *desc, UndoRedoHelpCB_T helper=0, Params *prevAuxParams=0)
double getDiffuseCoeff(int lightNum)
void setProjectionMatrix(const double *mtx)
const vector< double > getUpVec()
A class for describing the viewpoint and lights in a 3D VAPOR scene.
class that indicates location and direction of view
int setNumLights(int nlights)
int setAmbientCoeff(double val)
static ParamsBase * CreateDefaultInstance()
int setStretchedCamPosLocal(const double *vec)
const double * getProjectionMatrix()
int setCameraPosLocal(const vector< double > &val, int)
const std::string getShortName()
const double * getModelViewMatrix()
double getSpecularCoeff(int lightNum)
double getCameraPosLocal(int coord)
const vector< double > getCameraPosLocal()
void setCurrentVPToHome()
Set the current viewpoint to be the home viewpoint.
const vector< double > getViewDir()
int setStretchedRotCtrLocal(const double *vec)
const vector< double > getRotationCenterLocal()
virtual Viewpoint * getHomeViewpoint()
Provides support for maintaining a queue of recently issued commands, performing UnDo, ReDo, etc. The parent Command class supports a queue of Params changes; each entry has a clone of the previous and next Params instance associated with a change.
int setViewDir(const vector< double > &val)
int setRotationCenterLocal(const vector< double > &vec)
int setLightDirection(int lightNum, int dir, double val)
int setSpecularCoeff(int lightNum, double val)
static void CaptureEnd(Command *pCom, Params *nextParams, Params *nextAuxParams=0)
int setUpVec(const vector< double > &val)