[Orxonox-commit 1015] r5736 - in code/branches/libraries2/src/orxonox: . graphics worldentities
landauf at orxonox.net
landauf at orxonox.net
Tue Sep 1 01:02:10 CEST 2009
Author: landauf
Date: 2009-09-01 01:02:10 +0200 (Tue, 01 Sep 2009)
New Revision: 5736
Added:
code/branches/libraries2/src/orxonox/graphics/
code/branches/libraries2/src/orxonox/graphics/Backlight.cc
code/branches/libraries2/src/orxonox/graphics/Backlight.h
code/branches/libraries2/src/orxonox/graphics/Billboard.cc
code/branches/libraries2/src/orxonox/graphics/Billboard.h
code/branches/libraries2/src/orxonox/graphics/BlinkingBillboard.cc
code/branches/libraries2/src/orxonox/graphics/BlinkingBillboard.h
code/branches/libraries2/src/orxonox/graphics/CMakeLists.txt
code/branches/libraries2/src/orxonox/graphics/Camera.cc
code/branches/libraries2/src/orxonox/graphics/Camera.h
code/branches/libraries2/src/orxonox/graphics/FadingBillboard.cc
code/branches/libraries2/src/orxonox/graphics/FadingBillboard.h
code/branches/libraries2/src/orxonox/graphics/GlobalShader.cc
code/branches/libraries2/src/orxonox/graphics/GlobalShader.h
code/branches/libraries2/src/orxonox/graphics/Light.cc
code/branches/libraries2/src/orxonox/graphics/Light.h
code/branches/libraries2/src/orxonox/graphics/Model.cc
code/branches/libraries2/src/orxonox/graphics/Model.h
code/branches/libraries2/src/orxonox/graphics/ParticleEmitter.cc
code/branches/libraries2/src/orxonox/graphics/ParticleEmitter.h
code/branches/libraries2/src/orxonox/graphics/ParticleSpawner.cc
code/branches/libraries2/src/orxonox/graphics/ParticleSpawner.h
Removed:
code/branches/libraries2/src/orxonox/GlobalShader.cc
code/branches/libraries2/src/orxonox/GlobalShader.h
code/branches/libraries2/src/orxonox/worldentities/Backlight.cc
code/branches/libraries2/src/orxonox/worldentities/Backlight.h
code/branches/libraries2/src/orxonox/worldentities/Billboard.cc
code/branches/libraries2/src/orxonox/worldentities/Billboard.h
code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.cc
code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.h
code/branches/libraries2/src/orxonox/worldentities/Camera.cc
code/branches/libraries2/src/orxonox/worldentities/Camera.h
code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.cc
code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.h
code/branches/libraries2/src/orxonox/worldentities/Light.cc
code/branches/libraries2/src/orxonox/worldentities/Light.h
code/branches/libraries2/src/orxonox/worldentities/Model.cc
code/branches/libraries2/src/orxonox/worldentities/Model.h
code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.cc
code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.h
code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.cc
code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.h
Modified:
code/branches/libraries2/src/orxonox/CMakeLists.txt
code/branches/libraries2/src/orxonox/worldentities/CMakeLists.txt
Log:
Created a new subdirectory in orxonox, called "graphics", for all classes which are more or less wrappers around Ogre classes.
Doesn't compile atm
Modified: code/branches/libraries2/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/CMakeLists.txt 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/CMakeLists.txt 2009-08-31 23:02:10 UTC (rev 5736)
@@ -25,7 +25,6 @@
PawnManager.cc
PlayerManager.cc
- GlobalShader.cc
Level.cc
Radar.cc
Scene.cc
@@ -34,6 +33,7 @@
ADD_SUBDIRECTORY(collisionshapes)
ADD_SUBDIRECTORY(controllers)
ADD_SUBDIRECTORY(gametypes)
+ADD_SUBDIRECTORY(graphics)
ADD_SUBDIRECTORY(infos)
ADD_SUBDIRECTORY(interfaces)
ADD_SUBDIRECTORY(items)
Deleted: code/branches/libraries2/src/orxonox/GlobalShader.cc
===================================================================
--- code/branches/libraries2/src/orxonox/GlobalShader.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/GlobalShader.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,78 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "GlobalShader.h"
-
-#include "util/Exception.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "Scene.h"
-
-namespace orxonox
-{
- CreateFactory(GlobalShader);
-
- GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
- {
- RegisterObject(GlobalShader);
-
- if (!this->getScene())
- ThrowException(AbortLoading, "Can't create GlobalShader, no scene given.");
-// if (!this->getScene()->getSceneManager())
-// ThrowException(AbortLoading, "Can't create GlobalShader, no scene manager given.");
-
- if (this->getScene()->getSceneManager())
- this->shader_.setSceneManager(this->getScene()->getSceneManager());
-
- this->registerVariables();
- }
-
- GlobalShader::~GlobalShader()
- {
- }
-
- void GlobalShader::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(GlobalShader, XMLPort, xmlelement, mode);
-
- XMLPortParamExtern(GlobalShader, Shader, &this->shader_, "compositor", setCompositor, getCompositor, xmlelement, mode);
- }
-
- void GlobalShader::registerVariables()
- {
- registerVariable(this->bVisible_, VariableDirection::ToClient, new NetworkCallback<GlobalShader>(this, &GlobalShader::changedVisibility));
- registerVariable(const_cast<std::string&>(this->shader_.getCompositor()), VariableDirection::ToClient, new NetworkCallback<Shader>(&this->shader_, &Shader::changedCompositor));
- }
-
- void GlobalShader::changedVisibility()
- {
- SUPER(GlobalShader, changedVisibility);
-
- this->shader_.setVisible(this->isVisible());
- }
-}
Deleted: code/branches/libraries2/src/orxonox/GlobalShader.h
===================================================================
--- code/branches/libraries2/src/orxonox/GlobalShader.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/GlobalShader.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,61 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _GlobalShader_H__
-#define _GlobalShader_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "core/BaseObject.h"
-#include "network/synchronisable/Synchronisable.h"
-#include "tools/Shader.h"
-
-namespace orxonox
-{
- class _OrxonoxExport GlobalShader : public BaseObject, public Synchronisable
- {
- public:
- GlobalShader(BaseObject* creator);
- virtual ~GlobalShader();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
-
- virtual void changedVisibility();
-
- inline const Shader& getShader() const
- { return this->shader_; }
-
- private:
- void changedCompositor();
-
- Shader shader_;
- };
-}
-
-#endif /* _GlobalShader_H__ */
Copied: code/branches/libraries2/src/orxonox/graphics/Backlight.cc (from rev 5735, code/branches/libraries2/src/orxonox/worldentities/Backlight.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Backlight.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Backlight.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,234 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Backlight.h"
+
+#include <algorithm>
+#include <OgreRibbonTrail.h>
+#include <OgreSceneManager.h>
+#include <OgreSceneNode.h>
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+ CreateFactory(Backlight);
+
+ Backlight::Backlight(BaseObject* creator) : FadingBillboard(creator)
+ {
+ RegisterObject(Backlight);
+
+ this->ribbonTrail_ = 0;
+ this->ribbonTrailNode_ = 0;
+
+ this->width_ = 0;
+ this->length_ = 1.0f;
+ this->lifetime_ = 0.001f;
+ this->maxelements_ = 1;
+
+ this->tickcount_ = 0;
+
+ if (GameMode::showsGraphics())
+ {
+ if (!this->getScene())
+ ThrowException(AbortLoading, "Can't create Backlight, no scene given.");
+ if (!this->getScene()->getSceneManager())
+ ThrowException(AbortLoading, "Can't create Backlight, no scene manager given.");
+ if (!this->getScene()->getRootSceneNode())
+ ThrowException(AbortLoading, "Can't create Backlight, no root scene node given.");
+
+ this->ribbonTrail_ = this->getScene()->getSceneManager()->createRibbonTrail(this->getNode()->getName());
+
+ this->ribbonTrailNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
+ this->ribbonTrailNode_->attachObject(this->ribbonTrail_);
+
+ this->ribbonTrail_->setMaxChainElements(this->maxelements_);
+ this->ribbonTrail_->setTrailLength(this->length_);
+ this->ribbonTrail_->setInitialWidth(0, 0);
+ }
+
+ this->registerVariables();
+ }
+
+ Backlight::~Backlight()
+ {
+ if (this->isInitialized())
+ {
+ if (this->ribbonTrail_)
+ {
+ if (this->ribbonTrailNode_)
+ {
+ this->ribbonTrailNode_->detachObject(this->ribbonTrail_);
+ this->getScene()->getSceneManager()->destroySceneNode(this->ribbonTrailNode_->getName());
+ }
+ this->getScene()->getSceneManager()->destroyRibbonTrail(this->ribbonTrail_);
+ }
+ }
+ }
+
+ void Backlight::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Backlight, XMLPort, xmlelement, mode);
+
+ XMLPortParam(Backlight, "length", setLength, getLength, xmlelement, mode).defaultValues(100.0f);
+ XMLPortParam(Backlight, "width", setWidth, getWidth, xmlelement, mode).defaultValues(1.0f);
+ XMLPortParam(Backlight, "elements", setMaxElements, getMaxElements, xmlelement, mode).defaultValues(10);
+ XMLPortParam(Backlight, "lifetime", setLifetime, getLifetime, xmlelement, mode).defaultValues(1.0f);
+ XMLPortParam(Backlight, "trailmaterial", setTrailMaterial, getTrailMaterial, xmlelement, mode);
+ }
+
+ void Backlight::registerVariables()
+ {
+ registerVariable(this->width_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_width));
+ registerVariable(this->lifetime_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_lifetime));
+ registerVariable(this->length_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_length));
+ registerVariable(this->maxelements_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_maxelements));
+ registerVariable(this->trailmaterial_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_trailmaterial));
+ }
+
+ void Backlight::changedColour()
+ {
+ FadingBillboard::changedColour();
+
+ if (this->ribbonTrail_ && this->tickcount_ >= 2)
+ this->ribbonTrail_->setInitialColour(0, this->getFadedColour());
+ }
+
+ void Backlight::update_width()
+ {
+ if (this->ribbonTrail_ && this->tickcount_ >= 2)
+ this->ribbonTrail_->setInitialWidth(0, this->width_ * this->getWorldScale());
+ this->update_lifetime();
+ }
+
+ void Backlight::update_lifetime()
+ {
+ if (this->ribbonTrail_ && this->tickcount_ >= 2)
+ {
+ this->ribbonTrail_->setWidthChange(0, this->width_ * this->getWorldScale() / this->lifetime_ * this->getTimeFactor());
+ this->ribbonTrail_->setColourChange(0, 0, 0, 0, 1.0f / this->lifetime_ * this->getTimeFactor());
+ }
+ }
+
+ void Backlight::update_length()
+ {
+ if (this->ribbonTrail_ && this->tickcount_ >= 2)
+ this->ribbonTrail_->setTrailLength(this->length_ * this->getWorldScale());
+ }
+
+ void Backlight::update_maxelements()
+ {
+ if (this->ribbonTrail_ && this->tickcount_ >= 2)
+ this->ribbonTrail_->setMaxChainElements(this->maxelements_);
+ }
+
+ void Backlight::update_trailmaterial()
+ {
+ if (this->ribbonTrail_ && this->tickcount_ >= 2)
+ this->ribbonTrail_->setMaterialName(this->trailmaterial_);
+ }
+
+ void Backlight::changedVisibility()
+ {
+ SUPER(Backlight, changedVisibility);
+
+ if (this->ribbonTrail_)
+ this->ribbonTrail_->setVisible(this->isVisible());
+ }
+
+ void Backlight::startturnonoff()
+ {
+ FadingBillboard::startturnonoff();
+
+ if (this->ribbonTrail_ && this->isActive() && this->isVisible())
+ this->ribbonTrail_->setVisible(true);
+ }
+
+ void Backlight::stopturnonoff()
+ {
+ this->postprocessingtime_ = std::max(0.0f, this->lifetime_ - this->turnofftime_);
+
+ FadingBillboard::stopturnonoff();
+
+ if (this->ribbonTrail_)
+ this->ribbonTrail_->setInitialColour(0, this->getFadedColour());
+ }
+
+ void Backlight::poststopturnonoff()
+ {
+ FadingBillboard::poststopturnonoff();
+
+ if (this->ribbonTrail_)
+ this->ribbonTrail_->setVisible(false);
+ }
+
+ void Backlight::changedScale()
+ {
+ SUPER(Backlight, changedScale);
+
+ this->update_width();
+ this->update_length();
+ }
+
+ void Backlight::tick(float dt)
+ {
+ if (this->tickcount_ < 2)
+ {
+ ++this->tickcount_;
+ if (this->tickcount_ == 2)
+ {
+ this->changedColour();
+ this->update_width();
+ this->update_lifetime();
+ this->update_length();
+ this->update_maxelements();
+ this->update_trailmaterial();
+ if (this->ribbonTrail_)
+ this->ribbonTrail_->addNode(this->node_);
+ }
+ }
+
+ SUPER(Backlight, tick, dt);
+
+ if (this->ribbonTrail_ && this->changedirection_ != 0)
+ {
+ // we use alpha_blend, only adjust alpha
+ const ColourValue& colour = this->getColour();
+ this->ribbonTrail_->setInitialColour(0, colour.r, colour.g, colour.b, this->getFadedColour().a);
+ }
+ }
+
+ void Backlight::changedTimeFactor(float factor_new, float factor_old)
+ {
+ this->update_lifetime();
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/Backlight.h (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/Backlight.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Backlight.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Backlight.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,104 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Backlight_H__
+#define _Backlight_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "tools/interfaces/TimeFactorListener.h"
+#include "FadingBillboard.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Backlight : public FadingBillboard, public TimeFactorListener
+ {
+ public:
+ Backlight(BaseObject* creator);
+ virtual ~Backlight();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void registerVariables();
+
+ virtual void tick(float dt);
+ virtual void changedVisibility();
+
+ inline void setWidth(float width)
+ { this->width_ = width; this->update_width(); }
+ inline float getWidth() const
+ { return this->width_; }
+
+ inline void setLifetime(float lifetime)
+ { this->lifetime_ = lifetime; this->update_lifetime(); }
+ inline float getLifetime() const
+ { return this->lifetime_; }
+
+ inline void setLength(float length)
+ { this->length_ = length; this->update_length(); }
+ inline float getLength() const
+ { return this->length_; }
+
+ inline void setMaxElements(size_t maxelements)
+ { this->maxelements_ = maxelements; this->update_maxelements(); }
+ inline size_t getMaxElements() const
+ { return this->maxelements_; }
+
+ inline void setTrailMaterial(const std::string& material)
+ { this->trailmaterial_ = material; this->update_trailmaterial(); }
+ inline const std::string& getTrailMaterial() const
+ { return this->trailmaterial_; }
+
+ virtual void changedScale();
+
+ protected:
+ virtual void changedTimeFactor(float factor_new, float factor_old);
+
+ private:
+ virtual void startturnonoff();
+ virtual void stopturnonoff();
+ virtual void poststopturnonoff();
+ virtual void changedColour();
+ void update_width();
+ void update_lifetime();
+ void update_length();
+ void update_maxelements();
+ void update_trailmaterial();
+
+ Ogre::RibbonTrail* ribbonTrail_;
+ Ogre::SceneNode* ribbonTrailNode_;
+ float width_;
+ float length_;
+ float lifetime_;
+ size_t maxelements_;
+ std::string trailmaterial_;
+ char tickcount_;
+ };
+}
+
+#endif /* _Backlight_H__ */
Copied: code/branches/libraries2/src/orxonox/graphics/Billboard.cc (from rev 5735, code/branches/libraries2/src/orxonox/worldentities/Billboard.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Billboard.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Billboard.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,128 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Billboard.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+ CreateFactory(Billboard);
+
+ Billboard::Billboard(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(Billboard);
+
+ this->material_ = "";
+ this->colour_ = ColourValue::White;
+// this->rotation_ = 0;
+
+ this->registerVariables();
+ }
+
+ Billboard::~Billboard()
+ {
+ if (this->isInitialized())
+ {
+ if (this->isInitialized() && this->billboard_.getBillboardSet())
+ this->detachOgreObject(this->billboard_.getBillboardSet());
+ }
+ }
+
+ void Billboard::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Billboard, XMLPort, xmlelement, mode);
+
+ XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
+ XMLPortParam(Billboard, "colour", setColour, getColour, xmlelement, mode).defaultValues(ColourValue::White);
+// XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
+ }
+
+ void Billboard::registerVariables()
+ {
+ registerVariable(this->material_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
+ registerVariable(this->colour_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
+// registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
+ }
+
+ void Billboard::changedMaterial()
+ {
+ if (this->material_ == "")
+ return;
+
+ if (!this->billboard_.getBillboardSet())
+ {
+ if (this->getScene() && GameMode::showsGraphics())
+ {
+ this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
+ if (this->billboard_.getBillboardSet())
+ this->attachOgreObject(this->billboard_.getBillboardSet());
+ this->billboard_.setVisible(this->isVisible());
+// this->changedRotation();
+ }
+ }
+ else
+ this->billboard_.setMaterial(this->material_);
+ }
+
+ void Billboard::changedColour()
+ {
+ if (!this->billboard_.getBillboardSet())
+ {
+/*
+ if (this->getScene() && GameMode::showsGraphics() && (this->material_ != ""))
+ {
+ this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
+ if (this->billboard_.getBillboardSet())
+ this->attachOgreObject(this->billboard_.getBillboardSet());
+ this->billboard_.setVisible(this->isVisible());
+ }
+*/
+ }
+ else
+ this->billboard_.setColour(this->colour_);
+ }
+
+/*
+ void Billboard::changedRotation()
+ {
+ if (this->billboard_.getBillboardSet())
+ this->billboard_.getBillboardSet()->setRotation(this->rotation_);
+ }
+*/
+
+ void Billboard::changedVisibility()
+ {
+ SUPER(Billboard, changedVisibility);
+
+ this->billboard_.setVisible(this->isVisible());
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/Billboard.h (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/Billboard.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Billboard.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Billboard.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,90 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Billboard_H__
+#define _Billboard_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Math.h"
+#include "tools/BillboardSet.h"
+#include "interfaces/TeamColourable.h"
+#include "StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Billboard : public StaticEntity, public TeamColourable
+ {
+ public:
+ Billboard(BaseObject* creator);
+ virtual ~Billboard();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void registerVariables();
+
+ virtual void changedVisibility();
+
+ inline const BillboardSet& getBillboardSet() const
+ { return this->billboard_; }
+
+ inline void setMaterial(const std::string& material)
+ { this->material_ = material; this->changedMaterial(); }
+ inline const std::string& getMaterial() const
+ { return this->material_; }
+
+ inline void setColour(const ColourValue& colour)
+ { this->colour_ = colour; this->changedColour(); }
+ inline const ColourValue& getColour() const
+ { return this->colour_; }
+/*
+ inline void setRotation(const Radian& rotation)
+ { this->rotation_ = rotation; this->changedRotation(); }
+ inline const Radian& getRotation() const
+ { return this->rotation_; }
+*/
+ virtual void setTeamColour(const ColourValue& colour)
+ { this->setColour(colour); }
+
+ protected:
+ inline BillboardSet& getBillboardSet()
+ { return this->billboard_; }
+
+ virtual void changedColour();
+
+ private:
+ void changedMaterial();
+// void changedRotation();
+
+ BillboardSet billboard_;
+ std::string material_;
+ ColourValue colour_;
+// Radian rotation_;
+ };
+}
+
+#endif /* _Billboard_H__ */
Copied: code/branches/libraries2/src/orxonox/graphics/BlinkingBillboard.cc (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/BlinkingBillboard.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/BlinkingBillboard.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,86 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "BlinkingBillboard.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(BlinkingBillboard);
+
+ BlinkingBillboard::BlinkingBillboard(BaseObject* creator) : Billboard(creator)
+ {
+ RegisterObject(BlinkingBillboard);
+
+ this->amplitude_ = 1.0f;
+ this->frequency_ = 1.0f;
+ this->phase_ = 0;
+ this->bQuadratic_ = false;
+ this->time_ = 0;
+
+ this->registerVariables();
+ }
+
+ BlinkingBillboard::~BlinkingBillboard()
+ {
+ }
+
+ void BlinkingBillboard::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(BlinkingBillboard, XMLPort, xmlelement, mode);
+
+ XMLPortParam(BlinkingBillboard, "amplitude", setAmplitude, getAmplitude, xmlelement, mode).defaultValues(1.0f);
+ XMLPortParam(BlinkingBillboard, "frequency", setFrequency, getFrequency, xmlelement, mode).defaultValues(1.0f);
+ XMLPortParam(BlinkingBillboard, "phase", setPhase, getPhase, xmlelement, mode).defaultValues(Degree(0));
+ XMLPortParam(BlinkingBillboard, "quadratic", setQuadratic, isQuadratic, xmlelement, mode).defaultValues(false);
+ }
+
+ void BlinkingBillboard::registerVariables()
+ {
+// registerVariable(this->amplitude_, VariableDirection::ToClient);
+// registerVariable(this->frequency_, VariableDirection::ToClient);
+// registerVariable(this->phase_, VariableDirection::ToClient);
+ }
+
+ void BlinkingBillboard::tick(float dt)
+ {
+ SUPER(BlinkingBillboard, tick, dt);
+
+ if (GameMode::isMaster() && this->isActive())
+ {
+ this->time_ += dt;
+ if (this->bQuadratic_)
+ this->setScale(this->amplitude_ * static_cast<float>(square(sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_))));
+ else
+ this->setScale(this->amplitude_ * static_cast<float>(sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_)));
+ }
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/BlinkingBillboard.h (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/BlinkingBillboard.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/BlinkingBillboard.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,80 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _BlinkingBillboard_H__
+#define _BlinkingBillboard_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Math.h"
+#include "tools/interfaces/Tickable.h"
+#include "Billboard.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport BlinkingBillboard : public Billboard, public Tickable
+ {
+ public:
+ BlinkingBillboard(BaseObject* creator);
+ virtual ~BlinkingBillboard();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void registerVariables();
+
+ virtual void tick(float dt);
+
+ inline void setAmplitude(float amplitude)
+ { this->amplitude_ = amplitude; }
+ inline float getAmplitude() const
+ { return this->amplitude_; }
+
+ inline void setFrequency(float frequency)
+ { this->frequency_ = frequency; }
+ inline float getFrequency() const
+ { return this->frequency_; }
+
+ inline void setPhase(const Degree& phase)
+ { this->phase_ = phase; }
+ inline const Degree& getPhase() const
+ { return this->phase_; }
+
+ inline void setQuadratic(bool bQuadratic)
+ { this->bQuadratic_ = bQuadratic; }
+ inline bool isQuadratic() const
+ { return this->bQuadratic_; }
+
+ private:
+ float amplitude_;
+ float frequency_;
+ Degree phase_;
+ bool bQuadratic_;
+ long double time_;
+ };
+}
+
+#endif /* _BlinkingBillboard_H__ */
Added: code/branches/libraries2/src/orxonox/graphics/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/CMakeLists.txt (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/CMakeLists.txt 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,12 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ Backlight.cc
+ Billboard.cc
+ BlinkingBillboard.cc
+ Camera.cc
+ FadingBillboard.cc
+ GlobalShader.cc
+ Light.cc
+ Model.cc
+ ParticleEmitter.cc
+ ParticleSpawner.cc
+)
Property changes on: code/branches/libraries2/src/orxonox/graphics/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/branches/libraries2/src/orxonox/graphics/Camera.cc (from rev 5735, code/branches/libraries2/src/orxonox/worldentities/Camera.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Camera.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Camera.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,162 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * Benjamin Knecht
+ *
+ */
+
+#include "Camera.h"
+
+#include <algorithm>
+#include <OgreCamera.h>
+#include <OgreSceneManager.h>
+#include <OgreSceneNode.h>
+
+#include "util/Exception.h"
+#include "util/StringUtils.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "Scene.h"
+#include "CameraManager.h"
+
+namespace orxonox
+{
+ CreateFactory(Camera);
+
+ Camera::Camera(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(Camera);
+
+ if (!this->getScene())
+ ThrowException(AbortLoading, "Can't create Camera, no scene.");
+ if (!this->getScene()->getSceneManager())
+ ThrowException(AbortLoading, "Can't create Camera, no scene-manager given.");
+ if (!this->getScene()->getRootSceneNode())
+ ThrowException(AbortLoading, "Can't create Camera, no root-scene-node given.");
+
+ this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
+ this->cameraNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
+ this->attachNode(this->cameraNode_);
+ this->cameraNode_->attachObject(this->camera_);
+
+ this->bHasFocus_ = false;
+ this->bDrag_ = false;
+ this->nearClipDistance_ = 1;
+
+ this->setObjectMode(0x0);
+
+ this->setConfigValues();
+ this->configvaluecallback_changedNearClipDistance();
+ }
+
+ Camera::~Camera()
+ {
+ if (this->isInitialized())
+ {
+ this->releaseFocus();
+
+ this->cameraNode_->detachAllObjects();
+ this->getScene()->getSceneManager()->destroyCamera(this->camera_);
+
+ if (this->bDrag_)
+ this->detachNode(this->cameraNode_);
+
+ if (this->getScene()->getSceneManager())
+ this->getScene()->getSceneManager()->destroySceneNode(this->cameraNode_->getName());
+ }
+ }
+
+ void Camera::setConfigValues()
+ {
+ SetConfigValue(nearClipDistance_, 1.0f).callback(this, &Camera::configvaluecallback_changedNearClipDistance);
+ }
+
+ void Camera::configvaluecallback_changedNearClipDistance()
+ {
+ this->camera_->setNearClipDistance(this->nearClipDistance_);
+ }
+
+ void Camera::tick(float dt)
+ {
+ SUPER(Camera, tick, dt);
+
+ if (this->bDrag_)
+ {
+ // this stuff here may need some adjustments
+ float coeff = std::min(1.0f, 15.0f * dt);
+
+ Vector3 offset = this->getWorldPosition() - this->cameraNode_->_getDerivedPosition();
+ this->cameraNode_->translate(coeff * offset);
+
+ this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->_getDerivedOrientation(), this->getWorldOrientation(), true));
+ //this->cameraNode_->setOrientation(this->getWorldOrientation());
+ }
+ }
+
+ void Camera::requestFocus()
+ {
+ CameraManager::getInstance().requestFocus(this);
+ }
+
+ void Camera::releaseFocus()
+ {
+ CameraManager::getInstance().releaseFocus(this);
+ }
+
+ /**
+ what to do when camera loses focus (do not request focus in this function!!)
+ this is called by the CameraManager singleton class to notify the camera
+ */
+ void Camera::removeFocus()
+ {
+ this->bHasFocus_ = false;
+ }
+
+ void Camera::setFocus()
+ {
+ this->bHasFocus_ = true;
+ CameraManager::getInstance().useCamera(this->camera_);
+ }
+
+ void Camera::setDrag(bool bDrag)
+ {
+ if (bDrag != this->bDrag_)
+ {
+ this->bDrag_ = bDrag;
+
+ if (!bDrag)
+ {
+ this->attachNode(this->cameraNode_);
+ this->cameraNode_->setPosition(Vector3::ZERO);
+ this->cameraNode_->setOrientation(Quaternion::IDENTITY);
+ }
+ else
+ {
+ this->detachNode(this->cameraNode_);
+ this->cameraNode_->setPosition(this->getWorldPosition());
+ this->cameraNode_->setOrientation(this->getWorldOrientation());
+ }
+ }
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/Camera.h (from rev 5735, code/branches/libraries2/src/orxonox/worldentities/Camera.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Camera.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Camera.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,74 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * Benjamin Knecht
+ *
+ */
+
+#ifndef _Camera_H__
+#define _Camera_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/OgreForwardRefs.h"
+#include "tools/interfaces/Tickable.h"
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Camera : public StaticEntity, public Tickable
+ {
+ friend class CameraManager;
+
+ public:
+ Camera(BaseObject* creator);
+ virtual ~Camera();
+
+ void setConfigValues();
+ virtual void tick(float dt);
+
+ void requestFocus();
+ void releaseFocus();
+
+ inline bool hasFocus()
+ { return this->bHasFocus_; }
+
+ void setDrag(bool bDrag);
+ inline bool getDrag() const
+ { return this->bDrag_; }
+
+ private:
+ void removeFocus();
+ void setFocus();
+ void configvaluecallback_changedNearClipDistance();
+
+ Ogre::Camera* camera_;
+ Ogre::SceneNode* cameraNode_;
+ float nearClipDistance_;
+ bool bHasFocus_;
+ bool bDrag_;
+ };
+}
+
+#endif /* _Camera_H__ */
Copied: code/branches/libraries2/src/orxonox/graphics/FadingBillboard.cc (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/FadingBillboard.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/FadingBillboard.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,163 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "FadingBillboard.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(FadingBillboard);
+
+ FadingBillboard::FadingBillboard(BaseObject* creator) : Billboard(creator)
+ {
+ RegisterObject(FadingBillboard);
+
+ this->turnontime_ = 0.0f;
+ this->turnofftime_ = 0.0f;
+ this->postprocessingtime_ = 0.0f;
+ this->changedirection_ = 0;
+
+ this->fadedColour_ = ColourValue::White;
+
+ this->registerVariables();
+ }
+
+ FadingBillboard::~FadingBillboard()
+ {
+ }
+
+ void FadingBillboard::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(FadingBillboard, XMLPort, xmlelement, mode);
+
+ XMLPortParam(FadingBillboard, "turnontime", setTurnOnTime, getTurnOnTime, xmlelement, mode).defaultValues(0.5f);
+ XMLPortParam(FadingBillboard, "turnofftime", setTurnOffTime, getTurnOffTime, xmlelement, mode).defaultValues(0.5f);
+ }
+
+ void FadingBillboard::registerVariables()
+ {
+ registerVariable(this->turnontime_, VariableDirection::ToClient);
+ registerVariable(this->turnofftime_, VariableDirection::ToClient);
+ }
+
+ void FadingBillboard::changedColour()
+ {
+ Billboard::changedColour();
+
+ if (this->isActive())
+ this->fadedColour_ = this->getColour();
+ else
+ this->fadedColour_ = ColourValue::ZERO;
+
+ this->getBillboardSet().setColour(this->fadedColour_);
+ }
+
+ void FadingBillboard::changedActivity()
+ {
+ SUPER(FadingBillboard, changedActivity);
+
+ this->startturnonoff();
+ }
+
+ void FadingBillboard::changedVisibility()
+ {
+ SUPER(FadingBillboard, changedVisibility);
+
+ if (this->isVisible() && !this->isActive() && this->changedirection_ == 0)
+ {
+ // Billboard shouldn't be visible
+ this->getBillboardSet().setVisible(false);
+ }
+ }
+
+ void FadingBillboard::startturnonoff()
+ {
+ if (this->isActive())
+ {
+ this->changedirection_ = 1;
+ this->turnonofftimer_.setTimer(this->turnontime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));
+
+ if (this->isVisible())
+ this->getBillboardSet().setVisible(true);
+ }
+ else
+ {
+ this->changedirection_ = -1;
+ this->turnonofftimer_.setTimer(this->turnofftime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));
+ }
+ }
+
+ void FadingBillboard::stopturnonoff()
+ {
+ if (this->changedirection_ > 0)
+ {
+ this->fadedColour_ = this->getColour();
+ this->getBillboardSet().setColour(this->fadedColour_);
+ }
+ else if (this->changedirection_ < 0)
+ {
+ this->fadedColour_ = ColourValue::ZERO;
+ this->getBillboardSet().setColour(this->fadedColour_);
+ this->turnonofftimer_.setTimer(this->postprocessingtime_, false, this, createExecutor(createFunctor(&FadingBillboard::poststopturnonoff)));
+ }
+ this->changedirection_ = 0;
+ }
+
+ void FadingBillboard::poststopturnonoff()
+ {
+ this->getBillboardSet().setVisible(false);
+ }
+
+ void FadingBillboard::tick(float dt)
+ {
+ SUPER(FadingBillboard, tick, dt);
+
+ if (this->changedirection_ > 0 && (this->fadedColour_.a < this->getColour().a))
+ {
+ ColourValue colour = this->fadedColour_ + this->getColour() / this->turnontime_ * dt;
+
+ if (colour.a < this->getColour().a)
+ {
+ this->fadedColour_ = colour;
+ this->getBillboardSet().setColour(this->fadedColour_);
+ }
+ }
+ else if (this->changedirection_ < 0 && (this->fadedColour_.a > 0))
+ {
+ ColourValue colour = this->fadedColour_ - this->getColour() / this->turnofftime_ * dt;
+
+ if (colour.a > 0)
+ {
+ this->fadedColour_ = colour;
+ this->getBillboardSet().setColour(this->fadedColour_);
+ }
+ }
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/FadingBillboard.h (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/FadingBillboard.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/FadingBillboard.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,82 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _FadingBillboard_H__
+#define _FadingBillboard_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Math.h"
+#include "tools/Timer.h"
+#include "tools/interfaces/Tickable.h"
+#include "Billboard.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport FadingBillboard : public Billboard, public Tickable
+ {
+ public:
+ FadingBillboard(BaseObject* creator);
+ virtual ~FadingBillboard();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void registerVariables();
+
+ virtual void tick(float dt);
+ virtual void changedActivity();
+ virtual void changedVisibility();
+
+ inline void setTurnOnTime(float turnontime)
+ { this->turnontime_ = turnontime; }
+ inline float getTurnOnTime() const
+ { return this->turnontime_; }
+
+ inline void setTurnOffTime(float turnofftime)
+ { this->turnofftime_ = turnofftime; }
+ inline float getTurnOffTime() const
+ { return this->turnofftime_; }
+
+ inline const ColourValue& getFadedColour() const
+ { return this->fadedColour_; }
+
+ protected:
+ virtual void startturnonoff();
+ virtual void stopturnonoff();
+ virtual void poststopturnonoff();
+ virtual void changedColour();
+
+ float turnontime_;
+ float turnofftime_;
+ float postprocessingtime_;
+ Timer<FadingBillboard> turnonofftimer_;
+ char changedirection_;
+ ColourValue fadedColour_;
+ };
+}
+
+#endif /* _FadingBillboard_H__ */
Copied: code/branches/libraries2/src/orxonox/graphics/GlobalShader.cc (from rev 5735, code/branches/libraries2/src/orxonox/GlobalShader.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/GlobalShader.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/GlobalShader.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,78 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "GlobalShader.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+ CreateFactory(GlobalShader);
+
+ GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ {
+ RegisterObject(GlobalShader);
+
+ if (!this->getScene())
+ ThrowException(AbortLoading, "Can't create GlobalShader, no scene given.");
+// if (!this->getScene()->getSceneManager())
+// ThrowException(AbortLoading, "Can't create GlobalShader, no scene manager given.");
+
+ if (this->getScene()->getSceneManager())
+ this->shader_.setSceneManager(this->getScene()->getSceneManager());
+
+ this->registerVariables();
+ }
+
+ GlobalShader::~GlobalShader()
+ {
+ }
+
+ void GlobalShader::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(GlobalShader, XMLPort, xmlelement, mode);
+
+ XMLPortParamExtern(GlobalShader, Shader, &this->shader_, "compositor", setCompositor, getCompositor, xmlelement, mode);
+ }
+
+ void GlobalShader::registerVariables()
+ {
+ registerVariable(this->bVisible_, VariableDirection::ToClient, new NetworkCallback<GlobalShader>(this, &GlobalShader::changedVisibility));
+ registerVariable(const_cast<std::string&>(this->shader_.getCompositor()), VariableDirection::ToClient, new NetworkCallback<Shader>(&this->shader_, &Shader::changedCompositor));
+ }
+
+ void GlobalShader::changedVisibility()
+ {
+ SUPER(GlobalShader, changedVisibility);
+
+ this->shader_.setVisible(this->isVisible());
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/GlobalShader.h (from rev 5734, code/branches/libraries2/src/orxonox/GlobalShader.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/GlobalShader.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/GlobalShader.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,61 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _GlobalShader_H__
+#define _GlobalShader_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/BaseObject.h"
+#include "network/synchronisable/Synchronisable.h"
+#include "tools/Shader.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport GlobalShader : public BaseObject, public Synchronisable
+ {
+ public:
+ GlobalShader(BaseObject* creator);
+ virtual ~GlobalShader();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void registerVariables();
+
+ virtual void changedVisibility();
+
+ inline const Shader& getShader() const
+ { return this->shader_; }
+
+ private:
+ void changedCompositor();
+
+ Shader shader_;
+ };
+}
+
+#endif /* _GlobalShader_H__ */
Copied: code/branches/libraries2/src/orxonox/graphics/Light.cc (from rev 5735, code/branches/libraries2/src/orxonox/worldentities/Light.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Light.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Light.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,185 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Light.h"
+
+#include <OgreSceneManager.h>
+#include <OgreLight.h>
+#include <boost/static_assert.hpp>
+
+#include "util/StringUtils.h"
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+ CreateFactory(Light);
+
+ // Be sure we don't do bad conversions
+ BOOST_STATIC_ASSERT((int)Ogre::Light::LT_POINT == (int)Light::Point);
+ BOOST_STATIC_ASSERT((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional);
+ BOOST_STATIC_ASSERT((int)Ogre::Light::LT_SPOTLIGHT == (int)Light::Spotlight);
+
+ Light::Light(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(Light);
+
+ this->light_ = 0;
+ this->diffuse_ = ColourValue::White;
+ this->specular_ = ColourValue::White;
+ this->type_ = Light::Point;
+ this->attenuation_ = Vector4(100000, 1, 0, 0);
+ this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f);
+
+ if (GameMode::showsGraphics())
+ {
+ if (!this->getScene())
+ ThrowException(AbortLoading, "Can't create Light, no scene given.");
+ if (!this->getScene()->getSceneManager())
+ ThrowException(AbortLoading, "Can't create Light, no scene manager given.");
+
+ if (this->getScene() && this->getScene()->getSceneManager())
+ {
+ this->light_ = this->getScene()->getSceneManager()->createLight("Light" + getUniqueNumberString());
+ this->light_->setDirection(WorldEntity::FRONT);
+ this->attachOgreObject(this->light_);
+
+ this->updateType();
+ this->updateDiffuseColour();
+ this->updateSpecularColour();
+ this->updateAttenuation();
+ this->updateSpotlightRange();
+ }
+ }
+
+ this->registerVariables();
+ }
+
+ Light::~Light()
+ {
+ if (this->isInitialized())
+ {
+ if (this->light_ && this->getScene() && this->getScene()->getSceneManager())
+ this->getScene()->getSceneManager()->destroyLight(this->light_);
+ }
+ }
+
+ void Light::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Light, XMLPort, xmlelement, mode);
+
+ XMLPortParam(Light, "type", setTypeString, getTypeString, xmlelement, mode).defaultValues("point");
+ XMLPortParam(Light, "diffuse", setDiffuseColour, getDiffuseColour, xmlelement, mode).defaultValues(ColourValue::White);
+ XMLPortParam(Light, "specular", setSpecularColour, getSpecularColour, xmlelement, mode).defaultValues(ColourValue::White);
+ XMLPortParam(Light, "attenuation", setAttenuation, getAttenuation, xmlelement, mode).defaultValues(Vector4(100000, 1, 0, 0));
+ XMLPortParam(Light, "spotlightrange", setSpotlightRange, getSpotlightRange, xmlelement, mode).defaultValues(Vector3(40.0f, 30.0f, 1.0f));
+ }
+
+ void Light::registerVariables()
+ {
+ registerVariable((int&)this->type_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType));
+ registerVariable(this->diffuse_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateDiffuseColour));
+ registerVariable(this->specular_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpecularColour));
+ registerVariable(this->attenuation_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateAttenuation));
+ registerVariable(this->spotlightRange_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpotlightRange));
+ }
+
+ void Light::updateDiffuseColour()
+ {
+ if (this->light_)
+ this->light_->setDiffuseColour(this->diffuse_);
+ }
+
+ void Light::updateSpecularColour()
+ {
+ if (this->light_)
+ this->light_->setSpecularColour(this->specular_);
+ }
+
+ void Light::updateAttenuation()
+ {
+ if (this->light_ && this->type_ != Light::Directional)
+ this->light_->setAttenuation(this->attenuation_.x, this->attenuation_.y, this->attenuation_.z, this->attenuation_.w);
+ }
+
+ void Light::updateSpotlightRange()
+ {
+ if (this->light_ && this->type_ == Light::Spotlight)
+ this->light_->setSpotlightRange(Degree(this->spotlightRange_.x), Degree(this->spotlightRange_.y), this->spotlightRange_.z);
+ }
+
+ void Light::setTypeString(const std::string& type)
+ {
+ if (type == "point")
+ this->setType(Light::Point);
+ else if (type == "directional")
+ this->setType(Light::Directional);
+ else if (type == "spotlight")
+ this->setType(Light::Spotlight);
+ else
+ this->setType(Light::Point);
+ }
+
+ std::string Light::getTypeString() const
+ {
+ switch (this->type_)
+ {
+ case Light::Directional:
+ return "directional";
+ case Light::Spotlight:
+ return "spotlight";
+ case Light::Point:
+ default:
+ return "point";
+ }
+ }
+
+ void Light::updateType()
+ {
+ if (this->light_)
+ {
+ this->light_->setType(static_cast<Ogre::Light::LightTypes>(this->type_));
+
+ if (this->type_ != Light::Directional)
+ this->updateAttenuation();
+ if (this->type_ == Light::Spotlight)
+ this->updateSpotlightRange();
+ }
+ }
+
+ void Light::changedVisibility()
+ {
+ SUPER(Light, changedVisibility);
+
+ if (this->light_)
+ this->light_->setVisible(this->isVisible());
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/Light.h (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/Light.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Light.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Light.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,152 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Light_H__
+#define _Light_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "util/Math.h"
+#include "interfaces/TeamColourable.h"
+#include "StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Light : public StaticEntity, public TeamColourable
+ {
+ public:
+ enum LightTypes // Copy from the Ogre enum
+ {
+ /// Point light sources give off light equally in all directions, so require only position not direction
+ Point,
+ /// Directional lights simulate parallel light beams from a distant source, hence have direction but no position
+ Directional,
+ /// Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff
+ Spotlight
+ };
+
+ public:
+ Light(BaseObject* creator);
+ virtual ~Light();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void registerVariables();
+
+ virtual void changedVisibility();
+
+ inline Ogre::Light* getLight()
+ { return this->light_; }
+
+ inline void setType(Light::LightTypes type)
+ { this->type_ = type; this->updateType(); }
+ inline Light::LightTypes getType() const
+ { return this->type_; }
+
+ inline void setDiffuseColour(const ColourValue& colour)
+ { this->diffuse_ = colour; this->updateDiffuseColour(); }
+ inline const ColourValue& getDiffuseColour() const
+ { return this->diffuse_; }
+
+ inline void setSpecularColour(const ColourValue& colour)
+ { this->specular_ = colour; this->updateSpecularColour(); }
+ inline const ColourValue& getSpecularColour() const
+ { return this->specular_; }
+
+ virtual void setTeamColour(const ColourValue& colour)
+ { this->setDiffuseColour(colour); this->setSpecularColour(colour); }
+
+ /**
+ @brief Sets the attenuation parameters of the light source i.e. how it diminishes with distance.
+
+ @param attenuation.x range (The absolute upper range of the light in world units)
+ @param attenuation.y constant (The constant factor in the attenuation formula: 1.0 means never attenuate, 0.0 is complete attenuation)
+ @param attenuation.z linear (The linear factor in the attenuation formula: 1 means attenuate evenly over the distance)
+ @param attenuation.w quadratic (The quadratic factor in the attenuation formula: adds a curvature to the attenuation formula)
+
+ Quote from the Ogre API:
+ Lights normally get fainter the further they are away. Also, each light is given a maximum range beyond which it cannot affect any objects.
+ Light attenuation is not applicable to directional lights since they have an infinite range and constant intensity.
+ This follows a standard attenuation approach - see any good 3D text for the details of what they mean since i don't have room here!
+
+ Quote from the Ogre wiki:
+ "Using these numbers, the light has 100% intensity at 0 distance, and
+ trails off to near black at a distance equal to the Range. Keep in mind
+ that most of the light falls in the first 20% of the range."
+
+ Range Constant Linear Quadratic
+ 3250, 1.0, 0.0014, 0.000007
+ 600, 1.0, 0.007, 0.0002
+ 325, 1.0, 0.014, 0.0007
+ 200, 1.0, 0.022, 0.0019
+ 160, 1.0, 0.027, 0.0028
+ 100, 1.0, 0.045, 0.0075
+ 65, 1.0, 0.07, 0.017
+ 50, 1.0, 0.09, 0.032
+ 32, 1.0, 0.14, 0.07
+ 20, 1.0, 0.22, 0.20
+ 13, 1.0, 0.35, 0.44
+ 7, 1.0, 0.7, 1.8
+ */
+ inline void setAttenuation(const Vector4& attenuation)
+ { this->attenuation_ = attenuation; this->updateAttenuation(); }
+ inline const Vector4& getAttenuation() const
+ { return this->attenuation_; }
+
+ /**
+ @brief Sets the range of a spotlight, i.e. the angle of the inner and outer cones and the rate of falloff between them.
+
+ @param spotlightRange.x innerAngle (The angle covered by the bright inner cone)
+ @param spotlightRange.x outerAngle (The angle covered by the outer cone)
+ @param spotlightRange.x falloff (The rate of falloff between the inner and outer cones. 1.0 means a linear falloff, less means slower falloff, higher means faster falloff.)
+ */
+ inline void setSpotlightRange(const Vector3& spotlightRange)
+ { this->spotlightRange_ = spotlightRange; this->updateSpotlightRange(); }
+ inline const Vector3& getSpotlightRange() const
+ { return this->spotlightRange_; }
+
+ private:
+ void setTypeString(const std::string& type);
+ std::string getTypeString() const;
+
+ void updateType();
+ void updateDiffuseColour();
+ void updateSpecularColour();
+ void updateAttenuation();
+ void updateSpotlightRange();
+
+ Ogre::Light* light_;
+ LightTypes type_;
+ ColourValue diffuse_;
+ ColourValue specular_;
+ Vector4 attenuation_;
+ Vector3 spotlightRange_;
+ };
+}
+
+#endif /* _Light_H__ */
Copied: code/branches/libraries2/src/orxonox/graphics/Model.cc (from rev 5735, code/branches/libraries2/src/orxonox/worldentities/Model.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Model.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Model.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,100 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Model.h"
+
+#include <OgreEntity.h>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+ CreateFactory(Model);
+
+ Model::Model(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(Model);
+
+ this->bCastShadows_ = true;
+
+ this->registerVariables();
+ }
+
+ Model::~Model()
+ {
+ if (this->isInitialized() && this->mesh_.getEntity())
+ this->detachOgreObject(this->mesh_.getEntity());
+ }
+
+ void Model::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Model, XMLPort, xmlelement, mode);
+
+ XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
+ XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
+ }
+
+ void Model::registerVariables()
+ {
+ registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMesh));
+ registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedShadows));
+ }
+
+ void Model::changedMesh()
+ {
+ if (GameMode::showsGraphics())
+ {
+ if (this->mesh_.getEntity())
+ this->detachOgreObject(this->mesh_.getEntity());
+
+ this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
+
+ if (this->mesh_.getEntity())
+ {
+ this->attachOgreObject(this->mesh_.getEntity());
+ this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
+ this->mesh_.setVisible(this->isVisible());
+ }
+ }
+ }
+
+ void Model::changedShadows()
+ {
+ this->mesh_.setCastShadows(this->bCastShadows_);
+ }
+
+ void Model::changedVisibility()
+ {
+ SUPER(Model, changedVisibility);
+
+ this->mesh_.setVisible(this->isVisible());
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/Model.h (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/Model.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/Model.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/Model.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,74 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Model_H__
+#define _Model_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "tools/Mesh.h"
+#include "StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Model : public StaticEntity
+ {
+ public:
+ Model(BaseObject* creator);
+ virtual ~Model();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void registerVariables();
+
+ virtual void changedVisibility();
+
+ inline const Mesh& getMesh() const
+ { return this->mesh_; }
+
+ inline void setMeshSource(const std::string& meshname)
+ { this->meshSrc_ = meshname; this->changedMesh(); }
+ inline const std::string& getMeshSource() const
+ { return this->meshSrc_; }
+
+ inline void setCastShadows(bool bCastShadows)
+ { this->bCastShadows_ = bCastShadows; this->changedShadows(); }
+ inline bool getCastShadows() const
+ { return this->bCastShadows_; }
+
+ private:
+ void changedMesh();
+ void changedShadows();
+
+ std::string meshSrc_;
+ Mesh mesh_;
+ bool bCastShadows_;
+ };
+}
+
+#endif /* _Model_H__ */
Copied: code/branches/libraries2/src/orxonox/graphics/ParticleEmitter.cc (from rev 5735, code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/ParticleEmitter.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/ParticleEmitter.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,129 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+* @file
+* @brief class to control praticle effects
+*/
+
+#include "ParticleEmitter.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "tools/ParticleInterface.h"
+#include "Scene.h"
+
+namespace orxonox
+{
+ CreateFactory(ParticleEmitter);
+
+ ParticleEmitter::ParticleEmitter(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(ParticleEmitter);
+
+ if (GameMode::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager()))
+ ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given.");
+
+ this->particles_ = 0;
+ this->LOD_ = LODParticle::Normal;
+
+ this->registerVariables();
+ }
+
+ ParticleEmitter::~ParticleEmitter()
+ {
+ if (this->isInitialized() && this->particles_)
+ {
+ this->detachOgreObject(this->particles_->getParticleSystem());
+ delete this->particles_;
+ }
+ }
+
+ void ParticleEmitter::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ParticleEmitter, XMLPort, xmlelement, mode);
+
+ XMLPortParam(ParticleEmitter, "lod", setLODxml, getLODxml, xmlelement, mode).defaultValues(LODParticle::Normal);
+ XMLPortParam(ParticleEmitter, "source", setSource, getSource, xmlelement, mode);
+ }
+
+ void ParticleEmitter::registerVariables()
+ {
+ registerVariable(this->source_, VariableDirection::ToClient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
+ registerVariable((int&)(this->LOD_), VariableDirection::ToClient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
+ }
+
+ void ParticleEmitter::changedVisibility()
+ {
+ SUPER(ParticleEmitter, changedVisibility);
+
+ if (this->particles_)
+ this->particles_->setVisible(this->isVisible());
+ }
+
+ void ParticleEmitter::changedActivity()
+ {
+ SUPER(ParticleEmitter, changedActivity);
+
+ if (this->particles_)
+ this->particles_->setEnabled(this->isActive());
+ }
+
+ void ParticleEmitter::sourceChanged()
+ {
+ if (this->particles_)
+ {
+ delete this->particles_;
+ this->particles_ = 0;
+ }
+
+ if (GameMode::showsGraphics() && this->getScene() && this->getScene()->getSceneManager())
+ {
+ try
+ {
+ this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_);
+ this->attachOgreObject(this->particles_->getParticleSystem());
+ this->particles_->setVisible(this->isVisible());
+ this->particles_->setEnabled(this->isActive());
+ }
+ catch (...)
+ {
+ COUT(1) << "Error: Couln't load particle effect \"" << this->source_ << "\"" << std::endl;
+ this->particles_ = 0;
+ }
+ }
+ }
+
+ void ParticleEmitter::LODchanged()
+ {
+ if (this->particles_)
+ this->particles_->setDetailLevel(this->LOD_);
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/ParticleEmitter.h (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/ParticleEmitter.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/ParticleEmitter.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,79 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ParticleEmitter_H__
+#define _ParticleEmitter_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include "StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport ParticleEmitter : public StaticEntity
+ {
+ public:
+ ParticleEmitter(BaseObject* creator);
+ ~ParticleEmitter();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void registerVariables();
+
+ virtual void changedVisibility();
+ virtual void changedActivity();
+
+ inline ParticleInterface* getParticleInterface() const
+ { return this->particles_; }
+
+ inline void setSource(const std::string& source)
+ { this->source_ = source; this->sourceChanged(); }
+ inline const std::string& getSource() const
+ { return this->source_; }
+
+ inline void setLOD(LODParticle::Value level)
+ { this->LOD_ = level; this->LODchanged(); }
+ inline LODParticle::Value getLOD() const
+ { return this->LOD_; }
+
+ protected:
+ inline void setLODxml(unsigned int level)
+ { this->LOD_ = static_cast<LODParticle::Value>(level); this->LODchanged(); }
+ inline unsigned int getLODxml() const
+ { return static_cast<unsigned int>(this->LOD_); }
+
+ void sourceChanged();
+ void LODchanged();
+
+ ParticleInterface* particles_;
+ std::string source_;
+ LODParticle::Value LOD_;
+ };
+}
+
+#endif /* _ParticleEmitter_H__ */
Copied: code/branches/libraries2/src/orxonox/graphics/ParticleSpawner.cc (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.cc)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/ParticleSpawner.cc (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/ParticleSpawner.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,130 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "ParticleSpawner.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/Executor.h"
+#include "core/XMLPort.h"
+#include "tools/ParticleInterface.h"
+
+namespace orxonox
+{
+ CreateFactory(ParticleSpawner);
+
+ ParticleSpawner::ParticleSpawner(BaseObject* creator) : ParticleEmitter(creator)
+ {
+ RegisterObject(ParticleSpawner);
+
+ this->bAutostart_ = true;
+ this->bSuppressStart_ = false;
+ this->bAutoDestroy_ = true;
+ this->bForceDestroy_ = false;
+ this->bLoop_ = false;
+ this->startdelay_ = 0;
+ this->lifetime_ = 0;
+ this->destroydelay_ = 0;
+
+ this->startParticleSpawner();
+ }
+
+ ParticleSpawner::~ParticleSpawner()
+ {
+ }
+
+ void ParticleSpawner::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ParticleSpawner, XMLPort, xmlelement, mode);
+
+ XMLPortParam(ParticleSpawner, "autostart", setAutoStart, getAutoStart, xmlelement, mode).defaultValues(true);
+ XMLPortParam(ParticleSpawner, "autodestroy", setDestroyAfterLife, getDestroyAfterLife, xmlelement, mode).defaultValues(false);
+ XMLPortParam(ParticleSpawner, "loop", setLoop, getLoop, xmlelement, mode).defaultValues(false);
+ XMLPortParam(ParticleSpawner, "lifetime", setLifetime, getLifetime, xmlelement, mode).defaultValues(0.0f);
+ XMLPortParam(ParticleSpawner, "startdelay", setStartdelay, getStartdelay, xmlelement, mode).defaultValues(0.0f);
+ XMLPortParam(ParticleSpawner, "destroydelay", setDestroydelay, getDestroydelay, xmlelement, mode).defaultValues(0.0f);
+ }
+
+ void ParticleSpawner::processEvent(Event& event)
+ {
+ SUPER(ParticleSpawner, processEvent, event);
+
+ ORXONOX_SET_EVENT(ParticleSpawner, "spawn", spawn, event);
+ }
+
+ void ParticleSpawner::configure(float lifetime, float startdelay, float destroydelay, bool autodestroy)
+ {
+ this->bAutoDestroy_ = autodestroy;
+ this->startdelay_ = startdelay;
+ this->lifetime_ = lifetime;
+ this->destroydelay_ = destroydelay;
+ }
+
+ void ParticleSpawner::startParticleSpawner()
+ {
+ if (!this->particles_)
+ return;
+
+ this->setActive(false);
+
+ if (this->bForceDestroy_ || this->bSuppressStart_)
+ return;
+
+ this->timer_.setTimer(this->startdelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::fireParticleSpawner)));
+ }
+
+ void ParticleSpawner::fireParticleSpawner()
+ {
+ this->setActive(true);
+ if (this->lifetime_ != 0)
+ this->timer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&ParticleSpawner::stopParticleSpawner)));
+ }
+
+ void ParticleSpawner::stopParticleSpawner()
+ {
+ this->setActive(false);
+
+ if (this->bAutoDestroy_ || this->bForceDestroy_)
+ {
+ this->setPosition(this->getWorldPosition());
+ this->detachFromParent();
+
+ if (!this->timer_.isActive() || this->timer_.getRemainingTime() > this->destroydelay_)
+ this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
+ }
+ else if (this->bLoop_)
+ {
+ this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::startParticleSpawner)));
+ }
+ }
+
+ void ParticleSpawner::destroyParticleSpawner()
+ {
+ delete this;
+ }
+}
Copied: code/branches/libraries2/src/orxonox/graphics/ParticleSpawner.h (from rev 5734, code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.h)
===================================================================
--- code/branches/libraries2/src/orxonox/graphics/ParticleSpawner.h (rev 0)
+++ code/branches/libraries2/src/orxonox/graphics/ParticleSpawner.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -0,0 +1,104 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ParticleSpawner_H__
+#define _ParticleSpawner_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "tools/Timer.h"
+#include "ParticleEmitter.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport ParticleSpawner : public ParticleEmitter
+ {
+ public:
+ ParticleSpawner(BaseObject* creator);
+ virtual ~ParticleSpawner();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void processEvent(Event& event);
+
+ inline void destroy()
+ { this->bForceDestroy_ = true; this->stopParticleSpawner(); }
+ inline void spawn()
+ { this->bSuppressStart_ = false; this->startParticleSpawner(); }
+
+ void configure(float lifetime = 0, float startdelay = 0, float destroydelay = 0, bool autodestroy = true);
+
+ inline void setAutoStart(bool autostart)
+ { this->bAutostart_ = autostart; this->bSuppressStart_ = !autostart; }
+ inline bool getAutoStart() const
+ { return this->bAutostart_; }
+
+ inline void setDestroyAfterLife(bool destroy)
+ { this->bAutoDestroy_ = destroy; }
+ inline bool getDestroyAfterLife() const
+ { return this->bAutoDestroy_; }
+
+ inline void setLoop(bool loop)
+ { this->bLoop_ = loop; }
+ inline bool getLoop() const
+ { return this->bLoop_; }
+
+ inline void setLifetime(float lifetime)
+ { this->lifetime_ = lifetime; this->startParticleSpawner(); }
+ inline float getLifetime() const
+ { return this->lifetime_; }
+
+ inline void setStartdelay(float startdelay)
+ { this->startdelay_ = startdelay; this->startParticleSpawner(); }
+ inline float getStartdelay() const
+ { return this->startdelay_; }
+
+ inline void setDestroydelay(float destroydelay)
+ { this->destroydelay_ = destroydelay; this->startParticleSpawner(); }
+ inline float getDestroydelay() const
+ { return this->destroydelay_; }
+
+ private:
+ void startParticleSpawner();
+ void fireParticleSpawner();
+ void stopParticleSpawner();
+ void destroyParticleSpawner();
+
+ Timer<ParticleSpawner> timer_;
+
+ bool bSuppressStart_;
+ bool bAutostart_;
+ bool bForceDestroy_;
+ bool bAutoDestroy_;
+ bool bLoop_;
+ float startdelay_;
+ float lifetime_;
+ float destroydelay_;
+ };
+}
+
+#endif /* _ParticleSpawner_H__ */
Deleted: code/branches/libraries2/src/orxonox/worldentities/Backlight.cc
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Backlight.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Backlight.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,234 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "Backlight.h"
-
-#include <algorithm>
-#include <OgreRibbonTrail.h>
-#include <OgreSceneManager.h>
-#include <OgreSceneNode.h>
-
-#include "util/Exception.h"
-#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "core/XMLPort.h"
-#include "Scene.h"
-
-namespace orxonox
-{
- CreateFactory(Backlight);
-
- Backlight::Backlight(BaseObject* creator) : FadingBillboard(creator)
- {
- RegisterObject(Backlight);
-
- this->ribbonTrail_ = 0;
- this->ribbonTrailNode_ = 0;
-
- this->width_ = 0;
- this->length_ = 1.0f;
- this->lifetime_ = 0.001f;
- this->maxelements_ = 1;
-
- this->tickcount_ = 0;
-
- if (GameMode::showsGraphics())
- {
- if (!this->getScene())
- ThrowException(AbortLoading, "Can't create Backlight, no scene given.");
- if (!this->getScene()->getSceneManager())
- ThrowException(AbortLoading, "Can't create Backlight, no scene manager given.");
- if (!this->getScene()->getRootSceneNode())
- ThrowException(AbortLoading, "Can't create Backlight, no root scene node given.");
-
- this->ribbonTrail_ = this->getScene()->getSceneManager()->createRibbonTrail(this->getNode()->getName());
-
- this->ribbonTrailNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
- this->ribbonTrailNode_->attachObject(this->ribbonTrail_);
-
- this->ribbonTrail_->setMaxChainElements(this->maxelements_);
- this->ribbonTrail_->setTrailLength(this->length_);
- this->ribbonTrail_->setInitialWidth(0, 0);
- }
-
- this->registerVariables();
- }
-
- Backlight::~Backlight()
- {
- if (this->isInitialized())
- {
- if (this->ribbonTrail_)
- {
- if (this->ribbonTrailNode_)
- {
- this->ribbonTrailNode_->detachObject(this->ribbonTrail_);
- this->getScene()->getSceneManager()->destroySceneNode(this->ribbonTrailNode_->getName());
- }
- this->getScene()->getSceneManager()->destroyRibbonTrail(this->ribbonTrail_);
- }
- }
- }
-
- void Backlight::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Backlight, XMLPort, xmlelement, mode);
-
- XMLPortParam(Backlight, "length", setLength, getLength, xmlelement, mode).defaultValues(100.0f);
- XMLPortParam(Backlight, "width", setWidth, getWidth, xmlelement, mode).defaultValues(1.0f);
- XMLPortParam(Backlight, "elements", setMaxElements, getMaxElements, xmlelement, mode).defaultValues(10);
- XMLPortParam(Backlight, "lifetime", setLifetime, getLifetime, xmlelement, mode).defaultValues(1.0f);
- XMLPortParam(Backlight, "trailmaterial", setTrailMaterial, getTrailMaterial, xmlelement, mode);
- }
-
- void Backlight::registerVariables()
- {
- registerVariable(this->width_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_width));
- registerVariable(this->lifetime_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_lifetime));
- registerVariable(this->length_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_length));
- registerVariable(this->maxelements_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_maxelements));
- registerVariable(this->trailmaterial_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_trailmaterial));
- }
-
- void Backlight::changedColour()
- {
- FadingBillboard::changedColour();
-
- if (this->ribbonTrail_ && this->tickcount_ >= 2)
- this->ribbonTrail_->setInitialColour(0, this->getFadedColour());
- }
-
- void Backlight::update_width()
- {
- if (this->ribbonTrail_ && this->tickcount_ >= 2)
- this->ribbonTrail_->setInitialWidth(0, this->width_ * this->getWorldScale());
- this->update_lifetime();
- }
-
- void Backlight::update_lifetime()
- {
- if (this->ribbonTrail_ && this->tickcount_ >= 2)
- {
- this->ribbonTrail_->setWidthChange(0, this->width_ * this->getWorldScale() / this->lifetime_ * this->getTimeFactor());
- this->ribbonTrail_->setColourChange(0, 0, 0, 0, 1.0f / this->lifetime_ * this->getTimeFactor());
- }
- }
-
- void Backlight::update_length()
- {
- if (this->ribbonTrail_ && this->tickcount_ >= 2)
- this->ribbonTrail_->setTrailLength(this->length_ * this->getWorldScale());
- }
-
- void Backlight::update_maxelements()
- {
- if (this->ribbonTrail_ && this->tickcount_ >= 2)
- this->ribbonTrail_->setMaxChainElements(this->maxelements_);
- }
-
- void Backlight::update_trailmaterial()
- {
- if (this->ribbonTrail_ && this->tickcount_ >= 2)
- this->ribbonTrail_->setMaterialName(this->trailmaterial_);
- }
-
- void Backlight::changedVisibility()
- {
- SUPER(Backlight, changedVisibility);
-
- if (this->ribbonTrail_)
- this->ribbonTrail_->setVisible(this->isVisible());
- }
-
- void Backlight::startturnonoff()
- {
- FadingBillboard::startturnonoff();
-
- if (this->ribbonTrail_ && this->isActive() && this->isVisible())
- this->ribbonTrail_->setVisible(true);
- }
-
- void Backlight::stopturnonoff()
- {
- this->postprocessingtime_ = std::max(0.0f, this->lifetime_ - this->turnofftime_);
-
- FadingBillboard::stopturnonoff();
-
- if (this->ribbonTrail_)
- this->ribbonTrail_->setInitialColour(0, this->getFadedColour());
- }
-
- void Backlight::poststopturnonoff()
- {
- FadingBillboard::poststopturnonoff();
-
- if (this->ribbonTrail_)
- this->ribbonTrail_->setVisible(false);
- }
-
- void Backlight::changedScale()
- {
- SUPER(Backlight, changedScale);
-
- this->update_width();
- this->update_length();
- }
-
- void Backlight::tick(float dt)
- {
- if (this->tickcount_ < 2)
- {
- ++this->tickcount_;
- if (this->tickcount_ == 2)
- {
- this->changedColour();
- this->update_width();
- this->update_lifetime();
- this->update_length();
- this->update_maxelements();
- this->update_trailmaterial();
- if (this->ribbonTrail_)
- this->ribbonTrail_->addNode(this->node_);
- }
- }
-
- SUPER(Backlight, tick, dt);
-
- if (this->ribbonTrail_ && this->changedirection_ != 0)
- {
- // we use alpha_blend, only adjust alpha
- const ColourValue& colour = this->getColour();
- this->ribbonTrail_->setInitialColour(0, colour.r, colour.g, colour.b, this->getFadedColour().a);
- }
- }
-
- void Backlight::changedTimeFactor(float factor_new, float factor_old)
- {
- this->update_lifetime();
- }
-}
Deleted: code/branches/libraries2/src/orxonox/worldentities/Backlight.h
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Backlight.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Backlight.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,104 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Backlight_H__
-#define _Backlight_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include "tools/interfaces/TimeFactorListener.h"
-#include "FadingBillboard.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Backlight : public FadingBillboard, public TimeFactorListener
- {
- public:
- Backlight(BaseObject* creator);
- virtual ~Backlight();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
-
- virtual void tick(float dt);
- virtual void changedVisibility();
-
- inline void setWidth(float width)
- { this->width_ = width; this->update_width(); }
- inline float getWidth() const
- { return this->width_; }
-
- inline void setLifetime(float lifetime)
- { this->lifetime_ = lifetime; this->update_lifetime(); }
- inline float getLifetime() const
- { return this->lifetime_; }
-
- inline void setLength(float length)
- { this->length_ = length; this->update_length(); }
- inline float getLength() const
- { return this->length_; }
-
- inline void setMaxElements(size_t maxelements)
- { this->maxelements_ = maxelements; this->update_maxelements(); }
- inline size_t getMaxElements() const
- { return this->maxelements_; }
-
- inline void setTrailMaterial(const std::string& material)
- { this->trailmaterial_ = material; this->update_trailmaterial(); }
- inline const std::string& getTrailMaterial() const
- { return this->trailmaterial_; }
-
- virtual void changedScale();
-
- protected:
- virtual void changedTimeFactor(float factor_new, float factor_old);
-
- private:
- virtual void startturnonoff();
- virtual void stopturnonoff();
- virtual void poststopturnonoff();
- virtual void changedColour();
- void update_width();
- void update_lifetime();
- void update_length();
- void update_maxelements();
- void update_trailmaterial();
-
- Ogre::RibbonTrail* ribbonTrail_;
- Ogre::SceneNode* ribbonTrailNode_;
- float width_;
- float length_;
- float lifetime_;
- size_t maxelements_;
- std::string trailmaterial_;
- char tickcount_;
- };
-}
-
-#endif /* _Backlight_H__ */
Deleted: code/branches/libraries2/src/orxonox/worldentities/Billboard.cc
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Billboard.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Billboard.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,128 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "Billboard.h"
-
-#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "core/XMLPort.h"
-#include "Scene.h"
-
-namespace orxonox
-{
- CreateFactory(Billboard);
-
- Billboard::Billboard(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(Billboard);
-
- this->material_ = "";
- this->colour_ = ColourValue::White;
-// this->rotation_ = 0;
-
- this->registerVariables();
- }
-
- Billboard::~Billboard()
- {
- if (this->isInitialized())
- {
- if (this->isInitialized() && this->billboard_.getBillboardSet())
- this->detachOgreObject(this->billboard_.getBillboardSet());
- }
- }
-
- void Billboard::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Billboard, XMLPort, xmlelement, mode);
-
- XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
- XMLPortParam(Billboard, "colour", setColour, getColour, xmlelement, mode).defaultValues(ColourValue::White);
-// XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
- }
-
- void Billboard::registerVariables()
- {
- registerVariable(this->material_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
- registerVariable(this->colour_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
-// registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
- }
-
- void Billboard::changedMaterial()
- {
- if (this->material_ == "")
- return;
-
- if (!this->billboard_.getBillboardSet())
- {
- if (this->getScene() && GameMode::showsGraphics())
- {
- this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
- if (this->billboard_.getBillboardSet())
- this->attachOgreObject(this->billboard_.getBillboardSet());
- this->billboard_.setVisible(this->isVisible());
-// this->changedRotation();
- }
- }
- else
- this->billboard_.setMaterial(this->material_);
- }
-
- void Billboard::changedColour()
- {
- if (!this->billboard_.getBillboardSet())
- {
-/*
- if (this->getScene() && GameMode::showsGraphics() && (this->material_ != ""))
- {
- this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
- if (this->billboard_.getBillboardSet())
- this->attachOgreObject(this->billboard_.getBillboardSet());
- this->billboard_.setVisible(this->isVisible());
- }
-*/
- }
- else
- this->billboard_.setColour(this->colour_);
- }
-
-/*
- void Billboard::changedRotation()
- {
- if (this->billboard_.getBillboardSet())
- this->billboard_.getBillboardSet()->setRotation(this->rotation_);
- }
-*/
-
- void Billboard::changedVisibility()
- {
- SUPER(Billboard, changedVisibility);
-
- this->billboard_.setVisible(this->isVisible());
- }
-}
Deleted: code/branches/libraries2/src/orxonox/worldentities/Billboard.h
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Billboard.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Billboard.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,90 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Billboard_H__
-#define _Billboard_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/Math.h"
-#include "tools/BillboardSet.h"
-#include "interfaces/TeamColourable.h"
-#include "StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Billboard : public StaticEntity, public TeamColourable
- {
- public:
- Billboard(BaseObject* creator);
- virtual ~Billboard();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
-
- virtual void changedVisibility();
-
- inline const BillboardSet& getBillboardSet() const
- { return this->billboard_; }
-
- inline void setMaterial(const std::string& material)
- { this->material_ = material; this->changedMaterial(); }
- inline const std::string& getMaterial() const
- { return this->material_; }
-
- inline void setColour(const ColourValue& colour)
- { this->colour_ = colour; this->changedColour(); }
- inline const ColourValue& getColour() const
- { return this->colour_; }
-/*
- inline void setRotation(const Radian& rotation)
- { this->rotation_ = rotation; this->changedRotation(); }
- inline const Radian& getRotation() const
- { return this->rotation_; }
-*/
- virtual void setTeamColour(const ColourValue& colour)
- { this->setColour(colour); }
-
- protected:
- inline BillboardSet& getBillboardSet()
- { return this->billboard_; }
-
- virtual void changedColour();
-
- private:
- void changedMaterial();
-// void changedRotation();
-
- BillboardSet billboard_;
- std::string material_;
- ColourValue colour_;
-// Radian rotation_;
- };
-}
-
-#endif /* _Billboard_H__ */
Deleted: code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.cc
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,86 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "BlinkingBillboard.h"
-
-#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(BlinkingBillboard);
-
- BlinkingBillboard::BlinkingBillboard(BaseObject* creator) : Billboard(creator)
- {
- RegisterObject(BlinkingBillboard);
-
- this->amplitude_ = 1.0f;
- this->frequency_ = 1.0f;
- this->phase_ = 0;
- this->bQuadratic_ = false;
- this->time_ = 0;
-
- this->registerVariables();
- }
-
- BlinkingBillboard::~BlinkingBillboard()
- {
- }
-
- void BlinkingBillboard::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(BlinkingBillboard, XMLPort, xmlelement, mode);
-
- XMLPortParam(BlinkingBillboard, "amplitude", setAmplitude, getAmplitude, xmlelement, mode).defaultValues(1.0f);
- XMLPortParam(BlinkingBillboard, "frequency", setFrequency, getFrequency, xmlelement, mode).defaultValues(1.0f);
- XMLPortParam(BlinkingBillboard, "phase", setPhase, getPhase, xmlelement, mode).defaultValues(Degree(0));
- XMLPortParam(BlinkingBillboard, "quadratic", setQuadratic, isQuadratic, xmlelement, mode).defaultValues(false);
- }
-
- void BlinkingBillboard::registerVariables()
- {
-// registerVariable(this->amplitude_, VariableDirection::ToClient);
-// registerVariable(this->frequency_, VariableDirection::ToClient);
-// registerVariable(this->phase_, VariableDirection::ToClient);
- }
-
- void BlinkingBillboard::tick(float dt)
- {
- SUPER(BlinkingBillboard, tick, dt);
-
- if (GameMode::isMaster() && this->isActive())
- {
- this->time_ += dt;
- if (this->bQuadratic_)
- this->setScale(this->amplitude_ * static_cast<float>(square(sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_))));
- else
- this->setScale(this->amplitude_ * static_cast<float>(sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_)));
- }
- }
-}
Deleted: code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.h
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/BlinkingBillboard.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,80 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _BlinkingBillboard_H__
-#define _BlinkingBillboard_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/Math.h"
-#include "tools/interfaces/Tickable.h"
-#include "Billboard.h"
-
-namespace orxonox
-{
- class _OrxonoxExport BlinkingBillboard : public Billboard, public Tickable
- {
- public:
- BlinkingBillboard(BaseObject* creator);
- virtual ~BlinkingBillboard();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
-
- virtual void tick(float dt);
-
- inline void setAmplitude(float amplitude)
- { this->amplitude_ = amplitude; }
- inline float getAmplitude() const
- { return this->amplitude_; }
-
- inline void setFrequency(float frequency)
- { this->frequency_ = frequency; }
- inline float getFrequency() const
- { return this->frequency_; }
-
- inline void setPhase(const Degree& phase)
- { this->phase_ = phase; }
- inline const Degree& getPhase() const
- { return this->phase_; }
-
- inline void setQuadratic(bool bQuadratic)
- { this->bQuadratic_ = bQuadratic; }
- inline bool isQuadratic() const
- { return this->bQuadratic_; }
-
- private:
- float amplitude_;
- float frequency_;
- Degree phase_;
- bool bQuadratic_;
- long double time_;
- };
-}
-
-#endif /* _BlinkingBillboard_H__ */
Modified: code/branches/libraries2/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/CMakeLists.txt 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/CMakeLists.txt 2009-08-31 23:02:10 UTC (rev 5736)
@@ -5,18 +5,9 @@
MobileEntity.cc
ControllableEntity.cc
- Backlight.cc
- Billboard.cc
- BlinkingBillboard.cc
BigExplosion.cc
ExplosionChunk.cc
- FadingBillboard.cc
- Light.cc
- Camera.cc
CameraPosition.cc
- Model.cc
- ParticleEmitter.cc
- ParticleSpawner.cc
SpawnPoint.cc
TeamSpawnPoint.cc
)
Deleted: code/branches/libraries2/src/orxonox/worldentities/Camera.cc
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Camera.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Camera.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,162 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * Benjamin Knecht
- *
- */
-
-#include "Camera.h"
-
-#include <algorithm>
-#include <OgreCamera.h>
-#include <OgreSceneManager.h>
-#include <OgreSceneNode.h>
-
-#include "util/Exception.h"
-#include "util/StringUtils.h"
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "Scene.h"
-#include "CameraManager.h"
-
-namespace orxonox
-{
- CreateFactory(Camera);
-
- Camera::Camera(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(Camera);
-
- if (!this->getScene())
- ThrowException(AbortLoading, "Can't create Camera, no scene.");
- if (!this->getScene()->getSceneManager())
- ThrowException(AbortLoading, "Can't create Camera, no scene-manager given.");
- if (!this->getScene()->getRootSceneNode())
- ThrowException(AbortLoading, "Can't create Camera, no root-scene-node given.");
-
- this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
- this->cameraNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
- this->attachNode(this->cameraNode_);
- this->cameraNode_->attachObject(this->camera_);
-
- this->bHasFocus_ = false;
- this->bDrag_ = false;
- this->nearClipDistance_ = 1;
-
- this->setObjectMode(0x0);
-
- this->setConfigValues();
- this->configvaluecallback_changedNearClipDistance();
- }
-
- Camera::~Camera()
- {
- if (this->isInitialized())
- {
- this->releaseFocus();
-
- this->cameraNode_->detachAllObjects();
- this->getScene()->getSceneManager()->destroyCamera(this->camera_);
-
- if (this->bDrag_)
- this->detachNode(this->cameraNode_);
-
- if (this->getScene()->getSceneManager())
- this->getScene()->getSceneManager()->destroySceneNode(this->cameraNode_->getName());
- }
- }
-
- void Camera::setConfigValues()
- {
- SetConfigValue(nearClipDistance_, 1.0f).callback(this, &Camera::configvaluecallback_changedNearClipDistance);
- }
-
- void Camera::configvaluecallback_changedNearClipDistance()
- {
- this->camera_->setNearClipDistance(this->nearClipDistance_);
- }
-
- void Camera::tick(float dt)
- {
- SUPER(Camera, tick, dt);
-
- if (this->bDrag_)
- {
- // this stuff here may need some adjustments
- float coeff = std::min(1.0f, 15.0f * dt);
-
- Vector3 offset = this->getWorldPosition() - this->cameraNode_->_getDerivedPosition();
- this->cameraNode_->translate(coeff * offset);
-
- this->cameraNode_->setOrientation(Quaternion::Slerp(coeff, this->cameraNode_->_getDerivedOrientation(), this->getWorldOrientation(), true));
- //this->cameraNode_->setOrientation(this->getWorldOrientation());
- }
- }
-
- void Camera::requestFocus()
- {
- CameraManager::getInstance().requestFocus(this);
- }
-
- void Camera::releaseFocus()
- {
- CameraManager::getInstance().releaseFocus(this);
- }
-
- /**
- what to do when camera loses focus (do not request focus in this function!!)
- this is called by the CameraManager singleton class to notify the camera
- */
- void Camera::removeFocus()
- {
- this->bHasFocus_ = false;
- }
-
- void Camera::setFocus()
- {
- this->bHasFocus_ = true;
- CameraManager::getInstance().useCamera(this->camera_);
- }
-
- void Camera::setDrag(bool bDrag)
- {
- if (bDrag != this->bDrag_)
- {
- this->bDrag_ = bDrag;
-
- if (!bDrag)
- {
- this->attachNode(this->cameraNode_);
- this->cameraNode_->setPosition(Vector3::ZERO);
- this->cameraNode_->setOrientation(Quaternion::IDENTITY);
- }
- else
- {
- this->detachNode(this->cameraNode_);
- this->cameraNode_->setPosition(this->getWorldPosition());
- this->cameraNode_->setOrientation(this->getWorldOrientation());
- }
- }
- }
-}
Deleted: code/branches/libraries2/src/orxonox/worldentities/Camera.h
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Camera.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Camera.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,74 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * Benjamin Knecht
- *
- */
-
-#ifndef _Camera_H__
-#define _Camera_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/OgreForwardRefs.h"
-#include "tools/interfaces/Tickable.h"
-#include "worldentities/StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Camera : public StaticEntity, public Tickable
- {
- friend class CameraManager;
-
- public:
- Camera(BaseObject* creator);
- virtual ~Camera();
-
- void setConfigValues();
- virtual void tick(float dt);
-
- void requestFocus();
- void releaseFocus();
-
- inline bool hasFocus()
- { return this->bHasFocus_; }
-
- void setDrag(bool bDrag);
- inline bool getDrag() const
- { return this->bDrag_; }
-
- private:
- void removeFocus();
- void setFocus();
- void configvaluecallback_changedNearClipDistance();
-
- Ogre::Camera* camera_;
- Ogre::SceneNode* cameraNode_;
- float nearClipDistance_;
- bool bHasFocus_;
- bool bDrag_;
- };
-}
-
-#endif /* _Camera_H__ */
Deleted: code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.cc
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,163 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "FadingBillboard.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(FadingBillboard);
-
- FadingBillboard::FadingBillboard(BaseObject* creator) : Billboard(creator)
- {
- RegisterObject(FadingBillboard);
-
- this->turnontime_ = 0.0f;
- this->turnofftime_ = 0.0f;
- this->postprocessingtime_ = 0.0f;
- this->changedirection_ = 0;
-
- this->fadedColour_ = ColourValue::White;
-
- this->registerVariables();
- }
-
- FadingBillboard::~FadingBillboard()
- {
- }
-
- void FadingBillboard::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(FadingBillboard, XMLPort, xmlelement, mode);
-
- XMLPortParam(FadingBillboard, "turnontime", setTurnOnTime, getTurnOnTime, xmlelement, mode).defaultValues(0.5f);
- XMLPortParam(FadingBillboard, "turnofftime", setTurnOffTime, getTurnOffTime, xmlelement, mode).defaultValues(0.5f);
- }
-
- void FadingBillboard::registerVariables()
- {
- registerVariable(this->turnontime_, VariableDirection::ToClient);
- registerVariable(this->turnofftime_, VariableDirection::ToClient);
- }
-
- void FadingBillboard::changedColour()
- {
- Billboard::changedColour();
-
- if (this->isActive())
- this->fadedColour_ = this->getColour();
- else
- this->fadedColour_ = ColourValue::ZERO;
-
- this->getBillboardSet().setColour(this->fadedColour_);
- }
-
- void FadingBillboard::changedActivity()
- {
- SUPER(FadingBillboard, changedActivity);
-
- this->startturnonoff();
- }
-
- void FadingBillboard::changedVisibility()
- {
- SUPER(FadingBillboard, changedVisibility);
-
- if (this->isVisible() && !this->isActive() && this->changedirection_ == 0)
- {
- // Billboard shouldn't be visible
- this->getBillboardSet().setVisible(false);
- }
- }
-
- void FadingBillboard::startturnonoff()
- {
- if (this->isActive())
- {
- this->changedirection_ = 1;
- this->turnonofftimer_.setTimer(this->turnontime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));
-
- if (this->isVisible())
- this->getBillboardSet().setVisible(true);
- }
- else
- {
- this->changedirection_ = -1;
- this->turnonofftimer_.setTimer(this->turnofftime_, false, this, createExecutor(createFunctor(&FadingBillboard::stopturnonoff)));
- }
- }
-
- void FadingBillboard::stopturnonoff()
- {
- if (this->changedirection_ > 0)
- {
- this->fadedColour_ = this->getColour();
- this->getBillboardSet().setColour(this->fadedColour_);
- }
- else if (this->changedirection_ < 0)
- {
- this->fadedColour_ = ColourValue::ZERO;
- this->getBillboardSet().setColour(this->fadedColour_);
- this->turnonofftimer_.setTimer(this->postprocessingtime_, false, this, createExecutor(createFunctor(&FadingBillboard::poststopturnonoff)));
- }
- this->changedirection_ = 0;
- }
-
- void FadingBillboard::poststopturnonoff()
- {
- this->getBillboardSet().setVisible(false);
- }
-
- void FadingBillboard::tick(float dt)
- {
- SUPER(FadingBillboard, tick, dt);
-
- if (this->changedirection_ > 0 && (this->fadedColour_.a < this->getColour().a))
- {
- ColourValue colour = this->fadedColour_ + this->getColour() / this->turnontime_ * dt;
-
- if (colour.a < this->getColour().a)
- {
- this->fadedColour_ = colour;
- this->getBillboardSet().setColour(this->fadedColour_);
- }
- }
- else if (this->changedirection_ < 0 && (this->fadedColour_.a > 0))
- {
- ColourValue colour = this->fadedColour_ - this->getColour() / this->turnofftime_ * dt;
-
- if (colour.a > 0)
- {
- this->fadedColour_ = colour;
- this->getBillboardSet().setColour(this->fadedColour_);
- }
- }
- }
-}
Deleted: code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.h
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/FadingBillboard.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,82 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _FadingBillboard_H__
-#define _FadingBillboard_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/Math.h"
-#include "tools/Timer.h"
-#include "tools/interfaces/Tickable.h"
-#include "Billboard.h"
-
-namespace orxonox
-{
- class _OrxonoxExport FadingBillboard : public Billboard, public Tickable
- {
- public:
- FadingBillboard(BaseObject* creator);
- virtual ~FadingBillboard();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
-
- virtual void tick(float dt);
- virtual void changedActivity();
- virtual void changedVisibility();
-
- inline void setTurnOnTime(float turnontime)
- { this->turnontime_ = turnontime; }
- inline float getTurnOnTime() const
- { return this->turnontime_; }
-
- inline void setTurnOffTime(float turnofftime)
- { this->turnofftime_ = turnofftime; }
- inline float getTurnOffTime() const
- { return this->turnofftime_; }
-
- inline const ColourValue& getFadedColour() const
- { return this->fadedColour_; }
-
- protected:
- virtual void startturnonoff();
- virtual void stopturnonoff();
- virtual void poststopturnonoff();
- virtual void changedColour();
-
- float turnontime_;
- float turnofftime_;
- float postprocessingtime_;
- Timer<FadingBillboard> turnonofftimer_;
- char changedirection_;
- ColourValue fadedColour_;
- };
-}
-
-#endif /* _FadingBillboard_H__ */
Deleted: code/branches/libraries2/src/orxonox/worldentities/Light.cc
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Light.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Light.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,185 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "Light.h"
-
-#include <OgreSceneManager.h>
-#include <OgreLight.h>
-#include <boost/static_assert.hpp>
-
-#include "util/StringUtils.h"
-#include "util/Exception.h"
-#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "core/XMLPort.h"
-#include "Scene.h"
-
-namespace orxonox
-{
- CreateFactory(Light);
-
- // Be sure we don't do bad conversions
- BOOST_STATIC_ASSERT((int)Ogre::Light::LT_POINT == (int)Light::Point);
- BOOST_STATIC_ASSERT((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional);
- BOOST_STATIC_ASSERT((int)Ogre::Light::LT_SPOTLIGHT == (int)Light::Spotlight);
-
- Light::Light(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(Light);
-
- this->light_ = 0;
- this->diffuse_ = ColourValue::White;
- this->specular_ = ColourValue::White;
- this->type_ = Light::Point;
- this->attenuation_ = Vector4(100000, 1, 0, 0);
- this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f);
-
- if (GameMode::showsGraphics())
- {
- if (!this->getScene())
- ThrowException(AbortLoading, "Can't create Light, no scene given.");
- if (!this->getScene()->getSceneManager())
- ThrowException(AbortLoading, "Can't create Light, no scene manager given.");
-
- if (this->getScene() && this->getScene()->getSceneManager())
- {
- this->light_ = this->getScene()->getSceneManager()->createLight("Light" + getUniqueNumberString());
- this->light_->setDirection(WorldEntity::FRONT);
- this->attachOgreObject(this->light_);
-
- this->updateType();
- this->updateDiffuseColour();
- this->updateSpecularColour();
- this->updateAttenuation();
- this->updateSpotlightRange();
- }
- }
-
- this->registerVariables();
- }
-
- Light::~Light()
- {
- if (this->isInitialized())
- {
- if (this->light_ && this->getScene() && this->getScene()->getSceneManager())
- this->getScene()->getSceneManager()->destroyLight(this->light_);
- }
- }
-
- void Light::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Light, XMLPort, xmlelement, mode);
-
- XMLPortParam(Light, "type", setTypeString, getTypeString, xmlelement, mode).defaultValues("point");
- XMLPortParam(Light, "diffuse", setDiffuseColour, getDiffuseColour, xmlelement, mode).defaultValues(ColourValue::White);
- XMLPortParam(Light, "specular", setSpecularColour, getSpecularColour, xmlelement, mode).defaultValues(ColourValue::White);
- XMLPortParam(Light, "attenuation", setAttenuation, getAttenuation, xmlelement, mode).defaultValues(Vector4(100000, 1, 0, 0));
- XMLPortParam(Light, "spotlightrange", setSpotlightRange, getSpotlightRange, xmlelement, mode).defaultValues(Vector3(40.0f, 30.0f, 1.0f));
- }
-
- void Light::registerVariables()
- {
- registerVariable((int&)this->type_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType));
- registerVariable(this->diffuse_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateDiffuseColour));
- registerVariable(this->specular_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpecularColour));
- registerVariable(this->attenuation_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateAttenuation));
- registerVariable(this->spotlightRange_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpotlightRange));
- }
-
- void Light::updateDiffuseColour()
- {
- if (this->light_)
- this->light_->setDiffuseColour(this->diffuse_);
- }
-
- void Light::updateSpecularColour()
- {
- if (this->light_)
- this->light_->setSpecularColour(this->specular_);
- }
-
- void Light::updateAttenuation()
- {
- if (this->light_ && this->type_ != Light::Directional)
- this->light_->setAttenuation(this->attenuation_.x, this->attenuation_.y, this->attenuation_.z, this->attenuation_.w);
- }
-
- void Light::updateSpotlightRange()
- {
- if (this->light_ && this->type_ == Light::Spotlight)
- this->light_->setSpotlightRange(Degree(this->spotlightRange_.x), Degree(this->spotlightRange_.y), this->spotlightRange_.z);
- }
-
- void Light::setTypeString(const std::string& type)
- {
- if (type == "point")
- this->setType(Light::Point);
- else if (type == "directional")
- this->setType(Light::Directional);
- else if (type == "spotlight")
- this->setType(Light::Spotlight);
- else
- this->setType(Light::Point);
- }
-
- std::string Light::getTypeString() const
- {
- switch (this->type_)
- {
- case Light::Directional:
- return "directional";
- case Light::Spotlight:
- return "spotlight";
- case Light::Point:
- default:
- return "point";
- }
- }
-
- void Light::updateType()
- {
- if (this->light_)
- {
- this->light_->setType(static_cast<Ogre::Light::LightTypes>(this->type_));
-
- if (this->type_ != Light::Directional)
- this->updateAttenuation();
- if (this->type_ == Light::Spotlight)
- this->updateSpotlightRange();
- }
- }
-
- void Light::changedVisibility()
- {
- SUPER(Light, changedVisibility);
-
- if (this->light_)
- this->light_->setVisible(this->isVisible());
- }
-}
Deleted: code/branches/libraries2/src/orxonox/worldentities/Light.h
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Light.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Light.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,152 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Light_H__
-#define _Light_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include "util/Math.h"
-#include "interfaces/TeamColourable.h"
-#include "StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Light : public StaticEntity, public TeamColourable
- {
- public:
- enum LightTypes // Copy from the Ogre enum
- {
- /// Point light sources give off light equally in all directions, so require only position not direction
- Point,
- /// Directional lights simulate parallel light beams from a distant source, hence have direction but no position
- Directional,
- /// Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff
- Spotlight
- };
-
- public:
- Light(BaseObject* creator);
- virtual ~Light();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
-
- virtual void changedVisibility();
-
- inline Ogre::Light* getLight()
- { return this->light_; }
-
- inline void setType(Light::LightTypes type)
- { this->type_ = type; this->updateType(); }
- inline Light::LightTypes getType() const
- { return this->type_; }
-
- inline void setDiffuseColour(const ColourValue& colour)
- { this->diffuse_ = colour; this->updateDiffuseColour(); }
- inline const ColourValue& getDiffuseColour() const
- { return this->diffuse_; }
-
- inline void setSpecularColour(const ColourValue& colour)
- { this->specular_ = colour; this->updateSpecularColour(); }
- inline const ColourValue& getSpecularColour() const
- { return this->specular_; }
-
- virtual void setTeamColour(const ColourValue& colour)
- { this->setDiffuseColour(colour); this->setSpecularColour(colour); }
-
- /**
- @brief Sets the attenuation parameters of the light source i.e. how it diminishes with distance.
-
- @param attenuation.x range (The absolute upper range of the light in world units)
- @param attenuation.y constant (The constant factor in the attenuation formula: 1.0 means never attenuate, 0.0 is complete attenuation)
- @param attenuation.z linear (The linear factor in the attenuation formula: 1 means attenuate evenly over the distance)
- @param attenuation.w quadratic (The quadratic factor in the attenuation formula: adds a curvature to the attenuation formula)
-
- Quote from the Ogre API:
- Lights normally get fainter the further they are away. Also, each light is given a maximum range beyond which it cannot affect any objects.
- Light attenuation is not applicable to directional lights since they have an infinite range and constant intensity.
- This follows a standard attenuation approach - see any good 3D text for the details of what they mean since i don't have room here!
-
- Quote from the Ogre wiki:
- "Using these numbers, the light has 100% intensity at 0 distance, and
- trails off to near black at a distance equal to the Range. Keep in mind
- that most of the light falls in the first 20% of the range."
-
- Range Constant Linear Quadratic
- 3250, 1.0, 0.0014, 0.000007
- 600, 1.0, 0.007, 0.0002
- 325, 1.0, 0.014, 0.0007
- 200, 1.0, 0.022, 0.0019
- 160, 1.0, 0.027, 0.0028
- 100, 1.0, 0.045, 0.0075
- 65, 1.0, 0.07, 0.017
- 50, 1.0, 0.09, 0.032
- 32, 1.0, 0.14, 0.07
- 20, 1.0, 0.22, 0.20
- 13, 1.0, 0.35, 0.44
- 7, 1.0, 0.7, 1.8
- */
- inline void setAttenuation(const Vector4& attenuation)
- { this->attenuation_ = attenuation; this->updateAttenuation(); }
- inline const Vector4& getAttenuation() const
- { return this->attenuation_; }
-
- /**
- @brief Sets the range of a spotlight, i.e. the angle of the inner and outer cones and the rate of falloff between them.
-
- @param spotlightRange.x innerAngle (The angle covered by the bright inner cone)
- @param spotlightRange.x outerAngle (The angle covered by the outer cone)
- @param spotlightRange.x falloff (The rate of falloff between the inner and outer cones. 1.0 means a linear falloff, less means slower falloff, higher means faster falloff.)
- */
- inline void setSpotlightRange(const Vector3& spotlightRange)
- { this->spotlightRange_ = spotlightRange; this->updateSpotlightRange(); }
- inline const Vector3& getSpotlightRange() const
- { return this->spotlightRange_; }
-
- private:
- void setTypeString(const std::string& type);
- std::string getTypeString() const;
-
- void updateType();
- void updateDiffuseColour();
- void updateSpecularColour();
- void updateAttenuation();
- void updateSpotlightRange();
-
- Ogre::Light* light_;
- LightTypes type_;
- ColourValue diffuse_;
- ColourValue specular_;
- Vector4 attenuation_;
- Vector3 spotlightRange_;
- };
-}
-
-#endif /* _Light_H__ */
Deleted: code/branches/libraries2/src/orxonox/worldentities/Model.cc
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Model.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Model.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,100 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "Model.h"
-
-#include <OgreEntity.h>
-
-#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "core/XMLPort.h"
-#include "Scene.h"
-
-namespace orxonox
-{
- CreateFactory(Model);
-
- Model::Model(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(Model);
-
- this->bCastShadows_ = true;
-
- this->registerVariables();
- }
-
- Model::~Model()
- {
- if (this->isInitialized() && this->mesh_.getEntity())
- this->detachOgreObject(this->mesh_.getEntity());
- }
-
- void Model::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Model, XMLPort, xmlelement, mode);
-
- XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
- XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
- }
-
- void Model::registerVariables()
- {
- registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMesh));
- registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedShadows));
- }
-
- void Model::changedMesh()
- {
- if (GameMode::showsGraphics())
- {
- if (this->mesh_.getEntity())
- this->detachOgreObject(this->mesh_.getEntity());
-
- this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
-
- if (this->mesh_.getEntity())
- {
- this->attachOgreObject(this->mesh_.getEntity());
- this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
- this->mesh_.setVisible(this->isVisible());
- }
- }
- }
-
- void Model::changedShadows()
- {
- this->mesh_.setCastShadows(this->bCastShadows_);
- }
-
- void Model::changedVisibility()
- {
- SUPER(Model, changedVisibility);
-
- this->mesh_.setVisible(this->isVisible());
- }
-}
Deleted: code/branches/libraries2/src/orxonox/worldentities/Model.h
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/Model.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/Model.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,74 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Model_H__
-#define _Model_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include "tools/Mesh.h"
-#include "StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Model : public StaticEntity
- {
- public:
- Model(BaseObject* creator);
- virtual ~Model();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
-
- virtual void changedVisibility();
-
- inline const Mesh& getMesh() const
- { return this->mesh_; }
-
- inline void setMeshSource(const std::string& meshname)
- { this->meshSrc_ = meshname; this->changedMesh(); }
- inline const std::string& getMeshSource() const
- { return this->meshSrc_; }
-
- inline void setCastShadows(bool bCastShadows)
- { this->bCastShadows_ = bCastShadows; this->changedShadows(); }
- inline bool getCastShadows() const
- { return this->bCastShadows_; }
-
- private:
- void changedMesh();
- void changedShadows();
-
- std::string meshSrc_;
- Mesh mesh_;
- bool bCastShadows_;
- };
-}
-
-#endif /* _Model_H__ */
Deleted: code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.cc
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,129 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
-* @file
-* @brief class to control praticle effects
-*/
-
-#include "ParticleEmitter.h"
-
-#include "util/Exception.h"
-#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "core/XMLPort.h"
-#include "tools/ParticleInterface.h"
-#include "Scene.h"
-
-namespace orxonox
-{
- CreateFactory(ParticleEmitter);
-
- ParticleEmitter::ParticleEmitter(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(ParticleEmitter);
-
- if (GameMode::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager()))
- ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given.");
-
- this->particles_ = 0;
- this->LOD_ = LODParticle::Normal;
-
- this->registerVariables();
- }
-
- ParticleEmitter::~ParticleEmitter()
- {
- if (this->isInitialized() && this->particles_)
- {
- this->detachOgreObject(this->particles_->getParticleSystem());
- delete this->particles_;
- }
- }
-
- void ParticleEmitter::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(ParticleEmitter, XMLPort, xmlelement, mode);
-
- XMLPortParam(ParticleEmitter, "lod", setLODxml, getLODxml, xmlelement, mode).defaultValues(LODParticle::Normal);
- XMLPortParam(ParticleEmitter, "source", setSource, getSource, xmlelement, mode);
- }
-
- void ParticleEmitter::registerVariables()
- {
- registerVariable(this->source_, VariableDirection::ToClient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
- registerVariable((int&)(this->LOD_), VariableDirection::ToClient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
- }
-
- void ParticleEmitter::changedVisibility()
- {
- SUPER(ParticleEmitter, changedVisibility);
-
- if (this->particles_)
- this->particles_->setVisible(this->isVisible());
- }
-
- void ParticleEmitter::changedActivity()
- {
- SUPER(ParticleEmitter, changedActivity);
-
- if (this->particles_)
- this->particles_->setEnabled(this->isActive());
- }
-
- void ParticleEmitter::sourceChanged()
- {
- if (this->particles_)
- {
- delete this->particles_;
- this->particles_ = 0;
- }
-
- if (GameMode::showsGraphics() && this->getScene() && this->getScene()->getSceneManager())
- {
- try
- {
- this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_);
- this->attachOgreObject(this->particles_->getParticleSystem());
- this->particles_->setVisible(this->isVisible());
- this->particles_->setEnabled(this->isActive());
- }
- catch (...)
- {
- COUT(1) << "Error: Couln't load particle effect \"" << this->source_ << "\"" << std::endl;
- this->particles_ = 0;
- }
- }
- }
-
- void ParticleEmitter::LODchanged()
- {
- if (this->particles_)
- this->particles_->setDetailLevel(this->LOD_);
- }
-}
Deleted: code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.h
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/ParticleEmitter.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,79 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _ParticleEmitter_H__
-#define _ParticleEmitter_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include "StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport ParticleEmitter : public StaticEntity
- {
- public:
- ParticleEmitter(BaseObject* creator);
- ~ParticleEmitter();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void registerVariables();
-
- virtual void changedVisibility();
- virtual void changedActivity();
-
- inline ParticleInterface* getParticleInterface() const
- { return this->particles_; }
-
- inline void setSource(const std::string& source)
- { this->source_ = source; this->sourceChanged(); }
- inline const std::string& getSource() const
- { return this->source_; }
-
- inline void setLOD(LODParticle::Value level)
- { this->LOD_ = level; this->LODchanged(); }
- inline LODParticle::Value getLOD() const
- { return this->LOD_; }
-
- protected:
- inline void setLODxml(unsigned int level)
- { this->LOD_ = static_cast<LODParticle::Value>(level); this->LODchanged(); }
- inline unsigned int getLODxml() const
- { return static_cast<unsigned int>(this->LOD_); }
-
- void sourceChanged();
- void LODchanged();
-
- ParticleInterface* particles_;
- std::string source_;
- LODParticle::Value LOD_;
- };
-}
-
-#endif /* _ParticleEmitter_H__ */
Deleted: code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.cc
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.cc 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.cc 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,130 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "ParticleSpawner.h"
-
-#include "core/CoreIncludes.h"
-#include "core/EventIncludes.h"
-#include "core/Executor.h"
-#include "core/XMLPort.h"
-#include "tools/ParticleInterface.h"
-
-namespace orxonox
-{
- CreateFactory(ParticleSpawner);
-
- ParticleSpawner::ParticleSpawner(BaseObject* creator) : ParticleEmitter(creator)
- {
- RegisterObject(ParticleSpawner);
-
- this->bAutostart_ = true;
- this->bSuppressStart_ = false;
- this->bAutoDestroy_ = true;
- this->bForceDestroy_ = false;
- this->bLoop_ = false;
- this->startdelay_ = 0;
- this->lifetime_ = 0;
- this->destroydelay_ = 0;
-
- this->startParticleSpawner();
- }
-
- ParticleSpawner::~ParticleSpawner()
- {
- }
-
- void ParticleSpawner::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(ParticleSpawner, XMLPort, xmlelement, mode);
-
- XMLPortParam(ParticleSpawner, "autostart", setAutoStart, getAutoStart, xmlelement, mode).defaultValues(true);
- XMLPortParam(ParticleSpawner, "autodestroy", setDestroyAfterLife, getDestroyAfterLife, xmlelement, mode).defaultValues(false);
- XMLPortParam(ParticleSpawner, "loop", setLoop, getLoop, xmlelement, mode).defaultValues(false);
- XMLPortParam(ParticleSpawner, "lifetime", setLifetime, getLifetime, xmlelement, mode).defaultValues(0.0f);
- XMLPortParam(ParticleSpawner, "startdelay", setStartdelay, getStartdelay, xmlelement, mode).defaultValues(0.0f);
- XMLPortParam(ParticleSpawner, "destroydelay", setDestroydelay, getDestroydelay, xmlelement, mode).defaultValues(0.0f);
- }
-
- void ParticleSpawner::processEvent(Event& event)
- {
- SUPER(ParticleSpawner, processEvent, event);
-
- ORXONOX_SET_EVENT(ParticleSpawner, "spawn", spawn, event);
- }
-
- void ParticleSpawner::configure(float lifetime, float startdelay, float destroydelay, bool autodestroy)
- {
- this->bAutoDestroy_ = autodestroy;
- this->startdelay_ = startdelay;
- this->lifetime_ = lifetime;
- this->destroydelay_ = destroydelay;
- }
-
- void ParticleSpawner::startParticleSpawner()
- {
- if (!this->particles_)
- return;
-
- this->setActive(false);
-
- if (this->bForceDestroy_ || this->bSuppressStart_)
- return;
-
- this->timer_.setTimer(this->startdelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::fireParticleSpawner)));
- }
-
- void ParticleSpawner::fireParticleSpawner()
- {
- this->setActive(true);
- if (this->lifetime_ != 0)
- this->timer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&ParticleSpawner::stopParticleSpawner)));
- }
-
- void ParticleSpawner::stopParticleSpawner()
- {
- this->setActive(false);
-
- if (this->bAutoDestroy_ || this->bForceDestroy_)
- {
- this->setPosition(this->getWorldPosition());
- this->detachFromParent();
-
- if (!this->timer_.isActive() || this->timer_.getRemainingTime() > this->destroydelay_)
- this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::destroyParticleSpawner)));
- }
- else if (this->bLoop_)
- {
- this->timer_.setTimer(this->destroydelay_, false, this, createExecutor(createFunctor(&ParticleSpawner::startParticleSpawner)));
- }
- }
-
- void ParticleSpawner::destroyParticleSpawner()
- {
- delete this;
- }
-}
Deleted: code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.h
===================================================================
--- code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.h 2009-08-31 22:38:36 UTC (rev 5735)
+++ code/branches/libraries2/src/orxonox/worldentities/ParticleSpawner.h 2009-08-31 23:02:10 UTC (rev 5736)
@@ -1,104 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _ParticleSpawner_H__
-#define _ParticleSpawner_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "tools/Timer.h"
-#include "ParticleEmitter.h"
-
-namespace orxonox
-{
- class _OrxonoxExport ParticleSpawner : public ParticleEmitter
- {
- public:
- ParticleSpawner(BaseObject* creator);
- virtual ~ParticleSpawner();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void processEvent(Event& event);
-
- inline void destroy()
- { this->bForceDestroy_ = true; this->stopParticleSpawner(); }
- inline void spawn()
- { this->bSuppressStart_ = false; this->startParticleSpawner(); }
-
- void configure(float lifetime = 0, float startdelay = 0, float destroydelay = 0, bool autodestroy = true);
-
- inline void setAutoStart(bool autostart)
- { this->bAutostart_ = autostart; this->bSuppressStart_ = !autostart; }
- inline bool getAutoStart() const
- { return this->bAutostart_; }
-
- inline void setDestroyAfterLife(bool destroy)
- { this->bAutoDestroy_ = destroy; }
- inline bool getDestroyAfterLife() const
- { return this->bAutoDestroy_; }
-
- inline void setLoop(bool loop)
- { this->bLoop_ = loop; }
- inline bool getLoop() const
- { return this->bLoop_; }
-
- inline void setLifetime(float lifetime)
- { this->lifetime_ = lifetime; this->startParticleSpawner(); }
- inline float getLifetime() const
- { return this->lifetime_; }
-
- inline void setStartdelay(float startdelay)
- { this->startdelay_ = startdelay; this->startParticleSpawner(); }
- inline float getStartdelay() const
- { return this->startdelay_; }
-
- inline void setDestroydelay(float destroydelay)
- { this->destroydelay_ = destroydelay; this->startParticleSpawner(); }
- inline float getDestroydelay() const
- { return this->destroydelay_; }
-
- private:
- void startParticleSpawner();
- void fireParticleSpawner();
- void stopParticleSpawner();
- void destroyParticleSpawner();
-
- Timer<ParticleSpawner> timer_;
-
- bool bSuppressStart_;
- bool bAutostart_;
- bool bForceDestroy_;
- bool bAutoDestroy_;
- bool bLoop_;
- float startdelay_;
- float lifetime_;
- float destroydelay_;
- };
-}
-
-#endif /* _ParticleSpawner_H__ */
More information about the Orxonox-commit
mailing list