20 #ifndef VIEWPOINTPARAMS_H
21 #define VIEWPOINTPARAMS_H
26 #include "viewpoint.h"
91 float*
getViewDir() {
return currentViewpoint->getViewDir();}
95 float*
getUpVec() {
return currentViewpoint->getUpVec();}
103 #ifndef DOXYGEN_SKIP_THIS
105 const std::string& getShortName() {
return _shortName;}
106 virtual Params* deepCopy(ParamNode* n = 0);
118 float getCameraPosLocal(
int coord) {
return currentViewpoint->getCameraPosLocal()[coord];}
120 void setCameraPosLocal(
float* val,
int timestep ) {
121 currentViewpoint->setCameraPosLocal(val);
122 if (useLatLon) convertLocalToLonLat(timestep);
125 void setViewDir(
int i,
float val) { currentViewpoint->setViewDir(i,val);}
126 void setViewDir(
float* val) {currentViewpoint->setViewDir(val);}
128 void setUpVec(
int i,
float val) { currentViewpoint->setUpVec(i,val);}
129 void setUpVec(
float* val) {currentViewpoint->setUpVec(val);}
130 bool hasPerspective(){
return currentViewpoint->hasPerspective();}
131 void setPerspective(
bool on) {currentViewpoint->setPerspective(on);}
134 static void setStereoUserPref(
bool pref) {_stereoUserPref = pref;}
135 void setStereoNotSupported() {_stereoSupported=0;}
136 void setStereoSupported() {_stereoSupported=1;}
137 bool getStereoSupported() {
return _stereoSupported;}
140 int getStereoMode(){
return stereoMode;}
141 void setStereoMode(
int mode) {stereoMode = mode;}
142 float getStereoSeparation() {
return stereoSeparation;}
143 void setStereoSeparation(
float angle){stereoSeparation = angle;}
144 float getStereoConvergence() {
return stereoConvergence;}
145 void setStereoConvergence(
float conv) {stereoConvergence = conv;}
147 void setNumLights(
int nlights) {numLights = nlights;}
148 const float* getLightDirection(
int lightNum){
return lightDirection[lightNum];}
149 void setLightDirection(
int lightNum,
int dir,
float val){
150 lightDirection[lightNum][dir] = val;
152 float getDiffuseCoeff(
int lightNum) {
return diffuseCoeff[lightNum];}
153 float getSpecularCoeff(
int lightNum) {
return specularCoeff[lightNum];}
155 float getAmbientCoeff() {
return ambientCoeff;}
156 void setDiffuseCoeff(
int lightNum,
float val) {diffuseCoeff[lightNum]=val;}
157 void setSpecularCoeff(
int lightNum,
float val) {specularCoeff[lightNum]=val;}
158 void setExponent(
float val) {specularExp=val;}
159 void setAmbientCoeff(
float val) {ambientCoeff=val;}
160 Viewpoint* getCurrentViewpoint() {
return currentViewpoint;}
161 void setCurrentViewpoint(Viewpoint* newVP){
162 if (currentViewpoint)
delete currentViewpoint;
163 currentViewpoint = newVP;
165 Viewpoint* getHomeViewpoint() {
return homeViewpoint;}
166 void setHomeViewpoint(Viewpoint* newVP){
167 if (homeViewpoint)
delete homeViewpoint;
168 homeViewpoint = newVP;
172 void centerFullRegion(
int timestep);
174 float* getRotCenterLatLon(){
return currentViewpoint->getRotCenterLatLon();}
175 float getRotationCenterLocal(
int i){
return currentViewpoint->getRotationCenterLocal(i);}
176 float* getCamPosLatLon() {
return currentViewpoint->getCamPosLatLon();}
178 void setRotationCenterLocal(
float* vec,
int timestep){
179 currentViewpoint->setRotationCenterLocal(vec);
180 if (useLatLon) convertLocalToLonLat(timestep);
182 void setCamPosLatLon(
float x,
float y) {currentViewpoint->setCamPosLatLon(x,y);}
183 void setRotCenterLatLon(
float x,
float y) {currentViewpoint->setRotCenterLatLon(x,y);}
184 bool isLatLon() {
return useLatLon;}
185 void setLatLon(
bool val){useLatLon = val;}
187 void rescale(
float scaleFac[3],
int timestep);
189 bool convertLocalToLonLat(
int timestep);
190 bool convertLocalFromLonLat(
int timestep);
192 void getFarNearDist(
float* boxFar,
float* boxNear);
195 virtual bool reinit(
bool doOverride);
196 virtual void restart();
198 static void setDefaultPrefs();
202 static void localToStretchedCube(
const float fromCoords[3],
float toCoords[3]);
204 static void localToStretchedCube(
const double fromCoords[3],
double toCoords[3]);
207 static void localFromStretchedCube(
float fromCoords[3],
float toCoords[3]);
208 static void setCoordTrans();
212 const double* getModelViewMatrix() {
return modelViewMatrix;}
215 void transform3Vector(
const float vec[3],
float resvec[3]);
217 void setModelViewMatrix(
double* mtx){
218 for (
int i = 0; i<16; i++) modelViewMatrix[i] = mtx[i];
220 bool elementStartHandler(ExpatParseMgr*,
int , std::string& ,
const char ** );
221 bool elementEndHandler(ExpatParseMgr*,
int , std::string& );
222 ParamNode* buildNode();
223 static const float* getDefaultViewDir(){
return defaultViewDir;}
224 static const float* getDefaultUpVec(){
return defaultUpVec;}
225 static const float* getDefaultLightDirection(
int lightNum){
return defaultLightDirection[lightNum];}
226 static float getDefaultAmbientCoeff(){
return defaultAmbientCoeff;}
227 static float getDefaultSpecularExp(){
return defaultSpecularExp;}
228 static int getDefaultNumLights(){
return defaultNumLights;}
229 static const float* getDefaultDiffuseCoeff() {
return defaultDiffuseCoeff;}
230 static const float* getDefaultSpecularCoeff() {
return defaultSpecularCoeff;}
231 static void setDefaultLightDirection(
int lightNum,
float val[3]){
232 for (
int i = 0; i<3; i++) defaultLightDirection[lightNum][i] = val[i];
234 static void setDefaultUpVec(
float val[3]){
235 for (
int i = 0; i<3; i++) defaultUpVec[i] = val[i];
237 static void setDefaultViewDir(
float val[3]){
238 for (
int i = 0; i<3; i++) defaultViewDir[i] = val[i];
240 static void setDefaultSpecularCoeff(
float val[3]){
241 for (
int i = 0; i<3; i++) defaultSpecularCoeff[i] = val[i];
243 static void setDefaultDiffuseCoeff(
float val[3]){
244 for (
int i = 0; i<3; i++) defaultDiffuseCoeff[i] = val[i];
246 static void setDefaultAmbientCoeff(
float val){ defaultAmbientCoeff = val;}
247 static void setDefaultSpecularExp(
float val){ defaultSpecularExp = val;}
248 static void setDefaultNumLights(
int val){ defaultNumLights = val;}
249 static const string _stereoUserPrefAttr;
256 static const string _shortName;
257 static const string _latLonAttr;
258 static const string _currentViewTag;
259 static const string _homeViewTag;
260 static const string _lightTag;
261 static const string _lightDirectionAttr;
262 static const string _lightNumAttr;
263 static const string _diffuseLightAttr;
264 static const string _ambientLightAttr;
265 static const string _specularLightAttr;
266 static const string _specularExponentAttr;
267 static const string _stereoModeAttr;
268 static const string _stereoSeparationAttr;
269 static const string _stereoConvergenceAttr;
271 Viewpoint* currentViewpoint;
272 Viewpoint* homeViewpoint;
273 static bool _stereoSupported;
274 static bool _stereoUserPref;
275 float stereoSeparation;
276 float stereoConvergence;
281 float lightDirection[3][4];
282 float diffuseCoeff[3];
283 float specularCoeff[3];
289 static float minStretchedCubeCoord[3];
290 static float maxStretchedCubeCoord[3];
292 static float maxStretchedCubeSide;
294 static float defaultViewDir[3];
295 static float defaultUpVec[3];
296 static float defaultLightDirection[3][3];
297 static float defaultDiffuseCoeff[3];
298 static float defaultSpecularCoeff[3];
299 static float defaultAmbientCoeff;
300 static float defaultSpecularExp;
301 static int defaultNumLights;
306 double modelViewMatrix[16];
307 #endif //DOXYGEN_SKIP_THIS
310 #endif //VIEWPOINTPARAMS_H
float * getCameraPosLocal()
A pure virtual class for managing parameters used in visualization.
static float getMaxStretchedCubeSide()
Nodes with state in Xml tree representation.
static bool getStereoUserPref()
A class for describing the viewpoint and lights.
float * getRotationCenterLocal()
static float * getMinStretchedCubeCoords()