20 #ifndef VIEWPOINTPARAMS_H
21 #define VIEWPOINTPARAMS_H
26 #include "viewpoint.h"
86 float*
getViewDir() {
return currentViewpoint->getViewDir();}
90 float*
getUpVec() {
return currentViewpoint->getUpVec();}
98 #ifndef DOXYGEN_SKIP_THIS
100 const std::string& getShortName() {
return _shortName;}
101 virtual Params* deepCopy(ParamNode* n = 0);
113 float getCameraPosLocal(
int coord) {
return currentViewpoint->getCameraPosLocal()[coord];}
115 void setCameraPosLocal(
float* val,
int timestep ) {
116 currentViewpoint->setCameraPosLocal(val);
117 if (useLatLon) convertLocalToLonLat(timestep);
120 void setViewDir(
int i,
float val) { currentViewpoint->setViewDir(i,val);}
121 void setViewDir(
float* val) {currentViewpoint->setViewDir(val);}
123 void setUpVec(
int i,
float val) { currentViewpoint->setUpVec(i,val);}
124 void setUpVec(
float* val) {currentViewpoint->setUpVec(val);}
125 bool hasPerspective(){
return currentViewpoint->hasPerspective();}
126 void setPerspective(
bool on) {currentViewpoint->setPerspective(on);}
133 void setStereoNotSupported() {_stereoSupported=0;}
134 void setStereoSupported() {_stereoSupported=1;}
135 bool getStereoSupported() {
return _stereoSupported;}
138 int getStereoMode(){
return stereoMode;}
139 void setStereoMode(
int mode) {stereoMode = mode;}
140 float getStereoSeparation() {
return stereoSeparation;}
141 void setStereoSeparation(
float angle){stereoSeparation = angle;}
142 float getStereoConvergence() {
return stereoConvergence;}
143 void setStereoConvergence(
float conv) {stereoConvergence = conv;}
145 void setNumLights(
int nlights) {numLights = nlights;}
146 const float* getLightDirection(
int lightNum){
return lightDirection[lightNum];}
147 void setLightDirection(
int lightNum,
int dir,
float val){
148 lightDirection[lightNum][dir] = val;
150 float getDiffuseCoeff(
int lightNum) {
return diffuseCoeff[lightNum];}
151 float getSpecularCoeff(
int lightNum) {
return specularCoeff[lightNum];}
153 float getAmbientCoeff() {
return ambientCoeff;}
154 void setDiffuseCoeff(
int lightNum,
float val) {diffuseCoeff[lightNum]=val;}
155 void setSpecularCoeff(
int lightNum,
float val) {specularCoeff[lightNum]=val;}
156 void setExponent(
float val) {specularExp=val;}
157 void setAmbientCoeff(
float val) {ambientCoeff=val;}
158 Viewpoint* getCurrentViewpoint() {
return currentViewpoint;}
159 void setCurrentViewpoint(Viewpoint* newVP){
160 if (currentViewpoint)
delete currentViewpoint;
161 currentViewpoint = newVP;
163 Viewpoint* getHomeViewpoint() {
return homeViewpoint;}
164 void setHomeViewpoint(Viewpoint* newVP){
165 if (homeViewpoint)
delete homeViewpoint;
166 homeViewpoint = newVP;
170 void centerFullRegion(
int timestep);
172 float* getRotCenterLatLon(){
return currentViewpoint->getRotCenterLatLon();}
173 float getRotationCenterLocal(
int i){
return currentViewpoint->getRotationCenterLocal(i);}
174 float* getCamPosLatLon() {
return currentViewpoint->getCamPosLatLon();}
176 void setRotationCenterLocal(
float* vec,
int timestep){
177 currentViewpoint->setRotationCenterLocal(vec);
178 if (useLatLon) convertLocalToLonLat(timestep);
180 void setCamPosLatLon(
float x,
float y) {currentViewpoint->setCamPosLatLon(x,y);}
181 void setRotCenterLatLon(
float x,
float y) {currentViewpoint->setRotCenterLatLon(x,y);}
182 bool isLatLon() {
return useLatLon;}
183 void setLatLon(
bool val){useLatLon = val;}
185 void rescale(
float scaleFac[3],
int timestep);
187 bool convertLocalToLonLat(
int timestep);
188 bool convertLocalFromLonLat(
int timestep);
190 void getFarNearDist(
float* boxFar,
float* boxNear);
193 virtual bool reinit(
bool doOverride);
194 virtual void restart();
196 static void setDefaultPrefs();
200 static void localToStretchedCube(
const float fromCoords[3],
float toCoords[3]);
202 static void localToStretchedCube(
const double fromCoords[3],
double toCoords[3]);
205 static void localFromStretchedCube(
float fromCoords[3],
float toCoords[3]);
206 static void setCoordTrans();
210 const double* getModelViewMatrix() {
return modelViewMatrix;}
213 void transform3Vector(
const float vec[3],
float resvec[3]);
215 void setModelViewMatrix(
double* mtx){
216 for (
int i = 0; i<16; i++) modelViewMatrix[i] = mtx[i];
218 bool elementStartHandler(ExpatParseMgr*,
int , std::string& ,
const char ** );
219 bool elementEndHandler(ExpatParseMgr*,
int , std::string& );
220 ParamNode* buildNode();
221 static const float* getDefaultViewDir(){
return defaultViewDir;}
222 static const float* getDefaultUpVec(){
return defaultUpVec;}
223 static const float* getDefaultLightDirection(
int lightNum){
return defaultLightDirection[lightNum];}
224 static float getDefaultAmbientCoeff(){
return defaultAmbientCoeff;}
225 static float getDefaultSpecularExp(){
return defaultSpecularExp;}
226 static int getDefaultNumLights(){
return defaultNumLights;}
227 static const float* getDefaultDiffuseCoeff() {
return defaultDiffuseCoeff;}
228 static const float* getDefaultSpecularCoeff() {
return defaultSpecularCoeff;}
229 static void setDefaultLightDirection(
int lightNum,
float val[3]){
230 for (
int i = 0; i<3; i++) defaultLightDirection[lightNum][i] = val[i];
232 static void setDefaultUpVec(
float val[3]){
233 for (
int i = 0; i<3; i++) defaultUpVec[i] = val[i];
235 static void setDefaultViewDir(
float val[3]){
236 for (
int i = 0; i<3; i++) defaultViewDir[i] = val[i];
238 static void setDefaultSpecularCoeff(
float val[3]){
239 for (
int i = 0; i<3; i++) defaultSpecularCoeff[i] = val[i];
241 static void setDefaultDiffuseCoeff(
float val[3]){
242 for (
int i = 0; i<3; i++) defaultDiffuseCoeff[i] = val[i];
244 static void setDefaultAmbientCoeff(
float val){ defaultAmbientCoeff = val;}
245 static void setDefaultSpecularExp(
float val){ defaultSpecularExp = val;}
246 static void setDefaultNumLights(
int val){ defaultNumLights = val;}
253 static const string _shortName;
254 static const string _latLonAttr;
255 static const string _currentViewTag;
256 static const string _homeViewTag;
257 static const string _lightTag;
258 static const string _lightDirectionAttr;
259 static const string _lightNumAttr;
260 static const string _diffuseLightAttr;
261 static const string _ambientLightAttr;
262 static const string _specularLightAttr;
263 static const string _specularExponentAttr;
264 static const string _stereoModeAttr;
265 static const string _stereoSeparationAttr;
266 static const string _stereoConvergenceAttr;
268 Viewpoint* currentViewpoint;
269 Viewpoint* homeViewpoint;
270 static bool _stereoSupported;
271 float stereoSeparation;
272 float stereoConvergence;
277 float lightDirection[3][4];
278 float diffuseCoeff[3];
279 float specularCoeff[3];
285 static float minStretchedCubeCoord[3];
286 static float maxStretchedCubeCoord[3];
288 static float maxStretchedCubeSide;
290 static float defaultViewDir[3];
291 static float defaultUpVec[3];
292 static float defaultLightDirection[3][3];
293 static float defaultDiffuseCoeff[3];
294 static float defaultSpecularCoeff[3];
295 static float defaultAmbientCoeff;
296 static float defaultSpecularExp;
297 static int defaultNumLights;
302 double modelViewMatrix[16];
303 #endif //DOXYGEN_SKIP_THIS
306 #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.
A class for describing the viewpoint and lights.
float * getRotationCenterLocal()
static float * getMinStretchedCubeCoords()