- Timestamp:
- Jun 14, 2008, 7:20:00 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/bin/levels/sample.oxw
r1557 r1602 44 44 for i = 1, 226, 1 45 45 do ?> 46 <Model position="<?lua print(math.random() * 40000 - 20000)?>, <?lua print(math.random() * 40000 - 20000) ?>, <?lua print(math.random() * 40000 - 20000) ?>" scale="<?lua print(math.random() * 100 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random() * 30 + 15) ?>" />46 <Model position="<?lua print(math.random() * 40000 - 20000)?>, <?lua print(math.random() * 40000 - 20000) ?>, <?lua print(math.random() * 40000 - 20000) ?>" scale="<?lua print(math.random() * 250 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random() * 30 + 15) ?>" /> 47 47 <?lua 48 48 end -
code/trunk/src/orxonox/objects/ParticleSpawner.cc
r1563 r1602 41 41 { 42 42 RegisterObject(ParticleSpawner); 43 this->particle_ = 0; 43 44 } 44 45 … … 46 47 { 47 48 RegisterObject(ParticleSpawner); 49 this->setParticle(templateName, detaillevel, lifetime, delay, direction); 50 } 48 51 52 void ParticleSpawner::setParticle(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float delay, const Vector3& direction) 53 { 49 54 ExecutorMember<ParticleSpawner>* executor = createExecutor(createFunctor(&ParticleSpawner::createParticleSpawner)); 50 55 executor->setDefaultValues(lifetime); … … 61 66 ParticleSpawner::~ParticleSpawner() 62 67 { 63 if (this->isInitialized() )68 if (this->isInitialized() && this->particle_) 64 69 { 65 70 this->particle_->detachFromSceneNode(); … … 70 75 void ParticleSpawner::createParticleSpawner(float lifetime) 71 76 { 72 this->timer_.setTimer(lifetime, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));73 77 this->particle_->setEnabled(true); 78 if (lifetime != 0) 79 this->timer_.setTimer(lifetime, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner))); 74 80 } 75 81 … … 78 84 delete this; 79 85 } 86 87 void ParticleSpawner::setVisible(bool visible) 88 { 89 if (this->particle_) 90 this->particle_->setEnabled(visible); 91 } 80 92 } -
code/trunk/src/orxonox/objects/ParticleSpawner.h
r1563 r1602 41 41 public: 42 42 ParticleSpawner(); 43 ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime , float delay = 0, const Vector3& direction = Vector3::ZERO);43 ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime = 0, float delay = 0, const Vector3& direction = Vector3::ZERO); 44 44 virtual ~ParticleSpawner(); 45 46 void setParticle(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime = 0, float delay = 0, const Vector3& direction = Vector3::ZERO); 45 47 inline ParticleInterface* getParticleInterface() const 46 48 { return this->particle_; } 49 50 void setVisible(bool visible); 47 51 48 52 private: -
code/trunk/src/orxonox/objects/Projectile.cc
r1576 r1602 50 50 51 51 this->setConfigValues(); 52 this->explosionTemplateName_ = "Orxonox/explosion 1";53 this->smokeTemplateName_ = "Orxonox/smoke 3";52 this->explosionTemplateName_ = "Orxonox/explosion3"; 53 this->smokeTemplateName_ = "Orxonox/smoke4"; 54 54 55 55 if (this->owner_) … … 101 101 explosion->setPosition(this->getPosition()); 102 102 explosion->create(); 103 ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, LODParticle::normal, 6.0, 0.0);103 ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, LODParticle::normal, 2.0, 0.0); 104 104 smoke->setPosition(this->getPosition()); 105 smoke->getParticleInterface()->setSpeedFactor(3.0);105 // smoke->getParticleInterface()->setSpeedFactor(3.0); 106 106 smoke->create(); 107 107 delete this; -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1564 r1602 132 132 this->teamNr_ = 0; 133 133 this->health_ = 100; 134 135 COUT(3) << "Info: SpaceShip was loaded" << std::endl;136 134 } 137 135 … … 209 207 node2b->setScale(0.5, 0.5, 0.5); 210 208 tt2_->addToSceneNode(node2b); 209 210 this->leftThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, -10, -0.5)); 211 this->rightThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, 10, -0.5)); 212 213 Ogre::SceneNode* node2c = this->getNode()->createChildSceneNode(this->getName() + "particle2c"); 214 node2c->setInheritScale(false); 215 node2c->setScale(2, 2, 2); 216 node2c->attachObject(this->leftThrusterFlare_.getBillboardSet()); 217 node2c->attachObject(this->rightThrusterFlare_.getBillboardSet()); 211 218 // END CREATING THRUSTER 212 219 … … 226 233 this->greenNode_->setScale(0.3, 0.3, 0.3); 227 234 // END CREATING BLINKING LIGHTS 235 236 this->smoke_.setParticle("Orxonox/smoke5", LODParticle::normal); 237 this->fire_.setParticle("Orxonox/fire3", LODParticle::normal); 238 this->attachObject(this->smoke_); 239 this->attachObject(this->fire_); 228 240 229 241 if (this->isExactlyA(Class(SpaceShip))) … … 266 278 this->crosshairNear_.setVisible(this->isVisible()); 267 279 this->crosshairFar_.setVisible(this->isVisible()); 280 this->rightThrusterFlare_.setVisible(this->isVisible()); 281 this->leftThrusterFlare_.setVisible(this->isVisible()); 282 this->smoke_.setVisible(this->isVisible()); 283 this->fire_.setVisible(this->isVisible()); 268 284 } 269 285 … … 278 294 this->crosshairNear_.setVisible(this->isVisible()); 279 295 this->crosshairFar_.setVisible(this->isVisible()); 296 this->rightThrusterFlare_.setVisible(this->isVisible()); 297 this->leftThrusterFlare_.setVisible(this->isVisible()); 280 298 } 281 299 … … 385 403 this->cam_->tick(dt); 386 404 405 this->smoke_.setVisible(this->isVisible() && this->health_ < 40); 406 this->fire_.setVisible(this->isVisible() && this->health_ < 20); 407 387 408 if (this->redNode_ && this->greenNode_) 388 409 { -
code/trunk/src/orxonox/objects/SpaceShip.h
r1558 r1602 37 37 #include "Model.h" 38 38 #include "tools/BillboardSet.h" 39 #include "ParticleSpawner.h" 39 40 40 41 namespace orxonox … … 141 142 ParticleInterface* tt1_; 142 143 ParticleInterface* tt2_; 144 BillboardSet leftThrusterFlare_; 145 BillboardSet rightThrusterFlare_; 143 146 144 147 BillboardSet redBillboard_; … … 147 150 Ogre::SceneNode* greenNode_; 148 151 float blinkTime_; 152 153 ParticleSpawner smoke_; 154 ParticleSpawner fire_; 149 155 150 156 BillboardSet crosshairNear_; -
code/trunk/src/orxonox/objects/WorldEntity.cc
r1559 r1602 172 172 { 173 173 this->attachedWorldEntities_.push_back(entity); 174 this->attachObject(entity); 174 175 } 175 176 … … 181 182 return 0; 182 183 } 184 185 void WorldEntity::attachObject(const WorldEntity& obj) const 186 { 187 GraphicsEngine::getSingleton().getSceneManager()->getRootSceneNode()->removeChild(obj.getNode()); 188 this->getNode()->addChild(obj.getNode()); 189 } 190 191 void WorldEntity::attachObject(WorldEntity* obj) const 192 { 193 GraphicsEngine::getSingleton().getSceneManager()->getRootSceneNode()->removeChild(obj->getNode()); 194 this->getNode()->addChild(obj->getNode()); 195 } 183 196 } -
code/trunk/src/orxonox/objects/WorldEntity.h
r1535 r1602 58 58 const WorldEntity* getAttachedWorldEntity(unsigned int index) const; 59 59 60 inline Ogre::SceneNode* getNode() 60 inline Ogre::SceneNode* getNode() const 61 61 { return this->node_; } 62 62 … … 75 75 { return this->node_->getPosition(); } 76 76 77 inline void translate(const Vector3 &d, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)77 inline void translate(const Vector3& d, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 78 78 { this->node_->translate(d, relativeTo); } 79 79 inline void translate(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 80 80 { this->node_->translate(x, y, z, relativeTo); } 81 inline void translate(const Matrix3 &axes, const Vector3 &move, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)81 inline void translate(const Matrix3& axes, const Vector3& move, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 82 82 { this->node_->translate(axes, move, relativeTo); } 83 inline void translate(const Matrix3 &axes, Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT)83 inline void translate(const Matrix3& axes, Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_PARENT) 84 84 { this->node_->translate(axes, x, y, z, relativeTo); } 85 85 86 inline void yaw(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)86 inline void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 87 87 { this->node_->yaw(angle, relativeTo); } 88 inline void pitch(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)88 inline void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 89 89 { this->node_->pitch(angle, relativeTo); } 90 inline void roll(const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)90 inline void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 91 91 { this->node_->roll(angle, relativeTo); } 92 92 void setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll); 93 93 94 inline void setYaw(const Degree &angle)94 inline void setYaw(const Degree& angle) 95 95 { this->node_->yaw(angle, Ogre::Node::TS_LOCAL); } 96 inline void setPitch(const Degree &angle)96 inline void setPitch(const Degree& angle) 97 97 { this->node_->pitch(angle, Ogre::Node::TS_LOCAL); } 98 inline void setRoll(const Degree &angle)98 inline void setRoll(const Degree& angle) 99 99 { this->node_->roll(angle, Ogre::Node::TS_LOCAL); } 100 100 … … 103 103 inline void setOrientation(const Ogre::Quaternion& quat) 104 104 { this->node_->setOrientation(quat); } 105 inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL)105 inline void rotate(const Vector3& axis, const Radian& angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 106 106 { this->node_->rotate(axis, angle, relativeTo); } 107 107 inline void setDirectionLoader(Real x, Real y, Real z) 108 108 { this->setDirection(x, y, z); } 109 inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)109 inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 110 110 { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); } 111 inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)111 inline void setDirection(const Vector3& vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 112 112 { this->node_->setDirection(vec, relativeTo, localDirectionVector); } 113 inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)113 inline void lookAt(const Vector3& targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 114 114 { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); } 115 115 116 inline void setScale(const Vector3 &scale)116 inline void setScale(const Vector3& scale) 117 117 { this->node_->setScale(scale); } 118 118 inline void setScale(Real x, Real y, Real z) … … 124 124 inline const Vector3& getScale(void) const 125 125 { return this->node_->getScale(); } 126 inline void scale(const Vector3 &scale)126 inline void scale(const Vector3& scale) 127 127 { this->node_->scale(scale); } 128 128 inline void scale(Real x, Real y, Real z) … … 131 131 { this->node_->scale(scale, scale, scale); } 132 132 133 inline void attachObject(Ogre::MovableObject *obj) 133 void attachObject(const WorldEntity& obj) const; 134 void attachObject(WorldEntity* obj) const; 135 inline void attachObject(Ogre::MovableObject* obj) const 134 136 { this->node_->attachObject(obj); } 135 inline void attachObject(Mesh &mesh)137 inline void attachObject(Mesh& mesh) const 136 138 { this->node_->attachObject(mesh.getEntity()); } 137 inline void detachObject(Ogre::MovableObject *obj)139 inline void detachObject(Ogre::MovableObject* obj) const 138 140 { this->node_->detachObject(obj); } 139 inline void detachAllObjects() 141 inline void detachAllObjects() const 140 142 { this->node_->detachAllObjects(); } 141 143 … … 179 181 inline void setStatic(bool bStatic) 180 182 { this->bStatic_ = bStatic; } 181 inline bool isStatic() 183 inline bool isStatic() const 182 184 { return this->bStatic_; } 183 185 -
code/trunk/src/orxonox/tools/BillboardSet.cc
r1505 r1602 46 46 } 47 47 48 void BillboardSet::setBillboardSet(const std::string& file, const ColourValue& colour, int count, const Vector3& position) 48 void BillboardSet::setBillboardSet(const std::string& file, int count) 49 { 50 std::ostringstream name; 51 name << (BillboardSet::billboardSetCounter_s++); 52 this->billboardSet_ = GraphicsEngine::getSingleton().getSceneManager()->createBillboardSet("Billboard" + name.str(), count); 53 this->billboardSet_->createBillboard(Vector3::ZERO); 54 this->billboardSet_->setMaterialName(file); 55 } 56 57 void BillboardSet::setBillboardSet(const std::string& file, const ColourValue& colour, int count) 58 { 59 std::ostringstream name; 60 name << (BillboardSet::billboardSetCounter_s++); 61 this->billboardSet_ = GraphicsEngine::getSingleton().getSceneManager()->createBillboardSet("Billboard" + name.str(), count); 62 this->billboardSet_->createBillboard(Vector3::ZERO, colour); 63 this->billboardSet_->setMaterialName(file); 64 } 65 66 void BillboardSet::setBillboardSet(const std::string& file, const Vector3& position, int count) 67 { 68 std::ostringstream name; 69 name << (BillboardSet::billboardSetCounter_s++); 70 this->billboardSet_ = GraphicsEngine::getSingleton().getSceneManager()->createBillboardSet("Billboard" + name.str(), count); 71 this->billboardSet_->createBillboard(position); 72 this->billboardSet_->setMaterialName(file); 73 } 74 75 void BillboardSet::setBillboardSet(const std::string& file, const ColourValue& colour, const Vector3& position, int count) 49 76 { 50 77 std::ostringstream name; -
code/trunk/src/orxonox/tools/BillboardSet.h
r1558 r1602 44 44 BillboardSet(); 45 45 ~BillboardSet(); 46 void setBillboardSet(const std::string& file, const ColourValue& colour = ColourValue(1.0, 1.0, 1.0), int count = 1, const Vector3& position = Vector3::ZERO); 46 void setBillboardSet(const std::string& file, int count = 1); 47 void setBillboardSet(const std::string& file, const ColourValue& colour, int count = 1); 48 void setBillboardSet(const std::string& file, const Vector3& position, int count = 1); 49 void setBillboardSet(const std::string& file, const ColourValue& colour, const Vector3& position, int count = 1); 47 50 48 51 inline Ogre::BillboardSet* getBillboardSet()
Note: See TracChangeset
for help on using the changeset viewer.