Merge remote-tracking branch 'origin/master' into Sound
This commit is contained in:
@@ -12,3 +12,6 @@ tools/MayaExporter/x64/Debug/
|
||||
|
||||
tools/MayaExporter/MayaExporter/Debug/
|
||||
tools/MayaExporter/MayaExporter/GeneratedFiles/
|
||||
|
||||
tools/MayaExporter/MayaExporter/x64/*
|
||||
tools/MayaExporter/x64/*
|
||||
|
||||
+1
-1
Submodule assets updated: 88b1b9f047...7531e441fe
@@ -64,7 +64,7 @@ bool RayVsModel(const Ray& ray,
|
||||
float& outVCoord);
|
||||
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const std::vector<RawModel::Vertex>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& boxVelocity,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Rendering/Model.h"
|
||||
#include "Rendering/EAnimationComplete.h"
|
||||
#include "Rendering/Skeleton.h"
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
class AnimationSystem : public PureSystem
|
||||
{
|
||||
@@ -22,8 +23,9 @@ public:
|
||||
~AnimationSystem() { }
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& animationComponent, double dt) override;
|
||||
private:
|
||||
|
||||
|
||||
float angle = 0.f;
|
||||
bool b_forward = false;
|
||||
char bone[100];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef BoneAttachmentSystem_h__
|
||||
#define BoneAttachmentSystem_h__
|
||||
|
||||
#include "GLM.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/ResourceManager.h"
|
||||
#include "Rendering/Model.h"
|
||||
#include "Rendering/Skeleton.h"
|
||||
|
||||
//Needs to be a higher orderlevel than AnimationSystem
|
||||
class BoneAttachmentSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
BoneAttachmentSystem(World* world, EventBroker* eventBroker)
|
||||
: System(world, eventBroker)
|
||||
, PureSystem("BoneAttachment")
|
||||
{
|
||||
|
||||
}
|
||||
~BoneAttachmentSystem() { }
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& BoneAttachmentComponent, double dt) override;
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -43,8 +43,8 @@ private:
|
||||
void BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene);
|
||||
void BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene);
|
||||
|
||||
void BindExplosionTextures(std::shared_ptr<ExplosionEffectJob>& job);
|
||||
void BindModelTextures(std::shared_ptr<ModelJob>& job);
|
||||
void BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job);
|
||||
void BindModelTextures(GLuint shaderHandle, std::shared_ptr<ModelJob>& job);
|
||||
|
||||
Texture* m_WhiteTexture;
|
||||
Texture* m_BlackTexture;
|
||||
@@ -68,8 +68,18 @@ private:
|
||||
|
||||
ShaderProgram* m_ForwardPlusProgram;
|
||||
ShaderProgram* m_ExplosionEffectProgram;
|
||||
ShaderProgram* m_ExplosionEffectSplatMapProgram;
|
||||
ShaderProgram* m_ForwardPlusSplatMapProgram;
|
||||
ShaderProgram* m_ShieldToStencilProgram;
|
||||
ShaderProgram* m_FillDepthBufferProgram;
|
||||
|
||||
|
||||
ShaderProgram* m_ForwardPlusSkinnedProgram;
|
||||
ShaderProgram* m_ExplosionEffectSkinnedProgram;
|
||||
ShaderProgram* m_ExplosionEffectSplatMapSkinnedProgram;
|
||||
ShaderProgram* m_ForwardPlusSplatMapSkinnedProgram;
|
||||
ShaderProgram* m_ShieldToStencilSkinnedProgram;
|
||||
ShaderProgram* m_FillDepthBufferSkinnedProgram;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
struct ExplosionEffectJob : ModelJob
|
||||
{
|
||||
ExplosionEffectJob(ComponentWrapper explosionEffectComponent, ::Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialGroup matGroup, ComponentWrapper modelComponent, ::World* world, glm::vec4 fillColor, float fillPercentage)
|
||||
ExplosionEffectJob(ComponentWrapper explosionEffectComponent, ::Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matGroup, ComponentWrapper modelComponent, ::World* world, glm::vec4 fillColor, float fillPercentage)
|
||||
: ModelJob(model, camera, matrix, matGroup, modelComponent, world, fillColor, fillPercentage)
|
||||
{
|
||||
ExplosionOrigin = (glm::vec3)explosionEffectComponent["ExplosionOrigin"];
|
||||
|
||||
@@ -15,11 +15,12 @@ private:
|
||||
|
||||
public:
|
||||
~Model();
|
||||
const std::vector<RawModel::MaterialGroup>& MaterialGroups() const { return m_RawModel->MaterialGroups; }
|
||||
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::Vertex>& Vertices() const { return m_RawModel->m_Vertices; }
|
||||
const RawModel::Vertex* Vertices() const { return m_RawModel->Vertices(); }
|
||||
unsigned int NumberOfVertices() const { return m_RawModel->NumVertices(); }
|
||||
const AABB& Box() const { return m_Box; }
|
||||
|
||||
bool IsSkinned() const { return m_RawModel->IsSkinned(); }
|
||||
GLuint VAO;
|
||||
GLuint ElementBuffer;
|
||||
RawModel* m_RawModel;
|
||||
|
||||
@@ -14,39 +14,98 @@
|
||||
#include "../Core/World.h"
|
||||
#include "../Core/Transform.h"
|
||||
#include "Skeleton.h"
|
||||
#include "ShaderProgram.h"
|
||||
|
||||
struct ModelJob : RenderJob
|
||||
{
|
||||
ModelJob(Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialGroup matGroup, ComponentWrapper modelComponent, World* world, glm::vec4 fillColor, float fillPercentage)
|
||||
ModelJob(Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matProp, ComponentWrapper modelComponent, World* world, glm::vec4 fillColor, float fillPercentage)
|
||||
: RenderJob()
|
||||
{
|
||||
Model = model;
|
||||
TextureID = (matGroup.Texture) ? matGroup.Texture->ResourceID : 0;
|
||||
if (modelComponent["DiffuseTexture"]) {
|
||||
DiffuseTexture = matGroup.Texture.get();
|
||||
} else {
|
||||
DiffuseTexture = nullptr;
|
||||
}
|
||||
if (modelComponent["NormalMap"]) {
|
||||
NormalTexture = matGroup.NormalMap.get();
|
||||
} else {
|
||||
NormalTexture = nullptr;
|
||||
}
|
||||
if (modelComponent["SpecularMap"]) {
|
||||
SpecularTexture = matGroup.SpecularMap.get();
|
||||
} else {
|
||||
SpecularTexture = nullptr;
|
||||
}
|
||||
if (modelComponent["GlowMap"]) {
|
||||
IncandescenceTexture = matGroup.IncandescenceMap.get();
|
||||
} else {
|
||||
IncandescenceTexture = nullptr;
|
||||
}
|
||||
DiffuseColor = matGroup.DiffuseColor;
|
||||
SpecularColor = matGroup.SpecularColor;
|
||||
IncandescenceColor = matGroup.IncandescenceColor;
|
||||
StartIndex = matGroup.StartIndex;
|
||||
EndIndex = matGroup.EndIndex;
|
||||
ModelID = model->ResourceID;
|
||||
Type = matProp.type;
|
||||
::RawModel::MaterialBasic* matGroup = matProp.material;
|
||||
switch(matProp.type){
|
||||
case ::RawModel::MaterialType::Basic:
|
||||
if (Model->IsSkinned()) {
|
||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSkinnedProgram")->ResourceID;
|
||||
}
|
||||
else {
|
||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusProgram")->ResourceID;
|
||||
}
|
||||
TextureID = 0;
|
||||
break;
|
||||
case ::RawModel::MaterialType::SingleTextures:
|
||||
{
|
||||
if (Model->IsSkinned()) {
|
||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSkinnedProgram")->ResourceID;
|
||||
}
|
||||
else {
|
||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusProgram")->ResourceID;
|
||||
}
|
||||
::RawModel::MaterialSingleTextures* singleTextures = static_cast<::RawModel::MaterialSingleTextures*>(matProp.material);
|
||||
TextureID = (singleTextures->ColorMap.Texture) ? singleTextures->ColorMap.Texture->ResourceID : 0;
|
||||
if (modelComponent["DiffuseTexture"]) {
|
||||
DiffuseTexture.push_back(&singleTextures->ColorMap);
|
||||
}
|
||||
|
||||
if (modelComponent["NormalMap"]) {
|
||||
NormalTexture.push_back(&singleTextures->NormalMap);
|
||||
}
|
||||
|
||||
if (modelComponent["SpecularMap"]) {
|
||||
SpecularTexture.push_back(&singleTextures->SpecularMap);
|
||||
}
|
||||
|
||||
if (modelComponent["GlowMap"]) {
|
||||
IncandescenceTexture.push_back(&singleTextures->IncandescenceMap);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ::RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
if (Model->IsSkinned()) {
|
||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapSkinnedProgram")->ResourceID;
|
||||
}
|
||||
else {
|
||||
ShaderID = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram")->ResourceID;
|
||||
}
|
||||
::RawModel::MaterialSplatMapping* SplatTextures = static_cast<::RawModel::MaterialSplatMapping*>(matProp.material);
|
||||
|
||||
SplatMap = &SplatTextures->SplatMap;
|
||||
|
||||
TextureID = (SplatTextures->ColorMaps[0].Texture) ? SplatTextures->ColorMaps[0].Texture->ResourceID : 0;
|
||||
if (modelComponent["DiffuseTexture"]) {
|
||||
for (auto& texture : SplatTextures->ColorMaps) {
|
||||
DiffuseTexture.push_back(&texture);
|
||||
}
|
||||
}
|
||||
|
||||
if (modelComponent["NormalMap"]) {
|
||||
for (auto& texture : SplatTextures->NormalMaps) {
|
||||
NormalTexture.push_back(&texture);
|
||||
}
|
||||
}
|
||||
|
||||
if (modelComponent["SpecularMap"]) {
|
||||
for (auto& texture : SplatTextures->SpecularMaps) {
|
||||
SpecularTexture.push_back(&texture);
|
||||
}
|
||||
}
|
||||
|
||||
if (modelComponent["GlowMap"]) {
|
||||
for (auto& texture : SplatTextures->IncandescenceMaps) {
|
||||
IncandescenceTexture.push_back(&texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
DiffuseColor = matGroup->DiffuseColor;
|
||||
SpecularColor = matGroup->SpecularColor;
|
||||
IncandescenceColor = matGroup->IncandescenceColor;
|
||||
StartIndex = matGroup->StartIndex;
|
||||
EndIndex = matGroup->EndIndex;
|
||||
Matrix = matrix;
|
||||
Color = modelComponent["Color"];
|
||||
Entity = modelComponent.EntityID;
|
||||
@@ -57,29 +116,56 @@ struct ModelJob : RenderJob
|
||||
|
||||
FillColor = fillColor;
|
||||
FillPercentage = fillPercentage;
|
||||
|
||||
Skeleton = Model->m_RawModel->m_Skeleton;
|
||||
|
||||
if (world->HasComponent(Entity, "Animation") && Skeleton != nullptr) {
|
||||
auto animationComponent = world->GetComponent(Entity, "Animation");
|
||||
Animation = model->m_RawModel->m_Skeleton->GetAnimation(animationComponent["Name"]);
|
||||
AnimationTime = (double)animationComponent["Time"];
|
||||
if (Skeleton != nullptr) {
|
||||
if (world->HasComponent(Entity, "Animation")) {
|
||||
auto animationComponent = world->GetComponent(Entity, "Animation");
|
||||
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
::Skeleton::AnimationData animationData;
|
||||
animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(animationComponent["AnimationName" + std::to_string(i)]);
|
||||
if (animationData.animation == nullptr) {
|
||||
continue;
|
||||
}
|
||||
animationData.time = (double)animationComponent["Time" + std::to_string(i)];
|
||||
animationData.weight = (double)animationComponent["Weight" + std::to_string(i)];
|
||||
|
||||
Animations.push_back(animationData);
|
||||
}
|
||||
}
|
||||
|
||||
if (world->HasComponent(Entity, "AnimationOffset")) {
|
||||
auto animationOffsetComponent = world->GetComponent(Entity, "AnimationOffset");
|
||||
AnimationOffset.animation = model->m_RawModel->m_Skeleton->GetAnimation(animationOffsetComponent["AnimationName"]);
|
||||
AnimationOffset.time = (double)animationOffsetComponent["Time"];
|
||||
} else {
|
||||
AnimationOffset.animation = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
unsigned int TextureID;
|
||||
unsigned int ShaderID;
|
||||
unsigned int ModelID;
|
||||
|
||||
::RawModel::MaterialType Type;
|
||||
EntityID Entity;
|
||||
glm::mat4 Matrix;
|
||||
const Texture* DiffuseTexture;
|
||||
const Texture* NormalTexture;
|
||||
const Texture* SpecularTexture;
|
||||
const Texture* IncandescenceTexture;
|
||||
const ::RawModel::TextureProperties* SplatMap;
|
||||
std::vector<const ::RawModel::TextureProperties*> DiffuseTexture;
|
||||
std::vector<const ::RawModel::TextureProperties*> NormalTexture;
|
||||
std::vector<const ::RawModel::TextureProperties*> SpecularTexture;
|
||||
std::vector<const ::RawModel::TextureProperties*> IncandescenceTexture;
|
||||
float Shininess = 0.f;
|
||||
glm::vec4 Color;
|
||||
const ::Model* Model = nullptr;
|
||||
::Skeleton* Skeleton = nullptr;
|
||||
const ::Skeleton::Animation* Animation = nullptr;
|
||||
// const ::Skeleton::Animation* Animation = nullptr;
|
||||
|
||||
std::vector<::Skeleton::AnimationData> Animations;
|
||||
::Skeleton::AnimationOffset AnimationOffset;
|
||||
|
||||
float AnimationTime = 0.f;
|
||||
|
||||
@@ -95,7 +181,7 @@ struct ModelJob : RenderJob
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
Hash = TextureID;
|
||||
Hash = TextureID + ModelID << 10 + ShaderID << 20;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ private:
|
||||
const IRenderer* m_Renderer;
|
||||
|
||||
ShaderProgram* m_PickingProgram;
|
||||
ShaderProgram* m_PickingSkinnedProgram;
|
||||
Camera* m_Camera;
|
||||
|
||||
struct PickingInfo
|
||||
|
||||
@@ -33,18 +33,27 @@ protected:
|
||||
public:
|
||||
~RawModelCustom();
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
glm::vec3 Position;
|
||||
glm::vec3 Normal;
|
||||
glm::vec3 Tangent;
|
||||
glm::vec3 BiNormal;
|
||||
glm::vec2 TextureCoords;
|
||||
struct Vertex
|
||||
{
|
||||
glm::vec3 Position;
|
||||
glm::vec3 Normal;
|
||||
glm::vec3 Tangent;
|
||||
glm::vec3 BiNormal;
|
||||
glm::vec2 TextureCoords;
|
||||
};
|
||||
|
||||
struct SkinedVertex : public Vertex {
|
||||
glm::vec4 BoneIndices;
|
||||
glm::vec4 BoneWeights;
|
||||
};
|
||||
|
||||
struct MaterialGroup
|
||||
struct TextureProperties {
|
||||
std::string TexturePath;
|
||||
glm::vec2 UVRepeat;
|
||||
std::shared_ptr<::Texture> Texture;
|
||||
};
|
||||
|
||||
struct MaterialBasic
|
||||
{
|
||||
float SpecularExponent;
|
||||
float ReflectionFactor;
|
||||
@@ -54,25 +63,69 @@ public:
|
||||
unsigned int StartIndex;
|
||||
unsigned int EndIndex;
|
||||
//float Transparency;
|
||||
std::string TexturePath;
|
||||
std::shared_ptr<::Texture> Texture;
|
||||
std::string NormalMapPath;
|
||||
std::shared_ptr<::Texture> NormalMap;
|
||||
std::string SpecularMapPath;
|
||||
std::shared_ptr<::Texture> SpecularMap;
|
||||
std::string IncandescenceMapPath;
|
||||
std::shared_ptr<::Texture> IncandescenceMap;
|
||||
};
|
||||
|
||||
std::vector<MaterialGroup> MaterialGroups;
|
||||
struct MaterialSplatMapping : public MaterialBasic
|
||||
{
|
||||
TextureProperties SplatMap;
|
||||
std::vector<TextureProperties> ColorMaps;
|
||||
std::vector<TextureProperties> NormalMaps;
|
||||
std::vector<TextureProperties> SpecularMaps;
|
||||
std::vector<TextureProperties> IncandescenceMaps;
|
||||
};
|
||||
|
||||
struct MaterialSingleTextures : public MaterialBasic
|
||||
{
|
||||
TextureProperties ColorMap;
|
||||
TextureProperties NormalMap;
|
||||
TextureProperties SpecularMap;
|
||||
TextureProperties IncandescenceMap;
|
||||
};
|
||||
|
||||
enum class MaterialType { Basic = 1, SplatMapping, SingleTextures };
|
||||
|
||||
struct MaterialProperties {
|
||||
MaterialType type;
|
||||
MaterialBasic* material;
|
||||
};
|
||||
|
||||
const Vertex* Vertices() const {
|
||||
if (hasSkin) {
|
||||
return m_SkinedVertices.data();
|
||||
} else {
|
||||
return m_Vertices.data();
|
||||
}
|
||||
};
|
||||
|
||||
unsigned int VertexSize() const {
|
||||
if (hasSkin) {
|
||||
return sizeof(SkinedVertex);
|
||||
}
|
||||
else {
|
||||
return sizeof(Vertex);
|
||||
}
|
||||
};
|
||||
|
||||
unsigned int NumVertices() const {
|
||||
if (hasSkin) {
|
||||
return m_SkinedVertices.size();
|
||||
} else {
|
||||
return m_Vertices.size();
|
||||
}
|
||||
};
|
||||
|
||||
bool IsSkinned() const { return hasSkin; };
|
||||
|
||||
std::vector<MaterialProperties> m_Materials;
|
||||
|
||||
std::vector<Vertex> m_Vertices;
|
||||
std::vector<unsigned int> m_Indices;
|
||||
Skeleton* m_Skeleton = nullptr;
|
||||
glm::mat4 m_Matrix;
|
||||
|
||||
private:
|
||||
|
||||
bool hasSkin;
|
||||
std::vector<Vertex> m_Vertices;
|
||||
std::vector<SkinedVertex> m_SkinedVertices;
|
||||
|
||||
void ReadMeshFile(std::string filePath);
|
||||
void ReadMeshFileHeader(std::size_t& offset, char* fileData);
|
||||
@@ -83,13 +136,17 @@ private:
|
||||
void ReadMaterialFile(std::string filePath);
|
||||
void ReadMaterials(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadMaterialSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadMaterialBasic(MaterialBasic* Material, std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadMaterialSingleTexture(MaterialSingleTextures* Material, std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadMaterialSplatMapping(MaterialSplatMapping* Material, std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadMaterialTextureProperties(TextureProperties& texture, std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
|
||||
void ReadAnimationFile(std::string filePath);
|
||||
void ReadAnimationBindPoses(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
void ReadAnimationJoint(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
|
||||
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, unsigned int numberOfJoints, Skeleton::Animation& animation);
|
||||
void ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, std::vector<Skeleton::Animation::Keyframe>& animation);
|
||||
|
||||
//void CreateSkeleton(std::vector<std::tuple<std::string, glm::mat4>> &boneInfo, std::map<std::string, int> &boneNameMapping, aiNode* node, int parentID);
|
||||
};
|
||||
|
||||
@@ -50,7 +50,6 @@ private:
|
||||
void fillLight(std::list<std::shared_ptr<RenderJob>>& jobs);
|
||||
bool isChildOfACamera(EntityWrapper entity);
|
||||
bool isChildOfCurrentCamera(EntityWrapper entity);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Common.h"
|
||||
#include "../GLM.h"
|
||||
#include <glm/gtx/matrix_decompose.hpp>
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
//struct Bone
|
||||
//{
|
||||
@@ -53,22 +54,39 @@ public:
|
||||
{
|
||||
struct BoneProperty
|
||||
{
|
||||
int ID;
|
||||
glm::vec3 Position;
|
||||
glm::quat Rotation;
|
||||
glm::vec3 Position;
|
||||
glm::quat Rotation;
|
||||
glm::vec3 Scale = glm::vec3(1);
|
||||
};
|
||||
|
||||
int Index = 0;
|
||||
double Time = 0.0;
|
||||
std::map<int, Keyframe::BoneProperty> BoneProperties;
|
||||
int Index = 0;
|
||||
double Time = 0.0;
|
||||
BoneProperty BoneProperties;
|
||||
};
|
||||
|
||||
std::string Name;
|
||||
double Duration;
|
||||
std::vector<Keyframe> Keyframes;
|
||||
std::string Name;
|
||||
double Duration;
|
||||
std::map<int, std::vector<Keyframe>> JointAnimations;
|
||||
};
|
||||
|
||||
struct AnimationData
|
||||
{
|
||||
const Animation* animation;
|
||||
float time;
|
||||
float weight;
|
||||
};
|
||||
|
||||
struct JointFrameTransform {
|
||||
glm::vec3 PositionInterp = glm::vec3(0);
|
||||
glm::quat RotationInterp = glm::quat();
|
||||
glm::vec3 ScaleInterp = glm::vec3(0);
|
||||
float Weight;
|
||||
};
|
||||
|
||||
struct AnimationOffset {
|
||||
const Animation* animation;
|
||||
float time;
|
||||
};
|
||||
|
||||
Skeleton() { }
|
||||
~Skeleton();
|
||||
|
||||
@@ -82,17 +100,27 @@ public:
|
||||
|
||||
int GetBoneID(std::string name);
|
||||
|
||||
const Animation* GetAnimation(std::string name);
|
||||
std::vector<glm::mat4> GetFrameBones(const Animation& animation, double time, bool noRootMotion = false);
|
||||
void AccumulateBoneTransforms(bool noRootMotion, const Animation::Keyframe& currentFrame, const Animation::Keyframe& nextFrame, float progress, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix);
|
||||
void PrintSkeleton();
|
||||
const Animation* GetAnimation(std::string name);
|
||||
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, bool noRootMotion = false);
|
||||
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion = false);
|
||||
|
||||
//void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, float time, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix);
|
||||
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix);
|
||||
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix);
|
||||
|
||||
void PrintSkeleton();
|
||||
void PrintSkeleton(const Bone* parent, int depthCount);
|
||||
std::map<std::string, Animation> Animations;
|
||||
|
||||
private:
|
||||
std::map<std::string, Bone*> m_BonesByName;
|
||||
glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix);
|
||||
int GetKeyframe(const Animation& animation, double time);
|
||||
|
||||
int GetKeyframe(const Animation& animation, double time);
|
||||
private:
|
||||
|
||||
glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset);
|
||||
|
||||
std::map<std::string, Bone*> m_BonesByName;
|
||||
float aim = 0.f;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,9 +28,11 @@
|
||||
<xs:include schemaLocation="Components/HealthHUD.xsd"/>
|
||||
<xs:include schemaLocation="Components/Animation.xsd"/>
|
||||
<xs:include schemaLocation="Components/Fill.xsd"/>
|
||||
<xs:include schemaLocation="Components/BoneAttachment.xsd"/>
|
||||
<xs:include schemaLocation="Components/Lifetime.xsd"/>
|
||||
<xs:include schemaLocation="Components/HiddenForLocalPlayer.xsd"/>
|
||||
<xs:include schemaLocation="Components/HealthPickup.xsd"/>
|
||||
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
||||
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
||||
<xs:include schemaLocation="Components/Shield.xsd"/>
|
||||
<xs:include schemaLocation="Components/Shielded.xsd"/>
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Animation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Animation.xsd">
|
||||
<Name></Name>
|
||||
<Time>0</Time>
|
||||
<Speed>0</Speed>
|
||||
<Loop>true</Loop>
|
||||
<AnimationName1></AnimationName1>
|
||||
<Weight1>1.0</Weight1>
|
||||
<Time1>0</Time1>
|
||||
<Speed1>0</Speed1>
|
||||
<Loop1>true</Loop1>
|
||||
<AnimationName2></AnimationName2>
|
||||
<Weight2>1.0</Weight2>
|
||||
<Time2>0</Time2>
|
||||
<Speed2>0</Speed2>
|
||||
<Loop2>true</Loop2>
|
||||
<AnimationName3></AnimationName3>
|
||||
<Weight3>1.0</Weight3>
|
||||
<Time3>0</Time3>
|
||||
<Speed3>0</Speed3>
|
||||
<Loop3>true</Loop3>
|
||||
</Animation>
|
||||
@@ -6,10 +6,21 @@
|
||||
<xs:element name="Animation">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Name" type="t:string" minOccurs="0"/>
|
||||
<xs:element name="Time" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Speed" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Loop" type="t:bool" minOccurs="0"/>
|
||||
<xs:element name="AnimationName1" type="t:string" minOccurs="0"/>
|
||||
<xs:element name="Weight1" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Time1" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Speed1" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Loop1" type="t:bool" minOccurs="0"/>
|
||||
<xs:element name="AnimationName2" type="t:string" minOccurs="0"/>
|
||||
<xs:element name="Weight2" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Time2" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Speed2" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Loop2" type="t:bool" minOccurs="0"/>
|
||||
<xs:element name="AnimationName3" type="t:string" minOccurs="0"/>
|
||||
<xs:element name="Weight3" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Time3" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Speed3" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Loop3" type="t:bool" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<AnimationOffset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AnimationOffset.xsd">
|
||||
<AnimationName></AnimationName>
|
||||
<Time>0</Time>
|
||||
</AnimationOffset>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||
|
||||
<xs:element name="AnimationOffset">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Aim animation offset for the skeleton</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="AnimationName" type="t:string" minOccurs="0"/>
|
||||
<xs:element name="Time" type="t:double" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<BoneAttachment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoneAttachment.xsd">
|
||||
<BoneName></BoneName>
|
||||
<PositionOffset X="0" Y="0" Z="0"/>
|
||||
<OrientationOffset X="0" Y="0" Z="0"/>
|
||||
<ScaleOffset X="1" Y="1" Z="1"/>
|
||||
<InheritPosition>true</InheritPosition>
|
||||
<InheritOrientation>true</InheritOrientation>
|
||||
<InheritScale>false</InheritScale>
|
||||
</BoneAttachment>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||
|
||||
<xs:element name="BoneAttachment">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="BoneName" type="t:string" minOccurs="0"/>
|
||||
<xs:element name="PositionOffset" type="t:Vector" minOccurs="0"/>
|
||||
<xs:element name="InheritPosition" type="t:bool" minOccurs="0"/>
|
||||
<xs:element name="OrientationOffset" type="t:Vector" minOccurs="0"/>
|
||||
<xs:element name="InheritOrientation" type="t:bool" minOccurs="0"/>
|
||||
<xs:element name="ScaleOffset" type="t:Vector" minOccurs="0"/>
|
||||
<xs:element name="InheritScale" type="t:bool" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -20,7 +20,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>models/dummyscene.mesh</Resource>
|
||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0" Z="0"/>
|
||||
@@ -31,7 +31,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>models/animtest.</Resource>
|
||||
<Resource>Models/Test/AnimTest.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.0966923237" Y="1.2939688" Z="0.399702221"/>
|
||||
@@ -42,7 +42,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>models/animTest.mesh</Resource>
|
||||
<Resource>Models/Test/AnimTest.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.31816244" Z="1.1888907"/>
|
||||
@@ -53,7 +53,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>models/animTest.mesh</Resource>
|
||||
<Resource>Models/Test/AnimTest.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.708824873" Y="1.30000007" Z="0"/>
|
||||
@@ -64,7 +64,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>models/animTest.mesh</Resource>
|
||||
<Resource>Models/Test/AnimTest.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="1.36948848" Y="1.20000005" Z="0"/>
|
||||
@@ -91,7 +91,7 @@
|
||||
<Axis X="0" Y="5" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="117.03714" Y="3023.50244" Z="3.03297734"/>
|
||||
<Orientation X="117.03714" Y="3077.6958" Z="3.03297734"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -154,7 +154,7 @@
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.100000001" Z="0"/>
|
||||
<Orientation X="0" Y="191.457993" Z="0"/>
|
||||
<Orientation X="0" Y="209.88414" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="AnimationTests" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitPlane.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-1.245" Z="0"/>
|
||||
<Scale X="10" Y="10" Z="10"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:DirectionalLight/>
|
||||
<c:Model>
|
||||
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="2.42800021" Z="-2.80000019"/>
|
||||
<Orientation X="5.51900005" Y="3.65100026" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName>Crouch</AnimationName>
|
||||
<Time>1.2451274133223826</Time>
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Model>
|
||||
<Resource>Models/Asstest.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-1.245" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="R_Leg_Top">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Leg_Top</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.0718467757" Y="0.479806602" Z="0.0548748523"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-0.431370437" Y="0.850169301" Z="-2.42601299"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Leg_Bottom">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Leg_Bottom</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.39332974" Y="0.324809998" Z="-0.0288445484"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="1.18491673" Y="1.0242362" Z="-2.26206946"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Foot">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Foot</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.305837631" Y="0.0361253619" Z="0.179315761"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="3.10044129e-07" Y="1.09664524" Z="-3.13675666"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Foot">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Foot</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.186916605" Y="0.0361250937" Z="-0.136036098"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="3.14159131" Y="-7.15255737e-07" Z="3.14159274"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Leg_Bottom">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Leg_Bottom</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.124794818" Y="0.343560517" Z="-0.32563746"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-2.66533947" Y="-0.187336028" Z="2.93550467"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Leg_Top">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Leg_Top</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.0666294992" Y="0.471828938" Z="0.0128124626"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="1.98675263" Y="0.0233680122" Z="2.87409353"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Hip">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Hip</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.00469498895" Y="0.512485623" Z="0.0200203825"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-3.03470659" Y="0.36588186" Z="-3.0760417"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Spine_1">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Spine_1</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.00108358753" Y="0.645309925" Z="0.00671719108"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-2.23578" Y="1.12130237" Z="-2.36199307"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Spine_2">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Spine_2</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.0091821691" Y="0.768297315" Z="-0.0377721936"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-1.92300212" Y="1.0594666" Z="-2.269871"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Spine_3">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Spine_3</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.0091821691" Y="0.768297315" Z="-0.0377721936"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-1.92300212" Y="1.0594666" Z="-2.269871"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Leg_Top">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Neck</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.0257265922" Y="0.835334301" Z="-0.0725377947"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-2.67842054" Y="0.0451255701" Z="2.97098374"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Shoulder">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Shoulder</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.0091821691" Y="0.768297315" Z="-0.0377721936"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-1.92300212" Y="1.0594666" Z="-2.269871"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Arm">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Arm</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.080665715" Y="0.757790864" Z="0.0217154976"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-0.990312934" Y="0.329345405" Z="-0.0508526377"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Elbow">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Elbow</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.160035357" Y="0.843445063" Z="0.00654693879"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-1.90130699" Y="-0.773362398" Z="1.06810308"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Hand">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Hand</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.238011926" Y="0.711740375" Z="-0.115170464"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-0.845395327" Y="0.765393734" Z="-0.237622365"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Chin">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Chin</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.0430049673" Y="0.916874766" Z="-0.143034652"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-2.96715546" Y="0.0551578514" Z="2.99139857"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Hand">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Hand</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.0662894994" Y="0.739402592" Z="-0.459511727"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-3.1153264" Y="-0.248137668" Z="-0.829112232"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Elbow">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Elbow</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.0279197786" Y="0.648010612" Z="-0.314551264"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="0.325028092" Y="1.40154743" Z="1.88795435"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="AnimationTests" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="-0.100000001" Y="-1.11500001" Z="-3.10500026"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:DirectionalLight/>
|
||||
<c:Model>
|
||||
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="2.42800021" Z="-2.80000019"/>
|
||||
<Orientation X="5.40800047" Y="3.65100026" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Wave">
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName1>Run</AnimationName1>
|
||||
<Weight1>0.5</Weight1>
|
||||
<Time1>0.23980116887997371</Time1>
|
||||
<Speed1>1</Speed1>
|
||||
<Speed2>1</Speed2>
|
||||
<AnimationName2>StrafeRight</AnimationName2>
|
||||
<Weight2>0.5</Weight2>
|
||||
<Time2>0.42593105566437428</Time2>
|
||||
<AnimationName3>ReloadSwitch</AnimationName3>
|
||||
<Time3>0.68855715986371058</Time3>
|
||||
<Speed3>1</Speed3>
|
||||
</c:Animation>
|
||||
<c:AnimationOffset>
|
||||
<AnimationName>AimRifle</AnimationName>
|
||||
</c:AnimationOffset>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||
<Color A="1" B="0.984313726" G="1" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.690088332" Y="0" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:PointLight>
|
||||
<Radius>10</Radius>
|
||||
</c:PointLight>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.0823108" Z="0.738871336"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitPlane.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Scale X="10" Y="1" Z="10"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -35,7 +35,7 @@
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultWeaponBlue.mesh</Resource>
|
||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1" Z="0"/>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="R_Leg_Top" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Leg_Top</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.0664939061" Y="0.714353919" Z="0.0475388765"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="-0.783109188" Y="-0.0050998251" Z="3.14151597"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children/>
|
||||
|
||||
</Entity>
|
||||
@@ -9,7 +9,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/DummyScene.mesh</Resource>
|
||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -41,7 +41,7 @@
|
||||
<HomePointForTeam>3</HomePointForTeam>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -61,7 +61,7 @@
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="1" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -81,7 +81,7 @@
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -102,7 +102,7 @@
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -120,7 +120,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0.482352942" G="0.490196079" R="1"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -138,7 +138,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.196078435" R="0.196078435"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/DummyScene.mesh</Resource>
|
||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -42,7 +42,7 @@
|
||||
<CaptureTimer>6.9158446328696002</CaptureTimer>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="1" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -63,7 +63,7 @@
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -83,7 +83,7 @@
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -104,7 +104,7 @@
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -122,7 +122,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0.482352942" G="0.490196079" R="1"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -140,7 +140,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.196078435" R="0.196078435"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/DummyScene.mesh</Resource>
|
||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -41,7 +41,7 @@
|
||||
<HomePointForTeam>3</HomePointForTeam>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -61,7 +61,7 @@
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
@@ -79,7 +79,7 @@
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="1" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
@@ -98,7 +98,7 @@
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -116,7 +116,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0.482352942" G="0.490196079" R="1"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -134,7 +134,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.196078435" R="0.196078435"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/DummyScene.mesh</Resource>
|
||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -41,7 +41,7 @@
|
||||
<HomePointForTeam>3</HomePointForTeam>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -61,7 +61,7 @@
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="1" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -81,7 +81,7 @@
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -101,7 +101,7 @@
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -122,7 +122,7 @@
|
||||
<CapturePointNumber>4</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -140,7 +140,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0.482352942" G="0.490196079" R="1"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -158,7 +158,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0.482352942" G="0.490196079" R="1"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -176,7 +176,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.196078435" R="0.196078435"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -194,7 +194,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.196078435" R="0.196078435"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/DummyScene.mesh</Resource>
|
||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -41,7 +41,7 @@
|
||||
<HomePointForTeam>3</HomePointForTeam>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -61,7 +61,7 @@
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
@@ -79,7 +79,7 @@
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
<c:Transform>
|
||||
@@ -96,7 +96,7 @@
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="1" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
@@ -115,7 +115,7 @@
|
||||
<CapturePointNumber>4</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -133,7 +133,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0.482352942" G="0.490196079" R="1"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -151,7 +151,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0.482352942" G="0.490196079" R="1"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -169,7 +169,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.196078435" R="0.196078435"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -187,7 +187,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.196078435" R="0.196078435"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</HomePointForTeam>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -39,7 +39,7 @@
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
@@ -57,7 +57,7 @@
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -79,7 +79,7 @@
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -104,7 +104,7 @@
|
||||
<CapturePointNumber>4</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -124,7 +124,7 @@
|
||||
<c:AABB/>
|
||||
<c:Health/>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
<c:Team>
|
||||
@@ -143,7 +143,7 @@
|
||||
<c:AABB/>
|
||||
<c:Health/>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\Core\UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
<c:Team>
|
||||
@@ -160,7 +160,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>C:\Users\123456\Workspace\TacticalZ\assets\Models\DummyScene.mesh</Resource>
|
||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.600000024" Y="0" Z="0"/>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<Intensity>0.80000001192092896</Intensity>
|
||||
</c:DirectionalLight>
|
||||
<c:Model>
|
||||
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
||||
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:RaptorCopter>
|
||||
<Speed>1</Speed>
|
||||
@@ -62,7 +62,7 @@
|
||||
<RandomnessScalar>3</RandomnessScalar>
|
||||
</c:ExplosionEffect>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-1.68900967" Y="0.527161121" Z="-1.59648728"/>
|
||||
@@ -73,7 +73,7 @@
|
||||
<Entity name="SecondaryWeapon">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultWeaponRed.mesh</Resource>
|
||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -86,7 +86,7 @@
|
||||
<Entity name="SecondaryWeaponRed">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/DefenderGunRed.mesh</Resource>
|
||||
<Resource>Models/Weapons/Red/DefenderGunRed.mesh</Resource>
|
||||
<Transparent>true</Transparent>
|
||||
<NormalMap>false</NormalMap>
|
||||
</c:Model>
|
||||
@@ -115,7 +115,7 @@
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Model>
|
||||
<Resource>models/AssaultAnimated.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.786919653" Y="0" Z="0"/>
|
||||
@@ -131,7 +131,7 @@
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Model>
|
||||
<Resource>models/AssaultAnimated.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -157,7 +157,7 @@
|
||||
<Entity name="Log">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Log.mesh</Resource>
|
||||
<Resource>Models/Props/TreeLog.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-4" Y="0.698000014" Z="-1"/>
|
||||
@@ -176,7 +176,7 @@
|
||||
<Entity name="CombinedSpheres">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>models/NormSpecIncdMapSphere.mesh</Resource>
|
||||
<Resource>Models/Test/NormSpecIncdMapSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -260,7 +260,7 @@
|
||||
<Entity name="NormalSphere">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/NormalMapSphere.mesh</Resource>
|
||||
<Resource>Models/Test/NormalMapSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="1.82700014" Y="0" Z="-0.166000009"/>
|
||||
@@ -271,7 +271,7 @@
|
||||
<Entity name="SpecularSphere">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/SpecularMapSphere.mesh</Resource>
|
||||
<Resource>Models/Test/SpecularMapSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-1.06487739" Y="0" Z="1.52336037"/>
|
||||
@@ -313,7 +313,7 @@
|
||||
<Entity name="GlowMap">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/IncandescenceMapSphere.mesh</Resource>
|
||||
<Resource>Models/Test/IncandescenceMapSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-1.10000002" Y="0" Z="-1.80000007"/>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<Axis X="1" Y="0" Z="0"/>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/RotationWidgetX.mesh</Resource>
|
||||
<Resource>Models/Widgets/Rotate/RotationWidgetX.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -33,7 +33,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/RotationWidgetY.mesh</Resource>
|
||||
<Resource>Models/Widgets/Rotate/RotationWidgetY.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -48,7 +48,7 @@
|
||||
<Axis X="0" Y="0" Z="1"/>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/RotationWidgetZ.mesh</Resource>
|
||||
<Resource>Models/Widgets/Rotate/RotationWidgetZ.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/ScaleWidgetOrigin.mesh</Resource>
|
||||
<Resource>Models/Widgets/Scale/ScalingWidgetOrigin.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
<c:UniformScale>
|
||||
@@ -20,7 +20,7 @@
|
||||
</Type>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/ScaleWidgetX.mesh</Resource>
|
||||
<Resource>Models/Widgets/Scale/ScalingWidgetX.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -34,7 +34,7 @@
|
||||
</Type>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/ScaleWidgetY.mesh</Resource>
|
||||
<Resource>Models/Widgets/Scale/ScalingWidgetY.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -48,7 +48,7 @@
|
||||
</Type>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/ScaleWidgetZ.mesh</Resource>
|
||||
<Resource>Models/Widgets/Scale/ScalingWidgetZ.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/TranslationWidgetOrigin.mesh</Resource>
|
||||
<Resource>Models/Widgets/Translate/TranslationWidgetOrigin.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
<c:UniformScale>
|
||||
@@ -18,7 +18,7 @@
|
||||
<Axis X="1" Y="0" Z="0"/>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/TranslationWidgetX.mesh</Resource>
|
||||
<Resource>Models/Widgets/Translate/TranslationWidgetX.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -30,7 +30,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/TranslationWidgetY.mesh</Resource>
|
||||
<Resource>Models/Widgets/Translate/TranslationWidgetY.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -42,7 +42,7 @@
|
||||
<Axis X="0" Y="0" Z="1"/>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/TranslationWidgetZ.mesh</Resource>
|
||||
<Resource>Models/Widgets/Translate/TranslationWidgetZ.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -54,7 +54,7 @@
|
||||
<Axis X="0" Y="1" Z="1"/>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/WidgetPlaneX.mesh</Resource>
|
||||
<Resource>Models/Widgets/Translate/TranslationWidgetPlaneX.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -66,7 +66,7 @@
|
||||
<Axis X="1" Y="0" Z="1"/>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/WidgetPlaneY.mesh</Resource>
|
||||
<Resource>Models/Widgets/Translate/TranslationWidgetPlaneY.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -78,7 +78,7 @@
|
||||
<Axis X="1" Y="1" Z="0"/>
|
||||
</c:EditorWidget>
|
||||
<c:Model>
|
||||
<Resource>Models/WidgetPlaneZ.mesh</Resource>
|
||||
<Resource>Models/Widgets/Translate/TranslationWidgetPlaneZ.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.00432979874" Z="0"/>
|
||||
<Position X="2.5629313" Y="-1.99438679" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
@@ -18,23 +18,17 @@
|
||||
<Axis X="1.50000012" Y="-2.20000005" Z="2.10000014"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="2.87819886" Z="0"/>
|
||||
<Position X="0.00367118185" Y="0" Z="0.200000003"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<Name>Run</Name>
|
||||
<Time>0.56277947897317659</Time>
|
||||
<Speed>1</Speed>
|
||||
<AnimationName>Crouch Walk</AnimationName>
|
||||
<Time>0.64462505387501778</Time>
|
||||
<Speed>8</Speed>
|
||||
</c:Animation>
|
||||
<c:ExplosionEffect>
|
||||
<Velocity X="0" Y="1.10000002" Z="3.30000019"/>
|
||||
<ExplosionOrigin X="-0.600000024" Y="1" Z="0"/>
|
||||
<TimeSinceDeath>0.95625903442123672</TimeSinceDeath>
|
||||
<EndColor A="0" B="0.815686285" G="1" R="0"/>
|
||||
</c:ExplosionEffect>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultAnimated.mesh</Resource>
|
||||
<Color A="1" B="392156.875" G="1" R="1"/>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</c:AABB>
|
||||
<c:Collidable/>
|
||||
<c:Model>
|
||||
<Resource>Models\MapVersion1.mesh</Resource>
|
||||
<Resource>Models/LevelBase/MapVersion1.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -26,7 +26,7 @@
|
||||
<Intensity>2</Intensity>
|
||||
</c:DirectionalLight>
|
||||
<c:Model>
|
||||
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
||||
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||
<Visible>false</Visible>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>models/animTest.mesh</Resource>
|
||||
<Resource>Models/Test/AnimTest.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -39,7 +39,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="0.0117647061" G="0" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -54,7 +54,7 @@
|
||||
<Components>
|
||||
<c:DirectionalLight/>
|
||||
<c:Model>
|
||||
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
||||
<Resource>sModels/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-6.00145912" Y="1.42697716" Z="3.04144025"/>
|
||||
@@ -96,7 +96,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.254901975" R="0"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -109,7 +109,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.254901975" R="0"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -171,7 +171,7 @@
|
||||
<Entity name="CameraModel">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Camera.mesh</Resource>
|
||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
|
||||
@@ -186,7 +186,7 @@
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Model>
|
||||
<Resource>Models/Camera.mesh</Resource>
|
||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||
<Visible>false</Visible>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -199,7 +199,7 @@
|
||||
<Entity name="PlayerModel">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultHeadless.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultHeadless.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
<Origin X="0" Y="0.772000015" Z="0"/>
|
||||
<Size X="1" Y="1.60000002" Z="1"/>
|
||||
</c:AABB>
|
||||
<c:DashAbility>
|
||||
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
|
||||
</c:DashAbility>
|
||||
<c:Collidable/>
|
||||
<c:Health/>
|
||||
<c:Physics>
|
||||
@@ -53,7 +50,7 @@
|
||||
<Entity name="CameraModel">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Camera.mesh</Resource>
|
||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||
<Visible>false</Visible>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -92,7 +89,7 @@
|
||||
<Entity name="Crosshair">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/CrosshairQuad.mesh</Resource>
|
||||
<Resource>Models/Weapons/CrosshairQuad.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.200000003"/>
|
||||
@@ -105,7 +102,7 @@
|
||||
<Entity name="Weapon">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultWeaponRed.mesh</Resource>
|
||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.180000007" Y="-0.183000013" Z="0"/>
|
||||
@@ -130,7 +127,7 @@
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Model>
|
||||
<Resource>Models/Camera.mesh</Resource>
|
||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||
<Visible>false</Visible>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -149,7 +146,7 @@
|
||||
</c:Animation>
|
||||
<c:HiddenForLocalPlayer/>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultAnimated.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
<Intensity>0.80000001192092896</Intensity>
|
||||
</c:DirectionalLight>
|
||||
<c:Model>
|
||||
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
||||
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:RaptorCopter>
|
||||
<Speed>1</Speed>
|
||||
@@ -126,7 +126,7 @@
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Model>
|
||||
<Resource>models/AssaultAnimated.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.786919653" Y="0" Z="0"/>
|
||||
@@ -142,7 +142,7 @@
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Model>
|
||||
<Resource>models/AssaultAnimated.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -200,7 +200,7 @@
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultAnimated.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.5" Z="0"/>
|
||||
@@ -224,7 +224,7 @@
|
||||
<Entity name="CombinedSpheres">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>models/NormSpecIncdMapSphere.mesh</Resource>
|
||||
<Resource>Models/Test/NormSpecIncdMapSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -308,7 +308,7 @@
|
||||
<Entity name="NormalSphere">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/NormalMapSphere.mesh</Resource>
|
||||
<Resource>Models/Test/NormalMapSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="1.82700014" Y="0" Z="-0.166000009"/>
|
||||
@@ -319,7 +319,7 @@
|
||||
<Entity name="SpecularSphere">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/SpecularMapSphere.mesh</Resource>
|
||||
<Resource>Models/Test/SpecularMapSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-1.06487739" Y="0" Z="1.52336037"/>
|
||||
@@ -361,7 +361,7 @@
|
||||
<Entity name="GlowMap">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/IncandescenceMapSphere.mesh</Resource>
|
||||
<Resource>Models/Test/IncandescenceMapSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-1.10000002" Y="0" Z="-1.80000007"/>
|
||||
@@ -422,7 +422,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -435,7 +435,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -448,7 +448,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -461,7 +461,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -493,7 +493,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="1" G="0" R="0"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -506,7 +506,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="1" G="0" R="0"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -519,7 +519,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="1" G="0" R="0"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -532,7 +532,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="1" G="0" R="0"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -608,7 +608,7 @@
|
||||
<Entity name="Assault">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="0.572549045" B="1" G="1" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
@@ -690,7 +690,7 @@
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultWeaponBlue.mesh</Resource>
|
||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1" Z="0"/>
|
||||
@@ -737,7 +737,7 @@
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultWeaponRed.mesh</Resource>
|
||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1" Z="0"/>
|
||||
@@ -797,7 +797,7 @@
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/SecondaryWeapon.mesh</Resource>
|
||||
<Resource>Models/Weapons/SecondaryWeapon.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1" Z="0"/>
|
||||
@@ -844,7 +844,7 @@
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/AssualtSoft.mesh</Resource>
|
||||
<Resource>Models/Test/AssaultTPoseSoftEdge.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.5" Z="0"/>
|
||||
@@ -890,7 +890,7 @@
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/DefenderGunBlue.mesh</Resource>
|
||||
<Resource>Models/Weapons/Blue/DefenderGunBlue.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1" Z="0"/>
|
||||
@@ -937,7 +937,7 @@
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/DefenderGunRed.mesh</Resource>
|
||||
<Resource>Models/Weapons/Red/DefenderGunRed.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1" Z="0"/>
|
||||
@@ -984,7 +984,7 @@
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Assualt.mesh</Resource>
|
||||
<Resource>Models/Test/AssaultTPoseHardEdge.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.5" Z="0"/>
|
||||
@@ -1021,7 +1021,7 @@
|
||||
<Entity name="RedTeamHomeCapturePoint">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/CapturePoint.mesh</Resource>
|
||||
<Resource>Models/Props/CapturePoint.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="-30"/>
|
||||
@@ -1073,7 +1073,7 @@
|
||||
<Entity name="RedMiddleCapturePoint">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/CapturePoint.mesh</Resource>
|
||||
<Resource>Models/Props/CapturePoint.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="-15"/>
|
||||
@@ -1119,7 +1119,7 @@
|
||||
<Entity name="MiddleCapturePoint">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/CapturePoint.mesh</Resource>
|
||||
<Resource>Models/Props/CapturePoint.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -1163,7 +1163,7 @@
|
||||
<Entity name="BlueMiddleCaapturePoint">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/CapturePoint.mesh</Resource>
|
||||
<Resource>Models/Props/CapturePoint.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="15"/>
|
||||
@@ -1210,7 +1210,7 @@
|
||||
<Entity name="BlueTeamHomeCapturePoint">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/CapturePoint.mesh</Resource>
|
||||
<Resource>Models/Props/CapturePoint.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="30"/>
|
||||
@@ -1405,7 +1405,7 @@
|
||||
<Randomness>true</Randomness>
|
||||
</c:ExplosionEffect>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultWeaponBlue.mesh</Resource>
|
||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -1458,7 +1458,7 @@
|
||||
<TimeSinceDeath>0.31711568080172703</TimeSinceDeath>
|
||||
</c:ExplosionEffect>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -1518,7 +1518,7 @@
|
||||
<Randomness>true</Randomness>
|
||||
</c:ExplosionEffect>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultAnimated.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<Lifetime>0.25</Lifetime>
|
||||
</c:Lifetime>
|
||||
<c:Model>
|
||||
<Resource>Models/CylinderBullet.mesh</Resource>
|
||||
<Resource>Models/Weapons/CylinderBullet.mesh</Resource>
|
||||
<Color A="0.156862751" B="39.2156868" G="7.84313726" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<Lifetime>0.25</Lifetime>
|
||||
</c:Lifetime>
|
||||
<c:Model>
|
||||
<Resource>Models/CylinderBullet.mesh</Resource>
|
||||
<Resource>Models/Weapons/CylinderBullet.mesh</Resource>
|
||||
<Color A="0.156862751" B="0" G="0.525490224" R="39.2156868"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<Entity name="Model">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.obj</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="3.92156863" G="3.92156863" R="3.92156863"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -35,7 +35,7 @@
|
||||
<FOV>80</FOV>
|
||||
</c:Camera>
|
||||
<c:Model>
|
||||
<Resource>Models/Camera.mesh</Resource>
|
||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.39121652" Z="-0.043014247"/>
|
||||
@@ -52,14 +52,15 @@
|
||||
<Children>
|
||||
<Entity name="Hexagon">
|
||||
<Components>
|
||||
<c:HealthHUD/>
|
||||
<c:Fill>
|
||||
<Percentage>0.65990006923675537</Percentage>
|
||||
<Color A="0" B="0.659900069" G="0" R="0.340099931"/>
|
||||
</c:Fill>
|
||||
<c:HealthHUD/>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitHexagon.mesh</Resource>
|
||||
<Color A="0.313725501" B="0.70588237" G="0.70588237" R="0.70588237"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.285538822" Y="-0.282350302" Z="-1.52214652e-05"/>
|
||||
@@ -132,7 +133,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="3.92156863" G="1" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -161,7 +162,7 @@
|
||||
<Axis X="0.200000003" Y="3.4000001" Z="0.5"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="758.058899" Y="20632.8691" Z="1320.68018"/>
|
||||
<Orientation X="948.868286" Y="23876.6914" Z="1797.71118"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -308,7 +309,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="3.92156863"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -324,7 +325,7 @@
|
||||
<Intensity>0.10000000149011612</Intensity>
|
||||
</c:DirectionalLight>
|
||||
<c:Model>
|
||||
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
||||
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||
<Color A="1" B="0" G="3.92156863" R="3.92156863"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
@@ -346,6 +347,20 @@
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName>Run</AnimationName>
|
||||
<Time>0.021910293579680166</Time>
|
||||
<Speed>0.004999999888241291</Speed>
|
||||
</c:Animation>
|
||||
<c:Model>
|
||||
<Resource>Models/SuperTest.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/DummyScene.mesh</Resource>
|
||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -41,7 +41,7 @@
|
||||
<HomePointForTeam>3</HomePointForTeam>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -61,7 +61,7 @@
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="0"/>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
@@ -79,7 +79,7 @@
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
<c:Transform>
|
||||
@@ -96,7 +96,7 @@
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="1" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
@@ -115,7 +115,7 @@
|
||||
<CapturePointNumber>4</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitSphere.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -133,7 +133,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0.482352942" G="0.490196079" R="1"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -151,7 +151,7 @@
|
||||
<c:Health/>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0.482352942" G="0.490196079" R="1"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -171,7 +171,7 @@
|
||||
</c:Health>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="2.25"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
@@ -191,7 +191,7 @@
|
||||
</c:Health>
|
||||
<c:AABB/>
|
||||
<c:Model>
|
||||
<Resource>../assets/Models/Core/UnitCube.mesh</Resource>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="4.5"/>
|
||||
</c:Model>
|
||||
<c:Player/>
|
||||
|
||||
@@ -0,0 +1,497 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="Skeleton" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity name="R_Arm_Weapon_Joint">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="0.996078432" B="1" G="1" R="19.6078434"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.47420007" Y="0.928898275" Z="0.0299553983"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.100000001"/>
|
||||
<Orientation X="1.60548508" Y="-1.10789871" Z="-1.51772225"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Hand">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Hand</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.448672563" Y="0.992614031" Z="0.0575723015"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="1.60548508" Y="-1.10789871" Z="-1.51772225"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Arm">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Arm</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.12972948" Y="1.28044498" Z="-0.0855199769"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.178462029" Y="-0.240202308" Z="-0.227051333"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Shoulder">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Shoulder</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.0566707924" Y="1.22090316" Z="-0.110467494"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.798247218" Y="0.000491484476" Z="-0.00077928009"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Neck">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Neck</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="19.6078434"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="6.88049477e-05" Y="1.29971886" Z="-0.151777163"/>
|
||||
<Scale X="0.0500000007" Y="0.100000001" Z="0.0500000007"/>
|
||||
<Orientation X="-1.03466523" Y="-0.0017389874" Z="0.00627749134"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Spine_3">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Spine_3</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="19.6078434"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.000299328996" Y="1.2487011" Z="-0.0936965123"/>
|
||||
<Scale X="0.0500000007" Y="0.100000001" Z="0.0500000007"/>
|
||||
<Orientation X="-0.798247218" Y="0.000491484476" Z="-0.00077928009"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Spine_2">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Spine_2</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="19.6078434"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.000528411241" Y="1.1669693" Z="0.000368326902"/>
|
||||
<Scale X="0.0500000007" Y="0.100000001" Z="0.0500000007"/>
|
||||
<Orientation X="-0.798247218" Y="0.000491484476" Z="-0.00077928009"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Spine_1">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Spine_1</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="19.6078434"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.000317580998" Y="1.03476369" Z="7.06899816e-17"/>
|
||||
<Scale X="0.0500000007" Y="0.100000001" Z="0.0500000007"/>
|
||||
<Orientation X="-0.168994248" Y="-0.000270629855" Z="-6.74916964e-06"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Hip">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Hip</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="19.6078434"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.901226044" Z="0"/>
|
||||
<Scale X="0.100000001" Y="0.0500000007" Z="0.0500000007"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Leg_Top">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Leg_Top</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.0735318959" Y="0.86343354" Z="0.00186898722"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="0.431212306" Y="-0.0456388369" Z="-0.00236316444"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Leg_Bottom">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Leg_Bottom</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.0971027464" Y="0.534537971" Z="-0.158307418"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.435873091" Y="0.0584642813" Z="-0.0526505522"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Foot">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Foot</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.136750847" Y="0.215778053" Z="0.0181705151"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-7.45058151e-06" Y="-4.34406102e-05" Z="-2.32085604e-05"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Toe">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Toe</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.142155826" Y="0.180158257" Z="-0.171162993"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-7.45058151e-06" Y="-4.34406102e-05" Z="-2.32085604e-05"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Shoulder">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Shoulder</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.0569540039" Y="1.22099173" Z="-0.110411651"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.798247218" Y="0.000491484476" Z="-0.00077928009"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Arm">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Arm</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.129911453" Y="1.28064728" Z="-0.0853923708"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="0.558630228" Y="-0.558619261" Z="-0.988305748"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Hand">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Hand</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.454215586" Y="1.41859245" Z="-0.370613039"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.931911349" Y="4.81306633e-05" Z="0.000111658264"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Shoulder_Armor_Joint">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Shoulder_Armor_Joint</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.138541639" Y="1.30872273" Z="-0.144261822"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.798247218" Y="0.000491484476" Z="-0.00077928009"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Chin">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Chin</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="19.6078434"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.00033863826" Y="1.2016536" Z="-0.251047492"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.931916714" Y="-9.67644155e-07" Z="2.18351502e-07"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Head">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Head</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="19.6078434"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.000338668207" Y="1.33565879" Z="-0.254856527"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.931916714" Y="-9.67644155e-07" Z="2.18351502e-07"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Perietal">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>Perietal</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="19.6078434"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.000338537793" Y="1.43159795" Z="-0.410463303"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.931916714" Y="-9.67644155e-07" Z="2.18351502e-07"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="L_Elbow">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Elbow</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.312942117" Y="1.35850036" Z="-0.246365055"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="0.353978485" Y="-0.15571253" Z="-0.903516531"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Leg_Bottom">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Leg_Bottom</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.105701312" Y="0.499459773" Z="0.030466903"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-1.02907228" Y="-0.0580535792" Z="0.116703011"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Elbow">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Elbow</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.309118003" Y="1.12181115" Z="0.00506293867"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.391992599" Y="-0.509281039" Z="-0.0413108058"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Leg_Top">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Leg_Top</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.074000001" Y="0.863433301" Z="0.00200000009"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.0984009728" Y="0.0146064674" Z="0.00352247525"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Foot">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Foot</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.139749736" Y="0.334264338" Z="0.356020123"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.000313894066" Y="0.00262229913" Z="0.00155029749"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Toe">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Toe</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.144308567" Y="0.298593462" Z="0.166685253"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.000313894066" Y="0.00262229913" Z="0.00155029749"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="R_Shoulder_Armor_Joint">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Shoulder_Armor_Joint</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.13872239" Y="1.30850673" Z="-0.144398093"/>
|
||||
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
|
||||
<Orientation X="-0.798247218" Y="0.000491484476" Z="-0.00077928009"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -19,7 +19,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="1" Y="0" Z="0"/>
|
||||
@@ -31,7 +31,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-1" Y="0" Z="0"/>
|
||||
@@ -43,7 +43,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="1"/>
|
||||
@@ -55,7 +55,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="-1"/>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Model>
|
||||
<Resource>Models/Assault.mesh</Resource>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="1.31625879" Y="0" Z="0"/>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:SceneLight/>
|
||||
<c:Model>
|
||||
<Resource>Models/Test/SplatMapTest.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -6,7 +6,7 @@
|
||||
<Orientation X="0" Y="0" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Model>
|
||||
<Resource>Models/DummyScene.mesh</Resource>
|
||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||
</c:Model>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -36,7 +36,7 @@
|
||||
<ExponentialAccelaration>0</ExponentialAccelaration>
|
||||
</c:ExplosionEffect>
|
||||
<c:Model>
|
||||
<Resource>Models/Camera.mesh</Resource>
|
||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||
</c:Model>
|
||||
</Components>
|
||||
</Entity>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitPlane.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Scale X="10" Y="10" Z="10"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:PlayerSpawn/>
|
||||
<c:Spawner>
|
||||
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
||||
</c:Spawner>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Red/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="Test" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
<Name>L_Foot</Name>
|
||||
<InheritScale>true</InheritScale>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.0863945931" Y="0.221357167" Z="-0.0781617165"/>
|
||||
<Scale X="0.199999973" Y="0.199999973" Z="0.199999973"/>
|
||||
<Orientation X="-2.80262542" Y="0.0150706368" Z="-3.13294244"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children/>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="Join" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>L_Elbow</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.359419018" Y="1.38182318" Z="-0.0848901421"/>
|
||||
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||
<Orientation X="0.281418264" Y="-0.0785565302" Z="-0.902501941"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children/>
|
||||
|
||||
</Entity>
|
||||
@@ -38,6 +38,7 @@
|
||||
<xs:element ref="c:HiddenForLocalPlayer" minOccurs="0"/>
|
||||
<xs:element ref="c:Fill" minOccurs="0"/>
|
||||
<xs:element ref="c:Animation" minOccurs="0"/>
|
||||
<xs:element ref="c:BoneAttachment" minOccurs="0"/>
|
||||
<xs:element ref="c:Shield" minOccurs="0"/>
|
||||
<xs:element ref="c:Shielded" minOccurs="0"/>
|
||||
</xs:all>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#version 430
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 Bones[100];
|
||||
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 5) in vec4 BoneIndices;
|
||||
layout(location = 6) in vec4 BoneWeights;
|
||||
|
||||
|
||||
|
||||
out VertexData{
|
||||
vec3 Position;
|
||||
}Output;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 boneTransform = mat4(1);
|
||||
|
||||
if(BoneWeights[0] > 0.0f){
|
||||
boneTransform = BoneWeights[0] * Bones[int(BoneIndices[0])]
|
||||
+ BoneWeights[1] * Bones[int(BoneIndices[1])]
|
||||
+ BoneWeights[2] * Bones[int(BoneIndices[2])]
|
||||
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
||||
}
|
||||
|
||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
||||
|
||||
Output.Position = vec3(0.0);
|
||||
}
|
||||
@@ -9,6 +9,11 @@ uniform vec2 ScreenDimensions;
|
||||
uniform vec4 FillColor;
|
||||
uniform vec4 AmbientColor;
|
||||
uniform float FillPercentage;
|
||||
|
||||
uniform vec2 DiffuseUVRepeat;
|
||||
uniform vec2 NormalUVRepeat;
|
||||
uniform vec2 SpecularUVRepeat;
|
||||
uniform vec2 GlowUVRepeat;
|
||||
layout (binding = 0) uniform sampler2D DiffuseTexture;
|
||||
layout (binding = 1) uniform sampler2D NormalMapTexture;
|
||||
layout (binding = 2) uniform sampler2D SpecularMapTexture;
|
||||
@@ -114,11 +119,11 @@ vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textu
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate);
|
||||
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate);
|
||||
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate);
|
||||
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
|
||||
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
||||
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
||||
vec4 position = V * M * vec4(Input.Position, 1.0);
|
||||
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, NormalMapTexture);
|
||||
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
|
||||
normal = normalize(normal);
|
||||
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
||||
vec4 viewVec = normalize(-position);
|
||||
|
||||
@@ -3,15 +3,12 @@
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 Bones[100];
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 2) in vec3 Tangent;
|
||||
layout(location = 3) in vec3 BiTangent;
|
||||
layout(location = 4) in vec2 TextureCoords;
|
||||
layout(location = 5) in vec4 BoneIndices;
|
||||
layout(location = 6) in vec4 BoneWeights;
|
||||
|
||||
out VertexData{
|
||||
vec3 Position;
|
||||
@@ -25,19 +22,9 @@ out VertexData{
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
|
||||
mat4 boneTransform = mat4(1);
|
||||
if(BoneWeights[0] > 0.0f){
|
||||
boneTransform = BoneWeights[0] * Bones[int(BoneIndices[0])]
|
||||
+ BoneWeights[1] * Bones[int(BoneIndices[1])]
|
||||
+ BoneWeights[2] * Bones[int(BoneIndices[2])]
|
||||
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
||||
}
|
||||
|
||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
||||
gl_Position = P*V*M * vec4(Position, 1.0);
|
||||
|
||||
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
||||
Output.Position = Position;
|
||||
Output.TextureCoordinate = TextureCoords;
|
||||
Output.Normal = vec3(M * vec4(Normal, 0.0));
|
||||
Output.Tangent = vec3(M * vec4(Tangent, 0.0));
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#version 430
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 Bones[100];
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 2) in vec3 Tangent;
|
||||
layout(location = 3) in vec3 BiTangent;
|
||||
layout(location = 4) in vec2 TextureCoords;
|
||||
layout(location = 5) in vec4 BoneIndices;
|
||||
layout(location = 6) in vec4 BoneWeights;
|
||||
|
||||
out VertexData{
|
||||
vec3 Position;
|
||||
vec3 Normal;
|
||||
vec3 Tangent;
|
||||
vec3 BiTangent;
|
||||
vec2 TextureCoordinate;
|
||||
vec4 ExplosionColor;
|
||||
float ExplosionPercentageElapsed;
|
||||
}Output;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 boneTransform = mat4(1);
|
||||
|
||||
if(BoneWeights[0] > 0.0f){
|
||||
boneTransform = BoneWeights[0] * Bones[int(BoneIndices[0])]
|
||||
+ BoneWeights[1] * Bones[int(BoneIndices[1])]
|
||||
+ BoneWeights[2] * Bones[int(BoneIndices[2])]
|
||||
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
||||
}
|
||||
|
||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
||||
|
||||
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
||||
Output.TextureCoordinate = TextureCoords;
|
||||
Output.Normal = vec3(M * boneTransform * vec4(Normal, 0.0));
|
||||
Output.Tangent = vec3(M * vec4(Tangent, 0.0));
|
||||
Output.BiTangent = vec3(M * vec4(BiTangent, 0.0));
|
||||
Output.ExplosionColor = vec4(1.0);
|
||||
Output.ExplosionPercentageElapsed = 0.0;
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
#version 430
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform vec2 ScreenDimensions;
|
||||
uniform float FillPercentage;
|
||||
uniform vec4 DiffuseColor;
|
||||
uniform vec4 FillColor;
|
||||
uniform vec4 Color;
|
||||
uniform vec4 AmbientColor;
|
||||
|
||||
//Get bineded at the same time as the textures
|
||||
uniform vec2 DiffuseUVRepeat1;
|
||||
uniform vec2 DiffuseUVRepeat2;
|
||||
uniform vec2 DiffuseUVRepeat3;
|
||||
uniform vec2 DiffuseUVRepeat4;
|
||||
uniform vec2 DiffuseUVRepeat5;
|
||||
uniform vec2 NormalUVRepeat1;
|
||||
uniform vec2 NormalUVRepeat2;
|
||||
uniform vec2 NormalUVRepeat3;
|
||||
uniform vec2 NormalUVRepeat4;
|
||||
uniform vec2 NormalUVRepeat5;
|
||||
uniform vec2 SpecularUVRepeat1;
|
||||
uniform vec2 SpecularUVRepeat2;
|
||||
uniform vec2 SpecularUVRepeat3;
|
||||
uniform vec2 SpecularUVRepeat4;
|
||||
uniform vec2 SpecularUVRepeat5;
|
||||
uniform vec2 GlowUVRepeat1;
|
||||
uniform vec2 GlowUVRepeat2;
|
||||
uniform vec2 GlowUVRepeat3;
|
||||
uniform vec2 GlowUVRepeat4;
|
||||
uniform vec2 GlowUVRepeat5;
|
||||
layout (binding = 0) uniform sampler2D SplatMapTexture;
|
||||
layout (binding = 1) uniform sampler2D DiffuseTexture1;
|
||||
layout (binding = 2) uniform sampler2D DiffuseTexture2;
|
||||
layout (binding = 3) uniform sampler2D DiffuseTexture3;
|
||||
layout (binding = 4) uniform sampler2D DiffuseTexture4;
|
||||
layout (binding = 5) uniform sampler2D DiffuseTexture5;
|
||||
layout (binding = 6) uniform sampler2D NormalMapTexture1;
|
||||
layout (binding = 7) uniform sampler2D NormalMapTexture2;
|
||||
layout (binding = 8) uniform sampler2D NormalMapTexture3;
|
||||
layout (binding = 9) uniform sampler2D NormalMapTexture4;
|
||||
layout (binding = 10) uniform sampler2D NormalMapTexture5;
|
||||
layout (binding = 11) uniform sampler2D SpecularMapTexture1;
|
||||
layout (binding = 12) uniform sampler2D SpecularMapTexture2;
|
||||
layout (binding = 13) uniform sampler2D SpecularMapTexture3;
|
||||
layout (binding = 14) uniform sampler2D SpecularMapTexture4;
|
||||
layout (binding = 15) uniform sampler2D SpecularMapTexture5;
|
||||
layout (binding = 16) uniform sampler2D GlowMapTexture1;
|
||||
layout (binding = 17) uniform sampler2D GlowMapTexture2;
|
||||
layout (binding = 18) uniform sampler2D GlowMapTexture3;
|
||||
layout (binding = 19) uniform sampler2D GlowMapTexture4;
|
||||
layout (binding = 20) uniform sampler2D GlowMapTexture5;
|
||||
|
||||
#define TILE_SIZE 16
|
||||
|
||||
struct LightSource {
|
||||
vec4 Position;
|
||||
vec4 Direction;
|
||||
vec4 Color;
|
||||
float Radius;
|
||||
float Intensity;
|
||||
float Falloff;
|
||||
int Type;
|
||||
};
|
||||
|
||||
layout (std430, binding = 1) buffer LightBuffer
|
||||
{
|
||||
LightSource List[];
|
||||
} LightSources;
|
||||
|
||||
struct LightGrid {
|
||||
float Start;
|
||||
float Amount;
|
||||
vec2 Padding;
|
||||
};
|
||||
|
||||
layout (std430, binding = 2) buffer LightGridBuffer
|
||||
{
|
||||
LightGrid Data[];
|
||||
} LightGrids;
|
||||
|
||||
layout (std430, binding = 4) buffer LightIndexBuffer
|
||||
{
|
||||
float LightIndex[];
|
||||
};
|
||||
|
||||
|
||||
in VertexData{
|
||||
vec3 Position;
|
||||
vec3 Normal;
|
||||
vec3 Tangent;
|
||||
vec3 BiTangent;
|
||||
vec2 TextureCoordinate;
|
||||
vec4 ExplosionColor;
|
||||
float ExplosionPercentageElapsed;
|
||||
}Input;
|
||||
|
||||
out vec4 sceneColor;
|
||||
out vec4 bloomColor;
|
||||
|
||||
struct LightResult {
|
||||
vec4 Diffuse;
|
||||
vec4 Specular;
|
||||
};
|
||||
|
||||
float CalcAttenuation(float radius, float dist, float falloff) {
|
||||
return 1.0 - smoothstep(radius * 0.3, radius, dist);
|
||||
}
|
||||
|
||||
vec4 CalcSpecular(vec4 lightColor, vec4 viewVec, vec4 lightVec, vec4 normal) {
|
||||
vec4 R = normalize( reflect(-lightVec, normal));
|
||||
float RdotV = max( dot(R, viewVec), 0.0);
|
||||
return lightColor * pow(RdotV, 90.0);
|
||||
}
|
||||
|
||||
vec4 CalcDiffuse(vec4 lightColor, vec4 lightVec, vec4 normal) {
|
||||
float power = max( dot(normal, lightVec), 0.0);
|
||||
return lightColor * power;
|
||||
}
|
||||
|
||||
LightResult CalcPointLightSource(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal, float falloff)
|
||||
{
|
||||
vec4 L = lightPos - position;
|
||||
float dist = length(L);
|
||||
L = normalize(L);
|
||||
|
||||
float attenuation = CalcAttenuation(lightRadius, dist, falloff);
|
||||
|
||||
LightResult result;
|
||||
result.Diffuse = CalcDiffuse(lightColor, L, normal) * attenuation * intensity;
|
||||
result.Specular = CalcSpecular(lightColor, viewVec, L, normal) * attenuation * intensity;
|
||||
return result;
|
||||
}
|
||||
|
||||
LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensity, vec4 viewVec, vec4 vertNormal)
|
||||
{
|
||||
vec4 L = normalize( -vec4(direction.xyz, 0) );
|
||||
|
||||
LightResult result;
|
||||
result.Diffuse = CalcDiffuse(color, L, vertNormal) * intensity;
|
||||
result.Specular = CalcSpecular(color, viewVec, L, vertNormal) * intensity;
|
||||
return result;
|
||||
}
|
||||
|
||||
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
|
||||
{
|
||||
mat3 TBN = mat3(tangent, bitangent, normal);
|
||||
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
|
||||
return vec4(TBN * normalize(NormalMap), 0.0);
|
||||
}
|
||||
|
||||
#define TEXTURE_TILE 5.0
|
||||
|
||||
vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B, sampler2D A, sampler2D D,
|
||||
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues, vec2 A_TileValues, vec2 D_TileValues){
|
||||
vec4 R_Channel = texture2D(R, Input.TextureCoordinate * R_TileValues);
|
||||
vec4 G_Channel = texture2D(G, Input.TextureCoordinate * G_TileValues);
|
||||
vec4 B_Channel = texture2D(B, Input.TextureCoordinate * B_TileValues);
|
||||
vec4 A_Channel = texture2D(A, Input.TextureCoordinate * A_TileValues);
|
||||
vec4 D_Channel = texture2D(D, Input.TextureCoordinate * D_TileValues);
|
||||
|
||||
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
|
||||
if(total > 1.0f){
|
||||
blendValue.r / total;
|
||||
blendValue.g / total;
|
||||
blendValue.b / total;
|
||||
blendValue.a / total;
|
||||
}
|
||||
float D_percent = clamp( 1.0f - total, 0.0f, 1.0f);
|
||||
|
||||
return blendValue.r * R_Channel
|
||||
+ blendValue.g * G_Channel
|
||||
+ blendValue.b * B_Channel
|
||||
+ blendValue.a * A_Channel
|
||||
+ D_percent * D_Channel;
|
||||
}
|
||||
|
||||
vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B, sampler2D A, sampler2D D,
|
||||
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues, vec2 A_TileValues, vec2 D_TileValues){
|
||||
mat3 TBN = mat3(Input.Tangent, Input.BiTangent, Input.Normal);
|
||||
vec3 R_Channel = texture(R, Input.TextureCoordinate * R_TileValues).xyz * 2.0 - vec3(1.0);
|
||||
vec3 G_Channel = texture(G, Input.TextureCoordinate * G_TileValues).xyz * 2.0 - vec3(1.0);
|
||||
vec3 B_Channel = texture(B, Input.TextureCoordinate * B_TileValues).xyz * 2.0 - vec3(1.0);
|
||||
vec3 A_Channel = texture(A, Input.TextureCoordinate * A_TileValues).xyz * 2.0 - vec3(1.0);
|
||||
vec3 D_Channel = texture(D, Input.TextureCoordinate * D_TileValues).xyz * 2.0 - vec3(1.0);
|
||||
|
||||
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
|
||||
if(total > 1.0f){
|
||||
blendValue.r / total;
|
||||
blendValue.g / total;
|
||||
blendValue.b / total;
|
||||
blendValue.a / total;
|
||||
}
|
||||
float D_percent = clamp( 1.0f - total, 0.0f, 1.0f);
|
||||
|
||||
vec3 Normal_result = blendValue.r * R_Channel
|
||||
+ blendValue.g * G_Channel
|
||||
+ blendValue.b * B_Channel
|
||||
+ blendValue.a * A_Channel
|
||||
+ D_percent * D_Channel;
|
||||
|
||||
return vec4(TBN * normalize(Normal_result), 0.0);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 splatTexel = texture2D(SplatMapTexture, Input.TextureCoordinate);
|
||||
|
||||
vec4 diffuseTexel = CalcBlendedTexel(splatTexel, DiffuseTexture1, DiffuseTexture2, DiffuseTexture3, DiffuseTexture4, DiffuseTexture5,
|
||||
DiffuseUVRepeat1, DiffuseUVRepeat2, DiffuseUVRepeat3, DiffuseUVRepeat4, DiffuseUVRepeat5);
|
||||
vec4 glowTexel = CalcBlendedTexel(splatTexel, GlowMapTexture1, GlowMapTexture2, GlowMapTexture3, GlowMapTexture4, GlowMapTexture5,
|
||||
GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3, GlowUVRepeat4, GlowUVRepeat5);
|
||||
vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3, SpecularMapTexture4, SpecularMapTexture5,
|
||||
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3, SpecularUVRepeat4, SpecularUVRepeat5);
|
||||
vec4 position = V * M * vec4(Input.Position, 1.0);
|
||||
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
|
||||
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3, NormalMapTexture4, NormalMapTexture5,
|
||||
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3, NormalUVRepeat4, NormalUVRepeat5);
|
||||
normal = normalize(normal);
|
||||
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
||||
vec4 viewVec = normalize(-position);
|
||||
|
||||
vec2 tilePos;
|
||||
tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
|
||||
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
||||
|
||||
LightResult totalLighting;
|
||||
totalLighting.Diffuse = vec4(AmbientColor.rgb, 1.0);
|
||||
int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE)));
|
||||
|
||||
int start = int(LightGrids.Data[currentTile].Start);
|
||||
int amount = int(LightGrids.Data[currentTile].Amount);
|
||||
|
||||
for(int i = start; i < start + amount; i++) {
|
||||
|
||||
int l = int(LightIndex[i]);
|
||||
LightSource light = LightSources.List[l];
|
||||
|
||||
LightResult light_result;
|
||||
//These if statements should be removed.
|
||||
if(light.Type == 1) { // point
|
||||
light_result = CalcPointLightSource(V * light.Position, light.Radius, light.Color, light.Intensity, viewVec, position, normal, light.Falloff);
|
||||
} else if (light.Type == 2) { //Directional
|
||||
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
||||
}
|
||||
totalLighting.Diffuse += light_result.Diffuse;
|
||||
totalLighting.Specular += light_result.Specular;
|
||||
}
|
||||
|
||||
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
||||
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
|
||||
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
|
||||
|
||||
|
||||
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
|
||||
|
||||
if(pos <= FillPercentage) {
|
||||
color_result += FillColor;
|
||||
}
|
||||
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||
color_result += glowTexel*3;
|
||||
|
||||
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
|
||||
|
||||
//Tiled Debug Code
|
||||
/*
|
||||
if(int(gl_FragCoord.x)%16 == 0 || int(gl_FragCoord.y)%16 == 0 ) {
|
||||
sceneColor += vec4(0.5, 0, 0, 0);
|
||||
} else {
|
||||
sceneColor += vec4(LightGrids.Data[int(tilePos.x + tilePos.y*80)].Amount/LightSources.List.length(), 0, 0, 1);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,12 @@
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 Bones[100];
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 2) in vec3 Tangent;
|
||||
layout(location = 3) in vec3 BiTangent;
|
||||
layout(location = 4) in vec2 TextureCoords;
|
||||
layout(location = 5) in vec4 BoneIndices;
|
||||
layout(location = 6) in vec4 BoneWeights;
|
||||
|
||||
out VertexData{
|
||||
vec3 Position;
|
||||
@@ -19,14 +16,6 @@ out VertexData{
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 boneTransform = mat4(1);
|
||||
if(BoneWeights[0] > 0.0f){
|
||||
boneTransform = BoneWeights[0] * Bones[int(BoneIndices[0])]
|
||||
+ BoneWeights[1] * Bones[int(BoneIndices[1])]
|
||||
+ BoneWeights[2] * Bones[int(BoneIndices[2])]
|
||||
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
||||
}
|
||||
|
||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
||||
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
||||
gl_Position = P*V*M * vec4(Position, 1.0);
|
||||
Output.Position = Position, 1.0;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#version 430
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 Bones[100];
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 2) in vec3 Tangent;
|
||||
layout(location = 3) in vec3 BiTangent;
|
||||
layout(location = 4) in vec2 TextureCoords;
|
||||
layout(location = 5) in vec4 BoneIndices;
|
||||
layout(location = 6) in vec4 BoneWeights;
|
||||
|
||||
out VertexData{
|
||||
vec3 Position;
|
||||
}Output;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 boneTransform = mat4(1);
|
||||
if(BoneWeights[0] > 0.0f){
|
||||
boneTransform = BoneWeights[0] * Bones[int(BoneIndices[0])]
|
||||
+ BoneWeights[1] * Bones[int(BoneIndices[1])]
|
||||
+ BoneWeights[2] * Bones[int(BoneIndices[2])]
|
||||
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
||||
}
|
||||
|
||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
||||
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#version 430
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
uniform mat4 Bones[100];
|
||||
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 5) in vec4 BoneIndices;
|
||||
layout(location = 6) in vec4 BoneWeights;
|
||||
|
||||
|
||||
|
||||
out VertexData{
|
||||
vec3 Position;
|
||||
}Output;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 boneTransform = mat4(1);
|
||||
|
||||
if(BoneWeights[0] > 0.0f){
|
||||
boneTransform = BoneWeights[0] * Bones[int(BoneIndices[0])]
|
||||
+ BoneWeights[1] * Bones[int(BoneIndices[1])]
|
||||
+ BoneWeights[2] * Bones[int(BoneIndices[2])]
|
||||
+ BoneWeights[3] * Bones[int(BoneIndices[3])];
|
||||
}
|
||||
|
||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
||||
|
||||
Output.Position = vec3(0.0);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#version 430
|
||||
|
||||
uniform vec4 Color;
|
||||
uniform vec4 FillColor;
|
||||
uniform float FillPercentage;
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
|
||||
layout (binding = 0) uniform sampler2D DiffuseTexture;
|
||||
layout (binding = 1) uniform sampler2D GlowMapTexture;
|
||||
|
||||
|
||||
in VertexData{
|
||||
vec3 Position;
|
||||
vec3 Normal;
|
||||
vec2 TextureCoordinate;
|
||||
}Input;
|
||||
|
||||
|
||||
out vec4 sceneColor;
|
||||
out vec4 bloomColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate);
|
||||
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate);
|
||||
|
||||
vec4 color_result = Color * diffuseTexel;
|
||||
|
||||
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
|
||||
if(pos <= FillPercentage) {
|
||||
color_result += FillColor;
|
||||
}
|
||||
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||
color_result += glowTexel*3;
|
||||
|
||||
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#version 430
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
layout(location = 1) in vec3 Normal;
|
||||
layout(location = 4) in vec2 TextureCoords;
|
||||
|
||||
out VertexData{
|
||||
vec3 Position;
|
||||
vec3 Normal;
|
||||
vec2 TextureCoordinate;
|
||||
}Output;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = P * M * vec4(Position, 1.0);
|
||||
|
||||
Output.Position = Position;
|
||||
Output.TextureCoordinate = TextureCoords;
|
||||
Output.Normal = Normal;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ bool RayVsTriangle(const Ray& ray,
|
||||
}
|
||||
outDistance = dist;
|
||||
outUCoord = glm::dot(m, DxE2) * DetInv;
|
||||
outVCoord = glm::dot(ray.Direction(), MxE1) * DetInv;
|
||||
outVCoord = glm::dot(ray.Direction(), MxE1) * DetInv;
|
||||
|
||||
//u,v can be very close to 0 but still negative sometimes. added a deltafactor to compensate for that problem
|
||||
//If u and v are positive, u+v <= 1, dist is positive, and less than closest.
|
||||
@@ -331,7 +331,7 @@ bool rectangleVsTriangle(const glm::vec2& boxMin,
|
||||
float push = rightRes < -leftRes ? rightRes : leftRes;
|
||||
float absPushSq = abs(push);
|
||||
absPushSq *= absPushSq;
|
||||
|
||||
|
||||
if (absPushSq < resolutionDistanceSq) {
|
||||
resolutionDistanceSq = absPushSq;
|
||||
resolutionDirection = push * normal;
|
||||
@@ -356,8 +356,8 @@ constexpr bool FaceIsGround(float faceNormalY)
|
||||
//An array containing 3 int pairs { 0, 2 }, { 0, 1 }, { 1, 2 }
|
||||
constexpr std::array<std::pair<int, int>, 3> dimensionPairs({ std::pair<int, int>(0, 2), std::pair<int, int>(0, 1), std::pair<int, int>(1, 2) });
|
||||
|
||||
bool AABBvsTriangle(const AABB& box,
|
||||
const std::array<glm::vec3, 3>& triPos,
|
||||
bool AABBvsTriangle(const AABB& box,
|
||||
const std::array<glm::vec3, 3>& triPos,
|
||||
const glm::vec3& originalBoxVelocity,
|
||||
float verticalStepHeight,
|
||||
bool& isOnGround,
|
||||
@@ -386,7 +386,7 @@ bool AABBvsTriangle(const AABB& box,
|
||||
Resolution()
|
||||
: DistanceSq(INFINITY)
|
||||
, Vector(0.f)
|
||||
{}
|
||||
{ }
|
||||
BoxTriResolveCase Case;
|
||||
float DistanceSq;
|
||||
glm::vec3 Vector;
|
||||
@@ -526,9 +526,9 @@ bool AABBvsTriangle(const AABB& box,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const std::vector<RawModel::Vertex>& modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& boxVelocity,
|
||||
float verticalStepHeight,
|
||||
@@ -612,4 +612,4 @@ boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity)
|
||||
return aabb;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
||||
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
|
||||
bool isOnGround = (bool)cPhysics["IsOnGround"];
|
||||
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
|
||||
if (Collision::AABBvsTriangles(boxA, model->m_Vertices, model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
|
||||
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
|
||||
(glm::vec3&)cTransform["Position"] += resolutionVector;
|
||||
cPhysics["Velocity"] = inOutVelocity;
|
||||
if (isOnGround) {
|
||||
|
||||
@@ -15,33 +15,39 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
||||
|
||||
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["Name"]);
|
||||
|
||||
if(animation != nullptr) {
|
||||
double animationSpeed = (double)animationComponent["Speed"];
|
||||
if(skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["AnimationName" + std::to_string(i)]);
|
||||
|
||||
if (animation == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
double animationSpeed = (double)animationComponent["Speed" + std::to_string(i)];
|
||||
|
||||
if (animationSpeed != 0.0) {
|
||||
double nextTime = (double)animationComponent["Time"] + animationSpeed * dt;
|
||||
double nextTime = (double)animationComponent["Time" + std::to_string(i)] + animationSpeed * dt;
|
||||
|
||||
|
||||
if (!(bool)animationComponent["Loop"] && glm::abs(nextTime) > animation->Duration) {
|
||||
(double&)animationComponent["Time"] = glm::sign(nextTime) * animation->Duration;
|
||||
(double&)animationComponent["Speed"] = 0.0;
|
||||
if (!(bool)animationComponent["Loop" + std::to_string(i)] && glm::abs(nextTime) > animation->Duration) {
|
||||
(double&)animationComponent["Time" + std::to_string(i)] = glm::sign(nextTime) * animation->Duration;
|
||||
(double&)animationComponent["Speed" + std::to_string(i)] = 0.0;
|
||||
Events::AnimationComplete e;
|
||||
e.Entity = entity;
|
||||
e.Name = (std::string)animationComponent["Name"];
|
||||
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
||||
m_EventBroker->Publish(e);
|
||||
} else {
|
||||
if (glm::abs(nextTime) > animation->Duration) {
|
||||
(double&)animationComponent["Time"] = glm::abs(nextTime) - animation->Duration;
|
||||
(double&)animationComponent["Time" + std::to_string(i)] = glm::abs(nextTime) - animation->Duration;
|
||||
} else {
|
||||
(double&)animationComponent["Time"] = nextTime;
|
||||
(double&)animationComponent["Time" + std::to_string(i)] = nextTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "Rendering/BoneAttachmentSystem.h"
|
||||
|
||||
void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& BoneAttachmentComponent, double dt)
|
||||
{
|
||||
|
||||
|
||||
if(!entity.HasComponent("Transform")) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto parent = entity.FirstParentWithComponent("Animation");
|
||||
if (!parent.HasComponent("Model")) {
|
||||
return;
|
||||
}
|
||||
Model* model;
|
||||
try {
|
||||
model = ResourceManager::Load<::Model, true>(parent["Model"]["Resource"]);
|
||||
} catch (const std::exception&) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
|
||||
if(skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(parent["Animation"]["AnimationName1"]);
|
||||
|
||||
if (!animation) {
|
||||
return;
|
||||
}
|
||||
|
||||
int id = skeleton->GetBoneID(entity["BoneAttachment"]["BoneName"]);
|
||||
|
||||
if(id == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
glm::mat4 boneTransform = skeleton->GetBoneTransform(skeleton->Bones[id], animation, (double)parent["Animation"]["Time1"], glm::mat4(1));
|
||||
|
||||
glm::vec3 scale;
|
||||
glm::quat rotation;
|
||||
glm::vec3 translation;
|
||||
glm::vec3 skew;
|
||||
glm::vec4 perspective;
|
||||
glm::decompose(boneTransform, scale, rotation, translation, skew, perspective);
|
||||
|
||||
glm::vec3 angles;
|
||||
angles.y = asin(-boneTransform[0][2]);
|
||||
if (cos(angles.y) != 0) {
|
||||
angles.x = atan2(boneTransform[1][2], boneTransform[2][2]);
|
||||
angles.z = atan2(boneTransform[0][1], boneTransform[0][0]);
|
||||
} else {
|
||||
angles.x = atan2(-boneTransform[2][0], boneTransform[1][1]);
|
||||
angles.z = 0;
|
||||
}
|
||||
|
||||
if ((bool)entity["BoneAttachment"]["InheritPosition"]) {
|
||||
(glm::vec3&)entity["Transform"]["Position"] = translation + (glm::vec3)entity["BoneAttachment"]["PositionOffset"];
|
||||
}
|
||||
if ((bool)entity["BoneAttachment"]["InheritOrientation"]) {
|
||||
(glm::vec3&)entity["Transform"]["Orientation"] = angles + (glm::vec3)entity["BoneAttachment"]["OrientationOffset"];
|
||||
}
|
||||
if ((bool)entity["BoneAttachment"]["InheritScale"]) {
|
||||
(glm::vec3&)entity["Transform"]["Scale"] = scale * (glm::vec3)entity["BoneAttachment"]["ScaleOffset"];
|
||||
}
|
||||
}
|
||||
@@ -77,8 +77,8 @@ void DrawBloomPass::Draw(GLuint texture)
|
||||
|
||||
glBindVertexArray(m_ScreenQuad->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
|
||||
//Iterate some times to make it more gaussian.
|
||||
for (int i = 1; i < m_iterations; i++) {
|
||||
@@ -90,8 +90,8 @@ void DrawBloomPass::Draw(GLuint texture)
|
||||
|
||||
glBindVertexArray(m_ScreenQuad->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
|
||||
//horizontal pass
|
||||
|
||||
@@ -102,8 +102,8 @@ void DrawBloomPass::Draw(GLuint texture)
|
||||
|
||||
glBindVertexArray(m_ScreenQuad->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
}
|
||||
|
||||
//final vertical gaussian after the iterations are done
|
||||
@@ -115,8 +115,8 @@ void DrawBloomPass::Draw(GLuint texture)
|
||||
|
||||
glBindVertexArray(m_ScreenQuad->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
|
||||
GLERROR("DrawBloomPass::Draw: END");
|
||||
}
|
||||
|
||||
@@ -40,6 +40,6 @@ void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLu
|
||||
|
||||
glBindVertexArray(m_ScreenQuad->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,62 @@ void DrawFinalPass::InitializeShaderPrograms()
|
||||
m_ExplosionEffectProgram->Link();
|
||||
GLERROR("Creating explosion program");
|
||||
|
||||
m_ForwardPlusSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram");
|
||||
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
||||
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
||||
m_ForwardPlusSplatMapProgram->Compile();
|
||||
m_ForwardPlusSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
||||
m_ForwardPlusSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
||||
m_ForwardPlusSplatMapProgram->Link();
|
||||
GLERROR("Creating Forward SplatMap program");
|
||||
|
||||
m_ExplosionEffectSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapProgram");
|
||||
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
||||
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
|
||||
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
||||
m_ExplosionEffectSplatMapProgram->Compile();
|
||||
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
||||
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
||||
m_ExplosionEffectSplatMapProgram->Link();
|
||||
GLERROR("Creating explosion SplatMap program");
|
||||
|
||||
m_ForwardPlusSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSkinnedProgram");
|
||||
m_ForwardPlusSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
||||
m_ForwardPlusSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlus.frag.glsl")));
|
||||
m_ForwardPlusSkinnedProgram->Compile();
|
||||
m_ForwardPlusSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
||||
m_ForwardPlusSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
||||
m_ForwardPlusSkinnedProgram->Link();
|
||||
GLERROR("Creating forward+ Skinned program");
|
||||
|
||||
m_ExplosionEffectSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSkinnedProgram");
|
||||
m_ExplosionEffectSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
||||
m_ExplosionEffectSkinnedProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
|
||||
m_ExplosionEffectSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlus.frag.glsl")));
|
||||
m_ExplosionEffectSkinnedProgram->Compile();
|
||||
m_ExplosionEffectSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
||||
m_ExplosionEffectSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
||||
m_ExplosionEffectSkinnedProgram->Link();
|
||||
GLERROR("Creating explosion Skinned program");
|
||||
|
||||
m_ExplosionEffectSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapSkinnedProgram");
|
||||
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
||||
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
||||
m_ExplosionEffectSplatMapSkinnedProgram->Compile();
|
||||
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
||||
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
||||
m_ExplosionEffectSplatMapSkinnedProgram->Link();
|
||||
GLERROR("Creating Forward SplatMap Skinned program");
|
||||
|
||||
m_ForwardPlusSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapSkinnedProgram");
|
||||
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
||||
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
||||
m_ForwardPlusSplatMapSkinnedProgram->Compile();
|
||||
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
||||
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
||||
m_ForwardPlusSplatMapSkinnedProgram->Link();
|
||||
GLERROR("Creating Forward SplatMap Skinned program");
|
||||
|
||||
m_ShieldToStencilProgram = ResourceManager::Load<ShaderProgram>("#ShieldToStencilProgram");
|
||||
m_ShieldToStencilProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ShieldStencil.vert.glsl")));
|
||||
m_ShieldToStencilProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ShieldStencil.frag.glsl")));
|
||||
@@ -86,12 +142,26 @@ void DrawFinalPass::InitializeShaderPrograms()
|
||||
m_ShieldToStencilProgram->Link();
|
||||
GLERROR("Creating Shield program");
|
||||
|
||||
m_ShieldToStencilSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ShieldToStencilProgramSkinned");
|
||||
m_ShieldToStencilSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ShieldStencilSkinned.vert.glsl")));
|
||||
m_ShieldToStencilSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ShieldStencil.frag.glsl")));
|
||||
m_ShieldToStencilSkinnedProgram->Compile();
|
||||
m_ShieldToStencilSkinnedProgram->Link();
|
||||
GLERROR("Creating Shield Skinned program");
|
||||
|
||||
m_FillDepthBufferProgram = ResourceManager::Load<ShaderProgram>("#FillDepthBufferProgram");
|
||||
m_FillDepthBufferProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FillDepthBuffer.vert.glsl")));
|
||||
m_FillDepthBufferProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/FillDepthBuffer.frag.glsl")));
|
||||
m_FillDepthBufferProgram->Compile();
|
||||
m_FillDepthBufferProgram->Link();
|
||||
GLERROR("Creating DepthFill program");
|
||||
|
||||
m_FillDepthBufferSkinnedProgram = ResourceManager::Load<ShaderProgram>("#FillDepthBufferProgramSkinned");
|
||||
m_FillDepthBufferSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FillDepthBufferSkinned.vert.glsl")));
|
||||
m_FillDepthBufferSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/FillDepthBuffer.frag.glsl")));
|
||||
m_FillDepthBufferSkinnedProgram->Compile();
|
||||
m_FillDepthBufferSkinnedProgram->Link();
|
||||
GLERROR("Creating DepthFill program");
|
||||
}
|
||||
|
||||
void DrawFinalPass::Draw(RenderScene& scene)
|
||||
@@ -125,11 +195,11 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
||||
//Draw Opaque shielded objects
|
||||
state->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
||||
state->StencilMask(0x00);
|
||||
DrawShieldedModelRenderQueue(scene.Jobs.OpaqueShieldedObjects, scene);
|
||||
DrawModelRenderQueues(scene.Jobs.OpaqueShieldedObjects, scene); //might need changing
|
||||
GLERROR("Shielded Opaque object");
|
||||
|
||||
//Draw Transparen Shielded objects
|
||||
DrawShieldedModelRenderQueue(scene.Jobs.TransparentShieldedObjects, scene);
|
||||
DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
|
||||
GLERROR("Shielded Transparent objects");
|
||||
|
||||
GLERROR("END");
|
||||
@@ -223,107 +293,205 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
||||
{
|
||||
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
|
||||
GLERROR("forwardHandle");
|
||||
GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle();
|
||||
GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle();
|
||||
GLERROR("explosionHandle");
|
||||
GLuint explosionSplatMapHandle = m_ExplosionEffectSplatMapProgram->GetHandle();
|
||||
GLERROR("explosionSplatMapHandle");
|
||||
GLuint forwardSplatHandle = m_ForwardPlusSplatMapProgram->GetHandle();
|
||||
GLERROR("forwardSplatHandle");
|
||||
GLuint forwardSkinnedHandle = m_ForwardPlusSkinnedProgram->GetHandle();
|
||||
GLERROR("forwardSkinnedHandle");
|
||||
GLuint explosionSkinnedHandle = m_ExplosionEffectSkinnedProgram->GetHandle();
|
||||
GLERROR("explosionSkinnedHandle");
|
||||
GLuint explosionSplatMapSkinnedHandle = m_ExplosionEffectSplatMapSkinnedProgram->GetHandle();
|
||||
GLERROR("explosionSplatMapSkinnedHandle");
|
||||
GLuint forwardSplatMapSkinnedHandle = m_ForwardPlusSplatMapSkinnedProgram->GetHandle();
|
||||
GLERROR("forwardSplatSkinnedHandle");
|
||||
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightCullingPass->LightSSBO());
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO());
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, m_LightCullingPass->LightIndexSSBO());
|
||||
|
||||
for(auto &job : jobs)
|
||||
{
|
||||
auto explosionEffectJob = std::dynamic_pointer_cast<ExplosionEffectJob>(job);
|
||||
if(explosionEffectJob) {
|
||||
//Bind program
|
||||
if(GLERROR("Prebind")) {
|
||||
continue;
|
||||
}
|
||||
m_ExplosionEffectProgram->Bind();
|
||||
if(GLERROR("BindProgram")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto &job : jobs) {
|
||||
auto explosionEffectJob = std::dynamic_pointer_cast<ExplosionEffectJob>(job);
|
||||
if (explosionEffectJob) {
|
||||
switch (explosionEffectJob->Type) {
|
||||
case RawModel::MaterialType::Basic:
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
{
|
||||
if (explosionEffectJob->Model->IsSkinned()) {
|
||||
m_ExplosionEffectSkinnedProgram->Bind();
|
||||
GLERROR("Bind ExplosionEffectSkinned program");
|
||||
//bind uniforms
|
||||
BindExplosionUniforms(explosionSkinnedHandle, explosionEffectJob, scene);
|
||||
//bind textures
|
||||
BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob);
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
} else {
|
||||
m_ExplosionEffectProgram->Bind();
|
||||
GLERROR("Bind ExplosionEffect program");
|
||||
//bind uniforms
|
||||
BindExplosionUniforms(explosionHandle, explosionEffectJob, scene);
|
||||
//bind textures
|
||||
BindExplosionTextures(explosionHandle, explosionEffectJob);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
if (explosionEffectJob->Model->IsSkinned()) {
|
||||
m_ExplosionEffectSplatMapSkinnedProgram->Bind();
|
||||
GLERROR("Bind ExplosionEffectSplatMapSkinned program");
|
||||
//bind uniforms
|
||||
BindExplosionUniforms(explosionSplatMapSkinnedHandle, explosionEffectJob, scene);
|
||||
//bind textures
|
||||
BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob);
|
||||
GLERROR("asdasd");
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
} else {
|
||||
m_ExplosionEffectSplatMapProgram->Bind();
|
||||
GLERROR("Bind ExplosionEffectSplatMap program");
|
||||
//bind uniforms
|
||||
//bind uniforms
|
||||
BindExplosionUniforms(explosionSplatMapHandle, explosionEffectJob, scene);
|
||||
//bind textures
|
||||
BindExplosionTextures(explosionSplatMapHandle, explosionEffectJob);
|
||||
GLERROR("asdasd");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
//Bind uniforms
|
||||
BindExplosionUniforms(explosionHandle, explosionEffectJob, scene);
|
||||
if(GLERROR("BindExplosionUniforms")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (explosionEffectJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
if (explosionEffectJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = explosionEffectJob->Skeleton->GetFrameBones(*explosionEffectJob->Animation, explosionEffectJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
}
|
||||
}
|
||||
if(GLERROR("Animation")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//bind textures
|
||||
BindExplosionTextures(explosionEffectJob);
|
||||
if(GLERROR("BindExplosionTextures")) {
|
||||
continue;
|
||||
}
|
||||
//draw
|
||||
glBindVertexArray(explosionEffectJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer);
|
||||
glDrawElements(GL_TRIANGLES, explosionEffectJob->EndIndex - explosionEffectJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(explosionEffectJob->StartIndex*sizeof(unsigned int)));
|
||||
glEnable(GL_CULL_FACE);
|
||||
if(GLERROR("explosion effect end")) {
|
||||
continue;
|
||||
}
|
||||
GLERROR("explosion effect end");
|
||||
} else {
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||
if (modelJob) {
|
||||
//bind forward program
|
||||
//TODO: JOHAN/TOBIAS: Bind shader based on ModelJob->ShaderID;
|
||||
switch (modelJob->Type) {
|
||||
case RawModel::MaterialType::Basic:
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
{
|
||||
if (modelJob->Model->IsSkinned()) {
|
||||
m_ForwardPlusSkinnedProgram->Bind();
|
||||
GLERROR("Bind ForwardPlusSkinnedProgram");
|
||||
//bind uniforms
|
||||
BindModelUniforms(forwardSkinnedHandle, modelJob, scene);
|
||||
//bind textures
|
||||
BindModelTextures(forwardSkinnedHandle, modelJob);
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
} else {
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||
if (modelJob) {
|
||||
//bind forward program
|
||||
m_ForwardPlusProgram->Bind();
|
||||
glUniform2f(glGetUniformLocation(forwardHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
|
||||
//bind uniforms
|
||||
BindModelUniforms(forwardHandle, modelJob, scene);
|
||||
|
||||
//bind textures
|
||||
BindModelTextures(modelJob);
|
||||
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
if (modelJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
} else {
|
||||
m_ForwardPlusProgram->Bind();
|
||||
GLERROR("Bind ForwardPlusProgram");
|
||||
//bind uniforms
|
||||
BindModelUniforms(forwardHandle, modelJob, scene);
|
||||
//bind textures
|
||||
BindModelTextures(forwardHandle, modelJob);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
if (modelJob->Model->IsSkinned()) {
|
||||
m_ForwardPlusSplatMapSkinnedProgram->Bind();
|
||||
GLERROR("Bind SplatMap program");
|
||||
//bind uniforms
|
||||
BindModelUniforms(forwardSplatMapSkinnedHandle, modelJob, scene);
|
||||
//bind textures
|
||||
BindModelTextures(forwardSplatMapSkinnedHandle, modelJob);
|
||||
GLERROR("asdasd");
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
//draw
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex*sizeof(unsigned int)));
|
||||
if(GLERROR("models end")) {
|
||||
continue;
|
||||
} else {
|
||||
m_ForwardPlusSplatMapProgram->Bind();
|
||||
GLERROR("Bind SplatMap program");
|
||||
//bind uniforms
|
||||
BindModelUniforms(forwardSplatHandle, modelJob, scene);
|
||||
//bind textures
|
||||
BindModelTextures(forwardSplatHandle, modelJob);
|
||||
GLERROR("asdasd");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//draw
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex*sizeof(unsigned int)));
|
||||
if (GLERROR("models end")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DrawFinalPass::DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
|
||||
{
|
||||
m_ShieldToStencilProgram->Bind();
|
||||
GLuint shaderHandle = m_ShieldToStencilProgram->GetHandle();
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
|
||||
for (auto &job : jobs) {
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||
if (modelJob) {
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
|
||||
if(modelJob->Model->IsSkinned()) {
|
||||
m_ShieldToStencilSkinnedProgram->Bind();
|
||||
GLuint shaderHandle = m_ShieldToStencilSkinnedProgram->GetHandle();
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
} else {
|
||||
m_ShieldToStencilProgram->Bind();
|
||||
GLuint shaderHandle = m_ShieldToStencilProgram->GetHandle();
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
|
||||
}
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||
@@ -366,19 +534,20 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
|
||||
continue;
|
||||
}
|
||||
|
||||
if (explosionEffectJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
if (explosionEffectJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = explosionEffectJob->Skeleton->GetFrameBones(*explosionEffectJob->Animation, explosionEffectJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
}
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
if (GLERROR("Animation")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//bind textures
|
||||
BindExplosionTextures(explosionEffectJob);
|
||||
BindExplosionTextures(explosionHandle, explosionEffectJob);
|
||||
if (GLERROR("BindExplosionTextures")) {
|
||||
continue;
|
||||
}
|
||||
@@ -402,15 +571,16 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
|
||||
BindModelUniforms(forwardHandle, modelJob, scene);
|
||||
|
||||
//bind textures
|
||||
BindModelTextures(modelJob);
|
||||
BindModelTextures(forwardHandle ,modelJob);
|
||||
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
if (modelJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
}
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
|
||||
//draw
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
@@ -427,25 +597,35 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
|
||||
|
||||
void DrawFinalPass::DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
|
||||
{
|
||||
m_FillDepthBufferProgram->Bind();
|
||||
GLuint shaderHandle = m_FillDepthBufferProgram->GetHandle();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
|
||||
|
||||
|
||||
for (auto &job : jobs) {
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||
|
||||
//bind uniforms
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
if(modelJob->Model->IsSkinned()) {
|
||||
m_FillDepthBufferSkinnedProgram->Bind();
|
||||
GLuint shaderHandle = m_FillDepthBufferSkinnedProgram->GetHandle();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
if (modelJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
} else {
|
||||
m_FillDepthBufferProgram->Bind();
|
||||
GLuint shaderHandle = m_FillDepthBufferProgram->GetHandle();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
}
|
||||
|
||||
|
||||
//draw
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||
@@ -459,108 +639,314 @@ void DrawFinalPass::DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& job
|
||||
|
||||
void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene)
|
||||
{
|
||||
GLERROR("Bind 1 uniform");
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix));
|
||||
GLERROR("Bind 2 uniform");
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
GLERROR("Bind 3 uniform");
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
GLERROR("Bind 4 uniform");
|
||||
|
||||
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
|
||||
GLERROR("Bind 5 uniform");
|
||||
|
||||
glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin));
|
||||
GLERROR("Bind 6 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), job->TimeSinceDeath);
|
||||
GLERROR("Bind 7 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "ExplosionDuration"), job->ExplosionDuration);
|
||||
GLERROR("Bind 8 uniform");
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "EndColor"), 1, glm::value_ptr(job->EndColor));
|
||||
GLERROR("Bind 9 uniform");
|
||||
glUniform1i(glGetUniformLocation(shaderHandle, "Randomness"), job->Randomness);
|
||||
GLERROR("Bind 10 uniform");
|
||||
glUniform1fv(glGetUniformLocation(shaderHandle, "RandomNumbers"), 50, job->RandomNumbers.data());
|
||||
GLERROR("Bind 11 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "RandomnessScalar"), job->RandomnessScalar);
|
||||
GLERROR("Bind 12 uniform");
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "Velocity"), 1, glm::value_ptr(job->Velocity));
|
||||
GLERROR("Bind 13 uniform");
|
||||
glUniform1i(glGetUniformLocation(shaderHandle, "ColorByDistance"), job->ColorByDistance);
|
||||
GLERROR("Bind 14 uniform");
|
||||
glUniform1i(glGetUniformLocation(shaderHandle, "ExponentialAccelaration"), job->ExponentialAccelaration);
|
||||
GLERROR("Bind 15 uniform");
|
||||
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color));
|
||||
GLERROR("Bind 16 uniform");
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "DiffuseColor"), 1, glm::value_ptr(job->DiffuseColor));
|
||||
GLERROR("Bind 17 uniform");
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(job->FillColor));
|
||||
GLERROR("Bind 18 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), job->FillPercentage);
|
||||
GLERROR("Bind 19 uniform");
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor));
|
||||
GLERROR("END");
|
||||
}
|
||||
|
||||
void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene)
|
||||
{
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(job->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
GLERROR("Bind 1 uniform");
|
||||
GLint Location_M = glGetUniformLocation(shaderHandle, "M");
|
||||
glUniformMatrix4fv(Location_M, 1, GL_FALSE, glm::value_ptr(job->Matrix));
|
||||
GLERROR("Bind 2 uniform");
|
||||
GLint Location_V = glGetUniformLocation(shaderHandle, "V");
|
||||
glUniformMatrix4fv(Location_V, 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
GLERROR("Bind 3 uniform");
|
||||
GLint Location_P = glGetUniformLocation(shaderHandle, "P");
|
||||
glUniformMatrix4fv(Location_P, 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
GLERROR("Bind 4 uniform");
|
||||
|
||||
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
|
||||
GLint Location_ScreenDimensions = glGetUniformLocation(shaderHandle, "ScreenDimensions");
|
||||
glUniform2f(Location_ScreenDimensions, m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
|
||||
GLERROR("Bind 5 uniform");
|
||||
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color));
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "DiffuseColor"), 1, glm::value_ptr(job->DiffuseColor));
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(job->FillColor));
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), job->FillPercentage);
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor));
|
||||
GLint Location_FillPercentage = glGetUniformLocation(shaderHandle, "FillPercentage");
|
||||
glUniform1f(Location_FillPercentage, job->FillPercentage);
|
||||
GLERROR("Bind 6 uniform");
|
||||
GLint Location_DiffuseColor = glGetUniformLocation(shaderHandle, "DiffuseColor");
|
||||
glUniform4fv(Location_DiffuseColor, 1, glm::value_ptr(job->DiffuseColor));
|
||||
GLERROR("Bind 7 uniform");
|
||||
GLint Location_FillColor = glGetUniformLocation(shaderHandle, "FillColor");
|
||||
glUniform4fv(Location_FillColor, 1, glm::value_ptr(job->FillColor));
|
||||
GLERROR("Bind 8 uniform");
|
||||
GLint Location_Color = glGetUniformLocation(shaderHandle, "Color");
|
||||
glUniform4fv(Location_Color, 1, glm::value_ptr(job->Color));
|
||||
GLERROR("Bind 9 uniform");
|
||||
GLint Location_AmbientColor = glGetUniformLocation(shaderHandle, "AmbientColor");
|
||||
glUniform4fv(Location_AmbientColor, 1, glm::value_ptr(scene.AmbientColor));
|
||||
|
||||
GLERROR("END");
|
||||
GLERROR("END");
|
||||
}
|
||||
|
||||
|
||||
void DrawFinalPass::BindExplosionTextures(std::shared_ptr<ExplosionEffectJob>& job)
|
||||
void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
if (job->DiffuseTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture->m_Texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
}
|
||||
switch (job->Type) {
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
case RawModel::MaterialType::Basic:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
if (job->DiffuseTexture.size() > 0 && job->DiffuseTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(job->DiffuseTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
if (job->NormalTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture->m_Texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
if (job->NormalTexture.size() > 0 && job->NormalTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(job->NormalTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
if (job->SpecularTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture->m_Texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture);
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
if (job->SpecularTexture.size() > 0 && job->SpecularTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(job->SpecularTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
if (job->IncandescenceTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture->m_Texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
if (job->IncandescenceTexture.size() > 0 && job->IncandescenceTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(job->IncandescenceTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, job->SplatMap->Texture->m_Texture);
|
||||
|
||||
int texturePosition = GL_TEXTURE1;
|
||||
|
||||
//Bind 5 diffuse textures
|
||||
std::string UniformName = "DiffuseUVRepeat";
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
glActiveTexture(texturePosition);
|
||||
if (job->DiffuseTexture.size() > i && job->DiffuseTexture[i]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[i]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->DiffuseTexture[i]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
texturePosition++;
|
||||
}
|
||||
|
||||
//Bind 5 Normal textures
|
||||
UniformName = "NormalUVRepeat";
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
glActiveTexture(texturePosition);
|
||||
if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->NormalTexture[i]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
texturePosition++;
|
||||
}
|
||||
|
||||
//Bind 5 Specular textures
|
||||
UniformName = "SpecularUVRepeat";
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
glActiveTexture(texturePosition);
|
||||
if (job->SpecularTexture.size() > i && job->SpecularTexture[i]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[i]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->SpecularTexture[i]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
texturePosition++;
|
||||
}
|
||||
|
||||
//Bind 5 Incandescence textures
|
||||
UniformName = "GlowUVRepeat";
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
glActiveTexture(texturePosition);
|
||||
if (job->IncandescenceTexture.size() > i && job->IncandescenceTexture[i]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[i]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->IncandescenceTexture[i]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
texturePosition++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawFinalPass::BindModelTextures(std::shared_ptr<ModelJob>& job)
|
||||
void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<ModelJob>& job)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
if (job->DiffuseTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture->m_Texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
}
|
||||
switch (job->Type) {
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
case RawModel::MaterialType::Basic:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
if (job->DiffuseTexture.size() > 0 && job->DiffuseTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(job->DiffuseTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
if (job->NormalTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture->m_Texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
if (job->NormalTexture.size() > 0 && job->NormalTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(job->NormalTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
if (job->SpecularTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture->m_Texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture);
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
if (job->SpecularTexture.size() > 0 && job->SpecularTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(job->SpecularTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
if (job->IncandescenceTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture->m_Texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
if (job->IncandescenceTexture.size() > 0 && job->IncandescenceTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(job->IncandescenceTexture[0]->UVRepeat));
|
||||
}
|
||||
else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, job->SplatMap->Texture->m_Texture);
|
||||
|
||||
int texturePosition = GL_TEXTURE1;
|
||||
|
||||
//Bind 5 diffuse textures
|
||||
std::string UniformName = "DiffuseUVRepeat";
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
glActiveTexture(texturePosition);
|
||||
if (job->DiffuseTexture.size() > i && job->DiffuseTexture[i]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[i]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->DiffuseTexture[i]->UVRepeat));
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
texturePosition++;
|
||||
}
|
||||
|
||||
//Bind 5 Normal textures
|
||||
UniformName = "NormalUVRepeat";
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
glActiveTexture(texturePosition);
|
||||
if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->NormalTexture[i]->UVRepeat));
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_NeutralNormalTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
texturePosition++;
|
||||
}
|
||||
|
||||
//Bind 5 Specular textures
|
||||
UniformName = "SpecularUVRepeat";
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
glActiveTexture(texturePosition);
|
||||
if (job->SpecularTexture.size() > i && job->SpecularTexture[i]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[i]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->SpecularTexture[i]->UVRepeat));
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_GreyTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
texturePosition++;
|
||||
}
|
||||
|
||||
//Bind 5 Incandescence textures
|
||||
UniformName = "GlowUVRepeat";
|
||||
for (unsigned int i = 0; i < 5; i++) {
|
||||
glActiveTexture(texturePosition);
|
||||
if (job->IncandescenceTexture.size() > i && job->IncandescenceTexture[i]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[i]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(job->IncandescenceTexture[i]->UVRepeat));
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_BlackTexture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, std::string(UniformName + ((char)(i + '1'))).c_str()), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
texturePosition++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,6 @@ void DrawScreenQuadPass::Draw(GLuint texture)
|
||||
|
||||
glBindVertexArray(m_ScreenQuad->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
}
|
||||
|
||||
@@ -5,26 +5,77 @@ Model::Model(std::string fileName)
|
||||
//Try loading the model asyncronously, if it throws any exceptions then let it propagate back to caller.
|
||||
m_RawModel = ResourceManager::Load<RawModel, true>(fileName);
|
||||
|
||||
for (auto& group : m_RawModel->MaterialGroups) {
|
||||
if (!group.TexturePath.empty()) {
|
||||
group.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(group.TexturePath));
|
||||
}
|
||||
if (!group.NormalMapPath.empty()) {
|
||||
group.NormalMap = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(group.NormalMapPath));
|
||||
}
|
||||
if (!group.SpecularMapPath.empty()) {
|
||||
group.SpecularMap = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(group.SpecularMapPath));
|
||||
}
|
||||
if (!group.IncandescenceMapPath.empty()) {
|
||||
group.IncandescenceMap = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(group.IncandescenceMapPath));
|
||||
}
|
||||
for (auto& materialProperty : m_RawModel->m_Materials) {
|
||||
switch (materialProperty.type) {
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
{
|
||||
RawModel::MaterialSingleTextures* materialSingleTexture = static_cast<RawModel::MaterialSingleTextures*>(materialProperty.material);
|
||||
if (!materialSingleTexture->ColorMap.TexturePath.empty()) {
|
||||
materialSingleTexture->ColorMap.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(materialSingleTexture->ColorMap.TexturePath));
|
||||
}
|
||||
if (!materialSingleTexture->NormalMap.TexturePath.empty()) {
|
||||
materialSingleTexture->NormalMap.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(materialSingleTexture->NormalMap.TexturePath));
|
||||
}
|
||||
if (!materialSingleTexture->SpecularMap.TexturePath.empty()) {
|
||||
materialSingleTexture->SpecularMap.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(materialSingleTexture->SpecularMap.TexturePath));
|
||||
}
|
||||
if (!materialSingleTexture->IncandescenceMap.TexturePath.empty()) {
|
||||
materialSingleTexture->IncandescenceMap.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(materialSingleTexture->IncandescenceMap.TexturePath));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
RawModel::MaterialSplatMapping* materialSplatMapping = static_cast<RawModel::MaterialSplatMapping*>(materialProperty.material);
|
||||
if (!materialSplatMapping->SplatMap.TexturePath.empty()) {
|
||||
materialSplatMapping->SplatMap.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(materialSplatMapping->SplatMap.TexturePath));
|
||||
}
|
||||
for (auto& texture : materialSplatMapping->ColorMaps)
|
||||
{
|
||||
if (!texture.TexturePath.empty()) {
|
||||
texture.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(texture.TexturePath));
|
||||
}
|
||||
else {
|
||||
texture.Texture = nullptr;
|
||||
}
|
||||
}
|
||||
for (auto& texture : materialSplatMapping->NormalMaps)
|
||||
{
|
||||
if (!texture.TexturePath.empty()) {
|
||||
texture.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(texture.TexturePath));
|
||||
} else {
|
||||
texture.Texture = nullptr;
|
||||
}
|
||||
}
|
||||
for (auto& texture : materialSplatMapping->SpecularMaps)
|
||||
{
|
||||
if (!texture.TexturePath.empty()) {
|
||||
texture.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(texture.TexturePath));
|
||||
}
|
||||
else {
|
||||
texture.Texture = nullptr;
|
||||
}
|
||||
}
|
||||
for (auto& texture : materialSplatMapping->IncandescenceMaps)
|
||||
{
|
||||
if (!texture.TexturePath.empty()) {
|
||||
texture.Texture = std::shared_ptr<Texture>(ResourceManager::Load<Texture>(texture.TexturePath));
|
||||
}
|
||||
else {
|
||||
texture.Texture = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate GL buffers
|
||||
GLuint buffer;
|
||||
glGenBuffers(1, &buffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, m_RawModel->m_Vertices.size() * sizeof(RawModel::Vertex), &m_RawModel->m_Vertices[0], GL_STATIC_DRAW);
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, m_RawModel->NumVertices() * m_RawModel->VertexSize(), m_RawModel->Vertices(), GL_STATIC_DRAW);
|
||||
|
||||
glGenBuffers(1, &ElementBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ElementBuffer);
|
||||
@@ -35,7 +86,13 @@ Model::Model(std::string fileName)
|
||||
GLERROR("GLEW: BufferFail4");
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
std::vector<int> structSizes = { 3, 3, 3, 3, 2, 4, 4 };
|
||||
std::vector<int> structSizes;
|
||||
if (m_RawModel->IsSkinned()) {
|
||||
structSizes = { 3, 3, 3, 3, 2, 4, 4 };
|
||||
} else {
|
||||
structSizes = { 3, 3, 3, 3, 2 };
|
||||
}
|
||||
|
||||
int stride = 0;
|
||||
for (int size : structSizes) {
|
||||
stride += size;
|
||||
@@ -49,8 +106,10 @@ Model::Model(std::string fileName)
|
||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||
if (m_RawModel->IsSkinned()) {
|
||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||
}
|
||||
}
|
||||
GLERROR("GLEW: BufferFail5");
|
||||
|
||||
@@ -59,15 +118,19 @@ Model::Model(std::string fileName)
|
||||
glEnableVertexAttribArray(2);
|
||||
glEnableVertexAttribArray(3);
|
||||
glEnableVertexAttribArray(4);
|
||||
glEnableVertexAttribArray(5);
|
||||
glEnableVertexAttribArray(6);
|
||||
if (m_RawModel->IsSkinned()) {
|
||||
glEnableVertexAttribArray(5);
|
||||
glEnableVertexAttribArray(6);
|
||||
}
|
||||
GLERROR("GLEW: BufferFail5");
|
||||
|
||||
//CreateBuffers();
|
||||
|
||||
glm::vec3 mini(INFINITY);
|
||||
glm::vec3 maxi(-INFINITY);
|
||||
for (const auto& v : m_RawModel->m_Vertices) {
|
||||
|
||||
for (unsigned int i = 0; i < m_RawModel->NumVertices(); i++) {
|
||||
const auto& v = m_RawModel->Vertices()[i];
|
||||
mini = glm::min(mini, v.Position);
|
||||
maxi = glm::max(maxi, v.Position);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,14 @@ void PickingPass::InitializeShaderPrograms()
|
||||
m_PickingProgram->Compile();
|
||||
m_PickingProgram->BindFragDataLocation(0, "TextureFragment");
|
||||
m_PickingProgram->Link();
|
||||
|
||||
m_PickingSkinnedProgram = ResourceManager::Load<ShaderProgram>("#PickingSkinnedProgram");
|
||||
|
||||
m_PickingSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/PickingSkinned.vert.glsl")));
|
||||
m_PickingSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Picking.frag.glsl")));
|
||||
m_PickingSkinnedProgram->Compile();
|
||||
m_PickingSkinnedProgram->BindFragDataLocation(0, "TextureFragment");
|
||||
m_PickingSkinnedProgram->Link();
|
||||
}
|
||||
|
||||
void PickingPass::Draw(RenderScene& scene)
|
||||
@@ -49,6 +57,7 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
|
||||
//TODO: Render: Add code for more jobs than modeljobs.
|
||||
GLuint shaderHandle = m_PickingProgram->GetHandle();
|
||||
GLuint shaderSkinnedHandle = m_PickingSkinnedProgram->GetHandle();
|
||||
m_PickingProgram->Bind();
|
||||
|
||||
if (scene.ClearDepth) {
|
||||
@@ -83,18 +92,32 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
|
||||
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
if (modelJob->Model->IsSkinned())
|
||||
{
|
||||
m_PickingSkinnedProgram->Bind();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
if (modelJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
}
|
||||
}
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
}
|
||||
} else {
|
||||
m_PickingProgram->Bind();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
}
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||
@@ -105,41 +128,50 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
for (auto &job : scene.Jobs.TransparentObjects) {
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||
|
||||
if (modelJob) {
|
||||
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
||||
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
||||
|
||||
PickingInfo pickInfo;
|
||||
pickInfo.Entity = modelJob->Entity;
|
||||
pickInfo.World = modelJob->World;
|
||||
pickInfo.Camera = scene.Camera;
|
||||
PickingInfo pickInfo;
|
||||
pickInfo.Entity = modelJob->Entity;
|
||||
pickInfo.World = modelJob->World;
|
||||
pickInfo.Camera = scene.Camera;
|
||||
|
||||
auto color = m_EntityColors.find(std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera));
|
||||
if (color != m_EntityColors.end()) {
|
||||
pickColor[0] = color->second[0];
|
||||
pickColor[1] = color->second[1];
|
||||
auto color = m_EntityColors.find(std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera));
|
||||
if (color != m_EntityColors.end()) {
|
||||
pickColor[0] = color->second[0];
|
||||
pickColor[1] = color->second[1];
|
||||
} else {
|
||||
m_EntityColors[std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera)] = glm::ivec2(pickColor[0], pickColor[1]);
|
||||
if (m_ColorCounter[0] > 255) {
|
||||
m_ColorCounter[0] = 0;
|
||||
m_ColorCounter[1] += 1;
|
||||
} else {
|
||||
m_EntityColors[std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera)] = glm::ivec2(pickColor[0], pickColor[1]);
|
||||
if (m_ColorCounter[0] > 255) {
|
||||
m_ColorCounter[0] = 0;
|
||||
m_ColorCounter[1] += 1;
|
||||
} else {
|
||||
m_ColorCounter[0] += 1;
|
||||
}
|
||||
m_ColorCounter[0] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
||||
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
if (modelJob) {
|
||||
if (modelJob->Model->IsSkinned()) {
|
||||
m_PickingSkinnedProgram->Bind();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
if (modelJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
} else {
|
||||
m_PickingProgram->Bind();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
}
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
@@ -175,17 +207,27 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
|
||||
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
if(modelJob->Model->IsSkinned()) {
|
||||
m_PickingSkinnedProgram->Bind();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
if (modelJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
} else {
|
||||
m_PickingProgram->Bind();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
}
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
@@ -198,6 +240,7 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||
|
||||
if (modelJob) {
|
||||
|
||||
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
||||
|
||||
PickingInfo pickInfo;
|
||||
@@ -221,19 +264,38 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
|
||||
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
if (modelJob->Model->IsSkinned()) {
|
||||
m_PickingSkinnedProgram->Bind();
|
||||
|
||||
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
|
||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||
|
||||
std::vector<glm::mat4> frameBones;
|
||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||
} else {
|
||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||
}
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
|
||||
if (modelJob->Animation != nullptr) {
|
||||
std::vector<glm::mat4> frameBones = modelJob->Skeleton->GetFrameBones(*modelJob->Animation, modelJob->AnimationTime);
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||
}
|
||||
} else {
|
||||
m_PickingProgram->Bind();
|
||||
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
glBindVertexArray(modelJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
||||
@@ -252,8 +314,8 @@ void PickingPass::ClearPicking()
|
||||
{
|
||||
m_PickingColorsToEntity.clear();
|
||||
m_EntityColors.clear();
|
||||
m_ColorCounter[0] = 1;
|
||||
m_ColorCounter[1] = 0;
|
||||
m_ColorCounter[0] = 0;
|
||||
m_ColorCounter[1] = 1;
|
||||
|
||||
m_PickingBuffer.Bind();
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
@@ -271,7 +271,7 @@ RawModelAssimp::RawModelAssimp(std::string fileName)
|
||||
skelAnim.Keyframes.push_back(animationFrame);
|
||||
}
|
||||
|
||||
m_Skeleton->Animations[animationName] = skelAnim;
|
||||
m_Skeleton->Animations[animationName1] = skelAnim;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,13 +34,20 @@ void RawModelCustom::ReadMeshFile(std::string filePath)
|
||||
ReadMeshFileHeader(offset, fileData);
|
||||
ReadMesh(offset, fileData, fileByteSize);
|
||||
}
|
||||
delete fileData;
|
||||
delete[] fileData;
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMeshFileHeader(std::size_t& offset, char* fileData)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
m_Vertices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
|
||||
hasSkin = *(bool*)(fileData + offset);
|
||||
offset += sizeof(bool);
|
||||
if (hasSkin) {
|
||||
m_SkinedVertices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
|
||||
}
|
||||
else {
|
||||
m_Vertices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
|
||||
}
|
||||
offset += sizeof(unsigned int);
|
||||
m_Indices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
|
||||
offset += sizeof(unsigned int);
|
||||
@@ -57,12 +64,19 @@ void RawModelCustom::ReadMesh(std::size_t& offset, char* fileData, const unsigne
|
||||
void RawModelCustom::ReadVertices(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
if (offset + m_Vertices.size() * sizeof(Vertex) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading vertices failed");
|
||||
}
|
||||
|
||||
memcpy(&m_Vertices[0], fileData + offset, m_Vertices.size() * sizeof(Vertex));
|
||||
offset += m_Vertices.size() * sizeof(Vertex);
|
||||
if (hasSkin) {
|
||||
if (offset + m_SkinedVertices.size() * sizeof(SkinedVertex) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading skined vertices failed");
|
||||
}
|
||||
memcpy(&m_SkinedVertices[0], fileData + offset, m_SkinedVertices.size() * sizeof(SkinedVertex));
|
||||
offset += m_SkinedVertices.size() * sizeof(SkinedVertex);
|
||||
} else {
|
||||
if (offset + m_Vertices.size() * sizeof(Vertex) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading vertices failed");
|
||||
}
|
||||
memcpy(&m_Vertices[0], fileData + offset, m_Vertices.size() * sizeof(Vertex));
|
||||
offset += m_Vertices.size() * sizeof(Vertex);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
@@ -102,14 +116,14 @@ void RawModelCustom::ReadMaterialFile(std::string filePath)
|
||||
if (fileByteSize > 0) {
|
||||
ReadMaterials(offset, fileData, fileByteSize);
|
||||
}
|
||||
delete fileData;
|
||||
delete[] fileData;
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMaterials(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
unsigned int* numMaterials = (unsigned int*)(fileData);
|
||||
MaterialGroups.reserve(*numMaterials);
|
||||
m_Materials.reserve(*numMaterials);
|
||||
offset += sizeof(unsigned int);
|
||||
|
||||
for (unsigned int i = 0; i < *numMaterials; i++) {
|
||||
@@ -121,83 +135,150 @@ void RawModelCustom::ReadMaterials(std::size_t& offset, char* fileData, const un
|
||||
|
||||
void RawModelCustom::ReadMaterialSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
MaterialGroup newMaterial;
|
||||
|
||||
MaterialProperties newMaterialProperty;
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
|
||||
if (offset + sizeof(unsigned int) * 4 > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material texture names length failed");
|
||||
}
|
||||
if (offset + sizeof(MaterialType) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material Type failed");
|
||||
}
|
||||
MaterialType type = *(MaterialType*)(fileData + offset);
|
||||
offset += sizeof(MaterialType);
|
||||
|
||||
unsigned int* nameLengths = (unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int) * 4;
|
||||
switch (type) {
|
||||
case MaterialType::Basic:
|
||||
newMaterialProperty.material = new MaterialBasic();
|
||||
ReadMaterialBasic(newMaterialProperty.material, offset, fileData, fileByteSize);
|
||||
break;
|
||||
case MaterialType::SplatMapping:
|
||||
newMaterialProperty.material = new MaterialSplatMapping();
|
||||
ReadMaterialSplatMapping(static_cast<MaterialSplatMapping*>(newMaterialProperty.material), offset, fileData, fileByteSize);
|
||||
break;
|
||||
case MaterialType::SingleTextures:
|
||||
newMaterialProperty.material = new MaterialSingleTextures();
|
||||
ReadMaterialSingleTexture(static_cast<MaterialSingleTextures*>(newMaterialProperty.material), offset, fileData, fileByteSize);
|
||||
break;
|
||||
default:
|
||||
throw Resource::FailedLoadingException("Material contains an unknown MaterialType");
|
||||
};
|
||||
|
||||
if (offset + sizeof(float) * 11 + sizeof(unsigned int) * 2 > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material specular, reflection, color and start and end index values failed");
|
||||
}
|
||||
|
||||
newMaterial.SpecularExponent = *(float*)(fileData + offset);
|
||||
offset += sizeof(float);
|
||||
newMaterial.ReflectionFactor = *(float*)(fileData + offset);
|
||||
offset += sizeof(float);
|
||||
|
||||
memcpy(&newMaterial.DiffuseColor[0], fileData + offset, sizeof(float) * 3);
|
||||
offset += sizeof(float) * 3;
|
||||
memcpy(&newMaterial.SpecularColor[0], fileData + offset, sizeof(float) * 3);
|
||||
offset += sizeof(float) * 3;
|
||||
memcpy(&newMaterial.IncandescenceColor[0], fileData + offset, sizeof(float) * 3);
|
||||
offset += sizeof(float) * 3;
|
||||
|
||||
newMaterial.StartIndex = *(unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int);
|
||||
newMaterial.EndIndex = *(unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int);
|
||||
|
||||
if (nameLengths[0] > 0) {
|
||||
if (offset + nameLengths[0] > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material texture path failed");
|
||||
}
|
||||
|
||||
newMaterial.TexturePath = "Textures/";
|
||||
newMaterial.TexturePath += (fileData + offset);
|
||||
newMaterial.TexturePath += ".png";
|
||||
offset += nameLengths[0];
|
||||
}
|
||||
|
||||
if (nameLengths[1] > 0) {
|
||||
if (offset + nameLengths[1] > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material NormalMap path failed");
|
||||
}
|
||||
newMaterial.NormalMapPath = "Textures/";
|
||||
newMaterial.NormalMapPath += (fileData + offset);
|
||||
newMaterial.NormalMapPath += ".png";
|
||||
offset += nameLengths[1];
|
||||
}
|
||||
|
||||
if (nameLengths[2] > 0) {
|
||||
if (offset + nameLengths[2] > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material SpecularMap path failed");
|
||||
}
|
||||
newMaterial.SpecularMapPath = "Textures/";
|
||||
newMaterial.SpecularMapPath += (fileData + offset);
|
||||
newMaterial.SpecularMapPath += ".png";
|
||||
offset += nameLengths[2];
|
||||
}
|
||||
|
||||
if (nameLengths[3] > 0) {
|
||||
if (offset + nameLengths[3] > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material IncandescenceMap path failed");
|
||||
}
|
||||
newMaterial.IncandescenceMapPath = "Textures/";
|
||||
newMaterial.IncandescenceMapPath += (fileData + offset);
|
||||
newMaterial.IncandescenceMapPath += ".png";
|
||||
offset += nameLengths[3];
|
||||
}
|
||||
newMaterialProperty.type = type;
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
MaterialGroups.push_back(newMaterial);
|
||||
m_Materials.push_back(newMaterialProperty);
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMaterialBasic(RawModelCustom::MaterialBasic* newMaterial, std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
if (offset + sizeof(float) * 11 + sizeof(unsigned int) * 2 > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material specular, reflection, color and start and end index values failed");
|
||||
}
|
||||
|
||||
newMaterial->SpecularExponent = *(float*)(fileData + offset);
|
||||
offset += sizeof(float);
|
||||
newMaterial->ReflectionFactor = *(float*)(fileData + offset);
|
||||
offset += sizeof(float);
|
||||
|
||||
memcpy(&newMaterial->DiffuseColor[0], fileData + offset, sizeof(float) * 3);
|
||||
offset += sizeof(float) * 3;
|
||||
memcpy(&newMaterial->SpecularColor[0], fileData + offset, sizeof(float) * 3);
|
||||
offset += sizeof(float) * 3;
|
||||
memcpy(&newMaterial->IncandescenceColor[0], fileData + offset, sizeof(float) * 3);
|
||||
offset += sizeof(float) * 3;
|
||||
|
||||
newMaterial->StartIndex = *(unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int);
|
||||
newMaterial->EndIndex = *(unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int);
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMaterialSingleTexture(RawModelCustom::MaterialSingleTextures* newMaterial, std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
ReadMaterialBasic(newMaterial, offset, fileData, fileByteSize);
|
||||
if (offset + sizeof(unsigned char) * 4 > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material NumOfMaps failed");
|
||||
}
|
||||
unsigned char numberOfMaps[4];
|
||||
memcpy(numberOfMaps, fileData + offset, sizeof(unsigned char) * 4);
|
||||
offset += sizeof(unsigned char) * 4;
|
||||
|
||||
if (numberOfMaps[0] > 0)
|
||||
{
|
||||
ReadMaterialTextureProperties(newMaterial->ColorMap, offset, fileData, fileByteSize);
|
||||
}
|
||||
|
||||
if (numberOfMaps[1] > 0)
|
||||
{
|
||||
ReadMaterialTextureProperties(newMaterial->SpecularMap, offset, fileData, fileByteSize);
|
||||
}
|
||||
|
||||
if (numberOfMaps[2] > 0)
|
||||
{
|
||||
ReadMaterialTextureProperties(newMaterial->NormalMap, offset, fileData, fileByteSize);
|
||||
}
|
||||
|
||||
if (numberOfMaps[3] > 0)
|
||||
{
|
||||
ReadMaterialTextureProperties(newMaterial->IncandescenceMap, offset, fileData, fileByteSize);
|
||||
}
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMaterialSplatMapping(RawModelCustom::MaterialSplatMapping* newMaterial, std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
{
|
||||
ReadMaterialBasic(newMaterial, offset, fileData, fileByteSize);
|
||||
ReadMaterialTextureProperties(newMaterial->SplatMap, offset, fileData, fileByteSize);
|
||||
if (offset + sizeof(unsigned char) * 4 > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material NumOfMaps failed");
|
||||
}
|
||||
|
||||
unsigned char numberOfMaps[4];
|
||||
memcpy(numberOfMaps, fileData + offset, sizeof(unsigned char) * 4);
|
||||
offset += sizeof(unsigned char) * 4;
|
||||
|
||||
newMaterial->ColorMaps.resize(numberOfMaps[0]);
|
||||
for (unsigned char i = 0; i < numberOfMaps[0]; i++)
|
||||
{
|
||||
ReadMaterialTextureProperties(newMaterial->ColorMaps[i], offset, fileData, fileByteSize);
|
||||
}
|
||||
|
||||
newMaterial->SpecularMaps.resize(numberOfMaps[1]);
|
||||
for (unsigned char i = 0; i < numberOfMaps[1]; i++)
|
||||
{
|
||||
ReadMaterialTextureProperties(newMaterial->SpecularMaps[i], offset, fileData, fileByteSize);
|
||||
}
|
||||
|
||||
newMaterial->NormalMaps.resize(numberOfMaps[2]);
|
||||
for (unsigned char i = 0; i < numberOfMaps[2]; i++)
|
||||
{
|
||||
ReadMaterialTextureProperties(newMaterial->NormalMaps[i], offset, fileData, fileByteSize);
|
||||
}
|
||||
|
||||
newMaterial->IncandescenceMaps.resize(numberOfMaps[3]);
|
||||
for (unsigned char i = 0; i < numberOfMaps[3]; i++)
|
||||
{
|
||||
ReadMaterialTextureProperties(newMaterial->IncandescenceMaps[i], offset, fileData, fileByteSize);
|
||||
}
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadMaterialTextureProperties(RawModelCustom::TextureProperties& texture, std::size_t& offset, char* fileData, const unsigned int& fileByteSize) {
|
||||
unsigned int nameLength = *(unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int);
|
||||
|
||||
if (nameLength > 0) {
|
||||
if (offset + nameLength > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material texture path failed");
|
||||
}
|
||||
texture.TexturePath = "Textures/";
|
||||
texture.TexturePath += (fileData + offset);
|
||||
texture.TexturePath += ".png";
|
||||
offset += nameLength;
|
||||
if (offset + sizeof(glm::vec2) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading Material texture UVTiling failed");
|
||||
}
|
||||
memcpy(&texture.UVRepeat[0], fileData + offset, sizeof(glm::vec2));
|
||||
offset += sizeof(glm::vec2);
|
||||
}
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationFile(std::string filePath)
|
||||
@@ -207,7 +288,9 @@ void RawModelCustom::ReadAnimationFile(std::string filePath)
|
||||
std::ifstream in(filePath.c_str(), std::ios_base::binary | std::ios_base::ate);
|
||||
|
||||
if (!in.is_open()) {
|
||||
//throw Resource::FailedLoadingException("Open animation file failed");
|
||||
if (hasSkin) {
|
||||
throw Resource::FailedLoadingException("Open animation file for a skinned mesh failed, unknown stuff will happen");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -233,7 +316,7 @@ void RawModelCustom::ReadAnimationFile(std::string filePath)
|
||||
ReadAnimationBindPoses(offset, fileData, fileByteSize);
|
||||
ReadAnimationClips(offset, fileData, fileByteSize, numAnimations);
|
||||
}
|
||||
delete fileData;
|
||||
delete[] fileData;
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationBindPoses(std::size_t& offset, char* fileData, const unsigned int& fileByteSize)
|
||||
@@ -318,32 +401,43 @@ void RawModelCustom::ReadAnimationClipSingle(std::size_t& offset, char* fileData
|
||||
if (offset + sizeof(float) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationClip duration failed");
|
||||
}
|
||||
|
||||
newAnimation.Duration = *(float*)(fileData + offset);
|
||||
offset += sizeof(float);
|
||||
|
||||
if (offset + sizeof(unsigned int) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationClip NrOfKeyframes failed");
|
||||
throw Resource::FailedLoadingException("Reading AnimationClip numberOfJointFrames failed");
|
||||
}
|
||||
unsigned int nrOfKeyframes = *(unsigned int*)(fileData + offset);
|
||||
unsigned int numberOfJointFrames = *(unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int);
|
||||
|
||||
if (offset + sizeof(unsigned int) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationClip NrOfJoints failed");
|
||||
}
|
||||
unsigned int nrOfJoints = *(unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int);
|
||||
for (unsigned int i = 0; i < numberOfJointFrames; i++) {
|
||||
if (offset + sizeof(unsigned int) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationClip JointID failed");
|
||||
}
|
||||
int jointID = *(unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int);
|
||||
|
||||
newAnimation.Keyframes.reserve(nrOfKeyframes);
|
||||
for (unsigned int i = 0; i < nrOfKeyframes; i++) {
|
||||
ReadAnimationKeyFrame(offset, fileData, fileByteSize, nrOfJoints, newAnimation);
|
||||
if (offset + sizeof(unsigned int) > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationClip numberOFKeyFrames failed");
|
||||
}
|
||||
unsigned int numberOFKeyFrames = *(unsigned int*)(fileData + offset);
|
||||
offset += sizeof(unsigned int);
|
||||
|
||||
if (numberOFKeyFrames > 0) {
|
||||
newAnimation.JointAnimations[jointID].reserve(numberOFKeyFrames);
|
||||
|
||||
for (unsigned int j = 0; j < numberOFKeyFrames; j++) {
|
||||
ReadAnimationKeyFrame(offset, fileData, fileByteSize, newAnimation.JointAnimations[jointID]);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_Skeleton->Animations[newAnimation.Name] = newAnimation;
|
||||
//m_Skeleton->Animations[newAnimation.Name].KeyFrameAmount = nrOfKeyframes;
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
void RawModelCustom::ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfJoints, Skeleton::Animation& animation)
|
||||
void RawModelCustom::ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, std::vector<Skeleton::Animation::Keyframe>& animation)
|
||||
{
|
||||
Skeleton::Animation::Keyframe newKeyFrame;
|
||||
|
||||
@@ -359,17 +453,27 @@ void RawModelCustom::ReadAnimationKeyFrame(std::size_t& offset, char* fileData,
|
||||
newKeyFrame.Time = *(float*)(fileData + offset);
|
||||
offset += sizeof(float);
|
||||
|
||||
if (offset + sizeof(Skeleton::Animation::Keyframe::BoneProperty) * numberOfJoints> fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationKeyFrame joints failed");
|
||||
if (offset + sizeof(float) * 3 > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationKeyFrame Position failed");
|
||||
}
|
||||
memcpy(&newKeyFrame.BoneProperties.Position[0], fileData + offset, sizeof(float) * 3);
|
||||
offset += sizeof(float) * 3;
|
||||
|
||||
Skeleton::Animation::Keyframe::BoneProperty newBone;
|
||||
for (unsigned int i = 0; i < numberOfJoints; i++) {
|
||||
memcpy(&newBone, (fileData + offset), sizeof(Skeleton::Animation::Keyframe::BoneProperty));
|
||||
offset += sizeof(Skeleton::Animation::Keyframe::BoneProperty);
|
||||
newKeyFrame.BoneProperties[newBone.ID] = newBone;
|
||||
if (offset + sizeof(float) * 4 > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationKeyFrame Rotation failed");
|
||||
}
|
||||
animation.Keyframes.push_back(newKeyFrame);
|
||||
memcpy(&newKeyFrame.BoneProperties.Rotation[0], fileData + offset, sizeof(float) * 4);
|
||||
offset += sizeof(float) * 4;
|
||||
|
||||
if (offset + sizeof(float) * 3 > fileByteSize) {
|
||||
throw Resource::FailedLoadingException("Reading AnimationKeyFrame Scale failed");
|
||||
}
|
||||
memcpy(&newKeyFrame.BoneProperties.Scale[0], fileData + offset, sizeof(float) * 3);
|
||||
offset += sizeof(float) * 3;
|
||||
|
||||
|
||||
animation.push_back(newKeyFrame);
|
||||
|
||||
}
|
||||
|
||||
RawModelCustom::~RawModelCustom()
|
||||
@@ -377,6 +481,9 @@ RawModelCustom::~RawModelCustom()
|
||||
if (m_Skeleton != nullptr) {
|
||||
delete m_Skeleton;
|
||||
}
|
||||
for (auto material : m_Materials) {
|
||||
delete material.material;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -62,14 +62,14 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
||||
}
|
||||
|
||||
// Only render children of a camera if that camera is currently active
|
||||
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
|
||||
continue;
|
||||
}
|
||||
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
|
||||
if (entity.HasComponent("HiddenForLocalPlayer") && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
|
||||
continue;
|
||||
}
|
||||
if (entity.HasComponent("HiddenForLocalPlayer") && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Model* model;
|
||||
try {
|
||||
@@ -111,6 +111,7 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
||||
fillPercentage
|
||||
));
|
||||
if (m_World->HasComponent(cModel.EntityID, "Shield")){
|
||||
explosionEffectJob->CalculateHash();
|
||||
Jobs.ShieldObjects.push_back(explosionEffectJob);
|
||||
} else if (m_World->HasComponent(cModel.EntityID, "Shielded")
|
||||
|| m_World->HasComponent(cModel.EntityID, "Player")) {
|
||||
@@ -122,6 +123,7 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
||||
if (cModel["Transparent"]) {
|
||||
Jobs.TransparentShieldedObjects.push_back(explosionEffectJob);
|
||||
} else {
|
||||
explosionEffectJob->CalculateHash();
|
||||
Jobs.OpaqueShieldedObjects.push_back(explosionEffectJob);
|
||||
}
|
||||
} else {
|
||||
@@ -132,6 +134,7 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
||||
if (cModel["Transparent"]) {
|
||||
Jobs.TransparentObjects.push_back(explosionEffectJob);
|
||||
} else {
|
||||
explosionEffectJob->CalculateHash();
|
||||
Jobs.OpaqueObjects.push_back(explosionEffectJob);
|
||||
}
|
||||
}
|
||||
@@ -147,6 +150,7 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
||||
fillPercentage
|
||||
));
|
||||
if (m_World->HasComponent(cModel.EntityID, "Shield")) {
|
||||
modelJob->CalculateHash();
|
||||
Jobs.ShieldObjects.push_back(modelJob);
|
||||
} else if (m_World->HasComponent(cModel.EntityID, "Shielded")
|
||||
|| m_World->HasComponent(cModel.EntityID, "Player")) {
|
||||
@@ -158,6 +162,7 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
||||
if (cModel["Transparent"]) {
|
||||
Jobs.TransparentShieldedObjects.push_back(modelJob);
|
||||
} else {
|
||||
modelJob->CalculateHash();
|
||||
Jobs.OpaqueShieldedObjects.push_back(modelJob);
|
||||
}
|
||||
} else {
|
||||
@@ -168,6 +173,7 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
||||
if (cModel["Transparent"]) {
|
||||
Jobs.TransparentObjects.push_back(modelJob);
|
||||
} else {
|
||||
modelJob->CalculateHash();
|
||||
Jobs.OpaqueObjects.push_back(modelJob);
|
||||
}
|
||||
}
|
||||
@@ -233,7 +239,7 @@ void RenderSystem::fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World*
|
||||
if (texts == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (auto& textComponent : *texts) {
|
||||
bool visible = textComponent["Visible"];
|
||||
if (!visible) {
|
||||
@@ -290,6 +296,8 @@ void RenderSystem::Update(double dt)
|
||||
|
||||
fillModels(scene.Jobs);
|
||||
fillPointLights(scene.Jobs.PointLight, m_World);
|
||||
//TODO: Make sure all objects needed are also sorted.
|
||||
scene.Jobs.OpaqueObjects.sort();
|
||||
fillDirectionalLights(scene.Jobs.DirectionalLight, m_World);
|
||||
fillText(scene.Jobs.Text, m_World);
|
||||
m_RenderFrame->Add(scene);
|
||||
|
||||
@@ -39,66 +39,494 @@ const Skeleton::Animation* Skeleton::GetAnimation(std::string name)
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<glm::mat4> Skeleton::GetFrameBones(const Animation& animation, double time, bool noRootMotion /*= false*/)
|
||||
std::vector<glm::mat4> Skeleton::GetFrameBones(std::vector<AnimationData> animations, bool noRootMotion /*= false*/)
|
||||
{
|
||||
// HACK: Animation wrap-around
|
||||
while (time < 0) {
|
||||
time += animation.Duration;
|
||||
}
|
||||
while (time > animation.Duration) {
|
||||
time -= animation.Duration;
|
||||
}
|
||||
if (animations.size() <= 0) {
|
||||
std::vector<glm::mat4> finalMatrices;
|
||||
for (auto& b : Bones) {
|
||||
finalMatrices.push_back(glm::mat4(1));//b.second->OffsetMatrix);
|
||||
}
|
||||
return finalMatrices;
|
||||
}
|
||||
|
||||
int currentKeyframeIndex = GetKeyframe(animation, time);
|
||||
std::map<int, glm::mat4> frameBones;
|
||||
AccumulateBoneTransforms(true, animations, frameBones, RootBone, glm::mat4(1));
|
||||
|
||||
const Animation::Keyframe& currentFrame = animation.Keyframes[currentKeyframeIndex];
|
||||
const Animation::Keyframe& nextFrame = animation.Keyframes[(currentKeyframeIndex + 1) % animation.Keyframes.size()];
|
||||
double alpha = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
|
||||
//auto animationFrame = Animations[""].Keyframes[frame];
|
||||
std::map<int, glm::mat4> frameBones;
|
||||
AccumulateBoneTransforms(noRootMotion, currentFrame, nextFrame, static_cast<float>(alpha), frameBones, RootBone, glm::mat4(1));
|
||||
|
||||
std::vector<glm::mat4> finalMatrices;
|
||||
for (auto &kv : frameBones) {
|
||||
finalMatrices.push_back(kv.second);
|
||||
}
|
||||
return finalMatrices;
|
||||
std::vector<glm::mat4> finalMatrices;
|
||||
for (auto &kv : frameBones) {
|
||||
finalMatrices.push_back(kv.second);
|
||||
}
|
||||
return finalMatrices;
|
||||
}
|
||||
|
||||
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation::Keyframe ¤tFrame, const Animation::Keyframe &nextFrame, float progress, std::map<int, glm::mat4> &boneMatrices, const Bone* bone, glm::mat4 parentMatrix)
|
||||
|
||||
std::vector<glm::mat4> Skeleton::GetFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion /*= false*/)
|
||||
{
|
||||
if (animations.size() <= 0 || animationOffset.animation == nullptr) {
|
||||
std::vector<glm::mat4> finalMatrices;
|
||||
for (auto& b : Bones) {
|
||||
finalMatrices.push_back(glm::mat4(1));//b.second->OffsetMatrix);
|
||||
}
|
||||
return finalMatrices;
|
||||
}
|
||||
|
||||
|
||||
std::map<int, glm::mat4> frameBones;
|
||||
AccumulateBoneTransforms(true, animations, animationOffset, frameBones, RootBone, glm::mat4(1));
|
||||
|
||||
std::vector<glm::mat4> finalMatrices;
|
||||
for (auto &kv : frameBones) {
|
||||
finalMatrices.push_back(kv.second);
|
||||
}
|
||||
return finalMatrices;
|
||||
}
|
||||
/*
|
||||
|
||||
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, float time, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix)
|
||||
{
|
||||
glm::mat4 boneMatrix;
|
||||
|
||||
if (currentFrame.BoneProperties.find(bone->ID) != currentFrame.BoneProperties.end() || nextFrame.BoneProperties.find(bone->ID) != nextFrame.BoneProperties.end()) {
|
||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties.at(bone->ID);
|
||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties.at(bone->ID);
|
||||
Animation::Keyframe currentFrame;
|
||||
Animation::Keyframe nextFrame;
|
||||
|
||||
glm::vec3 positionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
||||
glm::quat rotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
||||
glm::vec3 scaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
||||
if(animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
|
||||
std::vector<Animation::Keyframe> boneKeyFrames = animation->JointAnimations.at(bone->ID);
|
||||
|
||||
// Flag for no root motion
|
||||
if (bone == RootBone && noRootMotion) {
|
||||
positionInterp.x = 0;
|
||||
positionInterp.z = 0;
|
||||
}
|
||||
if(boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone
|
||||
for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame
|
||||
if (time >= boneKeyFrames.at(index).Time) {
|
||||
currentFrame = boneKeyFrames.at(index);
|
||||
nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float progress;
|
||||
|
||||
if(nextFrame.Index == 0) {
|
||||
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
|
||||
} else {
|
||||
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
|
||||
}
|
||||
|
||||
|
||||
boneMatrix = parentMatrix * (glm::translate(positionInterp) * glm::toMat4(rotationInterp) * glm::scale(scaleInterp));
|
||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||
} else {
|
||||
if (bone->Parent) {
|
||||
boneMatrix = parentMatrix; // * glm::inverse(bone->OffsetMatrix);
|
||||
if (progress > 1.0f || progress < 0.0f) {
|
||||
LOG_INFO("Progress: %f", progress);
|
||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
||||
}
|
||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
||||
|
||||
glm::vec3 positionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
||||
glm::quat rotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
||||
glm::vec3 scaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
||||
|
||||
// Flag for no root motion
|
||||
if (bone == RootBone && noRootMotion) {
|
||||
positionInterp.x = 0;
|
||||
positionInterp.z = 0;
|
||||
}
|
||||
|
||||
boneMatrix = parentMatrix *(glm::translate(positionInterp) * glm::toMat4(rotationInterp) * glm::scale(scaleInterp));
|
||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||
|
||||
} else { // 1 keyframes for the current bone
|
||||
currentFrame = boneKeyFrames.at(0);
|
||||
boneMatrix = parentMatrix *(glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale));
|
||||
|
||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||
}
|
||||
boneMatrices[bone->ID] = boneMatrix; // * bone->OffsetMatrix;
|
||||
}
|
||||
} else { // 0 keyframes for the current bone
|
||||
|
||||
for (auto &child : bone->Children) {
|
||||
std::string name = child->Name;
|
||||
AccumulateBoneTransforms(noRootMotion, currentFrame, nextFrame, progress, boneMatrices, child, boneMatrix);
|
||||
}
|
||||
// LOG_INFO("%s Has no keyframe", bone->Name.c_str());
|
||||
if (bone->Parent) {
|
||||
boneMatrix = parentMatrix * glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix;
|
||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||
} else {
|
||||
boneMatrix = glm::inverse(bone->OffsetMatrix);
|
||||
boneMatrices[bone->ID] = parentMatrix;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (auto &child : bone->Children) {
|
||||
AccumulateBoneTransforms(noRootMotion, animation, time, boneMatrices, child, boneMatrix);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix)
|
||||
{
|
||||
glm::mat4 boneMatrix;
|
||||
|
||||
|
||||
|
||||
std::vector<JointFrameTransform> JointTransforms;
|
||||
|
||||
for (const AnimationData animationData : animations) {
|
||||
const Animation* animation = animationData.animation;
|
||||
const float time = animationData.time;
|
||||
|
||||
JointFrameTransform jointTransform;
|
||||
jointTransform.Weight = animationData.weight;;
|
||||
|
||||
if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
|
||||
std::vector<Animation::Keyframe> boneKeyFrames = animation->JointAnimations.at(bone->ID);
|
||||
|
||||
Animation::Keyframe currentFrame;
|
||||
Animation::Keyframe nextFrame;
|
||||
|
||||
if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone
|
||||
for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame
|
||||
if (time >= boneKeyFrames.at(index).Time) {
|
||||
currentFrame = boneKeyFrames.at(index);
|
||||
nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float progress;
|
||||
|
||||
if (nextFrame.Index == 0) {
|
||||
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
|
||||
} else {
|
||||
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (progress > 1.0f || progress < 0.0f) {
|
||||
LOG_INFO("Progress: %f", progress);
|
||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
||||
}
|
||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
||||
|
||||
jointTransform.PositionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
||||
jointTransform.RotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
||||
jointTransform.ScaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
||||
|
||||
// Flag for no root motion
|
||||
if (bone == RootBone && noRootMotion) {
|
||||
jointTransform.PositionInterp.x = 0;
|
||||
jointTransform.PositionInterp.z = 0;
|
||||
}
|
||||
|
||||
JointTransforms.push_back(jointTransform);
|
||||
|
||||
} else { // 1 keyframes for the current bone
|
||||
currentFrame = boneKeyFrames.at(0);
|
||||
jointTransform.PositionInterp = currentFrame.BoneProperties.Position;
|
||||
jointTransform.RotationInterp = currentFrame.BoneProperties.Rotation;
|
||||
jointTransform.ScaleInterp = currentFrame.BoneProperties.Scale;
|
||||
JointTransforms.push_back(jointTransform);
|
||||
|
||||
}
|
||||
} else { // 0 keyframes for the current bone
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(JointTransforms.size() <= 0) {
|
||||
if (bone->Parent) {
|
||||
boneMatrix = parentMatrix * glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix;
|
||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||
} else {
|
||||
boneMatrix = glm::inverse(bone->OffsetMatrix);
|
||||
boneMatrices[bone->ID] = parentMatrix;
|
||||
}
|
||||
} else if (JointTransforms.size() == 1) {
|
||||
boneMatrix = parentMatrix *(glm::translate(JointTransforms.at(0).PositionInterp) * glm::toMat4(JointTransforms.at(0).RotationInterp) * glm::scale(JointTransforms.at(0).ScaleInterp));
|
||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||
} else {
|
||||
|
||||
glm::vec3 finalPosInterp;
|
||||
glm::quat finalRotInterp;
|
||||
glm::vec3 finalScaleInterp;
|
||||
float totalWeight = 0;
|
||||
|
||||
for (JointFrameTransform jointTransform : JointTransforms) {
|
||||
totalWeight += jointTransform.Weight;
|
||||
}
|
||||
|
||||
|
||||
for (JointFrameTransform jointTransform : JointTransforms)
|
||||
{
|
||||
if(jointTransform.Weight == 1.0f) {
|
||||
finalPosInterp = jointTransform.PositionInterp;
|
||||
finalRotInterp = jointTransform.RotationInterp;
|
||||
finalScaleInterp = jointTransform.ScaleInterp;
|
||||
break;
|
||||
} else {
|
||||
finalPosInterp += jointTransform.PositionInterp * (jointTransform.Weight/totalWeight);
|
||||
finalRotInterp *= glm::slerp(glm::quat(), jointTransform.RotationInterp, (jointTransform.Weight/totalWeight));
|
||||
finalScaleInterp += jointTransform.ScaleInterp * (jointTransform.Weight/totalWeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
boneMatrix = parentMatrix *(glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp));
|
||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (auto &child : bone->Children) {
|
||||
AccumulateBoneTransforms(noRootMotion, animations, boneMatrices, child, boneMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix)
|
||||
{
|
||||
glm::mat4 boneMatrix;
|
||||
|
||||
|
||||
|
||||
std::vector<JointFrameTransform> JointTransforms;
|
||||
|
||||
for (const AnimationData animationData : animations) {
|
||||
const Animation* animation = animationData.animation;
|
||||
const float time = animationData.time;
|
||||
|
||||
JointFrameTransform jointTransform;
|
||||
jointTransform.Weight = animationData.weight;;
|
||||
|
||||
if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
|
||||
std::vector<Animation::Keyframe> boneKeyFrames = animation->JointAnimations.at(bone->ID);
|
||||
|
||||
Animation::Keyframe currentFrame;
|
||||
Animation::Keyframe nextFrame;
|
||||
|
||||
if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone
|
||||
for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame
|
||||
if (time >= boneKeyFrames.at(index).Time) {
|
||||
currentFrame = boneKeyFrames.at(index);
|
||||
nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float progress;
|
||||
|
||||
if (nextFrame.Index == 0) {
|
||||
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
|
||||
} else {
|
||||
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (progress > 1.0f || progress < 0.0f) {
|
||||
LOG_INFO("Progress: %f", progress);
|
||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
||||
}
|
||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
||||
|
||||
jointTransform.PositionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
||||
jointTransform.RotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
||||
jointTransform.ScaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
||||
|
||||
// Flag for no root motion
|
||||
if (bone == RootBone && noRootMotion) {
|
||||
jointTransform.PositionInterp.x = 0;
|
||||
jointTransform.PositionInterp.z = 0;
|
||||
}
|
||||
|
||||
JointTransforms.push_back(jointTransform);
|
||||
|
||||
} else { // 1 keyframes for the current bone
|
||||
currentFrame = boneKeyFrames.at(0);
|
||||
jointTransform.PositionInterp = currentFrame.BoneProperties.Position;
|
||||
jointTransform.RotationInterp = currentFrame.BoneProperties.Rotation;
|
||||
jointTransform.ScaleInterp = currentFrame.BoneProperties.Scale;
|
||||
JointTransforms.push_back(jointTransform);
|
||||
|
||||
}
|
||||
} else { // 0 keyframes for the current bone
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
glm::mat4 offset = GetOffsetTransform(bone, animationOffset);
|
||||
|
||||
if (JointTransforms.size() == 0) {
|
||||
if (bone->Parent) {
|
||||
if (offset != glm::mat4(1)) {
|
||||
boneMatrix = parentMatrix * offset;// *((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix));
|
||||
} else {
|
||||
boneMatrix = parentMatrix *((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix));
|
||||
|
||||
}
|
||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||
} else {
|
||||
boneMatrix = offset * glm::inverse(bone->OffsetMatrix);
|
||||
boneMatrices[bone->ID] = parentMatrix;
|
||||
}
|
||||
} else {
|
||||
|
||||
glm::vec3 finalPosInterp;
|
||||
glm::quat finalRotInterp;
|
||||
glm::vec3 finalScaleInterp;
|
||||
float totalWeight = 0;
|
||||
|
||||
for (JointFrameTransform jointTransform : JointTransforms) {
|
||||
totalWeight += jointTransform.Weight;
|
||||
}
|
||||
|
||||
|
||||
for (JointFrameTransform jointTransform : JointTransforms) {
|
||||
if (jointTransform.Weight == 1.0f) {
|
||||
finalPosInterp = jointTransform.PositionInterp;
|
||||
finalRotInterp = jointTransform.RotationInterp;
|
||||
finalScaleInterp = jointTransform.ScaleInterp;
|
||||
break;
|
||||
} else {
|
||||
finalPosInterp += jointTransform.PositionInterp * (jointTransform.Weight/totalWeight);
|
||||
finalRotInterp *= glm::slerp(glm::quat(), jointTransform.RotationInterp, (jointTransform.Weight/totalWeight));
|
||||
finalScaleInterp += jointTransform.ScaleInterp * (jointTransform.Weight/totalWeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (offset != glm::mat4(1)) {
|
||||
boneMatrix = parentMatrix * ((glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) + offset);
|
||||
} else {
|
||||
boneMatrix = parentMatrix * (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp));
|
||||
}
|
||||
|
||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||
}
|
||||
|
||||
for (auto &child : bone->Children) {
|
||||
AccumulateBoneTransforms(noRootMotion, animations, animationOffset, boneMatrices, child, boneMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
glm::mat4 Skeleton::GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset)
|
||||
{
|
||||
const Animation* animation = animationOffset.animation;
|
||||
float time = animationOffset.time;
|
||||
|
||||
glm::vec3 position = glm::vec3(0);
|
||||
glm::quat rotation = glm::quat();
|
||||
glm::vec3 scale = glm::vec3(1);
|
||||
|
||||
if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
|
||||
std::vector<Animation::Keyframe> boneKeyFrames = animation->JointAnimations.at(bone->ID);
|
||||
|
||||
Animation::Keyframe currentFrame;
|
||||
Animation::Keyframe nextFrame;
|
||||
|
||||
if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone
|
||||
for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame
|
||||
if (time >= boneKeyFrames.at(index).Time) {
|
||||
currentFrame = boneKeyFrames.at(index);
|
||||
nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float progress;
|
||||
|
||||
if (nextFrame.Index == 0) {
|
||||
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
|
||||
} else {
|
||||
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (progress > 1.0f || progress < 0.0f) {
|
||||
LOG_INFO("Progress: %f", progress);
|
||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
||||
}
|
||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
||||
|
||||
position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
||||
rotation = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
||||
scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
||||
|
||||
|
||||
} else { // 1 keyframes for the current bone
|
||||
currentFrame = boneKeyFrames.at(0);
|
||||
position = currentFrame.BoneProperties.Position;
|
||||
rotation = currentFrame.BoneProperties.Rotation;
|
||||
scale = currentFrame.BoneProperties.Scale;
|
||||
}
|
||||
}
|
||||
|
||||
return (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale));
|
||||
}
|
||||
|
||||
|
||||
glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix)
|
||||
{
|
||||
glm::mat4 boneMatrix;
|
||||
|
||||
Animation::Keyframe currentFrame;
|
||||
Animation::Keyframe nextFrame;
|
||||
|
||||
if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
|
||||
std::vector<Animation::Keyframe> boneKeyFrames = animation->JointAnimations.at(bone->ID);
|
||||
|
||||
if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone
|
||||
for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame
|
||||
if (time >= boneKeyFrames.at(index).Time) {
|
||||
currentFrame = boneKeyFrames.at(index);
|
||||
nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float progress;
|
||||
|
||||
if (nextFrame.Index == 0) {
|
||||
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
|
||||
} else {
|
||||
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||
}
|
||||
|
||||
if (progress > 1.0f || progress < 0.0f) {
|
||||
LOG_INFO("Progress %f", progress);
|
||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
||||
}
|
||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
||||
|
||||
glm::vec3 positionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
||||
glm::quat rotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
||||
glm::vec3 scaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
||||
|
||||
boneMatrix = (glm::translate(positionInterp) * glm::toMat4(rotationInterp) * glm::scale(scaleInterp)) * childMatrix;
|
||||
|
||||
} else { // 1 keyframes for the current bone
|
||||
currentFrame = boneKeyFrames.at(0);
|
||||
boneMatrix = (glm::translate(currentFrame.BoneProperties.Position) * glm::toMat4(currentFrame.BoneProperties.Rotation) * glm::scale(currentFrame.BoneProperties.Scale)) * childMatrix;
|
||||
|
||||
}
|
||||
} else { // 0 keyframes for the current bone
|
||||
if (bone->Parent) {
|
||||
boneMatrix = bone->Parent->OffsetMatrix * glm::inverse(bone->OffsetMatrix) * childMatrix;
|
||||
} else {
|
||||
boneMatrix = glm::inverse(bone->OffsetMatrix) * childMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
if (bone->Parent) {
|
||||
return GetBoneTransform(bone->Parent, animation, time, boneMatrix);
|
||||
} else {
|
||||
return boneMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
int Skeleton::GetBoneID(std::string name)
|
||||
@@ -134,11 +562,13 @@ void Skeleton::PrintSkeleton(const Bone* bone, int depthCount)
|
||||
|
||||
int Skeleton::GetKeyframe(const Animation& animation, double time)
|
||||
{
|
||||
|
||||
/*
|
||||
if (time < 0) {
|
||||
time = 0;
|
||||
}
|
||||
if (time >= animation.Duration) {
|
||||
return animation.Keyframes.size() - 1;
|
||||
return animation..size() - 1;
|
||||
}
|
||||
|
||||
for (int keyframe = 0; keyframe < animation.Keyframes.size(); ++keyframe) {
|
||||
@@ -146,6 +576,8 @@ int Skeleton::GetKeyframe(const Animation& animation, double time)
|
||||
return (keyframe - 1) % animation.Keyframes.size();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+3
-1
@@ -14,9 +14,10 @@
|
||||
#include "Game/Systems/CapturePointSystem.h"
|
||||
#include "Game/Systems/PickupSpawnSystem.h"
|
||||
#include "Game/Systems/WeaponSystem.h"
|
||||
#include "Rendering/AnimationSystem.h"
|
||||
#include "Rendering/BoneAttachmentSystem.h"
|
||||
#include "Game/Systems/PlayerHUD.h"
|
||||
#include "Game/Systems/LifetimeSystem.h"
|
||||
#include "../Engine/Rendering/AnimationSystem.h"
|
||||
|
||||
Game::Game(int argc, char* argv[])
|
||||
{
|
||||
@@ -111,6 +112,7 @@ Game::Game(int argc, char* argv[])
|
||||
|
||||
// Collision and TriggerSystem should update after player.
|
||||
++updateOrderLevel;
|
||||
m_SystemPipeline->AddSystem<BoneAttachmentSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<CollisionSystem>(updateOrderLevel, m_OctreeCollision);
|
||||
m_SystemPipeline->AddSystem<TriggerSystem>(updateOrderLevel, m_OctreeTrigger);
|
||||
++updateOrderLevel;
|
||||
|
||||
@@ -124,19 +124,19 @@ void PlayerMovementSystem::Update(double dt)
|
||||
//TODO: add assault dash animation here
|
||||
if (glm::length(controller->Movement()) > 0.f) {
|
||||
if (controller->Crouching()) {
|
||||
cAnimation["Name"] = "Crouch Walk";
|
||||
(double&)cAnimation["Speed"] = 1.f * -glm::sign(controller->Movement().z);
|
||||
cAnimation["AnimationName1"] = "Crouch Walk";
|
||||
(double&)cAnimation["Speed1"] = 1.f * -glm::sign(controller->Movement().z);
|
||||
} else {
|
||||
cAnimation["Name"] = "Run";
|
||||
(double&)cAnimation["Speed"] = 2.f * -glm::sign(controller->Movement().z);
|
||||
cAnimation["AnimationName1"] = "Run";
|
||||
(double&)cAnimation["Speed1"] = 2.f * -glm::sign(controller->Movement().z);
|
||||
}
|
||||
} else {
|
||||
if (controller->Crouching()) {
|
||||
cAnimation["Name"] = "Crouch";
|
||||
cAnimation["AnimationName1"] = "Crouch";
|
||||
(double&)cAnimation["Speed"] = 1.f;
|
||||
} else {
|
||||
cAnimation["Name"] = "Hold Pos";
|
||||
(double&)cAnimation["Speed"] = 1.f;
|
||||
cAnimation["AnimationName1"] = "Hold Pos";
|
||||
(double&)cAnimation["Speed1"] = 1.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,13 +47,24 @@ bool Export::Meshes(std::string pathName, bool selectedOnly)
|
||||
|
||||
for (unsigned int i = 0; i < connections.length(); i++) {
|
||||
if (connections[i].node().apiType() == MFn::kSkinClusterFilter) {
|
||||
MGlobal::select(shape.parent(i), MGlobal::kReplaceList);
|
||||
MGlobal::displayInfo(MString() + "Moving " + thisNode.name() + " to bindPose.");
|
||||
shape.parent(0, &status);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "shape.parent(0, &status) failed with: " + status.errorString());
|
||||
}
|
||||
status = MGlobal::select(shape.parent(0), MGlobal::kReplaceList);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "Parent to " + thisNode.name() + " failed");
|
||||
}
|
||||
|
||||
MFnDependencyNode tmp(shape.parent(0));
|
||||
MGlobal::displayInfo(MString() + "Moving " + tmp.name() + " to bindPose.");
|
||||
|
||||
status = MGlobal::executeCommand("GoToBindPose;");
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "GoToBindPose: " + status.errorString());
|
||||
}
|
||||
MGlobal::displayInfo(MString() + "Has moved " + thisNode.name() + " to bindPose.");
|
||||
|
||||
MGlobal::displayInfo(MString() + "Has moved " + tmp.name() + " to bindPose.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,6 +120,8 @@ bool Export::Materials(std::string pathName)
|
||||
|
||||
bool Export::Animations(std::string pathName, std::vector<AnimationInfo> animInfo)
|
||||
{
|
||||
allAnimations.clear();
|
||||
allBindPoses.clear();
|
||||
if (MAnimControl::currentTime().unit() != MTime::kNTSCField) {
|
||||
|
||||
MGlobal::displayError(MString() + "Please change to 60 FPS under Preferences/Settings!");
|
||||
|
||||
@@ -82,16 +82,36 @@ bool Material::findColorTexture(MaterialNode& material_node, MFnDependencyNode&
|
||||
workspace);
|
||||
FullPath = FullPath.substr(workspace.length());
|
||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||
material_node.ColorMapFile = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
|
||||
material_node.ColorMapFileLength = material_node.ColorMapFile.length() + 1;
|
||||
// Test
|
||||
MGlobal::displayInfo(MString() + "getAbsolutePathToResources: " + workspace);
|
||||
MGlobal::displayInfo(MString() + "Texture file: " + FullPath.c_str());
|
||||
MaterialNode::Texture newTexture;
|
||||
|
||||
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||
|
||||
MPlug uvRepeatFile = TextureNode.findPlug("repeatUV");
|
||||
|
||||
uvRepeatFile.connectedTo(AllConnections, true, false);
|
||||
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kPlace2dTexture)) {
|
||||
MFnDependencyNode place2DTexture(AllConnections[i].node());
|
||||
MPlug uvRepeat = place2DTexture.findPlug("repeatUV");
|
||||
|
||||
newTexture.UVTiling[0] = uvRepeat.child(0).asFloat();
|
||||
newTexture.UVTiling[1] = uvRepeat.child(1).asFloat();
|
||||
}
|
||||
}
|
||||
|
||||
material_node.ColorMaps.push_back(newTexture);
|
||||
if(material_node.type == MaterialNode::MaterialType::Basic)
|
||||
material_node.type = MaterialNode::MaterialType::SingleTextures;
|
||||
return true;
|
||||
|
||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||
MGlobal::displayInfo(MString() + "find splat map");
|
||||
return findSplatTextures(material_node, material_node.ColorMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -120,9 +140,31 @@ bool Material::findNormalTexture(MaterialNode& material_node, MFnDependencyNode&
|
||||
workspace);
|
||||
FullPath = FullPath.substr(workspace.length());
|
||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||
material_node.NormalMapFile = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
material_node.NormalMapFileLength = material_node.NormalMapFile.length() + 1;
|
||||
|
||||
MaterialNode::Texture newTexture;
|
||||
|
||||
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||
|
||||
MPlug uvRepeatFile = TextureNode.findPlug("repeatUV");
|
||||
|
||||
uvRepeatFile.connectedTo(AllConnections, true, false);
|
||||
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kPlace2dTexture)) {
|
||||
MFnDependencyNode place2DTexture(AllConnections[i].node());
|
||||
MPlug uvRepeat = place2DTexture.findPlug("repeatUV");
|
||||
|
||||
newTexture.UVTiling[0] = uvRepeat.child(0).asFloat();
|
||||
newTexture.UVTiling[1] = uvRepeat.child(1).asFloat();
|
||||
}
|
||||
}
|
||||
|
||||
material_node.NormalMaps.push_back(newTexture);
|
||||
return true;
|
||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||
MGlobal::displayInfo(MString() + "find splat map");
|
||||
return findSplatTextures(material_node, material_node.NormalMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,9 +192,34 @@ bool Material::findSpecularTexture(MaterialNode& material_node, MFnDependencyNod
|
||||
workspace);
|
||||
FullPath = FullPath.substr(workspace.length());
|
||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||
material_node.SpecularMapFile = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
material_node.SpecularMapFileLength = material_node.SpecularMapFile.length() + 1;
|
||||
|
||||
MaterialNode::Texture newTexture;
|
||||
|
||||
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||
|
||||
MPlug uvRepeatFile = TextureNode.findPlug("repeatUV");
|
||||
|
||||
uvRepeatFile.connectedTo(AllConnections, true, false);
|
||||
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kPlace2dTexture)) {
|
||||
//C:\Users\kamisama\Desktop\TacticalZ\assets\test
|
||||
MFnDependencyNode place2DTexture(AllConnections[i].node());
|
||||
MPlug uvRepeat = place2DTexture.findPlug("repeatUV");
|
||||
|
||||
newTexture.UVTiling[0] = uvRepeat.child(0).asFloat();
|
||||
newTexture.UVTiling[1] = uvRepeat.child(1).asFloat();
|
||||
}
|
||||
}
|
||||
|
||||
material_node.SpecularMaps.push_back(newTexture);
|
||||
if (material_node.type == MaterialNode::MaterialType::Basic)
|
||||
material_node.type = MaterialNode::MaterialType::SingleTextures;
|
||||
return true;
|
||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||
MGlobal::displayInfo(MString() + "find splat map");
|
||||
return findSplatTextures(material_node, material_node.SpecularMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -168,7 +235,7 @@ bool Material::findIncandescenceTexture(MaterialNode& material_node, MFnDependen
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kFileTexture)) {
|
||||
MFnDependencyNode TextureNode(AllConnections[i].node());
|
||||
|
||||
|
||||
std::string FullPath = TextureNode.findPlug("ftn").asString().asChar();
|
||||
m_TexturePaths.push_back(FullPath);
|
||||
|
||||
@@ -177,14 +244,141 @@ bool Material::findIncandescenceTexture(MaterialNode& material_node, MFnDependen
|
||||
workspace);
|
||||
FullPath = FullPath.substr(workspace.length());
|
||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||
material_node.IncandescenceMapFile = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
material_node.IncandescenceMapFileLength = material_node.IncandescenceMapFile.length() + 1;
|
||||
|
||||
MaterialNode::Texture newTexture;
|
||||
|
||||
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||
|
||||
MPlug uvRepeatFile = TextureNode.findPlug("repeatUV");
|
||||
|
||||
uvRepeatFile.connectedTo(AllConnections, true, false);
|
||||
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kPlace2dTexture)) {
|
||||
MFnDependencyNode place2DTexture(AllConnections[i].node());
|
||||
MPlug uvRepeat = place2DTexture.findPlug("repeatUV");
|
||||
|
||||
newTexture.UVTiling[0] = uvRepeat.child(0).asFloat();
|
||||
newTexture.UVTiling[1] = uvRepeat.child(1).asFloat();
|
||||
}
|
||||
}
|
||||
|
||||
material_node.IncandescenceMaps.push_back(newTexture);
|
||||
if (material_node.type == MaterialNode::MaterialType::Basic)
|
||||
material_node.type = MaterialNode::MaterialType::SingleTextures;
|
||||
return true;
|
||||
|
||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||
MGlobal::displayInfo(MString() + "find splat map");
|
||||
return findSplatTextures(material_node, material_node.IncandescenceMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//C:\Users\kamisama\Desktop\TacticalZ\assets\test
|
||||
|
||||
bool Material::findSplatTextures(MaterialNode& material_node, std::vector<MaterialNode::Texture>& textureVector, MFnDependencyNode& node) {
|
||||
//Get all Inputs in LayeredTexture
|
||||
MPlug inputs = node.findPlug("inputs");
|
||||
MGlobal::displayInfo(MString() + "inputs.numElements(): " + inputs.numElements());
|
||||
|
||||
MPlugArray AllConnections;
|
||||
MStatus test;
|
||||
//Try to find splat texture if using custom splatmap build up.
|
||||
inputs[0].child(1).connectedTo(AllConnections, true, false);
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kMultiplyDivide)) {
|
||||
MGlobal::displayInfo(MString() + "found kMultiplyDivide");
|
||||
MFnDependencyNode multiplyDivide(AllConnections[i].node());
|
||||
multiplyDivide.findPlug("input1", &test).child(0).connectedTo(AllConnections, true, false);;
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kFileTexture)) {
|
||||
MFnDependencyNode TextureNode(AllConnections[i].node());
|
||||
|
||||
std::string FullPath = TextureNode.findPlug("ftn").asString().asChar();
|
||||
m_TexturePaths.push_back(FullPath);
|
||||
|
||||
MString workspace;
|
||||
MStatus status = MGlobal::executeCommand(MString("workspace -q -rd;"),
|
||||
workspace);
|
||||
FullPath = FullPath.substr(workspace.length());
|
||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||
|
||||
MaterialNode::Texture newTexture;
|
||||
|
||||
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||
|
||||
MPlug uvRepeatFile = TextureNode.findPlug("repeatUV");
|
||||
|
||||
uvRepeatFile.connectedTo(AllConnections, true, false);
|
||||
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kPlace2dTexture)) {
|
||||
MFnDependencyNode place2DTexture(AllConnections[i].node());
|
||||
MPlug uvRepeat = place2DTexture.findPlug("repeatUV");
|
||||
|
||||
newTexture.UVTiling[0] = uvRepeat.child(0).asFloat();
|
||||
newTexture.UVTiling[1] = uvRepeat.child(1).asFloat();
|
||||
}
|
||||
}
|
||||
material_node.SplatMap = newTexture;
|
||||
material_node.type = MaterialNode::MaterialType::SplatMapping;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < inputs.numElements(); i++) {
|
||||
//Get connections to color in input[i]
|
||||
inputs[i].child(0).connectedTo(AllConnections, true, false);
|
||||
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kFileTexture)) {
|
||||
MFnDependencyNode TextureNode(AllConnections[i].node());
|
||||
|
||||
std::string FullPath = TextureNode.findPlug("ftn").asString().asChar();
|
||||
m_TexturePaths.push_back(FullPath);
|
||||
|
||||
MString workspace;
|
||||
MStatus status = MGlobal::executeCommand(MString("workspace -q -rd;"),
|
||||
workspace);
|
||||
FullPath = FullPath.substr(workspace.length());
|
||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||
|
||||
MaterialNode::Texture newTexture;
|
||||
|
||||
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||
|
||||
MPlug uvRepeatFile = TextureNode.findPlug("repeatUV");
|
||||
|
||||
uvRepeatFile.connectedTo(AllConnections, true, false);
|
||||
|
||||
for (int i = 0; i < AllConnections.length(); i++) {
|
||||
if (AllConnections[i].node().hasFn(MFn::kPlace2dTexture)) {
|
||||
MFnDependencyNode place2DTexture(AllConnections[i].node());
|
||||
MPlug uvRepeat = place2DTexture.findPlug("repeatUV");
|
||||
|
||||
newTexture.UVTiling[0] = uvRepeat.child(0).asFloat();
|
||||
newTexture.UVTiling[1] = uvRepeat.child(1).asFloat();
|
||||
}
|
||||
}
|
||||
textureVector.push_back(newTexture);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (AllConnections.length() == 0) {
|
||||
MaterialNode::Texture newTexture;
|
||||
newTexture.FileNameLength = 0;
|
||||
textureVector.push_back(newTexture);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns the absolute path for all textures. Use for copying texture files.
|
||||
std::vector<std::string>* Material::TexturePaths()
|
||||
{
|
||||
@@ -209,7 +403,6 @@ std::vector<MaterialNode>* Material::DoIt(Mesh mesh)
|
||||
meshHasMaterial = true;
|
||||
MaterialStorage.IndexStart = totalIndices;
|
||||
MaterialStorage.IndexEnd = totalIndices + aMeshMaterial.second.size() - 1;
|
||||
break;
|
||||
}
|
||||
totalIndices += aMeshMaterial.second.size();
|
||||
}
|
||||
@@ -226,7 +419,10 @@ std::vector<MaterialNode>* Material::DoIt(Mesh mesh)
|
||||
MaterialStorage.ReflectionFactor = 0.0f;
|
||||
MaterialStorage.SpecularExponent = 0.0f;
|
||||
}
|
||||
|
||||
MaterialStorage.NumColorMaps = MaterialStorage.ColorMaps.size();
|
||||
MaterialStorage.NumNormalMaps = MaterialStorage.NormalMaps.size();
|
||||
MaterialStorage.NumSpecularMaps = MaterialStorage.SpecularMaps.size();
|
||||
MaterialStorage.NumIncandescenceMaps = MaterialStorage.IncandescenceMaps.size();
|
||||
m_AllMaterials.push_back(MaterialStorage);
|
||||
}
|
||||
matIt.next();
|
||||
|
||||
@@ -11,62 +11,123 @@
|
||||
#include "OutputData.h"
|
||||
#include "Mesh.h"
|
||||
|
||||
|
||||
//#define ColorMapSplat 1
|
||||
//#define SpecularMapSplat 1 << 1
|
||||
//#define NormalMapSplat 1 << 2
|
||||
//#define IncandescenceMapSplat 1 << 3
|
||||
|
||||
|
||||
|
||||
class MaterialNode : public OutputData
|
||||
{
|
||||
public:
|
||||
class Texture : public OutputData {
|
||||
public:
|
||||
unsigned int FileNameLength = 0;
|
||||
std::string FileName;
|
||||
float UVTiling[2]{ 1.0f, 1.0f };
|
||||
|
||||
virtual void WriteBinary(std::ostream& out)
|
||||
{
|
||||
out.write((char*)&FileNameLength, sizeof(unsigned int));
|
||||
out.write(FileName.c_str(), FileNameLength);
|
||||
out.write((char*)&UVTiling, sizeof(float) * 2);
|
||||
}
|
||||
|
||||
virtual void WriteASCII(std::ostream& out) const
|
||||
{
|
||||
out << "FileNameLength: " << FileNameLength << endl;
|
||||
out << "FileName: " << FileName << endl;
|
||||
out << "UV tiling: " << UVTiling[0] << " " << UVTiling[1] << endl;
|
||||
}
|
||||
};
|
||||
|
||||
enum class MaterialType { Basic = 1, SplatMapping, SingleTextures };
|
||||
|
||||
MaterialType type = MaterialType::Basic;
|
||||
|
||||
std::string Name;
|
||||
|
||||
float ReflectionFactor;
|
||||
float SpecularExponent;
|
||||
|
||||
float DiffuseColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||
unsigned int ColorMapFileLength = 0;
|
||||
std::string ColorMapFile;
|
||||
float DiffuseColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||
float SpecularColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||
float IncandescenceColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||
|
||||
float SpecularColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||
unsigned int SpecularMapFileLength = 0;
|
||||
std::string SpecularMapFile;
|
||||
unsigned int IndexStart;
|
||||
unsigned int IndexEnd;
|
||||
|
||||
unsigned int NormalMapFileLength = 0;
|
||||
std::string NormalMapFile;
|
||||
|
||||
float IncandescenceColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||
unsigned int IncandescenceMapFileLength = 0;
|
||||
std::string IncandescenceMapFile;
|
||||
|
||||
unsigned int IndexStart;
|
||||
unsigned int IndexEnd;
|
||||
unsigned char NumColorMaps = 0;
|
||||
unsigned char NumSpecularMaps = 0;
|
||||
unsigned char NumNormalMaps = 0;
|
||||
unsigned char NumIncandescenceMaps = 0;
|
||||
Texture SplatMap;
|
||||
std::vector<Texture> ColorMaps;
|
||||
std::vector<Texture> SpecularMaps;
|
||||
std::vector<Texture> NormalMaps;
|
||||
std::vector<Texture> IncandescenceMaps;
|
||||
|
||||
virtual void WriteBinary(std::ostream& out)
|
||||
{
|
||||
out.write((char*)&ColorMapFileLength, sizeof(unsigned int));
|
||||
out.write((char*)&NormalMapFileLength, sizeof(unsigned int));
|
||||
out.write((char*)&SpecularMapFileLength, sizeof(unsigned int));
|
||||
out.write((char*)&IncandescenceMapFileLength, sizeof(unsigned int));
|
||||
|
||||
|
||||
out.write((char*)&type, sizeof(MaterialType));
|
||||
out.write((char*)&SpecularExponent, sizeof(float));
|
||||
out.write((char*)&ReflectionFactor, sizeof(float));
|
||||
|
||||
out.write((char*)&DiffuseColor, sizeof(float) * 3);
|
||||
out.write((char*)&SpecularColor, sizeof(float) * 3);
|
||||
out.write((char*)&IncandescenceColor, sizeof(float) * 3);
|
||||
|
||||
out.write((char*)&IndexStart, sizeof(unsigned int));
|
||||
out.write((char*)&IndexEnd, sizeof(unsigned int));
|
||||
if (type != MaterialType::Basic) {
|
||||
if (type == MaterialType::SplatMapping) {
|
||||
SplatMap.WriteBinary(out);
|
||||
}
|
||||
out.write((char*)&NumColorMaps, sizeof(unsigned char));
|
||||
out.write((char*)&NumSpecularMaps, sizeof(unsigned char));
|
||||
out.write((char*)&NumNormalMaps, sizeof(unsigned char));
|
||||
out.write((char*)&NumIncandescenceMaps, sizeof(unsigned char));
|
||||
}
|
||||
|
||||
out.write(ColorMapFile.c_str(), ColorMapFileLength);
|
||||
out.write(NormalMapFile.c_str(), NormalMapFileLength);
|
||||
out.write(SpecularMapFile.c_str(), SpecularMapFileLength);
|
||||
out.write(IncandescenceMapFile.c_str(), IncandescenceMapFileLength);
|
||||
if (type != MaterialType::Basic) {
|
||||
for (auto aTexture : ColorMaps) {
|
||||
aTexture.WriteBinary(out);
|
||||
}
|
||||
for (auto aTexture : SpecularMaps) {
|
||||
aTexture.WriteBinary(out);
|
||||
}
|
||||
for (auto aTexture : NormalMaps) {
|
||||
aTexture.WriteBinary(out);
|
||||
}
|
||||
for (auto aTexture : IncandescenceMaps) {
|
||||
aTexture.WriteBinary(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void WriteASCII(std::ostream& out) const
|
||||
{
|
||||
out << "New Material _ not in binary" << endl;
|
||||
out << "number of indices: " << Name << " _ not in binary" << endl;
|
||||
|
||||
out << "ColorMapFile length: " << ColorMapFileLength << endl;
|
||||
out << "NormalMapFile length: " << NormalMapFileLength << endl;
|
||||
out << "SpecularMapFile length: " << SpecularMapFileLength << endl;
|
||||
out << "IncandescenceMapFile length: " << IncandescenceMapFileLength << endl;
|
||||
out << "MaterialType(enum): ";
|
||||
switch (type) {
|
||||
case MaterialType::Basic:
|
||||
out << "Basic";
|
||||
break;
|
||||
case MaterialType::SplatMapping:
|
||||
out << "SplatMapping";
|
||||
break;
|
||||
case MaterialType::SingleTextures:
|
||||
out << "SingleTextures";
|
||||
break;
|
||||
};
|
||||
|
||||
out << endl;
|
||||
|
||||
out << "Material Name: " << Name << " _ not in binary" << endl;
|
||||
|
||||
out << "SpecularExponent: " << SpecularExponent << endl;
|
||||
out << "ReflectionFactor: " << ReflectionFactor << endl;
|
||||
@@ -76,17 +137,38 @@ public:
|
||||
out << "IndexStart: " << IndexStart << endl;
|
||||
out << "IndexEnd: " << IndexEnd << endl;
|
||||
|
||||
if (ColorMapFileLength > 0)
|
||||
out << "ColorMapFile: " << ColorMapFile << endl;
|
||||
switch (type) {
|
||||
case MaterialType::SplatMapping:
|
||||
out << "SplatMap _ not in binary " << endl;
|
||||
SplatMap.WriteASCII(out);
|
||||
//Intended fall trought
|
||||
case MaterialType::SingleTextures:
|
||||
out << "NumColormaps (is unsigned char in Binary): " << ((unsigned int)NumColorMaps) << endl;
|
||||
out << "NumSpecularMap (is unsigned char in Binary): " << ((unsigned int)NumSpecularMaps) << endl;
|
||||
out << "NumNormalMap (is unsigned char in Binary): " << ((unsigned int)NumNormalMaps) << endl;
|
||||
out << "NumIncandescenceMap (is unsigned char in Binary): " << ((unsigned int)NumIncandescenceMaps )<< endl;
|
||||
|
||||
if (NormalMapFileLength > 0)
|
||||
out << "NormalMapFile: " << NormalMapFile << endl;
|
||||
|
||||
if (SpecularMapFileLength > 0)
|
||||
out << "SpecularMapFile: " << SpecularMapFile << endl;
|
||||
|
||||
if (IncandescenceMapFileLength > 0)
|
||||
out << "IncandescenceMapFile: " << IncandescenceMapFile << endl;
|
||||
out << "ColorMaps _ not in binary " << endl;
|
||||
for (auto aTexture : ColorMaps) {
|
||||
aTexture.WriteASCII(out);
|
||||
}
|
||||
|
||||
out << "SpecularMaps _ not in binary " << endl;
|
||||
for (auto aTexture : SpecularMaps) {
|
||||
aTexture.WriteASCII(out);
|
||||
}
|
||||
|
||||
out << "NormalMaps _ not in binary " << endl;
|
||||
for (auto aTexture : NormalMaps) {
|
||||
aTexture.WriteASCII(out);
|
||||
}
|
||||
|
||||
out << "IncandescenceMaps _ not in binary " << endl;
|
||||
for (auto aTexture : IncandescenceMaps) {
|
||||
aTexture.WriteASCII(out);
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -107,6 +189,7 @@ private:
|
||||
bool findNormalTexture(MaterialNode& material_node, MFnDependencyNode& node);
|
||||
bool findSpecularTexture(MaterialNode& material_node, MFnDependencyNode& node);
|
||||
bool findIncandescenceTexture(MaterialNode& material_node, MFnDependencyNode& node);
|
||||
bool findSplatTextures(MaterialNode& material_node, std::vector<MaterialNode::Texture>& textureVector, MFnDependencyNode& node);
|
||||
void grabLambertProperties(MaterialNode& material_node, MFnDependencyNode& node);
|
||||
void grabBlinnProperties(MaterialNode& material_node, MFnDependencyNode& node);
|
||||
void grabPhongProperties(MaterialNode& material_node, MFnDependencyNode& node);
|
||||
|
||||
@@ -40,8 +40,9 @@
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
@@ -77,6 +78,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<TargetExt>.mll</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@@ -135,7 +137,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;QT_DLL;QT_NO_DEBUG;QT_NO_IMPORT_QT47_QML;UNICODE;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\Maya2016\include;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
@@ -144,7 +146,7 @@
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<AdditionalDependencies>qtmain.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
||||
@@ -60,8 +60,6 @@ Menu::Menu(QDialog* dialog)
|
||||
|
||||
m_ExportPath = new QLineEdit;
|
||||
m_FileDialog = new QFileDialog;
|
||||
QString tmpPath("C:/Users/Nickelodion/Desktop/workspace/tacticalZ/assets/models/");
|
||||
m_ExportPath->setText(tmpPath);
|
||||
QLabel* exportLabel = new QLabel;
|
||||
exportLabel->setText("Export Path:");
|
||||
QLabel* nameLabel = new QLabel;
|
||||
|
||||
@@ -8,95 +8,91 @@ MeshClass::MeshClass()
|
||||
|
||||
}
|
||||
|
||||
std::map<int, MeshClass::WeightInfo> MeshClass::GetWeightData()
|
||||
{
|
||||
MS status;
|
||||
map<int, WeightInfo> weightMap;
|
||||
|
||||
MItDependencyNodes it(MFn::kSkinClusterFilter);
|
||||
|
||||
while (!it.isDone()) {
|
||||
|
||||
MObject object = it.thisNode(&status);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + " it.thisNode() ERROR: " + status.errorString());
|
||||
break;
|
||||
}
|
||||
MFnSkinCluster skinCluster(object, &status);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "skinCluster() ERROR: " + status.errorString());
|
||||
break;
|
||||
}
|
||||
MDagPathArray influences;
|
||||
|
||||
unsigned int nrOfInfluences = skinCluster.influenceObjects(influences,&status);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "skinCluster.influenceObjects() ERROR: " + status.errorString());
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned int index;
|
||||
index = skinCluster.indexForOutputConnection(0,&status);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "skinCluster.indexForOutputConnection() ERROR: " + status.errorString());
|
||||
break;
|
||||
}
|
||||
MDagPath skinPath;
|
||||
status = skinCluster.getPathAtIndex(index, skinPath);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "skinCluster.getPathAtIndex() ERROR: " + status.errorString());
|
||||
break;
|
||||
}
|
||||
|
||||
MItGeometry geomIter(skinPath);
|
||||
//for (unsigned int i = 0; i < nrOfInfluences; i++) {
|
||||
// MGlobal::displayInfo(MString() + " Influence object name: " + influences[i].partialPathName().asChar());
|
||||
//}
|
||||
WeightInfo weightInfo;
|
||||
|
||||
while (!geomIter.isDone()) {
|
||||
MObject comp = geomIter.component(&status);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "geomIter.component() ERROR: " + status.errorString());
|
||||
break;
|
||||
}
|
||||
MFloatArray weights;
|
||||
unsigned int influenceCount;
|
||||
status = skinCluster.getWeights(skinPath, comp, weights, influenceCount);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "skinCluster.getWeights() ERROR: " + status.errorString());
|
||||
break;
|
||||
}
|
||||
MFnDependencyNode test(comp);
|
||||
unsigned int nrOfWeights = 0;
|
||||
|
||||
for (unsigned int j = 0; j < weights.length() && nrOfWeights != 4; j++) {
|
||||
if (weights[j] > 0.00001) {
|
||||
weightInfo.BoneWeights[nrOfWeights] = weights[j];
|
||||
weightInfo.BoneIndices[nrOfWeights] = j;
|
||||
nrOfWeights++;
|
||||
}
|
||||
}
|
||||
|
||||
float totalWeight = 0.0f;
|
||||
for (unsigned int i = 0; i < 4; i++) {
|
||||
totalWeight += weightInfo.BoneWeights[i];
|
||||
}
|
||||
for (unsigned int i = 0; i < 4; i++) {
|
||||
weightInfo.BoneWeights[i] /= totalWeight;
|
||||
}
|
||||
weightMap[geomIter.index()] = weightInfo;
|
||||
|
||||
|
||||
for (unsigned int k = 0; k!=nrOfWeights; k++) {
|
||||
MGlobal::displayInfo(MString() + "influence: " + weightInfo.BoneIndices[k] + " weight: " + weightInfo.BoneWeights[k]);
|
||||
}
|
||||
geomIter.next();
|
||||
}
|
||||
it.next();
|
||||
}
|
||||
return weightMap;
|
||||
}
|
||||
//std::map<int, MeshClass::WeightInfo> MeshClass::GetWeightData()
|
||||
//{
|
||||
// MS status;
|
||||
// map<int, WeightInfo> weightMap;
|
||||
//
|
||||
// MItDependencyNodes it(MFn::kSkinClusterFilter);
|
||||
//
|
||||
// while (!it.isDone()) {
|
||||
//
|
||||
// MObject object = it.thisNode(&status);
|
||||
// if (status != MS::kSuccess) {
|
||||
// MGlobal::displayError(MString() + " it.thisNode() ERROR: " + status.errorString());
|
||||
// break;
|
||||
// }
|
||||
// MFnSkinCluster skinCluster(object, &status);
|
||||
// if (status != MS::kSuccess) {
|
||||
// MGlobal::displayError(MString() + "skinCluster() ERROR: " + status.errorString());
|
||||
// break;
|
||||
// }
|
||||
// MDagPathArray influences;
|
||||
//
|
||||
// unsigned int nrOfInfluences = skinCluster.influenceObjects(influences,&status);
|
||||
// if (status != MS::kSuccess) {
|
||||
// MGlobal::displayError(MString() + "skinCluster.influenceObjects() ERROR: " + status.errorString());
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// unsigned int index;
|
||||
// index = skinCluster.indexForOutputConnection(0,&status);
|
||||
// if (status != MS::kSuccess) {
|
||||
// MGlobal::displayError(MString() + "skinCluster.indexForOutputConnection() ERROR: " + status.errorString());
|
||||
// break;
|
||||
// }
|
||||
// MDagPath skinPath;
|
||||
// status = skinCluster.getPathAtIndex(index, skinPath);
|
||||
// if (status != MS::kSuccess) {
|
||||
// MGlobal::displayError(MString() + "skinCluster.getPathAtIndex() ERROR: " + status.errorString());
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// MItGeometry geomIter(skinPath);
|
||||
// //for (unsigned int i = 0; i < nrOfInfluences; i++) {
|
||||
// // MGlobal::displayInfo(MString() + " Influence object name: " + influences[i].partialPathName().asChar());
|
||||
// //}
|
||||
// WeightInfo weightInfo;
|
||||
//
|
||||
// while (!geomIter.isDone()) {
|
||||
// MObject comp = geomIter.component(&status);
|
||||
// if (status != MS::kSuccess) {
|
||||
// MGlobal::displayError(MString() + "geomIter.component() ERROR: " + status.errorString());
|
||||
// break;
|
||||
// }
|
||||
// MFloatArray weights;
|
||||
// unsigned int influenceCount;
|
||||
// status = skinCluster.getWeights(skinPath, comp, weights, influenceCount);
|
||||
// if (status != MS::kSuccess) {
|
||||
// MGlobal::displayError(MString() + "skinCluster.getWeights() ERROR: " + status.errorString());
|
||||
// break;
|
||||
// }
|
||||
// MFnDependencyNode test(comp);
|
||||
// unsigned int nrOfWeights = 0;
|
||||
//
|
||||
// for (unsigned int j = 0; j < weights.length() && nrOfWeights != 4; j++) {
|
||||
// if (weights[j] > 0.00001) {
|
||||
// weightInfo.BoneWeights[nrOfWeights] = weights[j];
|
||||
// weightInfo.BoneIndices[nrOfWeights] = j;
|
||||
// nrOfWeights++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// float totalWeight = 0.0f;
|
||||
// for (unsigned int i = 0; i < 4; i++) {
|
||||
// totalWeight += weightInfo.BoneWeights[i];
|
||||
// }
|
||||
// for (unsigned int i = 0; i < 4; i++) {
|
||||
// weightInfo.BoneWeights[i] /= totalWeight;
|
||||
// }
|
||||
// weightMap[geomIter.index()] = weightInfo;
|
||||
//
|
||||
// geomIter.next();
|
||||
// }
|
||||
// it.next();
|
||||
// }
|
||||
// return weightMap;
|
||||
//}
|
||||
|
||||
Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
{
|
||||
@@ -112,8 +108,6 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
MFnDependencyNode thisNode(node);
|
||||
MPlugArray connections;
|
||||
thisNode.findPlug("inMesh").connectedTo(connections, true, true);
|
||||
MGlobal::displayInfo(MString() + "inMesh");
|
||||
bool hasSkin = false;
|
||||
MPlug weightList, weights;
|
||||
MObject weightListObject;
|
||||
for (unsigned int i = 0; i < connections.length(); i++) {
|
||||
@@ -122,7 +116,7 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
weightList = skinCluster.findPlug("weightList", &status);
|
||||
weightListObject = weightList.attribute();
|
||||
weights = skinCluster.findPlug("weights");
|
||||
hasSkin = true;
|
||||
newMesh.hasSkin = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -138,7 +132,6 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
}
|
||||
|
||||
for (int pathID = 0; pathID < dagPaths.length(); pathID++) {
|
||||
MGlobal::displayInfo(dagPaths[pathID].fullPathName());
|
||||
MDagPath thisMeshPath(dagPaths[pathID]);
|
||||
|
||||
MMatrix transformMatrix = thisMeshPath.inclusiveMatrix(&status);
|
||||
@@ -173,8 +166,7 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
break;
|
||||
}
|
||||
map<string, vector<int>> materialFaceIDs;
|
||||
MGlobal::displayInfo(MString() + "shaderIndexList: " + shaderIndexList.length());
|
||||
MGlobal::displayInfo(MString() + "shaderList: " + shaderList.length());
|
||||
|
||||
MPlugArray plugArray;
|
||||
for (int i = 0; i < shaderIndexList.length(); i++) {
|
||||
MFnDependencyNode shader(shaderList[shaderIndexList[i]]);
|
||||
@@ -261,43 +253,33 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
//mesh.getPoint(vertexIndex, pos, MSpace::kPostTransform);
|
||||
pos = positions[vertexIndex];
|
||||
pos = pos * transformMatrix;
|
||||
if (abs(pos.x) > 0.0001)
|
||||
thisVertex.Pos[0] = pos.x;
|
||||
if (abs(pos.y) > 0.0001)
|
||||
thisVertex.Pos[1] = pos.y;
|
||||
if (abs(pos.z) > 0.0001)
|
||||
thisVertex.Pos[2] = pos.z;
|
||||
|
||||
thisVertex.Pos[0] = pos.x;
|
||||
thisVertex.Pos[1] = pos.y;
|
||||
thisVertex.Pos[2] = pos.z;
|
||||
|
||||
status = faceVert.getNormal(normal, MSpace::kObject);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "faceVert.getNormal() ERROR: " + status.errorString() + "for local vertex " + i + " in " + faceID + " in mesh " + thisMeshPath.fullPathName());
|
||||
break;
|
||||
}
|
||||
if (abs(normal[0]) > 0.0001)
|
||||
thisVertex.Normal[0] = normal[0];
|
||||
if (abs(normal[1]) > 0.0001)
|
||||
thisVertex.Normal[1] = normal[1];
|
||||
if (abs(normal[2]) > 0.0001)
|
||||
thisVertex.Normal[2] = normal[2];
|
||||
|
||||
thisVertex.Normal[0] = normal[0];
|
||||
thisVertex.Normal[1] = normal[1];
|
||||
thisVertex.Normal[2] = normal[2];
|
||||
|
||||
MFloatVector Tangent = Tangents[faceVert.tangentId()];
|
||||
//MVector tmp = faceVert.getTangent(MSpace::kObject, NULL);
|
||||
//tmp.get(biTangent);
|
||||
if (abs(Tangent[0]) > 0.0001)
|
||||
thisVertex.Tangent[0] = Tangent[0];
|
||||
if (abs(Tangent[1]) > 0.0001)
|
||||
thisVertex.Tangent[1] = Tangent[1];
|
||||
if (abs(Tangent[2]) > 0.0001)
|
||||
thisVertex.Tangent[2] = Tangent[2];
|
||||
thisVertex.Tangent[0] = Tangent[0];
|
||||
thisVertex.Tangent[1] = Tangent[1];
|
||||
thisVertex.Tangent[2] = Tangent[2];
|
||||
|
||||
MFloatVector biNormal = biNormals[faceVert.tangentId()];
|
||||
//faceVert.getBinormal().get(biNormal);
|
||||
if (abs(biNormal[0]) > 0.0001)
|
||||
thisVertex.BiNormal[0] = biNormal[0];
|
||||
if (abs(biNormal[1]) > 0.0001)
|
||||
thisVertex.BiNormal[1] = biNormal[1];
|
||||
if (abs(biNormal[2]) > 0.0001)
|
||||
thisVertex.BiNormal[2] = biNormal[2];
|
||||
thisVertex.BiNormal[0] = biNormal[0];
|
||||
thisVertex.BiNormal[1] = biNormal[1];
|
||||
thisVertex.BiNormal[2] = biNormal[2];
|
||||
|
||||
status = faceVert.getUV(UV);
|
||||
if (status != MS::kSuccess) {
|
||||
@@ -308,7 +290,8 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
thisVertex.Uv[1] = UV[1];
|
||||
|
||||
|
||||
if (hasSkin) {
|
||||
if (newMesh.hasSkin) {
|
||||
thisVertex.useWeights = true;
|
||||
float totalWeight = 0.0f;
|
||||
unsigned int totalBones = 0;
|
||||
MIntArray jointIDs /* ??? */;
|
||||
@@ -324,9 +307,11 @@ Mesh MeshClass::GetMeshData(MObjectArray object)
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < 4; i++) {
|
||||
thisVertex.BoneWeights[i] = thisVertex.BoneWeights[i] / totalWeight;
|
||||
//thisVertex.BoneWeights[i] = thisVertex.BoneWeights[i] / totalWeight;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
thisVertex.useWeights = false;
|
||||
}
|
||||
|
||||
//float totalWeight = thisVertex.BoneWeights[0] + thisVertex.BoneWeights[1] + thisVertex.BoneWeights[2] + thisVertex.BoneWeights[3];
|
||||
//if (totalWeight > 0.0001f) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
class VertexLayout : public OutputData
|
||||
{
|
||||
public:
|
||||
bool useWeights = true;
|
||||
float Pos[3]{ 0 };
|
||||
float Normal[3]{ 0 };
|
||||
float Tangent[3]{ 0 };
|
||||
@@ -26,8 +27,10 @@ public:
|
||||
out.write((char*)&Tangent, sizeof(float) * 3);
|
||||
out.write((char*)&BiNormal, sizeof(float) * 3);
|
||||
out.write((char*)&Uv, sizeof(float) * 2);
|
||||
out.write((char*)&BoneIndices, sizeof(float) * 4);
|
||||
out.write((char*)&BoneWeights, sizeof(float) * 4);
|
||||
if (useWeights) {
|
||||
out.write((char*)&BoneIndices, sizeof(float) * 4);
|
||||
out.write((char*)&BoneWeights, sizeof(float) * 4);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void WriteASCII(std::ostream& out) const
|
||||
@@ -37,8 +40,10 @@ public:
|
||||
out << Tangent[0] << " " << Tangent[1] << " " << Tangent[2] << endl;
|
||||
out << BiNormal[0] << " " << BiNormal[1] << " " << BiNormal[2] << endl;
|
||||
out << Uv[0] << " " << Uv[1] << endl;
|
||||
out << BoneIndices[0] << " " << BoneIndices[1] << " " << BoneIndices[2] << " " << BoneIndices[3] << endl;
|
||||
out << BoneWeights[0] << " " << BoneWeights[1] << " " << BoneWeights[2] << " " << BoneWeights[3] << endl;
|
||||
if (useWeights) {
|
||||
out << BoneIndices[0] << " " << BoneIndices[1] << " " << BoneIndices[2] << " " << BoneIndices[3] << endl;
|
||||
out << BoneWeights[0] << " " << BoneWeights[1] << " " << BoneWeights[2] << " " << BoneWeights[3] << endl;
|
||||
}
|
||||
|
||||
}
|
||||
bool operator==(const VertexLayout& right)
|
||||
@@ -57,6 +62,7 @@ public:
|
||||
|
||||
class Mesh : public OutputData {
|
||||
public:
|
||||
bool hasSkin = false;
|
||||
unsigned int NumVertices;
|
||||
unsigned int NumIndices;
|
||||
std::vector<VertexLayout> Vertices;
|
||||
@@ -64,6 +70,7 @@ public:
|
||||
|
||||
virtual void WriteBinary(std::ostream& out)
|
||||
{
|
||||
out.write((char*)&hasSkin, sizeof(bool));
|
||||
out.write((char*)&NumVertices, sizeof(int));
|
||||
out.write((char*)&NumIndices, sizeof(int));
|
||||
for (auto aVertex : Vertices) {
|
||||
@@ -79,6 +86,11 @@ public:
|
||||
virtual void WriteASCII(std::ostream& out) const
|
||||
{
|
||||
out << "New Mesh _ not in binary" << endl;
|
||||
out << "hasSkin: ";
|
||||
if(hasSkin)
|
||||
out << "true" << endl;
|
||||
else
|
||||
out << "false" << endl;
|
||||
out << "Number of vertices: " << NumVertices << endl;
|
||||
out << "number of indices: " << NumIndices << endl;
|
||||
int vertexNumber = 0;
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
//
|
||||
// return m_AllSkeletons;
|
||||
//}
|
||||
std::string attr[9] = { "scaleX", "scaleY", "scaleZ", "translateX", "translateY", "translateZ", "rotateX", "rotateY", "rotateZ" };
|
||||
static std::string attr[9] = { "scaleX", "scaleY", "scaleZ", "translateX", "translateY", "translateZ", "rotateX", "rotateY", "rotateZ" };
|
||||
|
||||
Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int endFrame)
|
||||
{
|
||||
@@ -68,100 +68,294 @@ Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int e
|
||||
std::vector<MObject> animatedJoints;
|
||||
std::vector<MObject> m_Hierarchy;
|
||||
|
||||
Animation returnData;
|
||||
double oneDivSixty = 1 / 60.0;
|
||||
returnData.Name = animationName;
|
||||
Animation returnData;
|
||||
double oneDivSixty = 1 / 60.0;
|
||||
returnData.Name = animationName;
|
||||
returnData.nameLength = animationName.size() + 1;
|
||||
returnData.Duration = (endFrame - startFrame) * oneDivSixty;
|
||||
returnData.Duration = (endFrame - startFrame) * oneDivSixty;
|
||||
|
||||
MItDag jointIt(MItDag::TraversalType::kDepthFirst, MFn::kJoint);
|
||||
while (!jointIt.isDone())
|
||||
{
|
||||
m_Hierarchy.push_back(jointIt.item());
|
||||
std::map<std::string, std::array<std::array<double, 4>, 4>> joinCheckMap;
|
||||
std::map<std::string, bool> exportJoint;
|
||||
|
||||
MFnDependencyNode depNode(jointIt.item());
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
MStatus tmp;
|
||||
MPlug plug = depNode.findPlug(attr[i].c_str(), &tmp);
|
||||
//MItDag jointIt(MItDag::TraversalType::kDepthFirst, MFn::kJoint);
|
||||
//for (unsigned int i = startFrame; i <= endFrame; i++)
|
||||
//{
|
||||
// MAnimControl::setCurrentTime(MTime(i, MTime::kNTSCField));
|
||||
// while (!jointIt.isDone())
|
||||
// {
|
||||
// m_Hierarchy.push_back(jointIt.item());
|
||||
|
||||
MPlugArray connections;
|
||||
plug.connectedTo(connections, true, false, 0);
|
||||
for (int j = 0; j != connections.length(); j++) {
|
||||
MObject connected = connections[j].node();
|
||||
// MFnTransform MayaJoint(jointIt.item());
|
||||
// MMatrix transformationMatrix = MayaJoint.transformationMatrix();
|
||||
|
||||
if (connected.hasFn(MFn::kAnimCurve)) {
|
||||
// if (i == startFrame)
|
||||
// {
|
||||
// double doubleMat[4][4];
|
||||
// transformationMatrix.get(doubleMat);
|
||||
|
||||
MFnAnimCurve jointAnim(connected);
|
||||
// joinCheckMap[MayaJoint.name().asChar()][0][0] = doubleMat[0][0];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][0][1] = doubleMat[0][1];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][0][2] = doubleMat[0][2];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][0][3] = doubleMat[0][3];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][1][0] = doubleMat[1][0];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][1][1] = doubleMat[1][1];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][1][2] = doubleMat[1][2];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][1][3] = doubleMat[1][3];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][2][0] = doubleMat[2][0];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][2][1] = doubleMat[2][1];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][2][2] = doubleMat[2][2];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][2][3] = doubleMat[2][3];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][3][0] = doubleMat[3][0];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][3][1] = doubleMat[3][1];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][3][2] = doubleMat[3][2];
|
||||
// joinCheckMap[MayaJoint.name().asChar()][3][3] = doubleMat[3][3];
|
||||
|
||||
unsigned int startKeyFrameIndex = jointAnim.findClosest(MTime(startFrame, MTime::kNTSCField), &tmp);
|
||||
// exportJoint[MayaJoint.name().asChar()] = false;
|
||||
// }
|
||||
// else if(!exportJoint[MayaJoint.name().asChar()])//!exportJoint[MayaJoint.name().asChar()])
|
||||
// {
|
||||
// double doubleMat[4][4];
|
||||
|
||||
if (tmp == MStatus::kFailure)
|
||||
MGlobal::displayInfo(MString() + "Fail :c");
|
||||
// doubleMat[0][0] = joinCheckMap[MayaJoint.name().asChar()][0][0];
|
||||
// doubleMat[0][1] = joinCheckMap[MayaJoint.name().asChar()][0][1];
|
||||
// doubleMat[0][2] = joinCheckMap[MayaJoint.name().asChar()][0][2];
|
||||
// doubleMat[0][3] = joinCheckMap[MayaJoint.name().asChar()][0][3];
|
||||
// doubleMat[1][0] = joinCheckMap[MayaJoint.name().asChar()][1][0];
|
||||
// doubleMat[1][1] = joinCheckMap[MayaJoint.name().asChar()][1][1];
|
||||
// doubleMat[1][2] = joinCheckMap[MayaJoint.name().asChar()][1][2];
|
||||
// doubleMat[1][3] = joinCheckMap[MayaJoint.name().asChar()][1][3];
|
||||
// doubleMat[2][0] = joinCheckMap[MayaJoint.name().asChar()][2][0];
|
||||
// doubleMat[2][1] = joinCheckMap[MayaJoint.name().asChar()][2][1];
|
||||
// doubleMat[2][2] = joinCheckMap[MayaJoint.name().asChar()][2][2];
|
||||
// doubleMat[2][3] = joinCheckMap[MayaJoint.name().asChar()][2][3];
|
||||
// doubleMat[3][0] = joinCheckMap[MayaJoint.name().asChar()][3][0];
|
||||
// doubleMat[3][1] = joinCheckMap[MayaJoint.name().asChar()][3][1];
|
||||
// doubleMat[3][2] = joinCheckMap[MayaJoint.name().asChar()][3][2];
|
||||
// doubleMat[3][3] = joinCheckMap[MayaJoint.name().asChar()][3][3];
|
||||
|
||||
if (startFrame * oneDivSixty <= jointAnim.time(startKeyFrameIndex).value() && jointAnim.time(startKeyFrameIndex).value() <= endFrame * oneDivSixty) {
|
||||
animatedJoints.push_back(jointIt.item());
|
||||
i = 9;
|
||||
break;
|
||||
}
|
||||
// MMatrix tmp(doubleMat);
|
||||
// if (!tmp.isEquivalent(transformationMatrix)) {
|
||||
// MGlobal::displayInfo(MString() + MayaJoint.name() + " is exported");
|
||||
// exportJoint[MayaJoint.name().asChar()] = true;
|
||||
// animatedJoints.push_back(MayaJoint.object());
|
||||
// }
|
||||
// }
|
||||
|
||||
unsigned int endKeyFrameIndex = jointAnim.findClosest(MTime(endFrame, MTime::kNTSCField));
|
||||
MGlobal::displayInfo(MString() + startKeyFrameIndex + " " + endKeyFrameIndex);
|
||||
/*for (int i = 0; i < 9; i++)
|
||||
{
|
||||
MStatus tmp;
|
||||
MPlug plug = depNode.findPlug(attr[i].c_str(), &tmp);
|
||||
|
||||
if (startFrame * oneDivSixty <= jointAnim.time(endKeyFrameIndex).value() && jointAnim.time(endKeyFrameIndex).value() <= endFrame * oneDivSixty || endKeyFrameIndex - startKeyFrameIndex > 0) {
|
||||
animatedJoints.push_back(jointIt.item());
|
||||
i = 9;
|
||||
break;
|
||||
}
|
||||
MPlugArray connections;
|
||||
plug.connectedTo(connections, true, false, 0);
|
||||
for (int j = 0; j != connections.length(); j++) {
|
||||
MObject connected = connections[j].node();
|
||||
|
||||
MFnTransform MayaJoint(jointIt.item());
|
||||
if (connected.hasFn(MFn::kAnimCurve)) {
|
||||
|
||||
MPlug BindPose = MayaJoint.findPlug("bindPose");
|
||||
MDataHandle DataHandle;
|
||||
BindPose.getValue(DataHandle);
|
||||
MFnMatrixData MartixFn(DataHandle.data());
|
||||
MMatrix BindPoseMatrix = MartixFn.matrix();
|
||||
MFnAnimCurve jointAnim(connected);
|
||||
|
||||
if (!BindPoseMatrix.isEquivalent(MayaJoint.transformationMatrix()))
|
||||
{
|
||||
MGlobal::displayError(MString() + animationName.c_str() + " is using " + MayaJoint.name() + " that is not in bind pose nor is it key framed in the animation, the exported animation will NOT correspond to the animation in Maya");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//MGlobal::displayInfo(MString() + "curve : " + jointAnim.name());
|
||||
//MGlobal::displayInfo(MString() + "curve keys : " + jointAnim.numKeys());
|
||||
//MGlobal::displayInfo(MString() + "curve keyframes : " + jointAnim.numKeyframes());
|
||||
//MGlobal::displayInfo(MString() + "startFrame : " + startFrame);
|
||||
//MGlobal::displayInfo(MString() + "endFrame : " + endFrame);
|
||||
|
||||
jointIt.next();
|
||||
}
|
||||
unsigned int startKeyFrameIndex = jointAnim.findClosest(MTime(startFrame, MTime::kNTSCField), &tmp);
|
||||
|
||||
int currentFrame = startFrame;
|
||||
while (currentFrame != endFrame + 1) { // ANDREAS
|
||||
Animation::Keyframe thisKeyFrame;
|
||||
thisKeyFrame.Index = currentFrame - startFrame;
|
||||
thisKeyFrame.Time = thisKeyFrame.Index * oneDivSixty;
|
||||
if (tmp == MStatus::kFailure)
|
||||
MGlobal::displayInfo(MString() + "Fail :c");
|
||||
|
||||
MAnimControl::setCurrentTime(MTime(currentFrame, MTime::kNTSCField));
|
||||
MTime time = MAnimControl::currentTime();
|
||||
if (startFrame * oneDivSixty <= jointAnim.time(startKeyFrameIndex).value() && jointAnim.time(startKeyFrameIndex).value() <= endFrame * oneDivSixty) {
|
||||
//MGlobal::displayInfo(MString() + "Start key time : " + jointAnim.time(startKeyFrameIndex).value());
|
||||
|
||||
for (auto aJoint : animatedJoints){
|
||||
MFnTransform thisJoint(aJoint);
|
||||
Animation::Keyframe::JointProperty joint;
|
||||
|
||||
auto it = std::find(m_Hierarchy.begin(), m_Hierarchy.end(), thisJoint.object());
|
||||
if (it != m_Hierarchy.end()) {
|
||||
joint.ID = it - m_Hierarchy.begin();
|
||||
}
|
||||
else {
|
||||
MGlobal::displayError(MString() + "Could not find joint ID for: " + thisJoint.name());
|
||||
}
|
||||
|
||||
MTransformationMatrix Matrix = thisJoint.transformation();
|
||||
MPlug BindPose = thisJoint.findPlug("bindPose");
|
||||
MDataHandle DataHandle;
|
||||
BindPose.getValue(DataHandle);
|
||||
MFnMatrixData MartixFn(DataHandle.data());
|
||||
MMatrix BindPoseMatrix = MartixFn.matrix();
|
||||
Matrix = Matrix.asMatrix();
|
||||
|
||||
if (startFrame <= jointAnim.time(startKeyFrameIndex).value() && jointAnim.time(startKeyFrameIndex).value() <= endFrame ) {
|
||||
animatedJoints.push_back(jointIt.item());
|
||||
i = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned int endKeyFrameIndex = jointAnim.findClosest(MTime(endFrame, MTime::kNTSCField));
|
||||
MGlobal::displayInfo(MString() + startKeyFrameIndex + " " + endKeyFrameIndex);
|
||||
MGlobal::displayInfo(MString() + "Fail!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
|
||||
if (startFrame * oneDivSixty <= jointAnim.time(endKeyFrameIndex).value() && jointAnim.time(endKeyFrameIndex).value() <= endFrame * oneDivSixty || endKeyFrameIndex - startKeyFrameIndex > 0) {
|
||||
//MGlobal::displayInfo(MString() + "End key index : " + endKeyFrameIndex);
|
||||
//MGlobal::displayInfo(MString() + "end key time : " + jointAnim.time(endKeyFrameIndex).value());
|
||||
|
||||
/*MGlobal::displayInfo(MString() + "start keyfram index: " + startKeyFrameIndex + ". End keyfram index: " + endKeyFrameIndex + ".");*/
|
||||
|
||||
/*if (startFrame <= jointAnim.time(endKeyFrameIndex).value() && jointAnim.time(endKeyFrameIndex).value() <= endFrame || endKeyFrameIndex - startKeyFrameIndex > 0) {
|
||||
animatedJoints.push_back(jointIt.item());
|
||||
i = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
MFnTransform MayaJoint(jointIt.item());
|
||||
|
||||
MPlug BindPose = MayaJoint.findPlug("bindPose");
|
||||
MDataHandle DataHandle;
|
||||
BindPose.getValue(DataHandle);
|
||||
MFnMatrixData MartixFn(DataHandle.data());
|
||||
MMatrix BindPoseMatrix = MartixFn.matrix();
|
||||
|
||||
if (!BindPoseMatrix.isEquivalent(MayaJoint.transformationMatrix()))
|
||||
{
|
||||
MGlobal::displayError(MString() + animationName.c_str() + " is using " + MayaJoint.name() + " that is not in bind pose nor is it key framed in the animation, the exported animation will NOT correspond to the animation in Maya");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // end of int i loop*/
|
||||
/* jointIt.next();
|
||||
}
|
||||
jointIt.reset();
|
||||
}*/
|
||||
|
||||
MItDag jointIt(MItDag::TraversalType::kDepthFirst, MFn::kJoint);
|
||||
unsigned int jointID = 0;
|
||||
|
||||
while (!jointIt.isDone()) {
|
||||
int currentFrame = startFrame;
|
||||
Animation::JointAnimation thisJointAnimation;
|
||||
bool haxBool = false;
|
||||
while (currentFrame < endFrame) {
|
||||
Animation::JointAnimation::KeyFrame thisKeyFrame;
|
||||
//thisKeyFrame.Index = currentFrame - startFrame;
|
||||
//thisKeyFrame.Time = thisKeyFrame.Index * oneDivSixty;
|
||||
|
||||
MAnimControl::setCurrentTime(MTime(currentFrame, MTime::kNTSCField));
|
||||
MTime time = MAnimControl::currentTime();
|
||||
|
||||
MFnTransform thisJoint(jointIt.currentItem());
|
||||
MTransformationMatrix transformationMatrix = thisJoint.transformationMatrix();
|
||||
|
||||
double doubleMat[4][4];
|
||||
|
||||
if (currentFrame != startFrame) {
|
||||
//Animation::JointAnimation joint;
|
||||
|
||||
doubleMat[0][0] = joinCheckMap[thisJoint.name().asChar()][0][0];
|
||||
doubleMat[0][1] = joinCheckMap[thisJoint.name().asChar()][0][1];
|
||||
doubleMat[0][2] = joinCheckMap[thisJoint.name().asChar()][0][2];
|
||||
doubleMat[0][3] = joinCheckMap[thisJoint.name().asChar()][0][3];
|
||||
doubleMat[1][0] = joinCheckMap[thisJoint.name().asChar()][1][0];
|
||||
doubleMat[1][1] = joinCheckMap[thisJoint.name().asChar()][1][1];
|
||||
doubleMat[1][2] = joinCheckMap[thisJoint.name().asChar()][1][2];
|
||||
doubleMat[1][3] = joinCheckMap[thisJoint.name().asChar()][1][3];
|
||||
doubleMat[2][0] = joinCheckMap[thisJoint.name().asChar()][2][0];
|
||||
doubleMat[2][1] = joinCheckMap[thisJoint.name().asChar()][2][1];
|
||||
doubleMat[2][2] = joinCheckMap[thisJoint.name().asChar()][2][2];
|
||||
doubleMat[2][3] = joinCheckMap[thisJoint.name().asChar()][2][3];
|
||||
doubleMat[3][0] = joinCheckMap[thisJoint.name().asChar()][3][0];
|
||||
doubleMat[3][1] = joinCheckMap[thisJoint.name().asChar()][3][1];
|
||||
doubleMat[3][2] = joinCheckMap[thisJoint.name().asChar()][3][2];
|
||||
doubleMat[3][3] = joinCheckMap[thisJoint.name().asChar()][3][3];
|
||||
|
||||
MMatrix LastJointMatrix(doubleMat);
|
||||
//Is same as last KeyFrame
|
||||
if (LastJointMatrix.isEquivalent(transformationMatrix.asMatrix())) {
|
||||
//jointID++;
|
||||
//jointIt.next();
|
||||
currentFrame++;
|
||||
haxBool = false;
|
||||
continue;
|
||||
} else if(!haxBool){
|
||||
haxBool = true;
|
||||
MTransformationMatrix LastJointTransformationMatrix = LastJointMatrix;
|
||||
MObject jointOrientObj = thisJoint.attribute("jointOrient");
|
||||
MFnNumericAttribute jointOrient(jointOrientObj);
|
||||
double jointOrientDouble[3];
|
||||
jointOrient.getDefault(jointOrientDouble[0], jointOrientDouble[1], jointOrientDouble[2]);
|
||||
//MGlobal::displayError(MString() + "Joint Matrix: ");
|
||||
//MGlobal::displayError(MString() + Matrix.asMatrix()[0][0] + " " + Matrix.asMatrix()[0][1] + " " + Matrix.asMatrix()[0][2] + " " + Matrix.asMatrix()[0][3]);
|
||||
//MGlobal::displayError(MString() + Matrix.asMatrix()[1][0] + " " + Matrix.asMatrix()[1][1] + " " + Matrix.asMatrix()[1][2] + " " + Matrix.asMatrix()[1][3]);
|
||||
//MGlobal::displayError(MString() + Matrix.asMatrix()[2][0] + " " + Matrix.asMatrix()[2][1] + " " + Matrix.asMatrix()[2][2] + " " + Matrix.asMatrix()[2][3]);
|
||||
//MGlobal::displayError(MString() + Matrix.asMatrix()[3][0] + " " + Matrix.asMatrix()[3][1] + " " + Matrix.asMatrix()[3][2] + " " + Matrix.asMatrix()[3][3]);
|
||||
|
||||
MEulerRotation joEuler(jointOrientDouble[0], jointOrientDouble[1], jointOrientDouble[2]);
|
||||
MQuaternion jo = joEuler.asQuaternion();
|
||||
|
||||
double tmp[4];
|
||||
LastJointTransformationMatrix.getRotationQuaternion(tmp[0], tmp[1], tmp[2], tmp[3]);
|
||||
MQuaternion rotation(tmp);
|
||||
|
||||
rotation = rotation * jo;
|
||||
rotation.get(tmp);
|
||||
|
||||
//Animation::JointAnimation::KeyFrame keyframe;
|
||||
Animation::JointAnimation::KeyFrame previousKeyFrame;
|
||||
previousKeyFrame.Index = currentFrame - startFrame - 1;
|
||||
previousKeyFrame.Time = previousKeyFrame.Index * oneDivSixty;
|
||||
|
||||
previousKeyFrame.Rotation[0] = tmp[0];
|
||||
previousKeyFrame.Rotation[1] = tmp[1];
|
||||
previousKeyFrame.Rotation[2] = tmp[2];
|
||||
previousKeyFrame.Rotation[3] = tmp[3];
|
||||
LastJointTransformationMatrix.getTranslation(MSpace::kTransform).get(tmp);
|
||||
previousKeyFrame.Position[0] = tmp[0];
|
||||
previousKeyFrame.Position[1] = tmp[1];
|
||||
previousKeyFrame.Position[2] = tmp[2];
|
||||
LastJointTransformationMatrix.getScale(tmp, MSpace::kTransform);
|
||||
previousKeyFrame.Scale[0] = tmp[0];
|
||||
previousKeyFrame.Scale[1] = tmp[1];
|
||||
previousKeyFrame.Scale[2] = tmp[2];
|
||||
|
||||
thisJointAnimation.m_KeyFrames.push_back(previousKeyFrame);
|
||||
}
|
||||
}
|
||||
|
||||
transformationMatrix.asMatrix().get(doubleMat);
|
||||
|
||||
//Save transformationMatrix to joinCheckMap
|
||||
joinCheckMap[thisJoint.name().asChar()][0][0] = doubleMat[0][0];
|
||||
joinCheckMap[thisJoint.name().asChar()][0][1] = doubleMat[0][1];
|
||||
joinCheckMap[thisJoint.name().asChar()][0][2] = doubleMat[0][2];
|
||||
joinCheckMap[thisJoint.name().asChar()][0][3] = doubleMat[0][3];
|
||||
joinCheckMap[thisJoint.name().asChar()][1][0] = doubleMat[1][0];
|
||||
joinCheckMap[thisJoint.name().asChar()][1][1] = doubleMat[1][1];
|
||||
joinCheckMap[thisJoint.name().asChar()][1][2] = doubleMat[1][2];
|
||||
joinCheckMap[thisJoint.name().asChar()][1][3] = doubleMat[1][3];
|
||||
joinCheckMap[thisJoint.name().asChar()][2][0] = doubleMat[2][0];
|
||||
joinCheckMap[thisJoint.name().asChar()][2][1] = doubleMat[2][1];
|
||||
joinCheckMap[thisJoint.name().asChar()][2][2] = doubleMat[2][2];
|
||||
joinCheckMap[thisJoint.name().asChar()][2][3] = doubleMat[2][3];
|
||||
joinCheckMap[thisJoint.name().asChar()][3][0] = doubleMat[3][0];
|
||||
joinCheckMap[thisJoint.name().asChar()][3][1] = doubleMat[3][1];
|
||||
joinCheckMap[thisJoint.name().asChar()][3][2] = doubleMat[3][2];
|
||||
joinCheckMap[thisJoint.name().asChar()][3][3] = doubleMat[3][3];
|
||||
|
||||
if (currentFrame == startFrame) {
|
||||
MPlug thisJointBindPose = thisJoint.findPlug("bindPose");
|
||||
MDataHandle DataHandle;
|
||||
thisJointBindPose.getValue(DataHandle);
|
||||
MFnMatrixData MartixFn(DataHandle.data());
|
||||
MMatrix thisJointBindPoseMatrix = MartixFn.matrix();
|
||||
|
||||
MFnTransform Parent(thisJoint.parent(0), &status);
|
||||
if (status == MS::kSuccess && thisJoint.parent(0).apiType() == MFn::kJoint) {
|
||||
MTransformationMatrix Matrix = Parent.transformation();
|
||||
MPlug parentBindPose = Parent.findPlug("bindPose");
|
||||
MDataHandle DataHandle;
|
||||
parentBindPose.getValue(DataHandle);
|
||||
MFnMatrixData MartixFn(DataHandle.data());
|
||||
MMatrix parentBindPoseMatrix = MartixFn.matrix();
|
||||
|
||||
thisJointBindPoseMatrix = thisJointBindPoseMatrix * parentBindPoseMatrix.inverse();
|
||||
}
|
||||
|
||||
if (thisJointBindPoseMatrix.isEquivalent(transformationMatrix.asMatrix())) {
|
||||
//jointID++;
|
||||
//jointIt.next();
|
||||
currentFrame++;
|
||||
MGlobal::displayError(MString() + thisJoint.name() + " is in bindPose");
|
||||
continue;
|
||||
}
|
||||
haxBool = true;
|
||||
}
|
||||
|
||||
MObject jointOrientObj = thisJoint.attribute("jointOrient");
|
||||
MFnNumericAttribute jointOrient(jointOrientObj);
|
||||
double jointOrientDouble[3];
|
||||
@@ -175,95 +369,97 @@ Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int e
|
||||
MEulerRotation joEuler(jointOrientDouble[0], jointOrientDouble[1], jointOrientDouble[2]);
|
||||
MQuaternion jo = joEuler.asQuaternion();
|
||||
|
||||
double tmp[4];
|
||||
Matrix.getRotationQuaternion(tmp[0], tmp[1], tmp[2], tmp[3]);
|
||||
double tmp[4];
|
||||
transformationMatrix.getRotationQuaternion(tmp[0], tmp[1], tmp[2], tmp[3]);
|
||||
MQuaternion rotation(tmp);
|
||||
|
||||
rotation = rotation * jo;
|
||||
rotation.get(tmp);
|
||||
|
||||
joint.Rotation[0] = tmp[0];
|
||||
joint.Rotation[1] = tmp[1];
|
||||
joint.Rotation[2] = tmp[2];
|
||||
joint.Rotation[3] = tmp[3];
|
||||
Matrix.getTranslation(MSpace::kTransform).get(tmp);
|
||||
joint.Position[0] = tmp[0];
|
||||
joint.Position[1] = tmp[1];
|
||||
joint.Position[2] = tmp[2];
|
||||
Matrix.getScale(tmp, MSpace::kTransform);
|
||||
joint.Scale[0] = tmp[0];
|
||||
joint.Scale[1] = tmp[1];
|
||||
joint.Scale[2] = tmp[2];
|
||||
//Animation::JointAnimation::KeyFrame keyframe;
|
||||
thisKeyFrame.Index = currentFrame - startFrame;
|
||||
thisKeyFrame.Time = thisKeyFrame.Index * oneDivSixty;
|
||||
|
||||
thisKeyFrame.JointProperties.push_back(joint);
|
||||
}
|
||||
returnData.Keyframes.push_back(thisKeyFrame);
|
||||
currentFrame++;
|
||||
}
|
||||
thisKeyFrame.Rotation[0] = tmp[0];
|
||||
thisKeyFrame.Rotation[1] = tmp[1];
|
||||
thisKeyFrame.Rotation[2] = tmp[2];
|
||||
thisKeyFrame.Rotation[3] = tmp[3];
|
||||
transformationMatrix.getTranslation(MSpace::kTransform).get(tmp);
|
||||
thisKeyFrame.Position[0] = tmp[0];
|
||||
thisKeyFrame.Position[1] = tmp[1];
|
||||
thisKeyFrame.Position[2] = tmp[2];
|
||||
transformationMatrix.getScale(tmp, MSpace::kTransform);
|
||||
thisKeyFrame.Scale[0] = tmp[0];
|
||||
thisKeyFrame.Scale[1] = tmp[1];
|
||||
thisKeyFrame.Scale[2] = tmp[2];
|
||||
|
||||
returnData.NumKeyFrames = returnData.Keyframes.size();
|
||||
returnData.NumberOfJoints = animatedJoints.size();
|
||||
thisJointAnimation.m_KeyFrames.push_back(thisKeyFrame);
|
||||
|
||||
return returnData;
|
||||
currentFrame++;
|
||||
}
|
||||
//thisKeyFrame.NumberOfJoints = thisKeyFrame.JointProperties.size();
|
||||
thisJointAnimation.numberOFKeyFrames = thisJointAnimation.m_KeyFrames.size();
|
||||
returnData.JointsFrameMap[jointID] = (thisJointAnimation);
|
||||
|
||||
jointID++;
|
||||
jointIt.next();
|
||||
}
|
||||
returnData.NumOfJointFrames = returnData.JointsFrameMap.size();
|
||||
return returnData;
|
||||
}
|
||||
|
||||
std::vector<BindPoseSkeletonNode> Skeleton::GetBindPoses()
|
||||
{
|
||||
MStatus status;
|
||||
std::vector<BindPoseSkeletonNode> m_AllSkeletons;
|
||||
std::vector<MObject> m_Hierarchy;
|
||||
std::vector<BindPoseSkeletonNode> m_AllSkeletons;
|
||||
std::vector<MObject> m_Hierarchy;
|
||||
|
||||
MItDag jointIt(MItDag::TraversalType::kDepthFirst, MFn::kJoint);
|
||||
BindPoseSkeletonNode SkeletonStorage;
|
||||
while (!jointIt.isDone()) {
|
||||
MFnTransform MayaJoint(jointIt.currentItem());
|
||||
BindPoseSkeletonNode::BindPoseJoint NewJoint;
|
||||
MItDag jointIt(MItDag::TraversalType::kDepthFirst, MFn::kJoint);
|
||||
BindPoseSkeletonNode SkeletonStorage;
|
||||
while (!jointIt.isDone()) {
|
||||
MFnTransform MayaJoint(jointIt.currentItem());
|
||||
BindPoseSkeletonNode::BindPoseJoint NewJoint;
|
||||
|
||||
if (MFnDependencyNode(MayaJoint.parent(0)).name() == "world") {
|
||||
if (SkeletonStorage.Joints.size() != 0) {
|
||||
m_AllSkeletons.push_back(SkeletonStorage);
|
||||
if (MFnDependencyNode(MayaJoint.parent(0)).object().apiType() != MFn::kJoint) {
|
||||
if (SkeletonStorage.Joints.size() != 0) {
|
||||
m_AllSkeletons.push_back(SkeletonStorage);
|
||||
|
||||
SkeletonStorage.Joints.clear();
|
||||
SkeletonStorage.Name.clear();
|
||||
}
|
||||
SkeletonStorage.Name = std::string(MayaJoint.name().asChar());
|
||||
NewJoint.ParentID = -1; // This joint is root
|
||||
}
|
||||
else {
|
||||
auto it = std::find(m_Hierarchy.begin(), m_Hierarchy.end(), MayaJoint.parent(0));
|
||||
if (it != m_Hierarchy.end()) {
|
||||
NewJoint.ParentID = it - m_Hierarchy.begin();
|
||||
}
|
||||
else {
|
||||
MGlobal::displayError(MString() + "Could not find joint parent for: " + MayaJoint.name());
|
||||
}
|
||||
}
|
||||
m_Hierarchy.push_back(MayaJoint.object());
|
||||
SkeletonStorage.Joints.clear();
|
||||
SkeletonStorage.Name.clear();
|
||||
}
|
||||
SkeletonStorage.Name = std::string(MayaJoint.name().asChar());
|
||||
NewJoint.ParentID = -1; // This joint is root
|
||||
} else {
|
||||
auto it = std::find(m_Hierarchy.begin(), m_Hierarchy.end(), MayaJoint.parent(0));
|
||||
if (it != m_Hierarchy.end()) {
|
||||
NewJoint.ParentID = it - m_Hierarchy.begin();
|
||||
} else {
|
||||
MGlobal::displayError(MString() + "Could not find joint parent for: " + MayaJoint.name());
|
||||
}
|
||||
}
|
||||
m_Hierarchy.push_back(MayaJoint.object());
|
||||
|
||||
MPlug BindPose = MayaJoint.findPlug("bindPose", &status);
|
||||
if (status != MS::kSuccess) {
|
||||
MPlug BindPose = MayaJoint.findPlug("bindPose", &status);
|
||||
if (status != MS::kSuccess) {
|
||||
MGlobal::displayError(MString() + "Could not find bindPose plug: " + status.errorString());
|
||||
}
|
||||
MDataHandle DataHandle;
|
||||
BindPose.getValue(DataHandle);
|
||||
MFnMatrixData MartixFn(DataHandle.data());
|
||||
MMatrix Matrix = MartixFn.matrix();
|
||||
MDataHandle DataHandle;
|
||||
BindPose.getValue(DataHandle);
|
||||
MFnMatrixData MartixFn(DataHandle.data());
|
||||
MMatrix Matrix = MartixFn.matrix();
|
||||
|
||||
|
||||
MVector tmp = MayaJoint.transformation().getTranslation(MSpace::kObject);
|
||||
MGlobal::displayError(MString() + "translation befor: " + tmp[0] + " " + tmp[1] + " " + tmp[2]);
|
||||
//Matrix[3][0] *= -1;
|
||||
//Matrix[3][2] *= -1;
|
||||
//Matrix[3][1] *= -1;
|
||||
|
||||
double test[3];
|
||||
MayaJoint.transformation().getScale(test, MSpace::kObject);
|
||||
MGlobal::displayError(MString() + "scale: " + test[0] + " " + test[1] + " " + test[2]);
|
||||
|
||||
MTransformationMatrix::RotationOrder order = MTransformationMatrix::RotationOrder::kXYZ;
|
||||
MayaJoint.transformation().getRotation(test, order);
|
||||
MGlobal::displayError(MString() + "rotation: " + test[0] + " " + test[1] + " " + test[2]);
|
||||
|
||||
|
||||
//----- test
|
||||
|
||||
|
||||
@@ -310,33 +506,33 @@ std::vector<BindPoseSkeletonNode> Skeleton::GetBindPoses()
|
||||
|
||||
Matrix = Matrix.inverse();
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
NewJoint.OffsetMatrix[i][j] = Matrix.matrix[i][j];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
NewJoint.OffsetMatrix[i][j] = Matrix.matrix[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
NewJoint.Name = MayaJoint.name().asChar();
|
||||
NewJoint.Name = MayaJoint.name().asChar();
|
||||
NewJoint.NameLength = MayaJoint.name().length() + 1;
|
||||
NewJoint.ID = SkeletonStorage.Joints.size();
|
||||
//double tmp[3];
|
||||
//((MTransformationMatrix)Matrix).eulerRotation().asVector().get(tmp);
|
||||
//NewJoint.Rotation[0] = tmp[0];
|
||||
//NewJoint.Rotation[1] = tmp[1];
|
||||
//NewJoint.Rotation[2] = tmp[2];
|
||||
//((MTransformationMatrix)Matrix).getScale(tmp, MSpace::Space::kTransform);
|
||||
//NewJoint.Scale[0] = tmp[0];
|
||||
//NewJoint.Scale[1] = tmp[1];
|
||||
//NewJoint.Scale[2] = tmp[2];
|
||||
//((MTransformationMatrix)Matrix).getTranslation(MSpace::Space::kTransform).get(tmp);
|
||||
//NewJoint.Translation[0] = tmp[0];
|
||||
//NewJoint.Translation[1] = tmp[1];
|
||||
//NewJoint.Translation[2] = tmp[2];
|
||||
SkeletonStorage.Joints.push_back(NewJoint);
|
||||
//double tmp[3];
|
||||
//((MTransformationMatrix)Matrix).eulerRotation().asVector().get(tmp);
|
||||
//NewJoint.Rotation[0] = tmp[0];
|
||||
//NewJoint.Rotation[1] = tmp[1];
|
||||
//NewJoint.Rotation[2] = tmp[2];
|
||||
//((MTransformationMatrix)Matrix).getScale(tmp, MSpace::Space::kTransform);
|
||||
//NewJoint.Scale[0] = tmp[0];
|
||||
//NewJoint.Scale[1] = tmp[1];
|
||||
//NewJoint.Scale[2] = tmp[2];
|
||||
//((MTransformationMatrix)Matrix).getTranslation(MSpace::Space::kTransform).get(tmp);
|
||||
//NewJoint.Translation[0] = tmp[0];
|
||||
//NewJoint.Translation[1] = tmp[1];
|
||||
//NewJoint.Translation[2] = tmp[2];
|
||||
SkeletonStorage.Joints.push_back(NewJoint);
|
||||
SkeletonStorage.numBones++;
|
||||
jointIt.next();
|
||||
}
|
||||
m_AllSkeletons.push_back(SkeletonStorage);
|
||||
jointIt.next();
|
||||
}
|
||||
m_AllSkeletons.push_back(SkeletonStorage);
|
||||
|
||||
return m_AllSkeletons;
|
||||
return m_AllSkeletons;
|
||||
}
|
||||
@@ -3,50 +3,63 @@
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include "MayaIncludes.h"
|
||||
#include "OutputData.h"
|
||||
|
||||
class Animation : public OutputData {
|
||||
public:
|
||||
struct Keyframe
|
||||
{
|
||||
struct JointProperty
|
||||
{
|
||||
int ID = 0;
|
||||
//struct Keyframe
|
||||
//{
|
||||
// struct JointProperty
|
||||
// {
|
||||
// int ID = 0;
|
||||
// float Position[3]{ 0 };
|
||||
// float Rotation[4]{ 0 };
|
||||
// float Scale[3]{ 0 };
|
||||
// };
|
||||
|
||||
// int Index = 0;
|
||||
// float Time = 0;
|
||||
// int NumberOfJoints;
|
||||
// std::vector<JointProperty> JointProperties;
|
||||
//};
|
||||
|
||||
struct JointAnimation {
|
||||
struct KeyFrame {
|
||||
int Index = 0;
|
||||
float Time = 0;
|
||||
float Position[3]{ 0 };
|
||||
float Rotation[4]{ 0 };
|
||||
float Scale[3]{ 0 };
|
||||
};
|
||||
|
||||
int Index = 0;
|
||||
float Time = 0;
|
||||
std::vector<JointProperty> JointProperties;
|
||||
};
|
||||
};
|
||||
unsigned int numberOFKeyFrames = 0;
|
||||
std::vector<KeyFrame> m_KeyFrames;
|
||||
};
|
||||
|
||||
std::string Name;
|
||||
int nameLength = 0;
|
||||
float Duration = 0;
|
||||
int NumKeyFrames = 0;
|
||||
int NumberOfJoints = 0;
|
||||
std::vector<Keyframe> Keyframes;
|
||||
int NumOfJointFrames = 0;
|
||||
std::map<int, JointAnimation> JointsFrameMap;
|
||||
|
||||
virtual void WriteBinary(std::ostream& out)
|
||||
{
|
||||
out.write((char*)&nameLength, sizeof(int));
|
||||
out.write(Name.c_str(), Name.size() + 1);
|
||||
out.write((char*)&Duration, sizeof(float));
|
||||
out.write((char*)&NumKeyFrames, sizeof(int));
|
||||
out.write((char*)&NumberOfJoints, sizeof(int));
|
||||
out.write((char*)&NumOfJointFrames, sizeof(int));
|
||||
//Här under loopas alla key frames igenom
|
||||
for (auto aKeyframe : Keyframes) {
|
||||
out.write((char*)&aKeyframe.Index, sizeof(int));
|
||||
out.write((char*)&aKeyframe.Time, sizeof(float));
|
||||
for (auto aJoint : aKeyframe.JointProperties) {
|
||||
out.write((char*)&aJoint.ID, sizeof(int));
|
||||
out.write((char*)aJoint.Position, sizeof(float) * 3);
|
||||
out.write((char*)aJoint.Rotation, sizeof(float) * 4);
|
||||
out.write((char*)aJoint.Scale, sizeof(float) * 3);
|
||||
for (auto aJointAnimation : JointsFrameMap) {
|
||||
out.write((char*)&aJointAnimation.first, sizeof(int));
|
||||
out.write((char*)&aJointAnimation.second.numberOFKeyFrames, sizeof(int));
|
||||
for (auto aJointKeyFrame : aJointAnimation.second.m_KeyFrames) {
|
||||
out.write((char*)&aJointKeyFrame.Index, sizeof(int));
|
||||
out.write((char*)&aJointKeyFrame.Time, sizeof(float));
|
||||
out.write((char*)&aJointKeyFrame.Position, sizeof(float) * 3);
|
||||
out.write((char*)&aJointKeyFrame.Rotation, sizeof(float) * 4);
|
||||
out.write((char*)&aJointKeyFrame.Scale, sizeof(float) * 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,16 +68,17 @@ public:
|
||||
{
|
||||
out << "Animation Name: " << Name << endl;
|
||||
out << "Duration: " << Duration << endl;
|
||||
out << "Number of KeyFrames: " << NumKeyFrames << endl;
|
||||
out << "Number of Joints: " << NumberOfJoints << endl;
|
||||
for (auto aKeyframe : Keyframes) {
|
||||
out << "Frame: " << aKeyframe.Index << endl;
|
||||
out << "Time: " << aKeyframe.Time << endl;
|
||||
for (auto aJoint : aKeyframe.JointProperties) {
|
||||
out << "Joint ID: " << aJoint.ID << endl;
|
||||
out << aJoint.Position[0] << " " << aJoint.Position[1] << " " << aJoint.Position[2] << endl;
|
||||
out << aJoint.Rotation[0] << " " << aJoint.Rotation[1] << " " << aJoint.Rotation[2] << " " << aJoint.Rotation[3] << endl;
|
||||
out << aJoint.Scale[0] << " " << aJoint.Scale[1] << " " << aJoint.Scale[2] << endl;
|
||||
out << "Number of KeyFrames: " << NumOfJointFrames << endl;
|
||||
for (auto aJointAnimation : JointsFrameMap) {
|
||||
out << "Bone: " << aJointAnimation.first << endl;
|
||||
//out << "Time: " << aJointAnimation.Time << endl;
|
||||
//out << "Number of Joints: " << aKeyframe.NumberOfJoints << endl;
|
||||
for (auto aJointKeyFrame : aJointAnimation.second.m_KeyFrames) {
|
||||
//out << "Joint ID: " << aJoint.ID << endl;
|
||||
out << "Time: " << aJointKeyFrame.Time << endl;
|
||||
out << aJointKeyFrame.Position[0] << " " << aJointKeyFrame.Position[1] << " " << aJointKeyFrame.Position[2] << endl;
|
||||
out << aJointKeyFrame.Rotation[0] << " " << aJointKeyFrame.Rotation[1] << " " << aJointKeyFrame.Rotation[2] << " " << aJointKeyFrame.Rotation[3] << endl;
|
||||
out << aJointKeyFrame.Scale[0] << " " << aJointKeyFrame.Scale[1] << " " << aJointKeyFrame.Scale[2] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user