Changeset 3196 for code/trunk/src/orxonox/tools
- Timestamp:
- Jun 20, 2009, 9:20:47 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 6 deleted
- 17 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/pch (added) merged: 3114-3118,3124-3125,3127-3131,3133,3138-3194
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/tools/BillboardSet.cc
r3110 r3196 29 29 #include "BillboardSet.h" 30 30 31 #include <cassert> 32 #include <string> 31 33 #include <sstream> 32 #include <cassert>33 34 34 #include <OgreSceneManager.h> 35 35 #include <OgreBillboardSet.h> 36 36 #include <OgreBillboard.h> 37 37 38 #include "util/Convert.h" 39 #include "util/Math.h" 40 #include "util/String.h" 38 41 #include "core/GameMode.h" 39 #include "util/Convert.h"40 #include "util/String.h"41 42 42 43 namespace orxonox -
code/trunk/src/orxonox/tools/BillboardSet.h
r2662 r3196 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include <string> 35 #include <OgrePrerequisites.h> 36 37 #include "util/Math.h" 33 #include "util/OgreForwardRefs.h" 38 34 39 35 namespace orxonox … … 52 48 inline Ogre::BillboardSet* getBillboardSet() 53 49 { return this->billboardSet_; } 54 inline Ogre::SceneManager* getSceneManager() 50 inline Ogre::SceneManager* getSceneManager() const 55 51 { return this->scenemanager_; } 56 52 … … 69 65 void destroyBillboardSet(); 70 66 71 static unsigned int billboardSetCounter_s;72 67 Ogre::BillboardSet* billboardSet_; 73 68 Ogre::SceneManager* scenemanager_; 69 70 static unsigned int billboardSetCounter_s; 74 71 }; 75 72 } -
code/trunk/src/orxonox/tools/BulletConversions.h
r2662 r3196 34 34 #include "util/Convert.h" 35 35 #include "util/Math.h" 36 #include "LinearMath/btQuaternion.h"37 #include "LinearMath/btVector3.h"36 #include <LinearMath/btQuaternion.h> 37 #include <LinearMath/btVector3.h> 38 38 39 39 namespace orxonox … … 43 43 struct ConverterExplicit<orxonox::Vector3, btVector3> 44 44 { 45 static bool convert(btVector3* output, const orxonox::Vector3& input)45 FORCEINLINE static bool convert(btVector3* output, const orxonox::Vector3& input) 46 46 { 47 47 output->setX(input.x); … … 56 56 struct ConverterExplicit<btVector3, orxonox::Vector3> 57 57 { 58 static bool convert(orxonox::Vector3* output, const btVector3& input)58 FORCEINLINE static bool convert(orxonox::Vector3* output, const btVector3& input) 59 59 { 60 60 output->x = input.x(); … … 69 69 struct ConverterExplicit<orxonox::Quaternion, btQuaternion> 70 70 { 71 static bool convert(btQuaternion* output, const orxonox::Quaternion& input)71 FORCEINLINE static bool convert(btQuaternion* output, const orxonox::Quaternion& input) 72 72 { 73 73 output->setW(input.w); … … 83 83 struct ConverterExplicit<btQuaternion, orxonox::Quaternion> 84 84 { 85 static bool convert(orxonox::Quaternion* output, const btQuaternion& input)85 FORCEINLINE static bool convert(orxonox::Quaternion* output, const btQuaternion& input) 86 86 { 87 87 output->w = input.w(); -
code/trunk/src/orxonox/tools/CMakeLists.txt
r3089 r3196 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 2 BillboardSet.cc 3 DynamicLines.cc 4 DynamicRenderable.cc 3 5 Mesh.cc 4 6 ParticleInterface.cc 5 7 Shader.cc 6 8 TextureGenerator.cc 7 TimeFactorListener.cc8 9 Timer.cc 9 WindowEventListener.cc10 DynamicLines.cpp11 DynamicRenderable.cpp12 10 ) -
code/trunk/src/orxonox/tools/DynamicLines.h
r3089 r3196 1 #ifndef _DYNAMIC_LINES_H_ 2 #define _DYNAMIC_LINES_H_ 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Baxissimo, Emmeran, DWORD, EtherDrive (OGRE Wiki) 24 * Co-authors: 25 * ... 26 * 27 */ 3 28 29 #ifndef _DynamicLines_H__ 30 #define _DynamicLines_H__ 31 32 #include "OrxonoxPrereqs.h" 33 34 #include <vector> 4 35 #include "DynamicRenderable.h" 5 #include <vector>6 36 7 namespace orxonox37 namespace Ogre 8 38 { 9 class DynamicLines : public DynamicRenderable 10 { 11 typedef Ogre::Vector3 Vector3; 12 typedef Ogre::Quaternion Quaternion; 13 typedef Ogre::Camera Camera; 14 typedef Ogre::Real Real; 15 typedef Ogre::RenderOperation::OperationType OperationType; 39 class DynamicLines : public DynamicRenderable 40 { 41 typedef RenderOperation::OperationType OperationType; 16 42 17 public:18 /// Constructor - see setOperationType() for description of argument.19 DynamicLines(OperationType opType=Ogre::RenderOperation::OT_LINE_STRIP);20 virtual ~DynamicLines();43 public: 44 /// Constructor - see setOperationType() for description of argument. 45 DynamicLines(OperationType opType = RenderOperation::OT_LINE_STRIP); 46 virtual ~DynamicLines(); 21 47 22 /// Add a point to the point list23 void addPoint(const Ogre::Vector3 &p);24 /// Add a point to the point list25 void addPoint(Real x, Real y, Real z);48 /// Add a point to the point list 49 void addPoint(const Vector3 &p); 50 /// Add a point to the point list 51 void addPoint(Real x, Real y, Real z); 26 52 27 /// Change the location of an existing point in the point list28 void setPoint(unsigned short index, const Vector3 &value);53 /// Change the location of an existing point in the point list 54 void setPoint(unsigned short index, const Vector3 &value); 29 55 30 /// Return the location of an existing point in the point list31 const Vector3& getPoint(unsigned short index) const;56 /// Return the location of an existing point in the point list 57 const Vector3& getPoint(unsigned short index) const; 32 58 33 /// Return the total number of points in the point list34 unsigned short getNumPoints(void) const;59 /// Return the total number of points in the point list 60 unsigned short getNumPoints(void) const; 35 61 36 /// Remove all points from the point list37 void clear();62 /// Remove all points from the point list 63 void clear(); 38 64 39 /// Call this to update the hardware buffer after making changes.40 void update();65 /// Call this to update the hardware buffer after making changes. 66 void update(); 41 67 42 /** Set the type of operation to draw with. 43 * @param opType Can be one of 44 * - RenderOperation::OT_LINE_STRIP 45 * - RenderOperation::OT_LINE_LIST 46 * - RenderOperation::OT_POINT_LIST 47 * - RenderOperation::OT_TRIANGLE_LIST 48 * - RenderOperation::OT_TRIANGLE_STRIP 49 * - RenderOperation::OT_TRIANGLE_FAN 50 * The default is OT_LINE_STRIP. 51 */ 52 void setOperationType(OperationType opType); 53 OperationType getOperationType() const; 68 /** 69 @brief 70 Set the type of operation to draw with. 71 @param opType 72 Can be one of 73 - RenderOperation::OT_LINE_STRIP 74 - RenderOperation::OT_LINE_LIST 75 - RenderOperation::OT_POINT_LIST 76 - RenderOperation::OT_TRIANGLE_LIST 77 - RenderOperation::OT_TRIANGLE_STRIP 78 - RenderOperation::OT_TRIANGLE_FAN 79 The default is OT_LINE_STRIP. 80 */ 81 void setOperationType(OperationType opType); 82 OperationType getOperationType() const; 54 83 55 protected:56 /// Implementation DynamicRenderable, creates a simple vertex-only decl57 virtual void createVertexDeclaration();58 /// Implementation DynamicRenderable, pushes point list out to hardware memory59 virtual void fillHardwareBuffers();84 protected: 85 /// Implementation DynamicRenderable, creates a simple vertex-only decl 86 virtual void createVertexDeclaration(); 87 /// Implementation DynamicRenderable, pushes point list out to hardware memory 88 virtual void fillHardwareBuffers(); 60 89 61 private:62 std::vector<Vector3> mPoints;63 bool mDirty;64 };90 private: 91 std::vector<Vector3> mPoints; 92 bool mDirty; 93 }; 65 94 } 66 95 67 #endif 96 #endif /* _DynamicLines_H__ */ -
code/trunk/src/orxonox/tools/DynamicRenderable.h
r3089 r3196 1 #ifndef DYNAMIC_RENDERABLE_H 2 #define DYNAMIC_RENDERABLE_H 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Sinbad, Baxissimo, DWORD, TheBren (OGRE Wiki) 24 * Co-authors: 25 * ... 26 * 27 */ 28 29 #ifndef _DynamicRenderable_H__ 30 #define _DynamicRenderable_H__ 31 32 #include "OrxonoxPrereqs.h" 3 33 4 34 #include <OgreSimpleRenderable.h> 5 35 6 namespace orxonox36 namespace Ogre 7 37 { 8 /// Abstract base class providing mechanisms for dynamically growing hardware buffers.9 class DynamicRenderable : public Ogre::SimpleRenderable10 {11 public:12 /// Constructor13 DynamicRenderable();14 /// Virtual destructor15 virtual ~DynamicRenderable();38 /// Abstract base class providing mechanisms for dynamically growing hardware buffers. 39 class DynamicRenderable : public SimpleRenderable 40 { 41 public: 42 /// Constructor 43 DynamicRenderable(); 44 /// Virtual destructor 45 virtual ~DynamicRenderable(); 16 46 17 /** Initializes the dynamic renderable. 18 @remarks 19 This function should only be called once. It initializes the 20 render operation, and calls the abstract function 21 createVertexDeclaration(). 22 @param operationType The type of render operation to perform. 23 @param useIndices Specifies whether to use indices to determine the 24 vertices to use as input. */ 25 void initialize(Ogre::RenderOperation::OperationType operationType, 26 bool useIndices); 47 /** 48 @brief 49 Initializes the dynamic renderable. 50 @remarks 51 This function should only be called once. It initializes the 52 render operation, and calls the abstract function 53 createVertexDeclaration(). 54 @param operationType 55 The type of render operation to perform. 56 @param useIndices 57 Specifies whether to use indices to determine the vertices to use as input. 58 */ 59 void initialize(RenderOperation::OperationType operationType, 60 bool useIndices); 27 61 28 /// Implementation of Ogre::SimpleRenderable29 virtual Ogre::Real getBoundingRadius(void) const;30 /// Implementation of Ogre::SimpleRenderable31 virtual Ogre::Real getSquaredViewDepth(const Ogre::Camera* cam) const;62 /// Implementation of SimpleRenderable 63 virtual Real getBoundingRadius(void) const; 64 /// Implementation of SimpleRenderable 65 virtual Real getSquaredViewDepth(const Camera* cam) const; 32 66 33 protected:34 /// Maximum capacity of the currently allocated vertex buffer.35 size_t mVertexBufferCapacity;36 /// Maximum capacity of the currently allocated index buffer.37 size_t mIndexBufferCapacity;67 protected: 68 /// Maximum capacity of the currently allocated vertex buffer. 69 size_t mVertexBufferCapacity; 70 /// Maximum capacity of the currently allocated index buffer. 71 size_t mIndexBufferCapacity; 38 72 39 /** Creates the vertex declaration. 40 @remarks 41 Override and set mRenderOp.vertexData->vertexDeclaration here. 42 mRenderOp.vertexData will be created for you before this method 43 is called. */ 44 virtual void createVertexDeclaration() = 0; 73 /** 74 @brief 75 Creates the vertex declaration. 76 @remarks 77 Override and set mRenderOp.vertexData->vertexDeclaration here. 78 mRenderOp.vertexData will be created for you before this method 79 is called. 80 */ 81 virtual void createVertexDeclaration() = 0; 45 82 46 /** Prepares the hardware buffers for the requested vertex and index counts. 47 @remarks 48 This function must be called before locking the buffers in 49 fillHardwareBuffers(). It guarantees that the hardware buffers 50 are large enough to hold at least the requested number of 51 vertices and indices (if using indices). The buffers are 52 possibly reallocated to achieve this. 53 @par 54 The vertex and index count in the render operation are set to 55 the values of vertexCount and indexCount respectively. 56 @param vertexCount The number of vertices the buffer must hold. 83 /** 84 @brief 85 Prepares the hardware buffers for the requested vertex and index counts. 86 @remarks 87 This function must be called before locking the buffers in 88 fillHardwareBuffers(). It guarantees that the hardware buffers 89 are large enough to hold at least the requested number of 90 vertices and indices (if using indices). The buffers are 91 possibly reallocated to achieve this. 92 @par 93 The vertex and index count in the render operation are set to 94 the values of vertexCount and indexCount respectively. 95 @param vertexCount 96 The number of vertices the buffer must hold. 97 @param indexCount 98 The number of indices the buffer must hold. This 99 parameter is ignored if not using indices. 100 */ 101 void prepareHardwareBuffers(size_t vertexCount, size_t indexCount); 57 102 58 @param indexCount The number of indices the buffer must hold. This 59 parameter is ignored if not using indices. */ 60 void prepareHardwareBuffers(size_t vertexCount, size_t indexCount); 61 62 /** Fills the hardware vertex and index buffers with data. 63 @remarks 64 This function must call prepareHardwareBuffers() before locking 65 the buffers to ensure the they are large enough for the data to 66 be written. Afterwards the vertex and index buffers (if using 67 indices) can be locked, and data can be written to them. */ 68 virtual void fillHardwareBuffers() = 0; 69 }; 103 /** 104 @brief 105 Fills the hardware vertex and index buffers with data. 106 @remarks 107 This function must call prepareHardwareBuffers() before locking 108 the buffers to ensure the they are large enough for the data to 109 be written. Afterwards the vertex and index buffers (if using 110 indices) can be locked, and data can be written to them. 111 */ 112 virtual void fillHardwareBuffers() = 0; 113 }; 70 114 } 71 115 72 #endif / / DYNAMIC_RENDERABLE_H116 #endif /* _DynamicRenderable_H__ */ -
code/trunk/src/orxonox/tools/Mesh.cc
r3110 r3196 29 29 #include "Mesh.h" 30 30 31 #include <cassert> 31 32 #include <sstream> 33 #include <string> 32 34 #include <OgreEntity.h> 33 35 #include <OgreSceneManager.h> 34 #include <cassert>35 36 36 #include "core/GameMode.h"37 37 #include "util/Convert.h" 38 38 #include "util/String.h" 39 #include "core/GameMode.h" 39 40 40 41 namespace orxonox -
code/trunk/src/orxonox/tools/Mesh.h
r2662 r3196 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include <string> 35 #include <OgrePrerequisites.h> 33 #include "util/OgreForwardRefs.h" 36 34 37 35 namespace orxonox … … 58 56 59 57 private: 60 static unsigned int meshCounter_s;61 58 Ogre::Entity* entity_; 62 59 bool bCastShadows_; 63 60 Ogre::SceneManager* scenemanager_; 61 62 static unsigned int meshCounter_s; 64 63 }; 65 64 } -
code/trunk/src/orxonox/tools/ParticleInterface.cc
r3110 r3196 34 34 #include "ParticleInterface.h" 35 35 36 #include <cassert> 37 #include <string> 36 38 #include <OgreParticleSystem.h> 37 39 #include <OgreParticleEmitter.h> 38 40 #include <OgreSceneManager.h> 39 #include <cassert> 40 41 42 #include "util/Convert.h" 43 #include "util/Math.h" 44 #include "core/CoreIncludes.h" 45 #include "core/GameMode.h" 41 46 #include "GraphicsManager.h" 42 #include "core/GameMode.h"43 #include "core/CoreIncludes.h"44 #include "util/Convert.h"45 47 46 48 namespace orxonox … … 132 134 return 0; 133 135 } 134 Ogre::ParticleAffector* ParticleInterface::getAffector(unsigned int affectorNr) const136 Ogre::ParticleAffector* ParticleInterface::getAffector(unsigned int affectorNr) 135 137 { 136 138 if (this->particleSystem_ && (affectorNr < this->particleSystem_->getNumAffectors())) -
code/trunk/src/orxonox/tools/ParticleInterface.h
r2896 r3196 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include <string> 35 #include <OgrePrerequisites.h> 36 37 #include "core/OrxonoxClass.h" 38 #include "util/Math.h" 39 #include "tools/TimeFactorListener.h" 34 #include "util/OgreForwardRefs.h" 35 #include "interfaces/TimeFactorListener.h" 40 36 41 37 #define getAllEmitters() \ … … 52 48 virtual ~ParticleInterface(); 53 49 54 inline Ogre::ParticleSystem* getParticleSystem() const50 inline Ogre::ParticleSystem* getParticleSystem() 55 51 { return this->particleSystem_; } 56 52 … … 62 58 63 59 Ogre::ParticleAffector* addAffector(const std::string& name); 64 Ogre::ParticleAffector* getAffector(unsigned int affectorNr) const;60 Ogre::ParticleAffector* getAffector(unsigned int affectorNr); 65 61 void removeAffector(unsigned int affectorNr); 66 62 void removeAllAffectors(); … … 95 91 void updateVisibility(); 96 92 97 static ParticleInterface* currentParticleInterface_s;98 static unsigned int counter_s;99 100 93 Ogre::ParticleSystem* particleSystem_; 94 Ogre::SceneManager* scenemanager_; 101 95 bool bVisible_; 102 96 bool bEnabled_; … … 104 98 unsigned int detaillevel_; //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high) 105 99 float speedFactor_; 106 Ogre::SceneManager* scenemanager_; 100 101 static ParticleInterface* currentParticleInterface_s; 102 static unsigned int counter_s; 107 103 }; 108 104 } -
code/trunk/src/orxonox/tools/Shader.cc
r3110 r3196 34 34 #include <OgreRoot.h> 35 35 #include <OgrePlugin.h> 36 37 #include "core/GameMode.h"38 #include "core/CoreIncludes.h"39 #include "core/Executor.h"40 #include "GraphicsManager.h"41 #include "util/Exception.h"42 43 36 #include <OgreMaterial.h> 44 37 #include <OgreTechnique.h> 45 38 #include <OgrePass.h> 46 39 #include <OgreMaterialManager.h> 40 41 #include "core/CoreIncludes.h" 42 #include "core/GameMode.h" 43 #include "GraphicsManager.h" 47 44 48 45 namespace orxonox … … 219 216 return (*((float*)pointer->second)); 220 217 else 221 return (*((int*)pointer->second));218 return static_cast<float>(*((int*)pointer->second)); 222 219 } 223 220 else -
code/trunk/src/orxonox/tools/Shader.h
r2662 r3196 31 31 32 32 #include "OrxonoxPrereqs.h" 33 #include <OgrePrerequisites.h> 33 34 #include <map> 35 #include <string> 34 36 #include <vector> 35 #include <map>36 37 37 #include "objects/Tickable.h" 38 #include "util/OgreForwardRefs.h" 39 #include "interfaces/Tickable.h" 38 40 39 41 namespace orxonox -
code/trunk/src/orxonox/tools/TextureGenerator.cc
r3110 r3196 33 33 34 34 #include "TextureGenerator.h" 35 35 36 #include <OgreMaterialManager.h> 36 37 #include <OgreTechnique.h> 37 38 #include "util/Convert.h" 39 #include "util/Math.h" 38 40 39 41 namespace std 40 42 { 41 43 template <> 42 bool less<orxonox::ColourValue>::operator()(const orxonox::ColourValue& __x, const orxonox::ColourValue& __y) const44 inline bool less<orxonox::ColourValue>::operator()(const orxonox::ColourValue& __x, const orxonox::ColourValue& __y) const 43 45 { 44 46 if (__x.r == __y.r) … … 63 65 unsigned int TextureGenerator::materialCount_s = 0; 64 66 65 /*static*/ const std::string& TextureGenerator::getMaterialName( std::stringtextureName, const ColourValue& colour)67 /*static*/ const std::string& TextureGenerator::getMaterialName(const std::string& textureName, const ColourValue& colour) 66 68 { 67 69 std::map<ColourValue, std::string>& colourMap = materials_s[textureName]; -
code/trunk/src/orxonox/tools/TextureGenerator.h
r1625 r3196 36 36 37 37 #include "OrxonoxPrereqs.h" 38 39 #include <map> 38 40 #include <string> 39 #include <map> 40 #include "util/Math.h" 41 #include "util/UtilPrereqs.h" 41 42 42 43 namespace orxonox … … 45 46 { 46 47 public: 47 static const std::string& getMaterialName( std::stringtextureName, const ColourValue& colour);48 static const std::string& getMaterialName(const std::string& textureName, const ColourValue& colour); 48 49 49 50 private: -
code/trunk/src/orxonox/tools/Timer.cc
r3110 r3196 27 27 */ 28 28 29 #include "Timer.h" 30 29 31 #include <set> 30 32 31 #include "Timer.h"32 33 #include "core/Executor.h"34 33 #include "core/CoreIncludes.h" 35 34 #include "core/ConsoleCommand.h" 36 35 #include "core/CommandExecutor.h" 37 36 #include "core/Clock.h" 37 #include "core/Functor.h" 38 38 39 39 namespace orxonox -
code/trunk/src/orxonox/tools/Timer.h
r2896 r3196 62 62 63 63 #include "OrxonoxPrereqs.h" 64 64 65 #include "core/Executor.h" 65 66 #include "core/OrxonoxClass.h" 66 #include " tools/TimeFactorListener.h"67 #include "interfaces/TimeFactorListener.h" 67 68 68 69 namespace orxonox
Note: See TracChangeset
for help on using the changeset viewer.