Browse Source

Removing a few boost things

Panagiotis Christopoulos Charitos 13 years ago
parent
commit
9c558c7b22

+ 0 - 1
include/anki/collision/CollisionShape.h

@@ -56,7 +56,6 @@ public:
 		virtual void visit(const Aabb&) = 0;
 	};
 
-
 	/// @name Constructors & destructor
 	/// @{
 	CollisionShape(CollisionShapeType cid_)

+ 2 - 3
include/anki/resource/Model.h

@@ -10,9 +10,8 @@
 
 namespace anki {
 
-/// Model patch interface class
-///
-/// Its very important class and it binds the material with the mesh
+/// Model patch interface class. Its very important class and it binds the
+/// material with the mesh
 class ModelPatchBase
 {
 public:

+ 0 - 6
include/anki/scene/Camera.h

@@ -6,10 +6,8 @@
 #include "anki/scene/Movable.h"
 #include "anki/scene/Frustumable.h"
 
-
 namespace anki {
 
-
 /// @addtogroup Scene
 /// @{
 
@@ -165,7 +163,6 @@ private:
 	}
 };
 
-
 /// Perspective camera
 class PerspectiveCamera: public Camera
 {
@@ -218,7 +215,6 @@ private:
 	ANKI_SLOT(updateFrustumSlot, const PerspectiveFrustum&)
 };
 
-
 /// Orthographic camera
 class OrthographicCamera: public Camera
 {
@@ -293,8 +289,6 @@ private:
 };
 /// @}
 
-
 } // end namespace
 
-
 #endif

+ 3 - 17
include/anki/scene/Renderable.h

@@ -3,19 +3,15 @@
 
 #include "anki/scene/Property.h"
 #include <vector>
-#include <boost/range/iterator_range.hpp>
-
 
 namespace anki {
 
-
 class ModelPatchBase;
 class Material;
 class MaterialVariable;
 class Light;
 class Transform;
 
-
 /// @addtogroup Scene
 /// @{
 
@@ -46,16 +42,11 @@ private:
 	bool buildin;
 };
 
-
-/// Renderable interface
-///
-/// Implemented by renderable scene nodes
+/// Renderable interface. Implemented by renderable scene nodes
 class Renderable
 {
 public:
 	typedef std::vector<PropertyBase*> Properties;
-	typedef boost::iterator_range<Properties::iterator> MutableRange;
-	typedef boost::iterator_range<Properties::const_iterator> ConstRange;
 
 	Renderable()
 	{}
@@ -75,14 +66,9 @@ public:
 		return nullptr;
 	}
 
-	MutableRange getProperties()
-	{
-		return MutableRange(props.begin(), props.end());
-	}
-
-	ConstRange getProperties() const
+	const Properties& getProperties() const
 	{
-		return ConstRange(props.begin(), props.end());
+		return props;
 	}
 
 protected:

+ 18 - 69
include/anki/scene/SkinNode.h

@@ -7,20 +7,14 @@
 #include "anki/scene/Spatial.h"
 #include "anki/resource/Model.h"
 #include "anki/math/Math.h"
-
-#include <boost/range/iterator_range.hpp>
 #include <vector>
-
+#include <array>
 
 namespace anki {
 
-
 class Skin;
 
-
-/// Skin specific mesh
-///
-/// It contains a number of VBOs for transform feedback
+/// Skin specific mesh. It contains a number of VBOs for transform feedback
 class SkinMesh: public MeshBase
 {
 public:
@@ -75,15 +69,13 @@ public:
 	/// @}
 
 private:
-	boost::array<Vbo, VBOS_TF_COUNT> tfVbos;
+	std::array<Vbo, VBOS_TF_COUNT> tfVbos;
 	const MeshBase* mesh; ///< The resource
 };
 
 
-/// Skin specific ModelPatch
-///
-/// It uses a SkinMesh to create the VAOs. It also creates a VAO for the
-/// transform feedback pass
+/// Skin specific ModelPatch. It uses a SkinMesh to create the VAOs. It also
+/// creates a VAO for the transform feedback pass
 class SkinModelPatch: public ModelPatchBase
 {
 public:
@@ -135,7 +127,7 @@ public:
 	/// @}
 
 private:
-	boost::scoped_ptr<SkinMesh> skinMesh;
+	std::unique_ptr<SkinMesh> skinMesh;
 	const ModelPatch* mpatch;
 	Vao tfVao; ///< Used as a source VAO in TFB
 };
@@ -211,30 +203,13 @@ public:
 	/// @}
 
 private:
-	boost::scoped_ptr<SkinModelPatch> skinModelPatch;
+	std::unique_ptr<SkinModelPatch> skinModelPatch;
 };
 
-
 /// A skin scene node
 class SkinNode: public SceneNode, public Movable
 {
 public:
-	template<typename T>
-	struct Types
-	{
-		typedef std::vector<T> Container;
-		typedef typename Container::iterator Iterator;
-		typedef typename Container::const_iterator ConstIterator;
-		typedef boost::iterator_range<Iterator> MutableRange;
-		typedef boost::iterator_range<ConstIterator> ConstRange;
-	};
-
-	typedef boost::ptr_vector<SkinPatchNode> PatchesContainer;
-	typedef boost::iterator_range<PatchesContainer::iterator>
-		PatchesMutableRange;
-	typedef boost::iterator_range<PatchesContainer::const_iterator>
-		PatchesConstRange;
-
 	/// @name Constructors/Destructor
 	/// @{
 	SkinNode(const char* skinFname,
@@ -267,53 +242,29 @@ public:
 
 	/// @name Accessors
 	/// @{
-	Types<Vec3>::ConstRange getHeads() const
-	{
-		return Types<Vec3>::ConstRange(heads.begin(), heads.end());
-	}
-	Types<Vec3>::MutableRange getHeads()
+	const std::vector<Vec3>& getHeads() const
 	{
-		return Types<Vec3>::MutableRange(heads.begin(), heads.end());
+		return heads;
 	}
 
-	Types<Vec3>::ConstRange getTails() const
+	const std::vector<Vec3>& getTails() const
 	{
-		return Types<Vec3>::ConstRange(tails.begin(), tails.end());
-	}
-	Types<Vec3>::MutableRange getTails()
-	{
-		return Types<Vec3>::MutableRange(tails.begin(), tails.end());
+		return tails;
 	}
 
-	Types<Mat3>::ConstRange getBoneRotations() const
+	const std::vector<Mat3>& getBoneRotations() const
 	{
-		return Types<Mat3>::ConstRange(boneRotations.begin(),
-			boneRotations.end());
-	}
-	Types<Mat3>::MutableRange getBoneRotations()
-	{
-		return Types<Mat3>::MutableRange(boneRotations.begin(),
-			boneRotations.end());
+		return boneRotations;
 	}
 
-	Types<Vec3>::ConstRange getBoneTranslations() const
-	{
-		return Types<Vec3>::ConstRange(boneTranslations.begin(),
-			boneTranslations.end());
-	}
-	Types<Vec3>::MutableRange getBoneTranslations()
+	const std::vector<Vec3>& getBoneTranslations() const
 	{
-		return Types<Vec3>::MutableRange(boneTranslations.begin(),
-			boneTranslations.end());
+		return boneTranslations;
 	}
 
-	PatchesConstRange getPatchNodes() const
-	{
-		return PatchesConstRange(patches.begin(), patches.end());
-	}
-	PatchesMutableRange getPatchNodes()
+	const boost::ptr_vector<SkinPatchNode>& getPatchNodes() const
 	{
-		return PatchesMutableRange(patches.begin(), patches.end());
+		return patches;
 	}
 
 	const Skin& getSkin() const
@@ -359,7 +310,7 @@ public:
 
 private:
 	SkinResourcePointer skin; ///< The resource
-	PatchesContainer patches;
+	boost::ptr_vector<SkinPatchNode> patches;
 	Obb visibilityShapeWSpace;
 
 	/// @name Animation stuff
@@ -396,8 +347,6 @@ private:
 		std::vector<Vec3>& heads, std::vector<Vec3>& tails);
 };
 
-
 } // end namespace
 
-
 #endif

+ 0 - 6
src/scene/Camera.cpp

@@ -1,9 +1,7 @@
 #include "anki/scene/Camera.h"
 
-
 namespace anki {
 
-
 //==============================================================================
 // Camera                                                                      =
 //==============================================================================
@@ -12,7 +10,6 @@ namespace anki {
 Camera::~Camera()
 {}
 
-
 //==============================================================================
 void Camera::lookAtPoint(const Vec3& point)
 {
@@ -26,7 +23,6 @@ void Camera::lookAtPoint(const Vec3& point)
 	setLocalRotation(rot);
 }
 
-
 //==============================================================================
 // PerspectiveCamera                                                           =
 //==============================================================================
@@ -44,7 +40,6 @@ PerspectiveCamera::PerspectiveCamera(const char* name, Scene* scene,
 	ANKI_CONNECT(prop, valueChanged, this, updateFrustumSlot);
 }
 
-
 //==============================================================================
 // OrthographicCamera                                                          =
 //==============================================================================
@@ -62,5 +57,4 @@ OrthographicCamera::OrthographicCamera(const char* name, Scene* scene,
 	ANKI_CONNECT(prop, valueChanged, this, updateFrustumSlot);
 }
 
-
 } // end namespace

+ 1 - 5
src/scene/Renderable.cpp

@@ -1,12 +1,10 @@
 #include "anki/scene/Renderable.h"
 #include "anki/resource/Material.h"
 #include "anki/resource/TextureResource.h"
-#include <boost/foreach.hpp>
-
+#include <boost/variant.hpp>
 
 namespace anki {
 
-
 //==============================================================================
 // CreateNewPropertyVisitor                                                    =
 //==============================================================================
@@ -31,7 +29,6 @@ struct CreateNewPropertyVisitor: boost::static_visitor<void>
 	}
 };
 
-
 //==============================================================================
 // Renderable                                                                  =
 //==============================================================================
@@ -52,5 +49,4 @@ void Renderable::init(PropertyMap& pmap)
 	}
 }
 
-
 }  // namespace anki

+ 14 - 29
src/scene/SkinNode.cpp

@@ -3,15 +3,11 @@
 #include "anki/resource/Skeleton.h"
 #include "anki/resource/SkelAnim.h"
 #include "anki/resource/MeshLoader.h"
-#include <boost/lexical_cast.hpp>
-
 
 namespace anki {
 
-
 #define BUFFER_OFFSET(i) ((char *)NULL + (i))
 
-
 //==============================================================================
 // SkinMesh                                                                    =
 //==============================================================================
@@ -21,18 +17,17 @@ const Vbo* SkinMesh::getVbo(VboId id) const
 {
 	switch(id)
 	{
-		case VBO_POSITIONS:
-			return &tfVbos[VBO_TF_POSITIONS];
-		case VBO_NORMALS:
-			return &tfVbos[VBO_TF_NORMALS];
-		case VBO_TANGENTS:
-			return &tfVbos[VBO_TF_TANGENTS];
-		default:
-			return mesh->getVbo(id);
+	case VBO_POSITIONS:
+		return &tfVbos[VBO_TF_POSITIONS];
+	case VBO_NORMALS:
+		return &tfVbos[VBO_TF_NORMALS];
+	case VBO_TANGENTS:
+		return &tfVbos[VBO_TF_TANGENTS];
+	default:
+		return mesh->getVbo(id);
 	}
 }
 
-
 //==============================================================================
 SkinMesh::SkinMesh(const MeshBase* mesh_)
 	: mesh(mesh_)
@@ -46,7 +41,7 @@ SkinMesh::SkinMesh(const MeshBase* mesh_)
 		tfVbos[VBO_TF_POSITIONS].create(
 			GL_ARRAY_BUFFER,
 			vbo->getSizeInBytes(),
-			NULL,
+			nullptr,
 			GL_STATIC_DRAW);
 	}
 
@@ -57,7 +52,7 @@ SkinMesh::SkinMesh(const MeshBase* mesh_)
 		tfVbos[VBO_TF_NORMALS].create(
 			GL_ARRAY_BUFFER,
 			vbo->getSizeInBytes(),
-			NULL,
+			nullptr,
 			GL_STATIC_DRAW);
 	}
 
@@ -68,12 +63,11 @@ SkinMesh::SkinMesh(const MeshBase* mesh_)
 		tfVbos[VBO_TF_TANGENTS].create(
 			GL_ARRAY_BUFFER,
 			vbo->getSizeInBytes(),
-			NULL,
+			nullptr,
 			GL_STATIC_DRAW);
 	}
 }
 
-
 //==============================================================================
 // SkinModelPatch                                                              =
 //==============================================================================
@@ -158,7 +152,6 @@ SkinModelPatch::SkinModelPatch(const ModelPatch* mpatch_)
 		BUFFER_OFFSET(20));
 }
 
-
 //==============================================================================
 // SkinPatchNode                                                               =
 //==============================================================================
@@ -175,7 +168,6 @@ SkinPatchNode::SkinPatchNode(const ModelPatch* modelPatch_,
 	Renderable::init(*this);
 }
 
-
 //==============================================================================
 // SkinNode                                                                    =
 //==============================================================================
@@ -192,7 +184,7 @@ SkinNode::SkinNode(const char* skinFname,
 	for(const ModelPatch& patch : skin->getModel().getModelPatches())
 	{
 		std::string name = skin.getResourceName()
-			+ boost::lexical_cast<std::string>(i);
+			+ std::to_string(i);
 
 		patches.push_back(new SkinPatchNode(&patch,
 			name.c_str(), scene,
@@ -207,12 +199,10 @@ SkinNode::SkinNode(const char* skinFname,
 	boneTranslations.resize(bonesNum);
 }
 
-
 //==============================================================================
 SkinNode::~SkinNode()
 {}
 
-
 //==============================================================================
 void SkinNode::movableUpdate()
 {
@@ -220,7 +210,6 @@ void SkinNode::movableUpdate()
 	visibilityShapeWSpace.transform(getWorldTransform());
 }
 
-
 //==============================================================================
 void SkinNode::frameUpdate(float prevUpdateTime, float crntTime, int f)
 {
@@ -249,7 +238,6 @@ void SkinNode::frameUpdate(float prevUpdateTime, float crntTime, int f)
 	    boneRotations, heads, tails);
 }
 
-
 //==============================================================================
 void SkinNode::interpolate(const SkelAnim& animation, float frame,
 	std::vector<Vec3>& boneTranslations, std::vector<Mat3>& boneRotations)
@@ -315,16 +303,15 @@ void SkinNode::interpolate(const SkelAnim& animation, float frame,
 	}
 }
 
-
 //==============================================================================
 void SkinNode::updateBoneTransforms(const Skeleton& skeleton,
 	std::vector<Vec3>& boneTranslations, std::vector<Mat3>& boneRotations)
 {
-	boost::array<uint, 128> queue;
+	std::array<uint, 128> queue;
 	uint head = 0, tail = 0;
 
 	// put the roots
-	BOOST_FOREACH(const Bone& bone, skeleton.getBones())
+	for(const Bone& bone : skeleton.getBones())
 	{
 		if(bone.getParent() == NULL)
 		{
@@ -374,7 +361,6 @@ void SkinNode::updateBoneTransforms(const Skeleton& skeleton,
 	}
 }
 
-
 //==============================================================================
 void SkinNode::deformHeadsTails(const Skeleton& skeleton,
     const std::vector<Vec3>& boneTranslations,
@@ -391,5 +377,4 @@ void SkinNode::deformHeadsTails(const Skeleton& skeleton,
 	}
 }
 
-
 } // end namespace