This commit is contained in:
viktorljung
2016-02-02 14:52:31 +01:00
parent 6ba87d2942
commit dba2fbdc0c
11 changed files with 842 additions and 112 deletions
+4 -2
View File
@@ -9,6 +9,7 @@
#include "Rendering/Model.h"
#include "Rendering/EAnimationComplete.h"
#include "Rendering/Skeleton.h"
#include <imgui/imgui.h>
class AnimationSystem : public PureSystem
{
@@ -22,8 +23,9 @@ public:
~AnimationSystem() { }
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& animationComponent, double dt) override;
private:
float angle = 0.f;
bool b_forward = false;
char bone[100];
};
#endif
+1
View File
@@ -41,6 +41,7 @@ public:
std::string Name;
glm::mat4 OffsetMatrix;
glm::mat4 ModificationMatrix = glm::mat4(1);
int ID;
Bone* Parent;
+315 -79
View File
@@ -34,108 +34,344 @@
<Entity>
<Components>
<c:Animation>
<AnimationName>Run</AnimationName>
<Time>0.88759450484008484</Time>
<AnimationName>Crouch</AnimationName>
<Time>1.2451274133223826</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
<Resource>Models/AssaultAnimated.mesh</Resource>
<Resource>Models/Asstest.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0.200000003" Y="-1.245" Z="-2.08000016"/>
<Position X="0" Y="-1.245" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity>
<Components>
<c:PointLight>
<Color A="1" B="0.745098054" G="0.623529434" R="1"/>
<Radius>12</Radius>
<Falloff>0.29999995231628418</Falloff>
</c:PointLight>
<c:Transform>
<Position X="0" Y="2.30650759" Z="0.323329508"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.564705908" R="0.56078434"/>
<Radius>7</Radius>
</c:PointLight>
<c:Transform>
<Position X="0" Y="1.63035285" Z="-1.18989873"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Test">
<Entity name="R_Leg_Top">
<Components>
<c:BoneAttachment>
<BoneName>L_Foot</BoneName>
<BoneName>R_Leg_Top</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
<InheritScale>true</InheritScale>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.0863928348" Y="0.0355217457" Z="-0.153234094"/>
<Scale X="0.199999988" Y="0.199999988" Z="0.200000003"/>
<Orientation X="3.14144039" Y="0.0170426127" Z="-3.13839984"/>
<Position X="0.0718467757" Y="0.479806602" Z="0.0548748523"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-0.431370437" Y="0.850169301" Z="-2.42601299"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Leg_Bottom">
<Components>
<c:BoneAttachment>
<BoneName>R_Leg_Bottom</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.39332974" Y="0.324809998" Z="-0.0288445484"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="1.18491673" Y="1.0242362" Z="-2.26206946"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Foot">
<Components>
<c:BoneAttachment>
<BoneName>R_Foot</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.305837631" Y="0.0361253619" Z="0.179315761"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="3.10044129e-07" Y="1.09664524" Z="-3.13675666"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="L_Foot">
<Components>
<c:BoneAttachment>
<BoneName>L_Foot</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.186916605" Y="0.0361250937" Z="-0.136036098"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="3.14159131" Y="-7.15255737e-07" Z="3.14159274"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="L_Leg_Bottom">
<Components>
<c:BoneAttachment>
<BoneName>L_Leg_Bottom</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.124794818" Y="0.343560517" Z="-0.32563746"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-2.66533947" Y="-0.187336028" Z="2.93550467"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="L_Leg_Top">
<Components>
<c:BoneAttachment>
<BoneName>L_Leg_Top</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.0666294992" Y="0.471828938" Z="0.0128124626"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="1.98675263" Y="0.0233680122" Z="2.87409353"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Hip">
<Components>
<c:BoneAttachment>
<BoneName>Hip</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.00469498895" Y="0.512485623" Z="0.0200203825"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-3.03470659" Y="0.36588186" Z="-3.0760417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spine_1">
<Components>
<c:BoneAttachment>
<BoneName>Spine_1</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.00108358753" Y="0.645309925" Z="0.00671719108"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-2.23578" Y="1.12130237" Z="-2.36199307"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spine_2">
<Components>
<c:BoneAttachment>
<BoneName>Spine_2</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.0091821691" Y="0.768297315" Z="-0.0377721936"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-1.92300212" Y="1.0594666" Z="-2.269871"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spine_3">
<Components>
<c:BoneAttachment>
<BoneName>Spine_3</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.0091821691" Y="0.768297315" Z="-0.0377721936"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-1.92300212" Y="1.0594666" Z="-2.269871"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Leg_Top">
<Components>
<c:BoneAttachment>
<BoneName>Neck</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.0257265922" Y="0.835334301" Z="-0.0725377947"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-2.67842054" Y="0.0451255701" Z="2.97098374"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Shoulder">
<Components>
<c:BoneAttachment>
<BoneName>R_Shoulder</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.0091821691" Y="0.768297315" Z="-0.0377721936"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-1.92300212" Y="1.0594666" Z="-2.269871"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Arm">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.080665715" Y="0.757790864" Z="0.0217154976"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-0.990312934" Y="0.329345405" Z="-0.0508526377"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Elbow">
<Components>
<c:BoneAttachment>
<BoneName>R_Elbow</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.160035357" Y="0.843445063" Z="0.00654693879"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-1.90130699" Y="-0.773362398" Z="1.06810308"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Hand">
<Components>
<c:BoneAttachment>
<BoneName>R_Hand</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.238011926" Y="0.711740375" Z="-0.115170464"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-0.845395327" Y="0.765393734" Z="-0.237622365"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Chin">
<Components>
<c:BoneAttachment>
<BoneName>Chin</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.0430049673" Y="0.916874766" Z="-0.143034652"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-2.96715546" Y="0.0551578514" Z="2.99139857"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="L_Hand">
<Components>
<c:BoneAttachment>
<BoneName>L_Hand</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.0662894994" Y="0.739402592" Z="-0.459511727"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-3.1153264" Y="-0.248137668" Z="-0.829112232"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="L_Elbow">
<Components>
<c:BoneAttachment>
<BoneName>L_Elbow</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.0279197786" Y="0.648010612" Z="-0.314551264"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="0.325028092" Y="1.40154743" Z="1.88795435"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity>
<Components>
<c:Animation>
<AnimationName>Walk</AnimationName>
<Time>0.94221571775669055</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
<Resource>Models/AssaultAnimated.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="-1.245" Z="-1.05166435"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Test">
<Components>
<c:Animation>
<AnimationName>Crouch Walk</AnimationName>
<Time>0.90348983519388959</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
<Resource>Models/AssaultAnimated.mesh</Resource>
<Color A="1" B="1" G="1" R="19.6078434"/>
</c:Model>
<c:Transform>
<Position X="0.0539491512" Y="-1.24511254" Z="0.0892278999"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-0.967451036" Y="-0.749000013" Z="-1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
@@ -0,0 +1,341 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="AnimationTests" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitPlane.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="-1.245" Z="0"/>
<Scale X="10" Y="10" Z="10"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:DirectionalLight/>
<c:Model>
<Resource>Models/DirectionalLightWidget.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="2.42800021" Z="-2.80000019"/>
<Orientation X="5.51900005" Y="3.65100026" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Animation>
<AnimationName>Run</AnimationName>
<Time>0.94215130460312757</Time>
<Speed>1</Speed>
</c:Animation>
<c:Model>
<Resource>Models/Asstest.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="0" Y="-1.245" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="R_Leg_Top">
<Components>
<c:BoneAttachment>
<BoneName>R_Leg_Top</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.0670756698" Y="0.7053985" Z="0.0367298797"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-0.539481044" Y="-0.0316002518" Z="-2.95271134"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Leg_Bottom">
<Components>
<c:BoneAttachment>
<BoneName>R_Leg_Bottom</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.148491099" Y="0.406787694" Z="-0.159706444"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="1.192891" Y="0.187030882" Z="-2.87608051"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Foot">
<Components>
<c:BoneAttachment>
<BoneName>R_Foot</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.147671953" Y="0.288556606" Z="0.187201411"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="1.19914544" Y="0.0853852332" Z="-3.1367836"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="L_Foot">
<Components>
<c:BoneAttachment>
<BoneName>L_Foot</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.0861762166" Y="0.035969615" Z="-0.0733369738"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-3.14159179" Y="1.56462193e-05" Z="-3.1415894"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="L_Leg_Bottom">
<Components>
<c:BoneAttachment>
<BoneName>L_Leg_Bottom</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.0949281976" Y="0.38283509" Z="-0.191370964"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-2.88567233" Y="-0.208285078" Z="-3.09033155"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="L_Leg_Top">
<Components>
<c:BoneAttachment>
<BoneName>L_Leg_Top</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.0714211613" Y="0.697834671" Z="-0.00534122996"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="2.61832142" Y="-0.111381792" Z="-3.05362916"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Hip">
<Components>
<c:BoneAttachment>
<BoneName>Hip</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="19.6078434"/>
</c:Model>
<c:Transform>
<Position X="-9.4325589e-18" Y="0.738307238" Z="0.00194504182"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-3.03686881" Y="0.365960717" Z="-3.07918954"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spine_1">
<Components>
<c:BoneAttachment>
<BoneName>Spine_1</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="19.6078434"/>
</c:Model>
<c:Transform>
<Position X="-0.00329666352" Y="0.871166348" Z="-0.0110896118"/>
<Scale X="0.0500000007" Y="0.100000001" Z="0.0500000007"/>
<Orientation X="-2.58382678" Y="1.22235525" Z="-2.69361424"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spine_2">
<Components>
<c:BoneAttachment>
<BoneName>Spine_2</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="19.6078434"/>
</c:Model>
<c:Transform>
<Position X="0.00619302923" Y="0.999758601" Z="-0.0344300792"/>
<Scale X="0.0500000007" Y="0.100000001" Z="0.0500000007"/>
<Orientation X="-2.29503679" Y="1.19778895" Z="-2.59355855"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spine_3">
<Components>
<c:BoneAttachment>
<BoneName>Spine_3</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="19.6078434"/>
</c:Model>
<c:Transform>
<Position X="0.00619302923" Y="0.999758601" Z="-0.0344300792"/>
<Scale X="0.0500000007" Y="0.100000001" Z="0.0500000007"/>
<Orientation X="-2.29503679" Y="1.19778895" Z="-2.59355855"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Neck">
<Components>
<c:BoneAttachment>
<BoneName>Neck</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="19.6078434" G="19.6078434" R="19.6078434"/>
</c:Model>
<c:Transform>
<Position X="0.0217485577" Y="1.07277262" Z="-0.0545123592"/>
<Scale X="0.0500000007" Y="0.100000001" Z="0.0500000007"/>
<Orientation X="-2.72223639" Y="0.035971649" Z="3.00587177"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Shoulder">
<Components>
<c:BoneAttachment>
<BoneName>R_Shoulder</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.00619302923" Y="0.999758601" Z="-0.0344300792"/>
<Scale X="0.100000001" Y="0.0500000007" Z="0.100000001"/>
<Orientation X="-2.29503679" Y="1.19778895" Z="-2.59355855"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Arm">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.0779105872" Y="0.97813803" Z="0.0216788556"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-0.504944384" Y="0.385777682" Z="-0.0470155627"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Elbow">
<Components>
<c:BoneAttachment>
<BoneName>R_Elbow</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.145016268" Y="1.09721363" Z="0.0620321929"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-2.07472539" Y="-1.02085268" Z="1.20787954"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="R_Hand">
<Components>
<c:BoneAttachment>
<BoneName>R_Hand</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="19.6078434" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="-0.194418803" Y="0.990253985" Z="-0.0940467715"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-0.332483619" Y="0.762842059" Z="0.00552804675"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Chin">
<Components>
<c:BoneAttachment>
<BoneName>Chin</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="19.6078434" G="19.6078434" R="19.6078434"/>
</c:Model>
<c:Transform>
<Position X="0.035807699" Y="1.15795505" Z="-0.12132182"/>
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
<Orientation X="-2.96464038" Y="0.0267533381" Z="2.98014784"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="R_Leg_Top" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoneAttachment>
<BoneName>R_Leg_Top</BoneName>
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
</c:BoneAttachment>
<c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="1" B="1" G="19.6078434" R="1"/>
</c:Model>
<c:Transform>
<Position X="0.0664939061" Y="0.714353919" Z="0.0475388765"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
<Orientation X="-0.783109188" Y="-0.0050998251" Z="3.14151597"/>
</c:Transform>
</Components>
<Children/>
</Entity>
+3 -1
View File
@@ -25,7 +25,9 @@
<Entity>
<Components>
<c:Animation>
<Name>Walk</Name>
<AnimationName>Crouch Walk</AnimationName>
<Time>0.64462505387501778</Time>
<Speed>8</Speed>
</c:Animation>
<c:Model>
<Resource>Models/AssaultAnimated.mesh</Resource>
+45
View File
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Model>
<Resource>Models/Core/UnitPlane.mesh</Resource>
</c:Model>
<c:Transform>
<Scale X="10" Y="10" Z="10"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:PlayerSpawn/>
<c:Spawner>
<EntityFile>Schema/Entities/Player.xml</EntityFile>
</c:Spawner>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:SpawnPoint/>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+96 -16
View File
@@ -23,29 +23,109 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["AnimationName"]);
if(animation != nullptr) {
double animationSpeed = (double)animationComponent["Speed"];
if (animation == nullptr) {
return;
}
if (animationSpeed != 0.0) {
double nextTime = (double)animationComponent["Time"] + animationSpeed * dt;
double animationSpeed = (double)animationComponent["Speed"];
if (animationSpeed != 0.0) {
double nextTime = (double)animationComponent["Time"] + animationSpeed * dt;
if (!(bool)animationComponent["Loop"] && glm::abs(nextTime) > animation->Duration) {
(double&)animationComponent["Time"] = glm::sign(nextTime) * animation->Duration;
(double&)animationComponent["Speed"] = 0.0;
Events::AnimationComplete e;
e.Entity = entity;
e.Name = (std::string)animationComponent["AnimationName"];
m_EventBroker->Publish(e);
if (!(bool)animationComponent["Loop"] && glm::abs(nextTime) > animation->Duration) {
(double&)animationComponent["Time"] = glm::sign(nextTime) * animation->Duration;
(double&)animationComponent["Speed"] = 0.0;
Events::AnimationComplete e;
e.Entity = entity;
e.Name = (std::string)animationComponent["AnimationName"];
m_EventBroker->Publish(e);
} else {
if (glm::abs(nextTime) > animation->Duration) {
(double&)animationComponent["Time"] = glm::abs(nextTime) - animation->Duration;
} else {
if (glm::abs(nextTime) > animation->Duration) {
(double&)animationComponent["Time"] = glm::abs(nextTime) - animation->Duration;
} else {
(double&)animationComponent["Time"] = nextTime;
}
(double&)animationComponent["Time"] = nextTime;
}
}
}
ImGui::SliderFloat("Angle", &angle, -180.f, 180.f);
int id = skeleton->GetBoneID("Spine_2");
auto it = skeleton->Bones.find(id);
if (it != skeleton->Bones.end()) {
int currentKeyframeIndex = skeleton->GetKeyframe(*animation, entity["Animation"]["Time"]);
const Skeleton::Animation::Keyframe& currentFrame = animation->Keyframes[currentKeyframeIndex];
const Skeleton::Animation::Keyframe& nextFrame = animation->Keyframes[(currentKeyframeIndex + 1) % animation->Keyframes.size()];
float alpha = ((double)entity["Animation"]["Time"] - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
glm::mat4 parentBoneTransform = skeleton->GetBoneTransform(it->second->Parent, currentFrame, nextFrame, alpha, glm::mat4(1));
glm::vec3 scale;
glm::quat rotation;
glm::vec3 translation;
glm::vec3 skew;
glm::vec4 perspective;
glm::decompose(parentBoneTransform, scale, rotation, translation, skew, perspective);
glm::vec3 rot;
rot = glm::vec3(1, 0, 0);
rot = glm::normalize(rot) * glm::radians(angle);
glm::mat4 modmat = glm::mat4(glm::quat(rot)) * glm::inverse(glm::mat4(rotation));
it->second->ModificationMatrix = modmat;
}
/*
{
int id = skeleton->GetBoneID("Neck");
auto it = skeleton->Bones.find(id);
if (it != skeleton->Bones.end()) {
it->second->ModificationMatrix = glm::mat4(glm::quat(glm::vec3(glm::radians(angle/2.f), 0.f, 0.f)));
}
}
{
int id = skeleton->GetBoneID("Spine_2");
auto it = skeleton->Bones.find(id);
if (it != skeleton->Bones.end()) {
it->second->ModificationMatrix = glm::mat4(glm::quat(glm::vec3(glm::radians(angle/4.f), 0.f, 0.f)));
}
}
{
int id = skeleton->GetBoneID("R_Shoulder");
auto it = skeleton->Bones.find(id);
if (it != skeleton->Bones.end()) {
it->second->ModificationMatrix = glm::mat4(glm::quat(glm::vec3(glm::radians(angle/2.f), 0.f, 0.f)));
}
}
{
int id = skeleton->GetBoneID("L_Shoulder");
auto it = skeleton->Bones.find(id);
if (it != skeleton->Bones.end()) {
it->second->ModificationMatrix = glm::mat4(glm::quat(glm::vec3(glm::radians(angle/2.f), 0.f, 0.f)));
}
}*/
if (entity.HasComponent("Player")) {
EntityWrapper cameraEntity = entity.FirstChildByName("Camera");
if (cameraEntity.Valid()) {
glm::vec3& cameraOrientation = cameraEntity["Transform"]["Orientation"];
}
}
}
+6 -6
View File
@@ -61,14 +61,14 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
EntityWrapper entity(m_World, cModel.EntityID);
// Only render children of a camera if that camera is currently active
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
continue;
}
// if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
// continue;
// } DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
if (entity.HasComponent("HiddenForLocalPlayer") && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
continue;
}
// if (entity.HasComponent("HiddenForLocalPlayer") && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
// continue;
// } DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS DO NOT COMMIT THIS
Model* model;
try {
+5 -4
View File
@@ -95,12 +95,13 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, const Animation::Keyf
positionInterp.z = 0;
}
boneMatrix = parentMatrix * (glm::translate(positionInterp) * glm::toMat4(rotationInterp) * glm::scale(scaleInterp));
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
boneMatrix = parentMatrix * bone->ModificationMatrix * (glm::translate(positionInterp) * glm::toMat4(rotationInterp) * glm::scale(scaleInterp));
boneMatrices[bone->ID] = boneMatrix *bone->OffsetMatrix;
} else {
if (bone->Parent) {
boneMatrix = parentMatrix; // * glm::inverse(bone->OffsetMatrix);
boneMatrix = parentMatrix;// *glm::inverse(bone->OffsetMatrix);
}
boneMatrices[bone->ID] = boneMatrix; // * bone->OffsetMatrix;
}
@@ -125,7 +126,7 @@ glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation::Keyframe
glm::vec3 scaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
boneMatrix = (glm::translate(positionInterp) * glm::toMat4(rotationInterp) * glm::scale(scaleInterp)) * parentMatrix;
boneMatrix = (glm::translate(positionInterp) * glm::toMat4(rotationInterp) * glm::scale(scaleInterp)) * bone->ModificationMatrix * parentMatrix;
} else {
if (bone->Parent) {
boneMatrix = parentMatrix;
+4 -4
View File
@@ -97,18 +97,18 @@ void PlayerMovementSystem::Update(double dt)
float movementLength = glm::length(groundVelocity);
if (glm::length(controller->Movement()) > 0.f) {
if (controller->Crouching()) {
cAnimation["Name"] = "Crouch Walk";
cAnimation["AnimationName"] = "Crouch Walk";
(double&)cAnimation["Speed"] = 1.f * -glm::sign(controller->Movement().z);
} else {
cAnimation["Name"] = "Run";
cAnimation["AnimationName"] = "Run";
(double&)cAnimation["Speed"] = 2.f * -glm::sign(controller->Movement().z);
}
} else {
if (controller->Crouching()) {
cAnimation["Name"] = "Crouch";
cAnimation["AnimationName"] = "Crouch";
(double&)cAnimation["Speed"] = 1.f;
} else {
cAnimation["Name"] = "Hold Pos";
cAnimation["AnimationName"] = "Hold Pos";
(double&)cAnimation["Speed"] = 1.f;
}
}