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 bool getStereoCapture(){
return stereoCapture;}
142 void setStereoMode(
int mode) {stereoMode = mode;}
143 void setStereoCapture(
int mode) {stereoCapture = mode;}
144 float getStereoSeparation() {
return stereoSeparation;}
145 void setStereoSeparation(
float angle){stereoSeparation = angle;}
146 float getStereoConvergence() {
return stereoConvergence;}
147 void setStereoConvergence(
float conv) {stereoConvergence = conv;}
149 void setNumLights(
int nlights) {numLights = nlights;}
150 const float* getLightDirection(
int lightNum){
return lightDirection[lightNum];}
151 void setLightDirection(
int lightNum,
int dir,
float val){
152 lightDirection[lightNum][dir] = val;
154 float getDiffuseCoeff(
int lightNum) {
return diffuseCoeff[lightNum];}
155 float getSpecularCoeff(
int lightNum) {
return specularCoeff[lightNum];}
157 float getAmbientCoeff() {
return ambientCoeff;}
158 void setDiffuseCoeff(
int lightNum,
float val) {diffuseCoeff[lightNum]=val;}
159 void setSpecularCoeff(
int lightNum,
float val) {specularCoeff[lightNum]=val;}
160 void setExponent(
float val) {specularExp=val;}
161 void setAmbientCoeff(
float val) {ambientCoeff=val;}
162 Viewpoint* getCurrentViewpoint() {
return currentViewpoint;}
163 void setCurrentViewpoint(Viewpoint* newVP){
164 if (currentViewpoint)
delete currentViewpoint;
165 currentViewpoint = newVP;
167 Viewpoint* getHomeViewpoint() {
return homeViewpoint;}
168 void setHomeViewpoint(Viewpoint* newVP){
169 if (homeViewpoint)
delete homeViewpoint;
170 homeViewpoint = newVP;
174 void centerFullRegion(
int timestep);
176 float* getRotCenterLatLon(){
return currentViewpoint->getRotCenterLatLon();}
177 float getRotationCenterLocal(
int i){
return currentViewpoint->getRotationCenterLocal(i);}
178 float* getCamPosLatLon() {
return currentViewpoint->getCamPosLatLon();}
180 void setRotationCenterLocal(
float* vec,
int timestep){
181 currentViewpoint->setRotationCenterLocal(vec);
182 if (useLatLon) convertLocalToLonLat(timestep);
184 void setCamPosLatLon(
float x,
float y) {currentViewpoint->setCamPosLatLon(x,y);}
185 void setRotCenterLatLon(
float x,
float y) {currentViewpoint->setRotCenterLatLon(x,y);}
186 bool isLatLon() {
return useLatLon;}
187 void setLatLon(
bool val){useLatLon = val;}
189 void rescale(
float scaleFac[3],
int timestep);
191 bool convertLocalToLonLat(
int timestep);
192 bool convertLocalFromLonLat(
int timestep);
194 void getFarNearDist(
float* boxFar,
float* boxNear);
197 virtual bool reinit(
bool doOverride);
198 virtual void restart();
200 static void setDefaultPrefs();
204 static void localToStretchedCube(
const float fromCoords[3],
float toCoords[3]);
206 static void localToStretchedCube(
const double fromCoords[3],
double toCoords[3]);
209 static void localFromStretchedCube(
float fromCoords[3],
float toCoords[3]);
210 static void setCoordTrans();
214 const double* getModelViewMatrix() {
return modelViewMatrix;}
217 void transform3Vector(
const float vec[3],
float resvec[3]);
219 void setModelViewMatrix(
double* mtx){
220 for (
int i = 0; i<16; i++) modelViewMatrix[i] = mtx[i];
222 bool elementStartHandler(ExpatParseMgr*,
int , std::string& ,
const char ** );
223 bool elementEndHandler(ExpatParseMgr*,
int , std::string& );
224 ParamNode* buildNode();
225 static const float* getDefaultViewDir(){
return defaultViewDir;}
226 static const float* getDefaultUpVec(){
return defaultUpVec;}
227 static const float* getDefaultLightDirection(
int lightNum){
return defaultLightDirection[lightNum];}
228 static float getDefaultAmbientCoeff(){
return defaultAmbientCoeff;}
229 static float getDefaultSpecularExp(){
return defaultSpecularExp;}
230 static int getDefaultNumLights(){
return defaultNumLights;}
231 static const float* getDefaultDiffuseCoeff() {
return defaultDiffuseCoeff;}
232 static const float* getDefaultSpecularCoeff() {
return defaultSpecularCoeff;}
233 static void setDefaultLightDirection(
int lightNum,
float val[3]){
234 for (
int i = 0; i<3; i++) defaultLightDirection[lightNum][i] = val[i];
236 static void setDefaultUpVec(
float val[3]){
237 for (
int i = 0; i<3; i++) defaultUpVec[i] = val[i];
239 static void setDefaultViewDir(
float val[3]){
240 for (
int i = 0; i<3; i++) defaultViewDir[i] = val[i];
242 static void setDefaultSpecularCoeff(
float val[3]){
243 for (
int i = 0; i<3; i++) defaultSpecularCoeff[i] = val[i];
245 static void setDefaultDiffuseCoeff(
float val[3]){
246 for (
int i = 0; i<3; i++) defaultDiffuseCoeff[i] = val[i];
248 static void setDefaultAmbientCoeff(
float val){ defaultAmbientCoeff = val;}
249 static void setDefaultSpecularExp(
float val){ defaultSpecularExp = val;}
250 static void setDefaultNumLights(
int val){ defaultNumLights = val;}
251 static const string _stereoUserPrefAttr;
252 static const string _stereoCaptureUserPrefAttr;
259 static const string _shortName;
260 static const string _latLonAttr;
261 static const string _currentViewTag;
262 static const string _homeViewTag;
263 static const string _lightTag;
264 static const string _lightDirectionAttr;
265 static const string _lightNumAttr;
266 static const string _diffuseLightAttr;
267 static const string _ambientLightAttr;
268 static const string _specularLightAttr;
269 static const string _specularExponentAttr;
270 static const string _stereoModeAttr;
271 static const string _stereoCaptureAttr;
272 static const string _stereoSeparationAttr;
273 static const string _stereoConvergenceAttr;
275 Viewpoint* currentViewpoint;
276 Viewpoint* homeViewpoint;
277 static bool _stereoSupported;
278 static bool _stereoUserPref;
279 static bool _stereoCaptureUserPref;
280 float stereoSeparation;
281 float stereoConvergence;
287 float lightDirection[3][4];
288 float diffuseCoeff[3];
289 float specularCoeff[3];
295 static float minStretchedCubeCoord[3];
296 static float maxStretchedCubeCoord[3];
298 static float maxStretchedCubeSide;
300 static float defaultViewDir[3];
301 static float defaultUpVec[3];
302 static float defaultLightDirection[3][3];
303 static float defaultDiffuseCoeff[3];
304 static float defaultSpecularCoeff[3];
305 static float defaultAmbientCoeff;
306 static float defaultSpecularExp;
307 static int defaultNumLights;
312 double modelViewMatrix[16];
313 #endif //DOXYGEN_SKIP_THIS 316 #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()