Compare commits

..

3 Commits

Author SHA1 Message Date
stiffly 2167b6f7b1 Fix for previous commit.. 2016-03-03 23:43:50 +01:00
stiffly 714665f0a3 Updated the PlayerID getter in Server.cpp. 2016-03-03 22:55:12 +01:00
stiffly 8466a282b7 The server will now parse a death event and pass it forward with a KillDeath event to the score system. 2016-03-03 22:48:42 +01:00
44 changed files with 1297 additions and 3935 deletions
+3 -2
View File
@@ -10,8 +10,9 @@ namespace Events
struct PlayerDeath : Event
{
//KilledBy,KilledByWhat is optional for now. It might be used later in the playerlog-system
EntityWrapper Player;
std::string KilledByWhat;
EntityWrapper Player = EntityWrapper::Invalid;
EntityWrapper Killer = EntityWrapper::Invalid;
std::string KilledByWhat = "";
};
}
-1
View File
@@ -29,7 +29,6 @@ struct EntityWrapper
EntityWrapper Parent();
EntityWrapper FirstParentByName(const std::string& parentEntityName);
EntityWrapper FirstChildByName(const std::string& name);
EntityWrapper FirstLevelChildByName(const std::string& name);
EntityWrapper FirstParentWithComponent(const std::string& componentType);
EntityWrapper Clone(EntityWrapper parent = EntityWrapper::Invalid);
std::vector<EntityWrapper> ChildrenWithComponent(const std::string& componentType);
+19
View File
@@ -0,0 +1,19 @@
#ifndef Events_KillDeath_h__
#define Events_KillDeath_h__
#include "Core/EventBroker.h"
typedef unsigned int PlayerID;
namespace Events
{
struct KillDeath : public Event
{
PlayerID Casualty = -1;
PlayerID Killer = -1;
};
}
#endif
+6 -1
View File
@@ -21,6 +21,8 @@
#include "Core/EEntityDeleted.h"
#include "Core/EComponentDeleted.h"
#include "Core/EAmmoPickup.h"
#include "Core/EPlayerDeath.h"
#include "Network/EKillDeath.h"
class Server : public Network
{
@@ -77,7 +79,8 @@ private:
void parseOnPlayerDamage(Packet& packet);
void identifyPacketLoss();
void kick(PlayerID player);
PlayerID GetPlayerIDFromEndpoint();
PlayerID getPlayerIDFromEndpoint();
PlayerID getPlayerIDFromEntityID(EntityID entityID);
void parsePlayerTransform(Packet& packet);
void parseOnInputCommand(Packet& packet);
void parseClientPing();
@@ -103,6 +106,8 @@ private:
bool OnPlayerDamage(const Events::PlayerDamage& e);
EventRelay<Server, Events::AmmoPickup> m_EAmmoPickup;
bool OnAmmoPickup(const Events::AmmoPickup& e);
EventRelay<Server, Events::PlayerDeath> m_EPlayerDeath;
bool OnPlayerDeath(const Events::PlayerDeath& e);
};
#endif
+15 -20
View File
@@ -3,32 +3,27 @@
#include "GLM.h"
#include "../Common.h"
#include "../Core/System.h"
#include "../Core/ResourceManager.h"
#include "Common.h"
#include "Core/System.h"
#include "Core/ResourceManager.h"
#include "Rendering/Model.h"
#include "Rendering/EAnimationComplete.h"
#include "Rendering/Skeleton.h"
#include "Rendering/BlendTree.h"
#include "Rendering/EAutoAnimationBlend.h"
#include "../Core/EntityWrapper.h"
#include "Rendering/AutoBlendQueue.h"
#include "../Input/EInputCommand.h"
#include "imgui/imgui.h"
#include <imgui/imgui.h>
class AnimationSystem : public ImpureSystem
class AnimationSystem : public PureSystem
{
public:
AnimationSystem(SystemParams params);
~AnimationSystem() { }
virtual void Update(double dt) override;
private:
void CreateBlendTrees();
void UpdateAnimations(double dt);
void UpdateWeights(double dt);
AnimationSystem(SystemParams params)
: System(params)
, PureSystem("Animation")
{
}
~AnimationSystem() { }
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& animationComponent, double dt) override;
private:
EventRelay<AnimationSystem, Events::AutoAnimationBlend> m_EAutoAnimationBlend;
bool OnAutoAnimationBlend(Events::AutoAnimationBlend& e);
std::unordered_map<EntityWrapper, AutoBlendQueue> m_AutoBlendQueues;
};
#endif
-46
View File
@@ -1,46 +0,0 @@
#ifndef AutoBlendQueue_h__
#define AutoBlendQueue_h__
#include "../Core/ResourceManager.h"
#include "Skeleton.h"
#include "Model.h"
#include "BlendTree.h"
#include "../Core/EntityWrapper.h"
class AutoBlendQueue
{
public:
struct AutoBlendJob
{
EntityWrapper RootNode = EntityWrapper::Invalid;
double Duration;
double CurrentTime = 0.0;
double Delay = 0.0;
EntityWrapper AnimationEntity = EntityWrapper::Invalid;
BlendTree::AutoBlendInfo BlendInfo;
};
struct AutoblendNode
{
AutoBlendJob BlendJob;
double StartTime;
double EndTime;
};
AutoBlendQueue() { };
void Insert(AutoBlendJob autoBlendJob);
void UpdateTime(double dt);
void PrintQueue();
bool HasActiveBlendJob();
std::shared_ptr<BlendTree> GetBlendTree();
AutoBlendQueue::AutoBlendJob& GetActiveBlendJob();
private:
std::list<AutoblendNode> m_BlendQueue;
};
#endif
-100
View File
@@ -1,100 +0,0 @@
#ifndef BlendTree_h__
#define BlendTree_h__
#include "Common.h"
#include "../GLM.h"
#include "Skeleton.h"
#include "../Core/EntityWrapper.h"
#include "../Core/World.h"
#include <stack>
class BlendTree
{
public:
enum class NodeType
{
Additive,
Blend,
Override,
Animation,
};
struct Node
{
std::string Name;
EntityWrapper Entity;
Node* Parent = nullptr;
Node* Child[2] = { nullptr, nullptr };
NodeType Type;
std::map<int, Skeleton::PoseData> Pose;
bool SubTreeRoot = false;
double Weight = 0.0;
Node* Next() {
Node* next = this;
if (next->Child[1] == nullptr) {
// Node has no right child
next = this;
while (next->Parent != nullptr && next == next->Parent->Child[1]) {
next = next->Parent;
}
next = next->Parent;
} else {
// Find the leftmost node in the right subtree
next = next->Child[1];
while (next->Child[0] != nullptr) {
next = next->Child[0];
}
}
return next;
}
};
struct AutoBlendInfo
{
std::string NodeName;
double progress;
bool Start;
bool SingleBlend;
std::unordered_map<EntityWrapper, double> StartWeights;
};
BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton);
~BlendTree();
std::vector<glm::mat4> GetFinalPose() { return m_FinalPose; }
glm::mat4 GetBoneTransform(int boneID);
bool IsValid() { return (m_Root == nullptr ? false : true); }
void PrintTree();
BlendTree::AutoBlendInfo AutoBlendStep(AutoBlendInfo blendInfo);
BlendTree::Node* GetCommonParent(std::string NodeName1, std::string NodeName2);
BlendTree::Node* FirstCommonParent(Node* node1, Node* node2);
EntityWrapper GetSubTreeRoot(std::string nodeName);
private:
Skeleton* m_Skeleton = nullptr;
Node* m_Root = nullptr;
std::vector<glm::mat4> m_FinalPose;
std::map<int, glm::mat4> m_FinalBoneTransforms;
std::vector<glm::mat4> AccumulateFinalPose();
BlendTree::Node* FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity);
std::vector<BlendTree::Node*> FindNodesByName(std::string name);
void Blend(std::map<int, Skeleton::PoseData>& pose);
};
#endif
@@ -8,7 +8,6 @@
#include "Core/ResourceManager.h"
#include "Rendering/Model.h"
#include "Rendering/Skeleton.h"
#include "Rendering/BlendTree.h"
//Needs to be a higher orderlevel than AnimationSystem
class BoneAttachmentSystem : public PureSystem
@@ -1,27 +0,0 @@
#ifndef Events_AutoAnimationBlend_h__
#define Events_AutoAnimationBlend_h__
#include "../Core/EventBroker.h"
#include "../Core/EntityWrapper.h"
namespace Events
{
struct AutoAnimationBlend : Event
{
EntityWrapper RootNode = EntityWrapper::Invalid;
std::string NodeName;
double Duration = 0.0;
double Delay = 0.0;
bool Start = false;
bool Reverse = false;
bool Restart = false;
bool SingleLevelBlend = false;
EntityWrapper AnimationEntity = EntityWrapper::Invalid;
};
}
#endif
+26 -6
View File
@@ -15,7 +15,6 @@
#include "../Core/Transform.h"
#include "Skeleton.h"
#include "ShaderProgram.h"
#include "BlendTree.h"
struct ModelJob : RenderJob
{
@@ -124,14 +123,32 @@ struct ModelJob : RenderJob
Skeleton = Model->m_RawModel->m_Skeleton;
if (Skeleton != nullptr) {
EntityWrapper entityWrapper = EntityWrapper(world, modelComponent.EntityID);
if (world->HasComponent(Entity, "Animation")) {
auto animationComponent = world->GetComponent(Entity, "Animation");
if(Skeleton->BlendTrees.find(entityWrapper) != Skeleton->BlendTrees.end()) {
BlendTree = Skeleton->BlendTrees.at(entityWrapper);
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;
@@ -150,7 +167,10 @@ struct ModelJob : RenderJob
glm::vec4 Color;
const ::Model* Model = nullptr;
::Skeleton* Skeleton = nullptr;
std::shared_ptr<::BlendTree> BlendTree = nullptr;
std::vector<::Skeleton::AnimationData> Animations;
::Skeleton::AnimationOffset AnimationOffset;
float GlowIntensity = 8.0;
glm::vec4 DiffuseColor;
glm::vec4 SpecularColor;
+55 -22
View File
@@ -6,9 +6,27 @@
#include "../GLM.h"
#include <glm/gtx/matrix_decompose.hpp>
#include <imgui/imgui.h>
#include "../Core/EntityWrapper.h"
class BlendTree;
//struct Bone
//{
// Bone(std::string name, glm::mat4 offsetMatrix)
// : Name(name)
// , OffsetMatrix(offsetMatrix)
// { }
//
// ~Bone()
// {
// for (auto kv : Children) {
// delete kv.second;
// }
// }
//
// std::string Name;
// glm::mat4 OffsetMatrix;
// glm::mat4 LocalMatrix;
//
// std::map<std::string, Bone*> Children;
//};
class Skeleton
{
@@ -50,43 +68,58 @@ public:
std::map<int, std::vector<Keyframe>> JointAnimations;
};
struct PoseData {
glm::vec3 Translation;
glm::quat Orientation;
glm::vec3 Scale;
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();
Bone* RootBone;
std::map<int, Bone*> Bones;
std::unordered_map<EntityWrapper, std::shared_ptr<BlendTree>> BlendTrees;
std::map<int, Bone*> Bones;
// Attach a new bone to the skeleton
// Returns: New bone index
int CreateBone(int ID, int parentID, std::string name, glm::mat4 offsetMatrix);
int GetBoneID(std::string name);
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion = false);
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, bool noRootMotion = false);
const Animation* GetAnimation(std::string name);
std::map<int, Skeleton::PoseData> GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion = false);
std::map<int, Skeleton::PoseData> BlendPoses(const std::map<int, PoseData>& pose1, const std::map<int, PoseData>& pose2, double weight);
std::map<int, Skeleton::PoseData> OverridePose(const std::map<int, PoseData>& overridePose, const std::map<int, PoseData>& targetPose);
std::map<int, Skeleton::PoseData> BlendPoseAdditive(const std::map<int, PoseData>& additivePose, const std::map<int, PoseData>& targetPose);
void GetFinalPose(std::map<int, Skeleton::PoseData>& boneMatrices, std::vector<glm::mat4>& finalPose, std::map<int, glm::mat4>& boneTransforms);
std::vector<glm::mat4> GetTPose();
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, std::map<int, glm::mat4>& frameBones, const Bone* bone, glm::mat4 parentMatrix);
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, std::map<int, glm::mat4>& frameBones, const Bone* bone, glm::mat4 parentMatrix);
void PrintSkeleton();
void PrintSkeleton(const Bone* parent, int depthCount);
std::map<std::string, Animation> Animations;
glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix);
glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, AnimationOffset animationOffset, glm::mat4 childMatrix);
glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, glm::mat4 childMatrix);
int GetKeyframe(const Animation& animation, double time);
std::map<std::string, Animation> Animations;
private:
Skeleton::PoseData GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time);
void AccumulateFinalPose(std::map<int, glm::mat4>& boneMatrices, std::map<int, Skeleton::PoseData>& poseDatas, std::map<int, glm::mat4>& boneTransforms, const Bone* bone, glm::mat4 parentMatrix);
void AdditiveBoneTransforms(const Animation* animation, double time, std::map<int, PoseData>& boneMatrices, const Bone* bone);
void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map<int, PoseData>& boneMatrices, const Bone* bone);
glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset);
std::map<std::string, Bone*> m_BonesByName;
+1 -1
View File
@@ -10,7 +10,7 @@ public:
: System(params)
, PureSystem("Lifetime")
{
LOG_INFO("ASDASDASSA");
}
virtual void Update(double dt) override;
+1 -3
View File
@@ -33,6 +33,7 @@
<xs:include schemaLocation="Components/HiddenForLocalPlayer.xsd"/>
<xs:include schemaLocation="Components/HealthPickup.xsd"/>
<xs:include schemaLocation="Components/AmmoPickup.xsd"/>
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
<xs:include schemaLocation="Components/DashAbility.xsd"/>
<xs:include schemaLocation="Components/ShieldAbility.xsd"/>
<xs:include schemaLocation="Components/SprintAbility.xsd"/>
@@ -47,9 +48,6 @@
<xs:include schemaLocation="Components/TextFieldReader.xsd"/>
<xs:include schemaLocation="Components/Menu.xsd"/>
<xs:include schemaLocation="Components/KillFeed.xsd"/>
<xs:include schemaLocation="Components/BlendOverride.xsd"/>
<xs:include schemaLocation="Components/Blend.xsd"/>
<xs:include schemaLocation="Components/BlendAdditive.xsd"/>
<xs:include schemaLocation="Components/Page.xsd"/>
<xs:include schemaLocation="Components/SpriteIndicator.xsd"/>
<xs:include schemaLocation="Components/Button.xsd"/>
+15 -7
View File
@@ -1,10 +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">
<AnimationName></AnimationName>
<Time>0</Time>
<Play>false</Play>
<Reverse>false</Reverse>
<Speed>0</Speed>
<Loop>true</Loop>
<Additive>false</Additive>
<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>
+17 -7
View File
@@ -2,17 +2,27 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="Animation">
<xs:complexType>
<xs:all>
<xs:element name="AnimationName" 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="Play" type="t:bool" minOccurs="0"/>
<xs:element name="Reverse" type="t:bool" minOccurs="0"/>
<xs:element name="Loop" type="t:bool" minOccurs="0"/>
<xs:element name="Additive" 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:attribute name="replicated" type="xs:boolean" fixed="true"/>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -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>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Blend xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Blend.xsd">
<Pose1></Pose1>
<Pose2></Pose2>
<Weight>0.5</Weight>
<SubTreeRoot>false</SubTreeRoot>
</Blend>
-15
View File
@@ -1,15 +0,0 @@
<?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="Blend">
<xs:complexType>
<xs:all>
<xs:element name="Pose1" type="t:string" minOccurs="0"/>
<xs:element name="Pose2" type="t:string" minOccurs="0"/>
<xs:element name="Weight" type="t:double" minOccurs="0"/>
<xs:element name="SubTreeRoot" type="t:bool" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<BlendAdditive xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BlendAdditive.xsd">
<Adder></Adder>
<Receiver></Receiver>
</BlendAdditive>
@@ -1,13 +0,0 @@
<?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="BlendAdditive">
<xs:complexType>
<xs:all>
<xs:element name="Adder" type="t:string" minOccurs="0"/>
<xs:element name="Receiver" type="t:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<BlendOverride xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BlendOverride.xsd">
<Master></Master>
<Slave></Slave>
</BlendOverride>
@@ -1,13 +0,0 @@
<?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="BlendOverride">
<xs:complexType>
<xs:all>
<xs:element name="Master" type="t:string" minOccurs="0"/>
<xs:element name="Slave" type="t:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
+86 -494
View File
@@ -2,10 +2,6 @@
<Entity name="AnimationTests" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:SceneLight>
<Gamma>0.30000001192092896</Gamma>
<Exposure>3</Exposure>
</c:SceneLight>
<c:Transform/>
</Components>
@@ -13,542 +9,138 @@
<Entity>
<Components>
<c:Transform>
<Position X="0.100000001" Y="-1.5150001" Z="-3.70500016"/>
<Orientation X="0" Y="2.41300011" Z="0"/>
<Position X="-0.100000001" Y="-1.11500001" Z="-3.10500026"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:DirectionalLight>
<Intensity>0</Intensity>
</c:DirectionalLight>
<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.60000038" Y="3.14159203" Z="0"/>
<Orientation X="5.40800047" Y="3.65100026" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Entity name="Running">
<Components>
<c:PointLight>
<Color A="1" B="0.70588237" G="0.70588237" R="1"/>
<Radius>8</Radius>
<Intensity>0.60000002384185791</Intensity>
</c:PointLight>
<c:Transform>
<Position X="1.32209361" Y="1.37392569" Z="-0.0505663045"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Assault">
<Components>
<c:BlendAdditive>
<Adder>AimBlend</Adder>
<Receiver>FinalBlend</Receiver>
</c:BlendAdditive>
<c:Animation>
<AnimationName1>Run</AnimationName1>
<Weight1>0.5</Weight1>
<Time1>0.60188997954429357</Time1>
<Speed1>-1</Speed1>
<Speed2>1</Speed2>
<Weight2>0.5</Weight2>
<Time2>0.96957233017255007</Time2>
<Time3>0.093923612201312068</Time3>
<Speed3>1</Speed3>
</c:Animation>
<c:AnimationOffset>
<AnimationName>AimRifle</AnimationName>
<Time>0.5</Time>
</c:AnimationOffset>
<c:Model>
<GlowIntensity>5</GlowIntensity>
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
</c:Model>
<c:Transform/>
<c:Transform>
<Position X="-0.690088332" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponAttachment">
<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/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.154985309" Y="1.07679462" Z="-0.201120675"/>
<Scale X="1.00000012" Y="1" Z="1.00000012"/>
<Orientation X="-0.0289514996" Y="-0.119508959" Z="0.18072544"/>
<Position X="0.161975682" Y="1.06281972" Z="-0.216630161"/>
<Orientation X="-0.064812161" Y="-0.0739696771" Z="0.143780142"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AimBlend">
</Children>
</Entity>
<Entity>
<Components>
<c:PointLight>
<Color A="1" B="0.70588237" G="0.70588237" R="1"/>
<Radius>10</Radius>
</c:PointLight>
<c:Transform>
<Position X="-0.375567257" Y="2.13093901" Z="-0.718547285"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:Blend>
<Pose1>AimPrimary</Pose1>
<Pose2>AimSecondary</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
<c:PointLight>
<Color A="1" B="1" G="0.70588237" R="0.70588237"/>
<Radius>10</Radius>
</c:PointLight>
<c:Transform>
<Position X="-1.96873236" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="AimPrimary">
<Components>
<c:Animation>
<AnimationName>AimRifleA</AnimationName>
<Time>0.49999979138374329</Time>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AimSecondary">
<Components>
<c:Animation>
<AnimationName>AimSecWepA</AnimationName>
<Time>0.5</Time>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="FinalBlend">
<Components>
<c:BlendOverride>
<Master>ReloadSwitchBlend</Master>
<Slave>MovementBlend</Slave>
</c:BlendOverride>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>StandCrouchBlend</Pose1>
<Pose2>JumpDashBlend</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StandCrouchBlend">
<Components>
<c:Blend>
<Pose1>StandMovement</Pose1>
<Pose2>CrouchMovement</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StandMovement">
<Components>
<c:Blend>
<Pose1>MovementBlend</Pose1>
<Pose2>Idle</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>RunWalkBlend</Pose1>
<Pose2>StrafeLRBlend</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="RunWalkBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>Run</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>WalkF</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.89967686078176468</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="StrafeLRBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>StrafeLeftF</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>StrafeRightF</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>0.33219857512804407</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="CrouchMovement">
<Components>
<c:Blend>
<Pose1>MovementBlend</Pose1>
<Pose2>Idle</Pose2>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>StrafeLRBlend</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StrafeLRBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>CrouchWalkF</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>CrouchF</AnimationName>
<Time>0.86553330718370836</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="JumpDashBlend">
<Components>
<c:Blend>
<Pose1>Jump</Pose1>
<Pose2>DashBlend</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Jump">
<Components>
<c:Animation>
<AnimationName>JumpF</AnimationName>
<Time>0.5</Time>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashBlend">
<Components>
<c:Blend>
<Pose1>DashFBBlend</Pose1>
<Pose2>DashLRBlend</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashFBBlend">
<Components>
<c:Blend>
<Pose1>DashForward</Pose1>
<Pose2>DashBackward</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashForward">
<Components>
<c:Animation>
<AnimationName>DashForwardF</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashBackward">
<Components>
<c:Animation>
<AnimationName>DashBackwardF</AnimationName>
<Time>1</Time>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="DashLRBlend">
<Components>
<c:Blend>
<Pose1>DashLeft</Pose1>
<Pose2>DashRight</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashLeft">
<Components>
<c:Animation>
<AnimationName>DashLeftF</AnimationName>
<Time>1</Time>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashRight">
<Components>
<c:Animation>
<AnimationName>DashRightF</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ReloadSwitchBlend">
<Components>
<c:Blend>
<Pose1>ReloadSwitch</Pose1>
<Pose2>WeaponActionBlend</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ReloadSwitch">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchU</AnimationName>
<Time>0.86721706215490468</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="WeaponActionBlend">
<Components>
<c:Blend>
<Pose1>IdleBlend</Pose1>
<Pose2>ShootBlend</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="IdleBlend">
<Components>
<c:Blend>
<Pose1>IdlePrimary</Pose1>
<Pose2>IdleSecondary</Pose2>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="IdlePrimary">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="IdleSecondary">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ShootBlend">
<Components>
<c:Blend>
<Pose1>ShootPrimary</Pose1>
<Pose2>ShootSecondary</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ShootPrimary">
<Components>
<c:Animation>
<AnimationName>ShootFastRifleU</AnimationName>
<Time>0.19605135393254369</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="ShootSecondary">
<Components>
<c:Animation>
<AnimationName>ShootSecWepFastU</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Plane">
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitPlane.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="5" Y="1" Z="5"/>
<Scale X="10" Y="1" Z="10"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Entity>
<Components>
<c:PointLight>
<Color A="1" B="0.956862748" G="0.960784316" R="0.819607854"/>
<Radius>8</Radius>
<Intensity>0.60000002384185791</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-1.36898434" Y="1.37392569" Z="0.620898128"/>
</c:Transform>
<c:Animation>
<AnimationName1>ShootFastRifle</AnimationName1>
<Time1>0.056234247235838808</Time1>
<Speed1>1</Speed1>
<Speed2>1</Speed2>
<AnimationName2>Idl</AnimationName2>
<Weight2>0.5</Weight2>
<Time2>1.8308673495784191</Time2>
<AnimationName3>StrafeRigh</AnimationName3>
<Weight3>0.5</Weight3>
<Time3>0.32167823998061529</Time3>
<Speed3>1</Speed3>
</c:Animation>
<c:Model>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Components>
<c:PointLight>
<Radius>8</Radius>
<Intensity>0.80000001192092896</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-0.127636135" Y="1.37392569" Z="-1.52101767"/>
</c:Transform>
</Components>
<Children/>
<Children>
<Entity>
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="0.803468645" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -1,513 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="Assault" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BlendAdditive>
<Adder>AimBlend</Adder>
<Receiver>FinalBlend</Receiver>
</c:BlendAdditive>
<c:Model>
<GlowIntensity>5</GlowIntensity>
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.156333789" Y="1.03861308" Z="-0.236426264"/>
<Orientation X="-0.004295466" Y="-0.0313791931" Z="0.138012439"/>
<Scale X="1.00000012" Y="1" Z="1.00000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AimBlend">
<Components>
<c:Blend>
<Pose1>AimPrimary</Pose1>
<Pose2>AimSecondary</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="AimSecondary">
<Components>
<c:Animation>
<AnimationName>AimSecWepA</AnimationName>
<Time>0.5</Time>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AimPrimary">
<Components>
<c:Animation>
<AnimationName>AimRifleA</AnimationName>
<Time>0.5</Time>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="FinalBlend">
<Components>
<c:BlendOverride>
<Master>ReloadSwitchBlend</Master>
<Slave>MovementBlend</Slave>
</c:BlendOverride>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>StandCrouchBlend</Pose1>
<Pose2>JumpDashBlend</Pose2>
<Weight>2.5146881298480398e-63</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StandCrouchBlend">
<Components>
<c:Blend>
<Pose1>StandMovement</Pose1>
<Pose2>CrouchMovement</Pose2>
<Weight>0.012867419418159054</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StandMovement">
<Components>
<c:Blend>
<Pose1>MovementBlend</Pose1>
<Pose2>Idle</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>RunWalkBlend</Pose1>
<Pose2>StrafeLRBlend</Pose2>
<Weight>2.4565650245976452e-16</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="RunWalkBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>Run</Pose2>
<Weight>1.2938206818383024e-24</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>WalkF</AnimationName>
<Time>0.2564968854355536</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.52851038945945739</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="StrafeLRBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>0.033793529385008014</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>StrafeLeftF</AnimationName>
<Time>0.43808950646909217</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>StrafeRightF</AnimationName>
<Time>0.4616050363492068</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>0.0053995709937186831</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="CrouchMovement">
<Components>
<c:Blend>
<Pose1>MovementBlend</Pose1>
<Pose2>Idle</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>StrafeLRBlend</Pose2>
<Weight>2.4565650245976452e-16</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StrafeLRBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>0.033793529385008014</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.045646808897594759</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.97296827084837822</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>CrouchWalkF</AnimationName>
<Time>0.75134225602578031</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>CrouchF</AnimationName>
<Time>0.99862473341677438</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="JumpDashBlend">
<Components>
<c:Blend>
<Pose1>Jump</Pose1>
<Pose2>DashBlend</Pose2>
<Weight>1</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Jump">
<Components>
<c:Animation>
<AnimationName>JumpF</AnimationName>
<Time>0.5</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashBlend">
<Components>
<c:Blend>
<Pose1>DashFBBlend</Pose1>
<Pose2>DashLRBlend</Pose2>
<Weight>0.014621149736541383</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashFBBlend">
<Components>
<c:Blend>
<Pose1>DashForward</Pose1>
<Pose2>DashBackward</Pose2>
<Weight>0.014363533804961248</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashForward">
<Components>
<c:Animation>
<AnimationName>DashForwardF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashBackward">
<Components>
<c:Animation>
<AnimationName>DashBackwardF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="DashLRBlend">
<Components>
<c:Blend>
<Pose1>DashLeft</Pose1>
<Pose2>DashRight</Pose2>
<Weight>4.3244885367500671e-16</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashLeft">
<Components>
<c:Animation>
<AnimationName>DashLeftF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashRight">
<Components>
<c:Animation>
<AnimationName>DashRightF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ReloadSwitchBlend">
<Components>
<c:Blend>
<Pose1>ReloadSwitch</Pose1>
<Pose2>WeaponActionBlend</Pose2>
<Weight>1</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ReloadSwitch">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchU</AnimationName>
<Time>0.00030848838797092881</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="WeaponActionBlend">
<Components>
<c:Blend>
<Pose1>IdleBlend</Pose1>
<Pose2>ShootBlend</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="IdleBlend">
<Components>
<c:Blend>
<Pose1>IdlePrimary</Pose1>
<Pose2>IdleSecondary</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="IdlePrimary">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>0.68071957047806109</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="IdleSecondary">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Time>0.68424461076784837</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ShootBlend">
<Components>
<c:Blend>
<Pose1>ShootPrimary</Pose1>
<Pose2>ShootSecondary</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ShootPrimary">
<Components>
<c:Animation>
<AnimationName>ShootFastRifleU</AnimationName>
<Time>0.12914212153428517</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="ShootSecondary">
<Components>
<c:Animation>
<AnimationName>ShootSecWepFastU</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
-598
View File
@@ -1,598 +0,0 @@
<?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:SceneLight>
<Gamma>0.30000001192092896</Gamma>
<Exposure>3</Exposure>
</c:SceneLight>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Transform>
<Position X="0.100000001" Y="-1.5150001" Z="-3.70500016"/>
<Orientation X="0" Y="2.41300011" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:DirectionalLight>
<Intensity>0</Intensity>
</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.60000038" Y="3.14159203" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Components>
<c:PointLight>
<Color A="1" B="0.70588237" G="0.70588237" R="1"/>
<Radius>8</Radius>
<Intensity>0.60000002384185791</Intensity>
</c:PointLight>
<c:Transform>
<Position X="1.32209361" Y="1.37392569" Z="-0.0505663045"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Assault">
<Components>
<c:BlendAdditive>
<Adder>AimBlend</Adder>
<Receiver>FinalBlend</Receiver>
</c:BlendAdditive>
<c:Model>
<GlowIntensity>5</GlowIntensity>
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.157041892" Y="1.0375092" Z="-0.236085728"/>
<Orientation X="-0.00432149554" Y="-0.0343661793" Z="0.138000518"/>
<Scale X="1.00000012" Y="1" Z="1.00000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AimBlend">
<Components>
<c:Blend>
<Pose1>AimPrimary</Pose1>
<Pose2>AimSecondary</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="AimSecondary">
<Components>
<c:Animation>
<AnimationName>AimSecWepA</AnimationName>
<Time>0.5</Time>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AimPrimary">
<Components>
<c:Animation>
<AnimationName>AimRifleA</AnimationName>
<Time>0.5</Time>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="FinalBlend">
<Components>
<c:BlendOverride>
<Master>ReloadSwitchBlend</Master>
<Slave>MovementBlend</Slave>
</c:BlendOverride>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>StandCrouchBlend</Pose1>
<Pose2>JumpDashBlend</Pose2>
<Weight>2.5146881298480398e-63</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StandCrouchBlend">
<Components>
<c:Blend>
<Pose1>StandMovement</Pose1>
<Pose2>CrouchMovement</Pose2>
<Weight>0.012867419418159054</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StandMovement">
<Components>
<c:Blend>
<Pose1>MovementBlend</Pose1>
<Pose2>Idle</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>RunWalkBlend</Pose1>
<Pose2>StrafeLRBlend</Pose2>
<Weight>2.4565650245976452e-16</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="RunWalkBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>Run</Pose2>
<Weight>1.2938206818383024e-24</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>WalkF</AnimationName>
<Time>0.28642783708275554</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.55844134110665933</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="StrafeLRBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>0.033793529385008014</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>StrafeLeftF</AnimationName>
<Time>0.46802045811629411</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>StrafeRightF</AnimationName>
<Time>0.49153598799640874</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleF</AnimationName>
<Time>1.9353306180083529</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="CrouchMovement">
<Components>
<c:Blend>
<Pose1>MovementBlend</Pose1>
<Pose2>Idle</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>StrafeLRBlend</Pose2>
<Weight>2.4565650245976452e-16</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StrafeLRBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>0.033793529385008014</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.075577760544797146</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.0028992224955801671</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>CrouchWalkF</AnimationName>
<Time>0.78127320767298225</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>CrouchF</AnimationName>
<Time>0.99862473341677438</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="JumpDashBlend">
<Components>
<c:Blend>
<Pose1>Jump</Pose1>
<Pose2>DashBlend</Pose2>
<Weight>1</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Jump">
<Components>
<c:Animation>
<AnimationName>JumpF</AnimationName>
<Time>0.5</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashBlend">
<Components>
<c:Blend>
<Pose1>DashFBBlend</Pose1>
<Pose2>DashLRBlend</Pose2>
<Weight>0.014621149736541383</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashFBBlend">
<Components>
<c:Blend>
<Pose1>DashForward</Pose1>
<Pose2>DashBackward</Pose2>
<Weight>0.014363533804961248</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashForward">
<Components>
<c:Animation>
<AnimationName>DashForwardF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashBackward">
<Components>
<c:Animation>
<AnimationName>DashBackwardF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="DashLRBlend">
<Components>
<c:Blend>
<Pose1>DashLeft</Pose1>
<Pose2>DashRight</Pose2>
<Weight>4.3244885367500671e-16</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DashLeft">
<Components>
<c:Animation>
<AnimationName>DashLeftF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="DashRight">
<Components>
<c:Animation>
<AnimationName>DashRightF</AnimationName>
<Time>1</Time>
<Speed>1</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ReloadSwitchBlend">
<Components>
<c:Blend>
<Pose1>ReloadSwitch</Pose1>
<Pose2>WeaponActionBlend</Pose2>
<Weight>1</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ReloadSwitch">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchU</AnimationName>
<Time>0.00030848838797092881</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="WeaponActionBlend">
<Components>
<c:Blend>
<Pose1>IdleBlend</Pose1>
<Pose2>ShootBlend</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="IdleBlend">
<Components>
<c:Blend>
<Pose1>IdlePrimary</Pose1>
<Pose2>IdleSecondary</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="IdlePrimary">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>0.71065052212526325</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="IdleSecondary">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Time>0.71417556241505054</Time>
<Speed>1</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ShootBlend">
<Components>
<c:Blend>
<Pose1>ShootPrimary</Pose1>
<Pose2>ShootSecondary</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ShootPrimary">
<Components>
<c:Animation>
<AnimationName>ShootFastRifleU</AnimationName>
<Time>0.12914212153428517</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="ShootSecondary">
<Components>
<c:Animation>
<AnimationName>ShootSecWepFastU</AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Plane">
<Components>
<c:Model>
<Resource>Models/Core/UnitPlane.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="5" Y="1" Z="5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Components>
<c:PointLight>
<Color A="1" B="0.956862748" G="0.960784316" R="0.819607854"/>
<Radius>8</Radius>
<Intensity>0.60000002384185791</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-1.36898434" Y="1.37392569" Z="0.620898128"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Components>
<c:PointLight>
<Radius>8</Radius>
<Intensity>0.80000001192092896</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-0.127636135" Y="1.37392569" Z="-1.52101767"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
-19
View File
@@ -1,19 +0,0 @@
<?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:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.136586398" Y="0.92942369" Z="-0.139760047"/>
<Orientation X="-0.601206124" Y="0.132410824" Z="-0.129014626"/>
</c:Transform>
</Components>
<Children/>
</Entity>
+103 -130
View File
@@ -18,9 +18,9 @@
<Transparent>true</Transparent>
</c:Model>
<c:Transform>
<Position X="0.155832842" Y="1.12994993" Z="-0.201626897"/>
<Position X="0.47420007" Y="0.928898275" Z="0.0299553983"/>
<Scale X="0.0500000007" Y="0.0500000007" Z="0.100000001"/>
<Orientation X="0.195066273" Y="-0.0870126858" Z="0.148657113"/>
<Orientation X="1.60548508" Y="-1.10789871" Z="-1.51772225"/>
</c:Transform>
</Components>
<Children/>
@@ -29,17 +29,16 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Hand</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.202149346" Y="1.12270021" Z="-0.144635201"/>
<Scale X="0.0500000231" Y="0.0500000305" Z="0.0500000119"/>
<Orientation X="1.41306889" Y="0.0776072815" Z="-0.744222522"/>
<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/>
@@ -48,17 +47,16 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Arm</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0609518476" Y="1.16432548" Z="0.0783129707"/>
<Scale X="0.0500000194" Y="0.0500000082" Z="0.0500000194"/>
<Orientation X="0.311971247" Y="0.199406415" Z="0.162320927"/>
<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/>
@@ -67,17 +65,16 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Shoulder</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0742288083" Y="1.12503755" Z="-0.00992172211"/>
<Scale X="0.0500000119" Y="0.0500000082" Z="0.0500000119"/>
<Orientation X="-0.295679808" Y="-1.03809071" Z="-0.158694059"/>
<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/>
@@ -86,17 +83,16 @@
<Components>
<c:BoneAttachment>
<BoneName>Neck</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0288712904" Y="1.20688999" Z="-0.0585537553"/>
<Scale X="0.0500000194" Y="0.0500000082" Z="0.0500000082"/>
<Orientation X="-0.0778672397" Y="-0.380205482" Z="-0.116210334"/>
<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/>
@@ -105,17 +101,16 @@
<Components>
<c:BoneAttachment>
<BoneName>Spine_3</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0190485716" Y="1.13146138" Z="-0.0447565243"/>
<Scale X="0.0500000119" Y="0.0500000082" Z="0.0500000119"/>
<Orientation X="-0.295679808" Y="-1.03809071" Z="-0.158694059"/>
<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/>
@@ -124,17 +119,16 @@
<Components>
<c:BoneAttachment>
<BoneName>Spine_2</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.00282198261" Y="1.01004541" Z="-0.0218831152"/>
<Scale X="0.0500000119" Y="0.0500000082" Z="0.0500000119"/>
<Orientation X="-0.295679808" Y="-1.03809071" Z="-0.158694059"/>
<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/>
@@ -143,17 +137,16 @@
<Components>
<c:BoneAttachment>
<BoneName>Spine_1</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.00298201409" Y="0.878305078" Z="-0.0124331526"/>
<Scale X="0.0500000082" Y="0.0500000007" Z="0.0500000007"/>
<Orientation X="-0.478212297" Y="-1.01566339" Z="-0.374480605"/>
<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/>
@@ -162,17 +155,15 @@
<Components>
<c:BoneAttachment>
<BoneName>Hip</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.745380521" Z="0"/>
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<Orientation X="-0.0850669593" Y="-0.351720452" Z="0.0214110892"/>
<Position X="0" Y="0.901226044" Z="0"/>
<Scale X="0.100000001" Y="0.0500000007" Z="0.0500000007"/>
</c:Transform>
</Components>
<Children/>
@@ -181,17 +172,16 @@
<Components>
<c:BoneAttachment>
<BoneName>L_Leg_Top</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0688988566" Y="0.704185605" Z="-0.0198653266"/>
<Position X="-0.0735318959" Y="0.86343354" Z="0.00186898722"/>
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<Orientation X="-0.124463096" Y="0.178934589" Z="0.0281526987"/>
<Orientation X="0.431212306" Y="-0.0456388369" Z="-0.00236316444"/>
</c:Transform>
</Components>
<Children/>
@@ -200,17 +190,16 @@
<Components>
<c:BoneAttachment>
<BoneName>L_Leg_Bottom</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0895988718" Y="0.340622783" Z="0.022300493"/>
<Position X="-0.0971027464" Y="0.534537971" Z="-0.158307418"/>
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<Orientation X="-0.634849846" Y="0.204822823" Z="0.0869619399"/>
<Orientation X="-0.435873091" Y="0.0584642813" Z="-0.0526505522"/>
</c:Transform>
</Components>
<Children/>
@@ -219,17 +208,16 @@
<Components>
<c:BoneAttachment>
<BoneName>L_Foot</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0861766189" Y="0.0597670376" Z="0.257741988"/>
<Scale X="0.0500000082" Y="0.0500000007" Z="0.0500000082"/>
<Orientation X="-0.185180262" Y="-0.00943047088" Z="-0.00198192359"/>
<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/>
@@ -238,17 +226,16 @@
<Components>
<c:BoneAttachment>
<BoneName>L_Toe</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0898738578" Y="-0.0101006478" Z="0.078159079"/>
<Scale X="0.0500000082" Y="0.0500000007" Z="0.0500000082"/>
<Orientation X="-0.185180262" Y="-0.00943047088" Z="-0.00198192359"/>
<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/>
@@ -257,17 +244,16 @@
<Components>
<c:BoneAttachment>
<BoneName>L_Shoulder</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0172477104" Y="1.11405122" Z="-0.107610352"/>
<Scale X="0.0500000119" Y="0.0500000082" Z="0.0500000119"/>
<Orientation X="-0.295679808" Y="-1.03809071" Z="-0.158694059"/>
<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/>
@@ -276,17 +262,16 @@
<Components>
<c:BoneAttachment>
<BoneName>L_Arm</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0692541152" Y="1.13922095" Z="-0.14491269"/>
<Scale X="0.0500000194" Y="0.0500000194" Z="0.0500000231"/>
<Orientation X="1.49024689" Y="-0.866028547" Z="1.11317146"/>
<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/>
@@ -295,17 +280,16 @@
<Components>
<c:BoneAttachment>
<BoneName>L_Hand</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.100635156" Y="1.17628682" Z="-0.439798951"/>
<Scale X="0.0500000231" Y="0.0500000305" Z="0.050000038"/>
<Orientation X="0.026293885" Y="-0.262760967" Z="2.338521"/>
<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/>
@@ -314,17 +298,16 @@
<Components>
<c:BoneAttachment>
<BoneName>L_Shoulder_Armor_Joint</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0505402647" Y="1.1960609" Z="-0.172250509"/>
<Scale X="0.0500000194" Y="0.0500000119" Z="0.0500000119"/>
<Orientation X="-0.295679778" Y="-1.03809094" Z="-0.506270111"/>
<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/>
@@ -333,17 +316,16 @@
<Components>
<c:BoneAttachment>
<BoneName>Chin</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0539259352" Y="1.22412896" Z="-0.183897316"/>
<Scale X="0.0500000119" Y="0.0500000082" Z="0.0500000082"/>
<Orientation X="-0.0481163412" Y="-0.134963214" Z="-0.102023236"/>
<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/>
@@ -352,17 +334,16 @@
<Components>
<c:BoneAttachment>
<BoneName>Head</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0481297895" Y="1.31164014" Z="-0.0825063139"/>
<Scale X="0.0500000119" Y="0.0500000082" Z="0.0500000082"/>
<Orientation X="-0.0481163412" Y="-0.134963214" Z="-0.102023236"/>
<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/>
@@ -371,17 +352,16 @@
<Components>
<c:BoneAttachment>
<BoneName>Perietal</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0686318353" Y="1.49197555" Z="-0.104337469"/>
<Scale X="0.0500000119" Y="0.0500000082" Z="0.0500000082"/>
<Orientation X="-0.0481163412" Y="-0.134963214" Z="-0.102023236"/>
<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/>
@@ -390,17 +370,16 @@
<Components>
<c:BoneAttachment>
<BoneName>L_Elbow</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0776530653" Y="1.10232043" Z="-0.397976696"/>
<Scale X="0.0500000231" Y="0.0500000231" Z="0.0500000231"/>
<Orientation X="2.36848879" Y="-0.278962672" Z="2.07910991"/>
<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/>
@@ -409,17 +388,16 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Leg_Bottom</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.115077674" Y="0.503088951" Z="-0.267230242"/>
<Scale X="0.0500000007" Y="0.0499999933" Z="0.049999997"/>
<Orientation X="-0.511662602" Y="-0.216903374" Z="-0.0133549664"/>
<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/>
@@ -428,17 +406,16 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Elbow</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.301801801" Y="1.09683371" Z="0.023665078"/>
<Scale X="0.0500000231" Y="0.0500000194" Z="0.0500000194"/>
<Orientation X="1.67780411" Y="0.697954118" Z="-1.36570835"/>
<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/>
@@ -447,17 +424,16 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Leg_Top</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0695244595" Y="0.711660385" Z="0.0306202006"/>
<Scale X="0.0500000007" Y="0.0500000007" Z="0.049999997"/>
<Orientation X="0.929966331" Y="0.0844758675" Z="0.0447596237"/>
<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/>
@@ -466,17 +442,16 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Foot</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.137999952" Y="0.19909358" Z="-0.0635268986"/>
<Scale X="0.0500000007" Y="0.0499999933" Z="0.049999997"/>
<Orientation X="-0.193798333" Y="-0.056662742" Z="-0.0102932369"/>
<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/>
@@ -485,17 +460,16 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Toe</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.153348058" Y="0.127739012" Z="-0.24189125"/>
<Scale X="0.0500000007" Y="0.0499999933" Z="0.049999997"/>
<Orientation X="-0.193798333" Y="-0.056662742" Z="-0.0102932369"/>
<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/>
@@ -504,17 +478,16 @@
<Components>
<c:BoneAttachment>
<BoneName>R_Shoulder_Armor_Joint</BoneName>
<ScaleOffset X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<InheritScale>true</InheritScale>
<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.0885034204" Y="1.22286928" Z="0.0661265627"/>
<Scale X="0.0500000119" Y="0.0500000119" Z="0.0500000119"/>
<Orientation X="-0.295679808" Y="-1.03809083" Z="-0.237101197"/>
<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/>
-145
View File
@@ -1,145 +0,0 @@
<?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:SceneLight>
<Gamma>0.30000001192092896</Gamma>
<Exposure>3</Exposure>
</c:SceneLight>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Transform>
<Position X="0.100000001" Y="-1.5150001" Z="-3.70500016"/>
<Orientation X="0" Y="2.41300011" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:DirectionalLight>
<Intensity>0</Intensity>
</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.60000038" Y="3.14159203" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Components>
<c:PointLight>
<Color A="1" B="0.70588237" G="0.70588237" R="1"/>
<Radius>8</Radius>
<Intensity>0.60000002384185791</Intensity>
</c:PointLight>
<c:Transform>
<Position X="1.32209361" Y="1.37392569" Z="-0.0505663045"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Assault">
<Components>
<c:BlendAdditive>
<Adder></Adder>
<Receiver></Receiver>
</c:BlendAdditive>
<c:Model>
<GlowIntensity>5</GlowIntensity>
<Resource>Models/Characters/Defender/DefenderBlue.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="1.00000012" Y="1" Z="1.00000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AimBlend">
<Components>
<c:Blend>
<Pose1>AimPrimary</Pose1>
<Pose2>AimSecondary</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="AimPrimary">
<Components>
<c:Animation>
<AnimationName></AnimationName>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="AimSecondary">
<Components>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Plane">
<Components>
<c:Model>
<Resource>Models/Core/UnitPlane.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="5" Y="1" Z="5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Components>
<c:PointLight>
<Color A="1" B="0.956862748" G="0.960784316" R="0.819607854"/>
<Radius>8</Radius>
<Intensity>0.60000002384185791</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-1.36898434" Y="1.37392569" Z="0.620898128"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Components>
<c:PointLight>
<Radius>8</Radius>
<Intensity>0.80000001192092896</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-0.127636135" Y="1.37392569" Z="-1.52101767"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
-298
View File
@@ -1,298 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="Assault" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BlendAdditive>
<Adder>Aim</Adder>
<Receiver>FinalBlend</Receiver>
</c:BlendAdditive>
<c:Model>
<GlowIntensity>4</GlowIntensity>
<Resource>Models/Characters/Sniper/SniperBlue.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.161506474" Y="1.12409711" Z="-0.197195739"/>
<Scale X="1.00000012" Y="1" Z="1.00000012"/>
<Orientation X="0.185420558" Y="-0.0891536027" Z="0.122916825"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Light">
<Components>
<c:PointLight>
<Radius>3</Radius>
</c:PointLight>
<c:Transform>
<Position X="0" Y="0.100000001" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Aim">
<Components>
<c:Animation>
<AnimationName>AimRifleA</AnimationName>
<Time>0.60000038146972656</Time>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="FinalBlend">
<Components>
<c:BlendOverride>
<Master>WeaponBlend</Master>
<Slave>MovementBlend</Slave>
</c:BlendOverride>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponBlend">
<Components>
<c:Blend>
<Pose1>ShootBlend</Pose1>
<Pose2>Reload</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ShootBlend">
<Components>
<c:Blend>
<Pose1>ShootFast</Pose1>
<Pose2>ShootSlow</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="ShootFast">
<Components>
<c:Animation>
<AnimationName>ShootFastRifleU</AnimationName>
<Time>0.19319528378127959</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="ShootSlow">
<Components>
<c:Animation>
<AnimationName>ShootRifleU</AnimationName>
<Time>0.59328474141239074</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Reload">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchU</AnimationName>
<Time>1</Time>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>StandCrouchBlend</Pose1>
<Pose2>Jump</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StandCrouchBlend">
<Components>
<c:Blend>
<Pose1>StandMovement</Pose1>
<Pose2>CrouchMovement</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="CrouchMovement">
<Components>
<c:Blend>
<Pose1>Walk</Pose1>
<Pose2>StrafeBlend</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>CrouchWalkF</AnimationName>
<Time>0.35684875796278082</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="StrafeBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.35684875796278082</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.35684875796278082</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="StandMovement">
<Components>
<c:Blend>
<Pose1>RunWalkBlend</Pose1>
<Pose2>StrafeBlend</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="RunWalkBlend">
<Components>
<c:Blend>
<Pose1>Run</Pose1>
<Pose2>Walk</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.35684875796278082</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>WalkF</AnimationName>
<Time>0.35684875796278082</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="StrafeBlend">
<Components>
<c:Blend>
<Pose1>Left</Pose1>
<Pose2>Right</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>StrafeLeftF</AnimationName>
<Time>0.35684875796278082</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>StrafeRightF</AnimationName>
<Time>0.35684875796278082</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="Jump">
<Components>
<c:Animation>
<AnimationName>JumpF</AnimationName>
<Time>1</Time>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
-122
View File
@@ -1,122 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="Assault" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BlendAdditive>
<Adder>AimAdditive</Adder>
<Receiver>BlendOverride</Receiver>
</c:BlendAdditive>
<c:Model>
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="1.00000012" Y="1" Z="1.00000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AimAdditive">
<Components>
<c:Animation>
<AnimationName>AimRifleA</AnimationName>
<Time>1</Time>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="BlendOverride">
<Components>
<c:BlendOverride>
<Master>ShootRifleAnimation</Master>
<Slave>MovementBlend</Slave>
</c:BlendOverride>
<c:Transform/>
</Components>
<Children>
<Entity name="ShootRifleAnimation">
<Components>
<c:Animation>
<AnimationName>ShootFastRifleU</AnimationName>
<Time>0.11937709655124218</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>BlendWalkRun</Pose1>
<Pose2>StrafeAnimation</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="StrafeAnimation">
<Components>
<c:Animation>
<AnimationName>StrafeRightF</AnimationName>
<Time>0.37772682263908042</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="BlendWalkRun">
<Components>
<c:Blend>
<Pose1>RunAnimtaion</Pose1>
<Pose2>WalkAnimation</Pose2>
<Weight>0.43000054359436035</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="RunAnimtaion">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.13674529278927716</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="WalkAnimation">
<Components>
<c:Animation>
<AnimationName>WalkF</AnimationName>
<Time>0.36615803446482609</Time>
<Speed>1</Speed>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+1 -3
View File
@@ -43,12 +43,10 @@
<xs:element ref="c:Shield" minOccurs="0"/>
<xs:element ref="c:Shielded" minOccurs="0"/>
<xs:element ref="c:CapturePointHUD" minOccurs="0"/>
<xs:element ref="c:BlendOverride" minOccurs="0"/>
<xs:element ref="c:TextFieldReader" minOccurs="0"/>
<xs:element ref="c:Blend" minOccurs="0"/>
<xs:element ref="c:BlendAdditive" minOccurs="0"/>
<xs:element ref="c:KillFeed" minOccurs="0"/>
<xs:element ref="c:Sprite" minOccurs="0"/>
<xs:element ref="c:AnimationOffset" minOccurs="0"/>
<xs:element ref="c:Menu" minOccurs="0"/>
<xs:element ref="c:Page" minOccurs="0"/>
<xs:element ref="c:Button" minOccurs="0"/>
-25
View File
@@ -51,31 +51,6 @@ EntityWrapper EntityWrapper::FirstChildByName(const std::string& name)
return firstChildByNameRecursive(name, this->ID);
}
EntityWrapper EntityWrapper::FirstLevelChildByName(const std::string& name)
{
EntityID parent = this->ID;
if (!this->World->ValidEntity(parent)) {
return EntityWrapper::Invalid;
}
auto itPair = this->World->GetDirectChildren(parent);
if (itPair.first == itPair.second) {
return EntityWrapper::Invalid;
}
for (auto it = itPair.first; it != itPair.second; ++it) {
std::string itName = this->World->GetName(it->second);
if (itName == name) {
return EntityWrapper(this->World, it->second);
} else if (it->second != EntityID_Invalid) {
continue;
}
}
return EntityWrapper::Invalid;
}
EntityWrapper EntityWrapper::FirstParentWithComponent(const std::string& componentType)
{
EntityWrapper entity = *this;
+27 -6
View File
@@ -14,6 +14,7 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
EVENT_SUBSCRIBE_MEMBER(m_EAmmoPickup, &Server::OnAmmoPickup);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &Server::OnPlayerDeath);
// BindWW
if (port == 0) {
port = config->Get<float>("Networking.Port", 27666);
@@ -351,7 +352,7 @@ void Server::parseTCPConnect(Packet & packet)
LOG_INFO("Parsing connections");
// Check if player is already connected
// Ska vara till lagd i TCPServer receive
PlayerID playerID = GetPlayerIDFromEndpoint();
PlayerID playerID = getPlayerIDFromEndpoint();
if (playerID == -1) {
return;
}
@@ -526,10 +527,20 @@ bool Server::OnAmmoPickup(const Events::AmmoPickup & e)
return true;
}
bool Server::OnPlayerDeath(const Events::PlayerDeath& e)
{
Events::KillDeath eKD;
eKD.Casualty = getPlayerIDFromEntityID(e.Player.ID);
eKD.Killer = getPlayerIDFromEntityID(e.Killer.ID);
m_EventBroker->Publish(eKD);
return false;
}
void Server::parseClientPing()
{
LOG_INFO("%i: Parsing ping", m_PacketID);
PlayerID player = GetPlayerIDFromEndpoint();
PlayerID player = getPlayerIDFromEndpoint();
if (player == -1) {
return;
}
@@ -567,7 +578,7 @@ void Server::parseOnInputCommand(Packet& packet)
{
PlayerID player = -1;
// Check which player it was who sent the message
player = GetPlayerIDFromEndpoint();
player = getPlayerIDFromEndpoint();
if (player != -1) {
while (packet.DataReadSize() < packet.Size()) {
Events::InputCommand e;
@@ -586,7 +597,7 @@ void Server::parseOnInputCommand(Packet& packet)
void Server::parsePlayerTransform(Packet& packet)
{
PlayerID playerID = GetPlayerIDFromEndpoint();
PlayerID playerID = getPlayerIDFromEndpoint();
if (playerID == -1) {
return;
}
@@ -635,7 +646,7 @@ bool Server::shouldSendToClient(EntityWrapper childEntity)
|| childEntity.HasComponent("AmmoPickup");
}
PlayerID Server::GetPlayerIDFromEndpoint()
PlayerID Server::getPlayerIDFromEndpoint()
{
// check both tcp and udp connection
for (auto& kv : m_ConnectedPlayers) {
@@ -647,4 +658,14 @@ PlayerID Server::GetPlayerIDFromEndpoint()
}
}
return -1;
}
}
PlayerID Server::getPlayerIDFromEntityID(EntityID entityID)
{
for(auto& kv : m_ConnectedPlayers) {
if (entityID == kv.second.EntityID) {
return kv.first;
}
}
return -1;
}
+40 -191
View File
@@ -1,222 +1,71 @@
#include "Rendering/AnimationSystem.h"
AnimationSystem::AnimationSystem(SystemParams params)
: System(params)
void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& animationComponent, double dt)
{
EVENT_SUBSCRIBE_MEMBER(m_EAutoAnimationBlend, &AnimationSystem::OnAutoAnimationBlend);
}
void AnimationSystem::Update(double dt)
{
UpdateAnimations(dt);
CreateBlendTrees();
UpdateWeights(dt);
for(auto& autoBlendQueue : m_AutoBlendQueues) {
autoBlendQueue.second.UpdateTime(dt);
}
}
void AnimationSystem::CreateBlendTrees()
{
auto modelComponents = m_World->GetComponents("Model");
if (modelComponents == nullptr) {
if(!entity.HasComponent("Model")) {
return;
}
for (auto& modelC : *modelComponents) {
EntityWrapper entity = EntityWrapper(m_World, modelC.EntityID);
Model* model;
try {
model = ResourceManager::Load<::Model, true>(entity["Model"]["Resource"]);
} catch (const std::exception&) {
continue;;
}
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
continue;
}
if (entity.HasComponent("Blend") || entity.HasComponent("BlendOverride") ||
entity.HasComponent("BlendAdditive") || entity.HasComponent("Animation"))
{
std::shared_ptr<BlendTree> blendTree = std::shared_ptr<BlendTree>(new BlendTree(entity, skeleton));
if(blendTree->IsValid()) {
skeleton->BlendTrees[entity] = blendTree;
}
}
Model* model;
try {
model = ResourceManager::Load<::Model, true>(entity["Model"]["Resource"]);
} catch (const std::exception&) {
return;
}
}
void AnimationSystem::UpdateAnimations(double dt)
{
auto animationComponents = m_World->GetComponents("Animation");
if(animationComponents == nullptr) {
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if(skeleton == nullptr) {
return;
}
for (auto& animationC : *animationComponents) {
EntityWrapper entity = EntityWrapper(m_World, animationC.EntityID);
EntityWrapper modelEntity;
if(!entity.HasComponent("Model")) {
modelEntity = entity.FirstParentWithComponent("Model");
} else {
modelEntity = entity;
}
Model* model;
try {
model = ResourceManager::Load<::Model, true>(modelEntity["Model"]["Resource"]);
} catch (const std::exception&) {
return;
}
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
return;
}
const Skeleton::Animation* animation = skeleton->GetAnimation(animationC["AnimationName"]);
for (int i = 1; i <= 3; i++) {
const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["AnimationName" + std::to_string(i)]);
if (animation == nullptr) {
continue;;
}
double animationSpeed = (double)animationC["Speed"];
double animationSpeed = (double)animationComponent["Speed" + std::to_string(i)];
if((bool)animationC["Reverse"]) {
animationSpeed *= -1;
}
if (animationSpeed != 0.0) {
double nextTime = (double)animationComponent["Time" + std::to_string(i)] + animationSpeed * dt;
if ((bool)animationC["Play"]) {
double nextTime = (double)animationC["Time"] + animationSpeed * dt;
if (!(bool)animationC["Loop"]) {
if (!(bool)animationComponent["Loop" + std::to_string(i)]) {
if (nextTime > animation->Duration) {
nextTime = animation->Duration;
(bool&)animationC["Play"] = false;
Events::AnimationComplete e;
e.Entity = entity;
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
m_EventBroker->Publish(e);
} else if (nextTime < 0) {
Events::AnimationComplete e;
e.Entity = entity;
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
m_EventBroker->Publish(e);
nextTime = 0;
(bool&)animationC["Play"] = false;
}
(double&)animationComponent["Speed" + std::to_string(i)] = 0.0;
} else {
if (nextTime > animation->Duration) {
while (nextTime > animation->Duration) {
nextTime -= animation->Duration;
}
Events::AnimationComplete e;
e.Entity = entity;
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
m_EventBroker->Publish(e);
nextTime -= animation->Duration;
} else if (nextTime < 0) {
while (nextTime < 0) {
nextTime += animation->Duration;
}
Events::AnimationComplete e;
e.Entity = entity;
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
m_EventBroker->Publish(e);
nextTime += animation->Duration;
}
}
(double&)animationC["Time"] = nextTime;
(double&)animationComponent["Time" + std::to_string(i)] = nextTime;
}
}
}
}
void AnimationSystem::UpdateWeights(double dt)
{
for (auto& autoBlendQueue : m_AutoBlendQueues) {
if(autoBlendQueue.second.HasActiveBlendJob()) {
AutoBlendQueue::AutoBlendJob& blendJob = autoBlendQueue.second.GetActiveBlendJob();
std::shared_ptr<BlendTree> blendTree = autoBlendQueue.second.GetBlendTree();
if (blendTree != nullptr) {
if (blendJob.Duration != 0.0) {
blendJob.BlendInfo.progress = glm::clamp(blendJob.CurrentTime / blendJob.Duration, 0.0, 1.0);
} else {
blendJob.BlendInfo.progress = 1.0;
}
blendJob.BlendInfo = blendTree->AutoBlendStep(blendJob.BlendInfo);
}
}
}
}
bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
{
if (!e.RootNode.Valid()) {
return false;
}
if (!e.RootNode.HasComponent("Model")) {
return false;
}
Model* model;
try {
model = ResourceManager::Load<::Model, true>((std::string)e.RootNode["Model"]["Resource"]);
} catch (const std::exception&) {
return false;
}
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
return false;
}
std::shared_ptr<BlendTree> blendTree;
if (skeleton->BlendTrees.find(e.RootNode) != skeleton->BlendTrees.end()) {
blendTree = skeleton->BlendTrees.at(e.RootNode);
} else {
return false;
}
EntityWrapper subTreeRoot = blendTree->GetSubTreeRoot(e.NodeName);
if (!subTreeRoot.Valid()) {
return false;
}
AutoBlendQueue::AutoBlendJob abj;
abj.AnimationEntity = e.AnimationEntity;
abj.CurrentTime = 0.0;
abj.Delay = e.Delay;
abj.Duration = e.Duration;
abj.RootNode = e.RootNode;
abj.BlendInfo.NodeName = e.NodeName;
abj.BlendInfo.progress = 0.0;
abj.BlendInfo.Start = e.Start;
abj.BlendInfo.SingleBlend = e.SingleLevelBlend;
EntityWrapper nodeEntity = subTreeRoot.FirstChildByName(e.NodeName); // more than one
if (nodeEntity.Valid()) {
if (nodeEntity.HasComponent("Animation")) {
const Skeleton::Animation* animation = skeleton->GetAnimation(nodeEntity["Animation"]["AnimationName"]);
(bool&)nodeEntity["Animation"]["Reverse"] = e.Reverse;
if (e.Restart) {
if (animation != nullptr) {
if (e.Restart) {
if (e.Reverse) {
(double&)nodeEntity["Animation"]["Time"] = animation->Duration;
} else {
(double&)nodeEntity["Animation"]["Time"] = 0.0;
}
}
}
}
}
}
m_AutoBlendQueues[subTreeRoot].Insert(abj);
return true;
}
-195
View File
@@ -1,195 +0,0 @@
#include "Rendering/AutoBlendQueue.h"
void AutoBlendQueue::Insert(AutoBlendJob autoBlendJob)
{
if(!autoBlendJob.RootNode.HasComponent("Model")) {
return;
}
AutoblendNode blendNode;
blendNode.BlendJob = autoBlendJob;
blendNode.StartTime = autoBlendJob.Delay;
blendNode.EndTime = autoBlendJob.Delay + autoBlendJob.Duration;
if (autoBlendJob.AnimationEntity.Valid()) {
if (autoBlendJob.AnimationEntity.HasComponent("Animation")) {
Model* model;
try {
model = ResourceManager::Load<::Model, true>((std::string)autoBlendJob.RootNode["Model"]["Resource"]);
} catch (const std::exception&) {
return;
}
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
return;
}
const Skeleton::Animation* animation = skeleton->GetAnimation((std::string)autoBlendJob.AnimationEntity["Animation"]["AnimationName"]);
if (animation == nullptr) {
return;
}
double AnimationDuration = 0.0;
double animationSpeed = (double)autoBlendJob.AnimationEntity["Animation"]["Speed"];
double animationTime = (double)autoBlendJob.AnimationEntity["Animation"]["Time"];
if ((bool)autoBlendJob.AnimationEntity["Animation"]["Reverse"]) {
AnimationDuration = (animation->Duration * animationSpeed) - (animation->Duration - animationTime);
} else {
AnimationDuration = (animation->Duration * animationSpeed) - animationTime;
}
blendNode.StartTime += AnimationDuration;
blendNode.EndTime += AnimationDuration;
if (m_BlendQueue.size() == 0) {
m_BlendQueue.push_back(blendNode);
} else {
for (auto it = m_BlendQueue.begin(); it != m_BlendQueue.end(); it++) {
auto next = std::next(it, 1);
if (it->BlendJob.BlendInfo.NodeName == autoBlendJob.BlendInfo.NodeName) {
(*it) = blendNode;
}
if (next != m_BlendQueue.end()) {
if (it->StartTime >= blendNode.StartTime && next->StartTime <= blendNode.StartTime) {
m_BlendQueue.insert(next, blendNode);
return;
}
} else if(it->StartTime > blendNode.StartTime){
m_BlendQueue.push_front(blendNode);
return;
} else if (it->StartTime <= blendNode.StartTime) {
m_BlendQueue.push_back(blendNode);
return;
}
}
}
}
}
m_BlendQueue.clear();
m_BlendQueue.push_back(blendNode);
}
void AutoBlendQueue::UpdateTime(double dt)
{
for (auto it = m_BlendQueue.begin(); it != m_BlendQueue.end();) {
if (it->EndTime <= 0) {
it = m_BlendQueue.erase(it);
} else {
it->EndTime -= dt;
it->StartTime -= dt;
it++;
}
}
}
void AutoBlendQueue::PrintQueue()
{
for (auto it = m_BlendQueue.begin(); it != m_BlendQueue.end(); it++) {
LOG_INFO("Start: %f End: %f \t %s", it->StartTime, it->EndTime, it->BlendJob.BlendInfo.NodeName.c_str());
}
}
bool AutoBlendQueue::HasActiveBlendJob()
{
if(m_BlendQueue.empty()) {
return false;
} else {
AutoblendNode blendNode = m_BlendQueue.front();
if (blendNode.StartTime <= 0) {
AutoBlendJob blendJob = blendNode.BlendJob;
if (!blendJob.RootNode.Valid()) {
m_BlendQueue.pop_front();
return false;
}
if (!blendJob.RootNode.HasComponent("Model")) {
m_BlendQueue.pop_front();
return HasActiveBlendJob();
}
Model* model;
try {
model = ResourceManager::Load<::Model, true>(blendJob.RootNode["Model"]["Resource"]);
} catch (const std::exception&) {
m_BlendQueue.pop_front();
return HasActiveBlendJob();
}
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
m_BlendQueue.pop_front();
return HasActiveBlendJob();
}
if (skeleton->BlendTrees.find(blendJob.RootNode) != skeleton->BlendTrees.end()) {
return true;
} else {
m_BlendQueue.pop_front();
return HasActiveBlendJob();
}
} else {
return false;
}
}
}
std::shared_ptr<BlendTree> AutoBlendQueue::GetBlendTree()
{
AutoblendNode blendNode = m_BlendQueue.front();
AutoBlendJob blendJob = blendNode.BlendJob;
if (!blendJob.RootNode.Valid()) {
m_BlendQueue.pop_front();
return false;
}
if (!blendJob.RootNode.HasComponent("Model")) {
return nullptr;
}
Model* model;
try {
model = ResourceManager::Load<::Model, true>(blendJob.RootNode["Model"]["Resource"]);
} catch (const std::exception&) {
return nullptr;
}
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
return nullptr;
}
if (skeleton->BlendTrees.find(blendJob.RootNode) != skeleton->BlendTrees.end()) {
return skeleton->BlendTrees.at(blendJob.RootNode);
} else {
return nullptr;
}
}
AutoBlendQueue::AutoBlendJob& AutoBlendQueue::GetActiveBlendJob()
{
AutoblendNode& blendNode = m_BlendQueue.front();
blendNode.BlendJob.CurrentTime = -blendNode.StartTime;
return blendNode.BlendJob;
}
-483
View File
@@ -1,483 +0,0 @@
#include "Rendering/BlendTree.h"
BlendTree::BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton)
{
m_Skeleton = skeleton;
if (ModelEntity.HasComponent("Animation")) {
const Skeleton::Animation* animation = skeleton->GetAnimation(ModelEntity["Animation"]["AnimationName"]);
if (animation == nullptr) {
return;
}
m_Root = new Node();
m_Root->Entity = ModelEntity;
m_Root->Name = ModelEntity.Name();
m_Root->Pose = m_Skeleton->GetFrameBones(animation, (double)ModelEntity["Animation"]["Time"], (bool)ModelEntity["Animation"]["Additive"]);
m_Root->Parent = nullptr;
m_Root->Type = NodeType::Animation;
} else if (ModelEntity.HasComponent("Blend")) {
m_Root = new Node();
m_Root->Entity = ModelEntity;
m_Root->Name = ModelEntity.Name();
m_Root->Parent = nullptr;
m_Root->Type = NodeType::Blend;
m_Root->Weight = (double)ModelEntity["Blend"]["Weight"];
m_Root->SubTreeRoot = (bool)ModelEntity["Blend"]["SubTreeRoot"];
(double&)ModelEntity["Blend"]["Weight"] = glm::clamp((double)ModelEntity["Blend"]["Weight"], 0.0, 1.0);
m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose1"], ModelEntity);
m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["Blend"]["Pose2"], ModelEntity);
} else if (ModelEntity.HasComponent("BlendOverride")) {
m_Root = new Node();
m_Root->Entity = ModelEntity;
m_Root->Name = ModelEntity.Name();
m_Root->Parent = nullptr;
m_Root->Type = NodeType::Override;
m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendOverride"]["Master"], ModelEntity);
m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendOverride"]["Slave"], ModelEntity);
} else if (ModelEntity.HasComponent("BlendAdditive")) {
m_Root = new Node();
m_Root->Entity = ModelEntity;
m_Root->Name = ModelEntity.Name();
m_Root->Parent = nullptr;
m_Root->Type = NodeType::Additive;
m_Root->Child[0] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendAdditive"]["Adder"], ModelEntity);
m_Root->Child[1] = FillTreeByName(m_Root, (std::string)ModelEntity["BlendAdditive"]["Receiver"], ModelEntity);
}
m_FinalPose = AccumulateFinalPose();
// PrintTree();
}
BlendTree::~BlendTree()
{
Node* currentNode = m_Root;
if (currentNode != nullptr) {
while (currentNode->Child[0] != nullptr) {
currentNode = currentNode->Child[0];
}
std::list<Node*> m_NodesToRemove;
while (currentNode != nullptr) {
m_NodesToRemove.push_back(currentNode);
currentNode = currentNode->Next();
}
for (auto it = m_NodesToRemove.begin(); it != m_NodesToRemove.end(); it++) {
delete (*it);
}
}
}
glm::mat4 BlendTree::GetBoneTransform(int boneID)
{
if(m_FinalBoneTransforms.find(boneID) != m_FinalBoneTransforms.end()) {
return m_FinalBoneTransforms.at(boneID);
} else {
return glm::mat4(1);
}
}
void BlendTree::PrintTree()
{
Node* currentNode = m_Root;
LOG_INFO("\n\n");
while(currentNode->Child[0] != nullptr) {
currentNode = currentNode->Child[0];
}
while (currentNode != nullptr)
{
LOG_INFO("%s", currentNode->Name.c_str());
currentNode = currentNode->Next();
}
}
BlendTree::Node* BlendTree::FillTreeByName(Node* parentNode, std::string name, EntityWrapper parentEntity)
{
EntityWrapper childEntity = parentEntity.FirstLevelChildByName(name); // Make first level child by name
if (!childEntity.Valid()) {
return nullptr;
}
if (childEntity.HasComponent("Animation")) {
const Skeleton::Animation* animation = m_Skeleton->GetAnimation(childEntity["Animation"]["AnimationName"]);
if (animation == nullptr) {
return nullptr;
}
Node* node = new Node();
node->Entity = childEntity;
node->Name = childEntity.Name();
node->Pose = m_Skeleton->GetFrameBones(animation, (double)childEntity["Animation"]["Time"], (bool)childEntity["Animation"]["Additive"]);
node->Parent = parentNode;
node->Type = NodeType::Animation;
return node;
} else if (childEntity.HasComponent("Blend")) {
Node* node = new Node();
node->Entity = childEntity;
node->Name = childEntity.Name();
node->Parent = parentNode;
node->Type = NodeType::Blend;
(double&)childEntity["Blend"]["Weight"] = glm::clamp((double)childEntity["Blend"]["Weight"], 0.0, 1.0);
node->Weight = (double)childEntity["Blend"]["Weight"];
node->SubTreeRoot = (bool)childEntity["Blend"]["SubTreeRoot"];
//if (node->Weight < 1.f && node->Weight > 0.f) {
node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity);
node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity);
/* } else if (node->Weight == 1.f) {
node->Child[0] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose1"], childEntity);
} else if (node->Weight == 0.f) {
node->Child[1] = FillTreeByName(node, (std::string)childEntity["Blend"]["Pose2"], childEntity);
}*/
if(node->Child[0] == nullptr && node->Child[1] == nullptr) {
return nullptr;
} else {
return node;
}
} else if (childEntity.HasComponent("BlendOverride")) {
Node* node = new Node();
node->Entity = childEntity;
node->Name = childEntity.Name();
node->Parent = parentNode;
node->Type = NodeType::Override;
node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Master"], childEntity);
node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendOverride"]["Slave"], childEntity);
if (node->Child[0] == nullptr && node->Child[1] == nullptr) {
return nullptr;
} else {
return node;
}
} else if (childEntity.HasComponent("BlendAdditive")) {
Node* node = new Node();
node->Entity = childEntity;
node->Name = childEntity.Name();
node->Parent = parentNode;
node->Type = NodeType::Additive;
node->Child[0] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Adder"], childEntity);
node->Child[1] = FillTreeByName(node, (std::string)childEntity["BlendAdditive"]["Receiver"], childEntity);
if(node->Child[0] == nullptr && node->Child[1] == nullptr) {
return nullptr;
} else {
return node;
}
}
return nullptr;
}
std::vector<BlendTree::Node*> BlendTree::FindNodesByName(std::string name)
{
std::vector<Node*> Nodes;
Node* currentNode = m_Root;
while (currentNode->Child[0] != nullptr) {
currentNode = currentNode->Child[0];
}
while (currentNode != nullptr) {
if(currentNode->Name == name) {
Nodes.push_back(currentNode);
}
currentNode = currentNode->Next();
}
return Nodes;
}
BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo)
{
std::vector<Node*> goalNodes = FindNodesByName(blendInfo.NodeName);
if (blendInfo.Start) {
for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) {
EntityWrapper entity = (*it)->Entity;
if (entity.Valid()) {
if (entity.HasComponent("Animation")) {
(bool&)entity["Animation"]["Play"] = true;
}
}
}
}
if(goalNodes.size() == 0) {
return blendInfo;
} else if(goalNodes.size() == 1) {
Node* currentNode = goalNodes[0]->Parent;
Node* lastNode = goalNodes[0];
while (currentNode != nullptr)
{
if(!currentNode->Entity.HasComponent("Blend")) {
return blendInfo;
}
double startWeight;
if(blendInfo.StartWeights.find(currentNode->Entity) != blendInfo.StartWeights.end()) {
startWeight = blendInfo.StartWeights.at(currentNode->Entity);
} else {
startWeight = currentNode->Weight;
blendInfo.StartWeights[currentNode->Entity] = startWeight;
}
double goalWeight;
if(currentNode->Child[0] == lastNode) {
goalWeight = 0.0;
} else if (currentNode->Child[1] == lastNode) {
goalWeight = 1.0;
}
double weight = ((goalWeight - startWeight) * blendInfo.progress) + startWeight;
(double&)currentNode->Entity["Blend"]["Weight"] = weight;
currentNode->Weight = weight;
lastNode = currentNode;
currentNode = currentNode->Parent;
if (blendInfo.SingleBlend) {
break;
}
}
} else if(goalNodes.size() >= 2) {
std::vector<Node*> sharedParents;
std::vector<Node*> nodes = goalNodes;
for (auto it = nodes.begin(); it != nodes.end(); it++) {
auto next = std::next(it, 1);
if (next != nodes.end()) {
Node* commonParent = FirstCommonParent((*it), (*next));
sharedParents.push_back(commonParent);
(*next) = commonParent;
nodes.erase(it);
it = nodes.begin();
}
}
for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) {
Node* currentNode = (*it)->Parent;
Node* lastNode = (*it);
while (currentNode != nullptr) {
if (!currentNode->Entity.HasComponent("Blend")) {
return blendInfo;
}
bool ShouldBreak = false;
for (auto it = sharedParents.begin(); it != sharedParents.end(); it++) {
if(currentNode == (*it)) {
ShouldBreak = true;
}
}
if(ShouldBreak) {
break;
}
double startWeight;
if (blendInfo.StartWeights.find(currentNode->Entity) != blendInfo.StartWeights.end()) {
startWeight = blendInfo.StartWeights.at(currentNode->Entity);
} else {
startWeight = currentNode->Weight;
blendInfo.StartWeights[currentNode->Entity] = startWeight;
}
double goalWeight;
if (currentNode->Child[0] == lastNode) {
goalWeight = 0.0;
} else if (currentNode->Child[1] == lastNode) {
goalWeight = 1.0;
}
double weight = ((goalWeight - startWeight) * blendInfo.progress) + startWeight;
(double&)currentNode->Entity["Blend"]["Weight"] = weight;
currentNode->Weight = weight;
lastNode = currentNode;
currentNode = currentNode->Parent;
}
}
}
return blendInfo;
}
BlendTree::Node* BlendTree::GetCommonParent(std::string NodeName1, std::string NodeName2)
{
std::vector<Node*> nodes1 = FindNodesByName(NodeName1);
std::vector<Node*> nodes2 = FindNodesByName(NodeName2);
for (auto it = nodes1.begin(); it != nodes1.end(); it++) {
auto next = std::next(it, 1);
if(next != nodes1.end()) {
Node* commonParent = FirstCommonParent((*it), (*next));
(*next) = commonParent;
nodes1.erase(it);
it = nodes1.begin();
}
}
for (auto it = nodes2.begin(); it != nodes2.end(); it++) {
auto next = std::next(it, 1);
if (next != nodes2.end()) {
Node* commonParent = FirstCommonParent((*it), (*next));
(*next) = commonParent;
nodes2.erase(it);
it = nodes2.begin();
}
}
return FirstCommonParent(nodes1.front(), nodes2.front());;
}
BlendTree::Node* BlendTree::FirstCommonParent(Node* node1, Node* node2)
{
std::list<Node*> node1Parents;
Node* currentNode = node1;
while (currentNode != nullptr) {
node1Parents.push_back(currentNode);
currentNode = currentNode->Parent;
}
currentNode = node2;
while (currentNode != nullptr) {
for (auto it = node1Parents.begin(); it != node1Parents.end(); it++) {
if (currentNode == (*it)) {
return currentNode;
}
}
currentNode = currentNode->Parent;
}
return nullptr;
}
EntityWrapper BlendTree::GetSubTreeRoot(std::string nodeName)
{
std::vector<Node*> nodes = FindNodesByName(nodeName);
if (nodes.size() == 0) {
return EntityWrapper::Invalid;
}
std::vector<Node*> subTreeRoots;
for (auto it = nodes.begin(); it != nodes.end(); it++) {
Node* currentNode = (*it)->Parent;
while (!currentNode->SubTreeRoot) {
currentNode = currentNode->Parent;
}
subTreeRoots.push_back(currentNode);
}
for (auto it = subTreeRoots.begin(); it != subTreeRoots.end(); it++) {
auto next = std::next(it, 1);
if (next != subTreeRoots.end()) {
Node* commonParent = FirstCommonParent((*it), (*next));
(*next) = commonParent;
subTreeRoots.erase(it);
it = subTreeRoots.begin();
}
}
return subTreeRoots.front()->Entity;
}
void BlendTree::Blend(std::map<int, Skeleton::PoseData>& pose)
{
Node* currentNode;
Node* start = m_Root;
while (start->Child[0] != nullptr) {
start = start->Child[0];
}
currentNode = start;
while (m_Root->Pose.size() == 0) {
if(currentNode->Pose.size() == 0) {
if (currentNode->Child[0] != nullptr && currentNode->Child[1] != nullptr) {
if (currentNode->Child[0]->Pose.size() != 0 && currentNode->Child[1]->Pose.size() != 0) {
switch (currentNode->Type) {
case BlendTree::NodeType::Additive:
currentNode->Pose = m_Skeleton->BlendPoseAdditive(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose);
break;
case BlendTree::NodeType::Blend:
currentNode->Pose = m_Skeleton->BlendPoses(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose, currentNode->Weight);
break;
case BlendTree::NodeType::Override:
currentNode->Pose = m_Skeleton->OverridePose(currentNode->Child[0]->Pose, currentNode->Child[1]->Pose);
break;
case BlendTree::NodeType::Animation:
// do nothing
break;
}
}
} else if (currentNode->Child[0] != nullptr) {
if (currentNode->Child[0]->Pose.size() != 0) {
currentNode->Pose = currentNode->Child[0]->Pose;
}
} else if (currentNode->Child[1] != nullptr) {
if (currentNode->Child[1]->Pose.size() != 0) {
currentNode->Pose = currentNode->Child[1]->Pose;
}
}
}
currentNode = currentNode->Next();
if (currentNode == nullptr) {
currentNode = start;
}
}
pose = m_Root->Pose;
}
std::vector<glm::mat4> BlendTree::AccumulateFinalPose()
{
std::vector<glm::mat4> finalPose;
if (m_Skeleton == nullptr || m_Root == nullptr || (m_Root->Child[0] == nullptr && m_Root->Child[1] == nullptr)) {
for (int i = 0; i < m_Skeleton->Bones.size(); i++) {
finalPose.push_back(glm::mat4(1));
}
return finalPose;
}
std::map<int, Skeleton::PoseData> pose;
Blend(pose);
m_Skeleton->GetFinalPose(pose, finalPose, m_FinalBoneTransforms);
return finalPose;
}
+59 -25
View File
@@ -8,13 +8,10 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
return;
}
auto parent = entity.FirstParentWithComponent("Model");
if(!parent.Valid()) {
auto parent = entity.FirstParentWithComponent("Animation");
if (!parent.HasComponent("Model")) {
return;
}
Model* model;
try {
model = ResourceManager::Load<::Model, true>(parent["Model"]["Resource"]);
@@ -38,29 +35,66 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
return;
}
if (skeleton->BlendTrees.find(parent) != skeleton->BlendTrees.end()) {
std::vector<::Skeleton::AnimationData> Animations;
::Skeleton::AnimationOffset AnimationOffset;
glm::mat4 boneTransform;
if (parent.HasComponent("Animation")) {
for (int i = 1; i <= 3; i++) {
::Skeleton::AnimationData animationData;
animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["Animation"]["AnimationName" + std::to_string(i)]);
if (animationData.animation == nullptr) {
continue;
}
animationData.time = (double)parent["Animation"]["Time" + std::to_string(i)];
animationData.weight = (double)parent["Animation"]["Weight" + std::to_string(i)];
glm::mat4 boneTransform = skeleton->BlendTrees.at(parent)->GetBoneTransform(id);
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 = glm::vec3(-glm::pitch(rotation), -glm::yaw(rotation), -glm::roll(rotation));
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"];
Animations.push_back(animationData);
}
}
if (parent.HasComponent("AnimationOffset")) {
AnimationOffset.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["AnimationOffset"]["AnimationName"]);
AnimationOffset.time = (double)parent["AnimationOffset"]["Time"];
if(AnimationOffset.animation != nullptr) {
boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, AnimationOffset, glm::mat4(1));
} else {
boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, glm::mat4(1));
}
} else {
boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, 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 = glm::vec3(-glm::pitch(rotation), -glm::yaw(rotation), -glm::roll(rotation));
/*
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"];
}
}
-2
View File
@@ -45,7 +45,6 @@ void DrawBloomPass::InitializeShaderPrograms()
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_horiz.vert.glsl")));
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl")));
m_GaussianProgram_horiz->Compile();
m_GaussianProgram_horiz->BindFragDataLocation(0, "fragmentColor");
m_GaussianProgram_horiz->Link();
}
@@ -54,7 +53,6 @@ void DrawBloomPass::InitializeShaderPrograms()
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_vert.vert.glsl")));
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_vert.frag.glsl")));
m_GaussianProgram_vert->Compile();
m_GaussianProgram_vert->BindFragDataLocation(0, "fragmentColor");
m_GaussianProgram_vert->Link();
}
}
+130 -124
View File
@@ -350,28 +350,27 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
case RawModel::MaterialType::Basic:
case RawModel::MaterialType::SingleTextures:
{
if (explosionEffectJob->Model->IsSkinned()) {
if (explosionEffectJob->Model->IsSkinned()) {
m_ExplosionEffectSkinnedProgram->Bind();
GLERROR("Bind ExplosionEffectSkinned program");
//bind uniforms
BindExplosionUniforms(explosionSkinnedHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(explosionSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
m_ExplosionEffectSkinnedProgram->Bind();
GLERROR("Bind ExplosionEffectSkinned program");
//bind uniforms
BindExplosionUniforms(explosionSkinnedHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(explosionSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->BlendTree != nullptr) {
frameBones = explosionEffectJob->BlendTree->GetFinalPose();
} else {
frameBones = explosionEffectJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "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(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ExplosionEffectProgram->Bind();
GLERROR("Bind ExplosionEffect program");
@@ -387,23 +386,23 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
}
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->BlendTree != nullptr) {
frameBones = explosionEffectJob->BlendTree->GetFinalPose();
} else {
frameBones = explosionEffectJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
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");
@@ -444,15 +443,17 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(forwardSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "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(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ForwardPlusProgram->Bind();
GLERROR("Bind ForwardPlusProgram");
@@ -476,13 +477,14 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
//bind textures
BindModelTextures(forwardSplatMapSkinnedHandle, modelJob);
GLERROR("asdasd");
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "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(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
@@ -559,14 +561,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->BlendTree != nullptr) {
frameBones = explosionEffectJob->BlendTree->GetFinalPose();
} else {
frameBones = explosionEffectJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "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(explosionSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ExplosionEffectShieldCheckProgram->Bind();
@@ -592,14 +594,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
//bind textures
BindExplosionTextures(explosionSplatMapSkinnedShieldCheckHandle, explosionEffectJob);
GLERROR("asdasd");
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->BlendTree != nullptr) {
frameBones = explosionEffectJob->BlendTree->GetFinalPose();
} else {
frameBones = explosionEffectJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedShieldCheckHandle, "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(explosionSplatMapSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
@@ -632,14 +634,15 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(explosionSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->BlendTree != nullptr) {
frameBones = explosionEffectJob->BlendTree->GetFinalPose();
} else {
frameBones = explosionEffectJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "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(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ExplosionEffectProgram->Bind();
GLERROR("Bind ExplosionEffect program");
@@ -663,14 +666,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
//bind textures
BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob);
GLERROR("asdasd");
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->BlendTree != nullptr) {
frameBones = explosionEffectJob->BlendTree->GetFinalPose();
} else {
frameBones = explosionEffectJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "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(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ExplosionEffectSplatMapProgram->Bind();
@@ -715,13 +718,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "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(forwardSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
@@ -747,14 +751,15 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
//bind textures
BindModelTextures(forwardSplatMapSkinnedShieldCheckHandle, 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(forwardSplatMapSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ForwardPlusSplatMapShieldCheckProgram->Bind();
@@ -784,13 +789,14 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(forwardSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "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(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
@@ -816,14 +822,15 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
//bind textures
BindModelTextures(forwardSplatMapSkinnedHandle, modelJob);
GLERROR("asdasd");
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "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(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ForwardPlusSplatMapProgram->Bind();
@@ -882,10 +889,10 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
}
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->BlendTree != nullptr) {
frameBones = explosionEffectJob->BlendTree->GetFinalPose();
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
} else {
frameBones = explosionEffectJob->Skeleton->GetTPose();
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
@@ -921,12 +928,11 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
BindModelTextures(forwardHandle ,modelJob);
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
} else {
frameBones = modelJob->Skeleton->GetTPose();
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
@@ -958,10 +964,10 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
} else {
frameBones = modelJob->Skeleton->GetTPose();
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
+26 -18
View File
@@ -104,15 +104,16 @@ void PickingPass::Draw(RenderScene& scene)
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])));
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else {
frameBones = modelJob->Skeleton->GetTPose();
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]));
}
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));
@@ -161,11 +162,13 @@ void PickingPass::Draw(RenderScene& scene)
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->BlendTree != nullptr) {
std::vector<glm::mat4> frameBones;
frameBones = modelJob->BlendTree->GetFinalPose();
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "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));
@@ -215,12 +218,11 @@ void PickingPass::Draw(RenderScene& scene)
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
} else {
frameBones = modelJob->Skeleton->GetTPose();
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
} else {
@@ -320,10 +322,16 @@ void PickingPass::Draw(RenderScene& scene)
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->BlendTree != nullptr) {
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
std::vector<glm::mat4> frameBones;
frameBones = modelJob->BlendTree->GetFinalPose();
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();
-4
View File
@@ -56,7 +56,6 @@ void SSAOPass::InitializeShaderProgram()
m_SSAOProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/SSAO.vert.glsl")));
m_SSAOProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/SSAO.frag.glsl")));
m_SSAOProgram->Compile();
m_SSAOProgram->BindFragDataLocation(0, "AO");
m_SSAOProgram->Link();
}
@@ -65,7 +64,6 @@ void SSAOPass::InitializeShaderProgram()
m_SSAOViewSpaceZProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/SSAO.vert.glsl")));
m_SSAOViewSpaceZProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/SSAOViewSpaceZ.frag.glsl")));
m_SSAOViewSpaceZProgram->Compile();
m_SSAOViewSpaceZProgram->BindFragDataLocation(0, "depthLinear");
m_SSAOViewSpaceZProgram->Link();
}
@@ -74,7 +72,6 @@ void SSAOPass::InitializeShaderProgram()
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_horiz.vert.glsl")));
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl")));
m_GaussianProgram_horiz->Compile();
m_GaussianProgram_horiz->BindFragDataLocation(0, "fragmentColor");
m_GaussianProgram_horiz->Link();
}
@@ -83,7 +80,6 @@ void SSAOPass::InitializeShaderProgram()
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_vert.vert.glsl")));
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_vert.frag.glsl")));
m_GaussianProgram_vert->Compile();
m_GaussianProgram_vert->BindFragDataLocation(0, "fragmentColor");
m_GaussianProgram_vert->Link();
}
}
+634 -228
View File
@@ -1,117 +1,339 @@
#include "Rendering/Skeleton.h"
std::map<int, Skeleton::PoseData> Skeleton::GetFrameBones(const Animation* animation, double time, bool additive, bool noRootMotion /*= false*/)
int Skeleton::CreateBone(int ID, int parentID, std::string name, glm::mat4 offsetMatrix)
{
if (animation == nullptr) {
std::map<int, PoseData> finalMatrices;
if (m_BonesByName.find(name) != m_BonesByName.end()) {
return m_BonesByName.at(name)->ID;
} else {
Bone* bone;
if (parentID == -1) {
bone = new Bone(ID, nullptr, name, offsetMatrix);
RootBone = bone;
} else {
Bone* parent = Bones[parentID];
bone = new Bone(ID, parent, name, offsetMatrix);
parent->Children.push_back(bone);
}
Bones[ID] = bone;
m_BonesByName[name] = bone;
return ID;
}
}
Skeleton::~Skeleton()
{
for (auto &kv : Bones) {
delete kv.second;
}
}
const Skeleton::Animation* Skeleton::GetAnimation(std::string name)
{
auto it = Animations.find(name);
if (it != Animations.end()) {
return const_cast<const Animation*>(&it->second);
} else {
return nullptr;
}
}
std::vector<glm::mat4> Skeleton::GetFrameBones(std::vector<AnimationData> animations, bool noRootMotion /*= false*/)
{
if (animations.size() <= 0) {
std::vector<glm::mat4> finalMatrices;
for (auto& b : Bones) {
PoseData poseData;
poseData.Translation = glm::vec3(0);
poseData.Orientation = glm::quat();
poseData.Scale = glm::vec3(1);
finalMatrices[b.second->ID] = poseData;
finalMatrices.push_back(glm::mat4(1));//b.second->OffsetMatrix);
}
return finalMatrices;
}
std::map<int, glm::mat4> frameBones;
AccumulateBoneTransforms(true, animations, frameBones, RootBone, glm::mat4(1));
std::map<int, PoseData> frameBones;
if(!additive) {
AccumulateBoneTransforms(true, animation, time, frameBones, RootBone);
} else {
AdditiveBoneTransforms(animation, time, frameBones, RootBone);
std::vector<glm::mat4> finalMatrices;
for (auto &kv : frameBones) {
finalMatrices.push_back(kv.second);
}
return frameBones;
return finalMatrices;
}
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, double time, std::map<int, PoseData>& boneMatrices, const Bone* bone)
std::vector<glm::mat4> Skeleton::GetFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion /*= false*/)
{
PoseData poseData;
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) {
nextFrame = currentFrame;
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
} else {
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
}
progress = glm::clamp(progress, 0.0f, 1.0f);
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
glm::vec3 position = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
glm::quat rotation = glm::normalize(glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress));
glm::vec3 scale = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
// Flag for no root motion
if (bone == RootBone && noRootMotion) {
position.x = 0;
position.z = 0;
}
poseData.Translation = position;
poseData.Orientation = rotation;
poseData.Scale = scale;
boneMatrices[bone->ID] = poseData;
} else { // 1 keyframes for the current bone
currentFrame = boneKeyFrames.at(0);
poseData.Translation = currentFrame.BoneProperties.Position;
poseData.Orientation = currentFrame.BoneProperties.Rotation;
poseData.Scale = currentFrame.BoneProperties.Scale;
boneMatrices[bone->ID] = poseData;
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, 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) {
nextFrame = currentFrame;
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
} else {
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
}
if (progress > 1.0f || progress < 0.0f) {
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, animation, time, boneMatrices, child);
AccumulateBoneTransforms(noRootMotion, animations, boneMatrices, child, boneMatrix);
}
}
void Skeleton::AdditiveBoneTransforms(const Animation* animation, double time, std::map<int, PoseData>& boneMatrices, const Bone* bone)
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix)
{
if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
PoseData refPose = GetAdditiveBonePose(bone, animation, 0.0);
PoseData srcPose = GetAdditiveBonePose(bone, animation, time + 1.0/60.0);
PoseData finalPose;
finalPose.Translation = srcPose.Translation - refPose.Translation;
finalPose.Orientation = srcPose.Orientation * glm::inverse(refPose.Orientation);
finalPose.Scale = srcPose.Scale - refPose.Scale;
glm::mat4 boneMatrix;
boneMatrices[bone->ID] = finalPose;
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) {
nextFrame = currentFrame;
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
} else {
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
}
if (progress > 1.0f || progress < 0.0f) {
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) {
AdditiveBoneTransforms(animation, time, boneMatrices, child);
AccumulateBoneTransforms(noRootMotion, animations, animationOffset, boneMatrices, child, boneMatrix);
}
}
Skeleton::PoseData Skeleton::GetAdditiveBonePose(const Bone* bone, const Animation* animation, double time)
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);
@@ -138,6 +360,7 @@ Skeleton::PoseData Skeleton::GetAdditiveBonePose(const Bone* bone, const Animati
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
} else {
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
}
progress = glm::clamp(progress, 0.0f, 1.0f);
@@ -158,130 +381,308 @@ Skeleton::PoseData Skeleton::GetAdditiveBonePose(const Bone* bone, const Animati
}
}
PoseData finalPose;
finalPose.Translation = position;
finalPose.Orientation = rotation;
finalPose.Scale = scale;
return finalPose;
}
std::map<int, Skeleton::PoseData> Skeleton::BlendPoses(const std::map<int, PoseData>& pose1, const std::map<int, PoseData>& pose2, double weight)
{
std::map<int, PoseData> finalPose;
float weight1 = (float)(1.0 - weight);
float weight2 = (float)(weight);
for (auto& b : Bones) {
int boneID = b.second->ID;
PoseData blendedPose;
blendedPose.Translation = glm::vec3(0);
blendedPose.Orientation = glm::quat();
blendedPose.Scale = glm::vec3(1);
if(pose1.find(boneID) != pose1.end() && pose2.find(boneID) != pose2.end()) {
blendedPose.Translation = pose1.at(boneID).Translation * weight1 + pose2.at(boneID).Translation * weight2;
blendedPose.Orientation = glm::slerp(pose1.at(boneID).Orientation, pose2.at(boneID).Orientation, weight2);
blendedPose.Scale = pose1.at(boneID).Scale * weight1 + pose2.at(boneID).Scale * weight2;
finalPose[boneID] = blendedPose;
} else if(pose1.find(boneID) != pose1.end()) {
finalPose[boneID] = pose1.at(boneID);
} else if (pose2.find(boneID) != pose2.end()) {
finalPose[boneID] = pose2.at(boneID);
}
}
return finalPose;
}
std::map<int, Skeleton::PoseData> Skeleton::OverridePose(const std::map<int, PoseData>& overridePose, const std::map<int, PoseData>& targetPose)
{
std::map<int, PoseData> finalPose;
for (auto& b : Bones) {
int boneID = b.second->ID;
if (overridePose.find(boneID) != overridePose.end()) {
finalPose[boneID] = overridePose.at(boneID);
} else if (targetPose.find(boneID) != targetPose.end()) {
finalPose[boneID] = targetPose.at(boneID);
}
}
return finalPose;
}
std::map<int, Skeleton::PoseData> Skeleton::BlendPoseAdditive(const std::map<int, PoseData>& additivePose, const std::map<int, PoseData>& targetPose)
{
std::map<int, PoseData> finalPose;
for (auto& b : Bones) {
int boneID = b.second->ID;
PoseData blendedPose;
blendedPose.Translation = glm::vec3(0);
blendedPose.Orientation = glm::quat();
blendedPose.Scale = glm::vec3(1);
if (additivePose.find(boneID) != additivePose.end() && targetPose.find(boneID) != targetPose.end()) {
blendedPose.Translation = additivePose.at(boneID).Translation + targetPose.at(boneID).Translation;
blendedPose.Orientation = additivePose.at(boneID).Orientation * targetPose.at(boneID).Orientation;
blendedPose.Scale = additivePose.at(boneID).Scale + targetPose.at(boneID).Scale;
finalPose[boneID] = blendedPose;
} else if (additivePose.find(boneID) != additivePose.end()) {
finalPose[boneID] = additivePose.at(boneID);
} else if (targetPose.find(boneID) != targetPose.end()) {
finalPose[boneID] = targetPose.at(boneID);
}
}
return finalPose;
}
void Skeleton::GetFinalPose(std::map<int, Skeleton::PoseData>& poseDatas, std::vector<glm::mat4>& finalPose, std::map<int, glm::mat4>& boneTransforms)
{
std::map<int, glm::mat4> boneMatrices;
AccumulateFinalPose(boneMatrices, poseDatas, boneTransforms, RootBone, glm::mat4(1));
for(auto& b : boneMatrices) {
finalPose.push_back(b.second);
}
return (glm::translate(position) * glm::toMat4(rotation) * glm::scale(scale));
}
std::vector<glm::mat4> Skeleton::GetTPose()
{
std::vector<glm::mat4> finalMatrices;
for (auto b : Bones) {
finalMatrices.push_back(glm::mat4(1));
}
return finalMatrices;
}
void Skeleton::AccumulateFinalPose(std::map<int, glm::mat4>& boneMatrices, std::map<int, Skeleton::PoseData>& poseDatas, std::map<int, glm::mat4>& boneTransforms, const Bone* bone, glm::mat4 parentMatrix)
glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix)
{
glm::mat4 boneMatrix;
if (poseDatas.find(bone->ID) != poseDatas.end()) {
boneMatrix = parentMatrix * (glm::translate(poseDatas.at(bone->ID).Translation) * glm::mat4(poseDatas.at(bone->ID).Orientation) * glm::scale(poseDatas.at(bone->ID).Scale));
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
} else {
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) {
nextFrame = currentFrame;
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 = parentMatrix * (glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix);
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
boneMatrix = bone->Parent->OffsetMatrix * glm::inverse(bone->OffsetMatrix) * childMatrix;
} else {
boneMatrix = glm::inverse(bone->OffsetMatrix);
boneMatrices[bone->ID] = parentMatrix;
boneMatrix = glm::inverse(bone->OffsetMatrix) * childMatrix;
}
}
boneTransforms[bone->ID] = boneMatrix;
if (bone->Parent) {
return GetBoneTransform(bone->Parent, animation, time, boneMatrix);
} else {
return boneMatrix;
}
}
for (auto &child : bone->Children) {
AccumulateFinalPose(boneMatrices, poseDatas, boneTransforms, child, boneMatrix);
glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, AnimationOffset animationOffset, glm::mat4 childMatrix)
{
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) {
nextFrame = currentFrame;
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
} else {
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
}
if (progress > 1.0f || progress < 0.0f) {
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 = offset * childMatrix;// *((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix));
} else {
boneMatrix = ((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix)) * childMatrix;
}
} else {
boneMatrix = offset * glm::inverse(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);
}
}
if (offset != glm::mat4(1)) {
boneMatrix = ((glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) + offset) * childMatrix;
} else {
boneMatrix = (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) * childMatrix;
}
}
if (bone->Parent != nullptr) {
return GetBoneTransform(noRootMotion, bone->Parent, animations, animationOffset, boneMatrix);
} else {
return boneMatrix;
}
}
glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, glm::mat4 childMatrix)
{
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) {
nextFrame = currentFrame;
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
} else {
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
}
if (progress > 1.0f || progress < 0.0f) {
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 = glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix * childMatrix;
} else {
boneMatrix = glm::inverse(bone->OffsetMatrix) * childMatrix;
}
} else if (JointTransforms.size() == 1) {
boneMatrix = (glm::translate(JointTransforms.at(0).PositionInterp) * glm::toMat4(JointTransforms.at(0).RotationInterp) * glm::scale(JointTransforms.at(0).ScaleInterp)) * childMatrix;
} 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 = (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) * childMatrix;
}
if (bone->Parent != nullptr) {
return GetBoneTransform(noRootMotion, bone->Parent, animations, boneMatrix);
} else {
return boneMatrix;
}
}
@@ -294,41 +695,46 @@ int Skeleton::GetBoneID(std::string name)
}
}
int Skeleton::CreateBone(int ID, int parentID, std::string name, glm::mat4 offsetMatrix)
void Skeleton::PrintSkeleton()
{
if (m_BonesByName.find(name) != m_BonesByName.end()) {
return m_BonesByName.at(name)->ID;
} else {
Bone* bone;
if (parentID == -1) {
bone = new Bone(ID, nullptr, name, offsetMatrix);
RootBone = bone;
} else {
Bone* parent = Bones[parentID];
bone = new Bone(ID, parent, name, offsetMatrix);
parent->Children.push_back(bone);
}
Bones[ID] = bone;
m_BonesByName[name] = bone;
return ID;
}
if (LOG_LEVEL < LOG_LEVEL_DEBUG) {
return;
}
PrintSkeleton(RootBone, 0);
}
Skeleton::~Skeleton()
void Skeleton::PrintSkeleton(const Bone* bone, int depthCount)
{
for (auto &kv : Bones) {
delete kv.second;
}
std::stringstream ss;
ss << std::string(depthCount, ' ');
ss << bone->ID << ": " << bone->Name;
std::cout << ss.str() << std::endl;
depthCount++;
for (auto &child : bone->Children) {
PrintSkeleton(child, depthCount);
}
}
const Skeleton::Animation* Skeleton::GetAnimation(std::string name)
int Skeleton::GetKeyframe(const Animation& animation, double time)
{
auto it = Animations.find(name);
if (it != Animations.end()) {
return const_cast<const Animation*>(&it->second);
} else {
return nullptr;
}
}
/*
if (time < 0) {
time = 0;
}
if (time >= animation.Duration) {
return animation..size() - 1;
}
for (int keyframe = 0; keyframe < animation.Keyframes.size(); ++keyframe) {
if (animation.Keyframes[keyframe].Time > time) {
return (keyframe - 1) % animation.Keyframes.size();
}
}
*/
return 0;
}
+11 -10
View File
@@ -12,15 +12,7 @@ HealthSystem::HealthSystem(SystemParams params)
}
void HealthSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cHealth, double dt)
{
double& health = cHealth["Health"];
if (health <= 0.0) {
Events::PlayerDeath ePlayerDeath;
ePlayerDeath.Player = entity;
m_EventBroker->Publish(ePlayerDeath);
//Note: we will delete the entity in PlayerDeathSystem
}
}
{ }
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
{
@@ -35,7 +27,16 @@ bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
if (playerBoostDefenderEntity.Valid()) {
e.Damage -= (double)playerBoostDefenderEntity["BoostDefender"]["StrengthOfEffect"];
}
health -= e.Damage;
if (health > 0) {
health -= e.Damage;
if (health <= 0.0) {
Events::PlayerDeath ePlayerDeath;
ePlayerDeath.Player = e.Victim;
ePlayerDeath.Killer = e.Inflictor;
m_EventBroker->Publish(ePlayerDeath);
//Note: we will delete the entity in PlayerDeathSystem
}
}
return true;
}