Compare commits

..

35 Commits

Author SHA1 Message Date
viktorljung cb94f6aecd AnimationDemo 2016-03-14 20:03:52 +01:00
William Moberg fb3842ba5b Indentation. 2016-03-14 06:05:11 +01:00
William Moberg 6daaccb9ed Merge branch 'Recording' of github.com:teamfisk/TacticalZ into Recording
# Conflicts:
#	src/Engine/Editor/EditorSystem.cpp
2016-03-14 06:02:47 +01:00
William Moberg 0cd161184e Smoother movement for editor camera. 2016-03-14 06:00:12 +01:00
Jace 87b983ec6f Stuff 2016-03-14 05:56:09 +01:00
Jace 592f33653e Better shadows for recording 2016-03-14 04:44:53 +01:00
Jace c74a4e375e Better CP_Valhalla lighting 2016-03-14 04:24:40 +01:00
Jace 78a383b03c Merge branch 'master' into Recording 2016-03-14 04:04:20 +01:00
Jace 24de85b476 Editor no longer resets camera 2016-03-14 04:02:05 +01:00
Jace fc97c4e8ea Merge branch 'master' of github.com:teamfisk/TacticalZ 2016-03-14 04:01:40 +01:00
Jace e3767996a1 Added DEBUG flags to all debug imgui stuff 2016-03-14 04:01:04 +01:00
William Moberg 809d164eba Merge pull request #221 from teamfisk/PerfectSoundForRelease
Perfect sound for release
2016-03-14 03:54:35 +01:00
Tobias Dahl 5879cb0de4 Merge pull request #219 from teamfisk/FixAssaultWeaponReload
Reload for assault is only done once now.
2016-03-14 03:48:59 +01:00
Tobias Dahl 832a901bf6 Merge pull request #220 from teamfisk/Movement
Movement
2016-03-14 03:48:47 +01:00
stiffly 8cef422ea7 Merge remote-tracking branch 'origin/master' into PerfectSoundForRelease
# Conflicts:
#	resources/Schema/Entities/CP_Rocky2.xml
2016-03-14 01:51:51 +01:00
stiffly 54a03ddc0f Hurt sound only played for local player. 2016-03-14 01:49:37 +01:00
viktorljung a65d8c86d1 3rd person reload effect 2016-03-14 01:48:48 +01:00
stiffly c1395355c6 Removed comment 2016-03-14 01:36:11 +01:00
viktorljung 0764c9bab2 Merge remote-tracking branch 'origin/master' into Movement 2016-03-14 01:20:20 +01:00
Jocke 1b1963e6d2 Reload for assault is only done once now. 2016-03-14 01:01:35 +01:00
stiffly 3994c0f7ad Merge remote-tracking branch 'origin/master' into PerfectSoundForRelease 2016-03-14 00:59:32 +01:00
stiffly 1345889e62 The win sound plays on win screen 2016-03-14 00:58:53 +01:00
viktorljung 424dffd1e0 removed shadows on 1st person hands and weapons
added shielded component on 3rd person weapons
2016-03-14 00:47:21 +01:00
viktorljung d1c11f20f2 Merge remote-tracking branch 'origin/master' into Movement 2016-03-14 00:39:16 +01:00
viktorljung 1bba40449f Tracers done 2016-03-14 00:38:36 +01:00
viktorljung f5343251c5 fixed for real now? 2016-03-14 00:28:30 +01:00
viktorljung 5207248a49 3rd person tracers fixed 2016-03-14 00:04:51 +01:00
viktorljung 1bf65d896a Sidearm tracer fixed 2016-03-13 23:42:21 +01:00
stiffly 7855cf03d2 The Endscreen now works over the network. 2016-03-13 23:33:10 +01:00
viktorljung 4adf7dc507 Assault tracer fixed 2016-03-13 23:29:50 +01:00
viktorljung 73bcc6e382 Merge branch 'Movement' of github.com:teamfisk/TacticalZ into Movement 2016-03-13 23:12:59 +01:00
viktorljung f393a22011 defender tracer fixed 2016-03-13 23:12:45 +01:00
stiffly 03dab9ca9a Merge remote-tracking branch 'origin/master' into PerfectSoundForRelease 2016-03-13 22:33:23 +01:00
stiffly 1a120ef345 Merge remote-tracking branch 'origin/master' into PerfectSoundForRelease 2016-03-13 22:22:41 +01:00
stiffly 0d823421d8 Added win sound file 2016-03-13 22:22:19 +01:00
59 changed files with 33863 additions and 27880 deletions
+6 -6
View File
@@ -48,13 +48,13 @@ bool RayVsTriangle(const Ray& ray,
bool trueOnNegativeDistance = false);
//Return true if the ray hits any of the triangles in the model. Stops checking when a hit is detected.
bool RayVsModel(const Ray& ray,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix);
//Return true if the ray hits any of the triangles in the model.
//Also returns the position of the intersection point. Will loop through all the whole model indices.
bool RayVsModel(const Ray& ray,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& outHitPosition);
@@ -62,7 +62,7 @@ bool RayVsModel(const Ray& ray,
//Also returns the distance from the ray origin to the closest
//intersection point, and the barycentric u,v-coordinates. Will loop through all the whole model indices.
bool RayVsModel(const Ray& ray,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
float& outDistance,
@@ -70,7 +70,7 @@ bool RayVsModel(const Ray& ray,
float& outVCoord);
bool AABBvsTriangles(const AABB& box,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& boxVelocity,
@@ -80,7 +80,7 @@ bool AABBvsTriangles(const AABB& box,
//Detects collision, but does not resolve.
bool AABBvsTriangles(const AABB& box,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix);
@@ -92,7 +92,7 @@ enum Output
};
//Detects intersection and containment.
Output AABBvsTrianglesWContainment(const AABB& box,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix);
+1
View File
@@ -43,6 +43,7 @@ private:
EditorGUI::WidgetSpace m_WidgetSpace = EditorGUI::WidgetSpace::Global;
EntityWrapper m_Widget = EntityWrapper::Invalid;
EntityWrapper m_CurrentSelection = EntityWrapper::Invalid;
glm::vec3 m_CamVelocity;
// Utility functions
EntityWrapper importEntity(EntityWrapper parent, boost::filesystem::path filePath);
@@ -213,7 +213,6 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
}
}
EntityWrapper firstPersonModel = m_PlayerEntity.FirstChildByName("Hands");
if (firstPersonModel.Valid()) {
if (val > 0) { // Walk/Run
+2
View File
@@ -36,6 +36,7 @@
#include "Network/ESearchForServers.h"
#include "Network/EInterpolate.h"
#include "Network/SnapshotFilter.h"
#include "Core/EWin.h"
class Client : public Network
{
@@ -107,6 +108,7 @@ private:
void parseAmmoPickup(Packet& packet);
void parseRemoveWorld(Packet& packet);
void parseKDEvent(Packet& packet);
void parseWin(Packet& packet);
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
void parseSnapshot(Packet& packet);
void identifyPacketLoss();
+1
View File
@@ -25,6 +25,7 @@ enum class MessageType
AmmoPickup,
RemoveWorld,
KD,
Win,
Invalid
};
@@ -16,6 +16,7 @@
#include "../Core/EEntityDeleted.h"
#include "Rendering/ESetBlendWeight.h"
#include "imgui/imgui.h"
#include "Input/EInputCommand.h"
class AnimationSystem : public ImpureSystem
{
@@ -37,7 +38,13 @@ private:
EventRelay<AnimationSystem, Events::SetBlendWeight> m_ESetBlendWeight;
bool OnSetBlendWeight(Events::SetBlendWeight& e);
EventRelay<AnimationSystem, Events::InputCommand> m_EInputCommand;
bool OnInputCommand(Events::InputCommand& e);
std::unordered_map<EntityWrapper, AutoBlendQueue> m_AutoBlendQueues;
bool Crouch = false;
float aimMove = 0;
};
#endif
+6 -12
View File
@@ -16,18 +16,15 @@ private:
public:
~Model();
const std::vector<RawModel::MaterialProperties>& MaterialGroups() const { return m_Materials; }
unsigned int NumberOfVertices() const { return m_Vertices.size(); }
const std::vector<RawModel::MaterialProperties>& MaterialGroups() const { return m_RawModel->m_Materials; }
const glm::mat4& Matrix() const { return m_RawModel->m_Matrix; }
const RawModel::Vertex* Vertices() const { return m_RawModel->Vertices(); }
unsigned int NumberOfVertices() const { return m_RawModel->NumVertices(); }
const AABB& Box() const { return m_Box; }
bool IsSkinned() const { return m_IsSkinned; }
bool IsSkinned() const { return m_RawModel->IsSkinned(); }
GLuint VAO;
GLuint ElementBuffer;
//RawModel* m_RawModel;
Skeleton* m_Skeleton = nullptr;
std::vector<glm::vec3> m_Vertices;
std::vector<unsigned int> m_Indices;
RawModel* m_RawModel;
private:
AABB m_Box;
@@ -37,9 +34,6 @@ private:
GLuint TangentNormalsBuffer;
GLuint BiTangentNormalsBuffer;
GLuint TextureCoordBuffer;
std::vector<RawModel::MaterialProperties> m_Materials;
bool m_IsSkinned;
};
#endif
+1 -1
View File
@@ -110,7 +110,7 @@ struct ModelJob : RenderJob
}
if (model->IsSkinned()) {
Skeleton = Model->m_Skeleton;
Skeleton = Model->m_RawModel->m_Skeleton;
if (Skeleton != nullptr) {
EntityWrapper entityWrapper = EntityWrapper(world, modelComponent.EntityID);
+16 -39
View File
@@ -13,7 +13,6 @@
#include <boost/filesystem/path.hpp>
#include <boost/endian/buffers.hpp>
#include "../Common.h"
#include "../GLM.h"
#include "../Core/ResourceManager.h"
@@ -21,17 +20,22 @@
#include "Skeleton.h"
#include "ShaderProgram.h"
#include "boost\endian\buffers.hpp"
class RawModelCustom : public Resource
{
friend class ResourceManager;
friend class Model;
protected:
RawModelCustom(std::string fileName);
public:
~RawModelCustom();
struct RenderVertex {
struct Vertex
{
glm::vec3 Position;
glm::vec3 Normal;
glm::vec3 Tangent;
@@ -39,7 +43,7 @@ public:
glm::vec2 TextureCoords;
};
struct SkinedVertex : public RenderVertex {
struct SkinedVertex : public Vertex {
glm::vec4 BoneIndices;
glm::vec4 BoneWeights;
};
@@ -87,7 +91,7 @@ public:
unsigned int ShaderID = 0;
};
const RenderVertex* Vertices() const {
const Vertex* Vertices() const {
if (hasSkin) {
return m_SkinedVertices.data();
} else {
@@ -95,16 +99,16 @@ public:
}
};
unsigned int VertexSize() const {
unsigned int VertexSize() const {
if (hasSkin) {
return sizeof(SkinedVertex);
}
else {
return sizeof(RenderVertex);
return sizeof(Vertex);
}
};
size_t NumVertices() const {
unsigned int NumVertices() const {
if (hasSkin) {
return m_SkinedVertices.size();
} else {
@@ -112,39 +116,17 @@ public:
}
};
const std::vector<unsigned int>& Indices() const {
return m_Indices;
}
bool IsSkinned() const { return hasSkin; };
const std::vector<glm::vec3>& CollisionVertices();
size_t NumCollisionVertices() const {
return m_CollisionVertices.size();
};
const std::vector<unsigned int>& CollisionIndices() const {
if (hasCollisionMesh) {
return m_CollisionIndices;
} else {
return m_Indices;
}
};
std::vector<MaterialProperties> m_Materials;
std::vector<unsigned int> m_Indices;
Skeleton* m_Skeleton = nullptr;
glm::mat4 m_Matrix;
private:
bool hasSkin;
bool hasCollisionMesh = false;
std::vector<unsigned int> m_Indices;
std::vector<unsigned int> m_CollisionIndices;
std::vector<glm::vec3> m_CollisionVertices;
std::vector<RenderVertex> m_Vertices;
std::vector<Vertex> m_Vertices;
std::vector<SkinedVertex> m_SkinedVertices;
void ReadMeshFile(std::string filePath);
@@ -167,12 +149,7 @@ private:
void ReadAnimationClips(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int numberOfClips);
void ReadAnimationClipSingle(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, unsigned int clipIndex);
void ReadAnimationKeyFrame(std::size_t& offset, char* fileData, const unsigned int& fileByteSize, std::vector<Skeleton::Animation::Keyframe>& animation);
void ReadCollisionFile(std::string filePath);
void ReadCollisionFileData(std::size_t& offset, char* fileData, const unsigned int& fileByteSize);
const std::vector<glm::vec3>& ConstructCollisionList();
//void CreateSkeleton(std::vector<std::tuple<std::string, glm::mat4>> &boneInfo, std::map<std::string, int> &boneNameMapping, aiNode* node, int parentID);
};
+1 -1
View File
@@ -69,7 +69,7 @@ private:
std::array<glm::mat4, MAX_SPLITS> m_LightProjection;
std::array<glm::mat4, MAX_SPLITS> m_LightView;
GLfloat m_NearFarPlane[2] = { -34.f, 27.f };
GLfloat m_NearFarPlane[2] = { -128.f, 128.f };
GLuint m_ResolutionSizeWidth = 1024 * 2;
GLuint m_ResolutionSizeHeight = 1024 * 2;
+1
View File
@@ -81,6 +81,7 @@ private:
void setSoundProperties(Source* source, ComponentWrapper* soundComponent);
float getDurationSeconds(Source* source);
float getTimeOffsetSeconds(Source* source);
void setTimeOffsetSeconds(Source* source, float timeOffset);
// Specific logic
void playSound(Source* source);
-1
View File
@@ -8,7 +8,6 @@
#include "Events/ESpawnerSpawn.h"
#include "Core/TransformSystem.h"
#include "Core/EntityFile.h"
#include "Rendering/Model.h"
class SpawnerSystem : public System
{
+1 -1
View File
@@ -2,5 +2,5 @@
<Camera xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Camera.xsd">
<FOV>59</FOV> <!-- 90 horizontal FOV at 1080p -->
<NearClip>0.01</NearClip>
<FarClip>5000</FarClip>
<FarClip>300</FarClip>
</Camera>
+114
View File
@@ -0,0 +1,114 @@
<?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:SceneLight>
<AmbientColor A="1" B="0.392156869" G="0.392156869" R="0.392156869"/>
<Gamma>1</Gamma>
<Exposure>0.82000017166137695</Exposure>
</c:SceneLight>
<c:Transform/>
</Components>
<Children>
<Entity>
<Components>
<c:Collidable/>
<c:Model>
<GlowIntensity>1.0199999809265137</GlowIntensity>
<Resource>Models/Props/Walls/SciFiWallTop.mesh</Resource>
<Color A="1" B="3.92156863" G="1" R="1"/>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="0" Y="58.718792" Z="15.6310005"/>
<Orientation X="0" Y="0" Z="3.14199996"/>
<Scale X="0.279000014" Y="1" Z="0.279000014"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Collidable/>
<c:Model>
<GlowIntensity>1.5</GlowIntensity>
<Resource>Models/Props/Pillars/SciFiPillar2Blue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="-14.4384613" Y="-1.2316848" Z="0"/>
<Orientation X="0" Y="2.64800024" Z="0"/>
<Scale X="2" Y="3.60000014" Z="1.9000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity>
<Components>
<c:Collidable/>
<c:Model>
<GlowIntensity>1.5</GlowIntensity>
<Resource>Models/Props/Pillars/SciFiPillar2Blue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="14.3019333" Y="-1.12725353" Z="0"/>
<Orientation X="0" Y="3.84800029" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Dir">
<Components>
<c:DirectionalLight>
<Color A="1" B="0.725490212" G="0.75686276" R="0.741176486"/>
<Intensity>1.0699999332427979</Intensity>
</c:DirectionalLight>
<c:Transform>
<Orientation X="3.68318534" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Cam">
<Components>
<c:Camera/>
<c:Model>
<Resource>Models/Core/UnitSphere.mesh</Resource>
<Shadow>false</Shadow>
<NormalMap>false</NormalMap>
<DiffuseTexture>false</DiffuseTexture>
<SpecularMap>false</SpecularMap>
<GlowMap>false</GlowMap>
</c:Model>
<c:Transform>
<Position X="0.100000001" Y="-0.0670000017" Z="-32.8670006"/>
<Orientation X="0" Y="3.1400001" Z="0"/>
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Spawn">
<Components>
<c:PlayerSpawn>
<AssaultFile>Schema/Entities/PlayerAssaultBlue.xml</AssaultFile>
<DefenderFile>Schema/Entities/PlayerDefenderBlue.xml</DefenderFile>
<SniperFile></SniperFile>
</c:PlayerSpawn>
<c:Model>
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
</c:Model>
<c:Spawner>
<EntityFile></EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.100000001" Y="2.8398931" Z="-29.0827847"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+9628 -9622
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,868 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="PlayerAssault" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:AABB>
<Origin X="0" Y="0.772000015" Z="0"/>
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:AssaultWeapon/>
<c:Team>
<Team>
<Blue/>
</Team>
</c:Team>
<c:Collidable/>
<c:DashAbility/>
<c:DoubleJump/>
<c:SidearmWeapon>
<BaseDamage>10</BaseDamage>
</c:SidearmWeapon>
<c:Health/>
<c:NetworkComponent/>
<c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
</c:Physics>
<c:Player>
<MovementSpeed>5</MovementSpeed>
<CurrentWeapon></CurrentWeapon>
</c:Player>
<c:Transform>
<Position X="-0.5" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="PlayerModel">
<Components>
<c:BlendOverride>
<Master>BlendTreeUpper</Master>
<Slave>BlendTreeLower</Slave>
</c:BlendOverride>
<c:Shielded/>
<c:HiddenForLocalPlayer/>
<c:Model>
<GlowIntensity>2.2000000476837158</GlowIntensity>
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
</c:Model>
<c:Transform>
<Orientation X="0" Y="0.467000008" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="PrimaryAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/WeaponAssaultBlueWorld.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.159274966" Y="1.03443384" Z="-0.235393077"/>
<Orientation X="-0.0276949964" Y="-0.0416635424" Z="0.131935105"/>
</c:Transform>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
</Components>
<Children>
<Entity name="AssaultWeapon">
<Components>
<c:Shielded/>
<c:Model>
<GlowIntensity>1.5</GlowIntensity>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Transform/>
</Components>
<Children>
<Entity name="ReloadSpawner">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Muzzle">
<Components>
<c:Transform>
<Position X="0.00728808995" Y="0.0896582007" Z="-0.643795013"/>
<Orientation X="6.27600002" Y="0.00499999989" Z="0.00600000005"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzleFlash">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/MuzzleFlashBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="-8.41593719e-05" Y="-0.000816107844" Z="0.0612007342"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="WeaponMuzzleRay">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayAssaultBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00179657922" Y="-0.00304772682" Z="-0.334699303"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="SecondaryAttachment">
<Components>
<c:BoneAttachment>
<BoneName>R_Arm_Weapon_Joint</BoneName>
</c:BoneAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/SidearmWeaponBlueWorld.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.159274966" Y="1.03443384" Z="-0.235393077"/>
<Orientation X="-0.0276949964" Y="-0.0416635424" Z="0.131935105"/>
</c:Transform>
<c:WeaponAttachment>
<Weapon>SidearmWeapon</Weapon>
<Person>
<ThirdPerson/>
</Person>
</c:WeaponAttachment>
</Components>
<Children/>
</Entity>
<Entity name="BlendTreeLower">
<Components>
<c:Blend>
<Pose1>MovementBlend</Pose1>
<Pose2>JumpDashBlend</Pose2>
<Weight>2.5146881298480398e-63</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="MovementBlend">
<Components>
<c:Blend>
<Pose1>StandMovement</Pose1>
<Pose2>CrouchMovement</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="CrouchMovement">
<Components>
<c:Blend>
<Pose1>DirectionBlend</Pose1>
<Pose2>Idle</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DirectionBlend">
<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.033793529385008014</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.44988618375479206</Time>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.37720764570557463</Time>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Walk">
<Components>
<c:Animation>
<AnimationName>CrouchWalkF</AnimationName>
<Time>0.15558163088297761</Time>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>CrouchF</AnimationName>
<Time>1.8288091278296688</Time>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="StandMovement">
<Components>
<c:Blend>
<Pose1>DirectionBlend</Pose1>
<Pose2>Idle</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="DirectionBlend">
<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.84192543677924192</Time>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>RunF</AnimationName>
<Time>0.28035050282109175</Time>
<Speed>2</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.88305913822256876</Time>
<Speed>2</Speed>
<Play>true</Play>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:Animation>
<AnimationName>StrafeRightF</AnimationName>
<Time>0.96047014705853506</Time>
<Speed>2</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.7574641124802284</Time>
<Play>true</Play>
</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>
<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.7999999523162842</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.7999999523162842</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.7999999523162842</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.7999999523162842</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="BlendTreeUpper">
<Components>
<c:Blend>
<Pose1>AssaultWeapon</Pose1>
<Pose2>SidearmWeapon</Pose2>
<Weight>0</Weight>
<SubTreeRoot>true</SubTreeRoot>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="AssaultWeapon">
<Components>
<c:BlendAdditive>
<Adder>Aim</Adder>
<Receiver>WeaponBlend</Receiver>
</c:BlendAdditive>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponBlend">
<Components>
<c:BlendAdditive>
<Adder>IdleAssault</Adder>
<Receiver>ActionBlend</Receiver>
</c:BlendAdditive>
<c:Transform/>
</Components>
<Children>
<Entity name="ActionBlend">
<Components>
<c:Blend>
<Pose1>Fire</Pose1>
<Pose2>Reload</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Reload">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchU</AnimationName>
<Speed>0.5</Speed>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Fire">
<Components>
<c:Animation>
<AnimationName>ShootFastRifleU</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="IdleAssault">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>1.4730651229275153</Time>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Aim">
<Components>
<c:Animation>
<AnimationName>AimRifleA</AnimationName>
<Time>0.5</Time>
<Speed>0.10000000149011612</Speed>
<Loop>false</Loop>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="SidearmWeapon">
<Components>
<c:BlendAdditive>
<Adder>Aim</Adder>
<Receiver>WeaponBlend</Receiver>
</c:BlendAdditive>
<c:Transform/>
</Components>
<Children>
<Entity name="WeaponBlend">
<Components>
<c:BlendAdditive>
<Adder>IdleSidearm</Adder>
<Receiver>ActionBlend</Receiver>
</c:BlendAdditive>
<c:Transform/>
</Components>
<Children>
<Entity name="ActionBlend">
<Components>
<c:Blend>
<Pose1>Reload</Pose1>
<Pose2>Fire</Pose2>
<Weight>1</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Reload">
<Components>
<c:Animation>
<AnimationName>ReloadSwitchU</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Fire">
<Components>
<c:Animation>
<AnimationName>ShootSecWepU</AnimationName>
<Loop>false</Loop>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="IdleSidearm">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Aim">
<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>
</Children>
</Entity>
<Entity name="Lights">
<Components>
<c:Transform/>
</Components>
<Children>
<Entity name="Elbow_Left">
<Components>
<c:BoneAttachment>
<BoneName>L_Elbow</BoneName>
</c:BoneAttachment>
<c:Transform>
<Position X="-0.0641395152" Y="0.971834779" Z="-0.393912911"/>
<Orientation X="-2.71834111" Y="-1.16788483" Z="-2.30780911"/>
</c:Transform>
</Components>
<Children>
<Entity name="Upper">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-0.119805202" Y="0.0187246669" Z="-0.0205985513"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Lower">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-0.0430894755" Y="-0.0822322816" Z="0.0446314402"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Elbow_Right">
<Components>
<c:BoneAttachment>
<BoneName>R_Elbow</BoneName>
</c:BoneAttachment>
<c:Transform>
<Position X="0.311632752" Y="1.00616109" Z="-0.0154332817"/>
<Orientation X="1.7501713" Y="1.40668344" Z="0.63290441"/>
</c:Transform>
</Components>
<Children>
<Entity name="Upper">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.119999997" Y="0.0187246669" Z="-0.0205985513"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Lower">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.0430000015" Y="-0.0822322816" Z="0.0446314402"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Head">
<Components>
<c:BoneAttachment>
<BoneName>Head</BoneName>
</c:BoneAttachment>
<c:Transform>
<Position X="0.0810014606" Y="1.25193644" Z="-0.150023431"/>
<Orientation X="-0.278524429" Y="-0.110433489" Z="-0.180452675"/>
</c:Transform>
</Components>
<Children>
<Entity name="Left">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-0.117407471" Y="0.0664995536" Z="-0.00829757564"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Right">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.116999999" Y="0.0664995536" Z="-0.00829757564"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Leg_top_left">
<Components>
<c:BoneAttachment>
<BoneName>L_Leg_Top</BoneName>
<PositionOffset X="-0.116000004" Y="0.0500000007" Z="0.0360000022"/>
</c:BoneAttachment>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-0.188116193" Y="0.722146571" Z="0.020738611"/>
<Orientation X="0.68511039" Y="-0.00414709467" Z="-0.0733199194"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Leg_top_Right">
<Components>
<c:BoneAttachment>
<BoneName>R_Leg_Top</BoneName>
<PositionOffset X="0.0800000057" Y="0.0730000064" Z="0.064000003"/>
</c:BoneAttachment>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.149692252" Y="0.745154798" Z="0.0894331336"/>
<Orientation X="-0.00521934591" Y="-0.594766259" Z="0.242353484"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Leg_bottom_Left">
<Components>
<c:BoneAttachment>
<BoneName>L_Leg_Bottomdw</BoneName>
</c:BoneAttachment>
<c:Transform>
<Position X="-0.121549807" Y="0.396206558" Z="-0.258821368"/>
<Orientation X="0.0123701356" Y="0.0872921124" Z="-0.0923962742"/>
</c:Transform>
</Components>
<Children>
<Entity name="Outside">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-0.0752567574" Y="-0.0357234403" Z="0.0396512263"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Inside">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.075000003" Y="-0.0357234403" Z="0.0396512263"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="Leg_bottom_Right">
<Components>
<c:BoneAttachment>
<BoneName>R_Leg_Bottom</BoneName>
</c:BoneAttachment>
<c:Transform>
<Position X="0.184227288" Y="0.324282408" Z="0.0380233303"/>
<Orientation X="-0.709708989" Y="-0.647283316" Z="0.337633669"/>
</c:Transform>
</Components>
<Children>
<Entity name="Inside">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="-0.0752567574" Y="-0.0357234403" Z="0.0396512263"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="Outside">
<Components>
<c:PointLight>
<Color A="1" B="1" G="0.784313738" R="0"/>
<Intensity>0.10000000149011612</Intensity>
</c:PointLight>
<c:Transform>
<Position X="0.075000003" Y="-0.0357234403" Z="0.0396512263"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+1 -4
View File
@@ -5,6 +5,7 @@
<c:Lifetime>
<Lifetime>0.079999998211860657</Lifetime>
</c:Lifetime>
<c:NetworkComponent/>
<c:Transform/>
</Components>
@@ -17,10 +18,8 @@
<DiffuseTexture>Textures/Effects/NewRay5.png</DiffuseTexture>
<Color A="1" B="2.35294127" G="1.17647064" R="0"/>
<KeepRatio>true</KeepRatio>
<Linear>true</Linear>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
<Orientation X="0" Y="-1.57099998" Z="0"/>
<Scale X="1" Y="0.0700000003" Z="0"/>
</c:Transform>
@@ -35,10 +34,8 @@
<DiffuseTexture>Textures/Effects/NewRay5.png</DiffuseTexture>
<Color A="1" B="2.35294127" G="1.17647064" R="0"/>
<KeepRatio>true</KeepRatio>
<Linear>true</Linear>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
<Orientation X="0" Y="4.71218538" Z="3.14199996"/>
<Scale X="1" Y="0.0700000003" Z="0"/>
</c:Transform>
@@ -5,6 +5,7 @@
<c:Lifetime>
<Lifetime>0.079999998211860657</Lifetime>
</c:Lifetime>
<c:NetworkComponent/>
<c:Transform/>
</Components>
@@ -17,12 +18,10 @@
<DiffuseTexture>Textures/Effects/NewRay7.png</DiffuseTexture>
<Color A="1" B="2.35294127" G="1.17647064" R="0"/>
<KeepRatio>true</KeepRatio>
<Linear>true</Linear>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
<Orientation X="0" Y="-1.57099998" Z="0"/>
<Scale X="1" Y="0.0700000003" Z="0"/>
<Scale X="1" Y="0.0700000003" Z="1"/>
</c:Transform>
</Components>
<Children/>
@@ -35,12 +34,10 @@
<DiffuseTexture>Textures/Effects/NewRay7.png</DiffuseTexture>
<Color A="1" B="2.35294127" G="1.17647064" R="0"/>
<KeepRatio>true</KeepRatio>
<Linear>true</Linear>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
<Orientation X="0" Y="4.71218538" Z="3.14199996"/>
<Scale X="1" Y="0.0700000003" Z="0"/>
<Scale X="1" Y="0.0700000003" Z="1"/>
</c:Transform>
</Components>
<Children/>
+3 -6
View File
@@ -3,11 +3,12 @@
<Components>
<c:Lifetime>
<Lifetime>0.08</Lifetime>
<Lifetime>0.080000000000000002</Lifetime>
</c:Lifetime>
<c:Fade>
<FadeTime>0.08</FadeTime>
<FadeTime>0.080000000000000002</FadeTime>
</c:Fade>
<c:NetworkComponent/>
<c:Transform/>
</Components>
@@ -20,10 +21,8 @@
<DiffuseTexture>Textures/Effects/NewRay5.png</DiffuseTexture>
<Color A="1" B="2.35294127" G="1.17647064" R="0"/>
<KeepRatio>true</KeepRatio>
<Linear>true</Linear>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
<Orientation X="0" Y="-1.57099998" Z="0"/>
<Scale X="1" Y="0.0250000004" Z="0"/>
</c:Transform>
@@ -38,10 +37,8 @@
<DiffuseTexture>Textures/Effects/NewRay5.png</DiffuseTexture>
<Color A="1" B="2.35294127" G="1.17647064" R="0"/>
<KeepRatio>true</KeepRatio>
<Linear>true</Linear>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
<Orientation X="0" Y="4.71218538" Z="3.14199996"/>
<Scale X="1" Y="0.0250000004" Z="0"/>
</c:Transform>
@@ -6,12 +6,14 @@
<Lifetime>2</Lifetime>
</c:Lifetime>
<c:ExplosionEffect>
<ColorByDistance>true</ColorByDistance>
<Velocity X="1.63300014" Y="0.0320000015" Z="0"/>
<ExplosionOrigin X="0" Y="0.0790000036" Z="-0.329000026"/>
<ExponentialAccelaration>true</ExponentialAccelaration>
<EndColor A="0" B="19.6078434" G="19.6078434" R="0"/>
<Velocity X="1.78000009" Y="0.0320000015" Z="0"/>
<ExplosionOrigin X="0" Y="0.142000005" Z="-0.659000039"/>
<EndColor A="0" B="19.6078434" G="0.00392156886" R="1.96078432"/>
<RandomnessScalar>1.3399996757507324</RandomnessScalar>
<Randomness>true</Randomness>
<ColorByDistance>true</ColorByDistance>
<ExponentialAccelaration>true</ExponentialAccelaration>
<ColorDistanceScalar>5.0899982452392578</ColorDistanceScalar>
</c:ExplosionEffect>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
@@ -2,6 +2,7 @@
<Entity name="SidearmWeapon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Shielded/>
<c:Model>
<Resource>Models/Weapons/Blue/SecondaryWeaponBlue.mesh</Resource>
</c:Model>
@@ -9,16 +10,37 @@
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Entity name="Muzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.0123999491" Y="0.102453232" Z="-0.273824364"/>
<Position X="-0.0169804785" Y="-0.0188358482" Z="-0.222064406"/>
</c:Transform>
</Components>
<Children/>
<Children>
<Entity name="WeaponMuzzleRay">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RaySideArmBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0.125075191" Z="-0.206788138"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="WeaponMuzzleFlash">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/MuzzleFlashSideArmBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.0240342002" Y="0.116005458" Z="-0.0419839472"/>
<Scale X="0.5" Y="0.5" Z="0.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
+38 -17
View File
@@ -11,17 +11,6 @@
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/Ray2Red.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0.105000004" Z="-0.256000012"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="AmmunitionHUD">
<Components>
<c:TextFieldReader>
@@ -38,8 +27,9 @@
<Entity name="AmmunitionHUDBackground">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="0.588235319" B="0" G="0" R="0"/>
</c:Sprite>
<c:Transform>
@@ -56,16 +46,16 @@
<Children>
<Entity name="MagazineAmmo">
<Components>
<c:TextFieldReader>
<ParentEntityName>Player</ParentEntityName>
<ComponentType>SidearmWeapon</ComponentType>
<Field>MagazineAmmo</Field>
</c:TextFieldReader>
<c:Text>
<Content>16</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
</c:Text>
<c:TextFieldReader>
<ParentEntityName>Player</ParentEntityName>
<ComponentType>SidearmWeapon</ComponentType>
<Field>MagazineAmmo</Field>
</c:TextFieldReader>
<c:Transform>
<Position X="0" Y="-0.00600000005" Z="0"/>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
@@ -92,6 +82,37 @@
</Entity>
</Children>
</Entity>
<Entity name="Muzzle">
<Components>
<c:Transform>
<Position X="0.197295129" Y="-0.116625182" Z="-0.709192753"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzleRay">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RaySideArmBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0" Z="-0.155046776"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="WeaponMuzzleFlash">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/MuzzleFlashSideArmBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Scale X="0.5" Y="0.5" Z="0.5"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -8,6 +8,7 @@
</c:BlendAdditive>
<c:Model>
<Resource>Models/Characters/Assault/FirstPersonAssaultBlue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform/>
</Components>
@@ -90,9 +91,10 @@
<c:Model>
<GlowIntensity>1.5</GlowIntensity>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="0.120748267" Y="-0.22843127" Z="-0.181454584"/>
<Position X="0.120748267" Y="-0.22843127" Z="-0.181454599"/>
<Orientation X="0.0102799674" Y="-0.00312504289" Z="0.0428140014"/>
</c:Transform>
</Components>
@@ -131,7 +133,7 @@
<EntityFile>Schema/Entities/RayAssaultBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00123506912" Y="-0.00209517847" Z="-0.681198895"/>
<Position X="0.00179657922" Y="-0.00304772682" Z="-0.334699303"/>
</c:Transform>
</Components>
<Children/>
@@ -2,6 +2,7 @@
<Entity name="AssaultWeapon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Shielded/>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
@@ -9,17 +10,6 @@
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ReloadSpawner">
<Components>
<c:Spawner>
@@ -29,6 +19,38 @@
</Components>
<Children/>
</Entity>
<Entity name="Muzzle">
<Components>
<c:Transform>
<Position X="0.00728808995" Y="0.0896582007" Z="-0.643795013"/>
<Orientation X="6.27600002" Y="0.00499999989" Z="0.00600000005"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzleFlash">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/MuzzleFlashBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="-8.41593719e-05" Y="-0.000816107844" Z="0.0612007342"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="WeaponMuzzleRay">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayAssaultBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.00179657922" Y="-0.00304772682" Z="-0.334699303"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -8,6 +8,7 @@
</c:BlendAdditive>
<c:Model>
<Resource>Models/Characters/Defender/FirstPersonDefenderBlue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform/>
</Components>
@@ -154,7 +155,7 @@
<InheritScale>true</InheritScale>
</c:BoneAttachment>
<c:Transform>
<Position X="0.0540262833" Y="-0.0954347998" Z="-0.225546911"/>
<Position X="0.0540262833" Y="-0.0954347998" Z="-0.225546926"/>
<Orientation X="0.00124507793" Y="0.077417776" Z="0.00737103401"/>
<Scale X="0.300000012" Y="0.300000042" Z="0.299999952"/>
</c:Transform>
@@ -244,9 +245,10 @@
</c:BoneAttachment>
<c:Model>
<Resource>Models/Weapons/Blue/DefenderWeaponBlue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="0.120748043" Y="-0.228436321" Z="-0.151475549"/>
<Position X="0.120748043" Y="-0.228436321" Z="-0.151475564"/>
<Orientation X="0.0102800643" Y="-0.00312487315" Z="0.0428144038"/>
</c:Transform>
</Components>
@@ -265,7 +267,7 @@
<Entity name="Muzzle">
<Components>
<c:Transform>
<Position X="0.137428522" Y="-0.145251781" Z="-0.590083241"/>
<Position X="0.119734153" Y="-0.145251781" Z="-0.564532101"/>
</c:Transform>
</Components>
<Children>
@@ -275,7 +277,7 @@
<EntityFile>Schema/Entities/RayDefenderBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.0180841181" Y="0.0252480619" Z="-0.663679719"/>
<Position X="0" Y="0" Z="-0.109966502"/>
</c:Transform>
</Components>
<Children/>
@@ -286,7 +288,7 @@
<EntityFile>Schema/Entities/MuzzleFlashBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.0201820824" Y="0.0212024488" Z="-0.0305794869"/>
<Position X="0.0201820824" Y="0" Z="0"/>
<Scale X="1.5" Y="1.5" Z="1"/>
</c:Transform>
</Components>
@@ -2,6 +2,7 @@
<Entity name="ThirdPersonWeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Shielded/>
<c:Model>
<Resource>Models/Weapons/Blue/DefenderWeaponBlue.mesh</Resource>
</c:Model>
@@ -9,17 +10,6 @@
</Components>
<Children>
<Entity name="WeaponMuzzle">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderRayBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.000284185546" Y="0.0318552479" Z="-0.193328083"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="ThirdPersonReloadSpawner">
<Components>
<c:Spawner>
@@ -29,6 +19,38 @@
</Components>
<Children/>
</Entity>
<Entity name="Muzzle">
<Components>
<c:Transform>
<Position X="-0.0100463303" Y="0.0624945536" Z="-0.372351319"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzleRay">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RayDefenderBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.0180841181" Y="0.0252480619" Z="-0.135249734"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="WeaponMuzzleFlash">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/MuzzleFlashBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0.0201820824" Y="0.0212024488" Z="-0.0305794869"/>
<Scale X="1.5" Y="1.5" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
@@ -8,6 +8,7 @@
</c:BlendAdditive>
<c:Model>
<Resource>Models/Characters/Assault/FirstPersonAssaultBlue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform/>
</Components>
@@ -183,6 +184,7 @@
<c:Model>
<GlowIntensity>1.2999999523162842</GlowIntensity>
<Resource>Models/Weapons/Blue/SecondaryWeaponBlue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="0.185786247" Y="-0.21622014" Z="-0.412707269"/>
@@ -204,7 +206,7 @@
<Entity name="Muzzle">
<Components>
<c:Transform>
<Position X="0.197295129" Y="-0.116625182" Z="-0.709192753"/>
<Position X="0.189540595" Y="-0.114737265" Z="-0.681462705"/>
</c:Transform>
</Components>
<Children>
@@ -213,9 +215,7 @@
<c:Spawner>
<EntityFile>Schema/Entities/RaySideArmBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0" Z="-0.155046776"/>
</c:Transform>
<c:Transform/>
</Components>
<Children/>
</Entity>
@@ -8,6 +8,7 @@
</c:BlendAdditive>
<c:Model>
<Resource>Models/Characters/Defender/FirstPersonDefenderBlue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform/>
</Components>
@@ -86,7 +87,7 @@
<BoneName>R_Ammo_Joint</BoneName>
</c:BoneAttachment>
<c:Transform>
<Position X="0.109812573" Y="-0.0832190216" Z="-0.373473197"/>
<Position X="0.109812573" Y="-0.0832190216" Z="-0.373473227"/>
<Orientation X="0.00118373742" Y="0.077411525" Z="0.00458352407"/>
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
</c:Transform>
@@ -183,9 +184,10 @@
<c:Model>
<GlowIntensity>1.5</GlowIntensity>
<Resource>Models/Weapons/Blue/SecondaryWeaponBlue.mesh</Resource>
<Shadow>false</Shadow>
</c:Model>
<c:Transform>
<Position X="0.18578662" Y="-0.216220587" Z="-0.382728696"/>
<Position X="0.18578662" Y="-0.216220587" Z="-0.382728726"/>
<Orientation X="0.010279973" Y="-0.00312555139" Z="0.0428142436"/>
</c:Transform>
</Components>
@@ -204,10 +206,19 @@
<Entity name="Muzzle">
<Components>
<c:Transform>
<Position X="0.196999997" Y="-0.116999999" Z="-0.668634355"/>
<Position X="0.192775041" Y="-0.117133088" Z="-0.647809923"/>
</c:Transform>
</Components>
<Children>
<Entity name="WeaponMuzzleRay">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RaySideArmBlue.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="WeaponMuzzleFlash">
<Components>
<c:Spawner>
@@ -219,17 +230,6 @@
</Components>
<Children/>
</Entity>
<Entity name="WeaponMuzzleRay">
<Components>
<c:Spawner>
<EntityFile>Schema/Entities/RaySideArmBlue.xml</EntityFile>
</c:Spawner>
<c:Transform>
<Position X="0" Y="0" Z="-0.155000001"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
+17 -17
View File
@@ -146,14 +146,14 @@ bool RayVsTriangle(const Ray& ray,
}
bool RayVsModel(const Ray& ray,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix)
{
for (int i = 0; i < modelIndices.size();) {
glm::vec3 v0 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
glm::vec3 v1 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
glm::vec3 v2 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
glm::vec3 v0 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
glm::vec3 v1 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
glm::vec3 v2 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
if (RayVsTriangle(ray, v0, v1, v2)) {
return true;
}
@@ -194,7 +194,7 @@ bool RayVsTriangle(const Ray& ray,
}
bool RayVsModel(const Ray& ray,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
float& outDistance,
@@ -204,9 +204,9 @@ bool RayVsModel(const Ray& ray,
outDistance = INFINITY;
bool hit = false;
for (int i = 0; i < modelIndices.size();) {
glm::vec3 v0 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
glm::vec3 v1 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
glm::vec3 v2 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix);
glm::vec3 v0 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
glm::vec3 v1 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
glm::vec3 v2 = TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
float dist = outDistance;
float u;
float v;
@@ -221,7 +221,7 @@ bool RayVsModel(const Ray& ray,
}
bool RayVsModel(const Ray& ray,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& outHitPosition)
@@ -548,7 +548,7 @@ BoxTriRes AABBvsTriangle(const AABB& box,
}
Output AABBvsTriangles(const AABB& box,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& boxVelocity,
@@ -565,9 +565,9 @@ Output AABBvsTriangles(const AABB& box,
glm::vec3 originalBoxVelocity(boxVelocity);
for (int i = 0; i < modelIndices.size(); ) {
std::array<glm::vec3, 3> triVertices = {
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix),
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix),
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]], modelMatrix)
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix),
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix),
TransformSystem::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix)
};
glm::vec3 outVec;
bool collideWithGround = isOnGround;
@@ -595,7 +595,7 @@ Output AABBvsTriangles(const AABB& box,
}
bool AABBvsTriangles(const AABB& box,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix,
glm::vec3& boxVelocity,
@@ -615,7 +615,7 @@ bool AABBvsTriangles(const AABB& box,
}
bool AABBvsTriangles(const AABB& box,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix)
{
@@ -633,7 +633,7 @@ bool AABBvsTriangles(const AABB& box,
}
Output AABBvsTrianglesWContainment(const AABB& box,
const std::vector<glm::vec3>& modelVertices,
const RawModel::Vertex* modelVertices,
const std::vector<unsigned int>& modelIndices,
const glm::mat4& modelMatrix)
{
@@ -741,7 +741,7 @@ boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<Enti
continue;
}
float u, v;
if (RayVsModel(ray, model->m_Vertices, model->m_Indices, TransformSystem::ModelMatrix(entityBox.Entity), outDistance, u, v)) {
if (RayVsModel(ray, model->Vertices(), model->m_RawModel->m_Indices, TransformSystem::ModelMatrix(entityBox.Entity), outDistance, u, v)) {
outIntersectPos = ray.Origin() + outDistance * ray.Direction();
return entityBox;
}
+6 -6
View File
@@ -41,15 +41,15 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
// Don't collide against invisible models.
continue;
}
Model* model;
RawModel* model;
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
try {
model = ResourceManager::Load<Model, true>(res);
model = ResourceManager::Load<RawModel, true>(res);
} catch (const std::exception&) {
continue;
}
float u, v;
hit = Collision::RayVsModel(ray, model->m_Vertices, model->m_Indices, TransformSystem::ModelMatrix(boxB.Entity), dist, u, v);
hit = Collision::RayVsModel(ray, model->Vertices(), model->m_Indices, TransformSystem::ModelMatrix(boxB.Entity), dist, u, v);
} else {
hit = Collision::RayVsAABB(ray, boxB, dist);
}
@@ -86,9 +86,9 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
// Don't collide against invisible models.
continue;
}
Model* model;
RawModel* model;
try {
model = ResourceManager::Load<Model, true>(boxB.Entity["Model"]["Resource"]);
model = ResourceManager::Load<RawModel, true>(boxB.Entity["Model"]["Resource"]);
} catch (const std::exception&) {
continue;
}
@@ -98,7 +98,7 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
bool isOnGround = (bool)cPhysics["IsOnGround"];
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
if (Collision::AABBvsTriangles(boxA, model->m_Vertices, model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
//Move the position to previous position if it is not moving in the xz-plane, else resolve with the resolution vector.
(Field<glm::vec3>)cTransform["Position"] += resolutionVector;
boxA = *Collision::EntityAbsoluteAABB(entity);
+3 -3
View File
@@ -10,11 +10,11 @@ void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapp
return;
}
Model* triggerModel = nullptr;
RawModel* triggerModel = nullptr;
glm::mat4 triggerModelMat;
if (triggerEntity.HasComponent("Model")) {
try {
triggerModel = ResourceManager::Load<Model, true>(triggerEntity["Model"]["Resource"]);
triggerModel = ResourceManager::Load<RawModel, true>(triggerEntity["Model"]["Resource"]);
triggerModelMat = TransformSystem::ModelMatrix(triggerEntity);
} catch (const std::exception&) {
}
@@ -38,7 +38,7 @@ void TriggerSystem::UpdateComponent(EntityWrapper& triggerEntity, ComponentWrapp
? Collision::Output::OutContained
: Collision::AABBvsTrianglesWContainment(
colliderBox,
triggerModel->m_Vertices,
triggerModel->Vertices(),
triggerModel->m_Indices,
triggerModelMat);
+51 -9
View File
@@ -8,6 +8,7 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
: System(params)
, m_Renderer(renderer)
, m_RenderFrame(renderFrame)
, m_CamVelocity(0.f)
{
m_EditorWorld = new World();
m_EditorWorldSystemPipeline = new SystemPipeline(m_EditorWorld, m_EventBroker, IsClient, IsServer);
@@ -83,14 +84,55 @@ void EditorSystem::Update(double dt)
}
}
m_EditorWorldSystemPipeline->Update(actualDelta);
ComponentWrapper& cameraTransform = m_EditorCamera["Transform"];
Field<glm::vec3> ori = cameraTransform["Orientation"];
ori.x(m_EditorCameraInputController->Rotation().x);
ori.y(m_EditorCameraInputController->Rotation().y);
Field<glm::vec3> pos = cameraTransform["Position"];
pos += m_EditorCameraInputController->Movement() * glm::inverse(glm::quat(ori)) * (float)actualDelta;
}
ComponentWrapper& cameraTransform = m_EditorCamera["Transform"];
Field<glm::vec3> ori = cameraTransform["Orientation"];
glm::vec3 newOri;
newOri.x = glm::mix(ori.x(), m_EditorCameraInputController->Rotation().x, 0.05f);
newOri.y = glm::mix(ori.y(), m_EditorCameraInputController->Rotation().y, 0.05f);
//ori.x(m_EditorCameraInputController->Rotation().x);
//ori.y(m_EditorCameraInputController->Rotation().y);
ori.x(newOri.x);
ori.y(newOri.y);
Field<glm::vec3> pos = cameraTransform["Position"];
auto move = m_EditorCameraInputController->Movement();
const float decreaseAccelleration = 3.75f;
const float increaseAccelleration = 5.25f;
if (move.x == 0) {
m_CamVelocity.x -= m_CamVelocity.x * (float)actualDelta * decreaseAccelleration;
//m_CamVelocity.x -= glm::sign(m_CamVelocity.x) * (float)actualDelta * decreaseAccelleration;
if (glm::abs(m_CamVelocity.x) < 0.01f) {
m_CamVelocity.x = 0;
}
} else {
m_CamVelocity.x += glm::sign(move.x) * (float)actualDelta * increaseAccelleration;
m_CamVelocity.x = glm::max(m_CamVelocity.x, -glm::abs(move.x));
m_CamVelocity.x = glm::min(m_CamVelocity.x, glm::abs(move.x));
}
if (move.y == 0) {
m_CamVelocity.y -= m_CamVelocity.y * (float)actualDelta * decreaseAccelleration;
//m_CamVelocity.y -= glm::sign(m_CamVelocity.y) * (float)actualDelta * decreaseAccelleration;
if (glm::abs(m_CamVelocity.y) < 0.01f) {
m_CamVelocity.y = 0;
}
} else {
m_CamVelocity.y += glm::sign(move.y) * (float)actualDelta * increaseAccelleration;
m_CamVelocity.y = glm::max(m_CamVelocity.y, -glm::abs(move.y));
m_CamVelocity.y = glm::min(m_CamVelocity.y, glm::abs(move.y));
}
if (move.z == 0) {
m_CamVelocity.z -= m_CamVelocity.z * (float)actualDelta * decreaseAccelleration;
//m_CamVelocity.z -= glm::sign(m_CamVelocity.z) * (float)actualDelta * decreaseAccelleration;
if (glm::abs(m_CamVelocity.z) < 0.01f) {
m_CamVelocity.z = 0;
}
} else {
m_CamVelocity.z += glm::sign(move.z) * (float)actualDelta * increaseAccelleration;
m_CamVelocity.z = glm::max(m_CamVelocity.z, -glm::abs(move.z));
m_CamVelocity.z = glm::min(m_CamVelocity.z, glm::abs(move.z));
}
pos += m_CamVelocity * glm::inverse(glm::quat(ori)) * (float)actualDelta;
}
void EditorSystem::Enable()
@@ -117,11 +159,11 @@ void EditorSystem::Enable()
void EditorSystem::Disable()
{
m_EditorCameraInputController->Disable();
//m_EditorCameraInputController->Disable();
m_EventBroker->Publish(Events::LockMouse());
Events::SetCamera e;
e.CameraEntity = m_ActualCamera;
m_EventBroker->Publish(e);
//m_EventBroker->Publish(e);
m_Enabled = false;
}
+10
View File
@@ -176,6 +176,9 @@ void Client::parseMessageType(Packet& packet)
case MessageType::KD:
parseKDEvent(packet);
break;
case MessageType::Win:
parseWin(packet);
break;
default:
break;
}
@@ -376,6 +379,13 @@ void Client::parseKDEvent(Packet & packet)
m_EventBroker->Publish(e);
}
void Client::parseWin(Packet& packet)
{
Events::Win e;
e.TeamThatWon = packet.ReadPrimitive<int>();
m_EventBroker->Publish(e);
}
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
{
for (auto field : componentInfo.FieldsInOrder) {
+3
View File
@@ -609,6 +609,9 @@ bool Server::OnWin(const Events::Win & e)
{
// Postpone the gameover reset
m_GameIsOver = true;
Packet winPacket = Packet(MessageType::Win);
winPacket.WritePrimitive(e.TeamThatWon);
reliableBroadcast(winPacket);
return true;
}
+373 -5
View File
@@ -6,6 +6,7 @@ AnimationSystem::AnimationSystem(SystemParams params)
EVENT_SUBSCRIBE_MEMBER(m_EAutoAnimationBlend, &AnimationSystem::OnAutoAnimationBlend);
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &AnimationSystem::OnEntityDeleted);
EVENT_SUBSCRIBE_MEMBER(m_ESetBlendWeight, &AnimationSystem::OnSetBlendWeight);
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &AnimationSystem::OnInputCommand);
}
void AnimationSystem::Update(double dt)
@@ -14,6 +15,19 @@ void AnimationSystem::Update(double dt)
CreateBlendTrees();
UpdateWeights(dt);
EntityWrapper aimEntity = m_World->GetFirstEntityByName("ThirdPerson").FirstChildByName("Aim");
(Field<double>)aimEntity["Animation"]["Time"] = glm::clamp((const double&)(Field<double>)aimEntity["Animation"]["Time"] + ((aimMove * 0.2f) * dt), 0.0, 1.0);
EntityWrapper aimTextEntity = m_World->GetFirstEntityByName("AimText");
if (aimMove > 0) {
(Field<std::string>)aimTextEntity["Text"]["Content"] = "Up";
} else if (aimMove < 0) {
(Field<std::string>)aimTextEntity["Text"]["Content"] = "Down";
} else {
(Field<std::string>)aimTextEntity["Text"]["Content"] = " ";
}
for(auto& autoBlendQueue : m_AutoBlendQueues) {
autoBlendQueue.second.UpdateTime(dt);
@@ -37,7 +51,7 @@ void AnimationSystem::CreateBlendTrees()
continue;;
}
Skeleton* skeleton = model->m_Skeleton;
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
continue;
}
@@ -79,7 +93,7 @@ void AnimationSystem::UpdateAnimations(double dt)
continue;
}
Skeleton* skeleton = model->m_Skeleton;
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
continue;
}
@@ -177,7 +191,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
return false;
}
Skeleton* skeleton = model->m_Skeleton;
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
LOG_ERROR("%s, RootNode skeleton invalid %s", e.NodeName, e.RootNode.Name().c_str());
return false;
@@ -300,7 +314,7 @@ bool AnimationSystem::OnEntityDeleted(Events::EntityDeleted& e)
return false;
}
Skeleton* skeleton = model->m_Skeleton;
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
return false;
}
@@ -331,7 +345,7 @@ bool AnimationSystem::OnSetBlendWeight(Events::SetBlendWeight& e)
return false;
}
Skeleton* skeleton = model->m_Skeleton;
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
return false;
}
@@ -353,3 +367,357 @@ bool AnimationSystem::OnSetBlendWeight(Events::SetBlendWeight& e)
}
}
bool AnimationSystem::OnInputCommand(Events::InputCommand& e)
{
EntityWrapper firstPerson = m_World->GetFirstEntityByName("FirstPerson");
EntityWrapper thirdPerson = m_World->GetFirstEntityByName("ThirdPerson");
EntityWrapper currentBlend = m_World->GetFirstEntityByName("CurrentBlend");
EntityWrapper queuedBlend = m_World->GetFirstEntityByName("QueuedBlend");
EntityWrapper MovementText = m_World->GetFirstEntityByName("MovementText");
if (e.Command == "ClearText") {
if (e.Value > 0) {
(Field<std::string>)currentBlend["Text"]["Content"] = " ";
(Field<std::string>)queuedBlend["Text"]["Content"] = " ";
}
}
if(e.Command == "Jump") {
if(e.Value > 0) {
(Field<std::string>)currentBlend["Text"]["Content"] = "Jump";
(Field<std::string>)queuedBlend["Text"]["Content"] = "Movement";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.2f;
blendEvent.NodeName = "Jump";
blendEvent.Start = true;
blendEvent.Restart = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventQueued;
blendEventQueued.RootNode = thirdPerson;
blendEventQueued.Delay = -0.1;
blendEventQueued.Duration = 0.3f;
blendEventQueued.NodeName = "MovementBlend";
blendEventQueued.AnimationEntity = thirdPerson.FirstChildByName("Jump");
m_EventBroker->Publish(blendEventQueued);
}
}
if (e.Command == "DashL") {
if (e.Value > 0) {
(Field<std::string>)currentBlend["Text"]["Content"] = "Dash Left";
(Field<std::string>)queuedBlend["Text"]["Content"] = "Movement";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.2f;
blendEvent.NodeName = "DashLeft";
blendEvent.Start = true;
blendEvent.Restart = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventQueued;
blendEventQueued.RootNode = thirdPerson;
blendEventQueued.Delay = -0.1;
blendEventQueued.Duration = 0.3f;
blendEventQueued.NodeName = "MovementBlend";
blendEventQueued.AnimationEntity = thirdPerson.FirstChildByName("DashLeft");
m_EventBroker->Publish(blendEventQueued);
}
}
if (e.Command == "DashR") {
if (e.Value > 0) {
(Field<std::string>)currentBlend["Text"]["Content"] = "Dash Right";
(Field<std::string>)queuedBlend["Text"]["Content"] = "Movement";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.2f;
blendEvent.NodeName = "DashRight";
blendEvent.Start = true;
blendEvent.Restart = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventQueued;
blendEventQueued.RootNode = thirdPerson;
blendEventQueued.Delay = -0.1;
blendEventQueued.Duration = 0.3f;
blendEventQueued.NodeName = "MovementBlend";
blendEventQueued.AnimationEntity = thirdPerson.FirstChildByName("DashRight");
m_EventBroker->Publish(blendEventQueued);
}
}
if (e.Command == "DashF") {
if (e.Value > 0) {
(Field<std::string>)currentBlend["Text"]["Content"] = "Dash Forward";
(Field<std::string>)queuedBlend["Text"]["Content"] = "Movement";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.2f;
blendEvent.NodeName = "DashForward";
blendEvent.Start = true;
blendEvent.Restart = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventQueued;
blendEventQueued.RootNode = thirdPerson;
blendEventQueued.Delay = -0.1;
blendEventQueued.Duration = 0.3f;
blendEventQueued.NodeName = "MovementBlend";
blendEventQueued.AnimationEntity = thirdPerson.FirstChildByName("DashForward");
m_EventBroker->Publish(blendEventQueued);
}
}
if (e.Command == "DashB") {
if (e.Value > 0) {
(Field<std::string>)currentBlend["Text"]["Content"] = "Dash Backward";
(Field<std::string>)queuedBlend["Text"]["Content"] = "Movement";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.2f;
blendEvent.NodeName = "DashBackward";
blendEvent.Start = true;
blendEvent.Restart = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventQueued;
blendEventQueued.RootNode = thirdPerson;
blendEventQueued.Delay = -0.1;
blendEventQueued.Duration = 0.3f;
blendEventQueued.NodeName = "MovementBlend";
blendEventQueued.AnimationEntity = thirdPerson.FirstChildByName("DashBackward");
m_EventBroker->Publish(blendEventQueued);
}
}
if (e.Command == "Right") {
if (e.Value > 0) {
(Field<std::string>)MovementText["Text"]["Content"] = "Right";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.3f;
blendEvent.NodeName = "Right";
blendEvent.Start = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventFP;
blendEventFP.RootNode = firstPerson;
blendEventFP.Duration = 0.3f;
blendEventFP.NodeName = "Run";
blendEventFP.Start = true;
m_EventBroker->Publish(blendEventFP);
} else if (e.Value < 0) {
(Field<std::string>)MovementText["Text"]["Content"] = "Left";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.3f;
blendEvent.NodeName = "Left";
blendEvent.Start = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventFP;
blendEventFP.RootNode = firstPerson;
blendEventFP.Duration = 0.3f;
blendEventFP.NodeName = "Run";
blendEventFP.Reverse = true;
blendEventFP.Start = true;
m_EventBroker->Publish(blendEventFP);
}
}else if (e.Command == "Up") {
if (e.Value > 0) {
(Field<std::string>)MovementText["Text"]["Content"] = "Forward";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.3f;
if (Crouch) {
blendEvent.NodeName = "Walk";
Events::AutoAnimationBlend blendEventFP;
blendEventFP.RootNode = firstPerson;
blendEventFP.Duration = 0.3f;
blendEventFP.NodeName = "Idle";
blendEventFP.Start = true;
m_EventBroker->Publish(blendEventFP);
} else {
blendEvent.NodeName = "Run";
Events::AutoAnimationBlend blendEventFP;
blendEventFP.RootNode = firstPerson;
blendEventFP.Duration = 0.3f;
blendEventFP.NodeName = "Run";
blendEventFP.Start = true;
m_EventBroker->Publish(blendEventFP);
}
blendEvent.Start = true;
m_EventBroker->Publish(blendEvent);
}else if (e.Value < 0) {
(Field<std::string>)MovementText["Text"]["Content"] = "Backward";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.3f;
if(Crouch) {
blendEvent.NodeName = "Walk";
Events::AutoAnimationBlend blendEventFP;
blendEventFP.RootNode = firstPerson;
blendEventFP.Duration = 0.3f;
blendEventFP.NodeName = "Idle";
blendEventFP.Start = true;
m_EventBroker->Publish(blendEventFP);
} else {
blendEvent.NodeName = "Run";
Events::AutoAnimationBlend blendEventFP;
blendEventFP.RootNode = firstPerson;
blendEventFP.Duration = 0.3f;
blendEventFP.NodeName = "Run";
blendEventFP.Reverse = true;
blendEventFP.Start = true;
m_EventBroker->Publish(blendEventFP);
}
blendEvent.Start = true;
blendEvent.Reverse = true;
m_EventBroker->Publish(blendEvent);
}
}
if (e.Command == "Idle"){
if (e.Value > 0) {
(Field<std::string>)MovementText["Text"]["Content"] = "Idle";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.5f;
blendEvent.NodeName = "Idle";
blendEvent.Start = true;
blendEvent.Reverse = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventFP;
blendEventFP.RootNode = firstPerson;
blendEventFP.Duration = 0.3f;
blendEventFP.NodeName = "Idle";
blendEventFP.Start = true;
m_EventBroker->Publish(blendEventFP);
}
}
if (e.Command == "Crouch") {
if (e.Value > 0) {
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.5f;
blendEvent.NodeName = "CrouchMovement";
blendEvent.Start = true;
blendEvent.Reverse = true;
m_EventBroker->Publish(blendEvent);
Crouch = true;
} else {
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.5f;
blendEvent.NodeName = "StandMovement";
blendEvent.Start = true;
blendEvent.Reverse = true;
m_EventBroker->Publish(blendEvent);
Crouch = false;
}
}
if (e.Command == "Aim") {
aimMove = e.Value;
}
if (e.Command == "Shoot") {
if (e.Value > 0) {
(Field<std::string>)currentBlend["Text"]["Content"] = "Fire";
(Field<std::string>)queuedBlend["Text"]["Content"] = "Idle";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.1f;
blendEvent.NodeName = "Fire";
blendEvent.Start = true;
blendEvent.Restart = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventFP;
blendEventFP.RootNode = firstPerson;
blendEventFP.Duration = 0.1f;
blendEventFP.NodeName = "Fire";
blendEventFP.Start = true;
blendEventFP.Restart = true;
m_EventBroker->Publish(blendEventFP);
}
}
if (e.Command == "Reload") {
if (e.Value > 0) {
(Field<std::string>)currentBlend["Text"]["Content"] = "Reload";
(Field<std::string>)queuedBlend["Text"]["Content"] = "Idle";
Events::AutoAnimationBlend blendEvent;
blendEvent.RootNode = thirdPerson;
blendEvent.Duration = 0.1f;
blendEvent.NodeName = "Reload";
blendEvent.Start = true;
blendEvent.Restart = true;
m_EventBroker->Publish(blendEvent);
Events::AutoAnimationBlend blendEventQ;
blendEventQ.RootNode = thirdPerson;
blendEventQ.Duration = 0.2f;
blendEventQ.Delay = -0.1;
blendEventQ.NodeName = "Fire";
blendEventQ.Start = false;
blendEventQ.Restart = true;
blendEventQ.AnimationEntity = thirdPerson.FirstChildByName("Reload");
m_EventBroker->Publish(blendEventQ);
Events::AutoAnimationBlend blendEventFP;
blendEventFP.RootNode = firstPerson;
blendEventFP.Duration = 0.1f;
blendEventFP.NodeName = "Reload";
blendEventFP.Start = true;
blendEventFP.Restart = true;
m_EventBroker->Publish(blendEventFP);
Events::AutoAnimationBlend blendEventFPQ;
blendEventFPQ.RootNode = firstPerson;
blendEventFPQ.Duration = 0.2f;
blendEventFPQ.Delay = -0.1;
blendEventFPQ.NodeName = "Fire";
blendEventFPQ.Start = false;
blendEventFPQ.Restart = true;
blendEventFPQ.AnimationEntity = thirdPerson.FirstChildByName("Reload");
m_EventBroker->Publish(blendEventFPQ);
}
}
return true;
}
+3 -3
View File
@@ -22,7 +22,7 @@ void AutoBlendQueue::Insert(AutoBlendJob autoBlendJob)
return;
}
Skeleton* skeleton = model->m_Skeleton;
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
return;
}
@@ -130,7 +130,7 @@ bool AutoBlendQueue::HasActiveBlendJob()
return HasActiveBlendJob();
}
Skeleton* skeleton = model->m_Skeleton;
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
m_BlendQueue.pop_front();
return HasActiveBlendJob();
@@ -173,7 +173,7 @@ std::shared_ptr<BlendTree> AutoBlendQueue::GetBlendTree()
return nullptr;
}
Skeleton* skeleton = model->m_Skeleton;
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
return nullptr;
}
@@ -26,7 +26,7 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
return;
}
Skeleton* skeleton = model->m_Skeleton;
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if(skeleton == nullptr) {
return;
+17 -3
View File
@@ -332,6 +332,14 @@ void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
glClearStencil(0x00);
glClear(GL_STENCIL_BUFFER_BIT);
//Fill depth buffer
state->Enable(GL_STENCIL_TEST);
state->StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state->StencilFunc(GL_ALWAYS, 1, 0xFF);
state->StencilMask(0xFF);
state->DepthMask(GL_FALSE);
//DrawToDepthStencilBuffer(scene.Jobs.ShieldObjects, scene);
state->DepthMask(GL_TRUE);
//Draw Opaque shielded objects
state->Disable(GL_STENCIL_TEST);
@@ -346,10 +354,10 @@ void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
GLERROR("OpaqueObjects");
//state->Disable(GL_STENCIL_TEST);
//Draw Transparen objects
//Draw Transparen Shielded objects
state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
DrawModelRenderQueuesWithShieldCheck(scene.Jobs.TransparentObjects, scene); //might need changing
GLERROR("Transparent objects");
GLERROR("Shielded Transparent objects");
//Generate blur texture.
delete state;
@@ -371,6 +379,12 @@ void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
} else {
stateSprite = new DrawFinalPassState(m_FinalPassFrameBuffer->GetHandle());
}
//Draw Transparen objects
//state->BlendFunc(GL_ONE, GL_ONE);
//state->StencilFunc(GL_EQUAL, 1, 0xFF);
//DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
GLERROR("TransparentObjects");
//state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
stateSprite->Enable(GL_DEPTH_TEST);
//stateSprite->AlphaFunc(GL_GEQUAL, 0.05f);
//stateSprite->Enable(GL_ALPHA_TEST);
@@ -624,7 +638,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else if (modelJob->Skeleton != nullptr) {
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
+12 -24
View File
@@ -3,9 +3,9 @@
Model::Model(std::string fileName)
{
//Try loading the model asyncronously, if it throws any exceptions then let it propagate back to caller.
auto rawModel = ResourceManager::Load<RawModel, true>(fileName);
m_RawModel = ResourceManager::Load<RawModel, true>(fileName);
for (auto& materialProperty : rawModel->m_Materials) {
for (auto& materialProperty : m_RawModel->m_Materials) {
switch (materialProperty.type) {
case RawModel::MaterialType::SingleTextures:
{
@@ -46,11 +46,11 @@ Model::Model(std::string fileName)
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, rawModel->NumVertices() * rawModel->VertexSize(), rawModel->Vertices(), GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, m_RawModel->NumVertices() * m_RawModel->VertexSize(), m_RawModel->Vertices(), GL_STATIC_DRAW);
glGenBuffers(1, &ElementBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ElementBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, rawModel->Indices().size() * sizeof(unsigned int), rawModel->Indices().data(), GL_STATIC_DRAW);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_RawModel->m_Indices.size() * sizeof(unsigned int), &m_RawModel->m_Indices[0], GL_STATIC_DRAW);
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
@@ -58,7 +58,7 @@ Model::Model(std::string fileName)
glBindBuffer(GL_ARRAY_BUFFER, buffer);
std::vector<int> structSizes;
if (rawModel->IsSkinned()) {
if (m_RawModel->IsSkinned()) {
structSizes = { 3, 3, 3, 3, 2, 4, 4 };
} else {
structSizes = { 3, 3, 3, 3, 2 };
@@ -77,7 +77,7 @@ Model::Model(std::string fileName)
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
if (rawModel->IsSkinned()) {
if (m_RawModel->IsSkinned()) {
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
}
@@ -89,7 +89,7 @@ Model::Model(std::string fileName)
glEnableVertexAttribArray(2);
glEnableVertexAttribArray(3);
glEnableVertexAttribArray(4);
if (rawModel->IsSkinned()) {
if (m_RawModel->IsSkinned()) {
glEnableVertexAttribArray(5);
glEnableVertexAttribArray(6);
}
@@ -99,29 +99,17 @@ Model::Model(std::string fileName)
glm::vec3 mini(INFINITY);
glm::vec3 maxi(-INFINITY);
for (unsigned int i = 0; i < rawModel->NumVertices(); i++) {
const auto& v = rawModel->Vertices()[i];
for (unsigned int i = 0; i < m_RawModel->NumVertices(); i++) {
const auto& v = m_RawModel->Vertices()[i];
mini = glm::min(mini, v.Position);
maxi = glm::max(maxi, v.Position);
}
m_Box = AABB(mini, maxi);
m_Skeleton = rawModel->m_Skeleton;
m_Materials = rawModel->m_Materials;
m_Indices = rawModel->CollisionIndices();
m_IsSkinned = rawModel->IsSkinned();
// Copy vertex positions for collisions later
m_Vertices = rawModel->CollisionVertices();
ResourceManager::Release("RawModel", fileName);
}
Model::~Model()
{
if (m_Skeleton != nullptr) {
delete m_Skeleton;
}
for (auto material : m_Materials) {
delete material.material;
}
}
+1 -1
View File
@@ -115,7 +115,7 @@ void PickingPass::Draw(RenderScene& scene)
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else if (modelJob->Skeleton != nullptr) {
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
+9 -86
View File
@@ -11,7 +11,6 @@ RawModelCustom::RawModelCustom(std::string fileName)
ReadMeshFile(fileName);
ReadMaterialFile(fileName);
ReadAnimationFile(fileName);
ReadCollisionFile(fileName);
}
void RawModelCustom::ReadMeshFile(std::string filePath)
@@ -72,11 +71,11 @@ void RawModelCustom::ReadVertices(std::size_t& offset, char* fileData, const uns
memcpy(&m_SkinedVertices[0], fileData + offset, m_SkinedVertices.size() * sizeof(SkinedVertex));
offset += m_SkinedVertices.size() * sizeof(SkinedVertex);
} else {
if (offset + m_Vertices.size() * sizeof(RenderVertex) > fileByteSize) {
if (offset + m_Vertices.size() * sizeof(Vertex) > fileByteSize) {
throw Resource::FailedLoadingException("Reading vertices failed");
}
memcpy(&m_Vertices[0], fileData + offset, m_Vertices.size() * sizeof(RenderVertex));
offset += m_Vertices.size() * sizeof(RenderVertex);
memcpy(&m_Vertices[0], fileData + offset, m_Vertices.size() * sizeof(Vertex));
offset += m_Vertices.size() * sizeof(Vertex);
}
#else
#endif
@@ -492,90 +491,14 @@ void RawModelCustom::ReadAnimationKeyFrame(std::size_t& offset, char* fileData,
}
void RawModelCustom::ReadCollisionFile(std::string filePath) {
char* fileData;
filePath += ".colli";
std::ifstream in(filePath.c_str(), std::ios_base::binary | std::ios_base::ate);
if (!in.is_open()) {
return;
}
unsigned int fileByteSize = static_cast<unsigned int>(in.tellg());
in.seekg(0, std::ios_base::beg);
fileData = new char[fileByteSize];
in.read(fileData, fileByteSize);
in.close();
std::size_t offset = 0;
if (fileByteSize > 0) {
ReadCollisionFileData(offset, fileData, fileByteSize);
}
hasCollisionMesh = true;
delete[] fileData;
}
const std::vector<glm::vec3>& RawModelCustom::CollisionVertices() {
if (hasCollisionMesh) {
return m_CollisionVertices;
}
else if (hasSkin) {
// We don't do collisions against skinned meshes now.
m_CollisionVertices = std::vector<glm::vec3>();
return m_CollisionVertices;
}
else {
return ConstructCollisionList();
}
};
void RawModelCustom::ReadCollisionFileData(std::size_t& offset, char* fileData, const unsigned int& fileByteSize){
m_CollisionVertices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
offset += sizeof(unsigned int);
m_CollisionIndices.resize(static_cast<std::size_t>(*(unsigned int*)(fileData + offset)));
offset += sizeof(unsigned int);
if (offset + m_CollisionVertices.size() * sizeof(glm::vec3) > fileByteSize) {
throw Resource::FailedLoadingException("Reading collision vertices failed");
}
memcpy(&m_CollisionVertices[0], fileData + offset, m_CollisionVertices.size() * sizeof(glm::vec3));
offset += m_CollisionVertices.size() * sizeof(glm::vec3);
if (offset + m_CollisionIndices.size() * sizeof(unsigned int) > fileByteSize) {
throw Resource::FailedLoadingException("Reading collision indices failed");
}
memcpy(&m_CollisionIndices[0], fileData + offset, m_CollisionIndices.size() * sizeof(unsigned int));
offset += m_CollisionIndices.size() * sizeof(unsigned int);
}
const std::vector<glm::vec3>& RawModelCustom::ConstructCollisionList()
{
if (!hasCollisionMesh && m_CollisionVertices.size() == 0) {
if (hasSkin) {
m_CollisionVertices.reserve(m_SkinedVertices.size());
for (const auto& vertex : m_SkinedVertices) {
m_CollisionVertices.push_back(vertex.Position);
}
} else {
m_CollisionVertices.reserve(m_Vertices.size());
for (const auto& vertex : m_Vertices) {
m_CollisionVertices.push_back(vertex.Position);
}
}
}
return m_CollisionVertices;
}
RawModelCustom::~RawModelCustom()
{
// Ownership of skeleton and materials get transferred to Model
// if (m_Skeleton != nullptr) {
// delete m_Skeleton;
// }
//for (auto material : m_Materials) {
// delete material.material;
//}
if (m_Skeleton != nullptr) {
delete m_Skeleton;
}
for (auto material : m_Materials) {
delete material.material;
}
}
#endif
+6 -1
View File
@@ -19,6 +19,7 @@ void Renderer::Initialize()
{
m_SSAO_Quality = m_Config->Get<int>("SSAO.Quality", 0);
m_GLOW_Quality = m_Config->Get<int>("GLOW.Quality", 0);
m_MSAA_Level = m_Config->Get<unsigned int>("MSAA.Level", 0);
InitializeWindow();
InitializeRenderPasses();
@@ -75,7 +76,7 @@ void Renderer::InitializeWindow()
//glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);
//glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate);
glfwWindowHint(GLFW_DECORATED, false);
glfwWindowHint(GLFW_AUTO_ICONIFY, false);
//glfwWindowHint(GLFW_AUTO_ICONIFY, false);
}
//glfwWindowHint(GLFW_SAMPLES, 8);
@@ -167,17 +168,21 @@ void Renderer::Draw(RenderFrame& frame)
{
GLERROR("PRE");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#ifdef DEBUG
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0Gaussian\0Picking\0Ambient Occlusion\0Combined Scene Texture\0Full Blurred Texture");
ImGui::Combo("CubeMap", &m_CubeMapTexture, "Nevada(512)\0Sky(1024)");
#endif
if(m_CubeMapTexture == 0) {
m_CubeMapPass->LoadTextures("Nevada");
} else if (m_CubeMapTexture == 1) {
m_CubeMapPass->LoadTextures("Sky");
}
#ifdef DEBUG
ImGui::SliderInt("SSAO Quality", &m_SSAO_Quality, 0, 3);
ImGui::SliderInt("Glow Quality", &m_GLOW_Quality, 0, 3);
ImGui::SliderInt("MSAA Level", (int*)&m_MSAA_Level, 0, 16);
#endif
m_SSAOPass->ChangeQuality(m_SSAO_Quality);
m_DrawBloomPass->ChangeQuality(m_GLOW_Quality);
m_DrawFinalPass->setMSAA(m_MSAA_Level);
+3 -1
View File
@@ -25,11 +25,13 @@ ShadowPass::~ShadowPass()
void ShadowPass::DebugGUI()
{
#ifdef DEBUG
ImGui::Checkbox("EnableShadows", &m_EnableShadows);
ImGui::DragFloat2("ShadowMapNearFar", m_NearFarPlane, 1.f, -1000.f, 1000.f);
ImGui::DragFloat("ShadowClippingWeight", &m_SplitWeight, 0.001f, 0.f, 1.f);
ImGui::Checkbox("ShadowTransparentObjects", &m_TransparentObjects);
ImGui::Checkbox("ShadowOnTextureAlphas", &m_TexturedShadows);
#endif
}
void ShadowPass::InitializeCameras(RenderScene & scene)
@@ -259,7 +261,7 @@ void ShadowPass::Draw(RenderScene & scene)
std::vector<glm::mat4> frameBones;
if (modelJob->BlendTree != nullptr) {
frameBones = modelJob->BlendTree->GetFinalPose();
} else if (modelJob->Skeleton != nullptr) {
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
+13
View File
@@ -417,6 +417,14 @@ bool SoundManager::OnSetCamera(const Events::SetCamera& e)
alSourcei(m_CurrentBGMCombo->ALsource, AL_LOOPING, 1);
setGain(m_CurrentBGMCombo, 0);
playSound(m_CurrentBGMCombo);
} else if (m_World->HasComponent(e.CameraEntity.ID, "EndScreen")) {
float timeOffset = getTimeOffsetSeconds(m_CurrentBGM);
stopSound(m_CurrentBGM);
m_CurrentBGM = createSource("Audio/BGM/Layer3.wav");
m_CurrentBGM->Type = SoundType::BGM;
alSourcei(m_CurrentBGM->ALsource, AL_LOOPING, 1);
playSound(m_CurrentBGM);
setTimeOffsetSeconds(m_CurrentBGM, timeOffset);
}
}
@@ -477,6 +485,11 @@ float SoundManager::getTimeOffsetSeconds(Source* source)
return time;
}
void SoundManager::setTimeOffsetSeconds(Source * source, float timeOffset)
{
alSourcef(source->ALsource, AL_SEC_OFFSET, timeOffset);
}
void SoundManager::initOpenAL()
{
// Initialize OpenAL
+12
View File
@@ -202,12 +202,18 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
if (addSpeed > 0) {
static float accel = 15.f;
#ifdef DEBUG
ImGui::InputFloat("accel", &accel);
#endif
static float airAccel = 0.5f;
#ifdef DEBUG
ImGui::InputFloat("airAccel", &airAccel);
#endif
float actualAccel = isOnGround ? accel : airAccel;
static float surfaceFriction = 5.f;
#ifdef DEBUG
ImGui::InputFloat("surfaceFriction", &surfaceFriction);
#endif
float accelerationSpeed = actualAccel * (float)dt * wishSpeed * surfaceFriction;
//if doubleTapped do Assault Dash - but only boost maximum 50.0f
float doubleTapDashBoost = controller->AssaultDashDoubleTapped() ? 40.0f : 1.0f;
@@ -220,7 +226,9 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
accelerationSpeed *= (double)player["SprintAbility"]["StrengthOfEffect"];
}
velocity += accelerationSpeed * (glm::vec3)wishDirection;
#ifdef DEBUG
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x(), velocity.y(), velocity.z(), glm::length((glm::vec3)velocity));
#endif
}
if (isOnGround) {
@@ -336,10 +344,14 @@ void PlayerMovementSystem::updateVelocity(EntityWrapper player, double dt)
// Ground friction
float speed = glm::length((glm::vec3)velocity);
static float groundFriction = 7.f;
#ifdef DEBUG
ImGui::InputFloat("groundFriction", &groundFriction);
#endif
static float airFriction = 2.f;
#ifdef DEBUG
ImGui::InputFloat("airFriction", &airFriction);
#endif
float friction = isOnGround ? groundFriction : airFriction;
if (speed > 0) {
float drop = speed * friction * (float)dt;
+3
View File
@@ -87,6 +87,9 @@ bool SoundSystem::OnPlayerDamage(const Events::PlayerDamage & e)
if (!e.Victim.Valid() || !e.Inflictor.Valid()) {
return false;
}
if (e.Victim.ID != LocalPlayer.ID) {
return false;
}
auto victimTeam = m_World->GetComponent(e.Victim.ID, "Team");
auto inflictorTeam = m_World->GetComponent(e.Inflictor.ID, "Team");
if ((int)victimTeam["Team"] == (int)inflictorTeam["Team"]) {
+3 -3
View File
@@ -112,15 +112,15 @@ bool SpawnerSystem::spawnedEntityIsColliding(EntityWrapper spawnedEntity, Entity
if (!spawnedBox.Entity.HasComponent("Model")) {
return true;
}
Model* model = nullptr;
RawModel* model = nullptr;
try {
model = ResourceManager::Load<Model, true>(otherEntity["Model"]["Resource"]);
model = ResourceManager::Load<RawModel, true>(otherEntity["Model"]["Resource"]);
} catch (const std::exception&) {
}
if (model != nullptr && Collision::AABBvsTriangles(
spawnedBox,
model->m_Vertices,
model->Vertices(),
model->m_Indices,
TransformSystem::ModelMatrix(otherEntity))) {
return true;
@@ -14,7 +14,19 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
// Start reloading automatically if at 0 mag ammo
Field<int> magAmmo = cWeapon["MagazineAmmo"];
if (m_ConfigAutoReload && magAmmo <= 0) {
OnReload(cWeapon, wi);
//OnReload(cWeapon, wi);
// Send an input command instead of reloading immediately so the server
// has a chance to catch up.
if (IsClient) {
Events::InputCommand e;
e.Player = wi.Player;
e.PlayerID = -1;
e.Command = "Reload";
e.Value = 1;
m_EventBroker->Publish(e);
e.Value = 0;
m_EventBroker->Publish(e);
}
}
// Only start reloading once we're done firing
@@ -235,7 +247,8 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
float distance = traceRayDistance(origin, direction);
EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner, tracerSpawner);
if (ray.Valid()) {
((Field<glm::vec3>)ray["Transform"]["Scale"]).z(distance);
((Field<glm::vec3>)ray["Transform"]["Scale"]).x(distance);
((Field<glm::vec3>)ray["Transform"]["Position"]).z(-distance/2.f);
}
}
//MuzzleFlash
@@ -395,9 +395,12 @@ void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo&
glm::vec3 muzzlePosition = TransformSystem::AbsolutePosition(muzzle);
glm::quat muzzleOrientation = TransformSystem::AbsoluteOrientation(muzzle);
rayOrigin = muzzlePosition;
glm::vec3 muzzleToHit = hitPosition - muzzlePosition;
rayOrigin = muzzlePosition + (muzzleToHit/2.f);
glm::vec3 lookVector = glm::normalize(-muzzleToHit);
float pitch = std::asin(-lookVector.y);
float yaw = std::atan2(lookVector.x, lookVector.z);
@@ -459,8 +462,8 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w
}
// Temp hit decal
EntityWrapper hit = ResourceManager::Load<EntityFile>("Schema/Entities/HitTest.xml")->MergeInto(m_World);
(Field<glm::vec3>)hit["Transform"]["Position"] = pick.Position;
// EntityWrapper hit = ResourceManager::Load<EntityFile>("Schema/Entities/HitTest.xml")->MergeInto(m_World);
// (Field<glm::vec3>)hit["Transform"]["Position"] = pick.Position;
// Don't let us shoot ourselves in the foot somehow
if (victim == LocalPlayer) {
@@ -477,12 +480,17 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w
// Check for friendly fire
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) {
// TODO: Ammo sharing
// Give boost
Events::PlayerDamage ePlayerDamage;
ePlayerDamage.Inflictor = wi.Player;
ePlayerDamage.Victim = victim;
ePlayerDamage.Damage = 0;
m_EventBroker->Publish(ePlayerDamage);
continue;
}
damageSum[victim] += pelletDamage;
((Field<glm::vec4>)hit["Model"]["Color"]).z(1.f);
// ((Field<glm::vec4>)hit["Model"]["Color"]).z(1.f);
}
// Deal damage!
@@ -493,7 +501,6 @@ void DefenderWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& w
ePlayerDamage.Victim = kv.first;
ePlayerDamage.Damage = kv.second;
m_EventBroker->Publish(ePlayerDamage);
LOG_DEBUG("Dealt %f damage to #%i", kv.second, kv.first.ID);
}
}
@@ -223,15 +223,16 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
return;
}
//Tracer
// Tracer
EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzleRay");
if (tracerSpawner.Valid()) {
glm::vec3 origin = TransformSystem::AbsolutePosition(tracerSpawner);
glm::vec3 direction = TransformSystem::AbsoluteOrientation(tracerSpawner) * glm::vec3(0, 0, -1);
glm::vec3 direction = glm::quat(TransformSystem::AbsoluteOrientationEuler(tracerSpawner)) * glm::vec3(0, 0, -1);
float distance = traceRayDistance(origin, direction);
EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner, tracerSpawner);
if (ray.Valid()) {
((Field<glm::vec3>)ray["Transform"]["Scale"]).z(distance);
((Field<glm::vec3>)ray["Transform"]["Scale"]).x(distance);
((Field<glm::vec3>)ray["Transform"]["Position"]).z(-distance/2.f);
}
}
+5 -22
View File
@@ -5,7 +5,7 @@ Export::Export()
}
bool Export::Meshes(std::string pathName, bool selectedOnly, bool isCollision)
bool Export::Meshes(std::string pathName, bool selectedOnly)
{
MStatus status;
if (pathName.empty()) {
@@ -92,14 +92,8 @@ bool Export::Meshes(std::string pathName, bool selectedOnly, bool isCollision)
Objects.append(node);
}
}
GetMeshData(Objects, isCollision);
if (!isCollision) {
WriteMeshData(pathName);
} else {
WriteCollisionData(pathName);
}
GetMeshData(Objects);
WriteMeshData(pathName);
MGlobal::displayInfo(MString() + "Enabling IKSolvers");
status = MGlobal::executeCommand("doEnableNodeItems true all;");
if (status != MS::kSuccess) {
@@ -150,9 +144,9 @@ bool Export::Animations(std::string pathName, std::vector<AnimationInfo> animInf
return true;
}
bool Export::GetMeshData(MObjectArray object, bool collision)
bool Export::GetMeshData(MObjectArray object)
{
meshes = m_MeshHandler.GetMeshData(object, collision);
meshes = m_MeshHandler.GetMeshData(object);
return true;
}
@@ -191,17 +185,6 @@ void Export::WriteMeshData(std::string pathName)
m_MeshFile.CloseFiles();
}
void Export::WriteCollisionData(std::string pathName) {
m_ColliFile.ASCIIFilePath(pathName + "_colli.txt");
m_ColliFile.binaryFilePath(pathName + ".colli");
m_ColliFile.OpenFiles();
m_ColliFile.writeToFiles((OutputData*)&meshes);
m_ColliFile.CloseFiles();
}
void Export::WriteAnimData(std::string pathName)
{
if (allBindPoses.size() > 0) {
+2 -4
View File
@@ -22,19 +22,18 @@ public:
int End;
};
bool Meshes(std::string pathName, bool selectedOnly = false, bool isCollision = false);
bool Meshes(std::string pathName, bool selectedOnly = false);
bool Materials(std::string pathName);
bool Animations(std::string pathName, std::vector<AnimationInfo> animInfo);
private:
bool GetMeshData(MObjectArray object, bool collision);
bool GetMeshData(MObjectArray object);
bool GetMaterialData();
bool GetAnimationData(AnimationInfo info);
void WriteMeshData(std::string pathName);
void WriteAnimData(std::string pathName);
void WriteMaterialData(std::string pathName);
void WriteCollisionData(std::string pathName);
Material m_MaterialHandler;
Skeleton m_SkeletonHandler;
@@ -45,7 +44,6 @@ private:
WriteToFile m_MeshFile;
WriteToFile m_AnimFile;
WriteToFile m_MtrlFile;
WriteToFile m_ColliFile;
//Mesh Data
Mesh meshes;
+30 -35
View File
@@ -25,7 +25,6 @@ Menu::Menu(QDialog* dialog)
m_ExportSelectedButton = new QCheckBox(tr("&Export Selected"));
m_ExportAnimationsButton = new QCheckBox(tr("&Export Animations"));
m_ExportMaterialButton = new QCheckBox(tr("&Export Material"));;
m_IsCollision = new QCheckBox(tr("&Export as collision mesh"));
m_ExportAnimationsButton->setChecked(true);
m_ExportMaterialButton->setChecked(true);
@@ -33,7 +32,6 @@ Menu::Menu(QDialog* dialog)
vbox->addWidget(m_ExportSelectedButton);
vbox->addWidget(m_ExportAnimationsButton);
vbox->addWidget(m_ExportMaterialButton);
vbox->addWidget(m_IsCollision);
vbox->addStretch(1);
optionsBox->setLayout(vbox);
@@ -48,7 +46,6 @@ Menu::Menu(QDialog* dialog)
connect(m_ExportSelectedButton, SIGNAL(clicked(bool)), this, SLOT(NULL));
connect(m_ExportAnimationsButton, SIGNAL(clicked(bool)), this, SLOT(NULL));
connect(m_ExportMaterialButton, SIGNAL(clicked(bool)), this, SLOT(NULL));
connect(m_IsCollision, SIGNAL(clicked(bool)), this, SLOT(NULL));
// Creating several layouts, adding widgets & adding them to one layout in the end
QHBoxLayout* topLayout = new QHBoxLayout;
@@ -166,42 +163,40 @@ void Menu::RemoveClipClicked(bool)
void Menu::ExportAll(bool)
{
if (m_ExportPath->text().isEmpty()) {
MGlobal::displayError(MString() + "Please select a folder.");
return;
}
if (m_ExportPath->text().isEmpty()) {
MGlobal::displayError(MString() + "Please select a folder.");
return;
}
//Export meshes
if (!m_Export.Meshes(m_ExportPath->text().toLocal8Bit().constData(), m_ExportSelectedButton->isChecked(), m_IsCollision->isChecked())) {
MGlobal::displayError(MString() + "Could not export mesh");
return;
}
//Export meshes
if (!m_Export.Meshes(m_ExportPath->text().toLocal8Bit().constData(), m_ExportSelectedButton->isChecked())) {
MGlobal::displayError(MString() + "Could not export mesh");
return;
}
if (!m_IsCollision->isChecked()){
if (m_ExportMaterialButton->isChecked()) {
if (!m_Export.Materials(m_ExportPath->text().toLocal8Bit().constData())) {
MGlobal::displayError(MString() + "Could not export materials");
return;
}
}
if (m_ExportMaterialButton->isChecked()) {
if (!m_Export.Materials(m_ExportPath->text().toLocal8Bit().constData())) {
MGlobal::displayError(MString() + "Could not export materials");
return;
}
}
std::vector<Export::AnimationInfo> animations;
for (unsigned int i = 0; i < m_AnimationClipName.size(); i++) {
Export::AnimationInfo thisClip;
thisClip.Name = std::string(m_AnimationClipName[i]->text().toLocal8Bit().constData());
thisClip.Start = m_StartFrameLines[i]->text().toInt();
thisClip.End = m_EndFrameLines[i]->text().toInt();
std::vector<Export::AnimationInfo> animations;
for (unsigned int i = 0; i < m_AnimationClipName.size(); i++) {
Export::AnimationInfo thisClip;
thisClip.Name = std::string(m_AnimationClipName[i]->text().toLocal8Bit().constData());
thisClip.Start = m_StartFrameLines[i]->text().toInt();
thisClip.End = m_EndFrameLines[i]->text().toInt();
animations.push_back(thisClip);
}
if (m_ExportAnimationsButton->isChecked()) {
//Export Animations
if (!m_Export.Animations(m_ExportPath->text().toLocal8Bit().constData(), animations)) {
MGlobal::displayError(MString() + "Could not export animations");
return;
}
}
}
animations.push_back(thisClip);
}
if (m_ExportAnimationsButton->isChecked()) {
//Export Animations
if (!m_Export.Animations(m_ExportPath->text().toLocal8Bit().constData(), animations)) {
MGlobal::displayError(MString() + "Could not export animations");
return;
}
}
}
void Menu::CancelClicked(bool)
-1
View File
@@ -66,7 +66,6 @@ private:
QCheckBox* m_ExportSelectedButton = nullptr;
QCheckBox* m_ExportAnimationsButton = nullptr;
QCheckBox* m_ExportMaterialButton = nullptr;
QCheckBox* m_IsCollision = nullptr;
QLineEdit* m_ExportPath = nullptr;
QFileDialog* m_FileDialog = nullptr;
+58 -62
View File
@@ -94,37 +94,33 @@ MeshClass::MeshClass()
// return weightMap;
//}
Mesh MeshClass::GetMeshData(MObjectArray object, bool collision)
Mesh MeshClass::GetMeshData(MObjectArray object)
{
MS status;
Mesh newMesh;
newMesh.isCollison = collision;
vector<VertexLayout>& vertexList = newMesh.Vertices;
map<string, vector<int>>& indexLists = newMesh.Indices;
for (int ObjectID = 0; ObjectID < object.length(); ObjectID++) {
if (!object[ObjectID].hasFn(MFn::kMesh))
continue;
MObject node = object[ObjectID];
MFnDependencyNode thisNode(node);
MPlugArray connections;
thisNode.findPlug("inMesh").connectedTo(connections, true, true);
MPlug weightList, weights;
MObject weightListObject;
for (unsigned int i = 0; i < connections.length(); i++) {
if (connections[i].node().apiType() == MFn::kSkinClusterFilter) {
MFnSkinCluster skinCluster(connections[i].node());
weightList = skinCluster.findPlug("weightList", &status);
weightListObject = weightList.attribute();
weights = skinCluster.findPlug("weights");
newMesh.hasSkin = true;
break;
}
}
if (!collision) {
for (unsigned int i = 0; i < connections.length(); i++) {
if (connections[i].node().apiType() == MFn::kSkinClusterFilter) {
MFnSkinCluster skinCluster(connections[i].node());
weightList = skinCluster.findPlug("weightList", &status);
weightListObject = weightList.attribute();
weights = skinCluster.findPlug("weights");
newMesh.hasSkin = true;
break;
}
}
}
// In here, we retrieve triangulated polygons from the mesh
MFnMesh mesh(object[ObjectID]);
@@ -261,62 +257,62 @@ Mesh MeshClass::GetMeshData(MObjectArray object, bool collision)
thisVertex.Pos[0] = pos.x;
thisVertex.Pos[1] = pos.y;
thisVertex.Pos[2] = pos.z;
thisVertex.isCollision = collision;
if (!collision) {
status = faceVert.getNormal(normal, MSpace::kObject);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + "faceVert.getNormal() ERROR: " + status.errorString() + "for local vertex " + i + " in " + faceID + " in mesh " + thisMeshPath.fullPathName());
break;
}
status = faceVert.getNormal(normal, MSpace::kObject);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + "faceVert.getNormal() ERROR: " + status.errorString() + "for local vertex " + i + " in " + faceID + " in mesh " + thisMeshPath.fullPathName());
break;
}
thisVertex.Normal[0] = normal[0];
thisVertex.Normal[1] = normal[1];
thisVertex.Normal[2] = normal[2];
thisVertex.Normal[0] = normal[0];
thisVertex.Normal[1] = normal[1];
thisVertex.Normal[2] = normal[2];
MFloatVector Tangent = Tangents[faceVert.tangentId()];
//MVector tmp = faceVert.getTangent(MSpace::kObject, NULL);
//tmp.get(biTangent);
thisVertex.Tangent[0] = Tangent[0];
thisVertex.Tangent[1] = Tangent[1];
thisVertex.Tangent[2] = Tangent[2];
MFloatVector Tangent = Tangents[faceVert.tangentId()];
//MVector tmp = faceVert.getTangent(MSpace::kObject, NULL);
//tmp.get(biTangent);
thisVertex.Tangent[0] = Tangent[0];
thisVertex.Tangent[1] = Tangent[1];
thisVertex.Tangent[2] = Tangent[2];
MFloatVector biNormal = biNormals[faceVert.tangentId()];
//faceVert.getBinormal().get(biNormal);
thisVertex.BiNormal[0] = biNormal[0];
thisVertex.BiNormal[1] = biNormal[1];
thisVertex.BiNormal[2] = biNormal[2];
MFloatVector biNormal = biNormals[faceVert.tangentId()];
//faceVert.getBinormal().get(biNormal);
thisVertex.BiNormal[0] = biNormal[0];
thisVertex.BiNormal[1] = biNormal[1];
thisVertex.BiNormal[2] = biNormal[2];
status = faceVert.getUV(UV);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + " faceVert.getUV() ERROR: " + status.errorString() + "for local vertex " + i + " in " + faceID + " in mesh " + thisMeshPath.fullPathName());
break;
}
thisVertex.Uv[0] = UV[0];
thisVertex.Uv[1] = UV[1];
status = faceVert.getUV(UV);
if (status != MS::kSuccess) {
MGlobal::displayError(MString() + " faceVert.getUV() ERROR: " + status.errorString() + "for local vertex " + i + " in " + faceID + " in mesh " + thisMeshPath.fullPathName());
break;
}
thisVertex.Uv[0] = UV[0];
thisVertex.Uv[1] = UV[1];
if (newMesh.hasSkin) {
thisVertex.useWeights = true;
float totalWeight = 0.0f;
unsigned int totalBones = 0;
MIntArray jointIDs /* ??? */;
weights.selectAncestorLogicalIndex(vertexIndex, weightListObject);
weights.getExistingArrayAttributeIndices(jointIDs);
for (unsigned int i = 0; i < jointIDs.length() && i < 4; i++) {
if (weights[i].asFloat() > 0.001f) {
thisVertex.BoneIndices[totalBones] = jointIDs[i];
thisVertex.BoneWeights[totalBones] = weights[i].asFloat();
totalWeight = totalWeight + weights[i].asFloat();
totalBones++;
}
}
if (newMesh.hasSkin) {
thisVertex.useWeights = true;
float totalWeight = 0.0f;
unsigned int totalBones = 0;
MIntArray jointIDs /* ??? */;
weights.selectAncestorLogicalIndex(vertexIndex, weightListObject);
weights.getExistingArrayAttributeIndices(jointIDs);
for (unsigned int i = 0; i < jointIDs.length() && i < 4; i++) {
if (weights[i].asFloat() > 0.001f) {
thisVertex.BoneIndices[totalBones] = jointIDs[i];
thisVertex.BoneWeights[totalBones] = weights[i].asFloat();
totalWeight = totalWeight + weights[i].asFloat();
totalBones++;
}
}
for (unsigned int i = 0; i < 4; i++) {
//thisVertex.BoneWeights[i] = thisVertex.BoneWeights[i] / totalWeight;
}
}
for (unsigned int i = 0; i < 4; i++) {
//thisVertex.BoneWeights[i] = thisVertex.BoneWeights[i] / totalWeight;
}
} else {
thisVertex.useWeights = false;
}
//float totalWeight = thisVertex.BoneWeights[0] + thisVertex.BoneWeights[1] + thisVertex.BoneWeights[2] + thisVertex.BoneWeights[3];
//if (totalWeight > 0.0001f) {
// thisVertex.BoneWeights[0] /= totalWeight;
+23 -32
View File
@@ -11,8 +11,7 @@
class VertexLayout : public OutputData
{
public:
bool isCollision = false;
bool useWeights = false;
bool useWeights = true;
float Pos[3]{ 0 };
float Normal[3]{ 0 };
float Tangent[3]{ 0 };
@@ -24,31 +23,28 @@ public:
virtual void WriteBinary(std::ostream& out)
{
out.write((char*)&Pos, sizeof(float) * 3);
if (!isCollision) {
out.write((char*)&Normal, sizeof(float) * 3);
out.write((char*)&Tangent, sizeof(float) * 3);
out.write((char*)&BiNormal, sizeof(float) * 3);
out.write((char*)&Uv, sizeof(float) * 2);
if (useWeights) {
out.write((char*)&BoneIndices, sizeof(float) * 4);
out.write((char*)&BoneWeights, sizeof(float) * 4);
}
out.write((char*)&Normal, sizeof(float) * 3);
out.write((char*)&Tangent, sizeof(float) * 3);
out.write((char*)&BiNormal, sizeof(float) * 3);
out.write((char*)&Uv, sizeof(float) * 2);
if (useWeights) {
out.write((char*)&BoneIndices, sizeof(float) * 4);
out.write((char*)&BoneWeights, sizeof(float) * 4);
}
}
virtual void WriteASCII(std::ostream& out) const
{
out << Pos[0] << " " << Pos[1] << " " << Pos[2] << endl;
if (!isCollision) {
out << Normal[0] << " " << Normal[1] << " " << Normal[2] << endl;
out << Tangent[0] << " " << Tangent[1] << " " << Tangent[2] << endl;
out << BiNormal[0] << " " << BiNormal[1] << " " << BiNormal[2] << endl;
out << Uv[0] << " " << Uv[1] << endl;
if (useWeights) {
out << BoneIndices[0] << " " << BoneIndices[1] << " " << BoneIndices[2] << " " << BoneIndices[3] << endl;
out << BoneWeights[0] << " " << BoneWeights[1] << " " << BoneWeights[2] << " " << BoneWeights[3] << endl;
}
out << Normal[0] << " " << Normal[1] << " " << Normal[2] << endl;
out << Tangent[0] << " " << Tangent[1] << " " << Tangent[2] << endl;
out << BiNormal[0] << " " << BiNormal[1] << " " << BiNormal[2] << endl;
out << Uv[0] << " " << Uv[1] << endl;
if (useWeights) {
out << BoneIndices[0] << " " << BoneIndices[1] << " " << BoneIndices[2] << " " << BoneIndices[3] << endl;
out << BoneWeights[0] << " " << BoneWeights[1] << " " << BoneWeights[2] << " " << BoneWeights[3] << endl;
}
}
bool operator==(const VertexLayout& right)
{
@@ -66,7 +62,6 @@ public:
class Mesh : public OutputData {
public:
bool isCollison = false;
bool hasSkin = false;
unsigned int NumVertices;
unsigned int NumIndices;
@@ -75,9 +70,7 @@ public:
virtual void WriteBinary(std::ostream& out)
{
if (!isCollison) {
out.write((char*)&hasSkin, sizeof(bool));
}
out.write((char*)&hasSkin, sizeof(bool));
out.write((char*)&NumVertices, sizeof(int));
out.write((char*)&NumIndices, sizeof(int));
for (auto aVertex : Vertices) {
@@ -93,13 +86,11 @@ public:
virtual void WriteASCII(std::ostream& out) const
{
out << "New Mesh _ not in binary" << endl;
if (!isCollison) {
out << "hasSkin: ";
if (hasSkin)
out << "true" << endl;
else
out << "false" << endl;
}
out << "hasSkin: ";
if(hasSkin)
out << "true" << endl;
else
out << "false" << endl;
out << "Number of vertices: " << NumVertices << endl;
out << "number of indices: " << NumIndices << endl;
int vertexNumber = 0;
@@ -124,7 +115,7 @@ class MeshClass
{
public:
MeshClass();
Mesh GetMeshData(MObjectArray Object, bool collision = false);
Mesh GetMeshData(MObjectArray Object);
~MeshClass();
private:
struct WeightInfo {