Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f75f5f2471 |
+1
-1
Submodule assets updated: 078e014f3d...b040545bc3
@@ -20,9 +20,6 @@
|
|||||||
class World;
|
class World;
|
||||||
struct ComponentWrapper;
|
struct ComponentWrapper;
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class Octree;
|
|
||||||
|
|
||||||
namespace Collision
|
namespace Collision
|
||||||
{
|
{
|
||||||
//Return true if the ray hits the box.
|
//Return true if the ray hits the box.
|
||||||
@@ -48,23 +45,20 @@ bool RayVsTriangle(const Ray& ray,
|
|||||||
bool trueOnNegativeDistance = false);
|
bool trueOnNegativeDistance = false);
|
||||||
//Return true if the ray hits any of the triangles in the model. Stops checking when a hit is detected.
|
//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,
|
bool RayVsModel(const Ray& ray,
|
||||||
const RawModel::Vertex* modelVertices,
|
const std::vector<RawModel::Vertex>& modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices);
|
||||||
const glm::mat4& modelMatrix);
|
|
||||||
//Return true if the ray hits any of the triangles in the model.
|
//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.
|
//Also returns the position of the intersection point. Will loop through all the whole model indices.
|
||||||
bool RayVsModel(const Ray& ray,
|
bool RayVsModel(const Ray& ray,
|
||||||
const RawModel::Vertex* modelVertices,
|
const std::vector<RawModel::Vertex>& modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices,
|
||||||
const glm::mat4& modelMatrix,
|
|
||||||
glm::vec3& outHitPosition);
|
glm::vec3& outHitPosition);
|
||||||
//Return true if the ray hits any of the triangles in the model.
|
//Return true if the ray hits any of the triangles in the model.
|
||||||
//Also returns the distance from the ray origin to the closest
|
//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.
|
//intersection point, and the barycentric u,v-coordinates. Will loop through all the whole model indices.
|
||||||
bool RayVsModel(const Ray& ray,
|
bool RayVsModel(const Ray& ray,
|
||||||
const RawModel::Vertex* modelVertices,
|
const std::vector<RawModel::Vertex>& modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices,
|
||||||
const glm::mat4& modelMatrix,
|
|
||||||
float& outDistance,
|
float& outDistance,
|
||||||
float& outUCoord,
|
float& outUCoord,
|
||||||
float& outVCoord);
|
float& outVCoord);
|
||||||
@@ -87,13 +81,6 @@ bool AABBVsAABB(const AABB& a, const AABB& b, glm::vec3& minimumTranslation);
|
|||||||
// Calculates an absolute AABB from an entity AABB component
|
// Calculates an absolute AABB from an entity AABB component
|
||||||
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox = false);
|
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox = false);
|
||||||
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity);
|
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity);
|
||||||
//Returns the first entity hit by the input ray. entitiesPotentiallyHitSorted needs to be sorted
|
|
||||||
//by their distance to the ray, e.g. result from Octree<EntityAABB>::ObjectsPossiblyHitByRay.
|
|
||||||
//Returns boost::none if none was hit. outDistance will be the distance to the intersection point if the ray intersects.
|
|
||||||
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<EntityAABB> entitiesPotentiallyHitSorted, float& outDistance, glm::vec3& outIntersectPos);
|
|
||||||
//Returns the first entity hit by the input ray that exists in the octree.
|
|
||||||
//outDistance will be the distance to the intersection point if the ray intersects.
|
|
||||||
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, Octree<EntityAABB>* octree, float& outDistance, glm::vec3& outIntersectPos);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
#ifndef EAmmoPickup_h__
|
|
||||||
#define EAmmoPickup_h__
|
|
||||||
|
|
||||||
#include "EventBroker.h"
|
|
||||||
#include "../Core/EntityWrapper.h"
|
|
||||||
|
|
||||||
namespace Events
|
|
||||||
{
|
|
||||||
|
|
||||||
struct AmmoPickup : Event
|
|
||||||
{
|
|
||||||
EntityWrapper Player;
|
|
||||||
int AmmoGain;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -9,8 +9,8 @@ namespace Events
|
|||||||
|
|
||||||
struct PlayerDamage : Event
|
struct PlayerDamage : Event
|
||||||
{
|
{
|
||||||
EntityWrapper Inflictor;
|
//NOTE: this struct is missing information on what the damageSource is
|
||||||
EntityWrapper Victim;
|
EntityWrapper Player;
|
||||||
double Damage;
|
double Damage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ namespace Events
|
|||||||
|
|
||||||
struct Shoot : Event
|
struct Shoot : Event
|
||||||
{
|
{
|
||||||
EntityWrapper Inflictor;
|
EntityWrapper Player;
|
||||||
double Damage;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ public:
|
|||||||
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects);
|
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects);
|
||||||
//Get the objects that are inside the frustum, the objects are put in outObjects.
|
//Get the objects that are inside the frustum, the objects are put in outObjects.
|
||||||
void ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObjects);
|
void ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObjects);
|
||||||
//Get objects, which AABB the input ray intersects, the objects are put in outObjects.
|
|
||||||
void ObjectsPossiblyHitByRay(const Ray& ray, std::vector<T>& outObjects);
|
|
||||||
//Empty the tree of all objects, static and dynamic.
|
//Empty the tree of all objects, static and dynamic.
|
||||||
void ClearObjects();
|
void ClearObjects();
|
||||||
//Empty the tree of all dynamic objects. Static objects remain in the tree.
|
//Empty the tree of all dynamic objects. Static objects remain in the tree.
|
||||||
@@ -102,8 +100,6 @@ struct Child
|
|||||||
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects) const;
|
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects) const;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObjects, bool takeAllDontTest) const;
|
void ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObjects, bool takeAllDontTest) const;
|
||||||
template<typename T>
|
|
||||||
void ObjectsPossiblyHitByRay(const Ray& ray, std::vector<T>& outObjects) const;
|
|
||||||
void ClearObjects();
|
void ClearObjects();
|
||||||
void ClearDynamicObjects();
|
void ClearDynamicObjects();
|
||||||
bool RayCollides(const Ray& ray, Output& data) const;
|
bool RayCollides(const Ray& ray, Output& data) const;
|
||||||
@@ -123,15 +119,6 @@ struct Child
|
|||||||
std::vector<int> childIndicesContainingBox(const AABB& box) const;
|
std::vector<int> childIndicesContainingBox(const AABB& box) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//To be able to sort child nodes and contained objects based on distance to ray origin.
|
|
||||||
struct RaySorterInfo
|
|
||||||
{
|
|
||||||
int Index;
|
|
||||||
float Distance;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool isFirstLower(const RaySorterInfo& first, const RaySorterInfo& second);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -177,13 +164,6 @@ void Octree<T>::ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObje
|
|||||||
m_Root->ObjectsInFrustum(frustum, outObjects, false);
|
m_Root->ObjectsInFrustum(frustum, outObjects, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void Octree<T>::ObjectsPossiblyHitByRay(const Ray& ray, std::vector<T>& outObjects)
|
|
||||||
{
|
|
||||||
falsifyObjectChecks();
|
|
||||||
m_Root->ObjectsPossiblyHitByRay(ray, outObjects);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void Octree<T>::ClearObjects()
|
void Octree<T>::ClearObjects()
|
||||||
{
|
{
|
||||||
@@ -302,59 +282,4 @@ void OctSpace::Child::ObjectsInFrustum(const Frustum& frustum, std::vector<T>& o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void OctSpace::Child::ObjectsPossiblyHitByRay(const Ray& ray, std::vector<T>& outObjects) const
|
|
||||||
{
|
|
||||||
//If the node AABB is missed, everything it contains is missed.
|
|
||||||
if (Collision::RayAABBIntr(ray, m_Box)) {
|
|
||||||
//If the ray shoots the tree, and it is a parent.
|
|
||||||
if (hasChildren()) {
|
|
||||||
//Sort children according to their distance from the ray origin.
|
|
||||||
std::vector<RaySorterInfo> childInfos;
|
|
||||||
childInfos.resize(8);
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
|
||||||
childInfos[i] = { i, glm::distance(ray.Origin(), m_Children[i]->m_Box.Origin()) };
|
|
||||||
}
|
|
||||||
std::sort(childInfos.begin(), childInfos.end(), isFirstLower);
|
|
||||||
//Loop through the children, starting with the one closest to the ray origin. I.e the first to be hit.
|
|
||||||
for (const RaySorterInfo& info : childInfos) {
|
|
||||||
m_Children[info.Index]->ObjectsPossiblyHitByRay(ray, outObjects);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//Check against boxes in the node.
|
|
||||||
bool intersected = false;
|
|
||||||
float dist;
|
|
||||||
//Sort all contained objects according to the distance from the ray origin to
|
|
||||||
//the intersection, if they are intersecting.
|
|
||||||
std::vector<RaySorterInfo> objectHitInfos;
|
|
||||||
objectHitInfos.reserve(m_StaticObjIndices.size() + m_DynamicObjIndices.size());
|
|
||||||
for (int i : m_StaticObjIndices) {
|
|
||||||
//If we haven't tested against this object before, and the ray hits.
|
|
||||||
if (!m_StaticObjectsRef[i].Checked &&
|
|
||||||
Collision::RayVsAABB(ray, *m_StaticObjectsRef[i].Box, dist)) {
|
|
||||||
objectHitInfos.push_back({ i, dist });
|
|
||||||
}
|
|
||||||
m_StaticObjectsRef[i].Checked = true;
|
|
||||||
}
|
|
||||||
for (int i : m_DynamicObjIndices) {
|
|
||||||
//If we haven't tested against this object before, and the ray hits.
|
|
||||||
if (!m_DynamicObjectsRef[i].Checked &&
|
|
||||||
Collision::RayVsAABB(ray, *m_DynamicObjectsRef[i].Box, dist)) {
|
|
||||||
objectHitInfos.push_back({ i + (int)m_StaticObjIndices.size(), dist });
|
|
||||||
}
|
|
||||||
m_DynamicObjectsRef[i].Checked = true;
|
|
||||||
}
|
|
||||||
std::sort(objectHitInfos.begin(), objectHitInfos.end(), isFirstLower);
|
|
||||||
int startSize = (int)outObjects.size();
|
|
||||||
outObjects.resize(startSize + objectHitInfos.size());
|
|
||||||
for (int i = 0; i < objectHitInfos.size(); ++i) {
|
|
||||||
outObjects[startSize + i] = (objectHitInfos[i].Index < m_StaticObjIndices.size()) ?
|
|
||||||
*static_cast<T*>(m_StaticObjectsRef[objectHitInfos[i].Index].Box.get()) :
|
|
||||||
*static_cast<T*>(m_DynamicObjectsRef[objectHitInfos[i].Index - m_StaticObjIndices.size()].Box.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -55,7 +55,6 @@ protected:
|
|||||||
//specialabilitys
|
//specialabilitys
|
||||||
bool m_MovementKeyDown = false;
|
bool m_MovementKeyDown = false;
|
||||||
bool m_SpecialAbilityKeyDown = false;
|
bool m_SpecialAbilityKeyDown = false;
|
||||||
int m_NumberOfMovementKeysDown = 0;
|
|
||||||
|
|
||||||
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
|
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
|
||||||
bool OnLockMouse(const Events::LockMouse& e);
|
bool OnLockMouse(const Events::LockMouse& e);
|
||||||
@@ -133,7 +132,6 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
|
|||||||
}
|
}
|
||||||
//if value = 0 then you have just released this key
|
//if value = 0 then you have just released this key
|
||||||
if (e.Value != 0) {
|
if (e.Value != 0) {
|
||||||
m_NumberOfMovementKeysDown++;
|
|
||||||
m_MovementKeyDown = true;
|
m_MovementKeyDown = true;
|
||||||
//if you pressed the same key within m_AssaultDashDoubleTapSensitivityTimer then you have doubletapped it
|
//if you pressed the same key within m_AssaultDashDoubleTapSensitivityTimer then you have doubletapped it
|
||||||
if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == m_CurrentDirectionVector) {
|
if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == m_CurrentDirectionVector) {
|
||||||
@@ -141,14 +139,10 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//== 0
|
//== 0
|
||||||
m_NumberOfMovementKeysDown--;
|
|
||||||
if (m_NumberOfMovementKeysDown == 0) {
|
|
||||||
m_MovementKeyDown = false;
|
m_MovementKeyDown = false;
|
||||||
}
|
|
||||||
//you have just released the key, store what key it was and reset the doubletap-sensitivity-timer
|
//you have just released the key, store what key it was and reset the doubletap-sensitivity-timer
|
||||||
m_AssaultDashTapDirection = m_CurrentDirectionVector;
|
m_AssaultDashTapDirection = m_CurrentDirectionVector;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,6 +202,12 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
m_AssaultDashDoubleTapped = true;
|
m_AssaultDashDoubleTapped = true;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
|
//moving to the side has priority
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//dashing with doubletap - check if doubletap to dash enabled
|
||||||
|
if (ResourceManager::Load<ConfigFile>("Input.ini")->Get<bool>("Keyboard.DoubleTapToDash", false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,11 +216,6 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
m_AssaultDashDoubleTapped = false;
|
m_AssaultDashDoubleTapped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//dashing with doubletap - check if doubletap to dash enabled
|
|
||||||
if (!ResourceManager::Load<ConfigFile>("Input.ini")->Get<bool>("Keyboard.DoubleTapToDash", false)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//check if we have received a valid doubletap
|
//check if we have received a valid doubletap
|
||||||
if (!m_ValidDoubleTap) {
|
if (!m_ValidDoubleTap) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -120,32 +120,6 @@ struct ModelJob : RenderJob
|
|||||||
|
|
||||||
if (model->IsSkinned()) {
|
if (model->IsSkinned()) {
|
||||||
Skeleton = Model->m_RawModel->m_Skeleton;
|
Skeleton = Model->m_RawModel->m_Skeleton;
|
||||||
|
|
||||||
if (Skeleton != nullptr) {
|
|
||||||
if (world->HasComponent(Entity, "Animation")) {
|
|
||||||
auto animationComponent = world->GetComponent(Entity, "Animation");
|
|
||||||
|
|
||||||
for (int i = 1; i <= 3; i++) {
|
|
||||||
::Skeleton::AnimationData animationData;
|
|
||||||
animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(animationComponent["AnimationName" + std::to_string(i)]);
|
|
||||||
if (animationData.animation == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
animationData.time = (double)animationComponent["Time" + std::to_string(i)];
|
|
||||||
animationData.weight = (double)animationComponent["Weight" + std::to_string(i)];
|
|
||||||
|
|
||||||
Animations.push_back(animationData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (world->HasComponent(Entity, "AnimationOffset")) {
|
|
||||||
auto animationOffsetComponent = world->GetComponent(Entity, "AnimationOffset");
|
|
||||||
AnimationOffset.animation = model->m_RawModel->m_Skeleton->GetAnimation(animationOffsetComponent["AnimationName"]);
|
|
||||||
AnimationOffset.time = (double)animationOffsetComponent["Time"];
|
|
||||||
} else {
|
|
||||||
AnimationOffset.animation = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -166,8 +140,8 @@ struct ModelJob : RenderJob
|
|||||||
glm::vec4 Color;
|
glm::vec4 Color;
|
||||||
const ::Model* Model = nullptr;
|
const ::Model* Model = nullptr;
|
||||||
::Skeleton* Skeleton = nullptr;
|
::Skeleton* Skeleton = nullptr;
|
||||||
std::vector<::Skeleton::AnimationData> Animations;
|
// const ::Skeleton::Animation* Animation = nullptr;
|
||||||
::Skeleton::AnimationOffset AnimationOffset;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ private:
|
|||||||
|
|
||||||
int m_ColorCounter[2];
|
int m_ColorCounter[2];
|
||||||
std::map<std::tuple<EntityID, const World*, Camera*>, glm::ivec2> m_EntityColors;
|
std::map<std::tuple<EntityID, const World*, Camera*>, glm::ivec2> m_EntityColors;
|
||||||
|
|
||||||
|
Texture* m_WhiteTexture;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
#include "../Core/EPlayerSpawned.h"
|
#include "../Core/EPlayerSpawned.h"
|
||||||
#include "../Core/Octree.h"
|
#include "../Core/Octree.h"
|
||||||
#include "../Collision/EntityAABB.h"
|
#include "../Collision/EntityAABB.h"
|
||||||
#include "../Core/ConfigFile.h"
|
|
||||||
|
|
||||||
class RenderSystem : public ImpureSystem
|
class RenderSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
@@ -49,9 +48,6 @@ private:
|
|||||||
void fillDirectionalLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
void fillDirectionalLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||||
void fillLight(std::list<std::shared_ptr<RenderJob>>& jobs);
|
void fillLight(std::list<std::shared_ptr<RenderJob>>& jobs);
|
||||||
void fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
void fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||||
|
|
||||||
bool isEntityVisible(EntityWrapper& entity);
|
|
||||||
|
|
||||||
bool isChildOfACamera(EntityWrapper entity);
|
bool isChildOfACamera(EntityWrapper entity);
|
||||||
bool isChildOfCurrentCamera(EntityWrapper entity);
|
bool isChildOfCurrentCamera(EntityWrapper entity);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -100,29 +100,50 @@ public:
|
|||||||
|
|
||||||
int GetBoneID(std::string name);
|
int GetBoneID(std::string name);
|
||||||
|
|
||||||
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion = false);
|
void CalculateFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion = false);
|
||||||
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, bool noRootMotion = false);
|
void CalculateFrameBones(std::vector<AnimationData> animations, bool noRootMotion = false);
|
||||||
|
|
||||||
const Animation* GetAnimation(std::string name);
|
const Animation* GetAnimation(std::string name);
|
||||||
|
|
||||||
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, std::map<int, glm::mat4>& frameBones, const Bone* bone, glm::mat4 parentMatrix);
|
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, const Bone* bone, glm::mat4 parentMatrix);
|
||||||
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, std::map<int, glm::mat4>& frameBones, const Bone* bone, glm::mat4 parentMatrix);
|
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, const Bone* bone, glm::mat4 parentMatrix);
|
||||||
|
|
||||||
void PrintSkeleton();
|
void PrintSkeleton();
|
||||||
void PrintSkeleton(const Bone* parent, int depthCount);
|
void PrintSkeleton(const Bone* parent, int depthCount);
|
||||||
std::map<std::string, Animation> Animations;
|
std::map<std::string, Animation> Animations;
|
||||||
|
|
||||||
glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix);
|
glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix);
|
||||||
glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, AnimationOffset animationOffset, glm::mat4 childMatrix);
|
|
||||||
glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, glm::mat4 childMatrix);
|
|
||||||
int GetKeyframe(const Animation& animation, double time);
|
int GetKeyframe(const Animation& animation, double time);
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<glm::mat4> GetBones()
|
||||||
|
{
|
||||||
|
std::vector<glm::mat4> finalMatrices;
|
||||||
|
for (auto &kv : m_BoneLocalTransforms) {
|
||||||
|
finalMatrices.push_back(kv.second);
|
||||||
|
}
|
||||||
|
return finalMatrices;;
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::mat4 GetBoneTransformSuper(int boneID)
|
||||||
|
{
|
||||||
|
if(m_BoneTransforms.find(boneID) != m_BoneTransforms.end()) {
|
||||||
|
return m_BoneTransforms.at(boneID);
|
||||||
|
} else {
|
||||||
|
return glm::mat4(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset);
|
glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset);
|
||||||
|
|
||||||
std::map<std::string, Bone*> m_BonesByName;
|
std::map<std::string, Bone*> m_BonesByName;
|
||||||
|
float aim = 0.f;
|
||||||
|
|
||||||
|
|
||||||
|
std::map<int, glm::mat4> m_BoneLocalTransforms;
|
||||||
|
std::map<int, glm::mat4> m_BoneTransforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
#ifndef AmmoPickupSystem_h__
|
|
||||||
#define AmmoPickupSystem_h__
|
|
||||||
|
|
||||||
#include "Core/System.h"
|
|
||||||
#include "Core/Transform.h"
|
|
||||||
#include "Core/ResourceManager.h"
|
|
||||||
#include "Core/EntityFileParser.h"
|
|
||||||
#include "Core/EPickupSpawned.h"
|
|
||||||
#include "Core/EAmmoPickup.h"
|
|
||||||
#include "Engine/Collision/ETrigger.h"
|
|
||||||
#include "Common.h"
|
|
||||||
|
|
||||||
class AmmoPickupSystem : public ImpureSystem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AmmoPickupSystem(SystemParams params);
|
|
||||||
|
|
||||||
virtual void Update(double dt) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
EventRelay<AmmoPickupSystem, Events::TriggerTouch> m_ETriggerTouch;
|
|
||||||
bool OnTriggerTouch(Events::TriggerTouch& e);
|
|
||||||
|
|
||||||
struct NewAmmoPickup {
|
|
||||||
glm::vec3 Pos;
|
|
||||||
double AmmoGain;
|
|
||||||
double RespawnTimer;
|
|
||||||
double DecreaseThisRespawnTimer;
|
|
||||||
};
|
|
||||||
std::vector<NewAmmoPickup> m_ETriggerTouchVector;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
@@ -44,6 +44,7 @@ private:
|
|||||||
|
|
||||||
//std::vector<ComponentWrapper>
|
//std::vector<ComponentWrapper>
|
||||||
|
|
||||||
|
const double m_CaptureTimeToTakeOver = 15.0;
|
||||||
bool m_ResetTimers = false;
|
bool m_ResetTimers = false;
|
||||||
|
|
||||||
//vectors which will keep track of enter/leave changes
|
//vectors which will keep track of enter/leave changes
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
#ifndef DamageIndicatorSystem_h__
|
|
||||||
#define DamageIndicatorSystem_h__
|
|
||||||
|
|
||||||
#include "Core/System.h"
|
|
||||||
#include "Core/Transform.h"
|
|
||||||
#include "Core/ResourceManager.h"
|
|
||||||
#include "Core/EntityFileParser.h"
|
|
||||||
#include "Core/EPlayerDamage.h"
|
|
||||||
#include "Common.h"
|
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
#include "Rendering/ESetCamera.h"
|
|
||||||
#include <glm/gtc/quaternion.hpp>
|
|
||||||
#include <glm/gtx/vector_angle.hpp>
|
|
||||||
|
|
||||||
#include "Rendering/Util/CommonFunctions.h"
|
|
||||||
|
|
||||||
class DamageIndicatorSystem : public System
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DamageIndicatorSystem(SystemParams params);
|
|
||||||
|
|
||||||
private:
|
|
||||||
EventRelay<DamageIndicatorSystem, Events::PlayerDamage> m_EPlayerDamage;
|
|
||||||
bool OnPlayerDamage(Events::PlayerDamage& e);
|
|
||||||
|
|
||||||
EventRelay<DamageIndicatorSystem, Events::SetCamera> m_ESetCamera;
|
|
||||||
bool OnSetCamera(const Events::SetCamera& e);
|
|
||||||
|
|
||||||
EntityID m_CurrentCamera = -1;
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "Core/EPlayerDamage.h"
|
#include "Core/EPlayerDamage.h"
|
||||||
#include "Core/EPlayerHealthPickup.h"
|
#include "Core/EPlayerHealthPickup.h"
|
||||||
#include "Core/EPlayerDeath.h"
|
#include "Core/EPlayerDeath.h"
|
||||||
#include "../Engine/Input/EInputCommand.h"
|
|
||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -29,8 +28,6 @@ private:
|
|||||||
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e);
|
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e);
|
||||||
EventRelay<HealthSystem, Events::PlayerHealthPickup> m_EPlayerHealthPickup;
|
EventRelay<HealthSystem, Events::PlayerHealthPickup> m_EPlayerHealthPickup;
|
||||||
bool HealthSystem::OnPlayerHealthPickup(Events::PlayerHealthPickup& e);
|
bool HealthSystem::OnPlayerHealthPickup(Events::PlayerHealthPickup& e);
|
||||||
EventRelay<HealthSystem, Events::InputCommand> m_InputCommand;
|
|
||||||
bool HealthSystem::OnInputCommand(Events::InputCommand& e);
|
|
||||||
|
|
||||||
//vector which will keep track of health changes
|
//vector which will keep track of health changes
|
||||||
std::vector<std::tuple<EntityID, double>> m_DeltaHealthVector;
|
std::vector<std::tuple<EntityID, double>> m_DeltaHealthVector;
|
||||||
|
|||||||
@@ -7,9 +7,6 @@
|
|||||||
#include "Events/EDoubleJump.h"
|
#include "Events/EDoubleJump.h"
|
||||||
#include "../Engine/Sound/EPlaySoundOnEntity.h"
|
#include "../Engine/Sound/EPlaySoundOnEntity.h"
|
||||||
|
|
||||||
#include "Core/EntityFile.h"
|
|
||||||
#include "Core/EntityFileParser.h"
|
|
||||||
|
|
||||||
class PlayerMovementSystem : public ImpureSystem
|
class PlayerMovementSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ public:
|
|||||||
|
|
||||||
virtual void Update(double dt) override;
|
virtual void Update(double dt) override;
|
||||||
|
|
||||||
static void SetRespawnTime(float respawnTime) { m_RespawnTime = respawnTime; };
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct SpawnRequest
|
struct SpawnRequest
|
||||||
{
|
{
|
||||||
@@ -25,19 +23,10 @@ private:
|
|||||||
|
|
||||||
bool m_NetworkEnabled = false;
|
bool m_NetworkEnabled = false;
|
||||||
std::vector<SpawnRequest> m_SpawnRequests;
|
std::vector<SpawnRequest> m_SpawnRequests;
|
||||||
|
|
||||||
//Player ID -> EntityWrapper.
|
|
||||||
std::map<int, EntityWrapper> m_PlayerEntities;
|
std::map<int, EntityWrapper> m_PlayerEntities;
|
||||||
//EntityWrapper ID -> Player ID.
|
|
||||||
std::map<EntityID, int> m_PlayerIDs;
|
|
||||||
|
|
||||||
static float m_RespawnTime;
|
|
||||||
float m_Timer;
|
|
||||||
|
|
||||||
EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand;
|
EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand;
|
||||||
bool OnInputCommand(Events::InputCommand& e);
|
bool OnInputCommand(const Events::InputCommand& e);
|
||||||
EventRelay<PlayerSpawnSystem, Events::PlayerSpawned> m_OnPlayerSpawnerd;
|
EventRelay<PlayerSpawnSystem, Events::PlayerSpawned> m_OnPlayerSpawnerd;
|
||||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||||
EventRelay<PlayerSpawnSystem, Events::PlayerDeath> m_OnPlayerDeath;
|
|
||||||
bool OnPlayerDeath(Events::PlayerDeath& e);
|
|
||||||
};
|
};
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#include "Sound/EPlaySoundOnEntity.h"
|
|
||||||
#include "Collision/Collision.h"
|
|
||||||
#include "Rendering/AnimationSystem.h"
|
|
||||||
#include "WeaponBehaviour.h"
|
|
||||||
#include "../SpawnerSystem.h"
|
|
||||||
#include "Core/EPlayerDamage.h"
|
|
||||||
#include "Core/EShoot.h"
|
|
||||||
|
|
||||||
class AssaultWeaponBehaviour : public WeaponBehaviour
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AssaultWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper weaponEntity);
|
|
||||||
|
|
||||||
virtual void Fire() override;
|
|
||||||
virtual void CeaseFire() override;
|
|
||||||
virtual void Reload() override;
|
|
||||||
|
|
||||||
virtual void Update(double dt) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
EntityWrapper m_FirstPersonModel;
|
|
||||||
// State
|
|
||||||
bool m_Firing = false;
|
|
||||||
bool m_Reloading = false;
|
|
||||||
double m_ReloadTimer = 0.0;
|
|
||||||
EntityWrapper m_ReloadImpersonator;
|
|
||||||
double m_TimeSinceLastFire = 0.0;
|
|
||||||
|
|
||||||
EventRelay<WeaponBehaviour, Events::AnimationComplete> m_EAnimationComplete;
|
|
||||||
bool OnAnimationComplete(Events::AnimationComplete& e);
|
|
||||||
|
|
||||||
bool hasAmmo();
|
|
||||||
void fireRound();
|
|
||||||
void spawnTracer();
|
|
||||||
float traceRayDistance(glm::vec3 origin, glm::vec3 direction);
|
|
||||||
void playSound();
|
|
||||||
void viewPunch();
|
|
||||||
void finishReload();
|
|
||||||
void playShootAnimation();
|
|
||||||
void playIdleAnimation();
|
|
||||||
void playReloadAnimation();
|
|
||||||
bool shoot(double damage);
|
|
||||||
void showHitMarker();
|
|
||||||
};
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#ifndef WeaponBehaviour_h__
|
|
||||||
#define WeaponBehaviour_h__
|
|
||||||
|
|
||||||
#include "Core/System.h"
|
|
||||||
#include "Rendering/IRenderer.h"
|
|
||||||
#include "Core/Octree.h"
|
|
||||||
#include "Collision/EntityAABB.h"
|
|
||||||
|
|
||||||
class WeaponBehaviour : public System
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper player)
|
|
||||||
: System(systemParams)
|
|
||||||
, m_Renderer(renderer)
|
|
||||||
, m_CollisionOctree(collisionOctree)
|
|
||||||
, m_Player(player)
|
|
||||||
{ }
|
|
||||||
virtual ~WeaponBehaviour() = default;
|
|
||||||
|
|
||||||
WeaponBehaviour(const WeaponBehaviour&) = delete;
|
|
||||||
WeaponBehaviour& operator=(const WeaponBehaviour &) = delete;
|
|
||||||
|
|
||||||
virtual void Fire() = 0;
|
|
||||||
virtual void CeaseFire() { }
|
|
||||||
virtual void Reload() { }
|
|
||||||
virtual void Update(double dt) { }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
IRenderer* m_Renderer;
|
|
||||||
Octree<EntityAABB>* m_CollisionOctree;
|
|
||||||
EntityWrapper m_Player;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#ifndef WeaponSystem_h__
|
|
||||||
#define WeaponSystem_h__
|
|
||||||
|
|
||||||
#include "Rendering/IRenderer.h"
|
|
||||||
|
|
||||||
#include "Common.h"
|
|
||||||
#include "Core/System.h"
|
|
||||||
#include "Core/EPlayerDamage.h"
|
|
||||||
#include "Core/EShoot.h"
|
|
||||||
#include "Core/EPlayerSpawned.h"
|
|
||||||
#include "Input/EInputCommand.h"
|
|
||||||
#include "Core/EntityFile.h"
|
|
||||||
#include "Core/EntityFileParser.h"
|
|
||||||
#include "Core/Octree.h"
|
|
||||||
#include "Collision/EntityAABB.h"
|
|
||||||
#include "Systems/SpawnerSystem.h"
|
|
||||||
#include "Sound/EPlaySoundOnEntity.h"
|
|
||||||
#include "AssaultWeaponBehaviour.h"
|
|
||||||
|
|
||||||
class WeaponSystem : public PureSystem, ImpureSystem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WeaponSystem(SystemParams params, IRenderer* renderer, Octree<EntityAABB>* collisionOctree);
|
|
||||||
|
|
||||||
virtual void Update(double dt) override;
|
|
||||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPlayer, double dt) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
SystemParams m_SystemParams;
|
|
||||||
IRenderer* m_Renderer;
|
|
||||||
Octree<EntityAABB>* m_CollisionOctree;
|
|
||||||
|
|
||||||
std::unordered_map<EntityWrapper, std::shared_ptr<WeaponBehaviour>> m_ActiveWeapons;
|
|
||||||
|
|
||||||
// Events
|
|
||||||
EventRelay<WeaponSystem, Events::PlayerSpawned> m_EPlayerSpawned;
|
|
||||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
|
||||||
EventRelay<WeaponSystem, Events::InputCommand> m_EInputCommand;
|
|
||||||
bool OnInputCommand(Events::InputCommand& e);
|
|
||||||
|
|
||||||
void selectWeapon(EntityWrapper player, ComponentInfo::EnumType slot);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
#ifndef WeaponSystem_h__
|
||||||
|
#define WeaponSystem_h__
|
||||||
|
|
||||||
|
//#include <GLFW/glfw3.h>
|
||||||
|
//#include <glm/common.hpp>
|
||||||
|
#include "Rendering/IRenderer.h"
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Core/EPlayerDamage.h"
|
||||||
|
#include "Core/EShoot.h"
|
||||||
|
#include "Core/EPlayerSpawned.h"
|
||||||
|
#include "Input/EInputCommand.h"
|
||||||
|
#include "Core/EntityFile.h"
|
||||||
|
#include "Core/EntityFileParser.h"
|
||||||
|
#include "Core/Octree.h"
|
||||||
|
#include "Collision/EntityAABB.h"
|
||||||
|
#include "Systems/SpawnerSystem.h"
|
||||||
|
#include "Sound/EPlaySoundOnEntity.h"
|
||||||
|
|
||||||
|
class WeaponBehaviour;
|
||||||
|
|
||||||
|
class WeaponSystem : public PureSystem, ImpureSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WeaponSystem(SystemParams params, IRenderer* renderer, Octree<EntityAABB>* collisionOctree);
|
||||||
|
|
||||||
|
virtual void Update(double dt) override;
|
||||||
|
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPlayer, double dt) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
SystemParams m_SystemParams;
|
||||||
|
IRenderer* m_Renderer;
|
||||||
|
Octree<EntityAABB>* m_CollisionOctree;
|
||||||
|
|
||||||
|
std::unordered_map<EntityWrapper, std::shared_ptr<WeaponBehaviour>> m_ActiveWeapons;
|
||||||
|
|
||||||
|
// Events
|
||||||
|
EventRelay<WeaponSystem, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||||
|
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||||
|
EventRelay<WeaponSystem, Events::Shoot> m_EShoot;
|
||||||
|
bool OnShoot(Events::Shoot& e);
|
||||||
|
EventRelay<WeaponSystem, Events::InputCommand> m_EInputCommand;
|
||||||
|
bool OnInputCommand(Events::InputCommand& e);
|
||||||
|
|
||||||
|
void selectWeapon(EntityWrapper player, ComponentInfo::EnumType slot);
|
||||||
|
};
|
||||||
|
|
||||||
|
class WeaponBehaviour : public System
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WeaponBehaviour(SystemParams systemParams, Octree<EntityAABB>* collisionOctree, EntityWrapper weaponEntity)
|
||||||
|
: System(systemParams)
|
||||||
|
, m_CollisionOctree(collisionOctree)
|
||||||
|
, m_Entity(weaponEntity)
|
||||||
|
{ }
|
||||||
|
virtual ~WeaponBehaviour() = default;
|
||||||
|
|
||||||
|
WeaponBehaviour(const WeaponBehaviour&) = delete;
|
||||||
|
WeaponBehaviour& operator=(const WeaponBehaviour &) = delete;
|
||||||
|
|
||||||
|
virtual void Fire() = 0;
|
||||||
|
virtual void CeaseFire() { }
|
||||||
|
virtual void Reload() { }
|
||||||
|
virtual void Update(double dt) { }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Octree<EntityAABB>* m_CollisionOctree;
|
||||||
|
EntityWrapper m_Entity;
|
||||||
|
};
|
||||||
|
|
||||||
|
class AssaultWeaponBehaviour : public WeaponBehaviour
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AssaultWeaponBehaviour(SystemParams systemParams, Octree<EntityAABB>* collisionOctree, EntityWrapper weaponEntity)
|
||||||
|
: WeaponBehaviour(systemParams, collisionOctree, weaponEntity)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual void Fire() override
|
||||||
|
{
|
||||||
|
m_TimeSinceLastFire = 0.0;
|
||||||
|
m_Firing = true;
|
||||||
|
fireRound();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void CeaseFire() override
|
||||||
|
{
|
||||||
|
m_Firing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Reload() override
|
||||||
|
{
|
||||||
|
ComponentWrapper& cAssaultWeapon = m_Entity["AssaultWeapon"];
|
||||||
|
|
||||||
|
int& magAmmo = cAssaultWeapon["MagazineAmmo"];
|
||||||
|
int magSize = cAssaultWeapon["MagazineSize"];
|
||||||
|
int& ammo = cAssaultWeapon["Ammo"];
|
||||||
|
|
||||||
|
// Don't reload if we're already fully loaded
|
||||||
|
if (magAmmo == magSize) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Throw away rounds in magazine to incentivise ammo sharing
|
||||||
|
int toLoad = glm::min(magSize, ammo);
|
||||||
|
magAmmo = toLoad;
|
||||||
|
ammo -= toLoad;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Update(double dt) override
|
||||||
|
{
|
||||||
|
if (!m_Firing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_TimeSinceLastFire += dt;
|
||||||
|
|
||||||
|
ComponentWrapper& cAssaultWeapon = m_Entity["AssaultWeapon"];
|
||||||
|
if (m_TimeSinceLastFire >= 1.0 / ((double)cAssaultWeapon["RPM"] / 60.0)) {
|
||||||
|
fireRound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_Firing = false;
|
||||||
|
double m_TimeSinceLastFire = 0.0;
|
||||||
|
EntityFile* m_RayRed = nullptr;
|
||||||
|
EntityFile* m_RayBlue = nullptr;
|
||||||
|
|
||||||
|
void fireRound()
|
||||||
|
{
|
||||||
|
ComponentWrapper& cAssaultWeapon = m_Entity["AssaultWeapon"];
|
||||||
|
|
||||||
|
int& magAmmo = cAssaultWeapon["MagazineAmmo"];
|
||||||
|
int ammo = cAssaultWeapon["Ammo"];
|
||||||
|
|
||||||
|
// Reload if our magazine is empty
|
||||||
|
if (magAmmo <= 0) {
|
||||||
|
Reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fire
|
||||||
|
magAmmo -= 1;
|
||||||
|
spawnTracer();
|
||||||
|
playSound();
|
||||||
|
|
||||||
|
m_TimeSinceLastFire = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void spawnTracer()
|
||||||
|
{
|
||||||
|
if (!IsClient) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityWrapper spawner;
|
||||||
|
if (m_Entity == LocalPlayer) {
|
||||||
|
spawner = m_Entity.FirstChildByName("WeaponMuzzle");
|
||||||
|
} else {
|
||||||
|
spawner = m_Entity.FirstChildByName("ThirdPersonWeaponMuzzle");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!spawner.Valid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Events::SpawnerSpawn e;
|
||||||
|
e.Spawner = spawner;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
float traceRayDistance(glm::vec3 origin, glm::vec3 direction)
|
||||||
|
{
|
||||||
|
// TODO: Cast a ray and size tracer appropriately
|
||||||
|
return 100.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void playSound()
|
||||||
|
{
|
||||||
|
if (!IsClient) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Events::PlaySoundOnEntity e;
|
||||||
|
e.EmitterID = m_Entity.ID;
|
||||||
|
e.FilePath = "Audio/laser/laser1.wav";
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -4,9 +4,6 @@ LoadMap=
|
|||||||
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
|
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
|
||||||
; if false -> Use pool allocation.
|
; if false -> Use pool allocation.
|
||||||
DisableMemoryPool=false
|
DisableMemoryPool=false
|
||||||
RespawnTime = 8.0
|
|
||||||
EditorEnabled=false
|
|
||||||
OutOfBodyExperience=false
|
|
||||||
|
|
||||||
[Editor]
|
[Editor]
|
||||||
CameraSpeed=3
|
CameraSpeed=3
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
Sensitivity=0.5
|
Sensitivity=0.5
|
||||||
InvertPitch=false
|
InvertPitch=false
|
||||||
|
|
||||||
[Keyboard]
|
|
||||||
DoubleTapToDash=false
|
|
||||||
|
|
||||||
[Bindings]
|
[Bindings]
|
||||||
MouseLeft=PrimaryFire
|
MouseLeft=PrimaryFire
|
||||||
MouseX=Yaw
|
MouseX=Yaw
|
||||||
@@ -25,4 +22,3 @@ C=ConnectToServer
|
|||||||
N=SwitchToServer
|
N=SwitchToServer
|
||||||
M=SwitchToClient
|
M=SwitchToClient
|
||||||
P=SwitchToPlayer
|
P=SwitchToPlayer
|
||||||
K=TakeDamage,1500
|
|
||||||
@@ -32,7 +32,6 @@
|
|||||||
<xs:include schemaLocation="Components/Lifetime.xsd"/>
|
<xs:include schemaLocation="Components/Lifetime.xsd"/>
|
||||||
<xs:include schemaLocation="Components/HiddenForLocalPlayer.xsd"/>
|
<xs:include schemaLocation="Components/HiddenForLocalPlayer.xsd"/>
|
||||||
<xs:include schemaLocation="Components/HealthPickup.xsd"/>
|
<xs:include schemaLocation="Components/HealthPickup.xsd"/>
|
||||||
<xs:include schemaLocation="Components/AmmoPickup.xsd"/>
|
|
||||||
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
||||||
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
||||||
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
|
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
|
||||||
<AmmoPickup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AmmoPickup.xsd">
|
|
||||||
<RespawnTimer>3</RespawnTimer>
|
|
||||||
<AmmoGain>30</AmmoGain>
|
|
||||||
</AmmoPickup>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
|
||||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
|
||||||
|
|
||||||
<xs:element name="AmmoPickup">
|
|
||||||
<xs:annotation>
|
|
||||||
<xs:documentation>An Ammo Pickup</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
<xs:complexType>
|
|
||||||
<xs:all>
|
|
||||||
<xs:element name="RespawnTimer" type="t:double" minOccurs="0">
|
|
||||||
<xs:annotation><xs:documentation>The respawn timer for a ammo pickup</xs:documentation></xs:annotation>
|
|
||||||
</xs:element>
|
|
||||||
<xs:element name="AmmoGain" type="t:double" minOccurs="0">
|
|
||||||
<xs:annotation><xs:documentation>How much percent ammo gain the player will get</xs:documentation></xs:annotation>
|
|
||||||
</xs:element>
|
|
||||||
</xs:all>
|
|
||||||
</xs:complexType>
|
|
||||||
</xs:element>
|
|
||||||
</xs:schema>
|
|
||||||
@@ -6,6 +6,4 @@
|
|||||||
<MaxAmmo>360</MaxAmmo>
|
<MaxAmmo>360</MaxAmmo>
|
||||||
<BaseDamage>5</BaseDamage>
|
<BaseDamage>5</BaseDamage>
|
||||||
<RPM>120</RPM>
|
<RPM>120</RPM>
|
||||||
<ViewPunch>0.01</ViewPunch>
|
|
||||||
<ReloadTime>2</ReloadTime>
|
|
||||||
</AssaultWeapon>
|
</AssaultWeapon>
|
||||||
@@ -22,12 +22,6 @@
|
|||||||
<xs:element name="RPM" type="t:double" minOccurs="0">
|
<xs:element name="RPM" type="t:double" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>Rate of fire in rounds per minute</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>Rate of fire in rounds per minute</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="ViewPunch" type="t:float" minOccurs="0">
|
|
||||||
<xs:annotation><xs:documentation>View punch in radians for each bullet fired</xs:documentation></xs:annotation>
|
|
||||||
</xs:element>
|
|
||||||
<xs:element name="ReloadTime" type="t:double" minOccurs="0">
|
|
||||||
<xs:annotation><xs:documentation>Time it takes to reload the weapon in seconds</xs:documentation></xs:annotation>
|
|
||||||
</xs:element>
|
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<CapturePoint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePoint.xsd">
|
<CapturePoint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePoint.xsd">
|
||||||
<CapturePointNumber>0</CapturePointNumber>
|
<CapturePointNumber>0</CapturePointNumber>
|
||||||
<CaptureTimer>0</CaptureTimer>
|
<CaptureTimer>0</CaptureTimer>
|
||||||
<CapturePointMaxTimer>15</CapturePointMaxTimer>
|
|
||||||
<HomePointForTeam><Spectator/></HomePointForTeam>
|
<HomePointForTeam><Spectator/></HomePointForTeam>
|
||||||
</CapturePoint>
|
</CapturePoint>
|
||||||
@@ -20,11 +20,7 @@
|
|||||||
<xs:documentation>CapturePointNumber specify an int number for this</xs:documentation>
|
<xs:documentation>CapturePointNumber specify an int number for this</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="CapturePointMaxTimer" type="t:double" minOccurs="0">
|
|
||||||
<xs:annotation>
|
|
||||||
<xs:documentation>The time needed to take over a Capture Point</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
</xs:element>
|
|
||||||
<xs:element name="HomePointForTeam" type="TeamEnum" minOccurs="0">
|
<xs:element name="HomePointForTeam" type="TeamEnum" minOccurs="0">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>Specify if this is a HomePoint for either team</xs:documentation>
|
<xs:documentation>Specify if this is a HomePoint for either team</xs:documentation>
|
||||||
|
|||||||
@@ -2,5 +2,4 @@
|
|||||||
<Player xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Player.xsd">
|
<Player xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Player.xsd">
|
||||||
<MovementSpeed>3</MovementSpeed>
|
<MovementSpeed>3</MovementSpeed>
|
||||||
<CrouchSpeed>1.5</CrouchSpeed>
|
<CrouchSpeed>1.5</CrouchSpeed>
|
||||||
<CurrentWishDirection X="0" Y="0" Z="0"/>
|
|
||||||
</Player>
|
</Player>
|
||||||
@@ -5,13 +5,12 @@
|
|||||||
|
|
||||||
<xs:element name="Player">
|
<xs:element name="Player">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>The player entity</xs:documentation>
|
<xs:documentation>The player charachter</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:all>
|
<xs:all>
|
||||||
<xs:element name="MovementSpeed" type="t:float" minOccurs="0"/>
|
<xs:element name="MovementSpeed" type="t:float" minOccurs="0"/>
|
||||||
<xs:element name="CrouchSpeed" type="t:float" minOccurs="0"/>
|
<xs:element name="CrouchSpeed" type="t:float" minOccurs="0"/>
|
||||||
<xs:element name="CurrentWishDirection" type="t:Vector" minOccurs="0"/>
|
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
|
||||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
|
||||||
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:AmmoPickup/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="1" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
<c:Trigger/>
|
|
||||||
</Components>
|
|
||||||
|
|
||||||
<Children/>
|
|
||||||
|
|
||||||
</Entity>
|
|
||||||
@@ -1,294 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
|
||||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
|
||||||
|
|
||||||
<Components>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
|
|
||||||
<Children>
|
|
||||||
<Entity name="Scenemesh">
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/LevelBase/MapVersion1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="DirectionalLight">
|
|
||||||
<Components>
|
|
||||||
<c:DirectionalLight>
|
|
||||||
<Intensity>2</Intensity>
|
|
||||||
</c:DirectionalLight>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="61.9050903" Z="0"/>
|
|
||||||
<Scale X="50" Y="50" Z="50"/>
|
|
||||||
<Orientation X="4.42700005" Y="0" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="PointLight">
|
|
||||||
<Components>
|
|
||||||
<c:PointLight>
|
|
||||||
<Radius>8</Radius>
|
|
||||||
<Intensity>2.7999999523162842</Intensity>
|
|
||||||
</c:PointLight>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.370978802" Y="1.88588905" Z="-0.55370003"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="PointLight">
|
|
||||||
<Components>
|
|
||||||
<c:PointLight>
|
|
||||||
<Radius>8</Radius>
|
|
||||||
<Intensity>2.7999999523162842</Intensity>
|
|
||||||
</c:PointLight>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="38.0347443" Y="1.88588905" Z="62.7340622"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.904668212" Y="0" Z="8.48177528"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-4.61666441" Y="0" Z="-8.51156044"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-7.56803513" Y="-0.0658408776" Z="0.59418112"/>
|
|
||||||
<Scale X="1.20000005" Y="0.900000036" Z="1.30000007"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="10.460474" Y="0" Z="-3.92580295"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="1.09146011" Y="-0.315138876" Z="-0.333906144"/>
|
|
||||||
<Scale X="150" Y="1" Z="180"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="BluSpawn">
|
|
||||||
<Components>
|
|
||||||
<c:PlayerSpawn/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Blue/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="57.7363472" Y="1.18853188" Z="79.5"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:SpawnPoint/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:SpawnPoint/>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-2.05988312" Y="0" Z="2.79573512"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="1.85022807" Y="0" Z="-2.08909845"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="2.98651481" Y="0" Z="-4.67667246"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-5.16323137" Y="0" Z="3.62892342"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="RedSpawn">
|
|
||||||
<Components>
|
|
||||||
<c:PlayerSpawn/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Red/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-60.2567062" Y="1.60000002" Z="-78.1000061"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:SpawnPoint/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0" Z="2.24403"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="2.20245028" Y="0" Z="-1.97843659"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="4.79769945" Y="0" Z="-5.2088728"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:AmmoPickup>
|
|
||||||
<RespawnTimer>1</RespawnTimer>
|
|
||||||
<AmmoGain>22</AmmoGain>
|
|
||||||
</c:AmmoPickup>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="60" Y="1" Z="75"/>
|
|
||||||
</c:Transform>
|
|
||||||
<c:Trigger/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:AmmoPickup>
|
|
||||||
<RespawnTimer>1</RespawnTimer>
|
|
||||||
<AmmoGain>22</AmmoGain>
|
|
||||||
</c:AmmoPickup>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="60" Y="1" Z="77"/>
|
|
||||||
</c:Transform>
|
|
||||||
<c:Trigger/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:AmmoPickup>
|
|
||||||
<RespawnTimer>4</RespawnTimer>
|
|
||||||
<AmmoGain>44</AmmoGain>
|
|
||||||
</c:AmmoPickup>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="60" Y="1" Z="79"/>
|
|
||||||
</c:Transform>
|
|
||||||
<c:Trigger/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
|
|
||||||
</Entity>
|
|
||||||
@@ -26,25 +26,29 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Running">
|
<Entity name="Wave">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Run</AnimationName1>
|
<AnimationName1>Run</AnimationName1>
|
||||||
<Weight1>0.5</Weight1>
|
<Weight1>0.5</Weight1>
|
||||||
<Time1>0.60188997954429357</Time1>
|
<Time1>0.78014858943309839</Time1>
|
||||||
<Speed1>-1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
<Speed2>1</Speed2>
|
<Speed2>1</Speed2>
|
||||||
|
<AnimationName2>StrafeRight</AnimationName2>
|
||||||
<Weight2>0.5</Weight2>
|
<Weight2>0.5</Weight2>
|
||||||
<Time2>0.96957233017255007</Time2>
|
<Time2>0.78620929522779459</Time2>
|
||||||
<Time3>0.093923612201312068</Time3>
|
<AnimationName3>ShootFastRifle</AnimationName3>
|
||||||
|
<Time3>0.13809128482706701</Time3>
|
||||||
<Speed3>1</Speed3>
|
<Speed3>1</Speed3>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:AnimationOffset>
|
<c:AnimationOffset>
|
||||||
<AnimationName>AimRifle</AnimationName>
|
<AnimationName>AimRifle</AnimationName>
|
||||||
<Time>0.5</Time>
|
<Time>0.040000014007091522</Time>
|
||||||
</c:AnimationOffset>
|
</c:AnimationOffset>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||||
|
<Color A="0.627451003" B="19.6078434" G="1" R="3.92156863"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.690088332" Y="0" Z="0"/>
|
<Position X="-0.690088332" Y="0" Z="0"/>
|
||||||
@@ -58,11 +62,13 @@
|
|||||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||||
</c:BoneAttachment>
|
</c:BoneAttachment>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
<Resource>Models/Weapons/Blue/AssaultWeapon.mesh</Resource>
|
||||||
|
<Color A="1" B="1" G="1" R="19.6078434"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.161975682" Y="1.06281972" Z="-0.216630161"/>
|
<Position X="0.144055843" Y="0.970111489" Z="-0.126199633"/>
|
||||||
<Orientation X="-0.064812161" Y="-0.0739696771" Z="0.143780142"/>
|
<Orientation X="-0.535831392" Y="0.0691146553" Z="-0.0608282126"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -72,28 +78,14 @@
|
|||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
<Color A="1" B="0.70588237" G="0.70588237" R="1"/>
|
|
||||||
<Radius>10</Radius>
|
<Radius>10</Radius>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.375567257" Y="2.13093901" Z="-0.718547285"/>
|
<Position X="0" Y="1.0823108" Z="0.738871336"/>
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:PointLight>
|
|
||||||
<Color A="1" B="1" G="0.70588237" R="0.70588237"/>
|
|
||||||
<Radius>10</Radius>
|
|
||||||
</c:PointLight>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-1.96873236" Y="0" Z="0"/>
|
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
@@ -105,43 +97,6 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Animation>
|
|
||||||
<AnimationName1>ShootFastRifle</AnimationName1>
|
|
||||||
<Time1>0.056234247235838808</Time1>
|
|
||||||
<Speed1>1</Speed1>
|
|
||||||
<Speed2>1</Speed2>
|
|
||||||
<AnimationName2>Idl</AnimationName2>
|
|
||||||
<Weight2>0.5</Weight2>
|
|
||||||
<Time2>1.8308673495784191</Time2>
|
|
||||||
<AnimationName3>StrafeRigh</AnimationName3>
|
|
||||||
<Weight3>0.5</Weight3>
|
|
||||||
<Time3>0.32167823998061529</Time3>
|
|
||||||
<Speed3>1</Speed3>
|
|
||||||
</c:Animation>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:BoneAttachment>
|
|
||||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
|
||||||
</c:BoneAttachment>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0.803468645" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|||||||
@@ -26,48 +26,57 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Running">
|
<Entity name="Wave">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Run</AnimationName1>
|
<AnimationName1>Run</AnimationName1>
|
||||||
<Weight1>0.5</Weight1>
|
<Weight1>0.5</Weight1>
|
||||||
<Time1>0.14873348341666759</Time1>
|
<Time1>0.97312056690160276</Time1>
|
||||||
<Speed1>-1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
<Speed2>1</Speed2>
|
<Speed2>1</Speed2>
|
||||||
<AnimationName2></AnimationName2>
|
<AnimationName2>ReloadSwitch</AnimationName2>
|
||||||
<Weight2>0.5</Weight2>
|
<Time2>0.91310356788604263</Time2>
|
||||||
<Time2>0.96957233017255007</Time2>
|
<AnimationName3>LeftRight</AnimationName3>
|
||||||
<AnimationName3></AnimationName3>
|
<Weight3>0</Weight3>
|
||||||
<Time3>0.093923612201312068</Time3>
|
<Time3>0.040207288496060478</Time3>
|
||||||
<Speed3>1</Speed3>
|
<Speed3>1</Speed3>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:AnimationOffset>
|
<c:AnimationOffset>
|
||||||
<AnimationName>AimRifle</AnimationName>
|
<AnimationName>DownUp</AnimationName>
|
||||||
|
<Time>0.77999961376190186</Time>
|
||||||
</c:AnimationOffset>
|
</c:AnimationOffset>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
||||||
|
<Color A="0.627451003" B="19.6078434" G="1" R="3.92156863"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.690088332" Y="0" Z="0"/>
|
<Position X="-0.690088332" Y="1.00491476" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity name="R_Arm_Weapon_Joint">
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
<c:BoneAttachment>
|
<c:BoneAttachment>
|
||||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
|
||||||
</c:BoneAttachment>
|
</c:BoneAttachment>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
<Resource>Models/Weapons/Blue/AssaultWeapon.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.106085993" Y="1.24281573" Z="-0.198514819"/>
|
<Position X="0.120548911" Y="-0.223148599" Z="-0.151705116"/>
|
||||||
<Orientation X="0.466044426" Y="0.284358948" Z="-0.0190349482"/>
|
<Orientation X="0.09407565" Y="0.0181003436" Z="0.0279055703"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Camera/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
<Entity>
|
||||||
@@ -92,40 +101,6 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Animation>
|
|
||||||
<AnimationName1>ShootFastRifle</AnimationName1>
|
|
||||||
<Time1>0.11093210511546658</Time1>
|
|
||||||
<Speed1>1</Speed1>
|
|
||||||
</c:Animation>
|
|
||||||
<c:AnimationOffset>
|
|
||||||
<AnimationName>AimRifle</AnimationName>
|
|
||||||
<Time>1</Time>
|
|
||||||
</c:AnimationOffset>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:BoneAttachment>
|
|
||||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
|
||||||
</c:BoneAttachment>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.106085993" Y="1.24281573" Z="-0.198514819"/>
|
|
||||||
<Orientation X="0.466044426" Y="0.284358948" Z="-0.0190349482"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|||||||
@@ -2,246 +2,12 @@
|
|||||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
<Components>
|
<Components>
|
||||||
<c:Transform/>
|
<c:Transform>
|
||||||
|
<Position X="0.340887427" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
|
|
||||||
<Children>
|
<Children>
|
||||||
<Entity name="Scenemesh">
|
|
||||||
<Components>
|
|
||||||
<c:AABB>
|
|
||||||
<Origin X="0.195705414" Y="26.0382366" Z="-0.010017395"/>
|
|
||||||
<Size X="135.414337" Y="68.3848572" Z="180.020035"/>
|
|
||||||
</c:AABB>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/LevelBase/MapVersion1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="DirectionalLight">
|
|
||||||
<Components>
|
|
||||||
<c:DirectionalLight>
|
|
||||||
<Intensity>2</Intensity>
|
|
||||||
</c:DirectionalLight>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="61.9050903" Z="0"/>
|
|
||||||
<Scale X="50" Y="50" Z="50"/>
|
|
||||||
<Orientation X="4.42700005" Y="0" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="PointLight">
|
|
||||||
<Components>
|
|
||||||
<c:PointLight>
|
|
||||||
<Radius>8</Radius>
|
|
||||||
<Intensity>2.7999999523162842</Intensity>
|
|
||||||
</c:PointLight>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.370978802" Y="1.88588905" Z="-0.55370003"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="PointLight">
|
|
||||||
<Components>
|
|
||||||
<c:PointLight>
|
|
||||||
<Radius>8</Radius>
|
|
||||||
<Intensity>2.7999999523162842</Intensity>
|
|
||||||
</c:PointLight>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="38.0347443" Y="1.88588905" Z="62.7340622"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.904668212" Y="0" Z="8.48177528"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-4.61666441" Y="0" Z="-8.51156044"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-7.56803513" Y="-0.0658408776" Z="0.59418112"/>
|
|
||||||
<Scale X="1.20000005" Y="0.900000036" Z="1.30000007"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="10.460474" Y="0" Z="-3.92580295"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="1.09146011" Y="-0.315138876" Z="-0.333906144"/>
|
|
||||||
<Scale X="150" Y="1" Z="180"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="BluSpawn">
|
|
||||||
<Components>
|
|
||||||
<c:PlayerSpawn/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Blue/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="57.7363472" Y="2.38900018" Z="79.5"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:SpawnPoint/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:SpawnPoint/>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-2.05988312" Y="0" Z="2.79573512"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="1.85022807" Y="0" Z="-2.08909845"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="2.98651481" Y="0" Z="-4.67667246"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-5.16323137" Y="0" Z="3.62892342"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="RedSpawn">
|
|
||||||
<Components>
|
|
||||||
<c:PlayerSpawn/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Red/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-60.2567062" Y="3.4000001" Z="-78.1000061"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:SpawnPoint/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0" Z="2.24403"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="2.20245028" Y="0" Z="-1.97843659"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="4.79769945" Y="0" Z="-5.2088728"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
<c:AABB/>
|
<c:AABB/>
|
||||||
@@ -249,12 +15,10 @@
|
|||||||
<HomePointForTeam>
|
<HomePointForTeam>
|
||||||
<Red/>
|
<Red/>
|
||||||
</HomePointForTeam>
|
</HomePointForTeam>
|
||||||
<CaptureTimer>15</CaptureTimer>
|
|
||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="0.300000012" B="0" G="0" R="1"/>
|
<Color A="1" B="0" G="0.200000003" R="1"/>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team>
|
<c:Team>
|
||||||
<Team>
|
<Team>
|
||||||
@@ -262,7 +26,7 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="56.0000038" Y="1.50000012" Z="77.1000061"/>
|
<Position X="6.60000038" Y="0" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -276,12 +40,11 @@
|
|||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
<Color A="1" B="1" G="1" R="0"/>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team/>
|
<c:Team/>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="56.0000038" Y="1.70000005" Z="78.5"/>
|
<Position X="4.46673203" Y="0" Z="3.50259304"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -295,12 +58,15 @@
|
|||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team/>
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Blue/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="56.0000038" Y="1.10000002" Z="79.6000061"/>
|
<Position X="3.00000024" Y="0" Z="0.113596022"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -310,13 +76,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:AABB/>
|
<c:AABB/>
|
||||||
<c:CapturePoint>
|
<c:CapturePoint>
|
||||||
<CaptureTimer>-15</CaptureTimer>
|
|
||||||
<CapturePointNumber>3</CapturePointNumber>
|
<CapturePointNumber>3</CapturePointNumber>
|
||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="0.300000012" B="1" G="0" R="0"/>
|
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team>
|
<c:Team>
|
||||||
<Team>
|
<Team>
|
||||||
@@ -324,7 +88,7 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="56.0000038" Y="1.60000002" Z="80.6000061"/>
|
<Position X="1.75382805" Y="0" Z="0.0895374417"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -337,13 +101,11 @@
|
|||||||
<HomePointForTeam>
|
<HomePointForTeam>
|
||||||
<Blue/>
|
<Blue/>
|
||||||
</HomePointForTeam>
|
</HomePointForTeam>
|
||||||
<CaptureTimer>-15</CaptureTimer>
|
|
||||||
<CapturePointNumber>4</CapturePointNumber>
|
<CapturePointNumber>4</CapturePointNumber>
|
||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="0.300000012" B="1" G="0" R="0"/>
|
<Color A="1" B="1" G="0.200000003" R="0"/>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team>
|
<c:Team>
|
||||||
<Team>
|
<Team>
|
||||||
@@ -351,12 +113,61 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="56.0000038" Y="1.4000001" Z="82.1000061"/>
|
<Position X="0.56674248" Y="0" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Health/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Player/>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Blue/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="4.29100037" Y="-0.08556436" Z="1.29717529"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Health/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Player/>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Red/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="5.43557501" Y="0.888866663" Z="1.55849135"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Test/DummyScene.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.600000024" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|
||||||
</Entity>
|
</Entity>
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
|
||||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
|
||||||
|
|
||||||
<Components>
|
|
||||||
<c:Sprite>
|
|
||||||
<DiffuseTexture>Textures/DamageIndicator.png</DiffuseTexture>
|
|
||||||
<GlowMap></GlowMap>
|
|
||||||
<DepthSort>false</DepthSort>
|
|
||||||
<Color A="1" B="0.721568644" G="1" R="0.839215696"/>
|
|
||||||
</c:Sprite>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0" Z="-0.472000033"/>
|
|
||||||
<Scale X="0.100000001" Y="0.200000003" Z="0.5"/>
|
|
||||||
</c:Transform>
|
|
||||||
<c:Lifetime>
|
|
||||||
<Lifetime>1.5</Lifetime>
|
|
||||||
</c:Lifetime>
|
|
||||||
</Components>
|
|
||||||
|
|
||||||
<Children/>
|
|
||||||
|
|
||||||
</Entity>
|
|
||||||
@@ -1,426 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
|
||||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
|
||||||
|
|
||||||
<Components>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
|
|
||||||
<Children>
|
|
||||||
<Entity name="Scenemesh">
|
|
||||||
<Components>
|
|
||||||
<c:AABB>
|
|
||||||
<Size X="150" Y="64" Z="180"/>
|
|
||||||
</c:AABB>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models\MapVersion1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="DirectionalLight">
|
|
||||||
<Components>
|
|
||||||
<c:DirectionalLight>
|
|
||||||
<Intensity>2</Intensity>
|
|
||||||
</c:DirectionalLight>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="61.9050903" Z="0"/>
|
|
||||||
<Scale X="50" Y="50" Z="50"/>
|
|
||||||
<Orientation X="4.42700005" Y="0" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="PointLight">
|
|
||||||
<Components>
|
|
||||||
<c:PointLight>
|
|
||||||
<Radius>8</Radius>
|
|
||||||
<Intensity>2.7999999523162842</Intensity>
|
|
||||||
</c:PointLight>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.370978802" Y="1.88588905" Z="-0.55370003"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="PointLight">
|
|
||||||
<Components>
|
|
||||||
<c:PointLight>
|
|
||||||
<Radius>8</Radius>
|
|
||||||
<Intensity>2.7999999523162842</Intensity>
|
|
||||||
</c:PointLight>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="38.0347443" Y="1.88588905" Z="62.7340622"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.904668212" Y="0" Z="8.48177528"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-4.61666441" Y="0" Z="-8.51156044"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-7.56803513" Y="-0.0658408776" Z="0.59418112"/>
|
|
||||||
<Scale X="1.20000005" Y="0.900000036" Z="1.30000007"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="10.460474" Y="0" Z="-3.92580295"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="1.09146011" Y="-0.315138876" Z="-0.333906144"/>
|
|
||||||
<Scale X="150" Y="1" Z="180"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="BluSpawn">
|
|
||||||
<Components>
|
|
||||||
<c:PlayerSpawn/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Blue/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="57.7363472" Y="2.38900018" Z="79.5"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:SpawnPoint/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:SpawnPoint/>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-2.05988312" Y="0" Z="2.79573512"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="1.85022807" Y="0" Z="-2.08909845"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="2.98651481" Y="0" Z="-4.67667246"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-5.16323137" Y="0" Z="3.62892342"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="RedSpawn">
|
|
||||||
<Components>
|
|
||||||
<c:PlayerSpawn/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Red/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-60.2567062" Y="3.4000001" Z="-78.1000061"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:SpawnPoint/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0" Z="2.24403"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="2.20245028" Y="0" Z="-1.97843659"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="4.79769945" Y="0" Z="-5.2088728"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="Player">
|
|
||||||
<Components>
|
|
||||||
<c:AABB>
|
|
||||||
<Origin X="0" Y="0.772000015" Z="0"/>
|
|
||||||
<Size X="1" Y="1.60000002" Z="1"/>
|
|
||||||
</c:AABB>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:DashAbility/>
|
|
||||||
<c:Health>
|
|
||||||
<Health>99</Health>
|
|
||||||
</c:Health>
|
|
||||||
<c:Physics>
|
|
||||||
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
|
||||||
</c:Physics>
|
|
||||||
<c:Player>
|
|
||||||
<MovementSpeed>5</MovementSpeed>
|
|
||||||
</c:Player>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Red/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="57" Y="0.212861136" Z="77"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="Camera">
|
|
||||||
<Components>
|
|
||||||
<c:Camera/>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="1.37700009" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="PlayerName">
|
|
||||||
<Components>
|
|
||||||
<c:Text>
|
|
||||||
<Resource>Fonts/DroidSans.ttf,100</Resource>
|
|
||||||
<Color A="1" B="0" G="1" R="0"/>
|
|
||||||
</c:Text>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.100000001" Y="0.248000011" Z="-0.248000011"/>
|
|
||||||
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
|
|
||||||
<Orientation X="0" Y="3.14199996" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="CameraModel">
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Camera.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
|
|
||||||
<Scale X="1.30000007" Y="1.50000012" Z="1"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="HUD">
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0" Z="-0.5"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="HealthBar">
|
|
||||||
<Components>
|
|
||||||
<c:Fill>
|
|
||||||
<Percentage>0.99000000953674316</Percentage>
|
|
||||||
<Color A="0" B="0.99000001" G="0" R="0.00999999046"/>
|
|
||||||
</c:Fill>
|
|
||||||
<c:HealthHUD/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitHexagon.mesh</Resource>
|
|
||||||
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
|
|
||||||
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
|
|
||||||
<Orientation X="0" Y="0.594000041" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="Crosshair">
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/CrosshairQuad.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0" Z="0.200000003"/>
|
|
||||||
<Scale X="0.00600000005" Y="1" Z="0.00600000005"/>
|
|
||||||
<Orientation X="1.57000005" Y="0" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="Weapon">
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/AssaultWeaponRed.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.180000007" Y="-0.183000013" Z="0"/>
|
|
||||||
<Orientation X="0" Y="3.08300018" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="WeaponMuzzle">
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.215000004" Y="-0.153000012" Z="-0.266000003"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="ThirdPersonCamera">
|
|
||||||
<Components>
|
|
||||||
<c:Camera/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Camera.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.284000009" Y="1.83800006" Z="1.18900001"/>
|
|
||||||
<Orientation X="5.95600033" Y="0" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="PlayerModel">
|
|
||||||
<Components>
|
|
||||||
<c:Animation/>
|
|
||||||
<c:HiddenForLocalPlayer/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
|
||||||
<Color A="1" B="0" G="0" R="1"/>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="AABBStanding">
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
<Color A="0.427450985" B="1" G="1" R="1"/>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0.772000015" Z="0"/>
|
|
||||||
<Scale X="1" Y="1.60000002" Z="1"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="AABBCrouching">
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
<Color A="0.745098054" B="1" G="0" R="1"/>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0.772000015" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
|
|
||||||
</Entity>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
|
||||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
|
||||||
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Effects/JumpEffectHexagon.mesh</Resource>
|
|
||||||
<Color A="0.576470613" B="500" G="255" R="0.854901969"/>
|
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.600000024" Y="0.800000012" Z="0"/>
|
|
||||||
<Scale X="0.50000012" Y="0.50000019" Z="0.50000014"/>
|
|
||||||
</c:Transform>
|
|
||||||
<c:Lifetime>
|
|
||||||
<Lifetime>0.5</Lifetime>
|
|
||||||
</c:Lifetime>
|
|
||||||
<c:ExplosionEffect>
|
|
||||||
<ColorByDistance>true</ColorByDistance>
|
|
||||||
<Velocity X="0" Y="-7.76300049" Z="0"/>
|
|
||||||
<ExplosionOrigin X="0" Y="2.67900002" Z="0"/>
|
|
||||||
<ExponentialAccelaration>true</ExponentialAccelaration>
|
|
||||||
<ExplosionDuration>0.5</ExplosionDuration>
|
|
||||||
<EndColor A="0" B="0" G="0" R="1"/>
|
|
||||||
<Randomness>true</Randomness>
|
|
||||||
</c:ExplosionEffect>
|
|
||||||
</Components>
|
|
||||||
|
|
||||||
<Children/>
|
|
||||||
|
|
||||||
</Entity>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
|
||||||
<Entity name="HitMarker" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
|
||||||
|
|
||||||
<Components>
|
|
||||||
<c:Lifetime>
|
|
||||||
<Lifetime>0.1</Lifetime>
|
|
||||||
</c:Lifetime>
|
|
||||||
<c:Sprite>
|
|
||||||
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
|
||||||
<DepthSort>false</DepthSort>
|
|
||||||
</c:Sprite>
|
|
||||||
<c:Transform>
|
|
||||||
<Scale X="0.031" Y="0.031" Z="1"/>
|
|
||||||
<Orientation X="0" Y="0" Z="0.782"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
|
|
||||||
<Children/>
|
|
||||||
|
|
||||||
</Entity>
|
|
||||||
@@ -124,14 +124,10 @@
|
|||||||
<Origin X="0" Y="0.772000015" Z="0"/>
|
<Origin X="0" Y="0.772000015" Z="0"/>
|
||||||
<Size X="1" Y="1.60000002" Z="1"/>
|
<Size X="1" Y="1.60000002" Z="1"/>
|
||||||
</c:AABB>
|
</c:AABB>
|
||||||
<c:AssaultWeapon>
|
|
||||||
<RPM>600</RPM>
|
|
||||||
</c:AssaultWeapon>
|
|
||||||
<c:Collidable/>
|
<c:Collidable/>
|
||||||
<c:DashAbility/>
|
<c:Model/>
|
||||||
<c:Health/>
|
|
||||||
<c:Physics>
|
<c:Physics>
|
||||||
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
<Gravity>false</Gravity>
|
||||||
</c:Physics>
|
</c:Physics>
|
||||||
<c:Player>
|
<c:Player>
|
||||||
<MovementSpeed>5</MovementSpeed>
|
<MovementSpeed>5</MovementSpeed>
|
||||||
@@ -142,7 +138,8 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.0288832653" Z="2.64837074"/>
|
<Position X="-1.68112314" Y="0.0288829971" Z="3.06287026"/>
|
||||||
|
<Orientation X="0" Y="2.14675093" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -150,7 +147,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Camera/>
|
<c:Camera/>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="1.27700007" Z="0"/>
|
<Position X="0" Y="1.37700009" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -159,9 +156,10 @@
|
|||||||
<c:Text>
|
<c:Text>
|
||||||
<Resource>Fonts/DroidSans.ttf,100</Resource>
|
<Resource>Fonts/DroidSans.ttf,100</Resource>
|
||||||
<Color A="1" B="0" G="1" R="0"/>
|
<Color A="1" B="0" G="1" R="0"/>
|
||||||
|
<Visible>false</Visible>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.100000001" Y="0.248000011" Z="-0.248000011"/>
|
<Position X="0" Y="0.247910097" Z="-0.447844714"/>
|
||||||
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
|
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
|
||||||
<Orientation X="0" Y="3.14199996" Z="0"/>
|
<Orientation X="0" Y="3.14199996" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
@@ -172,7 +170,6 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
|
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
|
||||||
@@ -181,100 +178,6 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="HUD">
|
|
||||||
<Components>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0" Z="-0.5"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="HealthBar">
|
|
||||||
<Components>
|
|
||||||
<c:Fill>
|
|
||||||
<Percentage>1</Percentage>
|
|
||||||
<Color A="0" B="1" G="0" R="0"/>
|
|
||||||
</c:Fill>
|
|
||||||
<c:HealthHUD/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitHexagon.mesh</Resource>
|
|
||||||
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
|
|
||||||
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
|
|
||||||
<Orientation X="0" Y="0.594000041" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="Crosshair">
|
|
||||||
<Components>
|
|
||||||
<c:Sprite>
|
|
||||||
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
|
||||||
<DepthSort>false</DepthSort>
|
|
||||||
</c:Sprite>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0" Y="0" Z="0.200000003"/>
|
|
||||||
<Scale X="0.0250000004" Y="0.0250000004" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="Hands">
|
|
||||||
<Components>
|
|
||||||
<c:Animation>
|
|
||||||
<AnimationName1>Idle</AnimationName1>
|
|
||||||
<Time1>1.9569972344146196</Time1>
|
|
||||||
<Speed1>1</Speed1>
|
|
||||||
</c:Animation>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="WeaponModel">
|
|
||||||
<Components>
|
|
||||||
<c:BoneAttachment>
|
|
||||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
|
||||||
</c:BoneAttachment>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.120748013" Y="-0.228470564" Z="-0.151475638"/>
|
|
||||||
<Orientation X="0.010404693" Y="-0.00268176314" Z="0.0428441502"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="WeaponMuzzle">
|
|
||||||
<Components>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="FirstPersonReloadSpawner">
|
|
||||||
<Components>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/WeaponReloadEffect.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="ThirdPersonCamera">
|
<Entity name="ThirdPersonCamera">
|
||||||
@@ -293,53 +196,16 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="PlayerModel">
|
<Entity name="PlayerModel">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
|
||||||
<AnimationName1>Idle</AnimationName1>
|
|
||||||
<Time1>1.8055945618467364</Time1>
|
|
||||||
<Speed1>1</Speed1>
|
|
||||||
</c:Animation>
|
|
||||||
<c:AnimationOffset>
|
|
||||||
<AnimationName>AimRifle</AnimationName>
|
|
||||||
<Time>0.5</Time>
|
|
||||||
</c:AnimationOffset>
|
|
||||||
<c:HiddenForLocalPlayer/>
|
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
<Resource>Models/Characters/Assault/AssaultHeadless.mesh</Resource>
|
||||||
<Color A="1" B="0" G="0" R="1"/>
|
<Color A="1" B="0" G="0" R="1"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="ThirdPersonWeaponModel">
|
|
||||||
<Components>
|
|
||||||
<c:BoneAttachment>
|
|
||||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
|
||||||
</c:BoneAttachment>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.158578917" Y="1.02878916" Z="-0.215411991"/>
|
<Orientation X="0" Y="3.14159274" Z="0"/>
|
||||||
<Orientation X="-0.0626687407" Y="-0.0361274257" Z="0.120101407"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children>
|
|
||||||
<Entity name="ThirdPersonWeaponMuzzle">
|
|
||||||
<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>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
</Entity>
|
|
||||||
<Entity name="AABBStanding">
|
<Entity name="AABBStanding">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
|
|||||||
+487
-3083
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -23,9 +23,7 @@
|
|||||||
<Blue/>
|
<Blue/>
|
||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform/>
|
||||||
<Position X="0" Y="0.0288832653" Z="2.64837074"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
</Components>
|
||||||
|
|
||||||
<Children>
|
<Children>
|
||||||
@@ -92,33 +90,24 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Crosshair">
|
<Entity name="Crosshair">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Sprite>
|
<c:Model>
|
||||||
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
<Resource>Models/Weapons/CrosshairQuad.mesh</Resource>
|
||||||
<DepthSort>false</DepthSort>
|
</c:Model>
|
||||||
</c:Sprite>
|
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.200000003"/>
|
<Position X="0" Y="0" Z="0.200000003"/>
|
||||||
<Scale X="0.0250000004" Y="0.0250000004" Z="0"/>
|
<Scale X="0.00600000005" Y="1" Z="0.00600000005"/>
|
||||||
|
<Orientation X="1.57000005" Y="0" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="HitMarkerSpawner">
|
|
||||||
<Components>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/HitMarker.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Hands">
|
<Entity name="Hands">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>0.1719161089749548</Time1>
|
<Time1>0.52743271827223559</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
@@ -135,11 +124,10 @@
|
|||||||
</c:BoneAttachment>
|
</c:BoneAttachment>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.120747983" Y="-0.228997007" Z="-0.151475653"/>
|
<Position X="0.120747946" Y="-0.232330009" Z="-0.151475713"/>
|
||||||
<Orientation X="0.0104046585" Y="-0.00268164417" Z="0.0428441912"/>
|
<Orientation X="0.0104046576" Y="-0.00268170447" Z="0.0428439789"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -156,15 +144,6 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="FirstPersonReloadSpawner">
|
|
||||||
<Components>
|
|
||||||
<c:Spawner>
|
|
||||||
<EntityFile>Schema/Entities/WeaponReloadEffect.xml</EntityFile>
|
|
||||||
</c:Spawner>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
@@ -187,7 +166,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>1.8038469763698401</Time1>
|
<Time1>0.69666320633760392</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:AnimationOffset>
|
<c:AnimationOffset>
|
||||||
@@ -209,11 +188,10 @@
|
|||||||
</c:BoneAttachment>
|
</c:BoneAttachment>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.15859656" Y="1.02875519" Z="-0.21540691"/>
|
<Position X="0.162715688" Y="1.02479136" Z="-0.215626657"/>
|
||||||
<Orientation X="-0.0626692101" Y="-0.0361935496" Z="0.120095037"/>
|
<Orientation X="-0.0629899353" Y="-0.0542047173" Z="0.11849726"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
|
||||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
|
||||||
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="47.681942" Y="0.14480646" Z="46.8966408"/>
|
|
||||||
<Scale X="2" Y="2" Z="2"/>
|
|
||||||
<Orientation X="5.9380002" Y="0" Z="0.35800001"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
|
|
||||||
<Children>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="1.10786498" Y="-0.615343928" Z="-0.37226662"/>
|
|
||||||
<Orientation X="0.443000019" Y="0.685000062" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="2.15796614" Y="-1.18461192" Z="-0.382025093"/>
|
|
||||||
<Orientation X="0" Y="2.18400002" Z="5.72200012"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="3.53984666" Y="-1.55501318" Z="-0.237787247"/>
|
|
||||||
<Orientation X="0.604000032" Y="0.640000045" Z="6.28300047"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-2.86977816" Y="0.0265773162" Z="0.530605257"/>
|
|
||||||
<Orientation X="0" Y="4.71200037" Z="5.89000034"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-4.06748295" Y="1.2850678" Z="1.0140655"/>
|
|
||||||
<Orientation X="0" Y="4.94500017" Z="5.66600037"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-1.6440227" Y="-0.104511783" Z="0.248545036"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="3.22254896" Y="-0.99158901" Z="-1.59910381"/>
|
|
||||||
<Orientation X="0.268000007" Y="5.9920001" Z="6.00300026"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-3.07137322" Y="0.124666147" Z="1.97699928"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-4.24249363" Y="0.303708076" Z="1.92021227"/>
|
|
||||||
<Orientation X="0" Y="2.95000005" Z="5.79700041"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Collidable/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-1.89417958" Y="-0.57703048" Z="0.874724686"/>
|
|
||||||
<Orientation X="0.345000029" Y="0.651000023" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
|
||||||
|
|
||||||
</Entity>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
|
||||||
<Entity name="WeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
|
||||||
|
|
||||||
<Components>
|
|
||||||
<c:BoneAttachment>
|
|
||||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
|
||||||
</c:BoneAttachment>
|
|
||||||
<c:Lifetime>
|
|
||||||
<Lifetime>2</Lifetime>
|
|
||||||
</c:Lifetime>
|
|
||||||
<c:ExplosionEffect>
|
|
||||||
<ColorByDistance>true</ColorByDistance>
|
|
||||||
<Velocity X="3.33300018" 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="1"/>
|
|
||||||
<Randomness>true</Randomness>
|
|
||||||
</c:ExplosionEffect>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="0.120747991" Y="-0.229502052" Z="-0.151475638"/>
|
|
||||||
<Orientation X="0.0104046296" Y="-0.00268167513" Z="0.0428442545"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
|
|
||||||
<Children/>
|
|
||||||
|
|
||||||
</Entity>
|
|
||||||
@@ -1,245 +0,0 @@
|
|||||||
#version 430
|
|
||||||
|
|
||||||
uniform mat4 M;
|
|
||||||
uniform mat4 V;
|
|
||||||
uniform mat4 P;
|
|
||||||
uniform vec2 ScreenDimensions;
|
|
||||||
uniform float FillPercentage;
|
|
||||||
uniform vec4 DiffuseColor;
|
|
||||||
uniform vec4 FillColor;
|
|
||||||
uniform vec4 Color;
|
|
||||||
uniform vec4 AmbientColor;
|
|
||||||
|
|
||||||
//Get bineded at the same time as the textures
|
|
||||||
uniform vec2 DiffuseUVRepeat1;
|
|
||||||
uniform vec2 DiffuseUVRepeat2;
|
|
||||||
uniform vec2 DiffuseUVRepeat3;
|
|
||||||
uniform vec2 NormalUVRepeat1;
|
|
||||||
uniform vec2 NormalUVRepeat2;
|
|
||||||
uniform vec2 NormalUVRepeat3;
|
|
||||||
uniform vec2 SpecularUVRepeat1;
|
|
||||||
uniform vec2 SpecularUVRepeat2;
|
|
||||||
uniform vec2 SpecularUVRepeat3;
|
|
||||||
uniform vec2 GlowUVRepeat1;
|
|
||||||
uniform vec2 GlowUVRepeat2;
|
|
||||||
uniform vec2 GlowUVRepeat3;
|
|
||||||
layout (binding = 0) uniform sampler2D SplatMapTexture;
|
|
||||||
layout (binding = 1) uniform sampler2D DiffuseTexture1;
|
|
||||||
layout (binding = 2) uniform sampler2D DiffuseTexture2;
|
|
||||||
layout (binding = 3) uniform sampler2D DiffuseTexture3;
|
|
||||||
layout (binding = 4) uniform sampler2D NormalMapTexture1;
|
|
||||||
layout (binding = 5) uniform sampler2D NormalMapTexture2;
|
|
||||||
layout (binding = 6) uniform sampler2D NormalMapTexture3;
|
|
||||||
layout (binding = 7) uniform sampler2D SpecularMapTexture1;
|
|
||||||
layout (binding = 8) uniform sampler2D SpecularMapTexture2;
|
|
||||||
layout (binding = 9) uniform sampler2D SpecularMapTexture3;
|
|
||||||
layout (binding = 10) uniform sampler2D GlowMapTexture1;
|
|
||||||
layout (binding = 11) uniform sampler2D GlowMapTexture2;
|
|
||||||
layout (binding = 12) uniform sampler2D GlowMapTexture3;
|
|
||||||
|
|
||||||
#define TILE_SIZE 16
|
|
||||||
|
|
||||||
struct LightSource {
|
|
||||||
vec4 Position;
|
|
||||||
vec4 Direction;
|
|
||||||
vec4 Color;
|
|
||||||
float Radius;
|
|
||||||
float Intensity;
|
|
||||||
float Falloff;
|
|
||||||
int Type;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout (std430, binding = 1) buffer LightBuffer
|
|
||||||
{
|
|
||||||
LightSource List[];
|
|
||||||
} LightSources;
|
|
||||||
|
|
||||||
struct LightGrid {
|
|
||||||
float Start;
|
|
||||||
float Amount;
|
|
||||||
vec2 Padding;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout (std430, binding = 2) buffer LightGridBuffer
|
|
||||||
{
|
|
||||||
LightGrid Data[];
|
|
||||||
} LightGrids;
|
|
||||||
|
|
||||||
layout (std430, binding = 4) buffer LightIndexBuffer
|
|
||||||
{
|
|
||||||
float LightIndex[];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
in VertexData{
|
|
||||||
vec3 Position;
|
|
||||||
vec3 Normal;
|
|
||||||
vec3 Tangent;
|
|
||||||
vec3 BiTangent;
|
|
||||||
vec2 TextureCoordinate;
|
|
||||||
vec4 ExplosionColor;
|
|
||||||
float ExplosionPercentageElapsed;
|
|
||||||
}Input;
|
|
||||||
|
|
||||||
out vec4 sceneColor;
|
|
||||||
out vec4 bloomColor;
|
|
||||||
|
|
||||||
struct LightResult {
|
|
||||||
vec4 Diffuse;
|
|
||||||
vec4 Specular;
|
|
||||||
};
|
|
||||||
|
|
||||||
float CalcAttenuation(float radius, float dist, float falloff) {
|
|
||||||
return 1.0 - smoothstep(radius * 0.3, radius, dist);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 CalcSpecular(vec4 lightColor, vec4 viewVec, vec4 lightVec, vec4 normal) {
|
|
||||||
vec4 R = normalize( reflect(-lightVec, normal));
|
|
||||||
float RdotV = max( dot(R, viewVec), 0.0);
|
|
||||||
return lightColor * pow(RdotV, 90.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 CalcDiffuse(vec4 lightColor, vec4 lightVec, vec4 normal) {
|
|
||||||
float power = max( dot(normal, lightVec), 0.0);
|
|
||||||
return lightColor * power;
|
|
||||||
}
|
|
||||||
|
|
||||||
LightResult CalcPointLightSource(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal, float falloff)
|
|
||||||
{
|
|
||||||
vec4 L = lightPos - position;
|
|
||||||
float dist = length(L);
|
|
||||||
L = normalize(L);
|
|
||||||
|
|
||||||
float attenuation = CalcAttenuation(lightRadius, dist, falloff);
|
|
||||||
|
|
||||||
LightResult result;
|
|
||||||
result.Diffuse = CalcDiffuse(lightColor, L, normal) * attenuation * intensity;
|
|
||||||
result.Specular = CalcSpecular(lightColor, viewVec, L, normal) * attenuation * intensity;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensity, vec4 viewVec, vec4 vertNormal)
|
|
||||||
{
|
|
||||||
vec4 L = normalize( -vec4(direction.xyz, 0) );
|
|
||||||
|
|
||||||
LightResult result;
|
|
||||||
result.Diffuse = CalcDiffuse(color, L, vertNormal) * intensity;
|
|
||||||
result.Specular = CalcSpecular(color, viewVec, L, vertNormal) * intensity;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
|
|
||||||
{
|
|
||||||
mat3 TBN = mat3(tangent, bitangent, normal);
|
|
||||||
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
|
|
||||||
return vec4(TBN * normalize(NormalMap), 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
|
|
||||||
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){
|
|
||||||
vec4 R_Channel = texture2D(R, Input.TextureCoordinate * R_TileValues);
|
|
||||||
vec4 G_Channel = texture2D(G, Input.TextureCoordinate * G_TileValues);
|
|
||||||
vec4 B_Channel = texture2D(B, Input.TextureCoordinate * B_TileValues);
|
|
||||||
|
|
||||||
float total = blendValue.r + blendValue.g + blendValue.b;
|
|
||||||
float totalDiv = 1.0f / total;
|
|
||||||
blendValue.r = blendValue.r * totalDiv;
|
|
||||||
blendValue.g = blendValue.g * totalDiv;
|
|
||||||
blendValue.b = blendValue.b * totalDiv;
|
|
||||||
|
|
||||||
return blendValue.r * R_Channel
|
|
||||||
+ blendValue.g * G_Channel
|
|
||||||
+ blendValue.b * B_Channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
|
|
||||||
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){
|
|
||||||
mat3 TBN = mat3(Input.Tangent, Input.BiTangent, Input.Normal);
|
|
||||||
vec3 R_Channel = texture(R, Input.TextureCoordinate * R_TileValues).xyz * 2.0 - vec3(1.0);
|
|
||||||
vec3 G_Channel = texture(G, Input.TextureCoordinate * G_TileValues).xyz * 2.0 - vec3(1.0);
|
|
||||||
vec3 B_Channel = texture(B, Input.TextureCoordinate * B_TileValues).xyz * 2.0 - vec3(1.0);
|
|
||||||
|
|
||||||
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
|
|
||||||
float totalDiv = 1 / total;
|
|
||||||
blendValue.r = blendValue.r * totalDiv;
|
|
||||||
blendValue.g = blendValue.g * totalDiv;
|
|
||||||
blendValue.b = blendValue.b * totalDiv;
|
|
||||||
|
|
||||||
vec3 Normal_result = blendValue.r * R_Channel
|
|
||||||
+ blendValue.g * G_Channel
|
|
||||||
+ blendValue.b * B_Channel;
|
|
||||||
|
|
||||||
return vec4(TBN * normalize(Normal_result), 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec4 splatTexel = texture2D(SplatMapTexture, Input.TextureCoordinate);
|
|
||||||
|
|
||||||
vec4 diffuseTexel = CalcBlendedTexel(splatTexel, DiffuseTexture1, DiffuseTexture2, DiffuseTexture3,
|
|
||||||
DiffuseUVRepeat1, DiffuseUVRepeat2, DiffuseUVRepeat3);
|
|
||||||
vec4 glowTexel = CalcBlendedTexel(splatTexel, GlowMapTexture1, GlowMapTexture2, GlowMapTexture3,
|
|
||||||
GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3);
|
|
||||||
vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3,
|
|
||||||
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
|
|
||||||
vec4 position = V * M * vec4(Input.Position, 1.0);
|
|
||||||
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
|
|
||||||
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
|
|
||||||
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3);
|
|
||||||
normal = normalize(normal);
|
|
||||||
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
|
||||||
vec4 viewVec = normalize(-position);
|
|
||||||
|
|
||||||
vec2 tilePos;
|
|
||||||
tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
|
|
||||||
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
|
||||||
|
|
||||||
LightResult totalLighting;
|
|
||||||
totalLighting.Diffuse = vec4(AmbientColor.rgb, 1.0);
|
|
||||||
int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE)));
|
|
||||||
|
|
||||||
int start = int(LightGrids.Data[currentTile].Start);
|
|
||||||
int amount = int(LightGrids.Data[currentTile].Amount);
|
|
||||||
|
|
||||||
for(int i = start; i < start + amount; i++) {
|
|
||||||
|
|
||||||
int l = int(LightIndex[i]);
|
|
||||||
LightSource light = LightSources.List[l];
|
|
||||||
|
|
||||||
LightResult light_result;
|
|
||||||
//These if statements should be removed.
|
|
||||||
if(light.Type == 1) { // point
|
|
||||||
light_result = CalcPointLightSource(V * light.Position, light.Radius, light.Color, light.Intensity, viewVec, position, normal, light.Falloff);
|
|
||||||
} else if (light.Type == 2) { //Directional
|
|
||||||
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
|
||||||
}
|
|
||||||
totalLighting.Diffuse += light_result.Diffuse;
|
|
||||||
totalLighting.Specular += light_result.Specular;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
|
||||||
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
|
|
||||||
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
|
|
||||||
|
|
||||||
|
|
||||||
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
|
|
||||||
|
|
||||||
if(pos <= FillPercentage) {
|
|
||||||
color_result += FillColor;
|
|
||||||
}
|
|
||||||
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
|
||||||
color_result += glowTexel*3;
|
|
||||||
|
|
||||||
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
|
|
||||||
|
|
||||||
//Tiled Debug Code
|
|
||||||
/*
|
|
||||||
if(int(gl_FragCoord.x)%16 == 0 || int(gl_FragCoord.y)%16 == 0 ) {
|
|
||||||
sceneColor += vec4(0.5, 0, 0, 0);
|
|
||||||
} else {
|
|
||||||
sceneColor += vec4(LightGrids.Data[int(tilePos.x + tilePos.y*80)].Amount/LightSources.List.length(), 0, 0, 1);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,16 +1,27 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
|
||||||
uniform vec2 PickingColor;
|
uniform vec2 PickingColor;
|
||||||
|
layout (binding = 0) uniform sampler2D Texture;
|
||||||
|
uniform vec4 Color;
|
||||||
|
uniform vec4 DiffuseColor;
|
||||||
|
uniform vec2 DiffuseUVRepeat;
|
||||||
|
|
||||||
|
|
||||||
in VertexData{
|
in VertexData{
|
||||||
vec3 Position;
|
vec3 Position;
|
||||||
|
vec2 TextureCoord;
|
||||||
}Input;
|
}Input;
|
||||||
|
|
||||||
out vec4 TextureFragment;
|
out vec4 TextureFragment;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
vec4 diffuseTexel = texture2D(Texture, Input.TextureCoord * DiffuseUVRepeat);
|
||||||
|
|
||||||
|
if(Color.a * diffuseTexel.a >= 0.9) {
|
||||||
TextureFragment = vec4(PickingColor/255, 0, 1);
|
TextureFragment = vec4(PickingColor/255, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,12 @@ layout(location = 4) in vec2 TextureCoords;
|
|||||||
|
|
||||||
out VertexData{
|
out VertexData{
|
||||||
vec3 Position;
|
vec3 Position;
|
||||||
|
vec2 TextureCoord;
|
||||||
}Output;
|
}Output;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = P*V*M * vec4(Position, 1.0);
|
gl_Position = P*V*M * vec4(Position, 1.0);
|
||||||
Output.Position = Position, 1.0;
|
Output.Position = Position, 1.0;
|
||||||
|
Output.TextureCoord = TextureCoords;
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@ layout(location = 6) in vec4 BoneWeights;
|
|||||||
|
|
||||||
out VertexData{
|
out VertexData{
|
||||||
vec3 Position;
|
vec3 Position;
|
||||||
|
vec2 TextureCoord;
|
||||||
}Output;
|
}Output;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
@@ -29,4 +30,5 @@ void main()
|
|||||||
|
|
||||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
||||||
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
||||||
|
Output.TextureCoord = TextureCoords;
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,6 @@ void main()
|
|||||||
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||||
|
|
||||||
//bloomColor = vec4(clamp((glowTexel.xyz*3) - 1.0, 0, 100), 1.0);
|
//bloomColor = vec4(clamp((glowTexel.xyz*3) - 1.0, 0, 100), 1.0);
|
||||||
bloomColor = vec4(1.0, 1.0, 1.0, 0.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
#include "Rendering/Model.h"
|
#include "Rendering/Model.h"
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
#include "Core/Octree.h"
|
|
||||||
|
|
||||||
namespace Collision
|
namespace Collision
|
||||||
{
|
{
|
||||||
@@ -146,14 +145,13 @@ bool RayVsTriangle(const Ray& ray,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool RayVsModel(const Ray& ray,
|
bool RayVsModel(const Ray& ray,
|
||||||
const RawModel::Vertex* modelVertices,
|
const std::vector<RawModel::Vertex>& modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices)
|
||||||
const glm::mat4& modelMatrix)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < modelIndices.size();) {
|
for (int i = 0; i < modelIndices.size(); ++i) {
|
||||||
glm::vec3 v0 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
glm::vec3 v0 = modelVertices[modelIndices[i]].Position;
|
||||||
glm::vec3 v1 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
glm::vec3 v1 = modelVertices[modelIndices[++i]].Position;
|
||||||
glm::vec3 v2 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
glm::vec3 v2 = modelVertices[modelIndices[++i]].Position;
|
||||||
if (RayVsTriangle(ray, v0, v1, v2)) {
|
if (RayVsTriangle(ray, v0, v1, v2)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -194,20 +192,19 @@ bool RayVsTriangle(const Ray& ray,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool RayVsModel(const Ray& ray,
|
bool RayVsModel(const Ray& ray,
|
||||||
const RawModel::Vertex* modelVertices,
|
const std::vector<RawModel::Vertex>& modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices,
|
||||||
const glm::mat4& modelMatrix,
|
|
||||||
float& outDistance,
|
float& outDistance,
|
||||||
float& outUCoord,
|
float& outUCoord,
|
||||||
float& outVCoord)
|
float& outVCoord)
|
||||||
{
|
{
|
||||||
outDistance = INFINITY;
|
outDistance = INFINITY;
|
||||||
bool hit = false;
|
bool hit = false;
|
||||||
for (int i = 0; i < modelIndices.size();) {
|
for (int i = 0; i < modelIndices.size(); ++i) {
|
||||||
glm::vec3 v0 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
glm::vec3 v0 = modelVertices[modelIndices[i]].Position;
|
||||||
glm::vec3 v1 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
glm::vec3 v1 = modelVertices[modelIndices[++i]].Position;
|
||||||
glm::vec3 v2 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
glm::vec3 v2 = modelVertices[modelIndices[++i]].Position;
|
||||||
float dist = INFINITY;
|
float dist;
|
||||||
float u;
|
float u;
|
||||||
float v;
|
float v;
|
||||||
if (RayVsTriangle(ray, v0, v1, v2, dist, u, v)) {
|
if (RayVsTriangle(ray, v0, v1, v2, dist, u, v)) {
|
||||||
@@ -221,15 +218,14 @@ bool RayVsModel(const Ray& ray,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool RayVsModel(const Ray& ray,
|
bool RayVsModel(const Ray& ray,
|
||||||
const RawModel::Vertex* modelVertices,
|
const std::vector<RawModel::Vertex>& modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices,
|
||||||
const glm::mat4& modelMatrix,
|
|
||||||
glm::vec3& outHitPosition)
|
glm::vec3& outHitPosition)
|
||||||
{
|
{
|
||||||
float u;
|
float u;
|
||||||
float v;
|
float v;
|
||||||
float dist;
|
float dist;
|
||||||
bool hit = RayVsModel(ray, modelVertices, modelIndices, modelMatrix, dist, u, v);
|
bool hit = RayVsModel(ray, modelVertices, modelIndices, dist, u, v);
|
||||||
outHitPosition = ray.Origin() + dist * ray.Direction();
|
outHitPosition = ray.Origin() + dist * ray.Direction();
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
@@ -576,11 +572,11 @@ boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeM
|
|||||||
ComponentWrapper& cAABB = entity["AABB"];
|
ComponentWrapper& cAABB = entity["AABB"];
|
||||||
modelSpaceBox = EntityAABB::FromOriginSize((glm::vec3)cAABB["Origin"], (glm::vec3)cAABB["Size"]);
|
modelSpaceBox = EntityAABB::FromOriginSize((glm::vec3)cAABB["Origin"], (glm::vec3)cAABB["Size"]);
|
||||||
} else if (entity.HasComponent("Model")) {
|
} else if (entity.HasComponent("Model")) {
|
||||||
|
Model* model;
|
||||||
std::string res = entity["Model"]["Resource"];
|
std::string res = entity["Model"]["Resource"];
|
||||||
if (res.empty()) {
|
if (res.empty()) {
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
Model* model;
|
|
||||||
try {
|
try {
|
||||||
model = ResourceManager::Load<::Model, true>(res);
|
model = ResourceManager::Load<::Model, true>(res);
|
||||||
} catch (const Resource::StillLoadingException&) {
|
} catch (const Resource::StillLoadingException&) {
|
||||||
@@ -642,36 +638,4 @@ boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity)
|
|||||||
return aabb;
|
return aabb;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<EntityAABB> entitiesPotentiallyHitSorted, float& outDistance, glm::vec3& outIntersectPos)
|
|
||||||
{
|
|
||||||
for (EntityAABB& entityBox : entitiesPotentiallyHitSorted) {
|
|
||||||
if (!entityBox.Entity.HasComponent("Model")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
std::string res = entityBox.Entity["Model"]["Resource"];
|
|
||||||
if (res.empty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Model* model;
|
|
||||||
try {
|
|
||||||
model = ResourceManager::Load<::Model, true>(res);
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
float u, v;
|
|
||||||
if (RayVsModel(ray, model->Vertices(), model->m_RawModel->m_Indices, Transform::ModelMatrix(entityBox.Entity), outDistance, u, v)) {
|
|
||||||
outIntersectPos = ray.Origin() + outDistance * ray.Direction();
|
|
||||||
return entityBox;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return boost::none;
|
|
||||||
}
|
|
||||||
|
|
||||||
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, Octree<EntityAABB>* octree, float& outDistance, glm::vec3& outIntersectPos)
|
|
||||||
{
|
|
||||||
std::vector<EntityAABB> outObjects;
|
|
||||||
octree->ObjectsPossiblyHitByRay(ray, outObjects);
|
|
||||||
return Collision::EntityFirstHitByRay(ray, outObjects, outDistance, outIntersectPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -65,6 +65,7 @@ void EntityFilePreprocessor::parseComponentInfo()
|
|||||||
|
|
||||||
// Name
|
// Name
|
||||||
compInfo.Name = XS::ToString(element->getName());
|
compInfo.Name = XS::ToString(element->getName());
|
||||||
|
bool brk = compInfo.Name == "HiddenForLocalPlayer";
|
||||||
// Known allocation
|
// Known allocation
|
||||||
compInfo.Meta->Allocation = m_ComponentCounts[compInfo.Name];
|
compInfo.Meta->Allocation = m_ComponentCounts[compInfo.Name];
|
||||||
// Annotation
|
// Annotation
|
||||||
|
|||||||
@@ -5,6 +5,22 @@
|
|||||||
#include "Core/Octree.h"
|
#include "Core/Octree.h"
|
||||||
#include "Collision/Collision.h"
|
#include "Collision/Collision.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
//To be able to sort nodes based on distance to ray origin.
|
||||||
|
struct ChildInfo
|
||||||
|
{
|
||||||
|
int Index;
|
||||||
|
float Distance;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool isFirstLower(const ChildInfo& first, const ChildInfo& second)
|
||||||
|
{
|
||||||
|
return first.Distance < second.Distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
namespace OctSpace
|
namespace OctSpace
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -107,14 +123,14 @@ bool Child::RayCollides(const Ray& ray, OctSpace::Output& data) const
|
|||||||
//If the ray shoots the tree, and it is a parent to 8 children :o
|
//If the ray shoots the tree, and it is a parent to 8 children :o
|
||||||
if (hasChildren()) {
|
if (hasChildren()) {
|
||||||
//Sort children according to their distance from the ray origin.
|
//Sort children according to their distance from the ray origin.
|
||||||
std::vector<RaySorterInfo> childInfos;
|
std::vector<ChildInfo> childInfos;
|
||||||
childInfos.reserve(8);
|
childInfos.reserve(8);
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
childInfos.push_back({ i, glm::distance(ray.Origin(), m_Children[i]->m_Box.Origin()) });
|
childInfos.push_back({ i, glm::distance(ray.Origin(), m_Children[i]->m_Box.Origin()) });
|
||||||
}
|
}
|
||||||
std::sort(childInfos.begin(), childInfos.end(), isFirstLower);
|
std::sort(childInfos.begin(), childInfos.end(), isFirstLower);
|
||||||
//Loop through the children, starting with the one closest to the ray origin. I.e the first to be hit.
|
//Loop through the children, starting with the one closest to the ray origin. I.e the first to be hit.
|
||||||
for (const RaySorterInfo& info : childInfos) {
|
for (const ChildInfo& info : childInfos) {
|
||||||
if (m_Children[info.Index]->RayCollides(ray, data)) {
|
if (m_Children[info.Index]->RayCollides(ray, data)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -259,9 +275,4 @@ std::vector<int> Child::childIndicesContainingBox(const AABB& box) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFirstLower(const RaySorterInfo& first, const RaySorterInfo& second)
|
|
||||||
{
|
|
||||||
return first.Distance < second.Distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -390,9 +390,8 @@ bool Client::OnInputCommand(const Events::InputCommand & e)
|
|||||||
bool Client::OnPlayerDamage(const Events::PlayerDamage & e)
|
bool Client::OnPlayerDamage(const Events::PlayerDamage & e)
|
||||||
{
|
{
|
||||||
Packet packet(MessageType::OnPlayerDamage, m_SendPacketID);
|
Packet packet(MessageType::OnPlayerDamage, m_SendPacketID);
|
||||||
packet.WritePrimitive(m_ClientIDToServerID.at(e.Inflictor.ID));
|
|
||||||
packet.WritePrimitive(m_ClientIDToServerID.at(e.Victim.ID));
|
|
||||||
packet.WritePrimitive(e.Damage);
|
packet.WritePrimitive(e.Damage);
|
||||||
|
packet.WritePrimitive(m_ClientIDToServerID.at(e.Player.ID));
|
||||||
send(packet);
|
send(packet);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,9 +299,8 @@ void Server::parseOnInputCommand(Packet& packet)
|
|||||||
void Server::parseOnPlayerDamage(Packet & packet)
|
void Server::parseOnPlayerDamage(Packet & packet)
|
||||||
{
|
{
|
||||||
Events::PlayerDamage e;
|
Events::PlayerDamage e;
|
||||||
e.Inflictor = EntityWrapper(m_World, packet.ReadPrimitive<EntityID>());
|
|
||||||
e.Victim = EntityWrapper(m_World, packet.ReadPrimitive<EntityID>());
|
|
||||||
e.Damage = packet.ReadPrimitive<double>();
|
e.Damage = packet.ReadPrimitive<double>();
|
||||||
|
e.Player = EntityWrapper(m_World, packet.ReadPrimitive<EntityID>());
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
//LOG_DEBUG("Server::parseOnPlayerDamage: Command is %s. Value is %f. PlayerID is %i.", e.DamageAmount, e.PlayerDamagedID, e.TypeOfDamage.c_str());
|
//LOG_DEBUG("Server::parseOnPlayerDamage: Command is %s. Value is %f. PlayerID is %i.", e.DamageAmount, e.PlayerDamagedID, e.TypeOfDamage.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,32 +34,19 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
|||||||
if (!(bool)animationComponent["Loop" + std::to_string(i)]) {
|
if (!(bool)animationComponent["Loop" + std::to_string(i)]) {
|
||||||
if (nextTime > animation->Duration) {
|
if (nextTime > animation->Duration) {
|
||||||
nextTime = animation->Duration;
|
nextTime = animation->Duration;
|
||||||
Events::AnimationComplete e;
|
|
||||||
e.Entity = entity;
|
|
||||||
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
} else if (nextTime < 0) {
|
} else if (nextTime < 0) {
|
||||||
Events::AnimationComplete e;
|
|
||||||
e.Entity = entity;
|
|
||||||
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
nextTime = 0;
|
nextTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
(double&)animationComponent["Speed" + std::to_string(i)] = 0.0;
|
(double&)animationComponent["Speed" + std::to_string(i)] = 0.0;
|
||||||
|
Events::AnimationComplete e;
|
||||||
|
e.Entity = entity;
|
||||||
|
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
} else {
|
} else {
|
||||||
if (nextTime > animation->Duration) {
|
if (nextTime > animation->Duration) {
|
||||||
Events::AnimationComplete e;
|
|
||||||
e.Entity = entity;
|
|
||||||
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
nextTime -= animation->Duration;
|
nextTime -= animation->Duration;
|
||||||
} else if (nextTime < 0) {
|
} else if (nextTime < 0) {
|
||||||
Events::AnimationComplete e;
|
|
||||||
e.Entity = entity;
|
|
||||||
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
nextTime += animation->Duration;
|
nextTime += animation->Duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,5 +54,32 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
|||||||
(double&)animationComponent["Time" + std::to_string(i)] = nextTime;
|
(double&)animationComponent["Time" + std::to_string(i)] = nextTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Calculate bone transforms
|
||||||
|
if (skeleton != nullptr) {
|
||||||
|
std::vector<Skeleton::AnimationData> animations;
|
||||||
|
if (entity.HasComponent("Animation")) {
|
||||||
|
for (int i = 1; i <= 3; i++) {
|
||||||
|
Skeleton::AnimationData animationData;
|
||||||
|
animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(entity["Animation"]["AnimationName" + std::to_string(i)]);
|
||||||
|
if (animationData.animation == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
animationData.time = (double)entity["Animation"]["Time" + std::to_string(i)];
|
||||||
|
animationData.weight = (double)entity["Animation"]["Weight" + std::to_string(i)];
|
||||||
|
|
||||||
|
animations.push_back(animationData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.HasComponent("AnimationOffset")) {
|
||||||
|
Skeleton::AnimationOffset animationOffset;
|
||||||
|
animationOffset.animation = skeleton->GetAnimation(entity["AnimationOffset"]["AnimationName"]);
|
||||||
|
animationOffset.time = (double)entity["AnimationOffset"]["Time"];
|
||||||
|
skeleton->CalculateFrameBones(animations, animationOffset);
|
||||||
|
} else {
|
||||||
|
skeleton->CalculateFrameBones(animations);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!model->IsSkinned()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||||
|
|
||||||
@@ -29,45 +26,21 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Skeleton::Animation* animation = skeleton->GetAnimation(parent["Animation"]["AnimationName1"]);
|
||||||
|
|
||||||
|
if (!animation) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int id = skeleton->GetBoneID(entity["BoneAttachment"]["BoneName"]);
|
int id = skeleton->GetBoneID(entity["BoneAttachment"]["BoneName"]);
|
||||||
|
|
||||||
if(id == -1) {
|
if(id == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<::Skeleton::AnimationData> Animations;
|
|
||||||
::Skeleton::AnimationOffset AnimationOffset;
|
|
||||||
glm::mat4 boneTransform;
|
|
||||||
|
|
||||||
if (parent.HasComponent("Animation")) {
|
|
||||||
for (int i = 1; i <= 3; i++) {
|
|
||||||
::Skeleton::AnimationData animationData;
|
|
||||||
animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["Animation"]["AnimationName" + std::to_string(i)]);
|
|
||||||
if (animationData.animation == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
animationData.time = (double)parent["Animation"]["Time" + std::to_string(i)];
|
|
||||||
animationData.weight = (double)parent["Animation"]["Weight" + std::to_string(i)];
|
|
||||||
|
|
||||||
Animations.push_back(animationData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parent.HasComponent("AnimationOffset")) {
|
|
||||||
AnimationOffset.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["AnimationOffset"]["AnimationName"]);
|
|
||||||
AnimationOffset.time = (double)parent["AnimationOffset"]["Time"];
|
|
||||||
|
|
||||||
if(AnimationOffset.animation != nullptr) {
|
|
||||||
boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, AnimationOffset, glm::mat4(1));
|
|
||||||
} else {
|
|
||||||
boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, glm::mat4(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, glm::mat4(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
glm::mat4 boneTransform = skeleton->GetBoneTransformSuper(id);
|
||||||
|
//glm::mat4 boneTransform = skeleton->GetBoneTransform(skeleton->Bones[id], animation, (double)parent["Animation"]["Time1"], glm::mat4(1));
|
||||||
|
|
||||||
glm::vec3 scale;
|
glm::vec3 scale;
|
||||||
glm::quat rotation;
|
glm::quat rotation;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
GLERROR("Creating sprite program");
|
GLERROR("Creating sprite program");
|
||||||
m_ForwardPlusSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram");
|
m_ForwardPlusSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram");
|
||||||
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
||||||
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl")));
|
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
||||||
m_ForwardPlusSplatMapProgram->Compile();
|
m_ForwardPlusSplatMapProgram->Compile();
|
||||||
m_ForwardPlusSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
m_ForwardPlusSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
||||||
m_ForwardPlusSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
m_ForwardPlusSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
||||||
@@ -100,7 +100,7 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
m_ExplosionEffectSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapProgram");
|
m_ExplosionEffectSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapProgram");
|
||||||
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
||||||
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
|
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
|
||||||
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl")));
|
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
||||||
m_ExplosionEffectSplatMapProgram->Compile();
|
m_ExplosionEffectSplatMapProgram->Compile();
|
||||||
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
||||||
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
||||||
@@ -128,7 +128,7 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
|
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapSkinnedProgram");
|
m_ExplosionEffectSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapSkinnedProgram");
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl")));
|
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->Compile();
|
m_ExplosionEffectSplatMapSkinnedProgram->Compile();
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
||||||
@@ -137,7 +137,7 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
|
|
||||||
m_ForwardPlusSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapSkinnedProgram");
|
m_ForwardPlusSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapSkinnedProgram");
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl")));
|
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->Compile();
|
m_ForwardPlusSplatMapSkinnedProgram->Compile();
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
||||||
@@ -338,11 +338,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
//bind textures
|
//bind textures
|
||||||
BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob);
|
BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob);
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
|
frameBones = explosionEffectJob->Skeleton->GetBones();
|
||||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
} else {
|
} else {
|
||||||
m_ExplosionEffectProgram->Bind();
|
m_ExplosionEffectProgram->Bind();
|
||||||
@@ -365,11 +361,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob);
|
BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob);
|
||||||
GLERROR("asdasd");
|
GLERROR("asdasd");
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
|
frameBones = explosionEffectJob->Skeleton->GetBones();
|
||||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -410,11 +402,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
//bind textures
|
//bind textures
|
||||||
BindModelTextures(forwardSkinnedHandle, modelJob);
|
BindModelTextures(forwardSkinnedHandle, modelJob);
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
frameBones = modelJob->Skeleton->GetBones();
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -438,11 +426,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
BindModelTextures(forwardSplatMapSkinnedHandle, modelJob);
|
BindModelTextures(forwardSplatMapSkinnedHandle, modelJob);
|
||||||
GLERROR("asdasd");
|
GLERROR("asdasd");
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
frameBones = modelJob->Skeleton->GetBones();
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -486,11 +470,7 @@ void DrawFinalPass::DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJo
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
frameBones = modelJob->Skeleton->GetBones();
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
} else {
|
} else {
|
||||||
m_ShieldToStencilProgram->Bind();
|
m_ShieldToStencilProgram->Bind();
|
||||||
@@ -544,11 +524,7 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
|
frameBones = explosionEffectJob->Skeleton->GetBones();
|
||||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
if (GLERROR("Animation")) {
|
if (GLERROR("Animation")) {
|
||||||
@@ -583,11 +559,7 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
|
|||||||
BindModelTextures(forwardHandle ,modelJob);
|
BindModelTextures(forwardHandle ,modelJob);
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
frameBones = modelJob->Skeleton->GetBones();
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
|
|
||||||
@@ -619,11 +591,7 @@ void DrawFinalPass::DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& job
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
frameBones = modelJob->Skeleton->GetBones();
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -950,7 +918,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
|
|
||||||
//Bind 5 diffuse textures
|
//Bind 5 diffuse textures
|
||||||
std::string UniformName = "DiffuseUVRepeat";
|
std::string UniformName = "DiffuseUVRepeat";
|
||||||
for (unsigned int i = 0; i < 3; i++) {
|
for (unsigned int i = 0; i < 5; i++) {
|
||||||
glActiveTexture(texturePosition);
|
glActiveTexture(texturePosition);
|
||||||
if (job->DiffuseTexture.size() > i && job->DiffuseTexture[i]->Texture != nullptr) {
|
if (job->DiffuseTexture.size() > i && job->DiffuseTexture[i]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[i]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[i]->Texture->m_Texture);
|
||||||
@@ -964,7 +932,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
|
|
||||||
//Bind 5 Normal textures
|
//Bind 5 Normal textures
|
||||||
UniformName = "NormalUVRepeat";
|
UniformName = "NormalUVRepeat";
|
||||||
for (unsigned int i = 0; i < 3; i++) {
|
for (unsigned int i = 0; i < 5; i++) {
|
||||||
glActiveTexture(texturePosition);
|
glActiveTexture(texturePosition);
|
||||||
if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) {
|
if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture);
|
||||||
@@ -978,7 +946,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
|
|
||||||
//Bind 5 Specular textures
|
//Bind 5 Specular textures
|
||||||
UniformName = "SpecularUVRepeat";
|
UniformName = "SpecularUVRepeat";
|
||||||
for (unsigned int i = 0; i < 3; i++) {
|
for (unsigned int i = 0; i < 5; i++) {
|
||||||
glActiveTexture(texturePosition);
|
glActiveTexture(texturePosition);
|
||||||
if (job->SpecularTexture.size() > i && job->SpecularTexture[i]->Texture != nullptr) {
|
if (job->SpecularTexture.size() > i && job->SpecularTexture[i]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[i]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[i]->Texture->m_Texture);
|
||||||
@@ -992,7 +960,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
|
|
||||||
//Bind 5 Incandescence textures
|
//Bind 5 Incandescence textures
|
||||||
UniformName = "GlowUVRepeat";
|
UniformName = "GlowUVRepeat";
|
||||||
for (unsigned int i = 0; i < 3; i++) {
|
for (unsigned int i = 0; i < 5; i++) {
|
||||||
glActiveTexture(texturePosition);
|
glActiveTexture(texturePosition);
|
||||||
if (job->IncandescenceTexture.size() > i && job->IncandescenceTexture[i]->Texture != nullptr) {
|
if (job->IncandescenceTexture.size() > i && job->IncandescenceTexture[i]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[i]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[i]->Texture->m_Texture);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ PickingPass::~PickingPass()
|
|||||||
|
|
||||||
void PickingPass::InitializeTextures()
|
void PickingPass::InitializeTextures()
|
||||||
{
|
{
|
||||||
|
m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false);
|
||||||
GenerateTexture(&m_PickingTexture, GL_CLAMP_TO_BORDER, GL_LINEAR,
|
GenerateTexture(&m_PickingTexture, GL_CLAMP_TO_BORDER, GL_LINEAR,
|
||||||
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
|
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
|
||||||
}
|
}
|
||||||
@@ -98,16 +99,22 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
|
glUniform4fv(glGetUniformLocation(shaderSkinnedHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||||
|
} else {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
|
}
|
||||||
|
|
||||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
frameBones = modelJob->Skeleton->GetBones();
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -116,7 +123,17 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
|
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||||
|
} else {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
glBindVertexArray(modelJob->Model->VAO);
|
||||||
@@ -125,7 +142,7 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for (auto &job : scene.Jobs.TransparentObjects) {
|
for (auto &job : scene.Jobs.TransparentObjects) {
|
||||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||||
|
|
||||||
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
||||||
@@ -157,32 +174,50 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
|
glUniform4fv(glGetUniformLocation(shaderSkinnedHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
glActiveTexture(GL_TEXTURE0);
|
||||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||||
} else {
|
} else {
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<glm::mat4> frameBones;
|
||||||
|
frameBones = modelJob->Skeleton->GetBones();
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
} else {
|
} else {
|
||||||
m_PickingProgram->Bind();
|
m_PickingProgram->Bind();
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
|
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||||
|
} else {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
glBindVertexArray(modelJob->Model->VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||||
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
for (auto &job : scene.Jobs.OpaqueShieldedObjects) {
|
for (auto &job : scene.Jobs.OpaqueShieldedObjects) {
|
||||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||||
|
|
||||||
|
|
||||||
if (modelJob) {
|
if (modelJob) {
|
||||||
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
||||||
|
|
||||||
@@ -212,14 +247,21 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
|
glUniform4fv(glGetUniformLocation(shaderSkinnedHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
glActiveTexture(GL_TEXTURE0);
|
||||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||||
} else {
|
} else {
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<glm::mat4> frameBones;
|
||||||
|
frameBones = modelJob->Skeleton->GetBones();
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -227,7 +269,18 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
|
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||||
|
} else {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
glBindVertexArray(modelJob->Model->VAO);
|
||||||
@@ -236,7 +289,7 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for (auto &job : scene.Jobs.TransparentShieldedObjects) {
|
for (auto &job : scene.Jobs.TransparentShieldedObjects) {
|
||||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||||
|
|
||||||
if (modelJob) {
|
if (modelJob) {
|
||||||
@@ -271,16 +324,22 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
|
glUniform4fv(glGetUniformLocation(shaderSkinnedHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||||
|
} else {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
|
}
|
||||||
|
|
||||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
if (modelJob->AnimationOffset.animation != nullptr) {
|
frameBones = modelJob->Skeleton->GetBones();
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
|
||||||
} else {
|
|
||||||
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
|
||||||
}
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -290,17 +349,24 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
|
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
||||||
|
} else {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
glBindVertexArray(modelJob->Model->VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||||
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
m_PickingBuffer.Unbind();
|
m_PickingBuffer.Unbind();
|
||||||
GLERROR("PickingPass Error");
|
GLERROR("PickingPass Error");
|
||||||
|
|||||||
@@ -277,9 +277,9 @@ void RawModelCustom::ReadMaterialTextureProperties(RawModelCustom::TextureProper
|
|||||||
throw Resource::FailedLoadingException("Reading Material texture UVTiling failed");
|
throw Resource::FailedLoadingException("Reading Material texture UVTiling failed");
|
||||||
}
|
}
|
||||||
memcpy(&texture.UVRepeat[0], fileData + offset, sizeof(glm::vec2));
|
memcpy(&texture.UVRepeat[0], fileData + offset, sizeof(glm::vec2));
|
||||||
}
|
|
||||||
offset += sizeof(glm::vec2);
|
offset += sizeof(glm::vec2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RawModelCustom::ReadAnimationFile(std::string filePath)
|
void RawModelCustom::ReadAnimationFile(std::string filePath)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,8 +47,16 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EntityWrapper entity(world, cSprite.EntityID);
|
EntityWrapper entity(world, cSprite.EntityID);
|
||||||
if (!isEntityVisible(entity)) {
|
|
||||||
|
// Only render children of a camera if that camera is currently active
|
||||||
|
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
|
||||||
|
if (entity.HasComponent("HiddenForLocalPlayer") && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,23 +85,6 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderSystem::isEntityVisible(EntityWrapper& entity)
|
|
||||||
{
|
|
||||||
|
|
||||||
// Only render children of a camera if that camera is currently active
|
|
||||||
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
|
|
||||||
bool outOfBodyExperience = ResourceManager::Load<ConfigFile>("Config.ini")->Get<bool>("Debug.OutOfBodyExperience", false);
|
|
||||||
if (entity.HasComponent("HiddenForLocalPlayer") && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer)) && !outOfBodyExperience) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RenderSystem::isChildOfACamera(EntityWrapper entity)
|
bool RenderSystem::isChildOfACamera(EntityWrapper entity)
|
||||||
{
|
{
|
||||||
return entity.FirstParentWithComponent("Camera").Valid();
|
return entity.FirstParentWithComponent("Camera").Valid();
|
||||||
@@ -121,7 +112,13 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isEntityVisible(entity)) {
|
// Only render children of a camera if that camera is currently active
|
||||||
|
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
|
||||||
|
if ((entity.HasComponent("HiddenForLocalPlayer") || entity.FirstParentWithComponent("HiddenForLocalPlayer").Valid()) && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,11 +299,6 @@ void RenderSystem::fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World*
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityWrapper entity(world, textComponent.EntityID);
|
|
||||||
if (!isEntityVisible(entity)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Font* font;
|
Font* font;
|
||||||
try {
|
try {
|
||||||
font = ResourceManager::Load<Font>(resource);
|
font = ResourceManager::Load<Font>(resource);
|
||||||
|
|||||||
+156
-411
@@ -30,6 +30,30 @@ Skeleton::~Skeleton()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Skeleton::CalculateFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion /*= false*/)
|
||||||
|
{
|
||||||
|
if (animations.size() <= 0 || animationOffset.animation == nullptr) {
|
||||||
|
for (auto& b : Bones) {
|
||||||
|
m_BoneLocalTransforms[b.first] = glm::mat4(1);
|
||||||
|
m_BoneTransforms[b.first] = glm::mat4(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AccumulateBoneTransforms(noRootMotion, animations, animationOffset, RootBone, glm::mat4(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Skeleton::CalculateFrameBones(std::vector<AnimationData> animations, bool noRootMotion /*= false*/)
|
||||||
|
{
|
||||||
|
if (animations.size() <= 0) {
|
||||||
|
for (auto& b : Bones) {
|
||||||
|
m_BoneLocalTransforms[b.first] = glm::mat4(1);
|
||||||
|
m_BoneTransforms[b.first] = glm::mat4(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
AccumulateBoneTransforms(noRootMotion, animations, RootBone, glm::mat4(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Skeleton::Animation* Skeleton::GetAnimation(std::string name)
|
const Skeleton::Animation* Skeleton::GetAnimation(std::string name)
|
||||||
{
|
{
|
||||||
@@ -41,167 +65,7 @@ const Skeleton::Animation* Skeleton::GetAnimation(std::string name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<glm::mat4> Skeleton::GetFrameBones(std::vector<AnimationData> animations, bool noRootMotion /*= false*/)
|
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, const Bone* bone, glm::mat4 parentMatrix)
|
||||||
{
|
|
||||||
if (animations.size() <= 0) {
|
|
||||||
std::vector<glm::mat4> finalMatrices;
|
|
||||||
for (auto& b : Bones) {
|
|
||||||
finalMatrices.push_back(glm::mat4(1));//b.second->OffsetMatrix);
|
|
||||||
}
|
|
||||||
return finalMatrices;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::map<int, glm::mat4> frameBones;
|
|
||||||
AccumulateBoneTransforms(true, animations, frameBones, RootBone, glm::mat4(1));
|
|
||||||
|
|
||||||
std::vector<glm::mat4> finalMatrices;
|
|
||||||
for (auto &kv : frameBones) {
|
|
||||||
finalMatrices.push_back(kv.second);
|
|
||||||
}
|
|
||||||
return finalMatrices;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<glm::mat4> Skeleton::GetFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion /*= false*/)
|
|
||||||
{
|
|
||||||
if (animations.size() <= 0 || animationOffset.animation == nullptr) {
|
|
||||||
std::vector<glm::mat4> finalMatrices;
|
|
||||||
for (auto& b : Bones) {
|
|
||||||
finalMatrices.push_back(glm::mat4(1));//b.second->OffsetMatrix);
|
|
||||||
}
|
|
||||||
return finalMatrices;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::map<int, glm::mat4> frameBones;
|
|
||||||
AccumulateBoneTransforms(true, animations, animationOffset, frameBones, RootBone, glm::mat4(1));
|
|
||||||
|
|
||||||
std::vector<glm::mat4> finalMatrices;
|
|
||||||
for (auto &kv : frameBones) {
|
|
||||||
finalMatrices.push_back(kv.second);
|
|
||||||
}
|
|
||||||
return finalMatrices;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix)
|
|
||||||
{
|
|
||||||
glm::mat4 boneMatrix;
|
|
||||||
std::vector<JointFrameTransform> JointTransforms;
|
|
||||||
|
|
||||||
for (const AnimationData animationData : animations) {
|
|
||||||
const Animation* animation = animationData.animation;
|
|
||||||
const float time = animationData.time;
|
|
||||||
|
|
||||||
JointFrameTransform jointTransform;
|
|
||||||
jointTransform.Weight = animationData.weight;;
|
|
||||||
|
|
||||||
if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
|
|
||||||
std::vector<Animation::Keyframe> boneKeyFrames = animation->JointAnimations.at(bone->ID);
|
|
||||||
|
|
||||||
Animation::Keyframe currentFrame;
|
|
||||||
Animation::Keyframe nextFrame;
|
|
||||||
|
|
||||||
if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone
|
|
||||||
for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame
|
|
||||||
if (time >= boneKeyFrames.at(index).Time) {
|
|
||||||
currentFrame = boneKeyFrames.at(index);
|
|
||||||
nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float progress;
|
|
||||||
|
|
||||||
if (nextFrame.Index == 0) {
|
|
||||||
nextFrame = currentFrame;
|
|
||||||
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
|
|
||||||
} else {
|
|
||||||
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (progress > 1.0f || progress < 0.0f) {
|
|
||||||
LOG_INFO("Progress: %f", progress);
|
|
||||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
|
||||||
}
|
|
||||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
|
||||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
|
||||||
|
|
||||||
jointTransform.PositionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
|
||||||
jointTransform.RotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
|
||||||
jointTransform.ScaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
|
||||||
|
|
||||||
// Flag for no root motion
|
|
||||||
if (bone == RootBone && noRootMotion) {
|
|
||||||
jointTransform.PositionInterp.x = 0;
|
|
||||||
jointTransform.PositionInterp.z = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
JointTransforms.push_back(jointTransform);
|
|
||||||
|
|
||||||
} else { // 1 keyframes for the current bone
|
|
||||||
currentFrame = boneKeyFrames.at(0);
|
|
||||||
jointTransform.PositionInterp = currentFrame.BoneProperties.Position;
|
|
||||||
jointTransform.RotationInterp = currentFrame.BoneProperties.Rotation;
|
|
||||||
jointTransform.ScaleInterp = currentFrame.BoneProperties.Scale;
|
|
||||||
JointTransforms.push_back(jointTransform);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else { // 0 keyframes for the current bone
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JointTransforms.size() <= 0) {
|
|
||||||
if (bone->Parent) {
|
|
||||||
boneMatrix = parentMatrix * glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix;
|
|
||||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
|
||||||
} else {
|
|
||||||
boneMatrix = glm::inverse(bone->OffsetMatrix);
|
|
||||||
boneMatrices[bone->ID] = parentMatrix;
|
|
||||||
}
|
|
||||||
} else if (JointTransforms.size() == 1) {
|
|
||||||
boneMatrix = parentMatrix *(glm::translate(JointTransforms.at(0).PositionInterp) * glm::toMat4(JointTransforms.at(0).RotationInterp) * glm::scale(JointTransforms.at(0).ScaleInterp));
|
|
||||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
glm::vec3 finalPosInterp;
|
|
||||||
glm::quat finalRotInterp;
|
|
||||||
glm::vec3 finalScaleInterp;
|
|
||||||
float totalWeight = 0;
|
|
||||||
|
|
||||||
for (JointFrameTransform jointTransform : JointTransforms) {
|
|
||||||
totalWeight += jointTransform.Weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (JointFrameTransform jointTransform : JointTransforms) {
|
|
||||||
if (jointTransform.Weight == 1.0f) {
|
|
||||||
finalPosInterp = jointTransform.PositionInterp;
|
|
||||||
finalRotInterp = jointTransform.RotationInterp;
|
|
||||||
finalScaleInterp = jointTransform.ScaleInterp;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
finalPosInterp += jointTransform.PositionInterp * (jointTransform.Weight/totalWeight);
|
|
||||||
finalRotInterp *= glm::slerp(glm::quat(), jointTransform.RotationInterp, (jointTransform.Weight/totalWeight));
|
|
||||||
finalScaleInterp += jointTransform.ScaleInterp * (jointTransform.Weight/totalWeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
boneMatrix = parentMatrix *(glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp));
|
|
||||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (auto &child : bone->Children) {
|
|
||||||
AccumulateBoneTransforms(noRootMotion, animations, boneMatrices, child, boneMatrix);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix)
|
|
||||||
{
|
{
|
||||||
glm::mat4 boneMatrix;
|
glm::mat4 boneMatrix;
|
||||||
|
|
||||||
@@ -241,7 +105,6 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<Animation
|
|||||||
|
|
||||||
|
|
||||||
if (progress > 1.0f || progress < 0.0f) {
|
if (progress > 1.0f || progress < 0.0f) {
|
||||||
LOG_INFO("Progress: %f", progress);
|
|
||||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
progress = glm::clamp(progress, 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
||||||
@@ -284,10 +147,12 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<Animation
|
|||||||
boneMatrix = parentMatrix *((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix));
|
boneMatrix = parentMatrix *((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix));
|
||||||
|
|
||||||
}
|
}
|
||||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
m_BoneLocalTransforms[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||||
|
m_BoneTransforms[bone->ID] = boneMatrix;
|
||||||
} else {
|
} else {
|
||||||
boneMatrix = offset * glm::inverse(bone->OffsetMatrix);
|
boneMatrix = offset * glm::inverse(bone->OffsetMatrix);
|
||||||
boneMatrices[bone->ID] = parentMatrix;
|
m_BoneLocalTransforms[bone->ID] = parentMatrix;
|
||||||
|
m_BoneTransforms[bone->ID] = boneMatrix;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -316,18 +181,140 @@ void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<Animation
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (offset != glm::mat4(1)) {
|
if (offset != glm::mat4(1)) {
|
||||||
boneMatrix = parentMatrix * ((glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) + offset);
|
boneMatrix = parentMatrix * ((glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) + offset);
|
||||||
} else {
|
} else {
|
||||||
boneMatrix = parentMatrix * (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp));
|
boneMatrix = parentMatrix * (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp));
|
||||||
}
|
}
|
||||||
|
|
||||||
boneMatrices[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
m_BoneLocalTransforms[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||||
|
m_BoneTransforms[bone->ID] = boneMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &child : bone->Children) {
|
for (auto &child : bone->Children) {
|
||||||
AccumulateBoneTransforms(noRootMotion, animations, animationOffset, boneMatrices, child, boneMatrix);
|
AccumulateBoneTransforms(noRootMotion, animations, animationOffset, child, boneMatrix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Skeleton::AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, const Bone* bone, glm::mat4 parentMatrix)
|
||||||
|
{
|
||||||
|
glm::mat4 boneMatrix;
|
||||||
|
std::vector<JointFrameTransform> JointTransforms;
|
||||||
|
|
||||||
|
for (const AnimationData animationData : animations) {
|
||||||
|
const Animation* animation = animationData.animation;
|
||||||
|
const float time = animationData.time;
|
||||||
|
|
||||||
|
JointFrameTransform jointTransform;
|
||||||
|
jointTransform.Weight = animationData.weight;;
|
||||||
|
|
||||||
|
if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
|
||||||
|
std::vector<Animation::Keyframe> boneKeyFrames = animation->JointAnimations.at(bone->ID);
|
||||||
|
|
||||||
|
Animation::Keyframe currentFrame;
|
||||||
|
Animation::Keyframe nextFrame;
|
||||||
|
|
||||||
|
if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone
|
||||||
|
for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame
|
||||||
|
if (time >= boneKeyFrames.at(index).Time) {
|
||||||
|
currentFrame = boneKeyFrames.at(index);
|
||||||
|
nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float progress;
|
||||||
|
|
||||||
|
if (nextFrame.Index == 0) {
|
||||||
|
nextFrame = currentFrame;
|
||||||
|
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
|
||||||
|
} else {
|
||||||
|
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (progress > 1.0f || progress < 0.0f) {
|
||||||
|
progress = glm::clamp(progress, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
||||||
|
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
||||||
|
|
||||||
|
jointTransform.PositionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
||||||
|
jointTransform.RotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
||||||
|
jointTransform.ScaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
||||||
|
|
||||||
|
// Flag for no root motion
|
||||||
|
if (bone == RootBone && noRootMotion) {
|
||||||
|
jointTransform.PositionInterp.x = 0;
|
||||||
|
jointTransform.PositionInterp.z = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
JointTransforms.push_back(jointTransform);
|
||||||
|
|
||||||
|
} else { // 1 keyframes for the current bone
|
||||||
|
currentFrame = boneKeyFrames.at(0);
|
||||||
|
jointTransform.PositionInterp = currentFrame.BoneProperties.Position;
|
||||||
|
jointTransform.RotationInterp = currentFrame.BoneProperties.Rotation;
|
||||||
|
jointTransform.ScaleInterp = currentFrame.BoneProperties.Scale;
|
||||||
|
JointTransforms.push_back(jointTransform);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else { // 0 keyframes for the current bone
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JointTransforms.size() <= 0) {
|
||||||
|
if (bone->Parent) {
|
||||||
|
boneMatrix = parentMatrix * glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix;
|
||||||
|
m_BoneLocalTransforms[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||||
|
m_BoneTransforms[bone->ID] = boneMatrix;
|
||||||
|
} else {
|
||||||
|
boneMatrix = glm::inverse(bone->OffsetMatrix);
|
||||||
|
m_BoneLocalTransforms[bone->ID] = parentMatrix;
|
||||||
|
m_BoneTransforms[bone->ID] = boneMatrix;
|
||||||
|
}
|
||||||
|
} else if (JointTransforms.size() == 1) {
|
||||||
|
boneMatrix = parentMatrix *(glm::translate(JointTransforms.at(0).PositionInterp) * glm::toMat4(JointTransforms.at(0).RotationInterp) * glm::scale(JointTransforms.at(0).ScaleInterp));
|
||||||
|
m_BoneLocalTransforms[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||||
|
m_BoneTransforms[bone->ID] = boneMatrix;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
glm::vec3 finalPosInterp;
|
||||||
|
glm::quat finalRotInterp;
|
||||||
|
glm::vec3 finalScaleInterp;
|
||||||
|
float totalWeight = 0;
|
||||||
|
|
||||||
|
for (JointFrameTransform jointTransform : JointTransforms) {
|
||||||
|
totalWeight += jointTransform.Weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (JointFrameTransform jointTransform : JointTransforms) {
|
||||||
|
if (jointTransform.Weight == 1.0f) {
|
||||||
|
finalPosInterp = jointTransform.PositionInterp;
|
||||||
|
finalRotInterp = jointTransform.RotationInterp;
|
||||||
|
finalScaleInterp = jointTransform.ScaleInterp;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
finalPosInterp += jointTransform.PositionInterp * (jointTransform.Weight/totalWeight);
|
||||||
|
finalRotInterp *= glm::slerp(glm::quat(), jointTransform.RotationInterp, (jointTransform.Weight/totalWeight));
|
||||||
|
finalScaleInterp += jointTransform.ScaleInterp * (jointTransform.Weight/totalWeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
boneMatrix = parentMatrix *(glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp));
|
||||||
|
|
||||||
|
m_BoneLocalTransforms[bone->ID] = boneMatrix * bone->OffsetMatrix;
|
||||||
|
m_BoneTransforms[bone->ID] = boneMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (auto &child : bone->Children) {
|
||||||
|
AccumulateBoneTransforms(noRootMotion, animations, child, boneMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,8 +352,9 @@ glm::mat4 Skeleton::GetOffsetTransform(const Bone* bone, AnimationOffset animati
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (progress > 1.0f || progress < 0.0f) {
|
||||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
progress = glm::clamp(progress, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
||||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
||||||
|
|
||||||
@@ -448,249 +436,6 @@ glm::mat4 Skeleton::GetBoneTransform(const Bone* bone, const Animation* animatio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, AnimationOffset animationOffset, glm::mat4 childMatrix)
|
|
||||||
{
|
|
||||||
glm::mat4 boneMatrix;
|
|
||||||
|
|
||||||
std::vector<JointFrameTransform> JointTransforms;
|
|
||||||
|
|
||||||
for (const AnimationData animationData : animations) {
|
|
||||||
const Animation* animation = animationData.animation;
|
|
||||||
const float time = animationData.time;
|
|
||||||
|
|
||||||
JointFrameTransform jointTransform;
|
|
||||||
jointTransform.Weight = animationData.weight;;
|
|
||||||
|
|
||||||
if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
|
|
||||||
std::vector<Animation::Keyframe> boneKeyFrames = animation->JointAnimations.at(bone->ID);
|
|
||||||
|
|
||||||
Animation::Keyframe currentFrame;
|
|
||||||
Animation::Keyframe nextFrame;
|
|
||||||
|
|
||||||
if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone
|
|
||||||
for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame
|
|
||||||
if (time >= boneKeyFrames.at(index).Time) {
|
|
||||||
currentFrame = boneKeyFrames.at(index);
|
|
||||||
nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float progress;
|
|
||||||
|
|
||||||
if (nextFrame.Index == 0) {
|
|
||||||
nextFrame = currentFrame;
|
|
||||||
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
|
|
||||||
} else {
|
|
||||||
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (progress > 1.0f || progress < 0.0f) {
|
|
||||||
LOG_INFO("Progress: %f", progress);
|
|
||||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
|
||||||
}
|
|
||||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
|
||||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
|
||||||
|
|
||||||
jointTransform.PositionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
|
||||||
jointTransform.RotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
|
||||||
jointTransform.ScaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
|
||||||
|
|
||||||
// Flag for no root motion
|
|
||||||
if (bone == RootBone && noRootMotion) {
|
|
||||||
jointTransform.PositionInterp.x = 0;
|
|
||||||
jointTransform.PositionInterp.z = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
JointTransforms.push_back(jointTransform);
|
|
||||||
|
|
||||||
} else { // 1 keyframes for the current bone
|
|
||||||
currentFrame = boneKeyFrames.at(0);
|
|
||||||
jointTransform.PositionInterp = currentFrame.BoneProperties.Position;
|
|
||||||
jointTransform.RotationInterp = currentFrame.BoneProperties.Rotation;
|
|
||||||
jointTransform.ScaleInterp = currentFrame.BoneProperties.Scale;
|
|
||||||
JointTransforms.push_back(jointTransform);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else { // 0 keyframes for the current bone
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
glm::mat4 offset = GetOffsetTransform(bone, animationOffset);
|
|
||||||
|
|
||||||
if (JointTransforms.size() == 0) {
|
|
||||||
if (bone->Parent) {
|
|
||||||
if (offset != glm::mat4(1)) {
|
|
||||||
boneMatrix = offset * childMatrix;// *((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix));
|
|
||||||
} else {
|
|
||||||
boneMatrix = ((glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix)) * childMatrix;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
boneMatrix = offset * glm::inverse(bone->OffsetMatrix);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
glm::vec3 finalPosInterp;
|
|
||||||
glm::quat finalRotInterp;
|
|
||||||
glm::vec3 finalScaleInterp;
|
|
||||||
float totalWeight = 0;
|
|
||||||
|
|
||||||
for (JointFrameTransform jointTransform : JointTransforms) {
|
|
||||||
totalWeight += jointTransform.Weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (JointFrameTransform jointTransform : JointTransforms) {
|
|
||||||
if (jointTransform.Weight == 1.0f) {
|
|
||||||
finalPosInterp = jointTransform.PositionInterp;
|
|
||||||
finalRotInterp = jointTransform.RotationInterp;
|
|
||||||
finalScaleInterp = jointTransform.ScaleInterp;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
finalPosInterp += jointTransform.PositionInterp * (jointTransform.Weight/totalWeight);
|
|
||||||
finalRotInterp *= glm::slerp(glm::quat(), jointTransform.RotationInterp, (jointTransform.Weight/totalWeight));
|
|
||||||
finalScaleInterp += jointTransform.ScaleInterp * (jointTransform.Weight/totalWeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (offset != glm::mat4(1)) {
|
|
||||||
boneMatrix = ((glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) + offset) * childMatrix;
|
|
||||||
} else {
|
|
||||||
boneMatrix = (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) * childMatrix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bone->Parent != nullptr) {
|
|
||||||
return GetBoneTransform(noRootMotion, bone->Parent, animations, animationOffset, boneMatrix);
|
|
||||||
} else {
|
|
||||||
return boneMatrix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
glm::mat4 Skeleton::GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, glm::mat4 childMatrix)
|
|
||||||
{
|
|
||||||
glm::mat4 boneMatrix;
|
|
||||||
std::vector<JointFrameTransform> JointTransforms;
|
|
||||||
|
|
||||||
for (const AnimationData animationData : animations) {
|
|
||||||
const Animation* animation = animationData.animation;
|
|
||||||
const float time = animationData.time;
|
|
||||||
|
|
||||||
JointFrameTransform jointTransform;
|
|
||||||
jointTransform.Weight = animationData.weight;;
|
|
||||||
|
|
||||||
if (animation->JointAnimations.find(bone->ID) != animation->JointAnimations.end()) {
|
|
||||||
std::vector<Animation::Keyframe> boneKeyFrames = animation->JointAnimations.at(bone->ID);
|
|
||||||
|
|
||||||
Animation::Keyframe currentFrame;
|
|
||||||
Animation::Keyframe nextFrame;
|
|
||||||
|
|
||||||
if (boneKeyFrames.size() > 1) { // 2+ keyframes for the current bone
|
|
||||||
for (int index = boneKeyFrames.size()-1; index >= 0; index--) { // find the bone keyframes that surrounds the current frame
|
|
||||||
if (time >= boneKeyFrames.at(index).Time) {
|
|
||||||
currentFrame = boneKeyFrames.at(index);
|
|
||||||
nextFrame = boneKeyFrames.at((index + 1) % boneKeyFrames.size());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float progress;
|
|
||||||
|
|
||||||
if (nextFrame.Index == 0) {
|
|
||||||
nextFrame = currentFrame;
|
|
||||||
progress = (time - currentFrame.Time) / (animation->Duration - currentFrame.Time);
|
|
||||||
} else {
|
|
||||||
progress = (time - currentFrame.Time) / (nextFrame.Time - currentFrame.Time);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (progress > 1.0f || progress < 0.0f) {
|
|
||||||
LOG_INFO("Progress: %f", progress);
|
|
||||||
progress = glm::clamp(progress, 0.0f, 1.0f);
|
|
||||||
}
|
|
||||||
Animation::Keyframe::BoneProperty currentBoneProperty = currentFrame.BoneProperties;
|
|
||||||
Animation::Keyframe::BoneProperty nextBoneProperty = nextFrame.BoneProperties;
|
|
||||||
|
|
||||||
jointTransform.PositionInterp = currentBoneProperty.Position * (1.f - progress) + nextBoneProperty.Position * progress;
|
|
||||||
jointTransform.RotationInterp = glm::slerp(currentBoneProperty.Rotation, nextBoneProperty.Rotation, progress);
|
|
||||||
jointTransform.ScaleInterp = currentBoneProperty.Scale * (1.f - progress) + nextBoneProperty.Scale * progress;
|
|
||||||
|
|
||||||
// Flag for no root motion
|
|
||||||
if (bone == RootBone && noRootMotion) {
|
|
||||||
jointTransform.PositionInterp.x = 0;
|
|
||||||
jointTransform.PositionInterp.z = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
JointTransforms.push_back(jointTransform);
|
|
||||||
|
|
||||||
} else { // 1 keyframes for the current bone
|
|
||||||
currentFrame = boneKeyFrames.at(0);
|
|
||||||
jointTransform.PositionInterp = currentFrame.BoneProperties.Position;
|
|
||||||
jointTransform.RotationInterp = currentFrame.BoneProperties.Rotation;
|
|
||||||
jointTransform.ScaleInterp = currentFrame.BoneProperties.Scale;
|
|
||||||
JointTransforms.push_back(jointTransform);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else { // 0 keyframes for the current bone
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JointTransforms.size() <= 0) {
|
|
||||||
if (bone->Parent) {
|
|
||||||
boneMatrix = glm::inverse(bone->OffsetMatrix) * bone->Parent->OffsetMatrix * childMatrix;
|
|
||||||
} else {
|
|
||||||
boneMatrix = glm::inverse(bone->OffsetMatrix) * childMatrix;
|
|
||||||
}
|
|
||||||
} else if (JointTransforms.size() == 1) {
|
|
||||||
boneMatrix = (glm::translate(JointTransforms.at(0).PositionInterp) * glm::toMat4(JointTransforms.at(0).RotationInterp) * glm::scale(JointTransforms.at(0).ScaleInterp)) * childMatrix;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
glm::vec3 finalPosInterp;
|
|
||||||
glm::quat finalRotInterp;
|
|
||||||
glm::vec3 finalScaleInterp;
|
|
||||||
float totalWeight = 0;
|
|
||||||
|
|
||||||
for (JointFrameTransform jointTransform : JointTransforms) {
|
|
||||||
totalWeight += jointTransform.Weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (JointFrameTransform jointTransform : JointTransforms) {
|
|
||||||
if (jointTransform.Weight == 1.0f) {
|
|
||||||
finalPosInterp = jointTransform.PositionInterp;
|
|
||||||
finalRotInterp = jointTransform.RotationInterp;
|
|
||||||
finalScaleInterp = jointTransform.ScaleInterp;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
finalPosInterp += jointTransform.PositionInterp * (jointTransform.Weight/totalWeight);
|
|
||||||
finalRotInterp *= glm::slerp(glm::quat(), jointTransform.RotationInterp, (jointTransform.Weight/totalWeight));
|
|
||||||
finalScaleInterp += jointTransform.ScaleInterp * (jointTransform.Weight/totalWeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boneMatrix = (glm::translate(finalPosInterp) * glm::toMat4(finalRotInterp) * glm::scale(finalScaleInterp)) * childMatrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (bone->Parent != nullptr) {
|
|
||||||
return GetBoneTransform(noRootMotion, bone->Parent, animations, boneMatrix);
|
|
||||||
} else {
|
|
||||||
return boneMatrix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int Skeleton::GetBoneID(std::string name)
|
int Skeleton::GetBoneID(std::string name)
|
||||||
{
|
{
|
||||||
if (m_BonesByName.find(name) == m_BonesByName.end()) {
|
if (m_BonesByName.find(name) == m_BonesByName.end()) {
|
||||||
|
|||||||
@@ -16,12 +16,6 @@ file(GLOB SOURCE_FILES_Systems
|
|||||||
)
|
)
|
||||||
source_group(Systems FILES ${SOURCE_FILES_Systems})
|
source_group(Systems FILES ${SOURCE_FILES_Systems})
|
||||||
|
|
||||||
file(GLOB SOURCE_FILES_Systems_Weapon
|
|
||||||
"${INCLUDE_PATH}/Systems/Weapon/*.h"
|
|
||||||
"Systems/Weapon/*.cpp"
|
|
||||||
)
|
|
||||||
source_group(Systems\\Weapon FILES ${SOURCE_FILES_Systems_Weapon})
|
|
||||||
|
|
||||||
file(GLOB SOURCE_FILES_Events
|
file(GLOB SOURCE_FILES_Events
|
||||||
"${INCLUDE_PATH}/Events/*.h"
|
"${INCLUDE_PATH}/Events/*.h"
|
||||||
"Events/*.cpp"
|
"Events/*.cpp"
|
||||||
@@ -37,7 +31,6 @@ set(SOURCE_FILES
|
|||||||
${SOURCE_FILES}
|
${SOURCE_FILES}
|
||||||
"Game.cpp"
|
"Game.cpp"
|
||||||
${SOURCE_FILES_Systems}
|
${SOURCE_FILES_Systems}
|
||||||
${SOURCE_FILES_Systems_Weapon}
|
|
||||||
${SOURCE_FILES_Events}
|
${SOURCE_FILES_Events}
|
||||||
${SOURCE_FILES_Network}
|
${SOURCE_FILES_Network}
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-7
@@ -14,9 +14,7 @@
|
|||||||
#include "Game/Systems/CapturePointSystem.h"
|
#include "Game/Systems/CapturePointSystem.h"
|
||||||
#include "Game/Systems/CapturePointHUDSystem.h"
|
#include "Game/Systems/CapturePointHUDSystem.h"
|
||||||
#include "Game/Systems/PickupSpawnSystem.h"
|
#include "Game/Systems/PickupSpawnSystem.h"
|
||||||
#include "Game/Systems/AmmoPickupSystem.h"
|
#include "Game/Systems/WeaponSystem.h"
|
||||||
#include "Game/Systems/DamageIndicatorSystem.h"
|
|
||||||
#include "Game/Systems/Weapon/WeaponSystem.h"
|
|
||||||
#include "Rendering/AnimationSystem.h"
|
#include "Rendering/AnimationSystem.h"
|
||||||
#include "Game/Systems/PlayerHUDSystem.h"
|
#include "Game/Systems/PlayerHUDSystem.h"
|
||||||
#include "Rendering/BoneAttachmentSystem.h"
|
#include "Rendering/BoneAttachmentSystem.h"
|
||||||
@@ -43,7 +41,6 @@ Game::Game(int argc, char* argv[])
|
|||||||
ResourceManager::UseThreading = m_Config->Get<bool>("Multithreading.ResourceLoading", true);
|
ResourceManager::UseThreading = m_Config->Get<bool>("Multithreading.ResourceLoading", true);
|
||||||
DisableMemoryPool::Value = m_Config->Get<bool>("Debug.DisableMemoryPool", false);
|
DisableMemoryPool::Value = m_Config->Get<bool>("Debug.DisableMemoryPool", false);
|
||||||
LOG_LEVEL = static_cast<_LOG_LEVEL>(m_Config->Get<int>("Debug.LogLevel", 1));
|
LOG_LEVEL = static_cast<_LOG_LEVEL>(m_Config->Get<int>("Debug.LogLevel", 1));
|
||||||
PlayerSpawnSystem::SetRespawnTime(m_Config->Get<float>("Debug.RespawnTime", 15.0f));
|
|
||||||
|
|
||||||
// Create the core event broker
|
// Create the core event broker
|
||||||
m_EventBroker = new EventBroker();
|
m_EventBroker = new EventBroker();
|
||||||
@@ -120,13 +117,12 @@ Game::Game(int argc, char* argv[])
|
|||||||
m_SystemPipeline->AddSystem<PlayerMovementSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<PlayerMovementSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<SpawnerSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<SpawnerSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<PlayerSpawnSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<PlayerSpawnSystem>(updateOrderLevel);
|
||||||
|
m_SystemPipeline->AddSystem<PlayerDeathSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<WeaponSystem>(updateOrderLevel, m_Renderer, m_OctreeCollision);
|
m_SystemPipeline->AddSystem<WeaponSystem>(updateOrderLevel, m_Renderer, m_OctreeCollision);
|
||||||
m_SystemPipeline->AddSystem<LifetimeSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<LifetimeSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<CapturePointSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<CapturePointHUDSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<CapturePointHUDSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<PickupSpawnSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<PickupSpawnSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<AmmoPickupSystem>(updateOrderLevel);
|
|
||||||
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
|
|
||||||
// Populate Octree with collidables
|
// Populate Octree with collidables
|
||||||
++updateOrderLevel;
|
++updateOrderLevel;
|
||||||
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
||||||
@@ -134,7 +130,6 @@ Game::Game(int argc, char* argv[])
|
|||||||
m_SystemPipeline->AddSystem<FillFrustumOctreeSystem>(updateOrderLevel, m_OctreeFrustrumCulling);
|
m_SystemPipeline->AddSystem<FillFrustumOctreeSystem>(updateOrderLevel, m_OctreeFrustrumCulling);
|
||||||
m_SystemPipeline->AddSystem<AnimationSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<AnimationSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<UniformScaleSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<UniformScaleSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<PlayerDeathSystem>(updateOrderLevel);
|
|
||||||
m_SystemPipeline->AddSystem<PlayerHUDSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<PlayerHUDSystem>(updateOrderLevel);
|
||||||
// Collision and TriggerSystem should update after player.
|
// Collision and TriggerSystem should update after player.
|
||||||
++updateOrderLevel;
|
++updateOrderLevel;
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
#include "Systems/AmmoPickupSystem.h"
|
|
||||||
|
|
||||||
AmmoPickupSystem::AmmoPickupSystem(SystemParams params)
|
|
||||||
: System(params)
|
|
||||||
{
|
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &AmmoPickupSystem::OnTriggerTouch);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AmmoPickupSystem::Update(double dt)
|
|
||||||
{
|
|
||||||
for (auto it = m_ETriggerTouchVector.begin(); it != m_ETriggerTouchVector.end(); ++it)
|
|
||||||
{
|
|
||||||
auto& ammoPickupPosition = *it;
|
|
||||||
//set the double timer value (value 3)
|
|
||||||
ammoPickupPosition.DecreaseThisRespawnTimer -= dt;
|
|
||||||
if (ammoPickupPosition.DecreaseThisRespawnTimer < 0.0) {
|
|
||||||
//spawn and delete the vector item
|
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/AmmoPickup.xml");
|
|
||||||
EntityFileParser parser(entityFile);
|
|
||||||
EntityID ammoPickupID = parser.MergeEntities(m_World);
|
|
||||||
|
|
||||||
//let the world know a pickup has spawned (graphics effects, etc)
|
|
||||||
Events::PickupSpawned ePickupSpawned;
|
|
||||||
ePickupSpawned.Pickup = EntityWrapper(m_World, ammoPickupID);
|
|
||||||
m_EventBroker->Publish(ePickupSpawned);
|
|
||||||
|
|
||||||
//set values from the old entity to the new entity
|
|
||||||
auto& newAmmoPickupEntity = EntityWrapper(m_World, ammoPickupID);
|
|
||||||
newAmmoPickupEntity["Transform"]["Position"] = ammoPickupPosition.Pos;
|
|
||||||
newAmmoPickupEntity["AmmoPickup"]["AmmoGain"] = ammoPickupPosition.AmmoGain;
|
|
||||||
newAmmoPickupEntity["AmmoPickup"]["RespawnTimer"] = ammoPickupPosition.RespawnTimer;
|
|
||||||
|
|
||||||
//erase the current element (AmmoPickupPosition)
|
|
||||||
m_ETriggerTouchVector.erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool AmmoPickupSystem::OnTriggerTouch(Events::TriggerTouch& e)
|
|
||||||
{
|
|
||||||
if (e.Entity != LocalPlayer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//TODO: add other weapontypes
|
|
||||||
if (!e.Entity.HasComponent("AssaultWeapon")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!e.Trigger.HasComponent("AmmoPickup")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int maxWeaponAmmo = (int)e.Entity["AssaultWeapon"]["MaxAmmo"];
|
|
||||||
int& currentAmmo = (int)e.Entity["AssaultWeapon"]["Ammo"];
|
|
||||||
|
|
||||||
int ammoGiven = 0.01*(double)e.Trigger["AmmoPickup"]["AmmoGain"] * maxWeaponAmmo;
|
|
||||||
//cant pick up ammopacks if you are already at MaxAmmo
|
|
||||||
if (currentAmmo >= maxWeaponAmmo) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//personEntered = e.Entity, thingEntered = e.Trigger
|
|
||||||
Events::AmmoPickup ePlayerAmmoPickup;
|
|
||||||
ePlayerAmmoPickup.AmmoGain = ammoGiven;
|
|
||||||
ePlayerAmmoPickup.Player = e.Entity;
|
|
||||||
m_EventBroker->Publish(ePlayerAmmoPickup);
|
|
||||||
//immediately give the player the ammo
|
|
||||||
currentAmmo = std::min(currentAmmo + ammoGiven, maxWeaponAmmo);
|
|
||||||
|
|
||||||
//copy position, ammogain, respawntimer (twice since one of the values will be counted down to 0, the other will be set in the new object)
|
|
||||||
//we need to copy all values since each value can be different for each ammoPickup
|
|
||||||
m_ETriggerTouchVector.push_back({ (glm::vec3)e.Trigger["Transform"]["Position"] ,e.Trigger["AmmoPickup"]["AmmoGain"],
|
|
||||||
e.Trigger["AmmoPickup"]["RespawnTimer"],e.Trigger["AmmoPickup"]["RespawnTimer"] });
|
|
||||||
|
|
||||||
//delete the ammopickup
|
|
||||||
m_World->DeleteEntity(e.Trigger.ID);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -16,9 +16,6 @@ void CapturePointHUDSystem::Update(double dt)
|
|||||||
|
|
||||||
auto CapturePointHUDElements = m_World->GetComponents("CapturePointHUD");
|
auto CapturePointHUDElements = m_World->GetComponents("CapturePointHUD");
|
||||||
auto CapturePoints = m_World->GetComponents("CapturePoint");
|
auto CapturePoints = m_World->GetComponents("CapturePoint");
|
||||||
if (CapturePointHUDElements == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto& cCapturePointHUD : *CapturePointHUDElements) {
|
for (auto& cCapturePointHUD : *CapturePointHUDElements) {
|
||||||
int HUD_ID = cCapturePointHUD["CapturePointNumber"];
|
int HUD_ID = cCapturePointHUD["CapturePointNumber"];
|
||||||
@@ -39,14 +36,14 @@ void CapturePointHUDSystem::Update(double dt)
|
|||||||
}
|
}
|
||||||
//Color hud with team color
|
//Color hud with team color
|
||||||
auto capturePointTeam = (int)teamComponent["Team"];
|
auto capturePointTeam = (int)teamComponent["Team"];
|
||||||
entityHUDparent["Sprite"]["Color"] = capturePointTeam == blueTeam ? glm::vec4(0, 0.2f, 1, 0.7f) : capturePointTeam == redTeam ? glm::vec4(1, 0.0f, 0, 0.7f) : glm::vec4(1, 1, 1, 0.3f);
|
entityHUDparent["Sprite"]["Color"] = capturePointTeam == blueTeam ? glm::vec4(0, 0.2f, 1, 0.7) : capturePointTeam == redTeam ? glm::vec4(1, 0.2f, 0, 0.7) : glm::vec4(1, 1, 1, 0.3);
|
||||||
|
|
||||||
//Progress is scaled with time
|
//Progress is scaled with time
|
||||||
double currentCaptureTime = (double)entityCP["CapturePoint"]["CaptureTimer"];
|
double currentCaptureTime = (double)entityCP["CapturePoint"]["CaptureTimer"];
|
||||||
double progress = glm::abs(currentCaptureTime)/15.0;
|
double progress = glm::abs(currentCaptureTime)/15.0;
|
||||||
int currentCapturingTeam = currentCaptureTime > 0 ? redTeam : currentCaptureTime < 0 ? blueTeam : spectatorTeam;
|
int currentCapturingTeam = currentCaptureTime > 0 ? redTeam : currentCaptureTime < 0 ? blueTeam : spectatorTeam;
|
||||||
((glm::vec3&)entityHUD["Transform"]["Orientation"]).z = currentCapturingTeam == redTeam ? glm::half_pi<float>()+glm::pi<float>() : glm::half_pi<float>();
|
((glm::vec3&)entityHUD["Transform"]["Orientation"]).z = currentCapturingTeam == redTeam ? glm::half_pi<float>()+glm::pi<float>() : glm::half_pi<float>();
|
||||||
glm::vec4 fillColor = currentCapturingTeam == redTeam ? glm::vec4(1, 0.f, 0, 0.7f) : glm::vec4(0, 0.2f, 1, 0.7f);
|
glm::vec4 fillColor = currentCapturingTeam == redTeam ? glm::vec4(1, 0.2f, 0, 0.7) : glm::vec4(0, 0.2f, 1, 0.7);
|
||||||
entityHUD["Fill"]["Color"] = fillColor;
|
entityHUD["Fill"]["Color"] = fillColor;
|
||||||
entityHUD["Fill"]["Percentage"] = progress;
|
entityHUD["Fill"]["Percentage"] = progress;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
const int redTeam = (int)teamComponent["Team"].Enum("Red");
|
const int redTeam = (int)teamComponent["Team"].Enum("Red");
|
||||||
const int blueTeam = (int)teamComponent["Team"].Enum("Blue");
|
const int blueTeam = (int)teamComponent["Team"].Enum("Blue");
|
||||||
const int spectatorTeam = (int)teamComponent["Team"].Enum("Spectator");
|
const int spectatorTeam = (int)teamComponent["Team"].Enum("Spectator");
|
||||||
const double captureTimeToTakeOver = (double)cCapturePoint["CapturePointMaxTimer"];
|
|
||||||
|
|
||||||
int homePointForTeam = (int)cCapturePoint["HomePointForTeam"];
|
int homePointForTeam = (int)cCapturePoint["HomePointForTeam"];
|
||||||
if (m_NumberOfCapturePoints == 0 && capturePointNumber != 0 && (homePointForTeam == redTeam || homePointForTeam == blueTeam)) {
|
if (m_NumberOfCapturePoints == 0 && capturePointNumber != 0 && (homePointForTeam == redTeam || homePointForTeam == blueTeam)) {
|
||||||
@@ -58,7 +57,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
int blueTeamPlayersStandingInside = 0;
|
int blueTeamPlayersStandingInside = 0;
|
||||||
if (capturePointEntity.HasComponent("Model")) {
|
if (capturePointEntity.HasComponent("Model")) {
|
||||||
//Now sets team color to the capturepoint, or white if it is uncaptured.
|
//Now sets team color to the capturepoint, or white if it is uncaptured.
|
||||||
capturePointEntity["Model"]["Color"] = ownedBy == blueTeam ? glm::vec4(0, 0.0f, 1, 0.3) : ownedBy == redTeam ? glm::vec4(1, 0.0f, 0, 0.3) : glm::vec4(1, 1, 1, 0.3);
|
capturePointEntity["Model"]["Color"] = ownedBy == blueTeam ? glm::vec4(0, 0.2f, 1, 0.3) : ownedBy == redTeam ? glm::vec4(1, 0.2f, 0, 0.3) : glm::vec4(1, 1, 1, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate next possible capturePoint for both teams
|
//calculate next possible capturePoint for both teams
|
||||||
@@ -99,16 +98,20 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
ComponentWrapper& capturePoint = m_CapturePointNumberToEntityMap[i]["CapturePoint"];
|
ComponentWrapper& capturePoint = m_CapturePointNumberToEntityMap[i]["CapturePoint"];
|
||||||
if ((int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Red"] &&
|
if ((int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Red"] &&
|
||||||
(int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Blue"]) {
|
(int)capturePoint["CapturePointNumber"] != nextPossibleCapturePoint["Blue"]) {
|
||||||
//RED = +, BLUE = -, NONE
|
capturePoint["CaptureTimer"] = 0.0;
|
||||||
auto teamOwners = (int)m_CapturePointNumberToEntityMap[i]["Team"]["Team"];
|
|
||||||
if (teamOwners == redTeam || teamOwners == blueTeam) {
|
|
||||||
capturePoint["CaptureTimer"] = teamOwners == blueTeam ? -captureTimeToTakeOver : captureTimeToTakeOver;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_ResetTimers = false;
|
m_ResetTimers = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//colorize next possible capturepoint
|
||||||
|
if (nextPossibleCapturePoint["Red"] == capturePointNumber) {
|
||||||
|
capturePointEntity["Model"]["Color"] = glm::vec4(1, 1, 0, 0.3);
|
||||||
|
}
|
||||||
|
if (nextPossibleCapturePoint["Blue"] == capturePointNumber) {
|
||||||
|
capturePointEntity["Model"]["Color"] = glm::vec4(0, 1, 1, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
//check how many players are standing inside and are healthy
|
//check how many players are standing inside and are healthy
|
||||||
for (size_t i = m_ETriggerTouchVector.size(); i > 0; i--)
|
for (size_t i = m_ETriggerTouchVector.size(); i > 0; i--)
|
||||||
{
|
{
|
||||||
@@ -167,6 +170,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
//B. at most one of the teams have players inside
|
//B. at most one of the teams have players inside
|
||||||
//if capturePoint is not owned by the take-over team, just modify the CaptureTimer accordingly
|
//if capturePoint is not owned by the take-over team, just modify the CaptureTimer accordingly
|
||||||
if (ownedBy != currentTeam && canCapture) {
|
if (ownedBy != currentTeam && canCapture) {
|
||||||
|
if (abs((double)cCapturePoint["CaptureTimer"]) < 0.001f) {
|
||||||
|
LOG_DEBUG("Point is being captured by team %i", currentTeam); //Remove when we tested sufficiently.
|
||||||
|
}
|
||||||
cCapturePoint["CaptureTimer"] = (double)cCapturePoint["CaptureTimer"] + timerDeltaChange;
|
cCapturePoint["CaptureTimer"] = (double)cCapturePoint["CaptureTimer"] + timerDeltaChange;
|
||||||
}
|
}
|
||||||
//if capturePoint is owned by the team, and the other team has been trying to take it, then increase/decrease the timer towards 0.0
|
//if capturePoint is owned by the team, and the other team has been trying to take it, then increase/decrease the timer towards 0.0
|
||||||
@@ -174,11 +180,12 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
(ownedBy == currentTeam && currentTeam == blueTeam && (double)cCapturePoint["CaptureTimer"] > 0.0)) {
|
(ownedBy == currentTeam && currentTeam == blueTeam && (double)cCapturePoint["CaptureTimer"] > 0.0)) {
|
||||||
cCapturePoint["CaptureTimer"] = (double)cCapturePoint["CaptureTimer"] + timerDeltaChange;
|
cCapturePoint["CaptureTimer"] = (double)cCapturePoint["CaptureTimer"] + timerDeltaChange;
|
||||||
}
|
}
|
||||||
//check if captureTimer > captureTimeToTakeOver and if so change owner and publish the eCaptured event
|
//check if captureTimer > m_CaptureTimeToTakeOver and if so change owner and publish the eCaptured event
|
||||||
if (abs((double)cCapturePoint["CaptureTimer"]) > captureTimeToTakeOver && canCapture) {
|
if (abs((double)cCapturePoint["CaptureTimer"]) > abs(m_CaptureTimeToTakeOver) && canCapture) {
|
||||||
teamComponent["Team"] = currentTeam;
|
teamComponent["Team"] = currentTeam;
|
||||||
cCapturePoint["CaptureTimer"] = glm::sign((double)cCapturePoint["CaptureTimer"])*captureTimeToTakeOver;
|
cCapturePoint["CaptureTimer"] = 0.0;
|
||||||
//publish Captured event
|
//publish Captured event
|
||||||
|
LOG_DEBUG("Point is captured by team %i!", currentTeam); //Remove when we tested sufficiently.
|
||||||
Events::Captured e;
|
Events::Captured e;
|
||||||
e.CapturePointID = cCapturePoint.EntityID;
|
e.CapturePointID = cCapturePoint.EntityID;
|
||||||
e.TeamNumberThatCapturedCapturePoint = currentTeam;
|
e.TeamNumberThatCapturedCapturePoint = currentTeam;
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
#include "Systems/DamageIndicatorSystem.h"
|
|
||||||
|
|
||||||
DamageIndicatorSystem::DamageIndicatorSystem(SystemParams params)
|
|
||||||
: System(params)
|
|
||||||
{
|
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &DamageIndicatorSystem::OnPlayerDamage);
|
|
||||||
//current camera
|
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &DamageIndicatorSystem::OnSetCamera);
|
|
||||||
|
|
||||||
//load texture to cache
|
|
||||||
auto texture = CommonFunctions::LoadTexture("Textures/DamageIndicator.png", false);
|
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DamageIndicator.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DamageIndicatorSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
|
||||||
{
|
|
||||||
if (m_CurrentCamera == EntityID_Invalid) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.Victim != LocalPlayer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!e.Inflictor.Valid() || !e.Victim.Valid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//grab players direction
|
|
||||||
auto playerOrientation = glm::quat((glm::vec3)e.Victim["Transform"]["Orientation"]);
|
|
||||||
|
|
||||||
//get the position vectors, but ignore the y-height
|
|
||||||
auto enemyPosition = (glm::vec3)e.Inflictor["Transform"]["Position"];
|
|
||||||
auto playerPosition = (glm::vec3)e.Victim["Transform"]["Position"];
|
|
||||||
enemyPosition.y = 0.0f;
|
|
||||||
playerPosition.y = 0.0f;
|
|
||||||
|
|
||||||
//calculate the enemy to player vector
|
|
||||||
auto enemyPlayerVector = glm::normalize(playerPosition - enemyPosition);
|
|
||||||
|
|
||||||
//get angle from players current rotation, this angle is how much you rotate around the y-axis
|
|
||||||
auto playerAngle = glm::angle(playerOrientation);
|
|
||||||
auto playerRotationVector = glm::normalize(glm::rotateY(glm::vec3(0, 0, 1), playerAngle));
|
|
||||||
|
|
||||||
//dot product of players direction-vector and enemys-to-playervector will give the cos of the angle between the vectors
|
|
||||||
auto playerRotationDot = glm::dot(playerRotationVector, enemyPlayerVector);
|
|
||||||
//to get the angle between the vectors just do cos-inverse
|
|
||||||
auto angleBetweenVectors = glm::acos(playerRotationDot);
|
|
||||||
|
|
||||||
//rotate the direction-vector 90 degrees to get the players side-vector
|
|
||||||
auto playerSideVector = glm::normalize(glm::rotateY(glm::vec3(0, 0, 1), playerAngle + 1.57f));
|
|
||||||
//dot of sidevector positive = enemy is on the right side, dot sidevector negative = left side
|
|
||||||
auto playerSideVectorDot = glm::dot(playerSideVector, enemyPlayerVector);
|
|
||||||
if (playerSideVectorDot < 0) {
|
|
||||||
angleBetweenVectors = -angleBetweenVectors;
|
|
||||||
}
|
|
||||||
|
|
||||||
//load & set the "2d" sprite
|
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DamageIndicator.xml");
|
|
||||||
EntityFileParser parser(entityFile);
|
|
||||||
EntityID spriteID = parser.MergeEntities(m_World);
|
|
||||||
m_World->SetParent(spriteID, m_CurrentCamera);
|
|
||||||
auto spriteWrapper = EntityWrapper(m_World, spriteID);
|
|
||||||
//simply set the rotation z-wise to the angleBetweenVectors
|
|
||||||
spriteWrapper["Transform"]["Orientation"] = glm::vec3(0, 0, angleBetweenVectors);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DamageIndicatorSystem::OnSetCamera(const Events::SetCamera& e) {
|
|
||||||
m_CurrentCamera = e.CameraEntity.ID;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,6 @@ HealthSystem::HealthSystem(SystemParams params)
|
|||||||
//subscribe/listenTo playerdamage,healthpickup events (using the eventBroker)
|
//subscribe/listenTo playerdamage,healthpickup events (using the eventBroker)
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &HealthSystem::OnPlayerDamaged);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &HealthSystem::OnPlayerDamaged);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerHealthPickup, &HealthSystem::OnPlayerHealthPickup);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerHealthPickup, &HealthSystem::OnPlayerHealthPickup);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_InputCommand, &HealthSystem::OnInputCommand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HealthSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
|
void HealthSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
|
||||||
@@ -16,13 +15,13 @@ void HealthSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& comp
|
|||||||
|
|
||||||
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
|
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
|
||||||
{
|
{
|
||||||
ComponentWrapper cHealth = e.Victim["Health"];
|
ComponentWrapper cHealth = e.Player["Health"];
|
||||||
double& health = cHealth["Health"];
|
double& health = cHealth["Health"];
|
||||||
health -= e.Damage;
|
health -= e.Damage;
|
||||||
|
|
||||||
if (health <= 0.0) {
|
if (health <= 0.0) {
|
||||||
Events::PlayerDeath ePlayerDeath;
|
Events::PlayerDeath ePlayerDeath;
|
||||||
ePlayerDeath.Player = e.Victim;
|
ePlayerDeath.Player = e.Player;
|
||||||
m_EventBroker->Publish(ePlayerDeath);
|
m_EventBroker->Publish(ePlayerDeath);
|
||||||
//Note: we will delete the entity in PlayerDeathSystem
|
//Note: we will delete the entity in PlayerDeathSystem
|
||||||
}
|
}
|
||||||
@@ -30,17 +29,6 @@ bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HealthSystem::OnInputCommand(Events::InputCommand& e)
|
|
||||||
{
|
|
||||||
if (e.Command == "TakeDamage" && e.Value > 0 && LocalPlayer.Valid()) {
|
|
||||||
Events::PlayerDamage ev;
|
|
||||||
ev.Victim = LocalPlayer;
|
|
||||||
ev.Damage = e.Value;
|
|
||||||
m_EventBroker->Publish(ev);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HealthSystem::OnPlayerHealthPickup(Events::PlayerHealthPickup& e)
|
bool HealthSystem::OnPlayerHealthPickup(Events::PlayerHealthPickup& e)
|
||||||
{
|
{
|
||||||
ComponentWrapper cHealth = e.Player["Health"];
|
ComponentWrapper cHealth = e.Player["Health"];
|
||||||
|
|||||||
@@ -34,23 +34,14 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
|
|||||||
|
|
||||||
//components that we need from player
|
//components that we need from player
|
||||||
auto playerCamera = player.FirstChildByName("Camera");
|
auto playerCamera = player.FirstChildByName("Camera");
|
||||||
auto playerModel = player.FirstChildByName("PlayerModel");
|
auto playerEntityModel = player.FirstChildByName("PlayerModel")["Model"];
|
||||||
if (!playerCamera.Valid() || !playerModel.Valid()) {
|
auto playerEntityAnimation = player.FirstChildByName("PlayerModel")["Animation"];
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!playerModel.HasComponent("Model") || !playerModel.HasComponent("Animation")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto playerEntityModel = playerModel["Model"];
|
|
||||||
auto playerEntityAnimation = playerModel["Animation"];
|
|
||||||
|
|
||||||
//copy the data from player to explisioneffectmodel
|
//copy the data from player to explisioneffectmodel
|
||||||
playerEntityModel.Copy(deathEffectEW["Model"]);
|
playerEntityModel.Copy(deathEffectEW["Model"]);
|
||||||
playerEntityAnimation.Copy(deathEffectEW["Animation"]);
|
playerEntityAnimation.Copy(deathEffectEW["Animation"]);
|
||||||
//freeze the animation
|
//freeze the animation
|
||||||
deathEffectEW["Animation"]["Speed1"] = 0.0;
|
deathEffectEW["Animation"]["Speed"] = 0.0;
|
||||||
deathEffectEW["Animation"]["Speed2"] = 0.0;
|
|
||||||
deathEffectEW["Animation"]["Speed3"] = 0.0;
|
|
||||||
|
|
||||||
//copy the models position,orientation
|
//copy the models position,orientation
|
||||||
deathEffectEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
deathEffectEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
||||||
@@ -59,10 +50,8 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
|
|||||||
//deathEffectEW["ExplosionEffect"]["ExplosionOrigin"] = glm::vec3(0, 0, 0);
|
//deathEffectEW["ExplosionEffect"]["ExplosionOrigin"] = glm::vec3(0, 0, 0);
|
||||||
|
|
||||||
//camera (with lifetime) behind the player
|
//camera (with lifetime) behind the player
|
||||||
if (player == LocalPlayer) {
|
|
||||||
auto cam = deathEffectEW.FirstChildByName("Camera");
|
auto cam = deathEffectEW.FirstChildByName("Camera");
|
||||||
Events::SetCamera eSetCamera;
|
Events::SetCamera eSetCamera;
|
||||||
eSetCamera.CameraEntity = cam;
|
eSetCamera.CameraEntity = cam;
|
||||||
m_EventBroker->Publish(eSetCamera);
|
m_EventBroker->Publish(eSetCamera);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
|
|
||||||
float playerMovementSpeed = player["Player"]["MovementSpeed"];
|
float playerMovementSpeed = player["Player"]["MovementSpeed"];
|
||||||
float playerCrouchSpeed = player["Player"]["CrouchSpeed"];
|
float playerCrouchSpeed = player["Player"]["CrouchSpeed"];
|
||||||
glm::vec3& wishDirection = player["Player"]["CurrentWishDirection"];
|
|
||||||
|
|
||||||
if (player.HasComponent("Physics")) {
|
if (player.HasComponent("Physics")) {
|
||||||
ComponentWrapper cPhysics = player["Physics"];
|
ComponentWrapper cPhysics = player["Physics"];
|
||||||
@@ -59,7 +58,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
if (player.HasComponent("DashAbility")) {
|
if (player.HasComponent("DashAbility")) {
|
||||||
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"]);
|
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"]);
|
||||||
}
|
}
|
||||||
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
|
glm::vec3 wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
|
||||||
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
|
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
|
||||||
if (controller->AssaultDashDoubleTapped() && controller->Movement().z != 0 && controller->Movement().x != 0) {
|
if (controller->AssaultDashDoubleTapped() && controller->Movement().z != 0 && controller->Movement().x != 0) {
|
||||||
wishDirection = glm::vec3(controller->Movement().x, 0, 0)* glm::inverse(glm::quat(ori));
|
wishDirection = glm::vec3(controller->Movement().x, 0, 0)* glm::inverse(glm::quat(ori));
|
||||||
@@ -110,15 +109,9 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
//you cant jump and dash at the same time - since there is no friction in the air and we would thus dash much further in the air
|
//you cant jump and dash at the same time - since there is no friction in the air and we would thus dash much further in the air
|
||||||
if (!controller->PlayerIsDashing() && controller->Jumping() && !controller->Crouching() && (isOnGround || !controller->DoubleJumping())) {
|
if (!controller->PlayerIsDashing() && controller->Jumping() && !controller->Crouching() && (isOnGround || !controller->DoubleJumping())) {
|
||||||
(bool)cPhysics["IsOnGround"] = false;
|
(bool)cPhysics["IsOnGround"] = false;
|
||||||
if (isOnGround) {
|
if (velocity.y == 0.f) {
|
||||||
controller->SetDoubleJumping(false);
|
controller->SetDoubleJumping(false);
|
||||||
} else {
|
} else {
|
||||||
//put a hexagon at the players feet
|
|
||||||
auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml");
|
|
||||||
EntityFileParser parser(hexagonEffect);
|
|
||||||
EntityID hexagonEffectID = parser.MergeEntities(m_World);
|
|
||||||
EntityWrapper hexagonEW = EntityWrapper(m_World, hexagonEffectID);
|
|
||||||
hexagonEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
|
||||||
controller->SetDoubleJumping(true);
|
controller->SetDoubleJumping(true);
|
||||||
Events::DoubleJump e;
|
Events::DoubleJump e;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
@@ -234,8 +227,7 @@ void PlayerMovementSystem::updateVelocity(double dt)
|
|||||||
float speed = glm::length(velocity);
|
float speed = glm::length(velocity);
|
||||||
static float groundFriction = 7.f;
|
static float groundFriction = 7.f;
|
||||||
ImGui::InputFloat("groundFriction", &groundFriction);
|
ImGui::InputFloat("groundFriction", &groundFriction);
|
||||||
static float airFriction = 2.f;
|
static float airFriction = 0.f;
|
||||||
|
|
||||||
ImGui::InputFloat("airFriction", &airFriction);
|
ImGui::InputFloat("airFriction", &airFriction);
|
||||||
float friction = isOnGround ? groundFriction : airFriction;
|
float friction = isOnGround ? groundFriction : airFriction;
|
||||||
if (speed > 0) {
|
if (speed > 0) {
|
||||||
|
|||||||
@@ -1,39 +1,20 @@
|
|||||||
#include "Systems/PlayerSpawnSystem.h"
|
#include "Systems/PlayerSpawnSystem.h"
|
||||||
|
|
||||||
//This should be set by the config anyway.
|
|
||||||
float PlayerSpawnSystem::m_RespawnTime = 15.0f;
|
|
||||||
|
|
||||||
PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
|
PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
|
||||||
: System(params)
|
: System(params)
|
||||||
, m_Timer(0.f)
|
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_OnInputCommand, &PlayerSpawnSystem::OnInputCommand);
|
EVENT_SUBSCRIBE_MEMBER(m_OnInputCommand, &PlayerSpawnSystem::OnInputCommand);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerSpawnerd, &PlayerSpawnSystem::OnPlayerSpawned);
|
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerSpawnerd, &PlayerSpawnSystem::OnPlayerSpawned);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerDeath, &PlayerSpawnSystem::OnPlayerDeath);
|
|
||||||
m_NetworkEnabled = ResourceManager::Load<ConfigFile>("Config.ini")->Get("Networking.StartNetwork", false);
|
m_NetworkEnabled = ResourceManager::Load<ConfigFile>("Config.ini")->Get("Networking.StartNetwork", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerSpawnSystem::Update(double dt)
|
void PlayerSpawnSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
//Increase timer.
|
|
||||||
m_Timer += dt;
|
|
||||||
if (m_Timer < m_RespawnTime) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//If respawn time has passed, we spawn all players that have requested to be spawned.
|
|
||||||
m_Timer = 0.f;
|
|
||||||
|
|
||||||
//If there are no spawn requests, return immediately, if we are client the SpawnRequests should always be empty.
|
|
||||||
if (m_SpawnRequests.size() == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto playerSpawns = m_World->GetComponents("PlayerSpawn");
|
auto playerSpawns = m_World->GetComponents("PlayerSpawn");
|
||||||
if (playerSpawns == nullptr) {
|
if (playerSpawns == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int numSpawnedPlayers = 0;
|
|
||||||
for (auto& req : m_SpawnRequests) {
|
for (auto& req : m_SpawnRequests) {
|
||||||
for (auto& cPlayerSpawn : *playerSpawns) {
|
for (auto& cPlayerSpawn : *playerSpawns) {
|
||||||
EntityWrapper spawner(m_World, cPlayerSpawn.EntityID);
|
EntityWrapper spawner(m_World, cPlayerSpawn.EntityID);
|
||||||
@@ -59,61 +40,29 @@ void PlayerSpawnSystem::Update(double dt)
|
|||||||
e.Player = player;
|
e.Player = player;
|
||||||
e.Spawner = spawner;
|
e.Spawner = spawner;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
++numSpawnedPlayers;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (numSpawnedPlayers != (int)m_SpawnRequests.size()) {
|
|
||||||
LOG_DEBUG("%i players were supposed to be spawned, but %i was spawned.", (int)m_SpawnRequests.size(), numSpawnedPlayers);
|
|
||||||
} else {
|
|
||||||
LOG_DEBUG("%i players were spawned.", numSpawnedPlayers);
|
|
||||||
}
|
|
||||||
m_SpawnRequests.clear();
|
m_SpawnRequests.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
|
bool PlayerSpawnSystem::OnInputCommand(const Events::InputCommand& e)
|
||||||
{
|
{
|
||||||
if (e.Command != "PickTeam") {
|
if (e.Command != "PickTeam") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Team picks should be processed ONLY server-side!
|
// Team picks should be processed ONLY server-side!
|
||||||
// Don't make a spawn request if we're the client.
|
// Don't make a spawn request if PlayerID is -1, i.e. we're the client.
|
||||||
if (!IsServer && m_NetworkEnabled) {
|
if (e.PlayerID == -1 && m_NetworkEnabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Value == 0) {
|
if (e.Value != 0) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Spectating?
|
|
||||||
//Right now, return if someone picks spectator.
|
|
||||||
//1 signifies spectator here, could not get Playerteam component since it may be invalid or without team comp.
|
|
||||||
if ((ComponentInfo::EnumType)e.Value == 1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check if the player already requested spawn.
|
|
||||||
auto iter = m_SpawnRequests.begin();
|
|
||||||
for (; iter != m_SpawnRequests.end(); ++iter) {
|
|
||||||
if (iter->PlayerID == e.PlayerID) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iter != m_SpawnRequests.end()) {
|
|
||||||
//If player is in queue to spawn, then change their team affiliation in the request.
|
|
||||||
iter->Team = (ComponentInfo::EnumType)e.Value;
|
|
||||||
} else if (m_PlayerEntities.count(e.PlayerID) == 0 || !m_PlayerEntities[e.PlayerID].Valid()) {
|
|
||||||
//If player is not in queue to spawn, then create a spawn request,
|
|
||||||
//but only if they are spectating and/or just connected.
|
|
||||||
SpawnRequest req;
|
SpawnRequest req;
|
||||||
req.PlayerID = e.PlayerID;
|
req.PlayerID = e.PlayerID;
|
||||||
req.Team = (ComponentInfo::EnumType)e.Value;
|
req.Team = (ComponentInfo::EnumType)e.Value;
|
||||||
m_SpawnRequests.push_back(req);
|
m_SpawnRequests.push_back(req);
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -121,20 +70,25 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
|
|||||||
|
|
||||||
bool PlayerSpawnSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
|
bool PlayerSpawnSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
|
||||||
{
|
{
|
||||||
// Store the player for future reference
|
|
||||||
m_PlayerEntities[e.PlayerID] = e.Player;
|
|
||||||
m_PlayerIDs[e.Player.ID] = e.PlayerID;
|
|
||||||
|
|
||||||
// When a player is actually spawned (since the actual spawning is handled on the server)
|
// When a player is actually spawned (since the actual spawning is handled on the server)
|
||||||
if (!IsClient) {
|
if (!IsClient) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if a player already exists
|
||||||
|
if (m_PlayerEntities.count(e.PlayerID) != 0) {
|
||||||
|
// TODO: Disallow infinite respawning here
|
||||||
|
if (m_PlayerEntities[e.PlayerID].Valid()) {
|
||||||
|
m_World->DeleteEntity(m_PlayerEntities[e.PlayerID].ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the player for future reference
|
||||||
|
m_PlayerEntities[e.PlayerID] = e.Player;
|
||||||
|
|
||||||
// Set the camera to the correct entity
|
// Set the camera to the correct entity
|
||||||
EntityWrapper cameraEntity = e.Player.FirstChildByName("Camera");
|
EntityWrapper cameraEntity = e.Player.FirstChildByName("Camera");
|
||||||
bool outOfBodyExperience = ResourceManager::Load<ConfigFile>("Config.ini")->Get<bool>("Debug.OutOfBodyExperience", false);
|
if (cameraEntity.Valid()) {
|
||||||
if (cameraEntity.Valid() && !outOfBodyExperience) {
|
|
||||||
Events::SetCamera e;
|
Events::SetCamera e;
|
||||||
e.CameraEntity = cameraEntity;
|
e.CameraEntity = cameraEntity;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
@@ -160,23 +114,3 @@ bool PlayerSpawnSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerSpawnSystem::OnPlayerDeath(Events::PlayerDeath& e)
|
|
||||||
{
|
|
||||||
//Only spawn request if network is disabled or we are server.
|
|
||||||
if (!IsServer && m_NetworkEnabled) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!e.Player.HasComponent("Team")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ComponentWrapper cTeam = e.Player["Team"];
|
|
||||||
//A spectator can't die anyway
|
|
||||||
if ((ComponentInfo::EnumType)cTeam["Team"] == cTeam["Team"].Enum("Spectator")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
SpawnRequest req;
|
|
||||||
req.PlayerID = m_PlayerIDs.at(e.Player.ID);
|
|
||||||
req.Team = cTeam["Team"];
|
|
||||||
m_SpawnRequests.push_back(req);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ bool SoundSystem::OnInputCommand(const Events::InputCommand & e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (e.Command == "TakeDamage" && e.Value > 0) {
|
||||||
|
Events::PlayerDamage ev;
|
||||||
|
ev.Player = LocalPlayer;
|
||||||
|
ev.Damage = 1.0;
|
||||||
|
m_EventBroker->Publish(ev);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,12 +48,10 @@ EntityWrapper SpawnerSystem::Spawn(EntityWrapper spawner, EntityWrapper parent /
|
|||||||
EntityFileParser parser(entityFile);
|
EntityFileParser parser(entityFile);
|
||||||
EntityWrapper spawnedEntity(world, parser.MergeEntities(world, parent.ID));
|
EntityWrapper spawnedEntity(world, parser.MergeEntities(world, parent.ID));
|
||||||
|
|
||||||
if (spawnPoint != parent) {
|
|
||||||
// Set its position and orientation to that of the SpawnPoint
|
// Set its position and orientation to that of the SpawnPoint
|
||||||
spawnedEntity["Transform"]["Position"] = Transform::AbsolutePosition(spawnPoint.World, spawnPoint.ID);
|
spawnedEntity["Transform"]["Position"] = Transform::AbsolutePosition(spawnPoint.World, spawnPoint.ID);
|
||||||
// TODO: Quaternions, bitch
|
// TODO: Quaternions, bitch
|
||||||
spawnedEntity["Transform"]["Orientation"] = glm::eulerAngles(Transform::AbsoluteOrientation(spawnPoint));
|
spawnedEntity["Transform"]["Orientation"] = glm::eulerAngles(Transform::AbsoluteOrientation(spawnPoint));
|
||||||
}
|
|
||||||
|
|
||||||
return spawnedEntity;
|
return spawnedEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,341 +0,0 @@
|
|||||||
#include "Systems/Weapon/AssaultWeaponBehaviour.h"
|
|
||||||
|
|
||||||
AssaultWeaponBehaviour::AssaultWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper player)
|
|
||||||
: WeaponBehaviour(systemParams, renderer, collisionOctree, player)
|
|
||||||
{
|
|
||||||
m_FirstPersonModel = m_Player.FirstChildByName("Hands");
|
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EAnimationComplete, &AssaultWeaponBehaviour::OnAnimationComplete);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::Fire()
|
|
||||||
{
|
|
||||||
m_TimeSinceLastFire = 0.0;
|
|
||||||
m_Firing = true;
|
|
||||||
fireRound();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::CeaseFire()
|
|
||||||
{
|
|
||||||
m_Firing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::Reload()
|
|
||||||
{
|
|
||||||
if (m_Reloading) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentWrapper& cAssaultWeapon = m_Player["AssaultWeapon"];
|
|
||||||
int magAmmo = cAssaultWeapon["MagazineAmmo"];
|
|
||||||
int magSize = cAssaultWeapon["MagazineSize"];
|
|
||||||
int ammo = cAssaultWeapon["Ammo"];
|
|
||||||
|
|
||||||
// Don't reload if we're already fully loaded
|
|
||||||
if (magAmmo == magSize) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't reload if we're completly out of ammo
|
|
||||||
if (ammo == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Reloading = true;
|
|
||||||
m_ReloadTimer = cAssaultWeapon["ReloadTime"];
|
|
||||||
playReloadAnimation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::Update(double dt)
|
|
||||||
{
|
|
||||||
if (m_Reloading) {
|
|
||||||
m_ReloadTimer -= dt;
|
|
||||||
// Re-enable glow on reload impersonator half-way through the animation
|
|
||||||
if (m_ReloadTimer <= (double)m_Player["AssaultWeapon"]["ReloadTime"] / 2.0) {
|
|
||||||
if (m_ReloadImpersonator.Valid()) {
|
|
||||||
m_ReloadImpersonator["Model"]["GlowMap"] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m_ReloadTimer <= 0) {
|
|
||||||
finishReload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_Firing && !m_Reloading) {
|
|
||||||
m_TimeSinceLastFire += dt;
|
|
||||||
ComponentWrapper& cAssaultWeapon = m_Player["AssaultWeapon"];
|
|
||||||
if (m_TimeSinceLastFire >= 1.0 / ((double)cAssaultWeapon["RPM"] / 60.0)) {
|
|
||||||
fireRound();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_Firing && !m_Reloading) {
|
|
||||||
playIdleAnimation();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable glow map on weapon if it's out of ammo
|
|
||||||
// Make real first person weapon model visible again
|
|
||||||
EntityWrapper firstPersonWeaponModel = m_Player.FirstChildByName("WeaponModel");
|
|
||||||
if (firstPersonWeaponModel.Valid()) {
|
|
||||||
firstPersonWeaponModel["Model"]["GlowMap"] = hasAmmo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AssaultWeaponBehaviour::OnAnimationComplete(Events::AnimationComplete& e)
|
|
||||||
{
|
|
||||||
if (e.Entity != m_FirstPersonModel) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (e.Name == "ShootRifle") {
|
|
||||||
// if (!m_Firing) {
|
|
||||||
// playIdleAnimation();
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AssaultWeaponBehaviour::hasAmmo()
|
|
||||||
{
|
|
||||||
ComponentWrapper& cAssaultWeapon = m_Player["AssaultWeapon"];
|
|
||||||
int& magAmmo = cAssaultWeapon["MagazineAmmo"];
|
|
||||||
return magAmmo > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::fireRound()
|
|
||||||
{
|
|
||||||
if (m_Reloading) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentWrapper& cAssaultWeapon = m_Player["AssaultWeapon"];
|
|
||||||
|
|
||||||
int& magAmmo = cAssaultWeapon["MagazineAmmo"];
|
|
||||||
int ammo = cAssaultWeapon["Ammo"];
|
|
||||||
|
|
||||||
// Reload if our magazine is empty
|
|
||||||
if (magAmmo <= 0) {
|
|
||||||
Reload();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fire
|
|
||||||
magAmmo -= 1;
|
|
||||||
spawnTracer();
|
|
||||||
playSound();
|
|
||||||
viewPunch();
|
|
||||||
playShootAnimation();
|
|
||||||
bool hit = shoot(cAssaultWeapon["BaseDamage"]);
|
|
||||||
if (hit) {
|
|
||||||
showHitMarker();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_TimeSinceLastFire = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::spawnTracer()
|
|
||||||
{
|
|
||||||
if (!IsClient) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityWrapper spawner;
|
|
||||||
if (m_Player == LocalPlayer) {
|
|
||||||
spawner = m_Player.FirstChildByName("WeaponMuzzle");
|
|
||||||
} else {
|
|
||||||
spawner = m_Player.FirstChildByName("ThirdPersonWeaponMuzzle");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!spawner.Valid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float distance = traceRayDistance(Transform::AbsolutePosition(spawner), Transform::AbsoluteOrientation(spawner) * glm::vec3(0, 0, -1));
|
|
||||||
EntityWrapper ray = SpawnerSystem::Spawn(spawner);
|
|
||||||
((glm::vec3&)ray["Transform"]["Scale"]).z = (distance / 100.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
float AssaultWeaponBehaviour::traceRayDistance(glm::vec3 origin, glm::vec3 direction)
|
|
||||||
{
|
|
||||||
// TODO: Cast a ray and size tracer appropriately
|
|
||||||
float distance;
|
|
||||||
glm::vec3 pos;
|
|
||||||
auto entity = Collision::EntityFirstHitByRay(Ray(origin, direction), m_CollisionOctree, distance, pos);
|
|
||||||
if (entity) {
|
|
||||||
return distance;
|
|
||||||
} else {
|
|
||||||
return 100.f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::playSound()
|
|
||||||
{
|
|
||||||
if (!IsClient) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Events::PlaySoundOnEntity e;
|
|
||||||
e.EmitterID = m_Player.ID;
|
|
||||||
e.FilePath = "Audio/laser/laser1.wav";
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::viewPunch()
|
|
||||||
{
|
|
||||||
EntityWrapper playerCamera = m_Player.FirstChildByName("Camera");
|
|
||||||
if (!playerCamera.Valid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float viewPunch = m_Player["AssaultWeapon"]["ViewPunch"];
|
|
||||||
ComponentWrapper cTransform = playerCamera["Transform"];
|
|
||||||
glm::vec3& orientation = cTransform["Orientation"];
|
|
||||||
orientation.x += viewPunch;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::finishReload()
|
|
||||||
{
|
|
||||||
ComponentWrapper& cAssaultWeapon = m_Player["AssaultWeapon"];
|
|
||||||
int& magAmmo = cAssaultWeapon["MagazineAmmo"];
|
|
||||||
int magSize = cAssaultWeapon["MagazineSize"];
|
|
||||||
int& ammo = cAssaultWeapon["Ammo"];
|
|
||||||
|
|
||||||
// Throw away rounds in magazine to incentivise ammo sharing
|
|
||||||
int toLoad = glm::min(magSize, ammo);
|
|
||||||
magAmmo = toLoad;
|
|
||||||
ammo -= toLoad;
|
|
||||||
|
|
||||||
// Make real first person weapon model visible again
|
|
||||||
EntityWrapper firstPersonWeaponModel = m_Player.FirstChildByName("WeaponModel");
|
|
||||||
firstPersonWeaponModel["Model"]["Visible"] = true;
|
|
||||||
|
|
||||||
m_Reloading = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::playShootAnimation()
|
|
||||||
{
|
|
||||||
ComponentWrapper cAnimation = m_FirstPersonModel["Animation"];
|
|
||||||
if (cAnimation["AnimationName1"] != "ShootRifle") {
|
|
||||||
cAnimation["AnimationName1"] = "ShootRifle";
|
|
||||||
cAnimation["Weight1"] = 1.0;
|
|
||||||
cAnimation["Time1"] = 0.0;
|
|
||||||
cAnimation["Speed1"] = 1.0;
|
|
||||||
cAnimation["Loop1"] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::playIdleAnimation()
|
|
||||||
{
|
|
||||||
if (!m_FirstPersonModel.Valid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentWrapper cAnimation = m_FirstPersonModel["Animation"];
|
|
||||||
std::string& animationName1 = cAnimation["AnimationName1"];
|
|
||||||
double& animationSpeed1 = cAnimation["Speed1"];
|
|
||||||
|
|
||||||
std::string animationToPlay = "Idle";
|
|
||||||
double speedToSet = 1.0;
|
|
||||||
|
|
||||||
ComponentWrapper cPlayer = m_Player["Player"];
|
|
||||||
glm::vec3 movementDirection = cPlayer["CurrentWishDirection"];
|
|
||||||
if (glm::length2(movementDirection) > 0) {
|
|
||||||
animationToPlay = "Run";
|
|
||||||
ComponentWrapper cPhysics = m_Player["Physics"];
|
|
||||||
speedToSet = glm::length((glm::vec3)cPhysics["Velocity"]) / (float)cPlayer["MovementSpeed"];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (animationName1 != animationToPlay) {
|
|
||||||
cAnimation["AnimationName1"] = animationToPlay;
|
|
||||||
cAnimation["Weight1"] = 1.0;
|
|
||||||
cAnimation["Time1"] = 0.0;
|
|
||||||
cAnimation["Loop1"] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (animationSpeed1 != speedToSet) {
|
|
||||||
cAnimation["Speed1"] = speedToSet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::playReloadAnimation()
|
|
||||||
{
|
|
||||||
// Play animation
|
|
||||||
ComponentWrapper cAnimation = m_FirstPersonModel["Animation"];
|
|
||||||
cAnimation["AnimationName1"] = "ReloadSwitch";
|
|
||||||
cAnimation["Weight1"] = 1.0;
|
|
||||||
cAnimation["Time1"] = 0.0;
|
|
||||||
cAnimation["Speed1"] = 0.5;
|
|
||||||
cAnimation["Loop1"] = true;
|
|
||||||
|
|
||||||
// Hide weapon model and spawn the exploding version
|
|
||||||
EntityWrapper firstPersonWeaponModel = m_Player.FirstChildByName("WeaponModel");
|
|
||||||
EntityWrapper reloadSpawner = m_Player.FirstChildByName("FirstPersonReloadSpawner");
|
|
||||||
m_ReloadImpersonator = SpawnerSystem::Spawn(reloadSpawner, reloadSpawner);
|
|
||||||
firstPersonWeaponModel["Model"].Copy(m_ReloadImpersonator["Model"]);
|
|
||||||
firstPersonWeaponModel["Model"]["Visible"] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AssaultWeaponBehaviour::shoot(double damage)
|
|
||||||
{
|
|
||||||
// Only do shooting clientside
|
|
||||||
if (!IsClient) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only handle shooting for the local player
|
|
||||||
if (m_Player != LocalPlayer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure the player isn't shooting from the grave
|
|
||||||
if (!m_Player.Valid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Screen center, based on current resolution!
|
|
||||||
Rectangle screenResolution = m_Renderer->GetViewportSize();
|
|
||||||
glm::vec2 centerScreen = glm::vec2(screenResolution.Width / 2, screenResolution.Height / 2);
|
|
||||||
|
|
||||||
// Pick middle of screen
|
|
||||||
PickData pickData = m_Renderer->Pick(centerScreen);
|
|
||||||
if (pickData.Entity == EntityID_Invalid) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityWrapper victim(m_World, pickData.Entity);
|
|
||||||
|
|
||||||
// Don't let us shoot ourselves in the foot
|
|
||||||
if (victim == LocalPlayer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only care about players being hit
|
|
||||||
if (!victim.HasComponent("Player")) {
|
|
||||||
victim = victim.FirstParentWithComponent("Player");
|
|
||||||
}
|
|
||||||
if (!victim.Valid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for friendly fire
|
|
||||||
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)m_Player["Team"]["Team"]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deal damage!
|
|
||||||
Events::PlayerDamage ePlayerDamage;
|
|
||||||
ePlayerDamage.Inflictor = m_Player;
|
|
||||||
ePlayerDamage.Victim = victim;
|
|
||||||
ePlayerDamage.Damage = damage;
|
|
||||||
m_EventBroker->Publish(ePlayerDamage);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AssaultWeaponBehaviour::showHitMarker()
|
|
||||||
{
|
|
||||||
// Show hit marker
|
|
||||||
EntityWrapper hitMarkerSpawner = m_Player.FirstChildByName("HitMarkerSpawner");
|
|
||||||
if (hitMarkerSpawner.Valid()) {
|
|
||||||
SpawnerSystem::Spawn(hitMarkerSpawner, hitMarkerSpawner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "Systems/Weapon/WeaponSystem.h"
|
#include "Systems/WeaponSystem.h"
|
||||||
|
|
||||||
WeaponSystem::WeaponSystem(SystemParams params, IRenderer* renderer, Octree<EntityAABB>* collisionOctree)
|
WeaponSystem::WeaponSystem(SystemParams params, IRenderer* renderer, Octree<EntityAABB>* collisionOctree)
|
||||||
: System(params)
|
: System(params)
|
||||||
@@ -8,6 +8,7 @@ WeaponSystem::WeaponSystem(SystemParams params, IRenderer* renderer, Octree<Enti
|
|||||||
, m_CollisionOctree(collisionOctree)
|
, m_CollisionOctree(collisionOctree)
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &WeaponSystem::OnInputCommand);
|
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &WeaponSystem::OnInputCommand);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EShoot, &WeaponSystem::OnShoot);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &WeaponSystem::OnPlayerSpawned);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &WeaponSystem::OnPlayerSpawned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +25,6 @@ void WeaponSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPla
|
|||||||
selectWeapon(entity, 1);
|
selectWeapon(entity, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_EventBroker->Process<WeaponBehaviour>();
|
|
||||||
m_ActiveWeapons.at(entity)->Update(dt);
|
m_ActiveWeapons.at(entity)->Update(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,14 +59,6 @@ bool WeaponSystem::OnInputCommand(Events::InputCommand& e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reload
|
|
||||||
if (e.Command == "Reload" && e.Value != 0) {
|
|
||||||
if (m_ActiveWeapons.find(player) != m_ActiveWeapons.end()) {
|
|
||||||
auto weapon = m_ActiveWeapons.at(player);
|
|
||||||
weapon->Reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +68,7 @@ void WeaponSystem::selectWeapon(EntityWrapper player, ComponentInfo::EnumType sl
|
|||||||
if (slot == 1) {
|
if (slot == 1) {
|
||||||
// TODO: if class...
|
// TODO: if class...
|
||||||
if (m_ActiveWeapons.count(player) == 0) {
|
if (m_ActiveWeapons.count(player) == 0) {
|
||||||
m_ActiveWeapons.insert(std::make_pair(player, std::make_shared<AssaultWeaponBehaviour>(m_SystemParams, m_Renderer, m_CollisionOctree, player)));
|
m_ActiveWeapons.insert(std::make_pair(player, std::make_shared<AssaultWeaponBehaviour>(m_SystemParams, m_CollisionOctree, player)));
|
||||||
} else {
|
} else {
|
||||||
//m_ActiveWeapons.erase(player);
|
//m_ActiveWeapons.erase(player);
|
||||||
}
|
}
|
||||||
@@ -94,3 +86,52 @@ bool WeaponSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
|
|||||||
// TODO: Select the active one specified by player component
|
// TODO: Select the active one specified by player component
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WeaponSystem::OnShoot(Events::Shoot& eShoot)
|
||||||
|
{
|
||||||
|
if (!eShoot.Player.Valid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only run further picking code for the local player!
|
||||||
|
if (eShoot.Player != LocalPlayer) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Screen center, based on current resolution!
|
||||||
|
// TODO: check if player has enough ammo and if weapon has a cooldown or not
|
||||||
|
Rectangle screenResolution = m_Renderer->GetViewportSize();
|
||||||
|
glm::vec2 centerScreen = glm::vec2(screenResolution.Width / 2, screenResolution.Height / 2);
|
||||||
|
|
||||||
|
// TODO: check if player has enough ammo and if weapon has a cooldown or not
|
||||||
|
|
||||||
|
// Pick middle of screen
|
||||||
|
PickData pickData = m_Renderer->Pick(centerScreen);
|
||||||
|
if (pickData.Entity == EntityID_Invalid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityWrapper player(m_World, pickData.Entity);
|
||||||
|
|
||||||
|
// Only care about players being hit
|
||||||
|
if (!player.HasComponent("Player")) {
|
||||||
|
player = player.FirstParentWithComponent("Player");
|
||||||
|
}
|
||||||
|
if (!player.Valid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for friendly fire
|
||||||
|
EntityWrapper shooter = eShoot.Player;
|
||||||
|
if ((ComponentInfo::EnumType)player["Team"]["Team"] == (ComponentInfo::EnumType)shooter["Team"]["Team"]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Weapon damage calculations etc
|
||||||
|
Events::PlayerDamage ePlayerDamage;
|
||||||
|
ePlayerDamage.Player = player;
|
||||||
|
ePlayerDamage.Damage = 100;
|
||||||
|
m_EventBroker->Publish(ePlayerDamage);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -71,7 +71,7 @@ GameHealthSystemTest::GameHealthSystemTest()
|
|||||||
//damage player with 50
|
//damage player with 50
|
||||||
Events::PlayerDamage e;
|
Events::PlayerDamage e;
|
||||||
e.Damage = 50.0f;
|
e.Damage = 50.0f;
|
||||||
e.Victim = EntityWrapper(m_World, player.EntityID);
|
e.Player = EntityWrapper(m_World, player.EntityID);
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
|
|
||||||
//heal some other player with 40
|
//heal some other player with 40
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ MKLINK "%DeployLocation%\Schema\" "resources\Schema" /J
|
|||||||
RMDIR /S /Q "%DeployLocation%\Shaders"
|
RMDIR /S /Q "%DeployLocation%\Shaders"
|
||||||
MKLINK "%DeployLocation%\Shaders\" "resources\Shaders" /J
|
MKLINK "%DeployLocation%\Shaders\" "resources\Shaders" /J
|
||||||
:: Configuration files
|
:: Configuration files
|
||||||
DEL "%DeployLocation%\DefaultConfig.ini"
|
|
||||||
MKLINK "%DeployLocation%\DefaultConfig.ini" "resources\DefaultConfig.ini" /H
|
MKLINK "%DeployLocation%\DefaultConfig.ini" "resources\DefaultConfig.ini" /H
|
||||||
DEL "%DeployLocation%\DefaultInput.ini"
|
|
||||||
MKLINK "%DeployLocation%\DefaultInput.ini" "resources\DefaultInput.ini" /H
|
MKLINK "%DeployLocation%\DefaultInput.ini" "resources\DefaultInput.ini" /H
|
||||||
|
|
||||||
:: Platform specific binaries
|
:: Platform specific binaries
|
||||||
|
|||||||
Reference in New Issue
Block a user