1 /* 2 Copyright (c) 2008-2009 NetAllied Systems GmbH 3 4 This file is part of MayaDataModel. 5 6 Licensed under the MIT Open Source License, 7 for details please see LICENSE file or the website 8 http://www.opensource.org/licenses/mit-license.php 9 */ 10 #ifndef __MayaDM_ENVSKY_H__ 11 #define __MayaDM_ENVSKY_H__ 12 #include "MayaDMTypes.h" 13 #include "MayaDMConnectables.h" 14 #include "MayaDMTextureEnv.h" 15 namespace MayaDM 16 { 17 class EnvSky : public TextureEnv 18 { 19 public: 20 public: 21 EnvSky()22 EnvSky():TextureEnv(){} 23 EnvSky(FILE* file,const std::string& name,const std::string& parent="",bool shared=false,bool create=true) 24 :TextureEnv(file, name, parent, "envSky", shared, create){} ~EnvSky()25 virtual ~EnvSky(){} 26 setTotalBrightness(float tb)27 void setTotalBrightness(float tb) 28 { 29 if(tb == 1.0) return; 30 fprintf(mFile,"\tsetAttr \".tb\" %f;\n", tb); 31 } setSunBrightness(const float3 & su)32 void setSunBrightness(const float3& su) 33 { 34 if(su == float3(0.5f,0.5f,0.5f)) return; 35 fprintf(mFile,"\tsetAttr \".su\" -type \"float3\" "); 36 su.write(mFile); 37 fprintf(mFile,";\n"); 38 } setSunBrightnessR(float sur)39 void setSunBrightnessR(float sur) 40 { 41 if(sur == 0.0) return; 42 fprintf(mFile,"\tsetAttr \".su.sur\" %f;\n", sur); 43 } setSunBrightnessG(float sug)44 void setSunBrightnessG(float sug) 45 { 46 if(sug == 0.0) return; 47 fprintf(mFile,"\tsetAttr \".su.sug\" %f;\n", sug); 48 } setSunBrightnessB(float sub)49 void setSunBrightnessB(float sub) 50 { 51 if(sub == 0.0) return; 52 fprintf(mFile,"\tsetAttr \".su.sub\" %f;\n", sub); 53 } setHaloBrightness(const float3 & hb)54 void setHaloBrightness(const float3& hb) 55 { 56 if(hb == float3(0.5f,0.5f,0.5f)) return; 57 fprintf(mFile,"\tsetAttr \".hb\" -type \"float3\" "); 58 hb.write(mFile); 59 fprintf(mFile,";\n"); 60 } setHaloBrightnessR(float hbr)61 void setHaloBrightnessR(float hbr) 62 { 63 if(hbr == 0.0) return; 64 fprintf(mFile,"\tsetAttr \".hb.hbr\" %f;\n", hbr); 65 } setHaloBrightnessG(float hbg)66 void setHaloBrightnessG(float hbg) 67 { 68 if(hbg == 0.0) return; 69 fprintf(mFile,"\tsetAttr \".hb.hbg\" %f;\n", hbg); 70 } setHaloBrightnessB(float hbb)71 void setHaloBrightnessB(float hbb) 72 { 73 if(hbb == 0.0) return; 74 fprintf(mFile,"\tsetAttr \".hb.hbb\" %f;\n", hbb); 75 } setElevation(double e)76 void setElevation(double e) 77 { 78 if(e == 4) return; 79 fprintf(mFile,"\tsetAttr \".e\" %f;\n", e); 80 } setAzimuth(double az)81 void setAzimuth(double az) 82 { 83 if(az == 1) return; 84 fprintf(mFile,"\tsetAttr \".az\" %f;\n", az); 85 } setSize(float sz)86 void setSize(float sz) 87 { 88 if(sz == 0.531) return; 89 fprintf(mFile,"\tsetAttr \".sz\" %f;\n", sz); 90 } setBlur(float b)91 void setBlur(float b) 92 { 93 if(b == 1.0) return; 94 fprintf(mFile,"\tsetAttr \".b\" %f;\n", b); 95 } setSkyBrightness(const float3 & sk)96 void setSkyBrightness(const float3& sk) 97 { 98 if(sk == float3(0.5f,0.5f,0.5f)) return; 99 fprintf(mFile,"\tsetAttr \".sk\" -type \"float3\" "); 100 sk.write(mFile); 101 fprintf(mFile,";\n"); 102 } setSkyBrightnessR(float skr)103 void setSkyBrightnessR(float skr) 104 { 105 if(skr == 0.0) return; 106 fprintf(mFile,"\tsetAttr \".sk.skr\" %f;\n", skr); 107 } setSkyBrightnessG(float skg)108 void setSkyBrightnessG(float skg) 109 { 110 if(skg == 0.0) return; 111 fprintf(mFile,"\tsetAttr \".sk.skg\" %f;\n", skg); 112 } setSkyBrightnessB(float skb)113 void setSkyBrightnessB(float skb) 114 { 115 if(skb == 0.0) return; 116 fprintf(mFile,"\tsetAttr \".sk.skb\" %f;\n", skb); 117 } setAirDensity(float ad)118 void setAirDensity(float ad) 119 { 120 if(ad == 1.0) return; 121 fprintf(mFile,"\tsetAttr \".ad\" %f;\n", ad); 122 } setDustDensity(float dd)123 void setDustDensity(float dd) 124 { 125 if(dd == 0.0) return; 126 fprintf(mFile,"\tsetAttr \".dd\" %f;\n", dd); 127 } setSkyThickness(float st)128 void setSkyThickness(float st) 129 { 130 if(st == 1000.0) return; 131 fprintf(mFile,"\tsetAttr \".st\" %f;\n", st); 132 } setSkyRadius(float sr)133 void setSkyRadius(float sr) 134 { 135 if(sr == 50.0) return; 136 fprintf(mFile,"\tsetAttr \".sr\" %f;\n", sr); 137 } setHasFloor(bool hf)138 void setHasFloor(bool hf) 139 { 140 if(hf == true) return; 141 fprintf(mFile,"\tsetAttr \".hf\" %i;\n", hf); 142 } setFloorColor(const float3 & fc)143 void setFloorColor(const float3& fc) 144 { 145 if(fc == float3(0.4f,0.4f,0.4f)) return; 146 fprintf(mFile,"\tsetAttr \".fc\" -type \"float3\" "); 147 fc.write(mFile); 148 fprintf(mFile,";\n"); 149 } setFloorColorR(float fcr)150 void setFloorColorR(float fcr) 151 { 152 if(fcr == 0.0) return; 153 fprintf(mFile,"\tsetAttr \".fc.fcr\" %f;\n", fcr); 154 } setFloorColorG(float fcg)155 void setFloorColorG(float fcg) 156 { 157 if(fcg == 0.0) return; 158 fprintf(mFile,"\tsetAttr \".fc.fcg\" %f;\n", fcg); 159 } setFloorColorB(float fcb)160 void setFloorColorB(float fcb) 161 { 162 if(fcb == 0.0) return; 163 fprintf(mFile,"\tsetAttr \".fc.fcb\" %f;\n", fcb); 164 } setFloorAltitude(float fa)165 void setFloorAltitude(float fa) 166 { 167 if(fa == -10.0) return; 168 fprintf(mFile,"\tsetAttr \".fa\" %f;\n", fa); 169 } setUseTexture(bool ut)170 void setUseTexture(bool ut) 171 { 172 if(ut == false) return; 173 fprintf(mFile,"\tsetAttr \".ut\" %i;\n", ut); 174 } setCloudTexture(float ct)175 void setCloudTexture(float ct) 176 { 177 if(ct == 1.0) return; 178 fprintf(mFile,"\tsetAttr \".ct\" %f;\n", ct); 179 } setCloudBrightness(const float3 & cb)180 void setCloudBrightness(const float3& cb) 181 { 182 if(cb == float3(0.5f,0.5f,0.5f)) return; 183 fprintf(mFile,"\tsetAttr \".cb\" -type \"float3\" "); 184 cb.write(mFile); 185 fprintf(mFile,";\n"); 186 } setCloudBrightnessR(float cbr)187 void setCloudBrightnessR(float cbr) 188 { 189 if(cbr == 0.0) return; 190 fprintf(mFile,"\tsetAttr \".cb.cbr\" %f;\n", cbr); 191 } setCloudBrightnessG(float cbg)192 void setCloudBrightnessG(float cbg) 193 { 194 if(cbg == 0.0) return; 195 fprintf(mFile,"\tsetAttr \".cb.cbg\" %f;\n", cbg); 196 } setCloudBrightnessB(float cbb)197 void setCloudBrightnessB(float cbb) 198 { 199 if(cbb == 0.0) return; 200 fprintf(mFile,"\tsetAttr \".cb.cbb\" %f;\n", cbb); 201 } setSunsetBrightness(const float3 & ss)202 void setSunsetBrightness(const float3& ss) 203 { 204 if(ss == float3(1.0f,1.0f,1.0f)) return; 205 fprintf(mFile,"\tsetAttr \".ss\" -type \"float3\" "); 206 ss.write(mFile); 207 fprintf(mFile,";\n"); 208 } setSunsetBrightnessR(float ssr)209 void setSunsetBrightnessR(float ssr) 210 { 211 if(ssr == 0.0) return; 212 fprintf(mFile,"\tsetAttr \".ss.ssr\" %f;\n", ssr); 213 } setSunsetBrightnessG(float ssg)214 void setSunsetBrightnessG(float ssg) 215 { 216 if(ssg == 0.0) return; 217 fprintf(mFile,"\tsetAttr \".ss.ssg\" %f;\n", ssg); 218 } setSunsetBrightnessB(float ssb)219 void setSunsetBrightnessB(float ssb) 220 { 221 if(ssb == 0.0) return; 222 fprintf(mFile,"\tsetAttr \".ss.ssb\" %f;\n", ssb); 223 } setDensity(float d)224 void setDensity(float d) 225 { 226 if(d == 1.0) return; 227 fprintf(mFile,"\tsetAttr \".d\" %f;\n", d); 228 } setThreshold(float t)229 void setThreshold(float t) 230 { 231 if(t == 0.5) return; 232 fprintf(mFile,"\tsetAttr \".t\" %f;\n", t); 233 } setPower(float po)234 void setPower(float po) 235 { 236 if(po == 1.0) return; 237 fprintf(mFile,"\tsetAttr \".po\" %f;\n", po); 238 } setAltitude(float a)239 void setAltitude(float a) 240 { 241 if(a == 0.2) return; 242 fprintf(mFile,"\tsetAttr \".a\" %f;\n", a); 243 } setHaloSize(float hs)244 void setHaloSize(float hs) 245 { 246 if(hs == 20.0) return; 247 fprintf(mFile,"\tsetAttr \".hs\" %f;\n", hs); 248 } setSkySamples(float ssa)249 void setSkySamples(float ssa) 250 { 251 if(ssa == 5.0) return; 252 fprintf(mFile,"\tsetAttr \".ssa\" %f;\n", ssa); 253 } setFloorSamples(float fsa)254 void setFloorSamples(float fsa) 255 { 256 if(fsa == 1.0) return; 257 fprintf(mFile,"\tsetAttr \".fsa\" %f;\n", fsa); 258 } setCloudSamples(float csa)259 void setCloudSamples(float csa) 260 { 261 if(csa == 5.0) return; 262 fprintf(mFile,"\tsetAttr \".csa\" %f;\n", csa); 263 } getPointCamera()264 void getPointCamera()const 265 { 266 fprintf(mFile,"\"%s.p\"",mName.c_str()); 267 } getPointCameraX()268 void getPointCameraX()const 269 { 270 fprintf(mFile,"\"%s.p.px\"",mName.c_str()); 271 } getPointCameraY()272 void getPointCameraY()const 273 { 274 fprintf(mFile,"\"%s.p.py\"",mName.c_str()); 275 } getPointCameraZ()276 void getPointCameraZ()const 277 { 278 fprintf(mFile,"\"%s.p.pz\"",mName.c_str()); 279 } getRefPointCamera()280 void getRefPointCamera()const 281 { 282 fprintf(mFile,"\"%s.rpc\"",mName.c_str()); 283 } getRefPointCameraX()284 void getRefPointCameraX()const 285 { 286 fprintf(mFile,"\"%s.rpc.rcx\"",mName.c_str()); 287 } getRefPointCameraY()288 void getRefPointCameraY()const 289 { 290 fprintf(mFile,"\"%s.rpc.rcy\"",mName.c_str()); 291 } getRefPointCameraZ()292 void getRefPointCameraZ()const 293 { 294 fprintf(mFile,"\"%s.rpc.rcz\"",mName.c_str()); 295 } getTotalBrightness()296 void getTotalBrightness()const 297 { 298 fprintf(mFile,"\"%s.tb\"",mName.c_str()); 299 } getSunBrightness()300 void getSunBrightness()const 301 { 302 fprintf(mFile,"\"%s.su\"",mName.c_str()); 303 } getSunBrightnessR()304 void getSunBrightnessR()const 305 { 306 fprintf(mFile,"\"%s.su.sur\"",mName.c_str()); 307 } getSunBrightnessG()308 void getSunBrightnessG()const 309 { 310 fprintf(mFile,"\"%s.su.sug\"",mName.c_str()); 311 } getSunBrightnessB()312 void getSunBrightnessB()const 313 { 314 fprintf(mFile,"\"%s.su.sub\"",mName.c_str()); 315 } getHaloBrightness()316 void getHaloBrightness()const 317 { 318 fprintf(mFile,"\"%s.hb\"",mName.c_str()); 319 } getHaloBrightnessR()320 void getHaloBrightnessR()const 321 { 322 fprintf(mFile,"\"%s.hb.hbr\"",mName.c_str()); 323 } getHaloBrightnessG()324 void getHaloBrightnessG()const 325 { 326 fprintf(mFile,"\"%s.hb.hbg\"",mName.c_str()); 327 } getHaloBrightnessB()328 void getHaloBrightnessB()const 329 { 330 fprintf(mFile,"\"%s.hb.hbb\"",mName.c_str()); 331 } getElevation()332 void getElevation()const 333 { 334 fprintf(mFile,"\"%s.e\"",mName.c_str()); 335 } getAzimuth()336 void getAzimuth()const 337 { 338 fprintf(mFile,"\"%s.az\"",mName.c_str()); 339 } getSize()340 void getSize()const 341 { 342 fprintf(mFile,"\"%s.sz\"",mName.c_str()); 343 } getBlur()344 void getBlur()const 345 { 346 fprintf(mFile,"\"%s.b\"",mName.c_str()); 347 } getSkyBrightness()348 void getSkyBrightness()const 349 { 350 fprintf(mFile,"\"%s.sk\"",mName.c_str()); 351 } getSkyBrightnessR()352 void getSkyBrightnessR()const 353 { 354 fprintf(mFile,"\"%s.sk.skr\"",mName.c_str()); 355 } getSkyBrightnessG()356 void getSkyBrightnessG()const 357 { 358 fprintf(mFile,"\"%s.sk.skg\"",mName.c_str()); 359 } getSkyBrightnessB()360 void getSkyBrightnessB()const 361 { 362 fprintf(mFile,"\"%s.sk.skb\"",mName.c_str()); 363 } getAirDensity()364 void getAirDensity()const 365 { 366 fprintf(mFile,"\"%s.ad\"",mName.c_str()); 367 } getDustDensity()368 void getDustDensity()const 369 { 370 fprintf(mFile,"\"%s.dd\"",mName.c_str()); 371 } getSkyThickness()372 void getSkyThickness()const 373 { 374 fprintf(mFile,"\"%s.st\"",mName.c_str()); 375 } getSkyRadius()376 void getSkyRadius()const 377 { 378 fprintf(mFile,"\"%s.sr\"",mName.c_str()); 379 } getHasFloor()380 void getHasFloor()const 381 { 382 fprintf(mFile,"\"%s.hf\"",mName.c_str()); 383 } getFloorColor()384 void getFloorColor()const 385 { 386 fprintf(mFile,"\"%s.fc\"",mName.c_str()); 387 } getFloorColorR()388 void getFloorColorR()const 389 { 390 fprintf(mFile,"\"%s.fc.fcr\"",mName.c_str()); 391 } getFloorColorG()392 void getFloorColorG()const 393 { 394 fprintf(mFile,"\"%s.fc.fcg\"",mName.c_str()); 395 } getFloorColorB()396 void getFloorColorB()const 397 { 398 fprintf(mFile,"\"%s.fc.fcb\"",mName.c_str()); 399 } getFloorAltitude()400 void getFloorAltitude()const 401 { 402 fprintf(mFile,"\"%s.fa\"",mName.c_str()); 403 } getUseTexture()404 void getUseTexture()const 405 { 406 fprintf(mFile,"\"%s.ut\"",mName.c_str()); 407 } getCloudTexture()408 void getCloudTexture()const 409 { 410 fprintf(mFile,"\"%s.ct\"",mName.c_str()); 411 } getCloudBrightness()412 void getCloudBrightness()const 413 { 414 fprintf(mFile,"\"%s.cb\"",mName.c_str()); 415 } getCloudBrightnessR()416 void getCloudBrightnessR()const 417 { 418 fprintf(mFile,"\"%s.cb.cbr\"",mName.c_str()); 419 } getCloudBrightnessG()420 void getCloudBrightnessG()const 421 { 422 fprintf(mFile,"\"%s.cb.cbg\"",mName.c_str()); 423 } getCloudBrightnessB()424 void getCloudBrightnessB()const 425 { 426 fprintf(mFile,"\"%s.cb.cbb\"",mName.c_str()); 427 } getSunsetBrightness()428 void getSunsetBrightness()const 429 { 430 fprintf(mFile,"\"%s.ss\"",mName.c_str()); 431 } getSunsetBrightnessR()432 void getSunsetBrightnessR()const 433 { 434 fprintf(mFile,"\"%s.ss.ssr\"",mName.c_str()); 435 } getSunsetBrightnessG()436 void getSunsetBrightnessG()const 437 { 438 fprintf(mFile,"\"%s.ss.ssg\"",mName.c_str()); 439 } getSunsetBrightnessB()440 void getSunsetBrightnessB()const 441 { 442 fprintf(mFile,"\"%s.ss.ssb\"",mName.c_str()); 443 } getDensity()444 void getDensity()const 445 { 446 fprintf(mFile,"\"%s.d\"",mName.c_str()); 447 } getThreshold()448 void getThreshold()const 449 { 450 fprintf(mFile,"\"%s.t\"",mName.c_str()); 451 } getPower()452 void getPower()const 453 { 454 fprintf(mFile,"\"%s.po\"",mName.c_str()); 455 } getAltitude()456 void getAltitude()const 457 { 458 fprintf(mFile,"\"%s.a\"",mName.c_str()); 459 } getHaloSize()460 void getHaloSize()const 461 { 462 fprintf(mFile,"\"%s.hs\"",mName.c_str()); 463 } getSkySamples()464 void getSkySamples()const 465 { 466 fprintf(mFile,"\"%s.ssa\"",mName.c_str()); 467 } getFloorSamples()468 void getFloorSamples()const 469 { 470 fprintf(mFile,"\"%s.fsa\"",mName.c_str()); 471 } getCloudSamples()472 void getCloudSamples()const 473 { 474 fprintf(mFile,"\"%s.csa\"",mName.c_str()); 475 } 476 protected: 477 EnvSky(FILE* file,const std::string& name,const std::string& parent,const std::string& nodeType,bool shared=false,bool create=true) TextureEnv(file,name,parent,nodeType,shared,create)478 :TextureEnv(file, name, parent, nodeType, shared, create) {} 479 480 }; 481 }//namespace MayaDM 482 #endif//__MayaDM_ENVSKY_H__ 483