Merge branch 'MemoryOptimization' into Importer

# Conflicts:
#	include/Engine/Rendering/Model.h
#	src/Engine/Collision/Collision.cpp
#	src/Engine/Collision/CollisionSystem.cpp
#	src/Engine/Collision/TriggerSystem.cpp
#	src/Game/Systems/SpawnerSystem.cpp
This commit is contained in:
William Moberg
2016-03-14 02:06:53 +01:00
17 changed files with 91 additions and 89 deletions
+6 -6
View File
@@ -48,13 +48,13 @@ bool RayVsTriangle(const Ray& ray,
bool trueOnNegativeDistance = false);
//Return true if the ray hits any of the triangles in the model. Stops checking when a hit is detected.
bool RayVsModel(const Ray& ray,
const RawModel::Vertex* modelVertices,
const std::vector<glm::vec3>& modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix);
//Return true if the ray hits any of the triangles in the model.
//Also returns the position of the intersection point. Will loop through all the whole model indices.
bool RayVsModel(const Ray& ray,
const RawModel::Vertex* modelVertices,
const std::vector<glm::vec3>& modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& outHitPosition);
@@ -62,7 +62,7 @@ bool RayVsModel(const Ray& ray,
//Also returns the distance from the ray origin to the closest
//intersection point, and the barycentric u,v-coordinates. Will loop through all the whole model indices.
bool RayVsModel(const Ray& ray,
const RawModel::Vertex* modelVertices,
const std::vector<glm::vec3>& modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
float& outDistance,
@@ -70,7 +70,7 @@ bool RayVsModel(const Ray& ray,
float& outVCoord);
bool AABBvsTriangles(const AABB& box,
const RawModel::Vertex* modelVertices,
const std::vector<glm::vec3>& modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& boxVelocity,
@@ -80,7 +80,7 @@ bool AABBvsTriangles(const AABB& box,
//Detects collision, but does not resolve.
bool AABBvsTriangles(const AABB& box,
const RawModel::Vertex* modelVertices,
const std::vector<glm::vec3>& modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix);
@@ -92,7 +92,7 @@ enum Output
};
//Detects intersection and containment.
Output AABBvsTrianglesWContainment(const AABB& box,
const RawModel::Vertex* modelVertices,
const std::vector<glm::vec3>& modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix);
+16 -10
View File
@@ -16,21 +16,24 @@ private:
public:
~Model();
const std::vector<RawModel::MaterialProperties>& MaterialGroups() const { return m_RawModel->m_Materials; }
const glm::mat4& Matrix() const { return m_RawModel->m_Matrix; }
const std::vector<RawModel::MaterialProperties>& MaterialGroups() const { return m_Materials; }
//const RawModel::Vertex* Vertices() const { return m_RawModel->Vertices(); }
unsigned int NumberOfVertices() const { return m_Vertices.size(); }
//size_t NumberOfVertices() const { return m_RawModel->NumVertices(); }
//const std::vector<unsigned int>& Indices() const { return m_RawModel->Indices(); }
const RawModel::RenderVertex* Vertices() const { return m_RawModel->Vertices(); }
size_t NumberOfVertices() const { return m_RawModel->NumVertices(); }
const std::vector<unsigned int>& Indices() const { return m_RawModel->Indices(); }
const RawModel::Vertex* CollisionVertices() const { return m_RawModel->CollisionVertices(); }
const std::vector<unsigned int>& CollisionIndices() const { return m_RawModel->CollisionIndices(); }
//const RawModel::Vertex* CollisionVertices() const { return m_RawModel->CollisionVertices(); }
//const std::vector<unsigned int>& CollisionIndices() const { return m_RawModel->CollisionIndices(); }
const AABB& Box() const { return m_Box; }
bool IsSkinned() const { return m_RawModel->IsSkinned(); }
bool IsSkinned() const { return m_IsSkinned; }
GLuint VAO;
GLuint ElementBuffer;
RawModel* m_RawModel;
//RawModel* m_RawModel;
Skeleton* m_Skeleton = nullptr;
std::vector<glm::vec3> m_Vertices;
std::vector<unsigned int> m_Indices;
private:
AABB m_Box;
@@ -40,6 +43,9 @@ private:
GLuint TangentNormalsBuffer;
GLuint BiTangentNormalsBuffer;
GLuint TextureCoordBuffer;
std::vector<RawModel::MaterialProperties> m_Materials;
bool m_IsSkinned;
};
#endif
+1 -1
View File
@@ -110,7 +110,7 @@ struct ModelJob : RenderJob
}
if (model->IsSkinned()) {
Skeleton = Model->m_RawModel->m_Skeleton;
Skeleton = Model->m_Skeleton;
if (Skeleton != nullptr) {
EntityWrapper entityWrapper = EntityWrapper(world, modelComponent.EntityID);
+2 -5
View File
@@ -13,6 +13,7 @@
#include <boost/filesystem/path.hpp>
#include <boost/endian/buffers.hpp>
#include "../Common.h"
#include "../GLM.h"
#include "../Core/ResourceManager.h"
@@ -20,14 +21,10 @@
#include "Skeleton.h"
#include "ShaderProgram.h"
#include "boost\endian\buffers.hpp"
class RawModelCustom : public Resource
{
friend class ResourceManager;
friend class Model;
protected:
RawModelCustom(std::string fileName);