Merge remote-tracking branch 'origin/master' into DDS

Conflicts:
	assets
This commit is contained in:
Teejoon
2016-03-14 06:10:30 +01:00
77 changed files with 38298 additions and 10880 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);
@@ -213,7 +213,6 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
}
}
EntityWrapper firstPersonModel = m_PlayerEntity.FirstChildByName("Hands");
if (firstPersonModel.Valid()) {
if (val > 0) { // Walk/Run
+2
View File
@@ -36,6 +36,7 @@
#include "Network/ESearchForServers.h"
#include "Network/EInterpolate.h"
#include "Network/SnapshotFilter.h"
#include "Core/EWin.h"
class Client : public Network
{
@@ -107,6 +108,7 @@ private:
void parseAmmoPickup(Packet& packet);
void parseRemoveWorld(Packet& packet);
void parseKDEvent(Packet& packet);
void parseWin(Packet& packet);
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
void parseSnapshot(Packet& packet);
void identifyPacketLoss();
+1
View File
@@ -25,6 +25,7 @@ enum class MessageType
AmmoPickup,
RemoveWorld,
KD,
Win,
Invalid
};
+12 -6
View File
@@ -16,15 +16,18 @@ 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 RawModel::Vertex* Vertices() const { return m_RawModel->Vertices(); }
unsigned int NumberOfVertices() const { return m_RawModel->NumVertices(); }
const std::vector<RawModel::MaterialProperties>& MaterialGroups() const { return m_Materials; }
unsigned int NumberOfVertices() const { return m_Vertices.size(); }
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;
@@ -34,6 +37,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);
+39 -16
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,22 +21,17 @@
#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);
public:
~RawModelCustom();
struct Vertex
{
struct RenderVertex {
glm::vec3 Position;
glm::vec3 Normal;
glm::vec3 Tangent;
@@ -43,7 +39,7 @@ public:
glm::vec2 TextureCoords;
};
struct SkinedVertex : public Vertex {
struct SkinedVertex : public RenderVertex {
glm::vec4 BoneIndices;
glm::vec4 BoneWeights;
};
@@ -91,7 +87,7 @@ public:
unsigned int ShaderID = 0;
};
const Vertex* Vertices() const {
const RenderVertex* Vertices() const {
if (hasSkin) {
return m_SkinedVertices.data();
} else {
@@ -99,16 +95,16 @@ public:
}
};
unsigned int VertexSize() const {
unsigned int VertexSize() const {
if (hasSkin) {
return sizeof(SkinedVertex);
}
else {
return sizeof(Vertex);
return sizeof(RenderVertex);
}
};
unsigned int NumVertices() const {
size_t NumVertices() const {
if (hasSkin) {
return m_SkinedVertices.size();
} else {
@@ -116,17 +112,39 @@ public:
}
};
const std::vector<unsigned int>& Indices() const {
return m_Indices;
}
bool IsSkinned() const { return hasSkin; };
const std::vector<glm::vec3>& CollisionVertices();
size_t NumCollisionVertices() const {
return m_CollisionVertices.size();
};
const std::vector<unsigned int>& CollisionIndices() const {
if (hasCollisionMesh) {
return m_CollisionIndices;
} else {
return m_Indices;
}
};
std::vector<MaterialProperties> m_Materials;
std::vector<unsigned int> m_Indices;
Skeleton* m_Skeleton = nullptr;
glm::mat4 m_Matrix;
private:
bool hasSkin;
std::vector<Vertex> m_Vertices;
bool hasCollisionMesh = false;
std::vector<unsigned int> m_Indices;
std::vector<unsigned int> m_CollisionIndices;
std::vector<glm::vec3> m_CollisionVertices;
std::vector<RenderVertex> m_Vertices;
std::vector<SkinedVertex> m_SkinedVertices;
void ReadMeshFile(std::string filePath);
@@ -149,7 +167,12 @@ private:
void ReadAnimationClips(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfClips);
void ReadAnimationClipSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int clipIndex);
void ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, std::vector<Skeleton::Animation::Keyframe>& animation);
void ReadCollisionFile(std::string filePath);
void ReadCollisionFileData(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
const std::vector<glm::vec3>& ConstructCollisionList();
//void CreateSkeleton(std::vector<std::tuple<std::string, glm::mat4>> &boneInfo, std::map<std::string, int> &boneNameMapping, aiNode* node, int parentID);
};
+1
View File
@@ -81,6 +81,7 @@ private:
void setSoundProperties(Source* source, ComponentWrapper* soundComponent);
float getDurationSeconds(Source* source);
float getTimeOffsetSeconds(Source* source);
void setTimeOffsetSeconds(Source* source, float timeOffset);
// Specific logic
void playSound(Source* source);