Changeset 11071 for code/trunk/src/libraries/tools
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/tools/BillboardSet.cc
r8858 r11071 46 46 BillboardSet::BillboardSet() 47 47 { 48 this->billboardSet_ = 0;48 this->billboardSet_ = nullptr; 49 49 } 50 50 … … 81 81 { 82 82 orxout(internal_error) << "Couldn't load billboard \"" << file << '"' << endl; 83 this->billboardSet_ = 0;83 this->billboardSet_ = nullptr; 84 84 } 85 85 … … 104 104 { 105 105 orxout(internal_error) << "Couldn't load billboard \"" << file << '"' << endl; 106 this->billboardSet_ = 0;106 this->billboardSet_ = nullptr; 107 107 } 108 108 … … 114 114 if (this->billboardSet_ && this->scenemanager_) 115 115 this->scenemanager_->destroyBillboardSet(this->billboardSet_); 116 this->billboardSet_ = 0;116 this->billboardSet_ = nullptr; 117 117 } 118 118 -
code/trunk/src/libraries/tools/BulletDebugDrawer.h
r10277 r11071 13 13 #include <btBulletCollisionCommon.h> 14 14 #include <OgreFrameListener.h> 15 #include <OgreVector3.h> 16 #include <OgreColourValue.h> 15 17 16 18 namespace orxonox … … 21 23 BulletDebugDrawer(Ogre::SceneManager* sceneManager); 22 24 ~BulletDebugDrawer(); 23 virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color) ;24 // virtual void drawTriangle(const btVector3& v0, const btVector3& v1, const btVector3& v2, const btVector3& color, btScalar) ;25 virtual void drawSphere (const btVector3& p, btScalar radius, const btVector3& color) ;26 virtual void drawSphere(btScalar radius, const btTransform& transform, const btVector3& color) ;27 virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btVector3& color) ;28 virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btTransform& trans, const btVector3& color) ;29 virtual void drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color) ;30 virtual void drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color) ;31 // virtual void drawPlane(const btVector3& planeNormal, btScalar planeConst, const btTransform& transform, const btVector3& color) ;25 virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color) override; 26 // virtual void drawTriangle(const btVector3& v0, const btVector3& v1, const btVector3& v2, const btVector3& color, btScalar) override; 27 virtual void drawSphere (const btVector3& p, btScalar radius, const btVector3& color) override; 28 virtual void drawSphere(btScalar radius, const btTransform& transform, const btVector3& color) override; 29 virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btVector3& color) override; 30 virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btTransform& trans, const btVector3& color) override; 31 virtual void drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color) override; 32 virtual void drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color) override; 33 // virtual void drawPlane(const btVector3& planeNormal, btScalar planeConst, const btTransform& transform, const btVector3& color) override; 32 34 33 virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color) ;35 virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color) override; 34 36 35 virtual void reportErrorWarning(const char* warningString) ;36 virtual void draw3dText(const btVector3& location, const char* textString) ;37 virtual void reportErrorWarning(const char* warningString) override; 38 virtual void draw3dText(const btVector3& location, const char* textString) override; 37 39 38 virtual void setDebugMode(int debugMode) ;39 virtual int getDebugMode() const ;40 virtual void setDebugMode(int debugMode) override; 41 virtual int getDebugMode() const override; 40 42 41 43 void configure(bool bFill, float fillAlpha); 42 44 43 45 protected: 44 bool frameStarted(const Ogre::FrameEvent& evt);45 bool frameEnded(const Ogre::FrameEvent& evt);46 virtual bool frameStarted(const Ogre::FrameEvent& evt) override; 47 virtual bool frameEnded(const Ogre::FrameEvent& evt) override; 46 48 47 49 private: -
code/trunk/src/libraries/tools/DebugDrawer.cc
r10262 r11071 21 21 { 22 22 DebugDrawer::DebugDrawer(Ogre::SceneManager *_sceneManager, float _fillAlpha) : 23 sceneManager(_sceneManager), fillAlpha(_fillAlpha), manualObject( 0), isEnabled(true), linesIndex(0), trianglesIndex(0)23 sceneManager(_sceneManager), fillAlpha(_fillAlpha), manualObject(nullptr), isEnabled(true), linesIndex(0), trianglesIndex(0) 24 24 { 25 25 initialise(); … … 392 392 manualObject->estimateVertexCount(lineVertices.size()); 393 393 manualObject->estimateIndexCount(lineIndices.size()); 394 for ( std::list<VertexPair>::iterator i = lineVertices.begin(); i != lineVertices.end(); i++)394 for (const VertexPair& pair : lineVertices) 395 395 { 396 manualObject->position( i->first);397 manualObject->colour( i->second);396 manualObject->position(pair.first); 397 manualObject->colour(pair.second); 398 398 } 399 for ( std::list<int>::iterator i = lineIndices.begin(); i != lineIndices.end(); i++)400 manualObject->index( *i);399 for (int lineIndex : lineIndices) 400 manualObject->index(lineIndex); 401 401 } 402 402 else … … 409 409 manualObject->estimateVertexCount(triangleVertices.size()); 410 410 manualObject->estimateIndexCount(triangleIndices.size()); 411 for ( std::list<VertexPair>::iterator i = triangleVertices.begin(); i != triangleVertices.end(); i++)411 for (const VertexPair& pair : triangleVertices) 412 412 { 413 manualObject->position( i->first);414 manualObject->colour( i->second.r, i->second.g, i->second.b, fillAlpha);413 manualObject->position(pair.first); 414 manualObject->colour(pair.second.r, pair.second.g, pair.second.b, fillAlpha); 415 415 } 416 for ( std::list<int>::iterator i = triangleIndices.begin(); i != triangleIndices.end(); i++)417 manualObject->index( *i);416 for (int triangleIndex : triangleIndices) 417 manualObject->index(triangleIndex); 418 418 } 419 419 else … … 433 433 int DebugDrawer::addLineVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour) 434 434 { 435 lineVertices. push_back(VertexPair(vertex, colour));435 lineVertices.emplace_back(vertex, colour); 436 436 return linesIndex++; 437 437 } … … 445 445 int DebugDrawer::addTriangleVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour) 446 446 { 447 triangleVertices. push_back(VertexPair(vertex, colour));447 triangleVertices.emplace_back(vertex, colour); 448 448 return trianglesIndex++; 449 449 } -
code/trunk/src/libraries/tools/DynamicLines.cc
r5781 r11071 69 69 void DynamicLines::addPoint(Real x, Real y, Real z) 70 70 { 71 mPoints. push_back(Vector3(x,y,z));71 mPoints.emplace_back(x,y,z); 72 72 mDirty = true; 73 73 } -
code/trunk/src/libraries/tools/DynamicLines.h
r5781 r11071 84 84 protected: 85 85 /// Implementation DynamicRenderable, creates a simple vertex-only decl 86 virtual void createVertexDeclaration() ;86 virtual void createVertexDeclaration() override; 87 87 /// Implementation DynamicRenderable, pushes point list out to hardware memory 88 virtual void fillHardwareBuffers() ;88 virtual void fillHardwareBuffers() override; 89 89 90 90 private: -
code/trunk/src/libraries/tools/DynamicRenderable.h
r5781 r11071 61 61 62 62 /// Implementation of SimpleRenderable 63 virtual Real getBoundingRadius(void) const ;63 virtual Real getBoundingRadius(void) const override; 64 64 /// Implementation of SimpleRenderable 65 virtual Real getSquaredViewDepth(const Camera* cam) const ;65 virtual Real getSquaredViewDepth(const Camera* cam) const override; 66 66 67 67 protected: -
code/trunk/src/libraries/tools/IcoSphere.cc
r10262 r11071 116 116 std::list<TriangleIndices> faces2; 117 117 118 for ( std::list<TriangleIndices>::iterator j = faces.begin(); j != faces.end(); j++)118 for (const TriangleIndices& f : faces) 119 119 { 120 TriangleIndices f = *j;121 120 int a = getMiddlePoint(f.v1, f.v2); 122 121 int b = getMiddlePoint(f.v2, f.v3); … … 127 126 removeLineIndices(f.v3, f.v1); 128 127 129 faces2. push_back(TriangleIndices(f.v1, a, c));130 faces2. push_back(TriangleIndices(f.v2, b, a));131 faces2. push_back(TriangleIndices(f.v3, c, b));132 faces2. push_back(TriangleIndices(a, b, c));128 faces2.emplace_back(f.v1, a, c); 129 faces2.emplace_back(f.v2, b, a); 130 faces2.emplace_back(f.v3, c, b); 131 faces2.emplace_back(a, b, c); 133 132 134 133 addTriangleLines(f.v1, a, c); … … 143 142 void IcoSphere::addLineIndices(int index0, int index1) 144 143 { 145 lineIndices. push_back(LineIndices(index0, index1));144 lineIndices.emplace_back(index0, index1); 146 145 } 147 146 … … 164 163 { 165 164 Ogre::Real length = vertex.length(); 166 vertices. push_back(Ogre::Vector3(vertex.x / length, vertex.y / length, vertex.z / length));165 vertices.emplace_back(vertex.x / length, vertex.y / length, vertex.z / length); 167 166 return index++; 168 167 } … … 189 188 void IcoSphere::addFace(int index0, int index1, int index2) 190 189 { 191 faces. push_back(TriangleIndices(index0, index1, index2));190 faces.emplace_back(index0, index1, index2); 192 191 } 193 192 194 193 void IcoSphere::addToLineIndices(int baseIndex, std::list<int>* target) const 195 194 { 196 for ( std::list<LineIndices>::const_iterator i = lineIndices.begin(); i != lineIndices.end(); i++)195 for (const LineIndices& line : lineIndices) 197 196 { 198 target->push_back(baseIndex + (*i).v1);199 target->push_back(baseIndex + (*i).v2);197 target->push_back(baseIndex + line.v1); 198 target->push_back(baseIndex + line.v2); 200 199 } 201 200 } … … 203 202 void IcoSphere::addToTriangleIndices(int baseIndex, std::list<int>* target) const 204 203 { 205 for ( std::list<TriangleIndices>::const_iterator i = faces.begin(); i != faces.end(); i++)204 for (const TriangleIndices& triangle : faces) 206 205 { 207 target->push_back(baseIndex + (*i).v1);208 target->push_back(baseIndex + (*i).v2);209 target->push_back(baseIndex + (*i).v3);206 target->push_back(baseIndex + triangle.v1); 207 target->push_back(baseIndex + triangle.v2); 208 target->push_back(baseIndex + triangle.v3); 210 209 } 211 210 } … … 217 216 transform.setScale(Ogre::Vector3(scale, scale, scale)); 218 217 219 for ( int i = 0; i < (int) vertices.size(); i++)220 target-> push_back(VertexPair(transform * vertices[i], colour));218 for (const Ogre::Vector3& vertex : vertices) 219 target->emplace_back(transform * vertex, colour); 221 220 222 221 return vertices.size(); -
code/trunk/src/libraries/tools/Mesh.cc
r8858 r11071 44 44 Mesh::Mesh() 45 45 { 46 this->entity_ = 0;46 this->entity_ = nullptr; 47 47 this->bCastShadows_ = true; 48 48 } … … 73 73 { 74 74 orxout(internal_error) << "Couldn't load mesh \"" << meshsource << '"' << endl; 75 this->entity_ = 0;75 this->entity_ = nullptr; 76 76 } 77 77 } -
code/trunk/src/libraries/tools/OgreBulletUtils.h
r10262 r11071 10 10 11 11 #include "tools/ToolsPrereqs.h" 12 #include <OgreVector3.h> 13 #include <OgreQuaternion.h> 14 #include <OgreColourValue.h> 15 #include <OgreMatrix3.h> 16 #include <OgreMatrix4.h> 12 17 13 18 namespace orxonox … … 42 47 inline Ogre::Matrix3 matrix3(const btMatrix3x3& matrix) 43 48 { 44 return Matrix3(49 return Ogre::Matrix3( 45 50 matrix[0][0], matrix[0][1], matrix[0][2], 46 51 matrix[1][0], matrix[1][1], matrix[1][2], -
code/trunk/src/libraries/tools/ParticleInterface.cc
r11052 r11071 59 59 60 60 this->scenemanager_ = scenemanager; 61 this->particleSystem_ = 0;61 this->particleSystem_ = nullptr; 62 62 63 63 this->bEnabled_ = true; … … 80 80 { 81 81 orxout(internal_error) << "Couldn't load particle system \"" << templateName << '"' << endl; 82 this->particleSystem_ = 0;82 this->particleSystem_ = nullptr; 83 83 } 84 84 } … … 110 110 } 111 111 else 112 return 0;112 return nullptr; 113 113 } 114 114 Ogre::ParticleEmitter* ParticleInterface::getEmitter(unsigned int emitterNr) const … … 117 117 return this->particleSystem_->getEmitter(emitterNr); 118 118 else 119 return 0;119 return nullptr; 120 120 } 121 121 void ParticleInterface::removeEmitter(unsigned int emitterNr) … … 142 142 return this->particleSystem_->addAffector(name); 143 143 else 144 return 0;144 return nullptr; 145 145 } 146 146 Ogre::ParticleAffector* ParticleInterface::getAffector(unsigned int affectorNr) … … 149 149 return this->particleSystem_->getAffector(affectorNr); 150 150 else 151 return 0;151 return nullptr; 152 152 } 153 153 void ParticleInterface::removeAffector(unsigned int affectorNr) -
code/trunk/src/libraries/tools/ParticleInterface.h
r11052 r11071 78 78 79 79 protected: 80 virtual void changedTimeFactor(float factor_new, float factor_old) ;80 virtual void changedTimeFactor(float factor_new, float factor_old) override; 81 81 82 82 private: -
code/trunk/src/libraries/tools/ResourceCollection.cc
r9667 r11071 48 48 } 49 49 50 ResourceCollection::~ResourceCollection()51 {52 }53 54 50 void ResourceCollection::XMLPort(Element& xmlelement, XMLPort::Mode mode) 55 51 { … … 93 89 { 94 90 if (index >= resourceLocations_.size()) 95 return NULL;91 return nullptr; 96 92 else 97 93 return resourceLocations_[index]; -
code/trunk/src/libraries/tools/ResourceCollection.h
r9667 r11071 42 42 public: 43 43 ResourceCollection(Context* context); 44 virtual ~ResourceCollection() ;44 virtual ~ResourceCollection() = default; 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 48 void setResourceGroup(const std::string& resourceGroup); … … 54 54 55 55 private: 56 ResourceCollection(const ResourceCollection&); 56 // non-copyable: 57 ResourceCollection(const ResourceCollection&) = delete; 58 ResourceCollection& operator=(const ResourceCollection&) = delete; 57 59 58 60 std::string resourceGroup_; -
code/trunk/src/libraries/tools/ResourceLocation.cc
r10624 r11071 54 54 } 55 55 56 ResourceLocation::~ResourceLocation()57 {58 }59 60 56 void ResourceLocation::XMLPort(Element& xmlelement, XMLPort::Mode mode) 61 57 { -
code/trunk/src/libraries/tools/ResourceLocation.h
r9667 r11071 44 44 public: 45 45 ResourceLocation(Context* context); 46 virtual ~ResourceLocation() ;46 virtual ~ResourceLocation() = default; 47 47 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 49 50 50 void setPath(const std::string& path) { path_ = path; } … … 60 60 61 61 private: 62 ResourceLocation(const ResourceLocation&); 62 // non-copyable: 63 ResourceLocation(const ResourceLocation&) = delete; 64 ResourceLocation& operator=(const ResourceLocation&) = delete; 63 65 64 66 void load(const std::string& resourceGroup); -
code/trunk/src/libraries/tools/Shader.cc
r10727 r11071 44 44 @brief Initializes the values and sets the scene manager. 45 45 */ 46 Shader::Shader(Ogre::SceneManager* scenemanager) : compositorInstance_( 0)46 Shader::Shader(Ogre::SceneManager* scenemanager) : compositorInstance_(nullptr) 47 47 { 48 48 RegisterObject(Shader); … … 109 109 { 110 110 // For the moment, we get the viewport always from the graphics manager 111 // TODO: Try to support multiple viewports - note however that scenemanager_->getCurrentViewport() returns NULL111 // TODO: Try to support multiple viewports - note however that scenemanager_->getCurrentViewport() returns nullptr 112 112 // after switching to a camera in a different scene (only for the first time this scene is displayed though) 113 113 this->changedCompositorName(GraphicsManager::getInstance().getViewport()); … … 127 127 Ogre::CompositorManager::getSingleton().removeCompositor(viewport, this->oldcompositorName_); 128 128 this->compositorInstance_->removeListener(this); 129 this->compositorInstance_ = 0;129 this->compositorInstance_ = nullptr; 130 130 } 131 131 if (!this->compositorName_.empty()) … … 197 197 { 198 198 // iterate through the list of parameters 199 for ( std::list<ParameterContainer>::iterator it = this->parameters_.begin(); it != this->parameters_.end(); ++it)200 { 201 Ogre::Technique* techniquePtr = materialPtr->getTechnique( it->technique_);199 for (const ParameterContainer& parameter : this->parameters_) 200 { 201 Ogre::Technique* techniquePtr = materialPtr->getTechnique(parameter.technique_); 202 202 if (techniquePtr) 203 203 { 204 Ogre::Pass* passPtr = techniquePtr->getPass( it->pass_);204 Ogre::Pass* passPtr = techniquePtr->getPass(parameter.pass_); 205 205 if (passPtr) 206 206 { 207 207 // change the value of the parameter depending on its type 208 if ( it->value_.isType<int>())209 passPtr->getFragmentProgramParameters()->setNamedConstant( it->parameter_, it->value_.get<int>());210 else if ( it->value_.isType<float>())211 passPtr->getFragmentProgramParameters()->setNamedConstant( it->parameter_, it->value_.get<float>());208 if (parameter.value_.isType<int>()) 209 passPtr->getFragmentProgramParameters()->setNamedConstant(parameter.parameter_, parameter.value_.get<int>()); 210 else if (parameter.value_.isType<float>()) 211 passPtr->getFragmentProgramParameters()->setNamedConstant(parameter.parameter_, parameter.value_.get<float>()); 212 212 } 213 213 else 214 orxout(internal_warning) << "No pass " << it->pass_ << " in technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << endl;214 orxout(internal_warning) << "No pass " << parameter.pass_ << " in technique " << parameter.technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << endl; 215 215 } 216 216 else 217 orxout(internal_warning) << "No technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or technique has no pass with shader." << endl;217 orxout(internal_warning) << "No technique " << parameter.technique_ << " in compositor \"" << this->compositorName_ << "\" or technique has no pass with shader." << endl; 218 218 } 219 219 this->parameters_.clear(); … … 228 228 { 229 229 const Ogre::Root::PluginInstanceList& plugins = Ogre::Root::getSingleton().getInstalledPlugins(); 230 for ( size_t i = 0; i < plugins.size(); ++i)231 if (plugin s[i]->getName() == "Cg Program Manager")230 for (Ogre::Plugin* plugin : plugins) 231 if (plugin->getName() == "Cg Program Manager") 232 232 return true; 233 233 } -
code/trunk/src/libraries/tools/Shader.h
r10727 r11071 48 48 { 49 49 public: 50 Shader(Ogre::SceneManager* scenemanager = 0);50 Shader(Ogre::SceneManager* scenemanager = nullptr); 51 51 virtual ~Shader(); 52 52 … … 87 87 { return this->scenemanager_; } 88 88 89 virtual void cameraChanged(Ogre::Viewport* viewport, Ogre::Camera* oldCamera) ;89 virtual void cameraChanged(Ogre::Viewport* viewport, Ogre::Camera* oldCamera) override; 90 90 91 91 void setParameter(unsigned short technique, unsigned short pass, const std::string& parameter, float value); 92 92 void setParameter(unsigned short technique, unsigned short pass, const std::string& parameter, int value); 93 93 94 virtual void notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr& materialPtr) ;94 virtual void notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr& materialPtr) override; 95 95 96 96 private: -
code/trunk/src/libraries/tools/TextureGenerator.cc
r10546 r11071 71 71 namespace orxonox 72 72 { 73 std::map<std::string, std::map<ColourValue, std::string> 73 std::map<std::string, std::map<ColourValue, std::string>> TextureGenerator::materials_s; 74 74 unsigned int TextureGenerator::materialCount_s = 0; 75 75 -
code/trunk/src/libraries/tools/TextureGenerator.h
r5781 r11071 49 49 50 50 private: 51 TextureGenerator(); 52 TextureGenerator(const TextureGenerator&); 53 ~TextureGenerator(); 51 // static class, no instances allowed: 52 TextureGenerator() = delete; 53 TextureGenerator(const TextureGenerator&) = delete; 54 TextureGenerator& operator=(const TextureGenerator&) = delete; 55 ~TextureGenerator() = delete; 54 56 55 static std::map<std::string, std::map<ColourValue, std::string> 57 static std::map<std::string, std::map<ColourValue, std::string>> materials_s; 56 58 static unsigned int materialCount_s; 57 59 }; -
code/trunk/src/libraries/tools/Timer.cc
r11018 r11071 163 163 void Timer::init() 164 164 { 165 this->executor_ = 0;165 this->executor_ = nullptr; 166 166 this->interval_ = 0; 167 167 this->bLoop_ = false; -
code/trunk/src/libraries/tools/Timer.h
r11018 r11071 175 175 176 176 protected: 177 virtual float getTimeFactor() ;177 virtual float getTimeFactor() override; 178 178 }; 179 179 } -
code/trunk/src/libraries/tools/interfaces/TimeFactorListener.h
r9667 r11071 39 39 public: 40 40 TimeFactorListener(); 41 virtual ~TimeFactorListener() {}41 virtual ~TimeFactorListener() = default; 42 42 43 43 static void setTimeFactor(float factor); -
code/trunk/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc
r10624 r11071 60 60 float oldFactor = TimeFactorListener::timefactor_s; 61 61 TimeFactorListener::timefactor_s = factor; 62 for ( ObjectList<TimeFactorListener>::iterator it = ObjectList<TimeFactorListener>::begin(); it != ObjectList<TimeFactorListener>::end(); ++it)63 it->changedTimeFactor(factor, oldFactor);62 for (TimeFactorListener* listener : ObjectList<TimeFactorListener>()) 63 listener->changedTimeFactor(factor, oldFactor); 64 64 } 65 65
Note: See TracChangeset
for help on using the changeset viewer.