Changeset 1684 for code/branches/core3/src/orxonox
- Timestamp:
- Aug 31, 2008, 4:32:31 AM (16 years ago)
- Location:
- code/branches/core3/src/orxonox/objects
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/orxonox/objects/Ambient.cc
r1594 r1684 89 89 void Ambient::XMLPort(Element& xmlelement, XMLPort::Mode mode) 90 90 { 91 BaseObject::XMLPort(xmlelement, mode); 91 // BaseObject::XMLPort(xmlelement, mode); 92 SUPER(Ambient, XMLPort, xmlelement, mode); 92 93 93 94 XMLPortParam(Ambient, "colourvalue", setAmbientLight, getAmbienetLight, xmlelement, mode); -
code/branches/core3/src/orxonox/objects/BillboardProjectile.cc
r1676 r1684 67 67 void BillboardProjectile::changedVisibility() 68 68 { 69 Projectile::changedVisibility(); 69 // Projectile::changedVisibility(); 70 SUPER(BillboardProjectile, changedVisibility); 70 71 this->billboard_.setVisible(this->isVisible()); 71 72 } -
code/branches/core3/src/orxonox/objects/BillboardProjectile.h
r1676 r1684 38 38 namespace orxonox 39 39 { 40 class _OrxonoxExport BillboardProjectile : public Projectile 40 class TESTTESTTEST1 41 { 42 public: 43 TESTTESTTEST1() { this->setMyValue(10); } 44 45 private: 46 void setMyValue(int value) { this->value1_ = value; } 47 48 int value1_; 49 int value2_; 50 Identifier* identifier_; 51 }; 52 53 class TESTTESTTEST2 54 { 55 public: 56 TESTTESTTEST2() { this->setMyValue(10); } 57 58 private: 59 void setMyValue(int value) { this->value1_ = value; } 60 61 int value1_; 62 int value2_; 63 double value3_; 64 char value4_; 65 bool value5_; 66 Identifier* identifier1_; 67 Identifier* identifier2_; 68 }; 69 70 class TESTTESTTEST3 : virtual public TESTTESTTEST1 71 { 72 public: 73 TESTTESTTEST3() { this->setMyOtherValue(10); } 74 75 private: 76 void setMyOtherValue(int value) { this->value3_ = value; } 77 78 int value3_; 79 TESTTESTTEST2* test_; 80 }; 81 82 class _OrxonoxExport BillboardProjectile : public Projectile, public TESTTESTTEST3, public TESTTESTTEST2, virtual public TESTTESTTEST1 41 83 { 42 84 public: -
code/branches/core3/src/orxonox/objects/Model.cc
r1592 r1684 66 66 void Model::XMLPort(Element& xmlelement, XMLPort::Mode mode) 67 67 { 68 WorldEntity::XMLPort(xmlelement, mode); 68 // WorldEntity::XMLPort(xmlelement, mode); 69 SUPER(Model, XMLPort, xmlelement, mode); 69 70 70 71 XMLPortParam(Model, "mesh", setMesh, getMesh, xmlelement, mode); … … 72 73 Model::create(); 73 74 } 75 /* 76 void Model::tick(float dt) 77 { 78 float i = dt * rnd(-100, 100); 79 float j = dt * rnd(-100, 100); 80 float k = dt * rnd(-100, 100); 74 81 82 // WorldEntity::tick(dt); 83 SUPER(Model, tick, dt); 84 85 this->setPosition(this->getPosition().x + i, this->getPosition().y + j, this->getPosition().z + k); 86 } 87 */ 75 88 bool Model::create(){ 76 89 if(!WorldEntity::create()) … … 94 107 void Model::changedVisibility() 95 108 { 96 WorldEntity::changedVisibility(); 109 // WorldEntity::changedVisibility(); 110 SUPER(Model, changedVisibility); 97 111 this->mesh_.setVisible(this->isVisible()); 98 112 } -
code/branches/core3/src/orxonox/objects/Model.h
r1592 r1684 44 44 virtual ~Model(); 45 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 // virtual void tick(float dt); 46 47 virtual void changedVisibility(); 47 48 inline void setMesh(const std::string& meshname) -
code/branches/core3/src/orxonox/objects/ParticleProjectile.cc
r1676 r1684 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" 35 //#include "util/FastDelegate.h"36 //using namespace fastdelegate;37 35 38 36 namespace orxonox 39 37 { 40 38 CreateFactory(ParticleProjectile); 41 42 struct FunctionPointerViewer43 {44 void* ptr1_;45 void* ptr2_;46 47 void view()48 {49 std::cout << ptr1_ << "." << ptr2_ << std::endl;50 }51 };52 53 union FunctionPointerViewer154 {55 FunctionPointerViewer viewer_;56 void (Projectile::*function_) ();57 };58 59 union FunctionPointerViewer260 {61 FunctionPointerViewer viewer_;62 void (BillboardProjectile::*function_) ();63 };64 65 union FunctionPointerViewer366 {67 FunctionPointerViewer viewer_;68 void (ParticleProjectile::*function_) ();69 };70 39 71 40 ParticleProjectile::ParticleProjectile(SpaceShip* owner) : BillboardProjectile(owner) … … 86 55 87 56 this->setConfigValues(); 88 /*89 FunctionPointerViewer1 fpw1;90 fpw1.function_ = &Projectile::testfunction;91 FunctionPointerViewer2 fpw2;92 fpw2.function_ = &BillboardProjectile::testfunction;93 FunctionPointerViewer3 fpw3;94 fpw3.function_ = &ParticleProjectile::testfunction;95 57 96 std::cout << sizeof(void (Projectile::*) ()) << std::endl;97 fpw1.viewer_.view();98 fpw2.viewer_.view();99 fpw3.viewer_.view();100 101 {102 std::cout << "1:" << std::endl;103 FastDelegate0<> delegate1(this, &ParticleProjectile::testfunction);104 delegate1();105 FastDelegate0<> delegate2((BillboardProjectile*)this, &BillboardProjectile::testfunction);106 delegate2();107 FastDelegate0<> delegate3(this, &Projectile::testfunction);108 delegate3();109 }110 {111 std::cout << "2:" << std::endl;112 BillboardProjectile temp;113 // FastDelegate0<> delegate1(&temp, &ParticleProjectile::testfunction);114 // delegate1();115 FastDelegate0<> delegate2(&temp, &BillboardProjectile::testfunction);116 delegate2();117 FastDelegate0<> delegate3(&temp, &Projectile::testfunction);118 delegate3();119 }120 std::cout << "done" << std::endl;121 122 std::cout << "0:" << std::endl;123 this->Projectile::testfunction();124 this->BillboardProjectile::testfunction();125 this->ParticleProjectile::testfunction();126 this->testfunction();127 128 std::cout << "1:" << std::endl;129 (this->*fpw1.function_)();130 std::cout << "2:" << std::endl;131 (this->*fpw2.function_)();132 std::cout << "3:" << std::endl;133 (this->*fpw3.function_)();134 std::cout << "done" << std::endl;135 */136 58 std::cout << "c:\n"; 137 59 SUPER(ParticleProjectile, testfunction); … … 141 63 this->testfunction(); 142 64 std::cout << "f:\n"; 143 144 // (*((ClassIdentifier<SuperDummy>*)this->getIdentifier())->superFunctionCaller_testfunction_)(this);145 65 } 146 66 … … 158 78 void ParticleProjectile::changedVisibility() 159 79 { 160 BillboardProjectile::changedVisibility(); 80 // BillboardProjectile::changedVisibility(); 81 SUPER(ParticleProjectile, changedVisibility); 161 82 this->particles_->setEnabled(this->isVisible()); 162 83 } -
code/branches/core3/src/orxonox/objects/ParticleProjectile.h
r1676 r1684 38 38 namespace orxonox 39 39 { 40 class _OrxonoxExport ParticleProjectile : public BillboardProjectile 40 class TESTTESTTEST13 41 { 42 public: 43 TESTTESTTEST13() { this->setMyValue(10); } 44 45 private: 46 void setMyValue(int value) { this->value1_ = value; } 47 48 int value1_; 49 int value2_; 50 Identifier* identifier_; 51 }; 52 53 class TESTTESTTEST23 54 { 55 public: 56 TESTTESTTEST23() { this->setMyValue(10); } 57 58 private: 59 void setMyValue(int value) { this->value1_ = value; } 60 61 int value1_; 62 int value2_; 63 double value3_; 64 char value4_; 65 bool value5_; 66 Identifier* identifier1_; 67 Identifier* identifier2_; 68 }; 69 70 class TESTTESTTEST33 : virtual public TESTTESTTEST13 71 { 72 public: 73 TESTTESTTEST33() { this->setMyOtherValue(10); } 74 75 private: 76 void setMyOtherValue(int value) { this->value3_ = value; } 77 78 int value3_; 79 TESTTESTTEST23* test_; 80 }; 81 82 class _OrxonoxExport ParticleProjectile : public TESTTESTTEST33, public BillboardProjectile, virtual public TESTTESTTEST13 41 83 { 42 84 public: -
code/branches/core3/src/orxonox/objects/Projectile.cc
r1676 r1684 86 86 void Projectile::tick(float dt) 87 87 { 88 WorldEntity::tick(dt); 88 // WorldEntity::tick(dt); 89 SUPER(Projectile, tick, dt); 89 90 90 91 if (!this->isActive()) -
code/branches/core3/src/orxonox/objects/Projectile.h
r1683 r1684 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include "core/Super.h" 34 35 #include "WorldEntity.h" 35 36 #include "tools/Timer.h" 36 #undef SUPER_INTRUSIVE37 #include "core/Super.h"38 37 39 38 namespace orxonox 40 39 { 41 class _OrxonoxExport Projectile : public WorldEntity 40 class TESTTESTTEST12 41 { 42 public: 43 TESTTESTTEST12() { this->setMyValue(10); } 44 45 private: 46 void setMyValue(int value) { this->value1_ = value; } 47 48 int value1_; 49 int value2_; 50 Identifier* identifier_; 51 }; 52 53 class TESTTESTTEST22 54 { 55 public: 56 TESTTESTTEST22() { this->setMyValue(10); } 57 58 private: 59 void setMyValue(int value) { this->value1_ = value; } 60 61 int value1_; 62 int value2_; 63 double value3_; 64 char value4_; 65 bool value5_; 66 Identifier* identifier1_; 67 Identifier* identifier2_; 68 }; 69 70 class TESTTESTTEST32 : virtual public TESTTESTTEST12 71 { 72 public: 73 TESTTESTTEST32() { this->setMyOtherValue(10); } 74 75 private: 76 void setMyOtherValue(int value) { this->value3_ = value; } 77 78 int value3_; 79 TESTTESTTEST22* test_; 80 }; 81 82 class _OrxonoxExport Projectile : public TESTTESTTEST22, public TESTTESTTEST32, virtual public TESTTESTTEST12, public WorldEntity 42 83 { 43 84 public: … … 68 109 }; 69 110 70 // Partially specialized template (templatehack is now specialized too) 71 template <class T> 72 struct SuperFunctionCondition<0, 0, T> 73 { 74 // Checks if class U isA baseclass and sets the functionpointer if the check returned true 75 static void check() 76 { 77 std::cout << "check superfunction \"testfunction\" in " << ClassIdentifier<T>::getIdentifier()->getName() << std::endl; 78 79 T* temp = 0; 80 SuperFunctionCondition<0, 0, T>::apply(temp); 81 82 std::cout << "done" << std::endl; 83 84 // Calls the condition of the next super-function 85 SuperFunctionCondition<0 + 1, 0, T>::check(); 86 } 87 88 static void apply(void* temp) 89 { 90 std::cout << ClassIdentifier<T>::getIdentifier()->getName() << " is not a Projectile" << std::endl; 91 // nop 92 } 93 94 static void apply(Projectile* temp) 95 { 96 std::cout << ClassIdentifier<T>::getIdentifier()->getName() << " is a Projectile" << std::endl; 97 ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); 98 99 // Iterate through all children and assign the caller 100 for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) 101 { 102 if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_testfunction_) 103 { 104 std::cout << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << std::endl; 105 ((ClassIdentifier<T>*)(*it))->superFunctionCaller_testfunction_ = new SuperFunctionClassCaller_testfunction<T>; 106 } 107 } 108 } 109 }; 111 SUPER_FUNCTION(0, Projectile, testfunction, false); 110 112 } 111 113 -
code/branches/core3/src/orxonox/objects/RotatingProjectile.cc
r1610 r1684 88 88 89 89 Projectile::tick(dt); 90 // SUPER(RotatingProjectile, tick, dt); 90 91 } 91 92 92 93 void RotatingProjectile::changedVisibility() 93 94 { 94 BillboardProjectile::changedVisibility(); 95 // BillboardProjectile::changedVisibility(); 96 SUPER(RotatingProjectile, changedVisibility); 95 97 this->rotatingBillboard1_.setVisible(this->isVisible()); 96 98 this->rotatingBillboard2_.setVisible(this->isVisible()); -
code/branches/core3/src/orxonox/objects/Skybox.cc
r1592 r1684 67 67 void Skybox::XMLPort(Element& xmlelement, XMLPort::Mode mode) 68 68 { 69 BaseObject::XMLPort(xmlelement, mode); 69 // BaseObject::XMLPort(xmlelement, mode); 70 SUPER(Skybox, XMLPort, xmlelement, mode); 70 71 71 72 XMLPortParam(Skybox, "src", setSkyboxSrc, getSkyboxSrc, xmlelement, mode); … … 86 87 void Skybox::changedVisibility() 87 88 { 88 BaseObject::changedVisibility(); 89 // BaseObject::changedVisibility(); 90 SUPER(Skybox, changedVisibility); 89 91 GraphicsEngine::getSingleton().getSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_); 90 92 } -
code/branches/core3/src/orxonox/objects/SpaceShip.cc
r1594 r1684 259 259 void SpaceShip::changedVisibility() 260 260 { 261 Model::changedVisibility(); 261 // Model::changedVisibility(); 262 SUPER(SpaceShip, changedVisibility); 262 263 263 264 this->tt1_->setEnabled(this->isVisible()); … … 271 272 void SpaceShip::changedActivity() 272 273 { 273 Model::changedActivity(); 274 // Model::changedActivity(); 275 SUPER(SpaceShip, changedActivity); 274 276 275 277 this->tt1_->setEnabled(this->isVisible()); … … 345 347 void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 346 348 { 347 Model::XMLPort(xmlelement, mode); 349 // Model::XMLPort(xmlelement, mode); 350 SUPER(SpaceShip, XMLPort, xmlelement, mode); 348 351 349 352 XMLPortParam(SpaceShip, "camera", setCamera, getCamera, xmlelement, mode); … … 482 485 483 486 484 WorldEntity::tick(dt); 487 // WorldEntity::tick(dt); 488 SUPER(SpaceShip, tick, dt); 485 489 486 490 this->roll(this->mouseXRotation_ * dt); -
code/branches/core3/src/orxonox/objects/SpaceShipAI.cc
r1594 r1684 78 78 void SpaceShipAI::XMLPort(Element& xmlelement, XMLPort::Mode mode) 79 79 { 80 SpaceShip::XMLPort(xmlelement, mode); 80 // SpaceShip::XMLPort(xmlelement, mode); 81 SUPER(SpaceShipAI, XMLPort, xmlelement, mode); 81 82 82 83 this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&SpaceShipAI::action))); … … 229 230 this->doFire(); 230 231 231 SpaceShip::tick(dt); 232 // SpaceShip::tick(dt); 233 SUPER(SpaceShipAI, tick, dt); 232 234 } 233 235 -
code/branches/core3/src/orxonox/objects/SpaceShipAI.h
r1552 r1684 47 47 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 49 virtual void tick(float dt); 49 50 static void createEnemy(int num); 50 51 static void killEnemies(int num); … … 54 55 55 56 private: 56 virtual void tick(float dt);57 57 virtual ColourValue getProjectileColour() const; 58 58 -
code/branches/core3/src/orxonox/objects/Tickable.h
r1535 r1684 45 45 46 46 #include "core/OrxonoxClass.h" 47 #include "core/Super.h" 47 48 48 49 namespace orxonox … … 61 62 Tickable(); 62 63 }; 64 65 SUPER_FUNCTION(2, Tickable, tick, true); 63 66 64 67 //! The Tickable interface provides a tick(dt) function, that gets called every frame. -
code/branches/core3/src/orxonox/objects/WorldEntity.cc
r1611 r1684 110 110 void WorldEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode) 111 111 { 112 BaseObject::XMLPort(xmlelement, mode); 112 // BaseObject::XMLPort(xmlelement, mode); 113 SUPER(WorldEntity, XMLPort, xmlelement, mode); 113 114 114 115 XMLPortParamExternTemplate(WorldEntity, Ogre::Node, this->node_, "position", setPosition, getPosition, xmlelement, mode, Ogre::Node, const Vector3&);
Note: See TracChangeset
for help on using the changeset viewer.