Changeset 8947 in orxonox.OLD for branches/mountain_lake/src/lib
- Timestamp:
- Jun 30, 2006, 11:03:53 AM (18 years ago)
- Location:
- branches/mountain_lake/src/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mountain_lake/src/lib/graphics/effects/cloud_effect.cc
r8946 r8947 27 27 #include "shell_command.h" 28 28 #include "t_animation.h" 29 #include "script_class.h" 29 30 30 31 #include "parser/tinyxml/tinyxml.h" … … 48 49 SHELL_COMMAND(skyColor, CloudEffect, shellSkyColor); 49 50 SHELL_COMMAND(cloudColor, CloudEffect, shellCloudColor); 51 52 53 CREATE_SCRIPTABLE_CLASS(CloudEffect, CL_CLOUD_EFFECT, 54 addMethod("shellSkyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor)) 55 ->addMethod("shellCloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor)) 56 ); 57 50 58 51 59 CREATE_FACTORY(CloudEffect, CL_CLOUD_EFFECT); -
branches/mountain_lake/src/lib/graphics/effects/cloud_effect.h
r8911 r8947 50 50 virtual void deactivate(); 51 51 52 inlinevoid activateCloud() {52 void activateCloud() { 53 53 this->activate(); 54 54 } 55 56 inline void deactivateCloud() { 55 void deactivateCloud() { 57 56 this->deactivate(); 58 57 } 59 58 60 inlinevoid setCloudOption(const std::string& option) {59 void setCloudOption(const std::string& option) { 61 60 if (option == "activate") 62 61 this->cloudActivate = true; 63 62 } 64 63 65 inlinevoid setAnimationSpeed(float speed) {64 void setAnimationSpeed(float speed) { 66 65 this->animationSpeed = speed; 67 66 } 68 67 69 inlinevoid setCloudScale(float scale) {68 void setCloudScale(float scale) { 70 69 this->scale = scale; 71 70 } 72 71 73 inlinevoid setCloudColor(float colorX, float colorY, float colorZ) {72 void setCloudColor(float colorX, float colorY, float colorZ) { 74 73 this->cloudColor = Vector(colorX, colorY, colorZ); 75 74 } 76 75 77 inlinevoid setSkyColor(float colorX, float colorY, float colorZ) {76 void setSkyColor(float colorX, float colorY, float colorZ) { 78 77 this->skyColor = Vector(colorX, colorY, colorZ); 79 78 } 80 79 81 inlinevoid setPlanetRadius(float planetRadius) {80 void setPlanetRadius(float planetRadius) { 82 81 this->planetRadius = planetRadius; 83 82 } 84 83 85 inlinevoid setAtmosphericRadius(float atmosphericRadius) {84 void setAtmosphericRadius(float atmosphericRadius) { 86 85 this->atmosphericRadius = atmosphericRadius; 87 86 } 88 87 89 inlinevoid setDivisions(int divs) {88 void setDivisions(int divs) { 90 89 this->divs = divs; 91 90 } -
branches/mountain_lake/src/lib/util/executor/executor_lua.h
r8711 r8947 44 44 public: 45 45 /** 46 47 46 * @brief Constructor of a ExecutorXML 47 * @param function a Function to call 48 48 */ 49 49 ExecutorLua0(void(T::*function)()) 50 50 : Executor() 51 51 { 52 52 this->functionPointer = function; … … 91 91 public: 92 92 /** 93 94 93 * @brief Constructor of a ExecutorXML 94 * @param function a Function to call 95 95 */ 96 96 ExecutorLua1(void(T::*function)(type0)) 97 98 { 99 this->functionPointer = function; 100 this->functorType = Executor_Objective | Executor_NoLoadString; 101 } 102 103 /** 104 105 106 97 : Executor(ExecutorParamType<type0>()) 98 { 99 this->functionPointer = function; 100 this->functorType = Executor_Objective | Executor_NoLoadString; 101 } 102 103 /** 104 * @brief executes the Command on BaseObject 105 * @param object the BaseObject to execute this Executor on 106 * @param loadString ignored in this case 107 107 */ 108 108 virtual void operator()(BaseObject* object, const SubString& = SubString()) const … … 120 120 121 121 /** 122 122 * @returns a _new_ Copy of this Executor 123 123 */ 124 124 virtual Executor* clone () const … … 140 140 public: 141 141 /** 142 143 142 * @brief Constructor of a ExecutorXML 143 * @param function a Function to call 144 144 */ 145 145 ExecutorLua2(void(T::*function)(type0, type1)) 146 146 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>()) 147 147 { 148 148 this->functionPointer = function; … … 166 166 167 167 (dynamic_cast<T*>(object)->*(functionPointer))( 168 fromLua<type0>(state, 1),169 168 fromLua<type0>(state, 1), 169 fromLua<type1>(state, 2) ); 170 170 } 171 171 … … 217 217 (dynamic_cast<T*>(object)->*(functionPointer))( 218 218 fromLua<type0>(state, 1), 219 220 219 fromLua<type1>(state, 2), 220 fromLua<type2>(state, 3) ); 221 221 } 222 222 … … 233 233 234 234 235 /////////// 236 //// 4 //// 237 /////////// 238 //! Executes a Function with a lua_State* parameter. 239 template<class T, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4 : public Executor 240 { 241 public: 242 /** 243 * @brief Constructor of a ExecutorXML 244 * @param function a Function to call 245 */ 246 ExecutorLua4(void(T::*function)(type0, type1, type2, type3)) 247 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>()) 248 { 249 this->functionPointer = function; 250 this->functorType = Executor_Objective | Executor_NoLoadString; 251 } 252 253 /** 254 * @brief executes the Command on BaseObject 255 * @param object the BaseObject to execute this Executor on 256 * @param loadString ignored in this case 257 */ 258 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 259 { 260 PRINTF(1)("no usefull executor\n"); 261 } 262 263 virtual void operator()(BaseObject* object, int& count, void* values) const 264 { 265 lua_State* state = (lua_State*)values; 266 count = 0; 267 268 (dynamic_cast<T*>(object)->*(functionPointer))( 269 fromLua<type0>(state, 1), 270 fromLua<type1>(state, 2), 271 fromLua<type2>(state, 3), 272 fromLua<type3>(state, 4) ); 273 } 274 275 /** 276 * @returns a _new_ Copy of this Executor 277 */ 278 virtual Executor* clone () const 279 { 280 return new ExecutorLua4<T, type0, type1, type2, type3>(this->functionPointer); 281 } 282 private: 283 void (T::*functionPointer)(type0, type1, type2, type3); 284 }; 235 285 236 286 … … 250 300 public: 251 301 /** 252 253 302 * @brief Constructor of a ExecutorXML 303 * @param function a Function to call 254 304 */ 255 305 ExecutorLua0ret(ret (T::*function)()) 256 306 : Executor() 257 307 { 258 308 this->functionPointer = function; … … 279 329 280 330 /** 281 331 * @returns a _new_ Copy of this Executor 282 332 */ 283 333 virtual Executor* clone () const … … 299 349 public: 300 350 /** 301 302 351 * @brief Constructor of a ExecutorXML 352 * @param function a Function to call 303 353 */ 304 354 ExecutorLua1ret(ret (T::*function)(type0)) 305 355 : Executor(ExecutorParamType<type0>()) 306 356 { 307 357 this->functionPointer = function; … … 325 375 326 376 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 327 377 fromLua<type0>(state, 1))); 328 378 } 329 379 … … 347 397 public: 348 398 /** 349 350 399 * @brief Constructor of a ExecutorXML 400 * @param function a Function to call 351 401 */ 352 402 ExecutorLua2ret(ret (T::*function)(type0, type1)) 353 403 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>()) 354 404 { 355 405 this->functionPointer = function; … … 373 423 374 424 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 425 fromLua<type0>(state, 1), 426 fromLua<type1>(state, 2) )); 427 } 428 429 /** 430 * @returns a _new_ Copy of this Executor 431 */ 432 virtual Executor* clone () const 433 { 434 return new ExecutorLua2ret<T, ret, type0, type1>(this->functionPointer); 435 } 436 private: 437 ret (T::*functionPointer)(type0, type1); 438 }; 439 440 441 /////////// 442 //// 3 //// 443 /////////// 444 //! Executes a Function with a lua_State* parameter. 445 template<class T, typename ret, typename type0, typename type1, typename type2> class ExecutorLua3ret : public Executor 446 { 447 public: 448 /** 449 * @brief Constructor of a ExecutorXML 450 * @param function a Function to call 451 */ 452 ExecutorLua3ret(ret (T::*function)(type0, type1, type2)) 453 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>()) 454 { 455 this->functionPointer = function; 456 this->functorType = Executor_Objective | Executor_NoLoadString; 457 } 458 459 /** 460 * @brief executes the Command on BaseObject 461 * @param object the BaseObject to execute this Executor on 462 * @param loadString ignored in this case 463 */ 464 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 465 { 466 PRINTF(1)("no usefull executor\n"); 467 } 468 469 virtual void operator()(BaseObject* object, int& count, void* values) const 470 { 471 lua_State* state = (lua_State*)values; 472 count = 1; 473 474 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 475 fromLua<type0>(state, 1), 476 fromLua<type1>(state, 2), 477 fromLua<type2>(state, 3) )); 478 } 479 480 /** 481 * @returns a _new_ Copy of this Executor 482 */ 483 virtual Executor* clone () const 484 { 485 return new ExecutorLua3ret<T, ret, type0, type1, type2>(this->functionPointer); 486 } 487 private: 488 ret (T::*functionPointer)(type0, type1, type2); 489 }; 490 491 492 /////////// 493 //// 4 //// 494 /////////// 495 //! Executes a Function with a lua_State* parameter. 496 template<class T, typename ret, typename type0, typename type1, typename type2, typename type3> class ExecutorLua4ret : public Executor 497 { 498 public: 499 /** 500 * @brief Constructor of a ExecutorXML 501 * @param function a Function to call 502 */ 503 ExecutorLua4ret(ret (T::*function)(type0, type1, type2, type3)) 504 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>()) 505 { 506 this->functionPointer = function; 507 this->functorType = Executor_Objective | Executor_NoLoadString; 508 } 509 510 /** 511 * @brief executes the Command on BaseObject 512 * @param object the BaseObject to execute this Executor on 513 * @param loadString ignored in this case 514 */ 515 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 516 { 517 PRINTF(1)("no usefull executor\n"); 518 } 519 520 virtual void operator()(BaseObject* object, int& count, void* values) const 521 { 522 lua_State* state = (lua_State*)values; 523 count = 1; 524 525 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 526 fromLua<type0>(state, 1), 527 fromLua<type1>(state, 2), 528 fromLua<type2>(state, 3), 529 fromLua<type3>(state, 4) )); 530 } 531 532 /** 533 * @returns a _new_ Copy of this Executor 534 */ 535 virtual Executor* clone () const 536 { 537 return new ExecutorLua4ret<T, ret, type0, type1, type2, type3>(this->functionPointer); 538 } 539 private: 540 ret (T::*functionPointer)(type0, type1, type2, type3); 541 }; 542 543 /////////// 544 //// 5 //// 545 /////////// 546 //! Executes a Function with a lua_State* parameter. 547 template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4> class ExecutorLua5ret : public Executor 548 { 549 public: 550 /** 551 * @brief Constructor of a ExecutorXML 552 * @param function a Function to call 553 */ 554 ExecutorLua5ret(ret (T::*function)(type0, type1, type2, type3, type4)) 555 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>()) 556 { 557 this->functionPointer = function; 558 this->functorType = Executor_Objective | Executor_NoLoadString; 559 } 560 561 /** 562 * @brief executes the Command on BaseObject 563 * @param object the BaseObject to execute this Executor on 564 * @param loadString ignored in this case 565 */ 566 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 567 { 568 PRINTF(1)("no usefull executor\n"); 569 } 570 571 virtual void operator()(BaseObject* object, int& count, void* values) const 572 { 573 lua_State* state = (lua_State*)values; 574 count = 1; 575 576 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 577 fromLua<type0>(state, 1), 578 fromLua<type1>(state, 2), 579 fromLua<type2>(state, 3), 580 fromLua<type3>(state, 4), 581 fromLua<type4>(state, 5) )); 582 } 583 584 /** 585 * @returns a _new_ Copy of this Executor 586 */ 587 virtual Executor* clone () const 588 { 589 return new ExecutorLua5ret<T, ret, type0, type1, type2, type3, type4>(this->functionPointer); 590 } 591 private: 592 ret (T::*functionPointer)(type0, type1, type2, type3, type4); 593 }; 594 595 /////////// 596 //// 6 //// 597 /////////// 598 //! Executes a Function with a lua_State* parameter. 599 template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5> class ExecutorLua6ret : public Executor 600 { 601 public: 602 /** 603 * @brief Constructor of a ExecutorXML 604 * @param function a Function to call 605 */ 606 ExecutorLua6ret(ret (T::*function)(type0, type1, type2, type3, type4, type5)) 607 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), 608 ExecutorParamType<type2>(), ExecutorParamType<type3>(), 609 ExecutorParamType<type4>(), ExecutorParamType<type5>()) 610 { 611 this->functionPointer = function; 612 this->functorType = Executor_Objective | Executor_NoLoadString; 613 } 614 615 /** 616 * @brief executes the Command on BaseObject 617 * @param object the BaseObject to execute this Executor on 618 * @param loadString ignored in this case 619 */ 620 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 621 { 622 PRINTF(1)("no usefull executor\n"); 623 } 624 625 virtual void operator()(BaseObject* object, int& count, void* values) const 626 { 627 lua_State* state = (lua_State*)values; 628 count = 1; 629 630 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 375 631 fromLua<type0>(state, 1), 376 fromLua<type1>(state, 2) )); 377 } 378 379 /** 380 * @returns a _new_ Copy of this Executor 381 */ 382 virtual Executor* clone () const 383 { 384 return new ExecutorLua2ret<T, ret, type0, type1>(this->functionPointer); 385 } 386 private: 387 ret (T::*functionPointer)(type0, type1); 388 }; 632 fromLua<type1>(state, 2), 633 fromLua<type2>(state, 3), 634 fromLua<type3>(state, 4), 635 fromLua<type4>(state, 5), 636 fromLua<type5>(state, 6) )); 637 } 638 639 /** 640 * @returns a _new_ Copy of this Executor 641 */ 642 virtual Executor* clone () const 643 { 644 return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer); 645 } 646 private: 647 ret (T::*functionPointer)(type0, type1, type2, type3, type4, type5); 648 }; 649 650 /////////// 651 //// 7 //// 652 /////////// 653 //! Executes a Function with a lua_State* parameter. 654 template<class T, typename ret, typename type0, typename type1, typename type2, typename type3, typename type4, typename type5, typename type6> class ExecutorLua7ret : public Executor 655 { 656 public: 657 /** 658 * @brief Constructor of a ExecutorXML 659 * @param function a Function to call 660 */ 661 ExecutorLua7ret(ret (T::*function)(type0, type1, type2, type3, type4, type5, type6)) 662 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), 663 ExecutorParamType<type2>(), ExecutorParamType<type3>(), 664 ExecutorParamType<type4>(), ExecutorParamType<type5>(), 665 ExecutorParamType<type6>()) 666 { 667 this->functionPointer = function; 668 this->functorType = Executor_Objective | Executor_NoLoadString; 669 } 670 671 /** 672 * @brief executes the Command on BaseObject 673 * @param object the BaseObject to execute this Executor on 674 * @param loadString ignored in this case 675 */ 676 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 677 { 678 PRINTF(1)("no usefull executor\n"); 679 } 680 681 virtual void operator()(BaseObject* object, int& count, void* values) const 682 { 683 lua_State* state = (lua_State*)values; 684 count = 1; 685 686 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 687 fromLua<type0>(state, 1), 688 fromLua<type1>(state, 2), 689 fromLua<type2>(state, 3), 690 fromLua<type3>(state, 4), 691 fromLua<type4>(state, 5), 692 fromLua<type5>(state, 6), 693 fromLua<type6>(state, 7) )); 694 } 695 696 /** 697 * @returns a _new_ Copy of this Executor 698 */ 699 virtual Executor* clone () const 700 { 701 return new ExecutorLua7ret<T, ret, type0, type1, type2, type3, type4, type5, type6>(this->functionPointer); 702 } 703 private: 704 ret (T::*functionPointer)(type0, type1, type2, type3, type4, type5, type6); 705 }; 706 389 707 390 708 #endif /* _EXECUTOR_LUA_H */
Note: See TracChangeset
for help on using the changeset viewer.