Commit for Pull

This commit is contained in:
antc13
2016-01-15 17:58:26 +01:00
parent 6317a6092d
commit 8437b9c734
9 changed files with 158 additions and 51 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
#include "Core/Ray.h"
#include "Core/AABB.h"
#include "Engine/Rendering/RawModel.h"
#include "Engine/Rendering/RawModelAssimp.h"
#include "Core/Entity.h"
class World;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef Model_h__
#define Model_h__
#include "RawModel.h"
#include "RawModelAssimp.h"
#include "../OpenGL.h"
class Model : public RawModel
@@ -1,5 +1,5 @@
#ifndef RawModel_h__
#define RawModel_h__
#ifndef RawModelAssimp_h__
#define RawModelAssimp_h__
#include <fstream>
#include <iostream>
@@ -23,7 +23,7 @@ class RawModel : public Resource
friend class ResourceManager;
protected:
RawModel(std::string fileName);
RawModel(std::string fileName);
public:
~RawModel();
@@ -33,14 +33,10 @@ public:
glm::vec3 Position;
glm::vec3 Normal;
glm::vec3 Tangent;
glm::vec3 BiTangent;
glm::vec3 BiNormal;
glm::vec2 TextureCoords;
glm::vec4 DiffuseVertexColor;
glm::vec4 SpecularVertexColor;
glm::vec4 BoneIndices1;
glm::vec4 BoneIndices2;
glm::vec4 BoneWeights1;
glm::vec4 BoneWeights2;
glm::vec4 BoneIndices;
glm::vec4 BoneWeights;
};
struct MaterialGroup
@@ -64,8 +60,6 @@ private:
std::vector<glm::ivec2> BoneIndices;
std::vector<glm::vec2> BoneWeights;
std::vector<glm::vec3> Normals;
std::vector<glm::vec4> DiffuseVertexColor;
std::vector<glm::vec4> SpecularVertexColor;
std::vector<glm::vec3> TangentNormals;
std::vector<glm::vec3> BiTangentNormals;
std::vector<glm::vec2> TextureCoords;
+68
View File
@@ -0,0 +1,68 @@
#ifndef RawModelCustom_h__
#define RawModelCustom_h__
#include <fstream>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <stack>
#include <boost/filesystem/path.hpp>
#include "../Common.h"
#include "../GLM.h"
#include "../Core/ResourceManager.h"
#include "Texture.h"
#include "Skeleton.h"
#include "boost\endian\buffers.hpp"
class RawModel : public Resource
{
friend class ResourceManager;
protected:
RawModel(std::string fileName);
public:
~RawModel();
struct Vertex
{
glm::vec3 Position;
glm::vec3 Normal;
glm::vec3 Tangent;
glm::vec3 BiNormal;
glm::vec2 TextureCoords;
glm::vec4 BoneIndices;
glm::vec4 BoneWeights;
};
struct MaterialGroup
{
float Shininess;
std::shared_ptr<::Texture> Texture;
std::shared_ptr<::Texture> NormalMap;
std::shared_ptr<::Texture> SpecularMap;
unsigned int StartIndex;
unsigned int EndIndex;
};
std::vector<MaterialGroup> TextureGroups;
std::vector<Vertex> m_Vertices;
std::vector<unsigned int> m_Indices;
Skeleton* m_Skeleton = nullptr;
glm::mat4 m_Matrix;
private:
bool ReadMeshFileHeader(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
bool ReadMesh(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
bool ReadVertices(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
bool ReadIndices(unsigned int& offset, char* fileData, unsigned int& fileByteSize);
//void CreateSkeleton(std::vector<std::tuple<std::string, glm::mat4>> &boneInfo, std::map<std::string, int> &boneNameMapping, aiNode* node, int parentID);
};
#endif