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);}
127 int getStereoMode(){
return stereoMode;}
128 void setStereoMode(
int mode) {stereoMode = mode;}
129 float getStereoSeparation() {
return stereoSeparation;}
130 void setStereoSeparation(
float angle){stereoSeparation = angle;}
132 void setNumLights(
int nlights) {numLights = nlights;}
133 const float* getLightDirection(
int lightNum){
return lightDirection[lightNum];}
134 void setLightDirection(
int lightNum,
int dir,
float val){
135 lightDirection[lightNum][dir] = val;
137 float getDiffuseCoeff(
int lightNum) {
return diffuseCoeff[lightNum];}
138 float getSpecularCoeff(
int lightNum) {
return specularCoeff[lightNum];}
140 float getAmbientCoeff() {
return ambientCoeff;}
141 void setDiffuseCoeff(
int lightNum,
float val) {diffuseCoeff[lightNum]=val;}
142 void setSpecularCoeff(
int lightNum,
float val) {specularCoeff[lightNum]=val;}
143 void setExponent(
float val) {specularExp=val;}
144 void setAmbientCoeff(
float val) {ambientCoeff=val;}
145 Viewpoint* getCurrentViewpoint() {
return currentViewpoint;}
146 void setCurrentViewpoint(Viewpoint* newVP){
147 if (currentViewpoint)
delete currentViewpoint;
148 currentViewpoint = newVP;
150 Viewpoint* getHomeViewpoint() {
return homeViewpoint;}
151 void setHomeViewpoint(Viewpoint* newVP){
152 if (homeViewpoint)
delete homeViewpoint;
153 homeViewpoint = newVP;
157 void centerFullRegion(
int timestep);
159 float* getRotCenterLatLon(){
return currentViewpoint->getRotCenterLatLon();}
160 float getRotationCenterLocal(
int i){
return currentViewpoint->getRotationCenterLocal(i);}
161 float* getCamPosLatLon() {
return currentViewpoint->getCamPosLatLon();}
163 void setRotationCenterLocal(
float* vec,
int timestep){
164 currentViewpoint->setRotationCenterLocal(vec);
165 if (useLatLon) convertLocalToLonLat(timestep);
167 void setCamPosLatLon(
float x,
float y) {currentViewpoint->setCamPosLatLon(x,y);}
168 void setRotCenterLatLon(
float x,
float y) {currentViewpoint->setRotCenterLatLon(x,y);}
169 bool isLatLon() {
return useLatLon;}
170 void setLatLon(
bool val){useLatLon = val;}
172 void rescale(
float scaleFac[3],
int timestep);
174 bool convertLocalToLonLat(
int timestep);
175 bool convertLocalFromLonLat(
int timestep);
177 void getFarNearDist(
float* boxFar,
float* boxNear);
180 virtual bool reinit(
bool doOverride);
181 virtual void restart();
183 static void setDefaultPrefs();
187 static void localToStretchedCube(
const float fromCoords[3],
float toCoords[3]);
189 static void localToStretchedCube(
const double fromCoords[3],
double toCoords[3]);
192 static void localFromStretchedCube(
float fromCoords[3],
float toCoords[3]);
193 static void setCoordTrans();
197 const double* getModelViewMatrix() {
return modelViewMatrix;}
200 void transform3Vector(
const float vec[3],
float resvec[3]);
202 void setModelViewMatrix(
double* mtx){
203 for (
int i = 0; i<16; i++) modelViewMatrix[i] = mtx[i];
205 bool elementStartHandler(ExpatParseMgr*,
int , std::string& ,
const char ** );
206 bool elementEndHandler(ExpatParseMgr*,
int , std::string& );
207 ParamNode* buildNode();
208 static const float* getDefaultViewDir(){
return defaultViewDir;}
209 static const float* getDefaultUpVec(){
return defaultUpVec;}
210 static const float* getDefaultLightDirection(
int lightNum){
return defaultLightDirection[lightNum];}
211 static float getDefaultAmbientCoeff(){
return defaultAmbientCoeff;}
212 static float getDefaultSpecularExp(){
return defaultSpecularExp;}
213 static int getDefaultNumLights(){
return defaultNumLights;}
214 static const float* getDefaultDiffuseCoeff() {
return defaultDiffuseCoeff;}
215 static const float* getDefaultSpecularCoeff() {
return defaultSpecularCoeff;}
216 static void setDefaultLightDirection(
int lightNum,
float val[3]){
217 for (
int i = 0; i<3; i++) defaultLightDirection[lightNum][i] = val[i];
219 static void setDefaultUpVec(
float val[3]){
220 for (
int i = 0; i<3; i++) defaultUpVec[i] = val[i];
222 static void setDefaultViewDir(
float val[3]){
223 for (
int i = 0; i<3; i++) defaultViewDir[i] = val[i];
225 static void setDefaultSpecularCoeff(
float val[3]){
226 for (
int i = 0; i<3; i++) defaultSpecularCoeff[i] = val[i];
228 static void setDefaultDiffuseCoeff(
float val[3]){
229 for (
int i = 0; i<3; i++) defaultDiffuseCoeff[i] = val[i];
231 static void setDefaultAmbientCoeff(
float val){ defaultAmbientCoeff = val;}
232 static void setDefaultSpecularExp(
float val){ defaultSpecularExp = val;}
233 static void setDefaultNumLights(
int val){ defaultNumLights = val;}
240 static const string _shortName;
241 static const string _latLonAttr;
242 static const string _currentViewTag;
243 static const string _homeViewTag;
244 static const string _lightTag;
245 static const string _lightDirectionAttr;
246 static const string _lightNumAttr;
247 static const string _diffuseLightAttr;
248 static const string _ambientLightAttr;
249 static const string _specularLightAttr;
250 static const string _specularExponentAttr;
251 static const string _stereoModeAttr;
252 static const string _stereoSeparationAttr;
255 Viewpoint* currentViewpoint;
256 Viewpoint* homeViewpoint;
257 float stereoSeparation;
262 float lightDirection[3][4];
263 float diffuseCoeff[3];
264 float specularCoeff[3];
270 static float minStretchedCubeCoord[3];
271 static float maxStretchedCubeCoord[3];
273 static float maxStretchedCubeSide;
275 static float defaultViewDir[3];
276 static float defaultUpVec[3];
277 static float defaultLightDirection[3][3];
278 static float defaultDiffuseCoeff[3];
279 static float defaultSpecularCoeff[3];
280 static float defaultAmbientCoeff;
281 static float defaultSpecularExp;
282 static int defaultNumLights;
287 double modelViewMatrix[16];
288 #endif //DOXYGEN_SKIP_THIS
291 #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()