Merge branch 'master' of https://github.com/teamfisk/TacticalZ into Importer
This commit is contained in:
+1
-1
Submodule deps updated: bf83f099ba...ed45883a44
@@ -20,6 +20,9 @@
|
||||
class World;
|
||||
struct ComponentWrapper;
|
||||
|
||||
template<typename T>
|
||||
class Octree;
|
||||
|
||||
namespace Collision
|
||||
{
|
||||
//Return true if the ray hits the box.
|
||||
@@ -44,21 +47,24 @@ bool RayVsTriangle(const Ray& ray,
|
||||
float& outVCoord,
|
||||
bool trueOnNegativeDistance = false);
|
||||
//Return true if the ray hits any of the triangles in the model. Stops checking when a hit is detected.
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<RawModel::Vertex>& modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices);
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix);
|
||||
//Return true if the ray hits any of the triangles in the model.
|
||||
//Also returns the position of the intersection point. Will loop through all the whole model indices.
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<RawModel::Vertex>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& outHitPosition);
|
||||
//Return true if the ray hits any of the triangles in the model.
|
||||
//Also returns the distance from the ray origin to the closest
|
||||
//intersection point, and the barycentric u,v-coordinates. Will loop through all the whole model indices.
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<RawModel::Vertex>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
float& outDistance,
|
||||
float& outUCoord,
|
||||
float& outVCoord);
|
||||
@@ -81,6 +87,13 @@ bool AABBVsAABB(const AABB& a, const AABB& b, glm::vec3& minimumTranslation);
|
||||
// Calculates an absolute AABB from an entity AABB component
|
||||
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox = false);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
class CollisionSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
CollisionSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree)
|
||||
: System(world, eventBroker)
|
||||
CollisionSystem(SystemParams params, Octree<EntityAABB>* octree)
|
||||
: System(params)
|
||||
, PureSystem("Collidable")
|
||||
, m_Octree(octree)
|
||||
{ }
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
class FillFrustumOctreeSystem : public ImpureSystem, public PureSystem
|
||||
{
|
||||
public:
|
||||
FillFrustumOctreeSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree)
|
||||
: System(world, eventBroker)
|
||||
FillFrustumOctreeSystem(SystemParams params, Octree<EntityAABB>* octree)
|
||||
: System(params)
|
||||
, PureSystem("Model")
|
||||
, m_Octree(octree)
|
||||
{ }
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
class FillOctreeSystem : public ImpureSystem, public PureSystem
|
||||
{
|
||||
public:
|
||||
FillOctreeSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree, const std::string& fillComponentType)
|
||||
: System(world, eventBroker)
|
||||
FillOctreeSystem(SystemParams params, Octree<EntityAABB>* octree, const std::string& fillComponentType)
|
||||
: System(params)
|
||||
, PureSystem(fillComponentType)
|
||||
, m_Octree(octree)
|
||||
{ }
|
||||
|
||||
@@ -15,8 +15,8 @@ class AABB;
|
||||
class TriggerSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
TriggerSystem(World* world, EventBroker* eventBroker, Octree<EntityAABB>* octree)
|
||||
: System(world, eventBroker)
|
||||
TriggerSystem(SystemParams params, Octree<EntityAABB>* octree)
|
||||
: System(params)
|
||||
, PureSystem("Trigger")
|
||||
, m_Octree(octree)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ struct ComponentInfo
|
||||
unsigned int Allocation = 0;
|
||||
std::map<std::string, std::string> FieldAnnotations;
|
||||
std::map<std::string, std::map<std::string, EnumType>> FieldEnumDefinitions;
|
||||
bool NetworkReplicated = true;
|
||||
};
|
||||
|
||||
struct Field_t
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef ComponentWrapper_h__
|
||||
#define ComponentWrapper_h__
|
||||
|
||||
#include <boost/shared_array.hpp>
|
||||
#include "../Common.h"
|
||||
#include "Entity.h"
|
||||
#include "ComponentInfo.h"
|
||||
@@ -81,6 +82,18 @@ struct ComponentWrapper
|
||||
SubscriptProxy operator[](std::string propertyName) { return SubscriptProxy(this, propertyName); }
|
||||
};
|
||||
|
||||
// A component wrapper that "owns" its data through a shared pointer
|
||||
struct SharedComponentWrapper : ComponentWrapper
|
||||
{
|
||||
SharedComponentWrapper(const ComponentInfo& componentInfo, boost::shared_array<char> data)
|
||||
: ComponentWrapper(componentInfo, data.get())
|
||||
, m_DataReference(data)
|
||||
{ }
|
||||
|
||||
private:
|
||||
boost::shared_array<char> m_DataReference;
|
||||
};
|
||||
|
||||
// TODO: Move this to Tests once entity importing is finished
|
||||
class ComponentWrapperFactory
|
||||
{
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <xercesc/framework/psvi/XSElementDeclaration.hpp>
|
||||
#include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp>
|
||||
#include <xercesc/framework/psvi/XSAttributeUse.hpp>
|
||||
#include <xercesc/framework/psvi/XSAttributeDeclaration.hpp>
|
||||
#include <xercesc/framework/psvi/XSParticle.hpp>
|
||||
#include <xercesc/framework/psvi/XSModelGroup.hpp>
|
||||
#include <xercesc/framework/psvi/XSModelGroupDefinition.hpp>
|
||||
|
||||
@@ -30,7 +30,7 @@ struct EntityWrapper
|
||||
EntityWrapper FirstChildByName(const std::string& name);
|
||||
EntityWrapper FirstParentWithComponent(const std::string& componentType);
|
||||
bool IsChildOf(EntityWrapper potentialParent);
|
||||
bool Valid();
|
||||
bool Valid() const;
|
||||
|
||||
ComponentWrapper operator[](const char* componentName);
|
||||
bool operator==(const EntityWrapper& e) const;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <tuple>
|
||||
#include <set>
|
||||
|
||||
#include "../Common.h"
|
||||
#include "Event.h"
|
||||
@@ -107,7 +108,7 @@ private:
|
||||
typedef std::unordered_map<ContextTypeName_t, EventRelays_t> ContextRelays_t;
|
||||
ContextRelays_t m_ContextRelays;
|
||||
std::vector<BaseEventRelay*> m_RelaysToSubscribe;
|
||||
std::vector<std::tuple<EventID, ContextTypeName_t, EventTypeName_t>> m_RelaysToUnsubscribe;
|
||||
std::unordered_map<BaseEventRelay*, std::tuple<EventID, ContextTypeName_t, EventTypeName_t>> m_RelaysToUnsubscribe;
|
||||
|
||||
typedef std::list<std::pair<EventTypeName_t, std::shared_ptr<Event>>> EventQueue_t;
|
||||
std::shared_ptr<EventQueue_t> m_EventQueueRead;
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
#include "../Common.h"
|
||||
#include "AABB.h"
|
||||
#include "Frustum.h"
|
||||
|
||||
//Fwd declarations.
|
||||
class Ray;
|
||||
#include "Ray.h"
|
||||
|
||||
namespace OctSpace
|
||||
{
|
||||
@@ -43,6 +41,8 @@ public:
|
||||
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects);
|
||||
//Get the objects that are inside the frustum, the objects are put in 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.
|
||||
void ClearObjects();
|
||||
//Empty the tree of all dynamic objects. Static objects remain in the tree.
|
||||
@@ -102,6 +102,8 @@ struct Child
|
||||
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects) const;
|
||||
template<typename T>
|
||||
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 ClearDynamicObjects();
|
||||
bool RayCollides(const Ray& ray, Output& data) const;
|
||||
@@ -121,6 +123,15 @@ struct Child
|
||||
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>
|
||||
@@ -166,6 +177,13 @@ void Octree<T>::ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObje
|
||||
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>
|
||||
void Octree<T>::ClearObjects()
|
||||
{
|
||||
@@ -284,4 +302,59 @@ 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
|
||||
@@ -5,21 +5,55 @@
|
||||
#include "World.h"
|
||||
#include "EntityWrapper.h"
|
||||
#include "ComponentWrapper.h"
|
||||
#include "EPlayerSpawned.h"
|
||||
|
||||
struct SystemParams
|
||||
{
|
||||
SystemParams(::World* World, ::EventBroker* EventBroker, bool IsClient, bool IsServer)
|
||||
: World(World)
|
||||
, EventBroker(EventBroker)
|
||||
, IsClient(IsClient)
|
||||
, IsServer(IsServer)
|
||||
{ }
|
||||
|
||||
::World* World;
|
||||
::EventBroker* EventBroker;
|
||||
bool IsClient = false;
|
||||
bool IsServer = false;
|
||||
};
|
||||
|
||||
class System
|
||||
{
|
||||
friend class SystemPipeline;
|
||||
|
||||
protected:
|
||||
System(World* world, EventBroker) { }
|
||||
System(World* world, EventBroker* eventBroker)
|
||||
: m_World(world)
|
||||
, m_EventBroker(eventBroker)
|
||||
{ }
|
||||
System(SystemParams params)
|
||||
: m_World(params.World)
|
||||
, m_EventBroker(params.EventBroker)
|
||||
, IsClient(params.IsClient)
|
||||
, IsServer(params.IsServer)
|
||||
{
|
||||
if (IsClient) {
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &System::setLocalPlayer);
|
||||
}
|
||||
}
|
||||
virtual ~System() = default;
|
||||
|
||||
World* m_World;
|
||||
EventBroker* m_EventBroker;
|
||||
bool IsClient = false;
|
||||
bool IsServer = false;
|
||||
EntityWrapper LocalPlayer = EntityWrapper::Invalid;
|
||||
|
||||
private:
|
||||
EventRelay<System, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||
virtual bool setLocalPlayer(Events::PlayerSpawned& e)
|
||||
{
|
||||
if (e.PlayerID == -1) {
|
||||
LocalPlayer = e.Player;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class PureSystem : public virtual System
|
||||
@@ -34,7 +68,7 @@ protected:
|
||||
|
||||
const std::string m_ComponentType;
|
||||
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cComponent, double dt) = 0;
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPlayer, double dt) = 0;
|
||||
};
|
||||
|
||||
class ImpureSystem : public virtual System
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
class SystemPipeline
|
||||
{
|
||||
public:
|
||||
SystemPipeline(World* world, EventBroker* eventBroker)
|
||||
SystemPipeline(World* world, EventBroker* eventBroker, bool isClient, bool isServer)
|
||||
: m_World(world)
|
||||
, m_EventBroker(eventBroker)
|
||||
, m_IsClient(isClient)
|
||||
, m_IsServer(isServer)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPause, &SystemPipeline::OnPause);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EResume, &SystemPipeline::OnResume);
|
||||
@@ -35,7 +37,7 @@ public:
|
||||
m_OrderedSystemGroups.resize(updateOrderLevel + 1);
|
||||
}
|
||||
UnorderedSystems& group = m_OrderedSystemGroups[updateOrderLevel];
|
||||
System* system = new T(m_World, m_EventBroker, args...);
|
||||
System* system = new T(SystemParams(m_World, m_EventBroker, m_IsClient, m_IsServer), args...);
|
||||
group.Systems[typeid(T).name()] = system;
|
||||
|
||||
PureSystem* pureSystem = dynamic_cast<PureSystem*>(system);
|
||||
@@ -59,6 +61,9 @@ public:
|
||||
dt = 0.0;
|
||||
}
|
||||
|
||||
// Process utility events for the System base class
|
||||
m_EventBroker->Process<System>();
|
||||
|
||||
for (UnorderedSystems& group : m_OrderedSystemGroups) {
|
||||
// Process events
|
||||
for (auto& pair : group.Systems) {
|
||||
@@ -88,6 +93,8 @@ public:
|
||||
private:
|
||||
World* m_World;
|
||||
EventBroker* m_EventBroker;
|
||||
bool m_IsClient = false;
|
||||
bool m_IsServer = false;
|
||||
bool m_Paused = false;
|
||||
|
||||
struct UnorderedSystems
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class UniformScaleSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
UniformScaleSystem(World* world, EventBroker* eventBroker);
|
||||
UniformScaleSystem(SystemParams params);
|
||||
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cUniformScale, double dt) override;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
class EditorRenderSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
EditorRenderSystem(World* world, EventBroker* eventBroker, IRenderer* renderer, RenderFrame* renderFrame);
|
||||
EditorRenderSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame);
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
class EditorSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
EditorSystem(World* world, EventBroker* eventBroker, IRenderer* renderer, RenderFrame* renderFrame);
|
||||
EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame);
|
||||
~EditorSystem();
|
||||
|
||||
void Update(double dt);
|
||||
|
||||
@@ -25,7 +25,7 @@ struct WidgetDelta : Event
|
||||
class EditorWidgetSystem : public ImpureSystem, PureSystem
|
||||
{
|
||||
public:
|
||||
EditorWidgetSystem(World* world, EventBroker* eventBroker, IRenderer* renderer);
|
||||
EditorWidgetSystem(SystemParams params, IRenderer* renderer);
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cEditorWidget, double dt) override;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "Frame.h"
|
||||
#include "../Rendering/Texture.h"
|
||||
#include "../Rendering/Util/CommonFunctions.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
@@ -55,10 +56,10 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
m_Texture = ResourceManager::Load<Texture>(resourceName);
|
||||
m_Texture = CommonFunctions::LoadTexture(resourceName, false);
|
||||
m_TextureName = resourceName;
|
||||
if (m_Texture == nullptr) {
|
||||
m_Texture = ResourceManager::Load<Texture>("Textures/Core/ErrorTexture.png");
|
||||
m_Texture = CommonFunctions::LoadTexture("Textures/Core/ErrorTexture.png", false);
|
||||
}
|
||||
|
||||
SizeToTexture();
|
||||
|
||||
@@ -55,6 +55,7 @@ protected:
|
||||
//specialabilitys
|
||||
bool m_MovementKeyDown = false;
|
||||
bool m_SpecialAbilityKeyDown = false;
|
||||
int m_NumberOfMovementKeysDown = 0;
|
||||
|
||||
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
|
||||
bool OnLockMouse(const Events::LockMouse& e);
|
||||
@@ -132,6 +133,7 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
|
||||
}
|
||||
//if value = 0 then you have just released this key
|
||||
if (e.Value != 0) {
|
||||
m_NumberOfMovementKeysDown++;
|
||||
m_MovementKeyDown = true;
|
||||
//if you pressed the same key within m_AssaultDashDoubleTapSensitivityTimer then you have doubletapped it
|
||||
if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == m_CurrentDirectionVector) {
|
||||
@@ -139,10 +141,14 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
|
||||
}
|
||||
} else {
|
||||
//== 0
|
||||
m_MovementKeyDown = false;
|
||||
//you have just released the key, store what key it was and reset the doubletap-sensitivity-timer
|
||||
m_AssaultDashTapDirection = m_CurrentDirectionVector;
|
||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||
m_NumberOfMovementKeysDown--;
|
||||
if (m_NumberOfMovementKeysDown == 0) {
|
||||
m_MovementKeyDown = false;
|
||||
}
|
||||
//you have just released the key, store what key it was and reset the doubletap-sensitivity-timer
|
||||
m_AssaultDashTapDirection = m_CurrentDirectionVector;
|
||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,12 +208,6 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||
m_AssaultDashDoubleTapped = true;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -216,6 +216,11 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
||||
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
|
||||
if (!m_ValidDoubleTap) {
|
||||
return;
|
||||
|
||||
@@ -20,16 +20,22 @@
|
||||
#include "Input/EInputCommand.h"
|
||||
#include "Core/EPlayerDamage.h"
|
||||
#include "Network/EInterpolate.h"
|
||||
#include "Network/SnapshotFilter.h"
|
||||
#include "Core/EPlayerSpawned.h"
|
||||
|
||||
class Client : public Network
|
||||
{
|
||||
public:
|
||||
Client(ConfigFile* config);
|
||||
Client(World* world, EventBroker* eventBroker);
|
||||
Client(World* world, EventBroker* eventBroker, std::unique_ptr<SnapshotFilter> snapshotFilter);
|
||||
~Client();
|
||||
void Start(World* world, EventBroker* eventBroker) override;
|
||||
|
||||
void Connect(std::string address, int port);
|
||||
void Update() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<SnapshotFilter> m_SnapshotFilter = nullptr;
|
||||
|
||||
// Assio UDP logic
|
||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||
boost::asio::io_service m_IOService;
|
||||
@@ -45,10 +51,8 @@ private:
|
||||
PacketID m_SendPacketID = 0;
|
||||
|
||||
// Game logic
|
||||
World* m_World;
|
||||
std::string m_PlayerName;
|
||||
PlayerID m_PlayerID = -1;
|
||||
EntityID m_ServerEntityID = std::numeric_limits<EntityID>::max();
|
||||
bool m_IsConnected = false;
|
||||
EntityWrapper m_LocalPlayer = EntityWrapper::Invalid;
|
||||
// Server Client Lookup map
|
||||
@@ -74,7 +78,9 @@ private:
|
||||
void connect();
|
||||
void disconnect();
|
||||
void parseMessageType(Packet& packet);
|
||||
void updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID, const std::string& componentType);
|
||||
void updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID);
|
||||
SharedComponentWrapper createSharedComponent(Packet& packet, EntityID entityID, const ComponentInfo& componentInfo);
|
||||
void ignoreFields(Packet& packet, const ComponentInfo& componentInfo);
|
||||
void parseConnect(Packet& packet);
|
||||
void parsePlayerConnected(Packet& packet);
|
||||
void parsePing();
|
||||
@@ -99,7 +105,6 @@ private:
|
||||
void deleteFromServerClientMaps(EntityID serverEntityID, EntityID clientEntityID);
|
||||
|
||||
// Events
|
||||
EventBroker* m_EventBroker;
|
||||
EventRelay<Client, Events::InputCommand> m_EInputCommand;
|
||||
bool OnInputCommand(const Events::InputCommand& e);
|
||||
EventRelay<Client, Events::PlayerDamage> m_EPlayerDamage;
|
||||
|
||||
@@ -11,8 +11,13 @@ namespace Events
|
||||
|
||||
struct Interpolate : Event
|
||||
{
|
||||
EntityID Entity;
|
||||
boost::shared_array<char> DataArray;
|
||||
Interpolate(EntityWrapper Entity, SharedComponentWrapper Component)
|
||||
: Entity(Entity)
|
||||
, Component(Component)
|
||||
{ }
|
||||
|
||||
EntityWrapper Entity;
|
||||
SharedComponentWrapper Component;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -19,10 +19,15 @@ typedef unsigned int PacketID;
|
||||
class Network
|
||||
{
|
||||
public:
|
||||
Network(World* world, EventBroker* eventBroker);
|
||||
virtual ~Network() { };
|
||||
virtual void Start(World* m_world, EventBroker *eventBroker) = 0;
|
||||
|
||||
virtual void Update() = 0;
|
||||
|
||||
protected:
|
||||
World* m_World;
|
||||
EventBroker* m_EventBroker;
|
||||
|
||||
// For Debug
|
||||
bool isReadingData = false;
|
||||
NetworkData m_NetworkData;
|
||||
@@ -32,7 +37,6 @@ protected:
|
||||
double m_TimeoutMs;
|
||||
void saveToFile();
|
||||
void updateNetworkData();
|
||||
void initialize();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -22,15 +22,17 @@
|
||||
class Server : public Network
|
||||
{
|
||||
public:
|
||||
Server();
|
||||
Server(World* world, EventBroker* eventBroker, int port);
|
||||
~Server();
|
||||
void Start(World* m_world, EventBroker *eventBroker) override;
|
||||
|
||||
void Update() override;
|
||||
|
||||
private:
|
||||
int m_Port = 27666;
|
||||
// UDP logic
|
||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||
boost::asio::io_service m_IOService;
|
||||
boost::asio::ip::udp::socket m_Socket;
|
||||
std::unique_ptr<boost::asio::ip::udp::socket> m_Socket;
|
||||
|
||||
// Sending messages to client logic
|
||||
std::map<PlayerID, PlayerDefinition> m_ConnectedPlayers;
|
||||
@@ -46,13 +48,10 @@ private:
|
||||
float snapshotInterval;
|
||||
int checkTimeOutInterval = 100;
|
||||
int m_NextPlayerID = 0;
|
||||
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
||||
|
||||
//Timers
|
||||
std::clock_t m_StartPingTime;
|
||||
|
||||
// Game logic
|
||||
World* m_World;
|
||||
EventBroker* m_EventBroker;
|
||||
|
||||
// Packet loss logic
|
||||
PacketID m_PacketID = 0;
|
||||
@@ -66,6 +65,7 @@ private:
|
||||
void broadcast(Packet& packet);
|
||||
void sendSnapshot();
|
||||
void addChildrenToPacket(Packet& packet, EntityID entityID);
|
||||
void addInputCommandsToPacket(Packet& packet);
|
||||
void sendPing();
|
||||
void checkForTimeOuts();
|
||||
void disconnect(PlayerID playerID);
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef SnapshotFilter_h__
|
||||
#define SnapshotFilter_h__
|
||||
|
||||
#include "../Core/EntityWrapper.h"
|
||||
#include "../Core/ComponentWrapper.h"
|
||||
|
||||
class SnapshotFilter
|
||||
{
|
||||
public:
|
||||
// Filters an incoming snapshot.
|
||||
// Modify the component and return true if the component snapshot should be applied.
|
||||
// Otherwise return false and it will be ignored.
|
||||
virtual bool FilterComponent(EntityWrapper entity, SharedComponentWrapper& component)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -14,8 +14,8 @@
|
||||
class AnimationSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
AnimationSystem(World* world, EventBroker* eventBroker)
|
||||
: System(world, eventBroker)
|
||||
AnimationSystem(SystemParams params)
|
||||
: System(params)
|
||||
, PureSystem("Animation")
|
||||
{
|
||||
|
||||
@@ -23,9 +23,7 @@ public:
|
||||
~AnimationSystem() { }
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& animationComponent, double dt) override;
|
||||
private:
|
||||
float angle = 0.f;
|
||||
bool b_forward = false;
|
||||
char bone[100];
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -13,8 +13,8 @@
|
||||
class BoneAttachmentSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
BoneAttachmentSystem(World* world, EventBroker* eventBroker)
|
||||
: System(world, eventBroker)
|
||||
BoneAttachmentSystem(SystemParams params)
|
||||
: System(params)
|
||||
, PureSystem("BoneAttachment")
|
||||
{
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ public:
|
||||
glm::mat4 ViewMatrix() const { return m_ViewMatrix; }
|
||||
void SetViewMatrix(glm::mat4 val);
|
||||
|
||||
glm::mat4 BillboardMatrix();
|
||||
|
||||
float AspectRatio() const { return m_AspectRatio; }
|
||||
void SetAspectRatio(float val);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "FrameBuffer.h"
|
||||
#include "ShaderProgram.h"
|
||||
#include "Util/UnorderedMapVec2.h"
|
||||
#include "Util/CommonFunctions.h"
|
||||
#include "Texture.h"
|
||||
|
||||
class DrawFinalPass
|
||||
@@ -35,6 +36,7 @@ private:
|
||||
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
|
||||
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps) const;
|
||||
|
||||
void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene);
|
||||
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||
void DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||
void DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||
@@ -50,6 +52,7 @@ private:
|
||||
Texture* m_BlackTexture;
|
||||
Texture* m_NeutralNormalTexture;
|
||||
Texture* m_GreyTexture;
|
||||
Texture* m_ErrorTexture;
|
||||
|
||||
FrameBuffer m_FinalPassFrameBuffer;
|
||||
FrameBuffer m_FinalPassFrameBufferLowRes;
|
||||
@@ -69,6 +72,7 @@ private:
|
||||
ShaderProgram* m_ForwardPlusProgram;
|
||||
ShaderProgram* m_ExplosionEffectProgram;
|
||||
ShaderProgram* m_ExplosionEffectSplatMapProgram;
|
||||
ShaderProgram* m_SpriteProgram;
|
||||
ShaderProgram* m_ForwardPlusSplatMapProgram;
|
||||
ShaderProgram* m_ShieldToStencilProgram;
|
||||
ShaderProgram* m_FillDepthBufferProgram;
|
||||
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
virtual void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
|
||||
bool VSYNC() const { return m_VSYNC; }
|
||||
virtual void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
|
||||
std::string WindowTitle() const { return m_WindowTitle; }
|
||||
virtual void SetWindowTitle(const std::string& title) { glfwSetWindowTitle(m_Window, title.c_str()); m_WindowTitle = title; }
|
||||
//Returns screen size excluding window border and header
|
||||
Rectangle GetViewportSize() const { return m_ViewportSize; }
|
||||
virtual void Initialize() = 0;
|
||||
@@ -47,6 +49,7 @@ protected:
|
||||
int m_GLVersion[2];
|
||||
std::string m_GLVendor;
|
||||
GLFWwindow* m_Window = nullptr;
|
||||
std::string m_WindowTitle;
|
||||
};
|
||||
|
||||
#endif // Renderer_h__
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define Model_h__
|
||||
|
||||
#include "Rendering/RawModelCustom.h"
|
||||
#include "Util/CommonFunctions.h"
|
||||
//#include "Rendering/RawModelAssimp.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "Core/AABB.h"
|
||||
|
||||
@@ -117,33 +117,11 @@ struct ModelJob : RenderJob
|
||||
FillColor = fillColor;
|
||||
FillPercentage = fillPercentage;
|
||||
|
||||
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;
|
||||
}
|
||||
if (model->IsSkinned()) {
|
||||
Skeleton = Model->m_RawModel->m_Skeleton;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
unsigned int TextureID;
|
||||
@@ -164,10 +142,8 @@ struct ModelJob : RenderJob
|
||||
::Skeleton* Skeleton = nullptr;
|
||||
// const ::Skeleton::Animation* Animation = nullptr;
|
||||
|
||||
std::vector<::Skeleton::AnimationData> Animations;
|
||||
::Skeleton::AnimationOffset AnimationOffset;
|
||||
|
||||
|
||||
float AnimationTime = 0.f;
|
||||
|
||||
glm::vec4 DiffuseColor;
|
||||
glm::vec4 SpecularColor;
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
#include <png.h>
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
#include "Image.h"
|
||||
|
||||
class PNG : public Image
|
||||
class PNG : public Image, public Resource
|
||||
{
|
||||
public:
|
||||
PNG(std::string path);
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
struct TextureProperties {
|
||||
std::string TexturePath;
|
||||
glm::vec2 UVRepeat;
|
||||
std::shared_ptr<::Texture> Texture;
|
||||
Texture* Texture;
|
||||
};
|
||||
|
||||
struct MaterialBasic
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "PointLightJob.h"
|
||||
#include "DirectionalLightJob.h"
|
||||
#include "ExplosionEffectJob.h"
|
||||
#include "SpriteJob.h"
|
||||
|
||||
struct RenderScene
|
||||
{
|
||||
@@ -25,6 +26,7 @@ struct RenderScene
|
||||
std::list<std::shared_ptr<RenderJob>> OpaqueShieldedObjects;
|
||||
std::list<std::shared_ptr<RenderJob>> TransparentShieldedObjects;
|
||||
std::list<std::shared_ptr<RenderJob>> ShieldObjects;
|
||||
std::list<std::shared_ptr<RenderJob>> SpriteJob;
|
||||
std::list<std::shared_ptr<RenderJob>> PointLight;
|
||||
std::list<std::shared_ptr<RenderJob>> Text;
|
||||
std::list<std::shared_ptr<RenderJob>> DirectionalLight;
|
||||
@@ -41,7 +43,7 @@ struct RenderScene
|
||||
Jobs.OpaqueShieldedObjects.clear();
|
||||
Jobs.TransparentShieldedObjects.clear();
|
||||
Jobs.ShieldObjects.clear();
|
||||
Jobs.Text.clear();
|
||||
Jobs.SpriteJob.clear();
|
||||
Jobs.DirectionalLight.clear();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
class RenderSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
RenderSystem(World* world, EventBroker* eventBrokerer, const IRenderer* renderer, RenderFrame* renderFrame, Octree<EntityAABB>* frustumCullOctree);
|
||||
RenderSystem(SystemParams params, const IRenderer* renderer, RenderFrame* renderFrame, Octree<EntityAABB>* frustumCullOctree);
|
||||
~RenderSystem();
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
@@ -31,7 +31,6 @@ private:
|
||||
const IRenderer* m_Renderer;
|
||||
RenderFrame* m_RenderFrame;
|
||||
Camera* m_Camera;
|
||||
World* m_World;
|
||||
EntityWrapper m_CurrentCamera = EntityWrapper::Invalid;
|
||||
EntityWrapper m_LocalPlayer = EntityWrapper::Invalid;
|
||||
Octree<EntityAABB>* m_Octree;
|
||||
@@ -48,6 +47,7 @@ private:
|
||||
void fillPointLights(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 fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||
bool isChildOfACamera(EntityWrapper entity);
|
||||
bool isChildOfCurrentCamera(EntityWrapper entity);
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "../Core/Transform.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "TextPass.h"
|
||||
#include "Util/CommonFunctions.h"
|
||||
|
||||
class Renderer : public IRenderer
|
||||
{
|
||||
|
||||
@@ -100,13 +100,13 @@ public:
|
||||
|
||||
int GetBoneID(std::string name);
|
||||
|
||||
const Animation* GetAnimation(std::string name);
|
||||
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, bool noRootMotion = false);
|
||||
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion = false);
|
||||
void CalculateFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion = false);
|
||||
void CalculateFrameBones(std::vector<AnimationData> animations, bool noRootMotion = false);
|
||||
|
||||
//void AccumulateBoneTransforms(bool noRootMotion, const Animation* animation, float time, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix);
|
||||
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix);
|
||||
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, std::map<int, glm::mat4>& boneMatrices, const Bone* bone, glm::mat4 parentMatrix);
|
||||
const Animation* GetAnimation(std::string name);
|
||||
|
||||
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, 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(const Bone* parent, int depthCount);
|
||||
@@ -115,12 +115,35 @@ public:
|
||||
glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix);
|
||||
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:
|
||||
|
||||
glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset);
|
||||
|
||||
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
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef SpriteJob_h__
|
||||
#define SpriteJob_h__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../GLM.h"
|
||||
#include "../Core/ComponentWrapper.h"
|
||||
#include "Texture.h"
|
||||
#include "Model.h"
|
||||
#include "RenderJob.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
#include "Camera.h"
|
||||
#include "../Core/World.h"
|
||||
#include "../Core/Transform.h"
|
||||
#include "Skeleton.h"
|
||||
|
||||
struct SpriteJob : RenderJob
|
||||
{
|
||||
SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted)
|
||||
: RenderJob()
|
||||
{
|
||||
Model = ResourceManager::Load<::Model>("Models/Core/UnitQuad.mesh");
|
||||
::RawModel::MaterialProperties matProp = Model->MaterialGroups().front();
|
||||
TextureID = 0;
|
||||
|
||||
DiffuseTexture = CommonFunctions::LoadTexture(cSprite["DiffuseTexture"], true);
|
||||
|
||||
IncandescenceTexture = CommonFunctions::LoadTexture(cSprite["GlowMap"], true);
|
||||
|
||||
StartIndex = matProp.material->StartIndex;
|
||||
EndIndex = matProp.material->EndIndex;
|
||||
Matrix = matrix;
|
||||
Color = cSprite["Color"];
|
||||
Entity = cSprite.EntityID;
|
||||
Position = Transform::AbsolutePosition(world, cSprite.EntityID);
|
||||
Depth = 0;
|
||||
if (depthSorted) {
|
||||
glm::vec3 viewpos = glm::vec3(camera->ViewMatrix() * glm::vec4(Position, 1));
|
||||
Depth = viewpos.z;
|
||||
}
|
||||
World = world;
|
||||
|
||||
FillColor = fillColor;
|
||||
FillPercentage = fillPercentage;
|
||||
};
|
||||
|
||||
unsigned int TextureID;
|
||||
|
||||
EntityID Entity;
|
||||
glm::mat4 Matrix;
|
||||
const Texture* DiffuseTexture;
|
||||
const Texture* NormalTexture;
|
||||
const Texture* SpecularTexture;
|
||||
const Texture* IncandescenceTexture;
|
||||
float Shininess = 0.f;
|
||||
glm::vec4 Color;
|
||||
glm::vec3 Position;
|
||||
const ::Model* Model = nullptr;
|
||||
unsigned int StartIndex = 0;
|
||||
unsigned int EndIndex = 0;
|
||||
World* World;
|
||||
|
||||
glm::vec4 FillColor = glm::vec4(0);
|
||||
float FillPercentage = 0.0;
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
Hash = TextureID;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,14 +4,11 @@
|
||||
#include "../../Common.h"
|
||||
#include "../../OpenGL.h"
|
||||
#include "../../GLM.h"
|
||||
#include "../Texture.h"
|
||||
|
||||
class CommonFuntions
|
||||
{
|
||||
public:
|
||||
CommonFuntions() = delete;
|
||||
|
||||
private:
|
||||
|
||||
namespace CommonFunctions
|
||||
{
|
||||
Texture* LoadTexture(std::string path, bool threaded);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,24 +0,0 @@
|
||||
#include "Common.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
class ExplosionEffectSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
ExplosionEffectSystem(World* world, EventBroker* eventBroker)
|
||||
: System(world, eventBroker)
|
||||
, PureSystem("ExplosionEffect")
|
||||
{ }
|
||||
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override
|
||||
{
|
||||
|
||||
if ((double)component["TimeSinceDeath"] > (double)component["ExplosionDuration"]) {
|
||||
(double)component["TimeSinceDeath"] = 0.f;
|
||||
}
|
||||
(double&)component["TimeSinceDeath"] += dt;
|
||||
|
||||
//if ((bool)Component["Gravity"] == true) {
|
||||
// (bool)Component["ExponentialAccelaration"] = false;
|
||||
//}
|
||||
}
|
||||
};
|
||||
+12
-17
@@ -1,6 +1,8 @@
|
||||
#ifndef Game_h__
|
||||
#define Game_h__
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include "Core/ResourceManager.h"
|
||||
#include "Core/ConfigFile.h"
|
||||
#include "Core/EventBroker.h"
|
||||
@@ -14,7 +16,7 @@
|
||||
#include "Core/EKeyDown.h"
|
||||
#include "Core/EntityFilePreprocessor.h"
|
||||
#include "Core/SystemPipeline.h"
|
||||
#include "ExplosionEffectSystem.h"
|
||||
#include "Systems/ExplosionEffectSystem.h"
|
||||
#include "Editor/EditorSystem.h"
|
||||
#include "Core/EntityFile.h"
|
||||
#include "Rendering/RenderSystem.h"
|
||||
@@ -43,7 +45,9 @@ public:
|
||||
void Tick();
|
||||
|
||||
private:
|
||||
double m_LastTime;
|
||||
std::string m_NetworkAddress;
|
||||
int m_NetworkPort = 0;
|
||||
|
||||
ConfigFile* m_Config = nullptr;
|
||||
EventBroker* m_EventBroker;
|
||||
IRenderer* m_Renderer;
|
||||
@@ -56,24 +60,15 @@ private:
|
||||
Octree<EntityAABB>* m_OctreeFrustrumCulling;
|
||||
SystemPipeline* m_SystemPipeline;
|
||||
RenderFrame* m_RenderFrame;
|
||||
// Network variables
|
||||
boost::thread m_NetworkThread;
|
||||
|
||||
// Network methods
|
||||
void networkFunction();
|
||||
Network* m_ClientOrServer;
|
||||
bool m_IsClientOrServer = false;
|
||||
|
||||
// Sound
|
||||
Client* m_NetworkClient = nullptr;
|
||||
Server* m_NetworkServer = nullptr;
|
||||
SoundManager* m_SoundManager;
|
||||
double m_LastTime;
|
||||
|
||||
//EventRelay<Game, Events::InputCommand> m_EInputCommand;
|
||||
//bool debugOnInputCommand(const Events::InputCommand& e);
|
||||
|
||||
void debugInitialize();
|
||||
void debugTick(double dt);
|
||||
EventRelay<Client, Events::KeyDown> m_EKeyDown;
|
||||
bool m_IsClient = false;
|
||||
bool m_IsServer = false;
|
||||
|
||||
int parseArgs(int argc, char* argv[]);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef MultiplayerSnapshotFilter_h__
|
||||
#define MultiplayerSnapshotFilter_h__
|
||||
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Core/EPlayerSpawned.h"
|
||||
#include "Network/SnapshotFilter.h"
|
||||
#include "Network/EInterpolate.h"
|
||||
|
||||
class MultiplayerSnapshotFilter : public SnapshotFilter
|
||||
{
|
||||
public:
|
||||
MultiplayerSnapshotFilter(EventBroker* eventBroker);
|
||||
|
||||
virtual bool FilterComponent(EntityWrapper entity, SharedComponentWrapper& component) override;
|
||||
|
||||
private:
|
||||
EventBroker* m_EventBroker;
|
||||
|
||||
EntityWrapper m_LocalPlayer = EntityWrapper::Invalid;
|
||||
|
||||
EventRelay<MultiplayerSnapshotFilter, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||
bool OnPlayerSpawned(Events::PlayerSpawned ePlayerSpawned);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef CapturePointHUDSystem_h__
|
||||
#define CapturePointHUDSystem_h__
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <glm/common.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Core/System.h"
|
||||
#include "Engine/Collision/ETrigger.h"
|
||||
|
||||
class CapturePointHUDSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
CapturePointHUDSystem(SystemParams params);
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -17,7 +17,7 @@ class CapturePointSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
//WARNING: on new map, destroy all info in the vectors, as well as reset all variables (just make new?)
|
||||
CapturePointSystem(World* world, EventBroker* eventBroker);
|
||||
CapturePointSystem(SystemParams params);
|
||||
|
||||
//updatecomponent
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef ExplosionEffectSystem_h__
|
||||
#define ExplosionEffectSystem_h__
|
||||
|
||||
#include "Common.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
class ExplosionEffectSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
ExplosionEffectSystem(SystemParams params)
|
||||
: System(params)
|
||||
, PureSystem("ExplosionEffect")
|
||||
{ }
|
||||
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -17,7 +17,7 @@
|
||||
class HealthSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
HealthSystem(World* world, EventBroker* eventBroker);
|
||||
HealthSystem(SystemParams params);
|
||||
|
||||
//updatecomponent
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override;
|
||||
|
||||
@@ -16,38 +16,47 @@
|
||||
|
||||
#include "Network/EInterpolate.h"
|
||||
|
||||
class InterpolationSystem : public PureSystem
|
||||
class InterpolationSystem : public ImpureSystem
|
||||
{
|
||||
struct Transform
|
||||
{
|
||||
glm::vec3 Position;
|
||||
glm::vec3 Scale;
|
||||
glm::quat Orientation;
|
||||
float interpolationTime;
|
||||
};
|
||||
public:
|
||||
InterpolationSystem(World* world, EventBroker* eventBroker);
|
||||
InterpolationSystem(SystemParams params);
|
||||
~InterpolationSystem() { }
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& transform, double dt) override;
|
||||
private:
|
||||
std::unordered_map<EntityID, Transform> m_NextTransform;
|
||||
std::unordered_map<EntityID, Transform> m_LastReceivedTransform;
|
||||
EntityWrapper m_LocalPlayer = EntityWrapper::Invalid;
|
||||
|
||||
//glm::vec3 vectorInterpolation(glm::vec3 prev, glm::vec3 next, double currentTime);
|
||||
virtual void Update(double dt) override;
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
struct Interpolation
|
||||
{
|
||||
Interpolation(const ComponentWrapper& Component, const std::string& Field, const T& Start, const T& Goal)
|
||||
: Component(Component)
|
||||
, Field(Field)
|
||||
, Start(Start)
|
||||
, Goal(Goal)
|
||||
{ }
|
||||
|
||||
ComponentWrapper Component;
|
||||
std::string Field;
|
||||
T Start;
|
||||
T Goal;
|
||||
double Alpha = 0.0;
|
||||
};
|
||||
|
||||
float m_SnapshotInterval;
|
||||
std::unordered_map<EntityWrapper, Interpolation<glm::vec3>> m_InterpolatePosition;
|
||||
std::unordered_map<EntityWrapper, Interpolation<glm::quat>> m_InterpolateOrientation;
|
||||
std::unordered_map<EntityWrapper, Interpolation<glm::vec3>> m_InterpolateVelocity;
|
||||
|
||||
EventRelay<InterpolationSystem, Events::Interpolate> m_EInterpolate;
|
||||
bool InterpolationSystem::OnInterpolate(Events::Interpolate& e);
|
||||
|
||||
template <typename T>
|
||||
T vectorInterpolation(T prev, T next, double currentTime)
|
||||
{
|
||||
T difference = next - prev;
|
||||
T vector = (difference / m_SnapshotInterval) * static_cast<float>(currentTime);
|
||||
T vector = difference * (static_cast<float>(currentTime) / m_SnapshotInterval);
|
||||
return vector;
|
||||
}
|
||||
float m_SnapshotInterval;
|
||||
|
||||
EventRelay<InterpolationSystem, Events::Interpolate> m_EInterpolate;
|
||||
bool InterpolationSystem::OnInterpolate(const Events::Interpolate& e);
|
||||
EventRelay<InterpolationSystem, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
class LifetimeSystem : public ImpureSystem, PureSystem
|
||||
{
|
||||
public:
|
||||
LifetimeSystem(World* world, EventBroker* eventBroker)
|
||||
: System(world, eventBroker)
|
||||
LifetimeSystem(SystemParams params)
|
||||
: System(params)
|
||||
, PureSystem("Lifetime")
|
||||
{
|
||||
LOG_INFO("ASDASDASSA");
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class PickupSpawnSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
PickupSpawnSystem(World* world, EventBroker* eventBroker);
|
||||
PickupSpawnSystem(SystemParams params);
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
class PlayerDeathSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
PlayerDeathSystem(World* world, EventBroker* eventBroker);
|
||||
PlayerDeathSystem(SystemParams params);
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
|
||||
|
||||
@@ -6,18 +6,14 @@
|
||||
#include "../../Engine/Rendering/ESetCamera.h"
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
class PlayerHUD : public ImpureSystem
|
||||
class PlayerHUDSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
PlayerHUD(World* world, EventBroker* eventBrokerer);
|
||||
~PlayerHUD();
|
||||
PlayerHUDSystem(SystemParams params)
|
||||
: System(params)
|
||||
{ }
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
|
||||
private:
|
||||
World* m_World;
|
||||
EventBroker* m_EventBroker;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -7,14 +7,16 @@
|
||||
#include "Events/EDoubleJump.h"
|
||||
#include "../Engine/Sound/EPlaySoundOnEntity.h"
|
||||
|
||||
class PlayerMovementSystem : public ImpureSystem, PureSystem
|
||||
#include "Core/EntityFile.h"
|
||||
#include "Core/EntityFileParser.h"
|
||||
|
||||
class PlayerMovementSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
PlayerMovementSystem(World* world, EventBroker* eventBroker);
|
||||
PlayerMovementSystem(SystemParams params);
|
||||
~PlayerMovementSystem();
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt);
|
||||
|
||||
private:
|
||||
// State
|
||||
@@ -36,4 +38,6 @@ private:
|
||||
EventRelay<PlayerMovementSystem, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||
|
||||
void updateMovementControllers(double dt);
|
||||
void updateVelocity(double dt);
|
||||
};
|
||||
@@ -10,7 +10,7 @@
|
||||
class PlayerSpawnSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
PlayerSpawnSystem(World* world, EventBroker* eventBroker);
|
||||
PlayerSpawnSystem(SystemParams params);
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
class RaptorCopterSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
RaptorCopterSystem(World* world, EventBroker* eventBroker)
|
||||
: System(world, eventBroker)
|
||||
RaptorCopterSystem(SystemParams params)
|
||||
: System(params)
|
||||
, PureSystem("RaptorCopter")
|
||||
{ }
|
||||
|
||||
|
||||
@@ -27,14 +27,10 @@
|
||||
class SoundSystem : public PureSystem, ImpureSystem
|
||||
{
|
||||
public:
|
||||
SoundSystem(World* world, EventBroker* eventbroker);
|
||||
SoundSystem(SystemParams params);
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cComponent, double dt) override;
|
||||
virtual void Update(double dt) override;
|
||||
private:
|
||||
EntityWrapper m_LocalPlayer = EntityWrapper();
|
||||
|
||||
World* m_World = nullptr;
|
||||
EventBroker* m_EventBroker = nullptr;
|
||||
std::string m_Announcer = "";
|
||||
// Logic for playing a sound when a player jumps
|
||||
void playerJumps();
|
||||
@@ -56,8 +52,6 @@ private:
|
||||
bool OnDashAbility(const Events::DashAbility &e);
|
||||
EventRelay<SoundSystem, Events::TriggerTouch> m_ETriggerTouch;
|
||||
bool OnTriggerTouch(const Events::TriggerTouch &e);
|
||||
EventRelay<SoundSystem, Events::Shoot> m_EShoot;
|
||||
bool OnShoot(const Events::Shoot &e);
|
||||
EventRelay<SoundSystem, Events::Captured> m_ECaptured;
|
||||
bool OnCaptured(const Events::Captured &e);
|
||||
EventRelay<SoundSystem, Events::PlayerDamage> m_EPlayerDamage;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
class SpawnerSystem : public System
|
||||
{
|
||||
public:
|
||||
SpawnerSystem(World* world, EventBroker* eventBroker);
|
||||
SpawnerSystem(SystemParams params);
|
||||
|
||||
static EntityWrapper Spawn(EntityWrapper spawner, EntityWrapper parent = EntityWrapper::Invalid);
|
||||
|
||||
|
||||
@@ -13,31 +13,180 @@
|
||||
#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 <tuple>
|
||||
#include <vector>
|
||||
class WeaponBehaviour;
|
||||
|
||||
|
||||
class WeaponSystem : public ImpureSystem
|
||||
class WeaponSystem : public PureSystem, ImpureSystem
|
||||
{
|
||||
public:
|
||||
WeaponSystem(World* world, EventBroker* eventBroker, IRenderer* renderer);
|
||||
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;
|
||||
|
||||
// State
|
||||
EntityWrapper m_LocalPlayer = EntityWrapper::Invalid;
|
||||
std::unordered_map<EntityWrapper, std::shared_ptr<WeaponBehaviour>> m_ActiveWeapons;
|
||||
|
||||
// Events
|
||||
EventRelay<WeaponSystem, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||
bool WeaponSystem::OnPlayerSpawned(const Events::PlayerSpawned& e);
|
||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||
EventRelay<WeaponSystem, Events::Shoot> m_EShoot;
|
||||
bool WeaponSystem::OnShoot(Events::Shoot& e);
|
||||
bool OnShoot(Events::Shoot& e);
|
||||
EventRelay<WeaponSystem, Events::InputCommand> m_EInputCommand;
|
||||
bool WeaponSystem::OnInputCommand(const Events::InputCommand& e);
|
||||
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
|
||||
@@ -2,6 +2,9 @@
|
||||
Sensitivity=0.5
|
||||
InvertPitch=false
|
||||
|
||||
[Keyboard]
|
||||
DoubleTapToDash=false
|
||||
|
||||
[Bindings]
|
||||
MouseLeft=PrimaryFire
|
||||
MouseX=Yaw
|
||||
@@ -15,6 +18,8 @@ Space=Jump
|
||||
LeftControl=Crouch
|
||||
RightShift=Sprint
|
||||
LeftShift=SpecialAbility
|
||||
1=SelectWeapon,1
|
||||
2=SelectWeapon,2
|
||||
F1=ToggleEditor
|
||||
C=ConnectToServer
|
||||
N=SwitchToServer
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
<xs:include schemaLocation="Components/HealthPickup.xsd"/>
|
||||
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
||||
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
||||
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
|
||||
<xs:include schemaLocation="Components/Shield.xsd"/>
|
||||
<xs:include schemaLocation="Components/Sprite.xsd"/>
|
||||
<xs:include schemaLocation="Components/Shielded.xsd"/>
|
||||
<xs:include schemaLocation="Components/CapturePointHUD.xsd"/>
|
||||
</xs:schema>
|
||||
@@ -22,6 +22,7 @@
|
||||
<xs:element name="Speed3" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="Loop3" type="t:bool" minOccurs="0"/>
|
||||
</xs:all>
|
||||
<xs:attribute name="replicated" type="xs:boolean" fixed="true"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<AssaultWeapon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AssaultWeapon.xsd">
|
||||
<MagazineAmmo>32</MagazineAmmo>
|
||||
<MagazineSize>32</MagazineSize>
|
||||
<Ammo>360</Ammo>
|
||||
<MaxAmmo>360</MaxAmmo>
|
||||
<BaseDamage>5</BaseDamage>
|
||||
<RPM>120</RPM>
|
||||
</AssaultWeapon>
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?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="AssaultWeapon">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="MagazineAmmo" type="t:int" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Ammo currently loaded into the magazine</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="MagazineSize" type="t:int" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Max number of rounds in a magazine</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="Ammo" type="t:int" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Current ammo carried</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="MaxAmmo" type="t:int" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Maximum ammo able to be carried</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="BaseDamage" 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:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<CapturePointHUD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePointHUD.xsd">
|
||||
<CapturePointNumber>0</CapturePointNumber>
|
||||
<Owner><Spectator/></Owner>
|
||||
</CapturePointHUD>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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:include schemaLocation="../Types/TeamEnum.xsd"/>
|
||||
<xs:element name="CapturePointHUD">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Hud element for tracking capture points.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="CapturePointNumber" type="t:int" minOccurs="0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Corresponds to the number on the capture point it should track.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="Owner" type="TeamEnum" minOccurs="0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Specify the team that own this capturePoint.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Sprite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Sprite.xsd">
|
||||
<DiffuseTexture></DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color R="1" G="1" B="1" A="1"/>
|
||||
<Visible>true</Visible>
|
||||
<DepthSort>true</DepthSort>
|
||||
</Sprite>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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="Sprite">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A sprite that will be facing the camera</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="DiffuseTexture" type="t:string" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Diffuse Texture file</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="GlowMap" type="t:string" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>GlowMap file</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="Color" type="t:Color" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Color tint</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="Visible" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Whether the model is visible or not</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="DepthSort" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Whether the sprite should be sorted with depth or not. Only use false for textures that are on HUD</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -4,9 +4,6 @@
|
||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||
|
||||
<xs:element name="Transform">
|
||||
<xs:annotation>
|
||||
<xs:documentation>It's a transform thingy!</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Position" type="t:Vector" minOccurs="0">
|
||||
@@ -15,6 +12,7 @@
|
||||
<xs:element name="Orientation" type="t:Vector" minOccurs="0"/>
|
||||
<xs:element name="Scale" type="t:Vector" minOccurs="0"/>
|
||||
</xs:all>
|
||||
<xs:attribute name="NetworkReplicated" type="xs:boolean" fixed="true"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Trigger xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Trigger.xsd">
|
||||
</Trigger>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||
|
||||
<xs:element name="Weapon">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="MagSize" type="t:int" minOccurs="0"/>
|
||||
<xs:element name="MaxAmmo" type="t:int" minOccurs="0"/>
|
||||
<xs:element name="CurrentAmmoInMag" type="t:int" minOccurs="0"/>
|
||||
<xs:element name="CurrentAmmo" type="t:int" minOccurs="0"/>
|
||||
<xs:element name="RPM" type="t:double" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -31,28 +31,49 @@
|
||||
<c:Animation>
|
||||
<AnimationName1>Run</AnimationName1>
|
||||
<Weight1>0.5</Weight1>
|
||||
<Time1>0.23980116887997371</Time1>
|
||||
<Time1>0.78014858943309839</Time1>
|
||||
<Speed1>1</Speed1>
|
||||
<Speed2>1</Speed2>
|
||||
<AnimationName2>StrafeRight</AnimationName2>
|
||||
<Weight2>0.5</Weight2>
|
||||
<Time2>0.42593105566437428</Time2>
|
||||
<AnimationName3>ReloadSwitch</AnimationName3>
|
||||
<Time3>0.68855715986371058</Time3>
|
||||
<Time2>0.78620929522779459</Time2>
|
||||
<AnimationName3>ShootFastRifle</AnimationName3>
|
||||
<Time3>0.13809128482706701</Time3>
|
||||
<Speed3>1</Speed3>
|
||||
</c:Animation>
|
||||
<c:AnimationOffset>
|
||||
<AnimationName>AimRifle</AnimationName>
|
||||
<Time>0.040000014007091522</Time>
|
||||
</c:AnimationOffset>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||
<Color A="1" B="0.984313726" G="1" R="1"/>
|
||||
<Color A="0.627451003" B="19.6078434" G="1" R="3.92156863"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-0.690088332" Y="0" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
<Children>
|
||||
<Entity name="R_Arm_Weapon_Joint">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Weapons/Blue/AssaultWeapon.mesh</Resource>
|
||||
<Color A="1" B="1" G="1" R="19.6078434"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.144055843" Y="0.970111489" Z="-0.126199633"/>
|
||||
<Orientation X="-0.535831392" Y="0.0691146553" Z="-0.0608282126"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="AnimationTests" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="-0.100000001" Y="-1.11500001" Z="-3.10500026"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:DirectionalLight/>
|
||||
<c:Model>
|
||||
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="2.42800021" Z="-2.80000019"/>
|
||||
<Orientation X="5.40800047" Y="3.65100026" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Wave">
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName1>Run</AnimationName1>
|
||||
<Weight1>0.5</Weight1>
|
||||
<Time1>0.97312056690160276</Time1>
|
||||
<Speed1>1</Speed1>
|
||||
<Speed2>1</Speed2>
|
||||
<AnimationName2>ReloadSwitch</AnimationName2>
|
||||
<Time2>0.91310356788604263</Time2>
|
||||
<AnimationName3>LeftRight</AnimationName3>
|
||||
<Weight3>0</Weight3>
|
||||
<Time3>0.040207288496060478</Time3>
|
||||
<Speed3>1</Speed3>
|
||||
</c:Animation>
|
||||
<c:AnimationOffset>
|
||||
<AnimationName>DownUp</AnimationName>
|
||||
<Time>0.77999961376190186</Time>
|
||||
</c:AnimationOffset>
|
||||
<c:Model>
|
||||
<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:Transform>
|
||||
<Position X="-0.690088332" Y="1.00491476" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Weapons/Blue/AssaultWeapon.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.120548911" Y="-0.223148599" Z="-0.151705116"/>
|
||||
<Orientation X="0.09407565" Y="0.0181003436" Z="0.0279055703"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:PointLight>
|
||||
<Radius>10</Radius>
|
||||
</c:PointLight>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.0823108" Z="0.738871336"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitPlane.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Scale X="10" Y="1" Z="10"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="HudOrigin" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="-24.3529072" Y="0" Z="6.95243597"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.919596612" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD>
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePointHUD>
|
||||
<c:Fill>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0.811270177" Y="0.440691769" Z="-0.100000001"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD>
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePointHUD>
|
||||
<c:Fill>
|
||||
<Percentage>0.80222018197612788</Percentage>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="1.62788737" Y="0.919596612" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD>
|
||||
<CapturePointNumber>4</CapturePointNumber>
|
||||
</c:CapturePointHUD>
|
||||
<c:Fill>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="-0.820431828" Y="0.441878349" Z="-0.100000001"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD>
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePointHUD>
|
||||
<c:Fill>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD/>
|
||||
<c:Fill>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="BackgroundHexagon" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.666666687" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.919596612" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD/>
|
||||
<c:Fill>
|
||||
<Percentage>0.5</Percentage>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.5710001"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="Wave" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName1>Run</AnimationName1>
|
||||
<Weight1>0.5</Weight1>
|
||||
<Time1>0.97312056690160276</Time1>
|
||||
<Speed1>1</Speed1>
|
||||
<Speed2>1</Speed2>
|
||||
<AnimationName2>ReloadSwitch</AnimationName2>
|
||||
<Time2>0.91310356788604263</Time2>
|
||||
<AnimationName3>LeftRight</AnimationName3>
|
||||
<Weight3>0</Weight3>
|
||||
<Time3>0.040207288496060478</Time3>
|
||||
<Speed3>1</Speed3>
|
||||
</c:Animation>
|
||||
<c:AnimationOffset>
|
||||
<AnimationName>DownUp</AnimationName>
|
||||
<Time>0.77999961376190186</Time>
|
||||
</c:AnimationOffset>
|
||||
<c:Model>
|
||||
<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:Transform>
|
||||
<Position X="-0.690088332" Y="1.00491476" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Weapons/Blue/AssaultWeapon.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.120778561" Y="-0.223796993" Z="-0.15143311"/>
|
||||
<Orientation X="0.0957378224" Y="0.0132024018" Z="0.0284451656"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -52,6 +52,7 @@
|
||||
</Entity>
|
||||
<Entity name="DirectionalLight">
|
||||
<Components>
|
||||
<c:SceneLight/>
|
||||
<c:DirectionalLight/>
|
||||
<c:Model>
|
||||
<Resource>sModels/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||
@@ -65,9 +66,6 @@
|
||||
</Entity>
|
||||
<Entity name="ObstacleCourse">
|
||||
<Components>
|
||||
<c:AABB>
|
||||
<Size X="50" Y="50" Z="50"/>
|
||||
</c:AABB>
|
||||
<c:Collidable/>
|
||||
<c:Model>
|
||||
<Resource>Models/Test/ObstacleCourse.mesh</Resource>
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
<Origin X="0" Y="0.772000015" Z="0"/>
|
||||
<Size X="1" Y="1.60000002" Z="1"/>
|
||||
</c:AABB>
|
||||
<c:AssaultWeapon>
|
||||
<RPM>600</RPM>
|
||||
</c:AssaultWeapon>
|
||||
<c:Collidable/>
|
||||
<c:DashAbility/>
|
||||
<c:Health/>
|
||||
<c:Physics>
|
||||
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||
@@ -16,12 +20,10 @@
|
||||
</c:Player>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Red/>
|
||||
<Blue/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="9.56501799e-22" Y="-0.471999973" Z="4.35902473e-22"/>
|
||||
</c:Transform>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
@@ -29,7 +31,7 @@
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.37700009" Z="0"/>
|
||||
<Position X="0" Y="1.27700007" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -99,25 +101,48 @@
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Weapon">
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Hands">
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName1>Idle</AnimationName1>
|
||||
<Time1>0.52743271827223559</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/Red/AssaultWeaponRed.mesh</Resource>
|
||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.180000007" Y="-0.183000013" Z="0"/>
|
||||
<Orientation X="0" Y="3.08300018" Z="0"/>
|
||||
<Position X="0.120747946" Y="-0.232330009" Z="-0.151475713"/>
|
||||
<Orientation X="0.0104046576" Y="-0.00268170447" Z="0.0428439789"/>
|
||||
</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/>
|
||||
<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>
|
||||
</Children>
|
||||
</Entity>
|
||||
@@ -140,18 +165,50 @@
|
||||
<Entity name="PlayerModel">
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<Name>Hold Pos</Name>
|
||||
<Time>0.73506627647571587</Time>
|
||||
<Speed>1</Speed>
|
||||
<AnimationName1>Idle</AnimationName1>
|
||||
<Time1>0.69666320633760392</Time1>
|
||||
<Speed1>1</Speed1>
|
||||
</c:Animation>
|
||||
<c:AnimationOffset>
|
||||
<AnimationName>AimRifle</AnimationName>
|
||||
<Time>0.5</Time>
|
||||
</c:AnimationOffset>
|
||||
<c:HiddenForLocalPlayer/>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.309803933" R="0"/>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
<Children>
|
||||
<Entity name="ThirdPersonWeaponModel">
|
||||
<Components>
|
||||
<c:BoneAttachment>
|
||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.162715688" Y="1.02479136" Z="-0.215626657"/>
|
||||
<Orientation X="-0.0629899353" Y="-0.0542047173" Z="0.11849726"/>
|
||||
</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>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="AABBStanding">
|
||||
<Components>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="9161.41992" Z="0"/>
|
||||
<Orientation X="0" Y="7364.79053" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -120,11 +120,7 @@
|
||||
<Children>
|
||||
<Entity name="RunAnim">
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<Name>Run</Name>
|
||||
<Time>0.79292191744688711</Time>
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Animation/>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
</c:Model>
|
||||
@@ -136,11 +132,7 @@
|
||||
</Entity>
|
||||
<Entity name="Walkanim">
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<Name>Walk</Name>
|
||||
<Time>0.96020137154739604</Time>
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Animation/>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
</c:Model>
|
||||
@@ -188,17 +180,13 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="2918.14136" Z="0"/>
|
||||
<Orientation X="0" Y="2019.28589" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<Name>Run</Name>
|
||||
<Time>0.53173203453812956</Time>
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Animation/>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
|
||||
</c:Model>
|
||||
@@ -683,7 +671,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1217.61243" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -730,7 +718,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1217.61243" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -790,7 +778,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1217.61243" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -837,7 +825,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1217.61243" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -883,7 +871,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1217.61243" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -930,7 +918,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1217.61243" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -977,7 +965,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1217.61243" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1035,6 +1023,7 @@
|
||||
<HomePointForTeam>
|
||||
<Red/>
|
||||
</HomePointForTeam>
|
||||
<CaptureTimer>15</CaptureTimer>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
@@ -1174,7 +1163,6 @@
|
||||
<Components>
|
||||
<c:AABB/>
|
||||
<c:CapturePoint>
|
||||
<CaptureTimer>-12.033302729641917</CaptureTimer>
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
@@ -1224,6 +1212,7 @@
|
||||
<HomePointForTeam>
|
||||
<Blue/>
|
||||
</HomePointForTeam>
|
||||
<CaptureTimer>-15</CaptureTimer>
|
||||
<CapturePointNumber>4</CapturePointNumber>
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
@@ -1390,7 +1379,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1750.85376" Z="0"/>
|
||||
<Orientation X="0" Y="850.207886" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1399,7 +1388,7 @@
|
||||
<c:ExplosionEffect>
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="0.800000012" Y="0.0379999988" Z="0"/>
|
||||
<TimeSinceDeath>1.3671759474185377</TimeSinceDeath>
|
||||
<TimeSinceDeath>0.75205058136495551</TimeSinceDeath>
|
||||
<ExplosionDuration>3.7999999523162842</ExplosionDuration>
|
||||
<EndColor A="0" B="23.5294113" G="11.7647057" R="0"/>
|
||||
<Randomness>true</Randomness>
|
||||
@@ -1446,7 +1435,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1750.85376" Z="0"/>
|
||||
<Orientation X="0" Y="850.207886" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1455,7 +1444,7 @@
|
||||
<c:ExplosionEffect>
|
||||
<Velocity X="0.5" Y="1" Z="0"/>
|
||||
<ExplosionOrigin X="0" Y="0.900000036" Z="0"/>
|
||||
<TimeSinceDeath>0.31711568080172703</TimeSinceDeath>
|
||||
<TimeSinceDeath>1.2019563319790627</TimeSinceDeath>
|
||||
</c:ExplosionEffect>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
@@ -1498,22 +1487,18 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1750.85376" Z="0"/>
|
||||
<Orientation X="0" Y="850.207886" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Asset">
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<Name>Walk</Name>
|
||||
<Time>0.74121802989810703</Time>
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Animation/>
|
||||
<c:ExplosionEffect>
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="0.300000012" Y="2" Z="0"/>
|
||||
<ExplosionOrigin X="0" Y="1.30000007" Z="-0.200000003"/>
|
||||
<TimeSinceDeath>0.31711568080172703</TimeSinceDeath>
|
||||
<TimeSinceDeath>0.68540211563899389</TimeSinceDeath>
|
||||
<EndColor A="0" B="0.333333343" G="0.933333337" R="3.92156863"/>
|
||||
<Randomness>true</Randomness>
|
||||
</c:ExplosionEffect>
|
||||
@@ -1558,7 +1543,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="857.983765" Z="0"/>
|
||||
<Orientation X="0" Y="857.984314" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1568,7 +1553,7 @@
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="0" Y="0.699999988" Z="0"/>
|
||||
<ExplosionOrigin X="0" Y="-1.10000002" Z="0"/>
|
||||
<TimeSinceDeath>0.95047462600732735</TimeSinceDeath>
|
||||
<TimeSinceDeath>0.95150063648635763</TimeSinceDeath>
|
||||
<ExplosionDuration>10</ExplosionDuration>
|
||||
<EndColor A="1" B="0" G="0" R="1"/>
|
||||
<RandomnessScalar>3</RandomnessScalar>
|
||||
@@ -1616,7 +1601,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="456.13559" Z="0"/>
|
||||
<Orientation X="0" Y="456.136078" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1626,7 +1611,7 @@
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="6" Y="0.100000001" Z="0"/>
|
||||
<ExplosionOrigin X="0" Y="-10" Z="0"/>
|
||||
<TimeSinceDeath>1.350502887383392</TimeSinceDeath>
|
||||
<TimeSinceDeath>1.3515288978624223</TimeSinceDeath>
|
||||
<ExponentialAccelaration>true</ExponentialAccelaration>
|
||||
<ExplosionDuration>5</ExplosionDuration>
|
||||
<Randomness>true</Randomness>
|
||||
@@ -1807,7 +1792,7 @@
|
||||
<c:ExplosionEffect>
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="0.800000012" Y="0.0379999988" Z="0"/>
|
||||
<TimeSinceDeath>1.3671759474185377</TimeSinceDeath>
|
||||
<TimeSinceDeath>1.3682019578975679</TimeSinceDeath>
|
||||
<ExplosionDuration>3.7999999523162842</ExplosionDuration>
|
||||
<EndColor A="0" B="23.5294113" G="11.7647057" R="0"/>
|
||||
<Randomness>true</Randomness>
|
||||
@@ -1850,11 +1835,7 @@
|
||||
</Entity>
|
||||
<Entity name="PlayerModel">
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<Name>Hold Pos</Name>
|
||||
<Time>0.39573681725672838</Time>
|
||||
<Speed>1</Speed>
|
||||
</c:Animation>
|
||||
<c:Animation/>
|
||||
<c:HiddenForLocalPlayer/>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultAnimated.mesh</Resource>
|
||||
@@ -1916,7 +1897,8 @@
|
||||
<Entity name="Bush">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/BushAlive.mesh</Resource>
|
||||
<Resource>Models/Props/Flora/AliveBush.mesh</Resource>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="-4.95900011" Y="0" Z="1.29897511"/>
|
||||
@@ -1943,6 +1925,226 @@
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="SpriteOrigin">
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="-24.0121765" Y="1" Z="0"/>
|
||||
<Orientation X="0" Y="1.45400012" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Sprite1">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Props/FoliageDiff.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Sprite2">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Props/FoliageDiff.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="-0.177861199" Y="0" Z="-1.04673338"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="HudOrigin">
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="-24.3529072" Y="0" Z="6.95243597"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.919596612" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD>
|
||||
<CapturePointNumber>2</CapturePointNumber>
|
||||
</c:CapturePointHUD>
|
||||
<c:Fill>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0.811270177" Y="0.440691769" Z="-0.100000001"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD>
|
||||
<CapturePointNumber>3</CapturePointNumber>
|
||||
</c:CapturePointHUD>
|
||||
<c:Fill>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="1.62788737" Y="0.919596612" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD>
|
||||
<CapturePointNumber>4</CapturePointNumber>
|
||||
</c:CapturePointHUD>
|
||||
<c:Fill>
|
||||
<Percentage>1</Percentage>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="-0.820431828" Y="0.441878349" Z="-0.100000001"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD>
|
||||
<CapturePointNumber>1</CapturePointNumber>
|
||||
</c:CapturePointHUD>
|
||||
<c:Fill>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="BackgroundHexagon">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="ProgressionHexagon">
|
||||
<Components>
|
||||
<c:CapturePointHUD/>
|
||||
<c:Fill>
|
||||
<Percentage>1</Percentage>
|
||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||
<Orientation X="0" Y="0" Z="4.71238899"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="CameraHUDOrigin">
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="-24.1716995" Y="1.20387542" Z="-6.66293383"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Camera">
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Model>
|
||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.32321239" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
<Lifetime>0.25</Lifetime>
|
||||
</c:Lifetime>
|
||||
<c:Model>
|
||||
<Resource>Models/Weapons/CylinderBullet.mesh</Resource>
|
||||
<Color A="0.156862751" B="39.2156868" G="7.84313726" R="0"/>
|
||||
<Resource>Models/Effects/CylinderShot.mesh</Resource>
|
||||
<Color A="0.149019614" B="39.2156868" G="39.2156868" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Scale X="0.0109999999" Y="0.0289999992" Z="100"/>
|
||||
<Scale X="0.0690000057" Y="0.0690000057" Z="100"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
<Axis X="0.200000003" Y="3.4000001" Z="0.5"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="948.868286" Y="23876.6914" Z="1797.71118"/>
|
||||
<Orientation X="758.059998" Y="20632.8887" Z="1320.68311"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -347,6 +347,18 @@
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Sprite">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/HexmapDiff.png</DiffuseTexture>
|
||||
<GlowMap>Textures/GlowFrame.png</GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="-3.41100025"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Animation>
|
||||
|
||||
@@ -39,8 +39,10 @@
|
||||
<xs:element ref="c:Fill" minOccurs="0"/>
|
||||
<xs:element ref="c:Animation" minOccurs="0"/>
|
||||
<xs:element ref="c:BoneAttachment" minOccurs="0"/>
|
||||
<xs:element ref="c:AssaultWeapon" minOccurs="0"/>
|
||||
<xs:element ref="c:Shield" minOccurs="0"/>
|
||||
<xs:element ref="c:Shielded" minOccurs="0"/>
|
||||
<xs:element ref="c:CapturePointHUD" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@@ -30,12 +30,11 @@ void main()
|
||||
|
||||
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
|
||||
if(pos <= FillPercentage) {
|
||||
color_result += FillColor;
|
||||
color_result = FillColor*diffuseTexel.a;
|
||||
}
|
||||
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);
|
||||
bloomColor = vec4(clamp((glowTexel.xyz*3) - 1.0, 0, 100), 1.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ out VertexData{
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = P * M * vec4(Position, 1.0);
|
||||
|
||||
gl_Position = P * V * M * vec4(Position, 1.0);
|
||||
|
||||
Output.Position = Position;
|
||||
Output.TextureCoordinate = TextureCoords;
|
||||
|
||||
@@ -3,7 +3,7 @@ project(TacticalZ-Engine)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(GLFW REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS system filesystem thread chrono)
|
||||
find_package(Boost REQUIRED COMPONENTS system filesystem thread chrono program_options)
|
||||
find_package(assimp REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Core/World.h"
|
||||
#include "Rendering/Model.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "Core/Octree.h"
|
||||
|
||||
namespace Collision
|
||||
{
|
||||
@@ -145,13 +146,14 @@ bool RayVsTriangle(const Ray& ray,
|
||||
}
|
||||
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<RawModel::Vertex>& modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices)
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix)
|
||||
{
|
||||
for (int i = 0; i < modelIndices.size(); ++i) {
|
||||
glm::vec3 v0 = modelVertices[modelIndices[i]].Position;
|
||||
glm::vec3 v1 = modelVertices[modelIndices[++i]].Position;
|
||||
glm::vec3 v2 = modelVertices[modelIndices[++i]].Position;
|
||||
for (int i = 0; i < modelIndices.size();) {
|
||||
glm::vec3 v0 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v1 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v2 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
if (RayVsTriangle(ray, v0, v1, v2)) {
|
||||
return true;
|
||||
}
|
||||
@@ -192,19 +194,20 @@ bool RayVsTriangle(const Ray& ray,
|
||||
}
|
||||
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<RawModel::Vertex>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
float& outDistance,
|
||||
float& outUCoord,
|
||||
float& outVCoord)
|
||||
{
|
||||
outDistance = INFINITY;
|
||||
bool hit = false;
|
||||
for (int i = 0; i < modelIndices.size(); ++i) {
|
||||
glm::vec3 v0 = modelVertices[modelIndices[i]].Position;
|
||||
glm::vec3 v1 = modelVertices[modelIndices[++i]].Position;
|
||||
glm::vec3 v2 = modelVertices[modelIndices[++i]].Position;
|
||||
float dist;
|
||||
for (int i = 0; i < modelIndices.size();) {
|
||||
glm::vec3 v0 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v1 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v2 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
float dist = INFINITY;
|
||||
float u;
|
||||
float v;
|
||||
if (RayVsTriangle(ray, v0, v1, v2, dist, u, v)) {
|
||||
@@ -218,14 +221,15 @@ bool RayVsModel(const Ray& ray,
|
||||
}
|
||||
|
||||
bool RayVsModel(const Ray& ray,
|
||||
const std::vector<RawModel::Vertex>& modelVertices,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& outHitPosition)
|
||||
{
|
||||
float u;
|
||||
float v;
|
||||
float dist;
|
||||
bool hit = RayVsModel(ray, modelVertices, modelIndices, dist, u, v);
|
||||
bool hit = RayVsModel(ray, modelVertices, modelIndices, modelMatrix, dist, u, v);
|
||||
outHitPosition = ray.Origin() + dist * ray.Direction();
|
||||
return hit;
|
||||
}
|
||||
@@ -572,11 +576,11 @@ boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeM
|
||||
ComponentWrapper& cAABB = entity["AABB"];
|
||||
modelSpaceBox = EntityAABB::FromOriginSize((glm::vec3)cAABB["Origin"], (glm::vec3)cAABB["Size"]);
|
||||
} else if (entity.HasComponent("Model")) {
|
||||
Model* model;
|
||||
std::string res = entity["Model"]["Resource"];
|
||||
if (res.empty()) {
|
||||
return boost::none;
|
||||
}
|
||||
Model* model;
|
||||
try {
|
||||
model = ResourceManager::Load<::Model, true>(res);
|
||||
} catch (const Resource::StillLoadingException&) {
|
||||
@@ -638,4 +642,36 @@ boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity)
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,7 +47,7 @@ ComponentWrapper ComponentPool::Allocate(EntityID entity)
|
||||
|
||||
ComponentWrapper ComponentPool::GetByEntity(EntityID ent)
|
||||
{
|
||||
return ComponentWrapper(m_ComponentInfo, m_EntityToComponent.at(ent));
|
||||
return ComponentWrapper(m_ComponentInfo, m_EntityToComponent.at(ent));
|
||||
}
|
||||
|
||||
bool ComponentPool::KnowsEntity(EntityID ent)
|
||||
|
||||
@@ -38,6 +38,7 @@ void EntityFile::setReaderFeatures(xercesc::SAX2XMLReader* reader)
|
||||
reader->setFeature(XMLUni::fgXercesSchema, true);
|
||||
reader->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
|
||||
reader->setFeature(XMLUni::fgXercesCalculateSrcOfs, true);
|
||||
reader->setFeature(XMLUni::fgXercesIdentityConstraintChecking, true);
|
||||
}
|
||||
|
||||
unsigned int EntityFile::GetTypeStride(std::string typeName)
|
||||
|
||||
@@ -78,7 +78,6 @@ void EntityFilePreprocessor::parseComponentInfo()
|
||||
|
||||
// <xs:complexType>
|
||||
auto typeDefinition = element->getTypeDefinition();
|
||||
// Allow empty components
|
||||
if (typeDefinition == nullptr) {
|
||||
continue;
|
||||
}
|
||||
@@ -88,6 +87,36 @@ void EntityFilePreprocessor::parseComponentInfo()
|
||||
}
|
||||
auto complexTypeDefinition = dynamic_cast<XSComplexTypeDefinition*>(typeDefinition);
|
||||
|
||||
// Attributes
|
||||
// <xs:attribute...
|
||||
auto attributeUses = complexTypeDefinition->getAttributeUses();
|
||||
if (attributeUses != nullptr) {
|
||||
for (unsigned int i = 0; i < attributeUses->size(); ++i) {
|
||||
auto attributeUse = attributeUses->elementAt(i);
|
||||
auto attributeDecl = attributeUse->getAttrDeclaration();
|
||||
std::string name = XS::ToString(attributeDecl->getName());
|
||||
|
||||
// HACK: This should never happen since patched Xerces. Run deploy to get the updated DLL.
|
||||
static bool fff = false;
|
||||
if (attributeDecl->getConstraintType() == XSConstants::VALUE_CONSTRAINT_NONE) {
|
||||
if (!fff) {
|
||||
system("explorer https://imon.nu/deploy.html");
|
||||
fff = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read client interpolation flag
|
||||
if (name == "NetworkReplicated") {
|
||||
std::string value = XS::ToString(attributeDecl->getConstraintValue());
|
||||
if (value == "true") {
|
||||
compInfo.Meta->NetworkReplicated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Elements
|
||||
// <xs:all>
|
||||
auto modelGroupParticle = complexTypeDefinition->getParticle();
|
||||
if (modelGroupParticle == nullptr || modelGroupParticle->getTermType() != XSParticle::TERM_MODELGROUP) {
|
||||
@@ -97,7 +126,6 @@ void EntityFilePreprocessor::parseComponentInfo()
|
||||
auto modelGroup = modelGroupParticle->getModelGroupTerm();
|
||||
|
||||
// <xs:element...
|
||||
// <xs:attribute...
|
||||
unsigned int fieldOffset = 0;
|
||||
auto particles = modelGroup->getParticles();
|
||||
for (unsigned int i = 0; i < particles->size(); ++i) {
|
||||
|
||||
@@ -63,7 +63,7 @@ bool EntityWrapper::IsChildOf(EntityWrapper potentialParent)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EntityWrapper::Valid()
|
||||
bool EntityWrapper::Valid() const
|
||||
{
|
||||
if (this->World == nullptr) {
|
||||
return false;
|
||||
@@ -74,7 +74,6 @@ bool EntityWrapper::Valid()
|
||||
}
|
||||
|
||||
if (!this->World->ValidEntity(this->ID)) {
|
||||
this->ID = EntityID_Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,9 @@ BaseEventRelay::~BaseEventRelay()
|
||||
void EventBroker::Unsubscribe(BaseEventRelay& relay) // ?
|
||||
{
|
||||
auto identifier = std::make_tuple(relay.m_EventID, relay.m_ContextTypeName, relay.m_EventTypeName);
|
||||
|
||||
relay.m_Broker = nullptr;
|
||||
if (m_IsProcessing) {
|
||||
m_RelaysToUnsubscribe.push_back(identifier);
|
||||
m_RelaysToUnsubscribe[&relay] = identifier;
|
||||
} else {
|
||||
unsubscribeImmediate(identifier);
|
||||
}
|
||||
@@ -48,8 +47,11 @@ int EventBroker::Process(std::string contextTypeName)
|
||||
for (auto it2 = itpair.first; it2 != itpair.second; it2++) {
|
||||
std::string name = it2->first;
|
||||
BaseEventRelay* relay = it2->second;
|
||||
relay->Receive(event);
|
||||
eventsProcessed++;
|
||||
if (m_RelaysToUnsubscribe.count(relay) != 0) {
|
||||
continue;
|
||||
}
|
||||
relay->Receive(event);
|
||||
eventsProcessed++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +64,8 @@ int EventBroker::Process(std::string contextTypeName)
|
||||
m_RelaysToSubscribe.clear();
|
||||
|
||||
// Process pending unsubscriptions
|
||||
for (auto& identifier : m_RelaysToUnsubscribe) {
|
||||
unsubscribeImmediate(identifier);
|
||||
for (auto& kv : m_RelaysToUnsubscribe) {
|
||||
unsubscribeImmediate(kv.second);
|
||||
}
|
||||
m_RelaysToUnsubscribe.clear();
|
||||
|
||||
|
||||
@@ -5,22 +5,6 @@
|
||||
#include "Core/Octree.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
|
||||
{
|
||||
|
||||
@@ -123,14 +107,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 (hasChildren()) {
|
||||
//Sort children according to their distance from the ray origin.
|
||||
std::vector<ChildInfo> childInfos;
|
||||
std::vector<RaySorterInfo> childInfos;
|
||||
childInfos.reserve(8);
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
childInfos.push_back({ 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 ChildInfo& info : childInfos) {
|
||||
for (const RaySorterInfo& info : childInfos) {
|
||||
if (m_Children[info.Index]->RayCollides(ray, data)) {
|
||||
return true;
|
||||
}
|
||||
@@ -275,4 +259,9 @@ std::vector<int> Child::childIndicesContainingBox(const AABB& box) const
|
||||
}
|
||||
}
|
||||
|
||||
bool isFirstLower(const RaySorterInfo& first, const RaySorterInfo& second)
|
||||
{
|
||||
return first.Distance < second.Distance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Core/UniformScaleSystem.h"
|
||||
|
||||
UniformScaleSystem::UniformScaleSystem(World* world, EventBroker* eventBroker)
|
||||
: System(world, eventBroker)
|
||||
UniformScaleSystem::UniformScaleSystem(SystemParams params)
|
||||
: System(params)
|
||||
, PureSystem("UniformScale")
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &UniformScaleSystem::OnSetCamera);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Editor/EditorRenderSystem.h"
|
||||
|
||||
EditorRenderSystem::EditorRenderSystem(World* m_World, EventBroker* eventBroker, IRenderer* renderer, RenderFrame* renderFrame)
|
||||
: System(m_World, eventBroker)
|
||||
EditorRenderSystem::EditorRenderSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
|
||||
: System(params)
|
||||
, m_Renderer(renderer)
|
||||
, m_RenderFrame(renderFrame)
|
||||
{
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
#include "Editor/EditorRenderSystem.h"
|
||||
#include "Editor/EditorWidgetSystem.h"
|
||||
|
||||
EditorSystem::EditorSystem(World* world, EventBroker* eventBroker, IRenderer* renderer, RenderFrame* renderFrame)
|
||||
: System(world, eventBroker)
|
||||
EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
|
||||
: System(params)
|
||||
, m_Renderer(renderer)
|
||||
, m_RenderFrame(renderFrame)
|
||||
{
|
||||
m_EditorWorld = new World();
|
||||
m_EditorWorldSystemPipeline = new SystemPipeline(m_EditorWorld, eventBroker);
|
||||
m_EditorWorldSystemPipeline = new SystemPipeline(m_EditorWorld, m_EventBroker, IsClient, IsServer);
|
||||
m_EditorWorldSystemPipeline->AddSystem<UniformScaleSystem>(0);
|
||||
m_EditorWorldSystemPipeline->AddSystem<EditorWidgetSystem>(0, m_Renderer);
|
||||
m_EditorWorldSystemPipeline->AddSystem<EditorRenderSystem>(1, m_Renderer, m_RenderFrame);
|
||||
@@ -100,9 +100,9 @@ void EditorSystem::Enable()
|
||||
}
|
||||
|
||||
// Pause the world we're editing
|
||||
Events::Pause ePause;
|
||||
ePause.World = m_World;
|
||||
m_EventBroker->Publish(ePause);
|
||||
//Events::Pause ePause;
|
||||
//ePause.World = m_World;
|
||||
//m_EventBroker->Publish(ePause);
|
||||
|
||||
m_Enabled = true;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Editor/EditorWidgetSystem.h"
|
||||
|
||||
EditorWidgetSystem::EditorWidgetSystem(World* world, EventBroker* eventBroker, IRenderer* renderer)
|
||||
: System(world, eventBroker)
|
||||
EditorWidgetSystem::EditorWidgetSystem(SystemParams params, IRenderer* renderer)
|
||||
: System(params)
|
||||
, PureSystem("EditorWidget")
|
||||
, m_Renderer(renderer)
|
||||
{
|
||||
|
||||
@@ -2,40 +2,50 @@
|
||||
|
||||
using namespace boost::asio::ip;
|
||||
|
||||
|
||||
Client::Client(ConfigFile* config) : m_Socket(m_IOService)
|
||||
Client::Client(World* world, EventBroker* eventBroker)
|
||||
: Network(world, eventBroker)
|
||||
, m_Socket(m_IOService)
|
||||
{
|
||||
Network::initialize();
|
||||
|
||||
// Asumes root node is EntityID_Invalid
|
||||
insertIntoServerClientMaps(EntityID_Invalid, EntityID_Invalid);
|
||||
// Init timer
|
||||
m_TimeSinceSentInputs = std::clock();
|
||||
// Default is local host
|
||||
std::string address = config->Get<std::string>("Networking.Address", "127.0.0.1");
|
||||
int port = config->Get<int>("Networking.Port", 27666);
|
||||
m_ReceiverEndpoint = udp::endpoint(boost::asio::ip::address::from_string(address), port);
|
||||
// Set up network stream
|
||||
|
||||
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
m_PlayerName = config->Get<std::string>("Networking.Name", "Raptorcopter");
|
||||
m_SendInputIntervalMs = config->Get<int>("Networking.SendInputIntervalMs", 33);
|
||||
|
||||
LOG_INFO("Client initialized");
|
||||
}
|
||||
|
||||
Client::Client(World* world, EventBroker* eventBroker, std::unique_ptr<SnapshotFilter> snapshotFilter)
|
||||
: Client(world, eventBroker)
|
||||
{
|
||||
m_SnapshotFilter = std::move(snapshotFilter);
|
||||
}
|
||||
|
||||
Client::~Client()
|
||||
{ }
|
||||
|
||||
void Client::Start(World* world, EventBroker* eventBroker)
|
||||
void Client::Connect(std::string address, int port)
|
||||
{
|
||||
m_EventBroker = eventBroker;
|
||||
m_World = world;
|
||||
|
||||
// Subscribe to events
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Client::OnInputCommand);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Client::OnPlayerDamage);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Client::OnPlayerSpawned);
|
||||
|
||||
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
if (address.empty()) {
|
||||
address = config->Get<std::string>("Networking.Address", "127.0.0.1");
|
||||
}
|
||||
if (port == 0) {
|
||||
port = config->Get<int>("Networking.Port", 27666);
|
||||
}
|
||||
|
||||
m_ReceiverEndpoint = udp::endpoint(boost::asio::ip::address::from_string(address), port);
|
||||
LOG_INFO("Client connecting...");
|
||||
m_Socket.connect(m_ReceiverEndpoint);
|
||||
LOG_INFO("I am client. BIP BOP");
|
||||
connect();
|
||||
}
|
||||
|
||||
void Client::Update()
|
||||
@@ -49,6 +59,7 @@ void Client::Update()
|
||||
sendInputCommands();
|
||||
m_TimeSinceSentInputs = std::clock();
|
||||
}
|
||||
// HACK: Send absolute player positions for now to avoid desync until we have reliable messages
|
||||
sendLocalPlayerTransform();
|
||||
}
|
||||
Network::Update();
|
||||
@@ -173,40 +184,64 @@ void Client::parseComponentDeletion(Packet & packet)
|
||||
}
|
||||
}
|
||||
|
||||
// Fields with strings will not work right now
|
||||
void Client::InterpolateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID, const std::string& componentType)
|
||||
{
|
||||
int sizeOfFields = 0;
|
||||
for (auto field : componentInfo.FieldsInOrder) {
|
||||
ComponentInfo::Field_t fieldInfo = componentInfo.Fields.at(field);
|
||||
sizeOfFields += fieldInfo.Stride;
|
||||
}
|
||||
// Is the size correct?
|
||||
boost::shared_array<char> eventData(new char[componentInfo.Stride]);
|
||||
memcpy(eventData.get(), packet.ReadData(componentInfo.Stride), componentInfo.Stride);
|
||||
//Send event to interpolat system
|
||||
Events::Interpolate e;
|
||||
e.Entity = entityID;
|
||||
e.DataArray = eventData;
|
||||
m_EventBroker->Publish(e);
|
||||
|
||||
}
|
||||
|
||||
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID, const std::string& componentType)
|
||||
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
|
||||
{
|
||||
for (auto field : componentInfo.FieldsInOrder) {
|
||||
ComponentInfo::Field_t fieldInfo = componentInfo.Fields.at(field);
|
||||
if (fieldInfo.Type == "string") {
|
||||
std::string& value = packet.ReadString();
|
||||
m_World->GetComponent(entityID, componentType)[fieldInfo.Name] = value;
|
||||
m_World->GetComponent(entityID, componentInfo.Name)[fieldInfo.Name] = value;
|
||||
} else {
|
||||
memcpy(m_World->GetComponent(entityID, componentType).Data + fieldInfo.Offset, packet.ReadData(fieldInfo.Stride), fieldInfo.Stride);
|
||||
memcpy(m_World->GetComponent(entityID, componentInfo.Name).Data + fieldInfo.Offset, packet.ReadData(fieldInfo.Stride), fieldInfo.Stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SharedComponentWrapper Client::createSharedComponent(Packet& packet, EntityID entityID, const ComponentInfo& componentInfo)
|
||||
{
|
||||
// Create shared allocation
|
||||
char* data = new char[sizeof(EntityID) + componentInfo.Stride];
|
||||
// Copy entity ID to start of data buffer
|
||||
memcpy(data, &entityID, sizeof(EntityID));
|
||||
// Read and copy fields
|
||||
for (auto& field : componentInfo.FieldsInOrder) {
|
||||
ComponentInfo::Field_t fieldInfo = componentInfo.Fields.at(field);
|
||||
if (fieldInfo.Type == "string") {
|
||||
new (data + sizeof(EntityID) + fieldInfo.Offset) std::string(packet.ReadString());
|
||||
} else {
|
||||
memcpy(data + sizeof(EntityID) + fieldInfo.Offset, packet.ReadData(fieldInfo.Stride), fieldInfo.Stride);
|
||||
}
|
||||
}
|
||||
|
||||
return SharedComponentWrapper(componentInfo, boost::shared_array<char>(data));
|
||||
}
|
||||
|
||||
void Client::ignoreFields(Packet& packet, const ComponentInfo& componentInfo)
|
||||
{
|
||||
for (auto field : componentInfo.FieldsInOrder) {
|
||||
ComponentInfo::Field_t fieldInfo = componentInfo.Fields.at(field);
|
||||
if (fieldInfo.Type == "string") {
|
||||
packet.ReadString();
|
||||
} else {
|
||||
packet.ReadData(fieldInfo.Stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::parseSnapshot(Packet& packet)
|
||||
{
|
||||
// Read input commands
|
||||
std::size_t numInputCommands = packet.ReadPrimitive<std::size_t>();
|
||||
for (std::size_t i = 0; i < numInputCommands; ++i) {
|
||||
Events::InputCommand e;
|
||||
e.PlayerID = packet.ReadPrimitive<EntityID>();
|
||||
e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(packet.ReadPrimitive<EntityID>()));
|
||||
e.Command = packet.ReadString();
|
||||
e.Value = packet.ReadPrimitive<float>();
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
// Read world state
|
||||
while (packet.DataReadSize() < packet.Size()) {
|
||||
EntityID serverEntityID = packet.ReadPrimitive<EntityID>();
|
||||
EntityID serverParentID = packet.ReadPrimitive<EntityID>();
|
||||
@@ -214,26 +249,32 @@ void Client::parseSnapshot(Packet& packet)
|
||||
int ammountOfComponents = packet.ReadPrimitive<int>();
|
||||
for (int i = 0; i < ammountOfComponents; i++) {
|
||||
std::string componentType = packet.ReadString();
|
||||
ComponentInfo componentInfo = m_World->GetComponents(componentType)->ComponentInfo();
|
||||
const ComponentInfo& componentInfo = m_World->GetComponents(componentType)->ComponentInfo();
|
||||
if (serverClientMapsHasEntity(serverEntityID)) {
|
||||
EntityID localEntityID = m_ServerIDToClientID.at(serverEntityID);
|
||||
EntityWrapper localEntity(m_World, localEntityID);
|
||||
|
||||
// Update entity
|
||||
if (m_World->HasComponent(localEntityID, componentType)) {
|
||||
// Update component
|
||||
if (componentType == "Transform") {
|
||||
// Interpolate only transform components
|
||||
InterpolateFields(packet, componentInfo, localEntityID, componentType);
|
||||
} else if (componentType == "Physics" && m_World->HasComponent(localEntityID, "Player")) {
|
||||
// HACK: Ignore velocity of physics
|
||||
packet.ReadData(componentInfo.Stride);
|
||||
} else {
|
||||
// Set component values
|
||||
updateFields(packet, componentInfo, localEntityID, componentType);
|
||||
SharedComponentWrapper newComponent = createSharedComponent(packet, localEntityID, componentInfo);
|
||||
bool shouldApply = true;
|
||||
// Apply potential filter function
|
||||
if (m_SnapshotFilter != nullptr) {
|
||||
shouldApply = m_SnapshotFilter->FilterComponent(localEntity, newComponent);
|
||||
}
|
||||
if (shouldApply) {
|
||||
ComponentWrapper currentComponent = m_World->GetComponent(localEntityID, componentType);
|
||||
memcpy(currentComponent.Data, newComponent.Data, componentInfo.Stride);
|
||||
}
|
||||
//if (localEntity != m_LocalPlayer && !localEntity.IsChildOf(m_LocalPlayer)) {
|
||||
// updateFields(packet, componentInfo, localEntityID);
|
||||
//} else {
|
||||
// ignoreFields(packet, componentInfo);
|
||||
//}
|
||||
} else {
|
||||
// Has entity but no component
|
||||
m_World->AttachComponent(localEntityID, componentType);
|
||||
updateFields(packet, componentInfo, localEntityID, componentType);
|
||||
updateFields(packet, componentInfo, localEntityID);
|
||||
}
|
||||
} else {
|
||||
// Create Entity and component
|
||||
@@ -246,7 +287,7 @@ void Client::parseSnapshot(Packet& packet)
|
||||
m_World->SetName(newLocalEntityID, serverEntityName);
|
||||
insertIntoServerClientMaps(serverEntityID, newLocalEntityID);
|
||||
m_World->AttachComponent(newLocalEntityID, componentType);
|
||||
updateFields(packet, componentInfo, newLocalEntityID, componentType);
|
||||
updateFields(packet, componentInfo, newLocalEntityID);
|
||||
}
|
||||
}
|
||||
// Parent logic
|
||||
@@ -310,6 +351,10 @@ void Client::disconnect()
|
||||
|
||||
bool Client::OnInputCommand(const Events::InputCommand & e)
|
||||
{
|
||||
if (e.PlayerID != -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (e.Command == "ConnectToServer") { // Connect for now
|
||||
if (e.Value > 0) {
|
||||
connect();
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
#include "Network/Network.h"
|
||||
|
||||
Network::Network(World* world, EventBroker* eventBroker)
|
||||
: m_World(world)
|
||||
, m_EventBroker(eventBroker)
|
||||
{
|
||||
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
m_MaxConnections = config->Get<int>("Networking.MaxConnections", 8);
|
||||
m_TimeoutMs = config->Get<int>("Networking.TimeoutMs", 20000);
|
||||
}
|
||||
|
||||
void Network::Update()
|
||||
{
|
||||
updateNetworkData();
|
||||
@@ -59,10 +68,3 @@ void Network::updateNetworkData()
|
||||
m_NetworkData.DataReceivedThisInterval = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Network::initialize()
|
||||
{
|
||||
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
m_MaxConnections = config->Get<int>("Networking.MaxConnections", 8);
|
||||
m_TimeoutMs = config->Get<int>("Networking.TimeoutMs", 20000);
|
||||
}
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
#include "Network/Server.h"
|
||||
|
||||
Server::Server() : m_Socket(m_IOService, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 27666))
|
||||
Server::Server(World* world, EventBroker* eventBroker, int port)
|
||||
: Network(world, eventBroker)
|
||||
{
|
||||
Network::initialize();
|
||||
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
snapshotInterval = 1000 * config->Get<float>("Networking.SnapshotInterval", 0.05f);
|
||||
pingIntervalMs = config->Get<float>("Networking.PingIntervalMs", 1000);
|
||||
|
||||
}
|
||||
|
||||
Server::~Server()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Server::Start(World* world, EventBroker* eventBroker)
|
||||
{
|
||||
m_World = world;
|
||||
m_EventBroker = eventBroker;
|
||||
// Subscribe to events
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Server::OnInputCommand);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Server::OnPlayerSpawned);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &Server::OnEntityDeleted);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted);
|
||||
LOG_INFO("I am Server. BIP BOP\n");
|
||||
|
||||
// Bind
|
||||
if (port == 0) {
|
||||
port = config->Get<float>("Networking.Port", 27666);
|
||||
}
|
||||
m_Port = port;
|
||||
m_Socket = std::make_unique<boost::asio::ip::udp::socket>(m_IOService, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), port));
|
||||
LOG_INFO("Server initialized and bound to port %i", port);
|
||||
}
|
||||
|
||||
Server::~Server()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Server::Update()
|
||||
@@ -38,7 +39,7 @@ void Server::Update()
|
||||
|
||||
void Server::readFromClients()
|
||||
{
|
||||
while (m_Socket.available()) {
|
||||
while (m_Socket->available()) {
|
||||
try {
|
||||
bytesRead = receive(readBuffer);
|
||||
Packet packet(readBuffer, bytesRead);
|
||||
@@ -105,7 +106,7 @@ void Server::parseMessageType(Packet& packet)
|
||||
|
||||
size_t Server::receive(char * data)
|
||||
{
|
||||
size_t length = m_Socket.receive_from(
|
||||
size_t length = m_Socket->receive_from(
|
||||
boost::asio::buffer((void*)data
|
||||
, INPUTSIZE)
|
||||
, m_ReceiverEndpoint, 0);
|
||||
@@ -121,7 +122,7 @@ size_t Server::receive(char * data)
|
||||
void Server::send(PlayerID player, Packet& packet)
|
||||
{
|
||||
try {
|
||||
size_t bytesSent = m_Socket.send_to(
|
||||
size_t bytesSent = m_Socket->send_to(
|
||||
boost::asio::buffer(packet.Data(), packet.Size()),
|
||||
m_ConnectedPlayers[player].Endpoint,
|
||||
0);
|
||||
@@ -139,7 +140,7 @@ void Server::send(PlayerID player, Packet& packet)
|
||||
|
||||
void Server::send(Packet & packet)
|
||||
{
|
||||
m_Socket.send_to(
|
||||
m_Socket->send_to(
|
||||
boost::asio::buffer(
|
||||
packet.Data(),
|
||||
packet.Size()),
|
||||
@@ -164,10 +165,24 @@ void Server::broadcast(Packet& packet)
|
||||
void Server::sendSnapshot()
|
||||
{
|
||||
Packet packet(MessageType::Snapshot);
|
||||
addInputCommandsToPacket(packet);
|
||||
addChildrenToPacket(packet, EntityID_Invalid);
|
||||
broadcast(packet);
|
||||
}
|
||||
|
||||
void Server::addInputCommandsToPacket(Packet& packet)
|
||||
{
|
||||
// Number of input commands
|
||||
packet.WritePrimitive(m_InputCommandsToBroadcast.size());
|
||||
for (auto& command : m_InputCommandsToBroadcast) {
|
||||
packet.WritePrimitive(command.PlayerID);
|
||||
packet.WritePrimitive(m_ConnectedPlayers.at(command.PlayerID).EntityID);
|
||||
packet.WriteString(command.Command);
|
||||
packet.WritePrimitive(command.Value);
|
||||
}
|
||||
m_InputCommandsToBroadcast.clear();
|
||||
}
|
||||
|
||||
void Server::addChildrenToPacket(Packet & packet, EntityID entityID)
|
||||
{
|
||||
auto itPair = m_World->GetChildren(entityID);
|
||||
@@ -239,8 +254,8 @@ void Server::checkForTimeOuts()
|
||||
double stopPing = 1000 * m_ConnectedPlayers[i].StopTime /
|
||||
static_cast<double>(CLOCKS_PER_SEC);
|
||||
if (startPing > stopPing + m_TimeoutMs) {
|
||||
LOG_INFO("User %i timed out!", i);
|
||||
disconnect(i);
|
||||
//LOG_INFO("User %i timed out!", i);
|
||||
//disconnect(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,6 +287,10 @@ void Server::parseOnInputCommand(Packet& packet)
|
||||
e.Player = EntityWrapper(m_World, m_ConnectedPlayers.at(player).EntityID);
|
||||
e.Value = packet.ReadPrimitive<float>();
|
||||
m_EventBroker->Publish(e);
|
||||
|
||||
if (e.Command == "PrimaryFire") {
|
||||
m_InputCommandsToBroadcast.push_back(e);
|
||||
}
|
||||
//LOG_INFO("Server::parseOnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||
|
||||
if(skeleton == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -24,7 +22,7 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
||||
const Skeleton::Animation* animation = skeleton->GetAnimation(animationComponent["AnimationName" + std::to_string(i)]);
|
||||
|
||||
if (animation == nullptr) {
|
||||
return;
|
||||
continue;;
|
||||
}
|
||||
|
||||
double animationSpeed = (double)animationComponent["Speed" + std::to_string(i)];
|
||||
@@ -33,21 +31,55 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
||||
double nextTime = (double)animationComponent["Time" + std::to_string(i)] + animationSpeed * dt;
|
||||
|
||||
|
||||
if (!(bool)animationComponent["Loop" + std::to_string(i)] && glm::abs(nextTime) > animation->Duration) {
|
||||
(double&)animationComponent["Time" + std::to_string(i)] = glm::sign(nextTime) * animation->Duration;
|
||||
if (!(bool)animationComponent["Loop" + std::to_string(i)]) {
|
||||
if (nextTime > animation->Duration) {
|
||||
nextTime = animation->Duration;
|
||||
} else if (nextTime < 0) {
|
||||
nextTime = 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 {
|
||||
if (glm::abs(nextTime) > animation->Duration) {
|
||||
(double&)animationComponent["Time" + std::to_string(i)] = glm::abs(nextTime) - animation->Duration;
|
||||
} else {
|
||||
(double&)animationComponent["Time" + std::to_string(i)] = nextTime;
|
||||
if (nextTime > animation->Duration) {
|
||||
nextTime -= animation->Duration;
|
||||
} else if (nextTime < 0) {
|
||||
nextTime += animation->Duration;
|
||||
}
|
||||
}
|
||||
|
||||
(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user