Compare commits
126 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d666bd893d | |||
| ba69c79821 | |||
| 2c3122bbdb | |||
| 7d732c75ca | |||
| 78e318c032 | |||
| bb66f95d43 | |||
| cc422cf73a | |||
| 2e5ee633ce | |||
| 1e04244590 | |||
| d357e365cb | |||
| a8a3366e8a | |||
| 7de76376cf | |||
| 787eecce26 | |||
| a15e01596a | |||
| b5e372896f | |||
| a54156fab3 | |||
| a20707739e | |||
| 4f7a17ff62 | |||
| 47053285c8 | |||
| bee0630a26 | |||
| 1dc3756533 | |||
| 196469299f | |||
| e1196204eb | |||
| b9ea314232 | |||
| 71533b52ae | |||
| 6442254575 | |||
| 9f8b0f7aa9 | |||
| 021c4e36d7 | |||
| 02253ea6e1 | |||
| 2417175914 | |||
| fb5164221f | |||
| 88c7c57671 | |||
| 5295133311 | |||
| baff8301b3 | |||
| 3e42c067ab | |||
| 3b42f5dbf4 | |||
| 40ae2b8cbb | |||
| f1c2413cf9 | |||
| 11af6a3078 | |||
| 0370775820 | |||
| a36ed76a4e | |||
| af30e51564 | |||
| e24a84c52d | |||
| 04f77da6f1 | |||
| 30f454e6a4 | |||
| 648d864d6e | |||
| e473194671 | |||
| b761439c84 | |||
| 44a73ef883 | |||
| c1860ae383 | |||
| c4c53944d9 | |||
| bdec4f9d16 | |||
| 7cae84d4ee | |||
| 4964e732ca | |||
| 1bb1a1445e | |||
| d1213f9f59 | |||
| dd131e7652 | |||
| 70f4002d70 | |||
| b66e3d3630 | |||
| 06f614b3bb | |||
| 4a17e3c8f3 | |||
| 22e35489d7 | |||
| 055f6517a1 | |||
| afd9e24df6 | |||
| 851418b1de | |||
| fee50ba3b6 | |||
| 5bcadd5b1a | |||
| 42d810b198 | |||
| 3a15550b57 | |||
| 8f500965d4 | |||
| bd385a0d59 | |||
| 5e05e51309 | |||
| fee1ed6d6d | |||
| f79649cf9a | |||
| 2096779eb6 | |||
| 99747c518e | |||
| f088aa1d85 | |||
| 0af337bf39 | |||
| 6caa7e94a4 | |||
| e2a8605101 | |||
| c8c4879554 | |||
| 14054ad898 | |||
| e47201ff61 | |||
| 1d14094e90 | |||
| 3301f66ad1 | |||
| 49d4a45ef8 | |||
| e0c3a32e66 | |||
| 97b915f130 | |||
| c9f815fd42 | |||
| 8eea0c8395 | |||
| 38a3e88999 | |||
| 4e23e7bf30 | |||
| a8ab49f202 | |||
| 7d4a4ed7cf | |||
| fa2e556ab2 | |||
| 97de31be65 | |||
| 2f640d224c | |||
| f11bd24d53 | |||
| 607150189c | |||
| ecc473d520 | |||
| 73f59b89cc | |||
| 92e7d3ecf7 | |||
| 4b8f4981a3 | |||
| eb244f87c4 | |||
| 675a80e905 | |||
| ec54b1298d | |||
| a53ab7f745 | |||
| 95fa1f4bbd | |||
| 7cbdc33f84 | |||
| 9645169797 | |||
| 4f2ad3ad00 | |||
| b6b96c5f11 | |||
| 2ec30fd2b2 | |||
| d2ed293183 | |||
| e9f5a3d263 | |||
| 8bdf87da12 | |||
| 971fee4a0c | |||
| fccd8c64e7 | |||
| 0e9fb16399 | |||
| db5301ff2c | |||
| ba9419b342 | |||
| 88d7b79cd3 | |||
| 9232b24a7b | |||
| 774e17ffc9 | |||
| 7bf4f5c30e | |||
| e133791369 |
+1
-1
Submodule assets updated: b040545bc3...078e014f3d
@@ -20,6 +20,9 @@
|
|||||||
class World;
|
class World;
|
||||||
struct ComponentWrapper;
|
struct ComponentWrapper;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class Octree;
|
||||||
|
|
||||||
namespace Collision
|
namespace Collision
|
||||||
{
|
{
|
||||||
//Return true if the ray hits the box.
|
//Return true if the ray hits the box.
|
||||||
@@ -44,21 +47,24 @@ bool RayVsTriangle(const Ray& ray,
|
|||||||
float& outVCoord,
|
float& outVCoord,
|
||||||
bool trueOnNegativeDistance = false);
|
bool trueOnNegativeDistance = false);
|
||||||
//Return true if the ray hits any of the triangles in the model. Stops checking when a hit is detected.
|
//Return true if the ray hits any of the triangles in the model. Stops checking when a hit is detected.
|
||||||
bool RayVsModel(const Ray& ray,
|
bool RayVsModel(const Ray& ray,
|
||||||
const std::vector<RawModel::Vertex>& modelVertices,
|
const RawModel::Vertex* modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices);
|
const std::vector<unsigned int>& modelIndices,
|
||||||
|
const glm::mat4& modelMatrix);
|
||||||
//Return true if the ray hits any of the triangles in the model.
|
//Return true if the ray hits any of the triangles in the model.
|
||||||
//Also returns the position of the intersection point. Will loop through all the whole model indices.
|
//Also returns the position of the intersection point. Will loop through all the whole model indices.
|
||||||
bool RayVsModel(const Ray& ray,
|
bool RayVsModel(const Ray& ray,
|
||||||
const std::vector<RawModel::Vertex>& modelVertices,
|
const RawModel::Vertex* modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices,
|
||||||
|
const glm::mat4& modelMatrix,
|
||||||
glm::vec3& outHitPosition);
|
glm::vec3& outHitPosition);
|
||||||
//Return true if the ray hits any of the triangles in the model.
|
//Return true if the ray hits any of the triangles in the model.
|
||||||
//Also returns the distance from the ray origin to the closest
|
//Also returns the distance from the ray origin to the closest
|
||||||
//intersection point, and the barycentric u,v-coordinates. Will loop through all the whole model indices.
|
//intersection point, and the barycentric u,v-coordinates. Will loop through all the whole model indices.
|
||||||
bool RayVsModel(const Ray& ray,
|
bool RayVsModel(const Ray& ray,
|
||||||
const std::vector<RawModel::Vertex>& modelVertices,
|
const RawModel::Vertex* modelVertices,
|
||||||
const std::vector<unsigned int>& modelIndices,
|
const std::vector<unsigned int>& modelIndices,
|
||||||
|
const glm::mat4& modelMatrix,
|
||||||
float& outDistance,
|
float& outDistance,
|
||||||
float& outUCoord,
|
float& outUCoord,
|
||||||
float& outVCoord);
|
float& outVCoord);
|
||||||
@@ -81,6 +87,13 @@ bool AABBVsAABB(const AABB& a, const AABB& b, glm::vec3& minimumTranslation);
|
|||||||
// Calculates an absolute AABB from an entity AABB component
|
// Calculates an absolute AABB from an entity AABB component
|
||||||
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox = false);
|
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox = false);
|
||||||
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity);
|
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity);
|
||||||
|
//Returns the first entity hit by the input ray. entitiesPotentiallyHitSorted needs to be sorted
|
||||||
|
//by their distance to the ray, e.g. result from Octree<EntityAABB>::ObjectsPossiblyHitByRay.
|
||||||
|
//Returns boost::none if none was hit. outDistance will be the distance to the intersection point if the ray intersects.
|
||||||
|
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<EntityAABB> entitiesPotentiallyHitSorted, float& outDistance, glm::vec3& outIntersectPos);
|
||||||
|
//Returns the first entity hit by the input ray that exists in the octree.
|
||||||
|
//outDistance will be the distance to the intersection point if the ray intersects.
|
||||||
|
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, Octree<EntityAABB>* octree, float& outDistance, glm::vec3& outIntersectPos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef EAmmoPickup_h__
|
||||||
|
#define EAmmoPickup_h__
|
||||||
|
|
||||||
|
#include "EventBroker.h"
|
||||||
|
#include "../Core/EntityWrapper.h"
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct AmmoPickup : Event
|
||||||
|
{
|
||||||
|
EntityWrapper Player;
|
||||||
|
int AmmoGain;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -9,8 +9,8 @@ namespace Events
|
|||||||
|
|
||||||
struct PlayerDamage : Event
|
struct PlayerDamage : Event
|
||||||
{
|
{
|
||||||
//NOTE: this struct is missing information on what the damageSource is
|
EntityWrapper Inflictor;
|
||||||
EntityWrapper Player;
|
EntityWrapper Victim;
|
||||||
double Damage;
|
double Damage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ namespace Events
|
|||||||
|
|
||||||
struct Shoot : Event
|
struct Shoot : Event
|
||||||
{
|
{
|
||||||
EntityWrapper Player;
|
EntityWrapper Inflictor;
|
||||||
|
double Damage;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ public:
|
|||||||
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects);
|
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects);
|
||||||
//Get the objects that are inside the frustum, the objects are put in outObjects.
|
//Get the objects that are inside the frustum, the objects are put in outObjects.
|
||||||
void ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObjects);
|
void ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObjects);
|
||||||
|
//Get objects, which AABB the input ray intersects, the objects are put in outObjects.
|
||||||
|
void ObjectsPossiblyHitByRay(const Ray& ray, std::vector<T>& outObjects);
|
||||||
//Empty the tree of all objects, static and dynamic.
|
//Empty the tree of all objects, static and dynamic.
|
||||||
void ClearObjects();
|
void ClearObjects();
|
||||||
//Empty the tree of all dynamic objects. Static objects remain in the tree.
|
//Empty the tree of all dynamic objects. Static objects remain in the tree.
|
||||||
@@ -100,6 +102,8 @@ struct Child
|
|||||||
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects) const;
|
void ObjectsInSameRegion(const Box& box, std::vector<T>& outObjects) const;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObjects, bool takeAllDontTest) const;
|
void ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObjects, bool takeAllDontTest) const;
|
||||||
|
template<typename T>
|
||||||
|
void ObjectsPossiblyHitByRay(const Ray& ray, std::vector<T>& outObjects) const;
|
||||||
void ClearObjects();
|
void ClearObjects();
|
||||||
void ClearDynamicObjects();
|
void ClearDynamicObjects();
|
||||||
bool RayCollides(const Ray& ray, Output& data) const;
|
bool RayCollides(const Ray& ray, Output& data) const;
|
||||||
@@ -119,6 +123,15 @@ struct Child
|
|||||||
std::vector<int> childIndicesContainingBox(const AABB& box) const;
|
std::vector<int> childIndicesContainingBox(const AABB& box) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//To be able to sort child nodes and contained objects based on distance to ray origin.
|
||||||
|
struct RaySorterInfo
|
||||||
|
{
|
||||||
|
int Index;
|
||||||
|
float Distance;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool isFirstLower(const RaySorterInfo& first, const RaySorterInfo& second);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -164,6 +177,13 @@ void Octree<T>::ObjectsInFrustum(const Frustum& frustum, std::vector<T>& outObje
|
|||||||
m_Root->ObjectsInFrustum(frustum, outObjects, false);
|
m_Root->ObjectsInFrustum(frustum, outObjects, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void Octree<T>::ObjectsPossiblyHitByRay(const Ray& ray, std::vector<T>& outObjects)
|
||||||
|
{
|
||||||
|
falsifyObjectChecks();
|
||||||
|
m_Root->ObjectsPossiblyHitByRay(ray, outObjects);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void Octree<T>::ClearObjects()
|
void Octree<T>::ClearObjects()
|
||||||
{
|
{
|
||||||
@@ -282,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
|
#endif
|
||||||
@@ -55,6 +55,7 @@ protected:
|
|||||||
//specialabilitys
|
//specialabilitys
|
||||||
bool m_MovementKeyDown = false;
|
bool m_MovementKeyDown = false;
|
||||||
bool m_SpecialAbilityKeyDown = false;
|
bool m_SpecialAbilityKeyDown = false;
|
||||||
|
int m_NumberOfMovementKeysDown = 0;
|
||||||
|
|
||||||
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
|
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
|
||||||
bool OnLockMouse(const Events::LockMouse& e);
|
bool OnLockMouse(const Events::LockMouse& e);
|
||||||
@@ -132,6 +133,7 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
|
|||||||
}
|
}
|
||||||
//if value = 0 then you have just released this key
|
//if value = 0 then you have just released this key
|
||||||
if (e.Value != 0) {
|
if (e.Value != 0) {
|
||||||
|
m_NumberOfMovementKeysDown++;
|
||||||
m_MovementKeyDown = true;
|
m_MovementKeyDown = true;
|
||||||
//if you pressed the same key within m_AssaultDashDoubleTapSensitivityTimer then you have doubletapped it
|
//if you pressed the same key within m_AssaultDashDoubleTapSensitivityTimer then you have doubletapped it
|
||||||
if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == m_CurrentDirectionVector) {
|
if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == m_CurrentDirectionVector) {
|
||||||
@@ -139,10 +141,14 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//== 0
|
//== 0
|
||||||
m_MovementKeyDown = false;
|
m_NumberOfMovementKeysDown--;
|
||||||
//you have just released the key, store what key it was and reset the doubletap-sensitivity-timer
|
if (m_NumberOfMovementKeysDown == 0) {
|
||||||
m_AssaultDashTapDirection = m_CurrentDirectionVector;
|
m_MovementKeyDown = false;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
}
|
||||||
|
//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_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
m_AssaultDashDoubleTapped = true;
|
m_AssaultDashDoubleTapped = true;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
//moving to the side has priority
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//dashing with doubletap - check if doubletap to dash enabled
|
|
||||||
if (ResourceManager::Load<ConfigFile>("Input.ini")->Get<bool>("Keyboard.DoubleTapToDash", false)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +216,11 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
m_AssaultDashDoubleTapped = false;
|
m_AssaultDashDoubleTapped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//dashing with doubletap - check if doubletap to dash enabled
|
||||||
|
if (!ResourceManager::Load<ConfigFile>("Input.ini")->Get<bool>("Keyboard.DoubleTapToDash", false)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//check if we have received a valid doubletap
|
//check if we have received a valid doubletap
|
||||||
if (!m_ValidDoubleTap) {
|
if (!m_ValidDoubleTap) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
#include "Network/Network.h"
|
#include "Network/Network.h"
|
||||||
#include "Network/MessageType.h"
|
#include "Network/MessageType.h"
|
||||||
#include "Network/PlayerDefinition.h"
|
#include "Network/PlayerDefinition.h"
|
||||||
|
#include "Network/UDPClient.h"
|
||||||
|
#include "Network/TCPClient.h"
|
||||||
#include "Network/SnapshotDefinitions.h"
|
#include "Network/SnapshotDefinitions.h"
|
||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
@@ -33,17 +35,15 @@ public:
|
|||||||
void Connect(std::string address, int port);
|
void Connect(std::string address, int port);
|
||||||
void Update() override;
|
void Update() override;
|
||||||
|
|
||||||
private:
|
std::vector<Events::PlayerSpawned> m_PlayerSpawnEvents;
|
||||||
|
void parseSpawnEvents();
|
||||||
|
// Save for children
|
||||||
std::unique_ptr<SnapshotFilter> m_SnapshotFilter = nullptr;
|
std::unique_ptr<SnapshotFilter> m_SnapshotFilter = nullptr;
|
||||||
|
|
||||||
// Assio UDP logic
|
std::string m_Address;
|
||||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
int m_Port = 0;
|
||||||
boost::asio::io_service m_IOService;
|
|
||||||
boost::asio::ip::udp::socket m_Socket;
|
|
||||||
|
|
||||||
// Sending message to server logic
|
// Sending message to server logic
|
||||||
size_t bytesRead = 0;
|
size_t bytesRead = 0;
|
||||||
char readBuf[INPUTSIZE] = { 0 };
|
|
||||||
|
|
||||||
// Packet loss logic
|
// Packet loss logic
|
||||||
PacketID m_PacketID = 0;
|
PacketID m_PacketID = 0;
|
||||||
@@ -72,16 +72,14 @@ private:
|
|||||||
std::vector<Events::InputCommand> m_InputCommandBuffer;
|
std::vector<Events::InputCommand> m_InputCommandBuffer;
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
void readFromServer();
|
|
||||||
size_t receive(char* data);
|
size_t receive(char* data);
|
||||||
void send(Packet& packet);
|
|
||||||
void connect();
|
|
||||||
void disconnect();
|
void disconnect();
|
||||||
void parseMessageType(Packet& packet);
|
void parseMessageType(Packet& packet);
|
||||||
void updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID);
|
void updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID);
|
||||||
SharedComponentWrapper createSharedComponent(Packet& packet, EntityID entityID, const ComponentInfo& componentInfo);
|
SharedComponentWrapper createSharedComponent(Packet& packet, EntityID entityID, const ComponentInfo& componentInfo);
|
||||||
void ignoreFields(Packet& packet, const ComponentInfo& componentInfo);
|
void ignoreFields(Packet& packet, const ComponentInfo& componentInfo);
|
||||||
void parseConnect(Packet& packet);
|
void parseUDPConnect(Packet& packet);
|
||||||
|
void parseTCPConnect(Packet& packet);
|
||||||
void parsePlayerConnected(Packet& packet);
|
void parsePlayerConnected(Packet& packet);
|
||||||
void parsePing();
|
void parsePing();
|
||||||
void parseKick();
|
void parseKick();
|
||||||
@@ -91,7 +89,7 @@ private:
|
|||||||
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
||||||
void parseSnapshot(Packet& packet);
|
void parseSnapshot(Packet& packet);
|
||||||
void identifyPacketLoss();
|
void identifyPacketLoss();
|
||||||
bool hasServerTimedOut();
|
void hasServerTimedOut();
|
||||||
EntityID createPlayer();
|
EntityID createPlayer();
|
||||||
void sendInputCommands();
|
void sendInputCommands();
|
||||||
void sendLocalPlayerTransform();
|
void sendLocalPlayerTransform();
|
||||||
@@ -111,6 +109,10 @@ private:
|
|||||||
bool OnPlayerDamage(const Events::PlayerDamage& e);
|
bool OnPlayerDamage(const Events::PlayerDamage& e);
|
||||||
EventRelay<Client, Events::PlayerSpawned> m_EPlayerSpawned;
|
EventRelay<Client, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||||
bool OnPlayerSpawned(const Events::PlayerSpawned& e);
|
bool OnPlayerSpawned(const Events::PlayerSpawned& e);
|
||||||
|
void parsePlayerDamage(Packet& packet);
|
||||||
|
private:
|
||||||
|
UDPClient m_Unreliable;
|
||||||
|
TCPClient m_Reliable;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef HybridClient_h__
|
||||||
|
#define HybridClient_h__
|
||||||
|
|
||||||
|
class HybridClient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HybridClient();
|
||||||
|
~HybridClient();
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef HybridServer_h__
|
||||||
|
#define HybridServer_h__
|
||||||
|
|
||||||
|
class HybridServer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HybridServer();
|
||||||
|
~HybridServer();
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -18,7 +18,8 @@ enum class MessageType
|
|||||||
OnPlayerSpawned,
|
OnPlayerSpawned,
|
||||||
EntityDeleted,
|
EntityDeleted,
|
||||||
ComponentDeleted,
|
ComponentDeleted,
|
||||||
PlayerTransform
|
PlayerTransform,
|
||||||
|
Invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#define INPUTSIZE 32000
|
#define BUFFERSIZE 32000
|
||||||
typedef unsigned int PlayerID;
|
typedef unsigned int PlayerID;
|
||||||
typedef unsigned int PacketID;
|
typedef unsigned int PacketID;
|
||||||
|
|
||||||
@@ -35,6 +35,8 @@ protected:
|
|||||||
std::clock_t m_SaveDataTimer;
|
std::clock_t m_SaveDataTimer;
|
||||||
unsigned int m_MaxConnections;
|
unsigned int m_MaxConnections;
|
||||||
double m_TimeoutMs;
|
double m_TimeoutMs;
|
||||||
|
void logSentData(int bytesSent);
|
||||||
|
void logReceivedData(int bytesReceived);
|
||||||
void saveToFile();
|
void saveToFile();
|
||||||
void updateNetworkData();
|
void updateNetworkData();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef NetworkClient_h__
|
||||||
|
#define NetworkClient_h__
|
||||||
|
|
||||||
|
#include "Network/Packet.h"
|
||||||
|
#define BUFFERSIZE 64000
|
||||||
|
typedef unsigned int PlayerID;
|
||||||
|
typedef unsigned int PacketID;
|
||||||
|
|
||||||
|
class NetworkClient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void Connect(std::string playerName, std::string address, int port) = 0;
|
||||||
|
virtual void Disconnect() = 0;
|
||||||
|
virtual void Receive(Packet& packet) = 0;
|
||||||
|
virtual void Send(Packet & packet) = 0;
|
||||||
|
virtual bool IsSocketAvailable() = 0;
|
||||||
|
protected:
|
||||||
|
char m_ReadBuffer[BUFFERSIZE] = { 0 };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef NetworkServer_h__
|
||||||
|
#define NetworkServer_h__
|
||||||
|
#include <boost/asio.hpp>
|
||||||
|
#include "Network/Packet.h"
|
||||||
|
#include "Network/PlayerDefinition.h"
|
||||||
|
#define BUFFERSIZE 64000
|
||||||
|
typedef unsigned int PlayerID;
|
||||||
|
typedef unsigned int PacketID;
|
||||||
|
|
||||||
|
class NetworkServer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers) = 0;
|
||||||
|
virtual void Receive(Packet & packet, PlayerDefinition & playerDefinition) = 0;
|
||||||
|
virtual void Send(Packet & packet, PlayerDefinition & playerDefinition) = 0;
|
||||||
|
virtual void Send(Packet & packet) = 0;
|
||||||
|
protected:
|
||||||
|
char m_ReadBuffer[BUFFERSIZE] = { 0 };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -49,10 +49,15 @@ public:
|
|||||||
void WriteData(char* data, int sizeOfData);
|
void WriteData(char* data, int sizeOfData);
|
||||||
// Pops the first element as if it was a string.
|
// Pops the first element as if it was a string.
|
||||||
std::string ReadString();
|
std::string ReadString();
|
||||||
|
// Construct a packet
|
||||||
|
void ReconstructFromData(char* data, size_t SizeOfData);
|
||||||
|
// Update size of packet variable in header
|
||||||
|
void UpdateSize();
|
||||||
char* ReadData(int SizeOfData);
|
char* ReadData(int SizeOfData);
|
||||||
void ChangePacketID(unsigned int& packetID);
|
void ChangePacketID(unsigned int& packetID);
|
||||||
size_t Size() { return m_Offset; };
|
size_t Size() { return m_Offset; };
|
||||||
char* Data() { return m_Data; };
|
char* Data() { return m_Data; };
|
||||||
|
MessageType GetMessageType();
|
||||||
size_t DataReadSize() { return m_ReturnDataOffset; }
|
size_t DataReadSize() { return m_ReturnDataOffset; }
|
||||||
size_t MaxSize() { return m_MaxPacketSize; }
|
size_t MaxSize() { return m_MaxPacketSize; }
|
||||||
size_t HeaderSize() { return m_HeaderSize; }
|
size_t HeaderSize() { return m_HeaderSize; }
|
||||||
@@ -64,6 +69,7 @@ private:
|
|||||||
size_t m_MaxPacketSize = 512;
|
size_t m_MaxPacketSize = 512;
|
||||||
size_t m_HeaderSize = 0;
|
size_t m_HeaderSize = 0;
|
||||||
void resizeData();
|
void resizeData();
|
||||||
|
void resizeData(int size);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
#define PlayerDefinition_h__
|
#define PlayerDefinition_h__
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../Core/Entity.h"
|
#include "../Core/Entity.h"
|
||||||
|
#include <boost/asio.hpp>
|
||||||
|
|
||||||
struct PlayerDefinition {
|
struct PlayerDefinition {
|
||||||
::EntityID EntityID = EntityID_Invalid;
|
::EntityID EntityID = EntityID_Invalid;
|
||||||
@@ -9,6 +10,10 @@ struct PlayerDefinition {
|
|||||||
boost::asio::ip::udp::endpoint Endpoint;
|
boost::asio::ip::udp::endpoint Endpoint;
|
||||||
unsigned int PacketID;
|
unsigned int PacketID;
|
||||||
std::clock_t StopTime;
|
std::clock_t StopTime;
|
||||||
|
boost::asio::ip::address TCPAddress;
|
||||||
|
unsigned short TCPPort;
|
||||||
|
// use for tcp connections
|
||||||
|
boost::shared_ptr<boost::asio::ip::tcp::socket> TCPSocket;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#include <glm/common.hpp>
|
#include <glm/common.hpp>
|
||||||
#include <boost/asio/ip/udp.hpp>
|
|
||||||
|
|
||||||
|
#include "Network/TCPServer.h"
|
||||||
|
#include "Network/UDPServer.h"
|
||||||
#include "Network/MessageType.h"
|
#include "Network/MessageType.h"
|
||||||
#include "Network/PlayerDefinition.h"
|
#include "Network/PlayerDefinition.h"
|
||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
@@ -28,28 +29,29 @@ public:
|
|||||||
void Update() override;
|
void Update() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Network channels
|
||||||
|
TCPServer m_Reliable;
|
||||||
|
UDPServer m_Unreliable;
|
||||||
|
// dont forget to set these in the childrens receive logic
|
||||||
|
boost::asio::ip::address m_Address;
|
||||||
int m_Port = 27666;
|
int m_Port = 27666;
|
||||||
// UDP logic
|
|
||||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
|
||||||
boost::asio::io_service m_IOService;
|
|
||||||
std::unique_ptr<boost::asio::ip::udp::socket> m_Socket;
|
|
||||||
|
|
||||||
// Sending messages to client logic
|
// Sending messages to client logic
|
||||||
std::map<PlayerID, PlayerDefinition> m_ConnectedPlayers;
|
std::map<PlayerID, PlayerDefinition> m_ConnectedPlayers;
|
||||||
|
std::vector<PlayerID> m_PlayersToDisconnect;
|
||||||
// HACK: Fix INPUTSIZE
|
// HACK: Fix INPUTSIZE
|
||||||
char readBuffer[INPUTSIZE] = { 0 };
|
char readBuffer[BUFFERSIZE] = { 0 };
|
||||||
size_t bytesRead = 0;
|
size_t bytesRead = 0;
|
||||||
// time for previouse message
|
// time for previouse message
|
||||||
std::clock_t previousePingMessage = std::clock();
|
std::clock_t previousePingMessage = std::clock();
|
||||||
std::clock_t previousSnapshotMessage = std::clock();
|
std::clock_t previousSnapshotMessage = std::clock();
|
||||||
std::clock_t timOutTimer = std::clock();
|
std::clock_t timOutTimer = std::clock();
|
||||||
|
|
||||||
// How often we send messages (milliseconds)
|
// How often we send messages (milliseconds)
|
||||||
float pingIntervalMs;
|
float pingIntervalMs;
|
||||||
float snapshotInterval;
|
float snapshotInterval;
|
||||||
int checkTimeOutInterval = 100;
|
int checkTimeOutInterval = 100;
|
||||||
int m_NextPlayerID = 0;
|
int m_NextPlayerID = 0;
|
||||||
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
||||||
|
|
||||||
//Timers
|
//Timers
|
||||||
std::clock_t m_StartPingTime;
|
std::clock_t m_StartPingTime;
|
||||||
|
|
||||||
@@ -58,11 +60,9 @@ private:
|
|||||||
PacketID m_PreviousPacketID = 0;
|
PacketID m_PreviousPacketID = 0;
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
size_t receive(char* data);
|
//int receive(char* data);
|
||||||
void readFromClients();
|
void reliableBroadcast(Packet& packet);
|
||||||
void send(PlayerID player, Packet& packet);
|
void unreliableBroadcast(Packet& packet);
|
||||||
void send(Packet& packet);
|
|
||||||
void broadcast(Packet& packet);
|
|
||||||
void sendSnapshot();
|
void sendSnapshot();
|
||||||
void addChildrenToPacket(Packet& packet, EntityID entityID);
|
void addChildrenToPacket(Packet& packet, EntityID entityID);
|
||||||
void addInputCommandsToPacket(Packet& packet);
|
void addInputCommandsToPacket(Packet& packet);
|
||||||
@@ -70,15 +70,19 @@ private:
|
|||||||
void checkForTimeOuts();
|
void checkForTimeOuts();
|
||||||
void disconnect(PlayerID playerID);
|
void disconnect(PlayerID playerID);
|
||||||
void parseMessageType(Packet& packet);
|
void parseMessageType(Packet& packet);
|
||||||
void parseOnInputCommand(Packet& packet);
|
|
||||||
void parseOnPlayerDamage(Packet& packet);
|
void parseOnPlayerDamage(Packet& packet);
|
||||||
void parseConnect(Packet& packet);
|
|
||||||
void parseDisconnect();
|
|
||||||
void parseClientPing();
|
|
||||||
void parsePing();
|
|
||||||
void identifyPacketLoss();
|
void identifyPacketLoss();
|
||||||
void kick(PlayerID player);
|
void kick(PlayerID player);
|
||||||
PlayerID GetPlayerIDFromEndpoint(boost::asio::ip::udp::endpoint endpoint);
|
PlayerID GetPlayerIDFromEndpoint();
|
||||||
|
void parsePlayerTransform(Packet& packet);
|
||||||
|
void parseOnInputCommand(Packet& packet);
|
||||||
|
void parseClientPing();
|
||||||
|
void parsePing();
|
||||||
|
void parseUDPConnect(Packet & packet);
|
||||||
|
void parseTCPConnect(Packet & packet);
|
||||||
|
void parseDisconnect();
|
||||||
|
bool shouldSendToClient(EntityWrapper childEntity);
|
||||||
|
|
||||||
// Debug event
|
// Debug event
|
||||||
EventRelay<Server, Events::InputCommand> m_EInputCommand;
|
EventRelay<Server, Events::InputCommand> m_EInputCommand;
|
||||||
bool OnInputCommand(const Events::InputCommand& e);
|
bool OnInputCommand(const Events::InputCommand& e);
|
||||||
@@ -88,7 +92,8 @@ private:
|
|||||||
bool OnEntityDeleted(const Events::EntityDeleted& e);
|
bool OnEntityDeleted(const Events::EntityDeleted& e);
|
||||||
EventRelay<Server, Events::ComponentDeleted> m_EComponentDeleted;
|
EventRelay<Server, Events::ComponentDeleted> m_EComponentDeleted;
|
||||||
bool OnComponentDeleted(const Events::ComponentDeleted& e);
|
bool OnComponentDeleted(const Events::ComponentDeleted& e);
|
||||||
void parsePlayerTransform(Packet& packet);
|
EventRelay<Server, Events::PlayerDamage> m_EPlayerDamage;
|
||||||
|
bool OnPlayerDamage(const Events::PlayerDamage& e);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef TCPClient_h__
|
||||||
|
#define TCPClient_h__
|
||||||
|
|
||||||
|
#include <boost/asio.hpp>
|
||||||
|
#include "NetworkClient.h"
|
||||||
|
|
||||||
|
class TCPClient : public NetworkClient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TCPClient();
|
||||||
|
~TCPClient();
|
||||||
|
|
||||||
|
void Connect(std::string playerName, std::string address, int port);
|
||||||
|
void Disconnect();
|
||||||
|
void Receive(Packet& packet);
|
||||||
|
void Send(Packet & packet);
|
||||||
|
bool IsSocketAvailable();
|
||||||
|
private:
|
||||||
|
// Assio TCP logic
|
||||||
|
boost::asio::ip::tcp::endpoint m_Endpoint;
|
||||||
|
boost::asio::io_service m_IOService;
|
||||||
|
std::unique_ptr<boost::asio::ip::tcp::socket> m_Socket;
|
||||||
|
size_t readBuffer(char* data);
|
||||||
|
PacketID m_SendPacketID = 0;
|
||||||
|
bool m_IsConnected = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#ifndef TCPServer_h__
|
||||||
|
#define TCPServer_h__
|
||||||
|
|
||||||
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
#include <map>
|
||||||
|
#include "NetworkServer.h"
|
||||||
|
|
||||||
|
class TCPServer : public NetworkServer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TCPServer();
|
||||||
|
~TCPServer();
|
||||||
|
void AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers);
|
||||||
|
void Receive(Packet & packet, PlayerDefinition & playerDefinition);
|
||||||
|
void Send(Packet & packet, PlayerDefinition & playerDefinition);
|
||||||
|
void Send(Packet & packet);
|
||||||
|
void Disconnect();
|
||||||
|
private:
|
||||||
|
// TCP logic
|
||||||
|
boost::asio::io_service m_IOService;
|
||||||
|
std::unique_ptr<boost::asio::ip::tcp::acceptor> acceptor;
|
||||||
|
boost::shared_ptr<boost::asio::ip::tcp::socket> lastReceivedSocket;
|
||||||
|
|
||||||
|
void handle_accept(boost::shared_ptr<boost::asio::ip::tcp::socket> socket,
|
||||||
|
int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers,
|
||||||
|
const boost::system::error_code& error);
|
||||||
|
int readBuffer(char* data, PlayerDefinition& playerDefinition);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef UDPClient_h__
|
||||||
|
#define UDPClient_h__
|
||||||
|
|
||||||
|
#include <boost/asio.hpp>
|
||||||
|
#include "Network/NetworkClient.h"
|
||||||
|
|
||||||
|
class UDPClient : public NetworkClient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UDPClient();
|
||||||
|
~UDPClient();
|
||||||
|
|
||||||
|
void Connect(std::string playerName, std::string address, int port);
|
||||||
|
void Disconnect();
|
||||||
|
void Receive(Packet& packet);
|
||||||
|
void Send(Packet & packet);
|
||||||
|
bool IsSocketAvailable();
|
||||||
|
private:
|
||||||
|
// Assio UDP logic
|
||||||
|
boost::asio::io_service m_IOService;
|
||||||
|
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||||
|
boost::shared_ptr<boost::asio::ip::udp::socket> m_Socket;
|
||||||
|
int readBuffer(char* data);
|
||||||
|
PacketID m_SendPacketID = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#ifndef UDPServer_h__
|
||||||
|
#define UDPServer_h__
|
||||||
|
|
||||||
|
#include "NetworkServer.h"
|
||||||
|
#include <boost/asio/ip/udp.hpp>
|
||||||
|
|
||||||
|
class UDPServer : public NetworkServer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UDPServer();
|
||||||
|
~UDPServer();
|
||||||
|
void AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers);
|
||||||
|
void Receive(Packet & packet, PlayerDefinition & playerDefinition);
|
||||||
|
void Send(Packet & packet, PlayerDefinition & playerDefinition);
|
||||||
|
void Send(Packet & packet);
|
||||||
|
bool IsSocketAvailable();
|
||||||
|
private:
|
||||||
|
// UDP logic
|
||||||
|
boost::asio::io_service m_IOService;
|
||||||
|
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||||
|
std::unique_ptr<boost::asio::ip::udp::socket> m_Socket;
|
||||||
|
int readBuffer(char* data);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -120,6 +120,32 @@ struct ModelJob : RenderJob
|
|||||||
|
|
||||||
if (model->IsSkinned()) {
|
if (model->IsSkinned()) {
|
||||||
Skeleton = Model->m_RawModel->m_Skeleton;
|
Skeleton = Model->m_RawModel->m_Skeleton;
|
||||||
|
|
||||||
|
if (Skeleton != nullptr) {
|
||||||
|
if (world->HasComponent(Entity, "Animation")) {
|
||||||
|
auto animationComponent = world->GetComponent(Entity, "Animation");
|
||||||
|
|
||||||
|
for (int i = 1; i <= 3; i++) {
|
||||||
|
::Skeleton::AnimationData animationData;
|
||||||
|
animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(animationComponent["AnimationName" + std::to_string(i)]);
|
||||||
|
if (animationData.animation == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
animationData.time = (double)animationComponent["Time" + std::to_string(i)];
|
||||||
|
animationData.weight = (double)animationComponent["Weight" + std::to_string(i)];
|
||||||
|
|
||||||
|
Animations.push_back(animationData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (world->HasComponent(Entity, "AnimationOffset")) {
|
||||||
|
auto animationOffsetComponent = world->GetComponent(Entity, "AnimationOffset");
|
||||||
|
AnimationOffset.animation = model->m_RawModel->m_Skeleton->GetAnimation(animationOffsetComponent["AnimationName"]);
|
||||||
|
AnimationOffset.time = (double)animationOffsetComponent["Time"];
|
||||||
|
} else {
|
||||||
|
AnimationOffset.animation = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -140,8 +166,8 @@ struct ModelJob : RenderJob
|
|||||||
glm::vec4 Color;
|
glm::vec4 Color;
|
||||||
const ::Model* Model = nullptr;
|
const ::Model* Model = nullptr;
|
||||||
::Skeleton* Skeleton = nullptr;
|
::Skeleton* Skeleton = nullptr;
|
||||||
// const ::Skeleton::Animation* Animation = nullptr;
|
std::vector<::Skeleton::AnimationData> Animations;
|
||||||
|
::Skeleton::AnimationOffset AnimationOffset;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,6 @@ private:
|
|||||||
|
|
||||||
int m_ColorCounter[2];
|
int m_ColorCounter[2];
|
||||||
std::map<std::tuple<EntityID, const World*, Camera*>, glm::ivec2> m_EntityColors;
|
std::map<std::tuple<EntityID, const World*, Camera*>, glm::ivec2> m_EntityColors;
|
||||||
|
|
||||||
Texture* m_WhiteTexture;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "../Core/EPlayerSpawned.h"
|
#include "../Core/EPlayerSpawned.h"
|
||||||
#include "../Core/Octree.h"
|
#include "../Core/Octree.h"
|
||||||
#include "../Collision/EntityAABB.h"
|
#include "../Collision/EntityAABB.h"
|
||||||
|
#include "../Core/ConfigFile.h"
|
||||||
|
|
||||||
class RenderSystem : public ImpureSystem
|
class RenderSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
@@ -48,6 +49,9 @@ private:
|
|||||||
void fillDirectionalLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
void fillDirectionalLights(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||||
void fillLight(std::list<std::shared_ptr<RenderJob>>& jobs);
|
void fillLight(std::list<std::shared_ptr<RenderJob>>& jobs);
|
||||||
void fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
void fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, World* world);
|
||||||
|
|
||||||
|
bool isEntityVisible(EntityWrapper& entity);
|
||||||
|
|
||||||
bool isChildOfACamera(EntityWrapper entity);
|
bool isChildOfACamera(EntityWrapper entity);
|
||||||
bool isChildOfCurrentCamera(EntityWrapper entity);
|
bool isChildOfCurrentCamera(EntityWrapper entity);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -100,50 +100,29 @@ public:
|
|||||||
|
|
||||||
int GetBoneID(std::string name);
|
int GetBoneID(std::string name);
|
||||||
|
|
||||||
void CalculateFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion = false);
|
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, AnimationOffset animationOffset, bool noRootMotion = false);
|
||||||
void CalculateFrameBones(std::vector<AnimationData> animations, bool noRootMotion = false);
|
std::vector<glm::mat4> GetFrameBones(std::vector<AnimationData> animations, bool noRootMotion = false);
|
||||||
|
|
||||||
const Animation* GetAnimation(std::string name);
|
const Animation* GetAnimation(std::string name);
|
||||||
|
|
||||||
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, const Bone* bone, glm::mat4 parentMatrix);
|
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, std::map<int, glm::mat4>& frameBones, const Bone* bone, glm::mat4 parentMatrix);
|
||||||
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, const Bone* bone, glm::mat4 parentMatrix);
|
void AccumulateBoneTransforms(bool noRootMotion, std::vector<AnimationData> animations, AnimationOffset animationOffset, std::map<int, glm::mat4>& frameBones, const Bone* bone, glm::mat4 parentMatrix);
|
||||||
|
|
||||||
void PrintSkeleton();
|
void PrintSkeleton();
|
||||||
void PrintSkeleton(const Bone* parent, int depthCount);
|
void PrintSkeleton(const Bone* parent, int depthCount);
|
||||||
std::map<std::string, Animation> Animations;
|
std::map<std::string, Animation> Animations;
|
||||||
|
|
||||||
glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix);
|
glm::mat4 GetBoneTransform(const Bone* bone, const Animation* animation, float time, glm::mat4 childMatrix);
|
||||||
|
glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, AnimationOffset animationOffset, glm::mat4 childMatrix);
|
||||||
|
glm::mat4 GetBoneTransform(bool noRootMotion, const Bone* bone, std::vector<AnimationData> animations, glm::mat4 childMatrix);
|
||||||
int GetKeyframe(const Animation& animation, double time);
|
int GetKeyframe(const Animation& animation, double time);
|
||||||
|
|
||||||
|
|
||||||
std::vector<glm::mat4> GetBones()
|
|
||||||
{
|
|
||||||
std::vector<glm::mat4> finalMatrices;
|
|
||||||
for (auto &kv : m_BoneLocalTransforms) {
|
|
||||||
finalMatrices.push_back(kv.second);
|
|
||||||
}
|
|
||||||
return finalMatrices;;
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::mat4 GetBoneTransformSuper(int boneID)
|
|
||||||
{
|
|
||||||
if(m_BoneTransforms.find(boneID) != m_BoneTransforms.end()) {
|
|
||||||
return m_BoneTransforms.at(boneID);
|
|
||||||
} else {
|
|
||||||
return glm::mat4(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset);
|
glm::mat4 GetOffsetTransform(const Bone* bone, AnimationOffset animationOffset);
|
||||||
|
|
||||||
std::map<std::string, Bone*> m_BonesByName;
|
std::map<std::string, Bone*> m_BonesByName;
|
||||||
float aim = 0.f;
|
|
||||||
|
|
||||||
|
|
||||||
std::map<int, glm::mat4> m_BoneLocalTransforms;
|
|
||||||
std::map<int, glm::mat4> m_BoneTransforms;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#ifndef AmmoPickupSystem_h__
|
||||||
|
#define AmmoPickupSystem_h__
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Core/Transform.h"
|
||||||
|
#include "Core/ResourceManager.h"
|
||||||
|
#include "Core/EntityFileParser.h"
|
||||||
|
#include "Core/EPickupSpawned.h"
|
||||||
|
#include "Core/EAmmoPickup.h"
|
||||||
|
#include "Engine/Collision/ETrigger.h"
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
|
class AmmoPickupSystem : public ImpureSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AmmoPickupSystem(SystemParams params);
|
||||||
|
|
||||||
|
virtual void Update(double dt) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
EventRelay<AmmoPickupSystem, Events::TriggerTouch> m_ETriggerTouch;
|
||||||
|
bool OnTriggerTouch(Events::TriggerTouch& e);
|
||||||
|
|
||||||
|
struct NewAmmoPickup {
|
||||||
|
glm::vec3 Pos;
|
||||||
|
double AmmoGain;
|
||||||
|
double RespawnTimer;
|
||||||
|
double DecreaseThisRespawnTimer;
|
||||||
|
};
|
||||||
|
std::vector<NewAmmoPickup> m_ETriggerTouchVector;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef AmmunitionHUDSystem_h__
|
||||||
|
#define AmmunitionHUDSystem_h__
|
||||||
|
|
||||||
|
#include "../../Engine/Core/System.h"
|
||||||
|
#include "../../Engine/GLM.h"
|
||||||
|
|
||||||
|
class AmmunitionHUDSystem : public ImpureSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AmmunitionHUDSystem(SystemParams params)
|
||||||
|
: System(params)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual void Update(double dt) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -44,7 +44,6 @@ private:
|
|||||||
|
|
||||||
//std::vector<ComponentWrapper>
|
//std::vector<ComponentWrapper>
|
||||||
|
|
||||||
const double m_CaptureTimeToTakeOver = 15.0;
|
|
||||||
bool m_ResetTimers = false;
|
bool m_ResetTimers = false;
|
||||||
|
|
||||||
//vectors which will keep track of enter/leave changes
|
//vectors which will keep track of enter/leave changes
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef DamageIndicatorSystem_h__
|
||||||
|
#define DamageIndicatorSystem_h__
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Core/Transform.h"
|
||||||
|
#include "Core/ResourceManager.h"
|
||||||
|
#include "Core/EntityFileParser.h"
|
||||||
|
#include "Core/EPlayerDamage.h"
|
||||||
|
#include "Common.h"
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
|
#include "Rendering/ESetCamera.h"
|
||||||
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
#include <glm/gtx/vector_angle.hpp>
|
||||||
|
|
||||||
|
#include "Rendering/Util/CommonFunctions.h"
|
||||||
|
|
||||||
|
class DamageIndicatorSystem : public System
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DamageIndicatorSystem(SystemParams params);
|
||||||
|
|
||||||
|
private:
|
||||||
|
EventRelay<DamageIndicatorSystem, Events::PlayerDamage> m_EPlayerDamage;
|
||||||
|
bool OnPlayerDamage(Events::PlayerDamage& e);
|
||||||
|
|
||||||
|
EventRelay<DamageIndicatorSystem, Events::SetCamera> m_ESetCamera;
|
||||||
|
bool OnSetCamera(const Events::SetCamera& e);
|
||||||
|
|
||||||
|
EntityID m_CurrentCamera = -1;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@@ -3,13 +3,11 @@
|
|||||||
|
|
||||||
#include "../../Engine/Core/System.h"
|
#include "../../Engine/Core/System.h"
|
||||||
#include "../../Engine/GLM.h"
|
#include "../../Engine/GLM.h"
|
||||||
#include "../../Engine/Rendering/ESetCamera.h"
|
|
||||||
#include <imgui/imgui.h>
|
|
||||||
|
|
||||||
class PlayerHUDSystem : public ImpureSystem
|
class HealthHUDSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlayerHUDSystem(SystemParams params)
|
HealthHUDSystem(SystemParams params)
|
||||||
: System(params)
|
: System(params)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "Core/EPlayerDamage.h"
|
#include "Core/EPlayerDamage.h"
|
||||||
#include "Core/EPlayerHealthPickup.h"
|
#include "Core/EPlayerHealthPickup.h"
|
||||||
#include "Core/EPlayerDeath.h"
|
#include "Core/EPlayerDeath.h"
|
||||||
|
#include "../Engine/Input/EInputCommand.h"
|
||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -28,7 +29,9 @@ private:
|
|||||||
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e);
|
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e);
|
||||||
EventRelay<HealthSystem, Events::PlayerHealthPickup> m_EPlayerHealthPickup;
|
EventRelay<HealthSystem, Events::PlayerHealthPickup> m_EPlayerHealthPickup;
|
||||||
bool HealthSystem::OnPlayerHealthPickup(Events::PlayerHealthPickup& e);
|
bool HealthSystem::OnPlayerHealthPickup(Events::PlayerHealthPickup& e);
|
||||||
|
EventRelay<HealthSystem, Events::InputCommand> m_InputCommand;
|
||||||
|
bool HealthSystem::OnInputCommand(Events::InputCommand& e);
|
||||||
|
|
||||||
//vector which will keep track of health changes
|
//vector which will keep track of health changes
|
||||||
std::vector<std::tuple<EntityID, double>> m_DeltaHealthVector;
|
std::vector<std::tuple<EntityID, double>> m_DeltaHealthVector;
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
#include "Events/EDoubleJump.h"
|
#include "Events/EDoubleJump.h"
|
||||||
#include "../Engine/Sound/EPlaySoundOnEntity.h"
|
#include "../Engine/Sound/EPlaySoundOnEntity.h"
|
||||||
|
|
||||||
|
#include "Core/EntityFile.h"
|
||||||
|
#include "Core/EntityFileParser.h"
|
||||||
|
|
||||||
class PlayerMovementSystem : public ImpureSystem
|
class PlayerMovementSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ public:
|
|||||||
PlayerSpawnSystem(SystemParams params);
|
PlayerSpawnSystem(SystemParams params);
|
||||||
|
|
||||||
virtual void Update(double dt) override;
|
virtual void Update(double dt) override;
|
||||||
|
|
||||||
|
static void SetRespawnTime(float respawnTime) { m_RespawnTime = respawnTime; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct SpawnRequest
|
struct SpawnRequest
|
||||||
@@ -23,10 +25,19 @@ private:
|
|||||||
|
|
||||||
bool m_NetworkEnabled = false;
|
bool m_NetworkEnabled = false;
|
||||||
std::vector<SpawnRequest> m_SpawnRequests;
|
std::vector<SpawnRequest> m_SpawnRequests;
|
||||||
|
|
||||||
|
//Player ID -> EntityWrapper.
|
||||||
std::map<int, EntityWrapper> m_PlayerEntities;
|
std::map<int, EntityWrapper> m_PlayerEntities;
|
||||||
|
//EntityWrapper ID -> Player ID.
|
||||||
|
std::map<EntityID, int> m_PlayerIDs;
|
||||||
|
|
||||||
|
static float m_RespawnTime;
|
||||||
|
float m_Timer;
|
||||||
|
|
||||||
EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand;
|
EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand;
|
||||||
bool OnInputCommand(const Events::InputCommand& e);
|
bool OnInputCommand(Events::InputCommand& e);
|
||||||
EventRelay<PlayerSpawnSystem, Events::PlayerSpawned> m_OnPlayerSpawnerd;
|
EventRelay<PlayerSpawnSystem, Events::PlayerSpawned> m_OnPlayerSpawnerd;
|
||||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||||
|
EventRelay<PlayerSpawnSystem, Events::PlayerDeath> m_OnPlayerDeath;
|
||||||
|
bool OnPlayerDeath(Events::PlayerDeath& e);
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#include "Sound/EPlaySoundOnEntity.h"
|
||||||
|
#include "Collision/Collision.h"
|
||||||
|
#include "Rendering/AnimationSystem.h"
|
||||||
|
#include "Core/ConfigFile.h"
|
||||||
|
#include "WeaponBehaviour.h"
|
||||||
|
#include "../SpawnerSystem.h"
|
||||||
|
#include "Core/EPlayerDamage.h"
|
||||||
|
#include "Core/EShoot.h"
|
||||||
|
|
||||||
|
class AssaultWeaponBehaviour : public WeaponBehaviour
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AssaultWeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper weaponEntity);
|
||||||
|
|
||||||
|
virtual void Fire() override;
|
||||||
|
virtual void CeaseFire() override;
|
||||||
|
virtual void Reload() override;
|
||||||
|
|
||||||
|
virtual void Update(double dt) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
EntityWrapper m_FirstPersonModel;
|
||||||
|
EntityWrapper m_ThirdPersonModel;
|
||||||
|
// State
|
||||||
|
bool m_Firing = false;
|
||||||
|
bool m_Reloading = false;
|
||||||
|
double m_ReloadTimer = 0.0;
|
||||||
|
EntityWrapper m_FirstPersonReloadImpersonator;
|
||||||
|
EntityWrapper m_ThirdPersonReloadImpersonator;
|
||||||
|
double m_TimeSinceLastFire = 0.0;
|
||||||
|
|
||||||
|
EventRelay<WeaponBehaviour, Events::AnimationComplete> m_EAnimationComplete;
|
||||||
|
bool OnAnimationComplete(Events::AnimationComplete& e);
|
||||||
|
|
||||||
|
bool hasAmmo();
|
||||||
|
void fireRound();
|
||||||
|
void spawnTracer();
|
||||||
|
float traceRayDistance(glm::vec3 origin, glm::vec3 direction);
|
||||||
|
void playSound();
|
||||||
|
void viewPunch();
|
||||||
|
void finishReload();
|
||||||
|
void playShootAnimation();
|
||||||
|
void playIdleAnimation();
|
||||||
|
void playReloadAnimation();
|
||||||
|
bool shoot(double damage);
|
||||||
|
void showHitMarker();
|
||||||
|
};
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#ifndef WeaponBehaviour_h__
|
||||||
|
#define WeaponBehaviour_h__
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Rendering/IRenderer.h"
|
||||||
|
#include "Core/Octree.h"
|
||||||
|
#include "Collision/EntityAABB.h"
|
||||||
|
|
||||||
|
class WeaponBehaviour : public System
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WeaponBehaviour(SystemParams systemParams, IRenderer* renderer, Octree<EntityAABB>* collisionOctree, EntityWrapper player)
|
||||||
|
: System(systemParams)
|
||||||
|
, m_Renderer(renderer)
|
||||||
|
, m_CollisionOctree(collisionOctree)
|
||||||
|
, m_Player(player)
|
||||||
|
{ }
|
||||||
|
virtual ~WeaponBehaviour() = default;
|
||||||
|
|
||||||
|
WeaponBehaviour(const WeaponBehaviour&) = delete;
|
||||||
|
WeaponBehaviour& operator=(const WeaponBehaviour &) = delete;
|
||||||
|
|
||||||
|
virtual void Fire() = 0;
|
||||||
|
virtual void CeaseFire() { }
|
||||||
|
virtual void Reload() { }
|
||||||
|
virtual void Update(double dt) { }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
IRenderer* m_Renderer;
|
||||||
|
Octree<EntityAABB>* m_CollisionOctree;
|
||||||
|
EntityWrapper m_Player;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#ifndef WeaponSystem_h__
|
||||||
|
#define WeaponSystem_h__
|
||||||
|
|
||||||
|
#include "Rendering/IRenderer.h"
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
|
#include "Core/System.h"
|
||||||
|
#include "Core/EPlayerDamage.h"
|
||||||
|
#include "Core/EShoot.h"
|
||||||
|
#include "Core/EPlayerSpawned.h"
|
||||||
|
#include "Input/EInputCommand.h"
|
||||||
|
#include "Core/EntityFile.h"
|
||||||
|
#include "Core/EntityFileParser.h"
|
||||||
|
#include "Core/Octree.h"
|
||||||
|
#include "Collision/EntityAABB.h"
|
||||||
|
#include "Systems/SpawnerSystem.h"
|
||||||
|
#include "Sound/EPlaySoundOnEntity.h"
|
||||||
|
#include "AssaultWeaponBehaviour.h"
|
||||||
|
|
||||||
|
class WeaponSystem : public PureSystem, ImpureSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WeaponSystem(SystemParams params, IRenderer* renderer, Octree<EntityAABB>* collisionOctree);
|
||||||
|
|
||||||
|
virtual void Update(double dt) override;
|
||||||
|
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPlayer, double dt) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
SystemParams m_SystemParams;
|
||||||
|
IRenderer* m_Renderer;
|
||||||
|
Octree<EntityAABB>* m_CollisionOctree;
|
||||||
|
|
||||||
|
std::unordered_map<EntityWrapper, std::shared_ptr<WeaponBehaviour>> m_ActiveWeapons;
|
||||||
|
|
||||||
|
// Events
|
||||||
|
EventRelay<WeaponSystem, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||||
|
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||||
|
EventRelay<WeaponSystem, Events::InputCommand> m_EInputCommand;
|
||||||
|
bool OnInputCommand(Events::InputCommand& e);
|
||||||
|
|
||||||
|
void selectWeapon(EntityWrapper player, ComponentInfo::EnumType slot);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
#ifndef WeaponSystem_h__
|
|
||||||
#define WeaponSystem_h__
|
|
||||||
|
|
||||||
//#include <GLFW/glfw3.h>
|
|
||||||
//#include <glm/common.hpp>
|
|
||||||
#include "Rendering/IRenderer.h"
|
|
||||||
|
|
||||||
#include "Common.h"
|
|
||||||
#include "Core/System.h"
|
|
||||||
#include "Core/EPlayerDamage.h"
|
|
||||||
#include "Core/EShoot.h"
|
|
||||||
#include "Core/EPlayerSpawned.h"
|
|
||||||
#include "Input/EInputCommand.h"
|
|
||||||
#include "Core/EntityFile.h"
|
|
||||||
#include "Core/EntityFileParser.h"
|
|
||||||
#include "Core/Octree.h"
|
|
||||||
#include "Collision/EntityAABB.h"
|
|
||||||
#include "Systems/SpawnerSystem.h"
|
|
||||||
#include "Sound/EPlaySoundOnEntity.h"
|
|
||||||
|
|
||||||
class WeaponBehaviour;
|
|
||||||
|
|
||||||
class WeaponSystem : public PureSystem, ImpureSystem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WeaponSystem(SystemParams params, IRenderer* renderer, Octree<EntityAABB>* collisionOctree);
|
|
||||||
|
|
||||||
virtual void Update(double dt) override;
|
|
||||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPlayer, double dt) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
SystemParams m_SystemParams;
|
|
||||||
IRenderer* m_Renderer;
|
|
||||||
Octree<EntityAABB>* m_CollisionOctree;
|
|
||||||
|
|
||||||
std::unordered_map<EntityWrapper, std::shared_ptr<WeaponBehaviour>> m_ActiveWeapons;
|
|
||||||
|
|
||||||
// Events
|
|
||||||
EventRelay<WeaponSystem, Events::PlayerSpawned> m_EPlayerSpawned;
|
|
||||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
|
||||||
EventRelay<WeaponSystem, Events::Shoot> m_EShoot;
|
|
||||||
bool OnShoot(Events::Shoot& e);
|
|
||||||
EventRelay<WeaponSystem, Events::InputCommand> m_EInputCommand;
|
|
||||||
bool OnInputCommand(Events::InputCommand& e);
|
|
||||||
|
|
||||||
void selectWeapon(EntityWrapper player, ComponentInfo::EnumType slot);
|
|
||||||
};
|
|
||||||
|
|
||||||
class WeaponBehaviour : public System
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WeaponBehaviour(SystemParams systemParams, Octree<EntityAABB>* collisionOctree, EntityWrapper weaponEntity)
|
|
||||||
: System(systemParams)
|
|
||||||
, m_CollisionOctree(collisionOctree)
|
|
||||||
, m_Entity(weaponEntity)
|
|
||||||
{ }
|
|
||||||
virtual ~WeaponBehaviour() = default;
|
|
||||||
|
|
||||||
WeaponBehaviour(const WeaponBehaviour&) = delete;
|
|
||||||
WeaponBehaviour& operator=(const WeaponBehaviour &) = delete;
|
|
||||||
|
|
||||||
virtual void Fire() = 0;
|
|
||||||
virtual void CeaseFire() { }
|
|
||||||
virtual void Reload() { }
|
|
||||||
virtual void Update(double dt) { }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Octree<EntityAABB>* m_CollisionOctree;
|
|
||||||
EntityWrapper m_Entity;
|
|
||||||
};
|
|
||||||
|
|
||||||
class AssaultWeaponBehaviour : public WeaponBehaviour
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AssaultWeaponBehaviour(SystemParams systemParams, Octree<EntityAABB>* collisionOctree, EntityWrapper weaponEntity)
|
|
||||||
: WeaponBehaviour(systemParams, collisionOctree, weaponEntity)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
virtual void Fire() override
|
|
||||||
{
|
|
||||||
m_TimeSinceLastFire = 0.0;
|
|
||||||
m_Firing = true;
|
|
||||||
fireRound();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void CeaseFire() override
|
|
||||||
{
|
|
||||||
m_Firing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Reload() override
|
|
||||||
{
|
|
||||||
ComponentWrapper& cAssaultWeapon = m_Entity["AssaultWeapon"];
|
|
||||||
|
|
||||||
int& magAmmo = cAssaultWeapon["MagazineAmmo"];
|
|
||||||
int magSize = cAssaultWeapon["MagazineSize"];
|
|
||||||
int& ammo = cAssaultWeapon["Ammo"];
|
|
||||||
|
|
||||||
// Don't reload if we're already fully loaded
|
|
||||||
if (magAmmo == magSize) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Throw away rounds in magazine to incentivise ammo sharing
|
|
||||||
int toLoad = glm::min(magSize, ammo);
|
|
||||||
magAmmo = toLoad;
|
|
||||||
ammo -= toLoad;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Update(double dt) override
|
|
||||||
{
|
|
||||||
if (!m_Firing) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_TimeSinceLastFire += dt;
|
|
||||||
|
|
||||||
ComponentWrapper& cAssaultWeapon = m_Entity["AssaultWeapon"];
|
|
||||||
if (m_TimeSinceLastFire >= 1.0 / ((double)cAssaultWeapon["RPM"] / 60.0)) {
|
|
||||||
fireRound();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_Firing = false;
|
|
||||||
double m_TimeSinceLastFire = 0.0;
|
|
||||||
EntityFile* m_RayRed = nullptr;
|
|
||||||
EntityFile* m_RayBlue = nullptr;
|
|
||||||
|
|
||||||
void fireRound()
|
|
||||||
{
|
|
||||||
ComponentWrapper& cAssaultWeapon = m_Entity["AssaultWeapon"];
|
|
||||||
|
|
||||||
int& magAmmo = cAssaultWeapon["MagazineAmmo"];
|
|
||||||
int ammo = cAssaultWeapon["Ammo"];
|
|
||||||
|
|
||||||
// Reload if our magazine is empty
|
|
||||||
if (magAmmo <= 0) {
|
|
||||||
Reload();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fire
|
|
||||||
magAmmo -= 1;
|
|
||||||
spawnTracer();
|
|
||||||
playSound();
|
|
||||||
|
|
||||||
m_TimeSinceLastFire = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void spawnTracer()
|
|
||||||
{
|
|
||||||
if (!IsClient) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityWrapper spawner;
|
|
||||||
if (m_Entity == LocalPlayer) {
|
|
||||||
spawner = m_Entity.FirstChildByName("WeaponMuzzle");
|
|
||||||
} else {
|
|
||||||
spawner = m_Entity.FirstChildByName("ThirdPersonWeaponMuzzle");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!spawner.Valid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Events::SpawnerSpawn e;
|
|
||||||
e.Spawner = spawner;
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
float traceRayDistance(glm::vec3 origin, glm::vec3 direction)
|
|
||||||
{
|
|
||||||
// TODO: Cast a ray and size tracer appropriately
|
|
||||||
return 100.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void playSound()
|
|
||||||
{
|
|
||||||
if (!IsClient) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Events::PlaySoundOnEntity e;
|
|
||||||
e.EmitterID = m_Entity.ID;
|
|
||||||
e.FilePath = "Audio/laser/laser1.wav";
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -4,6 +4,9 @@ LoadMap=
|
|||||||
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
|
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
|
||||||
; if false -> Use pool allocation.
|
; if false -> Use pool allocation.
|
||||||
DisableMemoryPool=false
|
DisableMemoryPool=false
|
||||||
|
RespawnTime = 8.0
|
||||||
|
EditorEnabled=false
|
||||||
|
OutOfBodyExperience=false
|
||||||
|
|
||||||
[Editor]
|
[Editor]
|
||||||
CameraSpeed=3
|
CameraSpeed=3
|
||||||
@@ -20,7 +23,7 @@ StartNetwork=false
|
|||||||
IsServer=false
|
IsServer=false
|
||||||
Name=Bob
|
Name=Bob
|
||||||
Address=127.0.0.1
|
Address=127.0.0.1
|
||||||
Port=13
|
Port=27666
|
||||||
MaxConnections=8
|
MaxConnections=8
|
||||||
SnapshotInterval=0.05
|
SnapshotInterval=0.05
|
||||||
SendInputIntervalMs=33
|
SendInputIntervalMs=33
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
Sensitivity=0.5
|
Sensitivity=0.5
|
||||||
InvertPitch=false
|
InvertPitch=false
|
||||||
|
|
||||||
|
[Keyboard]
|
||||||
|
DoubleTapToDash=false
|
||||||
|
|
||||||
[Bindings]
|
[Bindings]
|
||||||
MouseLeft=PrimaryFire
|
MouseLeft=PrimaryFire
|
||||||
MouseX=Yaw
|
MouseX=Yaw
|
||||||
@@ -21,4 +24,5 @@ F1=ToggleEditor
|
|||||||
C=ConnectToServer
|
C=ConnectToServer
|
||||||
N=SwitchToServer
|
N=SwitchToServer
|
||||||
M=SwitchToClient
|
M=SwitchToClient
|
||||||
P=SwitchToPlayer
|
P=SwitchToPlayer
|
||||||
|
K=TakeDamage,1500
|
||||||
@@ -32,6 +32,7 @@
|
|||||||
<xs:include schemaLocation="Components/Lifetime.xsd"/>
|
<xs:include schemaLocation="Components/Lifetime.xsd"/>
|
||||||
<xs:include schemaLocation="Components/HiddenForLocalPlayer.xsd"/>
|
<xs:include schemaLocation="Components/HiddenForLocalPlayer.xsd"/>
|
||||||
<xs:include schemaLocation="Components/HealthPickup.xsd"/>
|
<xs:include schemaLocation="Components/HealthPickup.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/AmmoPickup.xsd"/>
|
||||||
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
<xs:include schemaLocation="Components/AnimationOffset.xsd"/>
|
||||||
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
<xs:include schemaLocation="Components/DashAbility.xsd"/>
|
||||||
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
|
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
|
||||||
@@ -39,4 +40,5 @@
|
|||||||
<xs:include schemaLocation="Components/Sprite.xsd"/>
|
<xs:include schemaLocation="Components/Sprite.xsd"/>
|
||||||
<xs:include schemaLocation="Components/Shielded.xsd"/>
|
<xs:include schemaLocation="Components/Shielded.xsd"/>
|
||||||
<xs:include schemaLocation="Components/CapturePointHUD.xsd"/>
|
<xs:include schemaLocation="Components/CapturePointHUD.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/AmmunitionHUD.xsd"/>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<AmmoPickup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AmmoPickup.xsd">
|
||||||
|
<RespawnTimer>3</RespawnTimer>
|
||||||
|
<AmmoGain>30</AmmoGain>
|
||||||
|
</AmmoPickup>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="AmmoPickup">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>An Ammo Pickup</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="RespawnTimer" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>The respawn timer for a ammo pickup</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="AmmoGain" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>How much percent ammo gain the player will get</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<AmmunitionHUD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AmmunitionHUD.xsd">
|
||||||
|
</AmmunitionHUD>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?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="AmmunitionHUD">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Hud element for tracking ammunition from parent with AssaultWeapon component. Child with the name "MagazineAmmo" tracks clip ammunition. Child with the name "Ammo" tracks ammo.</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -6,4 +6,6 @@
|
|||||||
<MaxAmmo>360</MaxAmmo>
|
<MaxAmmo>360</MaxAmmo>
|
||||||
<BaseDamage>5</BaseDamage>
|
<BaseDamage>5</BaseDamage>
|
||||||
<RPM>120</RPM>
|
<RPM>120</RPM>
|
||||||
|
<ViewPunch>0.01</ViewPunch>
|
||||||
|
<ReloadTime>2</ReloadTime>
|
||||||
</AssaultWeapon>
|
</AssaultWeapon>
|
||||||
@@ -22,6 +22,12 @@
|
|||||||
<xs:element name="RPM" type="t:double" minOccurs="0">
|
<xs:element name="RPM" type="t:double" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>Rate of fire in rounds per minute</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>Rate of fire in rounds per minute</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
<xs:element name="ViewPunch" type="t:float" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>View punch in radians for each bullet fired</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="ReloadTime" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>Time it takes to reload the weapon in seconds</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -2,5 +2,6 @@
|
|||||||
<CapturePoint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePoint.xsd">
|
<CapturePoint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePoint.xsd">
|
||||||
<CapturePointNumber>0</CapturePointNumber>
|
<CapturePointNumber>0</CapturePointNumber>
|
||||||
<CaptureTimer>0</CaptureTimer>
|
<CaptureTimer>0</CaptureTimer>
|
||||||
|
<CapturePointMaxTimer>15</CapturePointMaxTimer>
|
||||||
<HomePointForTeam><Spectator/></HomePointForTeam>
|
<HomePointForTeam><Spectator/></HomePointForTeam>
|
||||||
</CapturePoint>
|
</CapturePoint>
|
||||||
@@ -20,7 +20,11 @@
|
|||||||
<xs:documentation>CapturePointNumber specify an int number for this</xs:documentation>
|
<xs:documentation>CapturePointNumber specify an int number for this</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
<xs:element name="CapturePointMaxTimer" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>The time needed to take over a Capture Point</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:element>
|
||||||
<xs:element name="HomePointForTeam" type="TeamEnum" minOccurs="0">
|
<xs:element name="HomePointForTeam" type="TeamEnum" minOccurs="0">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>Specify if this is a HomePoint for either team</xs:documentation>
|
<xs:documentation>Specify if this is a HomePoint for either team</xs:documentation>
|
||||||
|
|||||||
@@ -2,4 +2,5 @@
|
|||||||
<Player xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Player.xsd">
|
<Player xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Player.xsd">
|
||||||
<MovementSpeed>3</MovementSpeed>
|
<MovementSpeed>3</MovementSpeed>
|
||||||
<CrouchSpeed>1.5</CrouchSpeed>
|
<CrouchSpeed>1.5</CrouchSpeed>
|
||||||
|
<CurrentWishDirection X="0" Y="0" Z="0"/>
|
||||||
</Player>
|
</Player>
|
||||||
@@ -5,12 +5,13 @@
|
|||||||
|
|
||||||
<xs:element name="Player">
|
<xs:element name="Player">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>The player charachter</xs:documentation>
|
<xs:documentation>The player entity</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:all>
|
<xs:all>
|
||||||
<xs:element name="MovementSpeed" type="t:float" minOccurs="0"/>
|
<xs:element name="MovementSpeed" type="t:float" minOccurs="0"/>
|
||||||
<xs:element name="CrouchSpeed" type="t:float" minOccurs="0"/>
|
<xs:element name="CrouchSpeed" type="t:float" minOccurs="0"/>
|
||||||
|
<xs:element name="CurrentWishDirection" type="t:Vector" minOccurs="0"/>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="AmmunitionHUD" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:AmmunitionHUD/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.0430000015" Y="0.131501317" Z="-0.0670000017"/>
|
||||||
|
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="AmmunitionHUDBackground">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.00200000009"/>
|
||||||
|
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="MagazineAmmo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>0</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Ammo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>360</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
|
||||||
|
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.00200000009" Y="0.00400000019" Z="-0.00100000005"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="MagazineAmmo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>0</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="0" G="0" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Ammo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>360</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="0" G="0" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
|
||||||
|
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:AmmoPickup/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
<c:Trigger/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,294 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="Scenemesh">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/LevelBase/MapVersion1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="DirectionalLight">
|
||||||
|
<Components>
|
||||||
|
<c:DirectionalLight>
|
||||||
|
<Intensity>2</Intensity>
|
||||||
|
</c:DirectionalLight>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="61.9050903" Z="0"/>
|
||||||
|
<Scale X="50" Y="50" Z="50"/>
|
||||||
|
<Orientation X="4.42700005" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="PointLight">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>2.7999999523162842</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.370978802" Y="1.88588905" Z="-0.55370003"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="PointLight">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>2.7999999523162842</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="38.0347443" Y="1.88588905" Z="62.7340622"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.904668212" Y="0" Z="8.48177528"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-4.61666441" Y="0" Z="-8.51156044"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-7.56803513" Y="-0.0658408776" Z="0.59418112"/>
|
||||||
|
<Scale X="1.20000005" Y="0.900000036" Z="1.30000007"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="10.460474" Y="0" Z="-3.92580295"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.09146011" Y="-0.315138876" Z="-0.333906144"/>
|
||||||
|
<Scale X="150" Y="1" Z="180"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="BluSpawn">
|
||||||
|
<Components>
|
||||||
|
<c:PlayerSpawn/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Blue/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="57.7363472" Y="1.18853188" Z="79.5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-2.05988312" Y="0" Z="2.79573512"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.85022807" Y="0" Z="-2.08909845"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="2.98651481" Y="0" Z="-4.67667246"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-5.16323137" Y="0" Z="3.62892342"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="RedSpawn">
|
||||||
|
<Components>
|
||||||
|
<c:PlayerSpawn/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Red/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-60.2567062" Y="1.60000002" Z="-78.1000061"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="2.24403"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="2.20245028" Y="0" Z="-1.97843659"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="4.79769945" Y="0" Z="-5.2088728"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:AmmoPickup>
|
||||||
|
<RespawnTimer>1</RespawnTimer>
|
||||||
|
<AmmoGain>22</AmmoGain>
|
||||||
|
</c:AmmoPickup>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="60" Y="1" Z="75"/>
|
||||||
|
</c:Transform>
|
||||||
|
<c:Trigger/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:AmmoPickup>
|
||||||
|
<RespawnTimer>1</RespawnTimer>
|
||||||
|
<AmmoGain>22</AmmoGain>
|
||||||
|
</c:AmmoPickup>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="60" Y="1" Z="77"/>
|
||||||
|
</c:Transform>
|
||||||
|
<c:Trigger/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:AmmoPickup>
|
||||||
|
<RespawnTimer>4</RespawnTimer>
|
||||||
|
<AmmoGain>44</AmmoGain>
|
||||||
|
</c:AmmoPickup>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="60" Y="1" Z="79"/>
|
||||||
|
</c:Transform>
|
||||||
|
<c:Trigger/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="AmmunitionHUD" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:AmmunitionHUD/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.0430000015" Y="0.131501317" Z="-0.0670000017"/>
|
||||||
|
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="AmmunitionHUDBackground">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.00200000009"/>
|
||||||
|
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AmmunitionText">
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="MagazineAmmo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>32</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Ammo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>360</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
|
||||||
|
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -26,29 +26,25 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Wave">
|
<Entity name="Running">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Run</AnimationName1>
|
<AnimationName1>Run</AnimationName1>
|
||||||
<Weight1>0.5</Weight1>
|
<Weight1>0.5</Weight1>
|
||||||
<Time1>0.78014858943309839</Time1>
|
<Time1>0.60188997954429357</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>-1</Speed1>
|
||||||
<Speed2>1</Speed2>
|
<Speed2>1</Speed2>
|
||||||
<AnimationName2>StrafeRight</AnimationName2>
|
|
||||||
<Weight2>0.5</Weight2>
|
<Weight2>0.5</Weight2>
|
||||||
<Time2>0.78620929522779459</Time2>
|
<Time2>0.96957233017255007</Time2>
|
||||||
<AnimationName3>ShootFastRifle</AnimationName3>
|
<Time3>0.093923612201312068</Time3>
|
||||||
<Time3>0.13809128482706701</Time3>
|
|
||||||
<Speed3>1</Speed3>
|
<Speed3>1</Speed3>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:AnimationOffset>
|
<c:AnimationOffset>
|
||||||
<AnimationName>AimRifle</AnimationName>
|
<AnimationName>AimRifle</AnimationName>
|
||||||
<Time>0.040000014007091522</Time>
|
<Time>0.5</Time>
|
||||||
</c:AnimationOffset>
|
</c:AnimationOffset>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||||
<Color A="0.627451003" B="19.6078434" G="1" R="3.92156863"/>
|
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.690088332" Y="0" Z="0"/>
|
<Position X="-0.690088332" Y="0" Z="0"/>
|
||||||
@@ -62,13 +58,11 @@
|
|||||||
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||||
</c:BoneAttachment>
|
</c:BoneAttachment>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeapon.mesh</Resource>
|
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||||
<Color A="1" B="1" G="1" R="19.6078434"/>
|
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.144055843" Y="0.970111489" Z="-0.126199633"/>
|
<Position X="0.161975682" Y="1.06281972" Z="-0.216630161"/>
|
||||||
<Orientation X="-0.535831392" Y="0.0691146553" Z="-0.0608282126"/>
|
<Orientation X="-0.064812161" Y="-0.0739696771" Z="0.143780142"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -78,13 +72,27 @@
|
|||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
|
<Color A="1" B="0.70588237" G="0.70588237" R="1"/>
|
||||||
<Radius>10</Radius>
|
<Radius>10</Radius>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="1.0823108" Z="0.738871336"/>
|
<Position X="-0.375567257" Y="2.13093901" Z="-0.718547285"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Color A="1" B="1" G="0.70588237" R="0.70588237"/>
|
||||||
|
<Radius>10</Radius>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-1.96873236" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
@@ -97,6 +105,43 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName1>ShootFastRifle</AnimationName1>
|
||||||
|
<Time1>0.056234247235838808</Time1>
|
||||||
|
<Speed1>1</Speed1>
|
||||||
|
<Speed2>1</Speed2>
|
||||||
|
<AnimationName2>Idl</AnimationName2>
|
||||||
|
<Weight2>0.5</Weight2>
|
||||||
|
<Time2>1.8308673495784191</Time2>
|
||||||
|
<AnimationName3>StrafeRigh</AnimationName3>
|
||||||
|
<Weight3>0.5</Weight3>
|
||||||
|
<Time3>0.32167823998061529</Time3>
|
||||||
|
<Speed3>1</Speed3>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:BoneAttachment>
|
||||||
|
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||||
|
</c:BoneAttachment>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.803468645" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|||||||
@@ -26,57 +26,48 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Wave">
|
<Entity name="Running">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Run</AnimationName1>
|
<AnimationName1>Run</AnimationName1>
|
||||||
<Weight1>0.5</Weight1>
|
<Weight1>0.5</Weight1>
|
||||||
<Time1>0.97312056690160276</Time1>
|
<Time1>0.14873348341666759</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>-1</Speed1>
|
||||||
<Speed2>1</Speed2>
|
<Speed2>1</Speed2>
|
||||||
<AnimationName2>ReloadSwitch</AnimationName2>
|
<AnimationName2></AnimationName2>
|
||||||
<Time2>0.91310356788604263</Time2>
|
<Weight2>0.5</Weight2>
|
||||||
<AnimationName3>LeftRight</AnimationName3>
|
<Time2>0.96957233017255007</Time2>
|
||||||
<Weight3>0</Weight3>
|
<AnimationName3></AnimationName3>
|
||||||
<Time3>0.040207288496060478</Time3>
|
<Time3>0.093923612201312068</Time3>
|
||||||
<Speed3>1</Speed3>
|
<Speed3>1</Speed3>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:AnimationOffset>
|
<c:AnimationOffset>
|
||||||
<AnimationName>DownUp</AnimationName>
|
<AnimationName>AimRifle</AnimationName>
|
||||||
<Time>0.77999961376190186</Time>
|
|
||||||
</c:AnimationOffset>
|
</c:AnimationOffset>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||||
<Color A="0.627451003" B="19.6078434" G="1" R="3.92156863"/>
|
|
||||||
<Transparent>true</Transparent>
|
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.690088332" Y="1.00491476" Z="0"/>
|
<Position X="-0.690088332" Y="0" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity name="R_Arm_Weapon_Joint">
|
||||||
<Components>
|
<Components>
|
||||||
<c:BoneAttachment>
|
<c:BoneAttachment>
|
||||||
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||||
|
<ScaleOffset X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||||
</c:BoneAttachment>
|
</c:BoneAttachment>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeapon.mesh</Resource>
|
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.120548911" Y="-0.223148599" Z="-0.151705116"/>
|
<Position X="0.106085993" Y="1.24281573" Z="-0.198514819"/>
|
||||||
<Orientation X="0.09407565" Y="0.0181003436" Z="0.0279055703"/>
|
<Orientation X="0.466044426" Y="0.284358948" Z="-0.0190349482"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Camera/>
|
|
||||||
<c:Transform/>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
<Entity>
|
||||||
@@ -101,6 +92,40 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName1>ShootFastRifle</AnimationName1>
|
||||||
|
<Time1>0.11093210511546658</Time1>
|
||||||
|
<Speed1>1</Speed1>
|
||||||
|
</c:Animation>
|
||||||
|
<c:AnimationOffset>
|
||||||
|
<AnimationName>AimRifle</AnimationName>
|
||||||
|
<Time>1</Time>
|
||||||
|
</c:AnimationOffset>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:BoneAttachment>
|
||||||
|
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||||
|
</c:BoneAttachment>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.106085993" Y="1.24281573" Z="-0.198514819"/>
|
||||||
|
<Orientation X="0.466044426" Y="0.284358948" Z="-0.0190349482"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|||||||
+3
-2
@@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?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">
|
<Entity name="CapturePointHUD" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
<Components>
|
<Components>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-24.3529072" Y="0" Z="6.95243597"/>
|
<Position X="0" Y="0.190541431" Z="0"/>
|
||||||
|
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
|
|
||||||
@@ -2,12 +2,246 @@
|
|||||||
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
<Components>
|
<Components>
|
||||||
<c:Transform>
|
<c:Transform/>
|
||||||
<Position X="0.340887427" Y="0" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
</Components>
|
||||||
|
|
||||||
<Children>
|
<Children>
|
||||||
|
<Entity name="Scenemesh">
|
||||||
|
<Components>
|
||||||
|
<c:AABB>
|
||||||
|
<Origin X="0.195705414" Y="26.0382366" Z="-0.010017395"/>
|
||||||
|
<Size X="135.414337" Y="68.3848572" Z="180.020035"/>
|
||||||
|
</c:AABB>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/LevelBase/MapVersion1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="DirectionalLight">
|
||||||
|
<Components>
|
||||||
|
<c:DirectionalLight>
|
||||||
|
<Intensity>2</Intensity>
|
||||||
|
</c:DirectionalLight>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="61.9050903" Z="0"/>
|
||||||
|
<Scale X="50" Y="50" Z="50"/>
|
||||||
|
<Orientation X="4.42700005" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="PointLight">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>2.7999999523162842</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.370978802" Y="1.88588905" Z="-0.55370003"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="PointLight">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>2.7999999523162842</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="38.0347443" Y="1.88588905" Z="62.7340622"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.904668212" Y="0" Z="8.48177528"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-4.61666441" Y="0" Z="-8.51156044"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-7.56803513" Y="-0.0658408776" Z="0.59418112"/>
|
||||||
|
<Scale X="1.20000005" Y="0.900000036" Z="1.30000007"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="10.460474" Y="0" Z="-3.92580295"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.09146011" Y="-0.315138876" Z="-0.333906144"/>
|
||||||
|
<Scale X="150" Y="1" Z="180"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="BluSpawn">
|
||||||
|
<Components>
|
||||||
|
<c:PlayerSpawn/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Blue/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="57.7363472" Y="2.38900018" Z="79.5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-2.05988312" Y="0" Z="2.79573512"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.85022807" Y="0" Z="-2.08909845"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="2.98651481" Y="0" Z="-4.67667246"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-5.16323137" Y="0" Z="3.62892342"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="RedSpawn">
|
||||||
|
<Components>
|
||||||
|
<c:PlayerSpawn/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Red/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-60.2567062" Y="3.4000001" Z="-78.1000061"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="2.24403"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="2.20245028" Y="0" Z="-1.97843659"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="4.79769945" Y="0" Z="-5.2088728"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
<c:AABB/>
|
<c:AABB/>
|
||||||
@@ -15,10 +249,12 @@
|
|||||||
<HomePointForTeam>
|
<HomePointForTeam>
|
||||||
<Red/>
|
<Red/>
|
||||||
</HomePointForTeam>
|
</HomePointForTeam>
|
||||||
|
<CaptureTimer>15</CaptureTimer>
|
||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="1" B="0" G="0.200000003" R="1"/>
|
<Color A="0.300000012" B="0" G="0" R="1"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team>
|
<c:Team>
|
||||||
<Team>
|
<Team>
|
||||||
@@ -26,7 +262,7 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="6.60000038" Y="0" Z="0"/>
|
<Position X="56.0000038" Y="1.50000012" Z="77.1000061"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -40,11 +276,12 @@
|
|||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="1" B="1" G="1" R="0"/>
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team/>
|
<c:Team/>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="4.46673203" Y="0" Z="3.50259304"/>
|
<Position X="56.0000038" Y="1.70000005" Z="78.5"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -58,15 +295,12 @@
|
|||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team>
|
<c:Team/>
|
||||||
<Team>
|
|
||||||
<Blue/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="3.00000024" Y="0" Z="0.113596022"/>
|
<Position X="56.0000038" Y="1.10000002" Z="79.6000061"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -76,11 +310,13 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:AABB/>
|
<c:AABB/>
|
||||||
<c:CapturePoint>
|
<c:CapturePoint>
|
||||||
|
<CaptureTimer>-15</CaptureTimer>
|
||||||
<CapturePointNumber>3</CapturePointNumber>
|
<CapturePointNumber>3</CapturePointNumber>
|
||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
<Color A="0.300000012" B="1" G="0" R="0"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team>
|
<c:Team>
|
||||||
<Team>
|
<Team>
|
||||||
@@ -88,7 +324,7 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="1.75382805" Y="0" Z="0.0895374417"/>
|
<Position X="56.0000038" Y="1.60000002" Z="80.6000061"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -101,11 +337,13 @@
|
|||||||
<HomePointForTeam>
|
<HomePointForTeam>
|
||||||
<Blue/>
|
<Blue/>
|
||||||
</HomePointForTeam>
|
</HomePointForTeam>
|
||||||
|
<CaptureTimer>-15</CaptureTimer>
|
||||||
<CapturePointNumber>4</CapturePointNumber>
|
<CapturePointNumber>4</CapturePointNumber>
|
||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||||
<Color A="1" B="1" G="0.200000003" R="0"/>
|
<Color A="0.300000012" B="1" G="0" R="0"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Team>
|
<c:Team>
|
||||||
<Team>
|
<Team>
|
||||||
@@ -113,61 +351,12 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.56674248" Y="0" Z="0"/>
|
<Position X="56.0000038" Y="1.4000001" Z="82.1000061"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Health/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Player/>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Blue/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="4.29100037" Y="-0.08556436" Z="1.29717529"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:AABB/>
|
|
||||||
<c:Health/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Player/>
|
|
||||||
<c:Team>
|
|
||||||
<Team>
|
|
||||||
<Red/>
|
|
||||||
</Team>
|
|
||||||
</c:Team>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="5.43557501" Y="0.888866663" Z="1.55849135"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
<Entity>
|
|
||||||
<Components>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Test/DummyScene.mesh</Resource>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
|
||||||
<Position X="-0.600000024" Y="0" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
|
||||||
<Children/>
|
|
||||||
</Entity>
|
|
||||||
</Children>
|
</Children>
|
||||||
|
|
||||||
</Entity>
|
</Entity>
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/DamageIndicator.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<DepthSort>false</DepthSort>
|
||||||
|
<Color A="1" B="0.721568644" G="1" R="0.839215696"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.472000033"/>
|
||||||
|
<Scale X="0.100000001" Y="0.200000003" Z="0.5"/>
|
||||||
|
</c:Transform>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>1.5</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,426 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="Scenemesh">
|
||||||
|
<Components>
|
||||||
|
<c:AABB>
|
||||||
|
<Size X="150" Y="64" Z="180"/>
|
||||||
|
</c:AABB>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models\MapVersion1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="DirectionalLight">
|
||||||
|
<Components>
|
||||||
|
<c:DirectionalLight>
|
||||||
|
<Intensity>2</Intensity>
|
||||||
|
</c:DirectionalLight>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/DirectionalLightWidget.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="61.9050903" Z="0"/>
|
||||||
|
<Scale X="50" Y="50" Z="50"/>
|
||||||
|
<Orientation X="4.42700005" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="PointLight">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>2.7999999523162842</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.370978802" Y="1.88588905" Z="-0.55370003"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="PointLight">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>2.7999999523162842</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="38.0347443" Y="1.88588905" Z="62.7340622"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.904668212" Y="0" Z="8.48177528"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-4.61666441" Y="0" Z="-8.51156044"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-7.56803513" Y="-0.0658408776" Z="0.59418112"/>
|
||||||
|
<Scale X="1.20000005" Y="0.900000036" Z="1.30000007"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="10.460474" Y="0" Z="-3.92580295"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:AABB/>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.09146011" Y="-0.315138876" Z="-0.333906144"/>
|
||||||
|
<Scale X="150" Y="1" Z="180"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="BluSpawn">
|
||||||
|
<Components>
|
||||||
|
<c:PlayerSpawn/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Blue/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="57.7363472" Y="2.38900018" Z="79.5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-2.05988312" Y="0" Z="2.79573512"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.85022807" Y="0" Z="-2.08909845"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="2.98651481" Y="0" Z="-4.67667246"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-5.16323137" Y="0" Z="3.62892342"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="RedSpawn">
|
||||||
|
<Components>
|
||||||
|
<c:PlayerSpawn/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Red/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-60.2567062" Y="3.4000001" Z="-78.1000061"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="2.24403"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="2.20245028" Y="0" Z="-1.97843659"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="4.79769945" Y="0" Z="-5.2088728"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Player">
|
||||||
|
<Components>
|
||||||
|
<c:AABB>
|
||||||
|
<Origin X="0" Y="0.772000015" Z="0"/>
|
||||||
|
<Size X="1" Y="1.60000002" Z="1"/>
|
||||||
|
</c:AABB>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:DashAbility/>
|
||||||
|
<c:Health>
|
||||||
|
<Health>99</Health>
|
||||||
|
</c:Health>
|
||||||
|
<c:Physics>
|
||||||
|
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||||
|
</c:Physics>
|
||||||
|
<c:Player>
|
||||||
|
<MovementSpeed>5</MovementSpeed>
|
||||||
|
</c:Player>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Red/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="57" Y="0.212861136" Z="77"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Camera">
|
||||||
|
<Components>
|
||||||
|
<c:Camera/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.37700009" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="PlayerName">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,100</Resource>
|
||||||
|
<Color A="1" B="0" G="1" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.100000001" Y="0.248000011" Z="-0.248000011"/>
|
||||||
|
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
|
||||||
|
<Orientation X="0" Y="3.14199996" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="CameraModel">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Camera.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
|
||||||
|
<Scale X="1.30000007" Y="1.50000012" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="HUD">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="HealthBar">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Percentage>0.99000000953674316</Percentage>
|
||||||
|
<Color A="0" B="0.99000001" G="0" R="0.00999999046"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:HealthHUD/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitHexagon.mesh</Resource>
|
||||||
|
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
|
||||||
|
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
|
||||||
|
<Orientation X="0" Y="0.594000041" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Crosshair">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/CrosshairQuad.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="0.200000003"/>
|
||||||
|
<Scale X="0.00600000005" Y="1" Z="0.00600000005"/>
|
||||||
|
<Orientation X="1.57000005" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Weapon">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/AssaultWeaponRed.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.180000007" Y="-0.183000013" Z="0"/>
|
||||||
|
<Orientation X="0" Y="3.08300018" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="WeaponMuzzle">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.215000004" Y="-0.153000012" Z="-0.266000003"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="ThirdPersonCamera">
|
||||||
|
<Components>
|
||||||
|
<c:Camera/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Camera.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.284000009" Y="1.83800006" Z="1.18900001"/>
|
||||||
|
<Orientation X="5.95600033" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="PlayerModel">
|
||||||
|
<Components>
|
||||||
|
<c:Animation/>
|
||||||
|
<c:HiddenForLocalPlayer/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||||
|
<Color A="1" B="0" G="0" R="1"/>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AABBStanding">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Color A="0.427450985" B="1" G="1" R="1"/>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.772000015" Z="0"/>
|
||||||
|
<Scale X="1" Y="1.60000002" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AABBCrouching">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Color A="0.745098054" B="1" G="0" R="1"/>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.772000015" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?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:Lifetime>
|
||||||
|
<Lifetime>0.5</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:ExplosionEffect>
|
||||||
|
<ColorByDistance>true</ColorByDistance>
|
||||||
|
<Velocity X="3.60000014" Y="3.93700027" Z="0"/>
|
||||||
|
<ExponentialAccelaration>true</ExponentialAccelaration>
|
||||||
|
<ExplosionDuration>0.5</ExplosionDuration>
|
||||||
|
<EndColor A="0" B="1" G="1" R="1"/>
|
||||||
|
<Randomness>true</Randomness>
|
||||||
|
</c:ExplosionEffect>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Effects/JumpEffectHexagon.mesh</Resource>
|
||||||
|
<Color A="0.545098066" 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.500000119" Y="0.500000179" Z="0.500000119"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="HealthHUD" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="HealthText">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Percentage>1</Percentage>
|
||||||
|
<Color A="1" B="1" G="0" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:HealthHUD/>
|
||||||
|
<c:Text>
|
||||||
|
<Content>100/100</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="0.392156869" B="1" G="0" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.355000019" Y="-0.203000009" Z="0.0410000011"/>
|
||||||
|
<Scale X="0.0350000001" Y="0.0350000001" Z="0.0350000001"/>
|
||||||
|
<Orientation X="0" Y="0.410000026" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="HealthBar">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Percentage>1</Percentage>
|
||||||
|
<Color A="0.196078435" B="1" G="0" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
|
||||||
|
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:HealthHUD/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.263000011" Y="-0.185000002" Z="0"/>
|
||||||
|
<Scale X="0.106000006" Y="0.333000004" Z="0.150000006"/>
|
||||||
|
<Orientation X="5.87300014" Y="0" Z="4.71200037"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="HitMarker" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>0.1</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
||||||
|
<DepthSort>false</DepthSort>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0.031" Y="0.031" Z="1"/>
|
||||||
|
<Orientation X="0" Y="0" Z="0.782"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -124,10 +124,14 @@
|
|||||||
<Origin X="0" Y="0.772000015" Z="0"/>
|
<Origin X="0" Y="0.772000015" Z="0"/>
|
||||||
<Size X="1" Y="1.60000002" Z="1"/>
|
<Size X="1" Y="1.60000002" Z="1"/>
|
||||||
</c:AABB>
|
</c:AABB>
|
||||||
|
<c:AssaultWeapon>
|
||||||
|
<RPM>600</RPM>
|
||||||
|
</c:AssaultWeapon>
|
||||||
<c:Collidable/>
|
<c:Collidable/>
|
||||||
<c:Model/>
|
<c:DashAbility/>
|
||||||
|
<c:Health/>
|
||||||
<c:Physics>
|
<c:Physics>
|
||||||
<Gravity>false</Gravity>
|
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||||
</c:Physics>
|
</c:Physics>
|
||||||
<c:Player>
|
<c:Player>
|
||||||
<MovementSpeed>5</MovementSpeed>
|
<MovementSpeed>5</MovementSpeed>
|
||||||
@@ -138,8 +142,7 @@
|
|||||||
</Team>
|
</Team>
|
||||||
</c:Team>
|
</c:Team>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-1.68112314" Y="0.0288829971" Z="3.06287026"/>
|
<Position X="0" Y="0.0288832653" Z="2.64837074"/>
|
||||||
<Orientation X="0" Y="2.14675093" Z="0"/>
|
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -147,7 +150,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Camera/>
|
<c:Camera/>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="1.37700009" Z="0"/>
|
<Position X="0" Y="1.27700007" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -156,10 +159,9 @@
|
|||||||
<c:Text>
|
<c:Text>
|
||||||
<Resource>Fonts/DroidSans.ttf,100</Resource>
|
<Resource>Fonts/DroidSans.ttf,100</Resource>
|
||||||
<Color A="1" B="0" G="1" R="0"/>
|
<Color A="1" B="0" G="1" R="0"/>
|
||||||
<Visible>false</Visible>
|
|
||||||
</c:Text>
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.247910097" Z="-0.447844714"/>
|
<Position X="0.100000001" Y="0.248000011" Z="-0.248000011"/>
|
||||||
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
|
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
|
||||||
<Orientation X="0" Y="3.14199996" Z="0"/>
|
<Orientation X="0" Y="3.14199996" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
@@ -170,6 +172,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
|
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
|
||||||
@@ -178,6 +181,100 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity name="HUD">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="HealthBar">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Percentage>1</Percentage>
|
||||||
|
<Color A="0" B="1" G="0" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:HealthHUD/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitHexagon.mesh</Resource>
|
||||||
|
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
|
||||||
|
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
|
||||||
|
<Orientation X="0" Y="0.594000041" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Crosshair">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
||||||
|
<DepthSort>false</DepthSort>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="0.200000003"/>
|
||||||
|
<Scale X="0.0250000004" Y="0.0250000004" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Hands">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName1>Idle</AnimationName1>
|
||||||
|
<Time1>1.9569972344146196</Time1>
|
||||||
|
<Speed1>1</Speed1>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="WeaponModel">
|
||||||
|
<Components>
|
||||||
|
<c:BoneAttachment>
|
||||||
|
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||||
|
</c:BoneAttachment>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.120748013" Y="-0.228470564" Z="-0.151475638"/>
|
||||||
|
<Orientation X="0.010404693" Y="-0.00268176314" Z="0.0428441502"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="WeaponMuzzle">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="FirstPersonReloadSpawner">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/WeaponReloadEffect.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="ThirdPersonCamera">
|
<Entity name="ThirdPersonCamera">
|
||||||
@@ -196,15 +293,52 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="PlayerModel">
|
<Entity name="PlayerModel">
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName1>Idle</AnimationName1>
|
||||||
|
<Time1>1.8055945618467364</Time1>
|
||||||
|
<Speed1>1</Speed1>
|
||||||
|
</c:Animation>
|
||||||
|
<c:AnimationOffset>
|
||||||
|
<AnimationName>AimRifle</AnimationName>
|
||||||
|
<Time>0.5</Time>
|
||||||
|
</c:AnimationOffset>
|
||||||
|
<c:HiddenForLocalPlayer/>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Characters/Assault/AssaultHeadless.mesh</Resource>
|
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||||
<Color A="1" B="0" G="0" R="1"/>
|
<Color A="1" B="0" G="0" R="1"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform/>
|
||||||
<Orientation X="0" Y="3.14159274" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
</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>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.158578917" Y="1.02878916" Z="-0.215411991"/>
|
||||||
|
<Orientation X="-0.0626687407" Y="-0.0361274257" Z="0.120101407"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ThirdPersonWeaponMuzzle">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/RayBlue.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="AABBStanding">
|
<Entity name="AABBStanding">
|
||||||
<Components>
|
<Components>
|
||||||
|
|||||||
+3189
-527
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -69,45 +69,250 @@
|
|||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity name="HealthBar">
|
<Entity name="Crosshair">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Fill>
|
<c:Sprite>
|
||||||
<Percentage>1</Percentage>
|
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
||||||
<Color A="0" B="1" G="0" R="0"/>
|
<DepthSort>false</DepthSort>
|
||||||
</c:Fill>
|
</c:Sprite>
|
||||||
<c:HealthHUD/>
|
|
||||||
<c:Model>
|
|
||||||
<Resource>Models/Core/UnitHexagon.mesh</Resource>
|
|
||||||
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
|
|
||||||
</c:Model>
|
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
|
<Position X="0" Y="0" Z="0.200000003"/>
|
||||||
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
|
<Scale X="0.0250000004" Y="0.0250000004" Z="0"/>
|
||||||
<Orientation X="0" Y="0.594000041" Z="0"/>
|
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Crosshair">
|
<Entity name="HitMarkerSpawner">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Spawner>
|
||||||
<Resource>Models/Weapons/CrosshairQuad.mesh</Resource>
|
<EntityFile>Schema/Entities/HitMarker.xml</EntityFile>
|
||||||
</c:Model>
|
</c:Spawner>
|
||||||
<c:Transform>
|
<c:Transform/>
|
||||||
<Position X="0" Y="0" Z="0.200000003"/>
|
|
||||||
<Scale X="0.00600000005" Y="1" Z="0.00600000005"/>
|
|
||||||
<Orientation X="1.57000005" Y="0" Z="0"/>
|
|
||||||
</c:Transform>
|
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity name="HealthHUD">
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="HealthText">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Percentage>1</Percentage>
|
||||||
|
<Color A="1" B="1" G="0" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:HealthHUD/>
|
||||||
|
<c:Text>
|
||||||
|
<Content>100/100</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="0.392156869" B="1" G="0" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.355000019" Y="-0.203000009" Z="0.0410000011"/>
|
||||||
|
<Scale X="0.0350000001" Y="0.0350000001" Z="0.0350000001"/>
|
||||||
|
<Orientation X="0" Y="0.410000026" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="HealthBar">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Percentage>1</Percentage>
|
||||||
|
<Color A="0.196078435" B="1" G="0" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
|
||||||
|
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:HealthHUD/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.263000011" Y="-0.185000002" Z="0"/>
|
||||||
|
<Scale X="0.106000006" Y="0.333000004" Z="0.150000006"/>
|
||||||
|
<Orientation X="5.87300014" Y="0" Z="4.71200037"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="CapturePointHUD">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.190541431" Z="0"/>
|
||||||
|
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
|
||||||
|
</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>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Hands">
|
<Entity name="Hands">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>0.52743271827223559</Time1>
|
<Time1>0.1719161089749548</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
@@ -124,10 +329,11 @@
|
|||||||
</c:BoneAttachment>
|
</c:BoneAttachment>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.120747946" Y="-0.232330009" Z="-0.151475713"/>
|
<Position X="0.120430604" Y="-0.229735136" Z="-0.181454614"/>
|
||||||
<Orientation X="0.0104046576" Y="-0.00268170447" Z="0.0428439789"/>
|
<Orientation X="0.0104046864" Y="-0.00268157595" Z="0.0428441279"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -142,6 +348,73 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity name="FirstPersonReloadSpawner">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AmmunitionHUD">
|
||||||
|
<Components>
|
||||||
|
<c:AmmunitionHUD/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.0430000015" Y="0.131501317" Z="-0.0670000017"/>
|
||||||
|
<Scale X="0.400000006" Y="0.400000006" Z="0.400000006"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="AmmunitionHUDBackground">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.00200000009"/>
|
||||||
|
<Scale X="0.119999997" Y="0.119999997" Z="0.119999997"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AmmunitionText">
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="MagazineAmmo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>32</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Ammo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>360</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
|
||||||
|
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
@@ -166,7 +439,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation>
|
||||||
<AnimationName1>Idle</AnimationName1>
|
<AnimationName1>Idle</AnimationName1>
|
||||||
<Time1>0.69666320633760392</Time1>
|
<Time1>1.8038469763698401</Time1>
|
||||||
<Speed1>1</Speed1>
|
<Speed1>1</Speed1>
|
||||||
</c:Animation>
|
</c:Animation>
|
||||||
<c:AnimationOffset>
|
<c:AnimationOffset>
|
||||||
@@ -177,6 +450,7 @@
|
|||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
<Resource>Models/Characters/Assault/AssaultAnimations.mesh</Resource>
|
||||||
<Color A="1" B="1" G="0.309803933" R="0"/>
|
<Color A="1" B="1" G="0.309803933" R="0"/>
|
||||||
|
<Visible>false</Visible>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform/>
|
<c:Transform/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -190,8 +464,8 @@
|
|||||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0.162715688" Y="1.02479136" Z="-0.215626657"/>
|
<Position X="0.158596605" Y="1.02875519" Z="-0.215406924"/>
|
||||||
<Orientation X="-0.0629899353" Y="-0.0542047173" Z="0.11849726"/>
|
<Orientation X="-0.0626692027" Y="-0.0361935981" Z="0.120094992"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -206,6 +480,15 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity name="ThirdPersonReloadSpawner">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
<Entity name="Explosion" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
<Entity name="Explosion" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
<Components>
|
<Components>
|
||||||
<c:Animation>
|
<c:Animation/>
|
||||||
<Name>Hold Pos</Name>
|
|
||||||
</c:Animation>
|
|
||||||
<c:Lifetime>
|
<c:Lifetime>
|
||||||
<Lifetime>2.5</Lifetime>
|
<Lifetime>2.5</Lifetime>
|
||||||
</c:Lifetime>
|
</c:Lifetime>
|
||||||
|
|||||||
@@ -0,0 +1,272 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="Player" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:AABB>
|
||||||
|
<Origin X="0" Y="0.772000015" Z="0"/>
|
||||||
|
<Size X="1" Y="1.60000002" Z="1"/>
|
||||||
|
</c:AABB>
|
||||||
|
<c:AssaultWeapon>
|
||||||
|
<RPM>600</RPM>
|
||||||
|
</c:AssaultWeapon>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:DashAbility/>
|
||||||
|
<c:Health/>
|
||||||
|
<c:Physics>
|
||||||
|
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||||
|
</c:Physics>
|
||||||
|
<c:Player>
|
||||||
|
<MovementSpeed>5</MovementSpeed>
|
||||||
|
</c:Player>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Red/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="5519.44287" Y="0.0288832653" Z="2.64837074"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="Camera">
|
||||||
|
<Components>
|
||||||
|
<c:Camera/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.27700007" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="PlayerName">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,100</Resource>
|
||||||
|
<Color A="1" B="0" G="1" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.100000001" Y="0.248000011" Z="-0.248000011"/>
|
||||||
|
<Scale X="0.100000001" Y="0.113000005" Z="0.5"/>
|
||||||
|
<Orientation X="0" Y="3.14199996" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="CameraModel">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.0331346765" Z="-0.0792061687"/>
|
||||||
|
<Scale X="1.30000007" Y="1.50000012" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="HUD">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="HealthBar">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Percentage>1</Percentage>
|
||||||
|
<Color A="0" B="1" G="0" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:HealthHUD/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitHexagon.mesh</Resource>
|
||||||
|
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
|
||||||
|
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
|
||||||
|
<Orientation X="0" Y="0.594000041" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Crosshair">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
||||||
|
<DepthSort>false</DepthSort>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="0.200000003"/>
|
||||||
|
<Scale X="0.0250000004" Y="0.0250000004" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="HitMarkerSpawner">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/HitMarker.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Hands">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName1>Idle</AnimationName1>
|
||||||
|
<Time1>0.1719161089749548</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>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.1204307" Y="-0.228431284" Z="-0.181454539"/>
|
||||||
|
<Orientation X="0.0104045458" Y="-0.00268182717" Z="0.0428440496"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="WeaponMuzzle">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.00325386273" Y="0.0970000029" Z="-0.843000054"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="FirstPersonReloadSpawner">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/ReloadEffectView.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="ThirdPersonCamera">
|
||||||
|
<Components>
|
||||||
|
<c:Camera/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.284000009" Y="1.83800006" Z="1.18900001"/>
|
||||||
|
<Orientation X="5.95600033" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="PlayerModel">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName1>Idle</AnimationName1>
|
||||||
|
<Time1>1.8038469763698401</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/AssaultAnimations.mesh</Resource>
|
||||||
|
<Color A="1" B="1" G="0.309803933" R="0"/>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ThirdPersonWeaponModel">
|
||||||
|
<Components>
|
||||||
|
<c:BoneAttachment>
|
||||||
|
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||||
|
</c:BoneAttachment>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.139178902" Y="0.782200813" Z="-0.246610582"/>
|
||||||
|
<Orientation X="-0.228463098" Y="0.0975924358" Z="0.182726845"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ThirdPersonWeaponMuzzle">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/RayRed.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.00644115033" Y="0.096679531" Z="-0.436609417"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="ThirdPersonReloadSpawner">
|
||||||
|
<Components>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/ReloadEffectWorld.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AABBStanding">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Color A="0.427450985" B="1" G="1" R="1"/>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.772000015" Z="0"/>
|
||||||
|
<Scale X="1" Y="1.60000002" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AABBCrouching">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||||
|
<Color A="0.745098054" B="1" G="0" R="1"/>
|
||||||
|
<Visible>false</Visible>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.772000015" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -6,12 +6,12 @@
|
|||||||
<Lifetime>0.25</Lifetime>
|
<Lifetime>0.25</Lifetime>
|
||||||
</c:Lifetime>
|
</c:Lifetime>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Weapons/CylinderBullet.mesh</Resource>
|
<Resource>Models/Effects/CylinderShot.mesh</Resource>
|
||||||
<Color A="0.156862751" B="0" G="0.525490224" R="39.2156868"/>
|
<Color A="0.149019614" B="0" G="0" R="39.2156868"/>
|
||||||
<Transparent>true</Transparent>
|
<Transparent>true</Transparent>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Scale X="0.0110000009" Y="0.029000001" Z="100"/>
|
<Scale X="0.0690000057" Y="0.0690000057" Z="100"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="WeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>2</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:ExplosionEffect>
|
||||||
|
<ColorByDistance>true</ColorByDistance>
|
||||||
|
<Velocity X="3.33300018" Y="0.0320000015" Z="0"/>
|
||||||
|
<ExplosionOrigin X="0" Y="0.0790000036" Z="-0.329000026"/>
|
||||||
|
<ExponentialAccelaration>true</ExponentialAccelaration>
|
||||||
|
<EndColor A="0" B="19.6078434" G="19.6078434" R="1"/>
|
||||||
|
<Randomness>true</Randomness>
|
||||||
|
</c:ExplosionEffect>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="WeaponModel" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>2</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:ExplosionEffect>
|
||||||
|
<ColorByDistance>true</ColorByDistance>
|
||||||
|
<Velocity X="1.63300014" Y="0.0320000015" Z="0"/>
|
||||||
|
<ExplosionOrigin X="0" Y="0.0790000036" Z="-0.329000026"/>
|
||||||
|
<ExponentialAccelaration>true</ExponentialAccelaration>
|
||||||
|
<EndColor A="0" B="19.6078434" G="19.6078434" R="1"/>
|
||||||
|
<Randomness>true</Randomness>
|
||||||
|
</c:ExplosionEffect>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="47.681942" Y="0.14480646" Z="46.8966408"/>
|
||||||
|
<Scale X="2" Y="2" Z="2"/>
|
||||||
|
<Orientation X="5.9380002" Y="0" Z="0.35800001"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.10786498" Y="-0.615343928" Z="-0.37226662"/>
|
||||||
|
<Orientation X="0.443000019" Y="0.685000062" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="2.15796614" Y="-1.18461192" Z="-0.382025093"/>
|
||||||
|
<Orientation X="0" Y="2.18400002" Z="5.72200012"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="3.53984666" Y="-1.55501318" Z="-0.237787247"/>
|
||||||
|
<Orientation X="0.604000032" Y="0.640000045" Z="6.28300047"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-2.86977816" Y="0.0265773162" Z="0.530605257"/>
|
||||||
|
<Orientation X="0" Y="4.71200037" Z="5.89000034"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-4.06748295" Y="1.2850678" Z="1.0140655"/>
|
||||||
|
<Orientation X="0" Y="4.94500017" Z="5.66600037"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-1.6440227" Y="-0.104511783" Z="0.248545036"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="3.22254896" Y="-0.99158901" Z="-1.59910381"/>
|
||||||
|
<Orientation X="0.268000007" Y="5.9920001" Z="6.00300026"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-3.07137322" Y="0.124666147" Z="1.97699928"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-4.24249363" Y="0.303708076" Z="1.92021227"/>
|
||||||
|
<Orientation X="0" Y="2.95000005" Z="5.79700041"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Collidable/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/Stones/MediumStone1.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-1.89417958" Y="-0.57703048" Z="0.874724686"/>
|
||||||
|
<Orientation X="0.345000029" Y="0.651000023" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="MagazineAmmo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>0</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Ammo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>360</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="1.17647064" R="0"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="5.2833886e-05" Y="-0.0407950208" Z="0"/>
|
||||||
|
<Scale X="0.0399999991" Y="0.0399999991" Z="0.0399999991"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -43,6 +43,9 @@
|
|||||||
<xs:element ref="c:Shield" minOccurs="0"/>
|
<xs:element ref="c:Shield" minOccurs="0"/>
|
||||||
<xs:element ref="c:Shielded" minOccurs="0"/>
|
<xs:element ref="c:Shielded" minOccurs="0"/>
|
||||||
<xs:element ref="c:CapturePointHUD" minOccurs="0"/>
|
<xs:element ref="c:CapturePointHUD" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:AmmunitionHUD" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:Sprite" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:AnimationOffset" minOccurs="0"/>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -0,0 +1,245 @@
|
|||||||
|
#version 430
|
||||||
|
|
||||||
|
uniform mat4 M;
|
||||||
|
uniform mat4 V;
|
||||||
|
uniform mat4 P;
|
||||||
|
uniform vec2 ScreenDimensions;
|
||||||
|
uniform float FillPercentage;
|
||||||
|
uniform vec4 DiffuseColor;
|
||||||
|
uniform vec4 FillColor;
|
||||||
|
uniform vec4 Color;
|
||||||
|
uniform vec4 AmbientColor;
|
||||||
|
|
||||||
|
//Get bineded at the same time as the textures
|
||||||
|
uniform vec2 DiffuseUVRepeat1;
|
||||||
|
uniform vec2 DiffuseUVRepeat2;
|
||||||
|
uniform vec2 DiffuseUVRepeat3;
|
||||||
|
uniform vec2 NormalUVRepeat1;
|
||||||
|
uniform vec2 NormalUVRepeat2;
|
||||||
|
uniform vec2 NormalUVRepeat3;
|
||||||
|
uniform vec2 SpecularUVRepeat1;
|
||||||
|
uniform vec2 SpecularUVRepeat2;
|
||||||
|
uniform vec2 SpecularUVRepeat3;
|
||||||
|
uniform vec2 GlowUVRepeat1;
|
||||||
|
uniform vec2 GlowUVRepeat2;
|
||||||
|
uniform vec2 GlowUVRepeat3;
|
||||||
|
layout (binding = 0) uniform sampler2D SplatMapTexture;
|
||||||
|
layout (binding = 1) uniform sampler2D DiffuseTexture1;
|
||||||
|
layout (binding = 2) uniform sampler2D DiffuseTexture2;
|
||||||
|
layout (binding = 3) uniform sampler2D DiffuseTexture3;
|
||||||
|
layout (binding = 4) uniform sampler2D NormalMapTexture1;
|
||||||
|
layout (binding = 5) uniform sampler2D NormalMapTexture2;
|
||||||
|
layout (binding = 6) uniform sampler2D NormalMapTexture3;
|
||||||
|
layout (binding = 7) uniform sampler2D SpecularMapTexture1;
|
||||||
|
layout (binding = 8) uniform sampler2D SpecularMapTexture2;
|
||||||
|
layout (binding = 9) uniform sampler2D SpecularMapTexture3;
|
||||||
|
layout (binding = 10) uniform sampler2D GlowMapTexture1;
|
||||||
|
layout (binding = 11) uniform sampler2D GlowMapTexture2;
|
||||||
|
layout (binding = 12) uniform sampler2D GlowMapTexture3;
|
||||||
|
|
||||||
|
#define TILE_SIZE 16
|
||||||
|
|
||||||
|
struct LightSource {
|
||||||
|
vec4 Position;
|
||||||
|
vec4 Direction;
|
||||||
|
vec4 Color;
|
||||||
|
float Radius;
|
||||||
|
float Intensity;
|
||||||
|
float Falloff;
|
||||||
|
int Type;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout (std430, binding = 1) buffer LightBuffer
|
||||||
|
{
|
||||||
|
LightSource List[];
|
||||||
|
} LightSources;
|
||||||
|
|
||||||
|
struct LightGrid {
|
||||||
|
float Start;
|
||||||
|
float Amount;
|
||||||
|
vec2 Padding;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout (std430, binding = 2) buffer LightGridBuffer
|
||||||
|
{
|
||||||
|
LightGrid Data[];
|
||||||
|
} LightGrids;
|
||||||
|
|
||||||
|
layout (std430, binding = 4) buffer LightIndexBuffer
|
||||||
|
{
|
||||||
|
float LightIndex[];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
in VertexData{
|
||||||
|
vec3 Position;
|
||||||
|
vec3 Normal;
|
||||||
|
vec3 Tangent;
|
||||||
|
vec3 BiTangent;
|
||||||
|
vec2 TextureCoordinate;
|
||||||
|
vec4 ExplosionColor;
|
||||||
|
float ExplosionPercentageElapsed;
|
||||||
|
}Input;
|
||||||
|
|
||||||
|
out vec4 sceneColor;
|
||||||
|
out vec4 bloomColor;
|
||||||
|
|
||||||
|
struct LightResult {
|
||||||
|
vec4 Diffuse;
|
||||||
|
vec4 Specular;
|
||||||
|
};
|
||||||
|
|
||||||
|
float CalcAttenuation(float radius, float dist, float falloff) {
|
||||||
|
return 1.0 - smoothstep(radius * 0.3, radius, dist);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcSpecular(vec4 lightColor, vec4 viewVec, vec4 lightVec, vec4 normal) {
|
||||||
|
vec4 R = normalize( reflect(-lightVec, normal));
|
||||||
|
float RdotV = max( dot(R, viewVec), 0.0);
|
||||||
|
return lightColor * pow(RdotV, 90.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcDiffuse(vec4 lightColor, vec4 lightVec, vec4 normal) {
|
||||||
|
float power = max( dot(normal, lightVec), 0.0);
|
||||||
|
return lightColor * power;
|
||||||
|
}
|
||||||
|
|
||||||
|
LightResult CalcPointLightSource(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal, float falloff)
|
||||||
|
{
|
||||||
|
vec4 L = lightPos - position;
|
||||||
|
float dist = length(L);
|
||||||
|
L = normalize(L);
|
||||||
|
|
||||||
|
float attenuation = CalcAttenuation(lightRadius, dist, falloff);
|
||||||
|
|
||||||
|
LightResult result;
|
||||||
|
result.Diffuse = CalcDiffuse(lightColor, L, normal) * attenuation * intensity;
|
||||||
|
result.Specular = CalcSpecular(lightColor, viewVec, L, normal) * attenuation * intensity;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensity, vec4 viewVec, vec4 vertNormal)
|
||||||
|
{
|
||||||
|
vec4 L = normalize( -vec4(direction.xyz, 0) );
|
||||||
|
|
||||||
|
LightResult result;
|
||||||
|
result.Diffuse = CalcDiffuse(color, L, vertNormal) * intensity;
|
||||||
|
result.Specular = CalcSpecular(color, viewVec, L, vertNormal) * intensity;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
|
||||||
|
{
|
||||||
|
mat3 TBN = mat3(tangent, bitangent, normal);
|
||||||
|
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
|
||||||
|
return vec4(TBN * normalize(NormalMap), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
|
||||||
|
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){
|
||||||
|
vec4 R_Channel = texture2D(R, Input.TextureCoordinate * R_TileValues);
|
||||||
|
vec4 G_Channel = texture2D(G, Input.TextureCoordinate * G_TileValues);
|
||||||
|
vec4 B_Channel = texture2D(B, Input.TextureCoordinate * B_TileValues);
|
||||||
|
|
||||||
|
float total = blendValue.r + blendValue.g + blendValue.b;
|
||||||
|
float totalDiv = 1.0f / total;
|
||||||
|
blendValue.r = blendValue.r * totalDiv;
|
||||||
|
blendValue.g = blendValue.g * totalDiv;
|
||||||
|
blendValue.b = blendValue.b * totalDiv;
|
||||||
|
|
||||||
|
return blendValue.r * R_Channel
|
||||||
|
+ blendValue.g * G_Channel
|
||||||
|
+ blendValue.b * B_Channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
|
||||||
|
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){
|
||||||
|
mat3 TBN = mat3(Input.Tangent, Input.BiTangent, Input.Normal);
|
||||||
|
vec3 R_Channel = texture(R, Input.TextureCoordinate * R_TileValues).xyz * 2.0 - vec3(1.0);
|
||||||
|
vec3 G_Channel = texture(G, Input.TextureCoordinate * G_TileValues).xyz * 2.0 - vec3(1.0);
|
||||||
|
vec3 B_Channel = texture(B, Input.TextureCoordinate * B_TileValues).xyz * 2.0 - vec3(1.0);
|
||||||
|
|
||||||
|
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
|
||||||
|
float totalDiv = 1 / total;
|
||||||
|
blendValue.r = blendValue.r * totalDiv;
|
||||||
|
blendValue.g = blendValue.g * totalDiv;
|
||||||
|
blendValue.b = blendValue.b * totalDiv;
|
||||||
|
|
||||||
|
vec3 Normal_result = blendValue.r * R_Channel
|
||||||
|
+ blendValue.g * G_Channel
|
||||||
|
+ blendValue.b * B_Channel;
|
||||||
|
|
||||||
|
return vec4(TBN * normalize(Normal_result), 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 splatTexel = texture2D(SplatMapTexture, Input.TextureCoordinate);
|
||||||
|
|
||||||
|
vec4 diffuseTexel = CalcBlendedTexel(splatTexel, DiffuseTexture1, DiffuseTexture2, DiffuseTexture3,
|
||||||
|
DiffuseUVRepeat1, DiffuseUVRepeat2, DiffuseUVRepeat3);
|
||||||
|
vec4 glowTexel = CalcBlendedTexel(splatTexel, GlowMapTexture1, GlowMapTexture2, GlowMapTexture3,
|
||||||
|
GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3);
|
||||||
|
vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3,
|
||||||
|
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
|
||||||
|
vec4 position = V * M * vec4(Input.Position, 1.0);
|
||||||
|
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
|
||||||
|
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
|
||||||
|
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3);
|
||||||
|
normal = normalize(normal);
|
||||||
|
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
|
||||||
|
vec4 viewVec = normalize(-position);
|
||||||
|
|
||||||
|
vec2 tilePos;
|
||||||
|
tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
|
||||||
|
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
||||||
|
|
||||||
|
LightResult totalLighting;
|
||||||
|
totalLighting.Diffuse = vec4(AmbientColor.rgb, 1.0);
|
||||||
|
int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE)));
|
||||||
|
|
||||||
|
int start = int(LightGrids.Data[currentTile].Start);
|
||||||
|
int amount = int(LightGrids.Data[currentTile].Amount);
|
||||||
|
|
||||||
|
for(int i = start; i < start + amount; i++) {
|
||||||
|
|
||||||
|
int l = int(LightIndex[i]);
|
||||||
|
LightSource light = LightSources.List[l];
|
||||||
|
|
||||||
|
LightResult light_result;
|
||||||
|
//These if statements should be removed.
|
||||||
|
if(light.Type == 1) { // point
|
||||||
|
light_result = CalcPointLightSource(V * light.Position, light.Radius, light.Color, light.Intensity, viewVec, position, normal, light.Falloff);
|
||||||
|
} else if (light.Type == 2) { //Directional
|
||||||
|
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
||||||
|
}
|
||||||
|
totalLighting.Diffuse += light_result.Diffuse;
|
||||||
|
totalLighting.Specular += light_result.Specular;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
||||||
|
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
|
||||||
|
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
|
||||||
|
|
||||||
|
|
||||||
|
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
|
||||||
|
|
||||||
|
if(pos <= FillPercentage) {
|
||||||
|
color_result += FillColor;
|
||||||
|
}
|
||||||
|
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||||
|
color_result += glowTexel*3;
|
||||||
|
|
||||||
|
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
|
||||||
|
|
||||||
|
//Tiled Debug Code
|
||||||
|
/*
|
||||||
|
if(int(gl_FragCoord.x)%16 == 0 || int(gl_FragCoord.y)%16 == 0 ) {
|
||||||
|
sceneColor += vec4(0.5, 0, 0, 0);
|
||||||
|
} else {
|
||||||
|
sceneColor += vec4(LightGrids.Data[int(tilePos.x + tilePos.y*80)].Amount/LightSources.List.length(), 0, 0, 1);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,27 +1,16 @@
|
|||||||
#version 430
|
#version 430
|
||||||
|
|
||||||
uniform vec2 PickingColor;
|
uniform vec2 PickingColor;
|
||||||
layout (binding = 0) uniform sampler2D Texture;
|
|
||||||
uniform vec4 Color;
|
|
||||||
uniform vec4 DiffuseColor;
|
|
||||||
uniform vec2 DiffuseUVRepeat;
|
|
||||||
|
|
||||||
|
|
||||||
in VertexData{
|
in VertexData{
|
||||||
vec3 Position;
|
vec3 Position;
|
||||||
vec2 TextureCoord;
|
|
||||||
}Input;
|
}Input;
|
||||||
|
|
||||||
out vec4 TextureFragment;
|
out vec4 TextureFragment;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 diffuseTexel = texture2D(Texture, Input.TextureCoord * DiffuseUVRepeat);
|
TextureFragment = vec4(PickingColor/255, 0, 1);
|
||||||
|
|
||||||
if(Color.a * diffuseTexel.a >= 0.9) {
|
|
||||||
TextureFragment = vec4(PickingColor/255, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,10 @@ layout(location = 4) in vec2 TextureCoords;
|
|||||||
|
|
||||||
out VertexData{
|
out VertexData{
|
||||||
vec3 Position;
|
vec3 Position;
|
||||||
vec2 TextureCoord;
|
|
||||||
}Output;
|
}Output;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = P*V*M * vec4(Position, 1.0);
|
gl_Position = P*V*M * vec4(Position, 1.0);
|
||||||
Output.Position = Position, 1.0;
|
Output.Position = Position, 1.0;
|
||||||
Output.TextureCoord = TextureCoords;
|
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,6 @@ layout(location = 6) in vec4 BoneWeights;
|
|||||||
|
|
||||||
out VertexData{
|
out VertexData{
|
||||||
vec3 Position;
|
vec3 Position;
|
||||||
vec2 TextureCoord;
|
|
||||||
}Output;
|
}Output;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
@@ -30,5 +29,4 @@ void main()
|
|||||||
|
|
||||||
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
gl_Position = P*V*M*boneTransform * vec4(Position, 1.0);
|
||||||
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
Output.Position = (boneTransform * vec4(Position, 1.0)).xyz;
|
||||||
Output.TextureCoord = TextureCoords;
|
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@ void main()
|
|||||||
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||||
|
|
||||||
//bloomColor = vec4(clamp((glowTexel.xyz*3) - 1.0, 0, 100), 1.0);
|
//bloomColor = vec4(clamp((glowTexel.xyz*3) - 1.0, 0, 100), 1.0);
|
||||||
|
bloomColor = vec4(1.0, 1.0, 1.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
#include "Rendering/Model.h"
|
#include "Rendering/Model.h"
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
|
#include "Core/Octree.h"
|
||||||
|
|
||||||
namespace Collision
|
namespace Collision
|
||||||
{
|
{
|
||||||
@@ -145,13 +146,14 @@ bool RayVsTriangle(const Ray& ray,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 std::vector<unsigned int>& modelIndices,
|
||||||
|
const glm::mat4& modelMatrix)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < modelIndices.size(); ++i) {
|
for (int i = 0; i < modelIndices.size();) {
|
||||||
glm::vec3 v0 = modelVertices[modelIndices[i]].Position;
|
glm::vec3 v0 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||||
glm::vec3 v1 = modelVertices[modelIndices[++i]].Position;
|
glm::vec3 v1 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||||
glm::vec3 v2 = modelVertices[modelIndices[++i]].Position;
|
glm::vec3 v2 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||||
if (RayVsTriangle(ray, v0, v1, v2)) {
|
if (RayVsTriangle(ray, v0, v1, v2)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -192,19 +194,20 @@ bool RayVsTriangle(const Ray& ray,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 std::vector<unsigned int>& modelIndices,
|
||||||
|
const glm::mat4& modelMatrix,
|
||||||
float& outDistance,
|
float& outDistance,
|
||||||
float& outUCoord,
|
float& outUCoord,
|
||||||
float& outVCoord)
|
float& outVCoord)
|
||||||
{
|
{
|
||||||
outDistance = INFINITY;
|
outDistance = INFINITY;
|
||||||
bool hit = false;
|
bool hit = false;
|
||||||
for (int i = 0; i < modelIndices.size(); ++i) {
|
for (int i = 0; i < modelIndices.size();) {
|
||||||
glm::vec3 v0 = modelVertices[modelIndices[i]].Position;
|
glm::vec3 v0 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||||
glm::vec3 v1 = modelVertices[modelIndices[++i]].Position;
|
glm::vec3 v1 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||||
glm::vec3 v2 = modelVertices[modelIndices[++i]].Position;
|
glm::vec3 v2 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||||
float dist;
|
float dist = INFINITY;
|
||||||
float u;
|
float u;
|
||||||
float v;
|
float v;
|
||||||
if (RayVsTriangle(ray, v0, v1, v2, dist, u, v)) {
|
if (RayVsTriangle(ray, v0, v1, v2, dist, u, v)) {
|
||||||
@@ -218,14 +221,15 @@ bool RayVsModel(const Ray& ray,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 std::vector<unsigned int>& modelIndices,
|
||||||
|
const glm::mat4& modelMatrix,
|
||||||
glm::vec3& outHitPosition)
|
glm::vec3& outHitPosition)
|
||||||
{
|
{
|
||||||
float u;
|
float u;
|
||||||
float v;
|
float v;
|
||||||
float dist;
|
float dist;
|
||||||
bool hit = RayVsModel(ray, modelVertices, modelIndices, dist, u, v);
|
bool hit = RayVsModel(ray, modelVertices, modelIndices, modelMatrix, dist, u, v);
|
||||||
outHitPosition = ray.Origin() + dist * ray.Direction();
|
outHitPosition = ray.Origin() + dist * ray.Direction();
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
@@ -572,11 +576,11 @@ boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeM
|
|||||||
ComponentWrapper& cAABB = entity["AABB"];
|
ComponentWrapper& cAABB = entity["AABB"];
|
||||||
modelSpaceBox = EntityAABB::FromOriginSize((glm::vec3)cAABB["Origin"], (glm::vec3)cAABB["Size"]);
|
modelSpaceBox = EntityAABB::FromOriginSize((glm::vec3)cAABB["Origin"], (glm::vec3)cAABB["Size"]);
|
||||||
} else if (entity.HasComponent("Model")) {
|
} else if (entity.HasComponent("Model")) {
|
||||||
Model* model;
|
|
||||||
std::string res = entity["Model"]["Resource"];
|
std::string res = entity["Model"]["Resource"];
|
||||||
if (res.empty()) {
|
if (res.empty()) {
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
Model* model;
|
||||||
try {
|
try {
|
||||||
model = ResourceManager::Load<::Model, true>(res);
|
model = ResourceManager::Load<::Model, true>(res);
|
||||||
} catch (const Resource::StillLoadingException&) {
|
} catch (const Resource::StillLoadingException&) {
|
||||||
@@ -638,4 +642,36 @@ boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity)
|
|||||||
return aabb;
|
return aabb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<EntityAABB> entitiesPotentiallyHitSorted, float& outDistance, glm::vec3& outIntersectPos)
|
||||||
|
{
|
||||||
|
for (EntityAABB& entityBox : entitiesPotentiallyHitSorted) {
|
||||||
|
if (!entityBox.Entity.HasComponent("Model")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::string res = entityBox.Entity["Model"]["Resource"];
|
||||||
|
if (res.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Model* model;
|
||||||
|
try {
|
||||||
|
model = ResourceManager::Load<::Model, true>(res);
|
||||||
|
} catch (const std::exception&) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
float u, v;
|
||||||
|
if (RayVsModel(ray, model->Vertices(), model->m_RawModel->m_Indices, Transform::ModelMatrix(entityBox.Entity), outDistance, u, v)) {
|
||||||
|
outIntersectPos = ray.Origin() + outDistance * ray.Direction();
|
||||||
|
return entityBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return boost::none;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, Octree<EntityAABB>* octree, float& outDistance, glm::vec3& outIntersectPos)
|
||||||
|
{
|
||||||
|
std::vector<EntityAABB> outObjects;
|
||||||
|
octree->ObjectsPossiblyHitByRay(ray, outObjects);
|
||||||
|
return Collision::EntityFirstHitByRay(ray, outObjects, outDistance, outIntersectPos);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,6 @@ void EntityFilePreprocessor::parseComponentInfo()
|
|||||||
|
|
||||||
// Name
|
// Name
|
||||||
compInfo.Name = XS::ToString(element->getName());
|
compInfo.Name = XS::ToString(element->getName());
|
||||||
bool brk = compInfo.Name == "HiddenForLocalPlayer";
|
|
||||||
// Known allocation
|
// Known allocation
|
||||||
compInfo.Meta->Allocation = m_ComponentCounts[compInfo.Name];
|
compInfo.Meta->Allocation = m_ComponentCounts[compInfo.Name];
|
||||||
// Annotation
|
// Annotation
|
||||||
|
|||||||
@@ -5,22 +5,6 @@
|
|||||||
#include "Core/Octree.h"
|
#include "Core/Octree.h"
|
||||||
#include "Collision/Collision.h"
|
#include "Collision/Collision.h"
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
//To be able to sort nodes based on distance to ray origin.
|
|
||||||
struct ChildInfo
|
|
||||||
{
|
|
||||||
int Index;
|
|
||||||
float Distance;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool isFirstLower(const ChildInfo& first, const ChildInfo& second)
|
|
||||||
{
|
|
||||||
return first.Distance < second.Distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace OctSpace
|
namespace OctSpace
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -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 the ray shoots the tree, and it is a parent to 8 children :o
|
||||||
if (hasChildren()) {
|
if (hasChildren()) {
|
||||||
//Sort children according to their distance from the ray origin.
|
//Sort children according to their distance from the ray origin.
|
||||||
std::vector<ChildInfo> childInfos;
|
std::vector<RaySorterInfo> childInfos;
|
||||||
childInfos.reserve(8);
|
childInfos.reserve(8);
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
childInfos.push_back({ i, glm::distance(ray.Origin(), m_Children[i]->m_Box.Origin()) });
|
childInfos.push_back({ i, glm::distance(ray.Origin(), m_Children[i]->m_Box.Origin()) });
|
||||||
}
|
}
|
||||||
std::sort(childInfos.begin(), childInfos.end(), isFirstLower);
|
std::sort(childInfos.begin(), childInfos.end(), isFirstLower);
|
||||||
//Loop through the children, starting with the one closest to the ray origin. I.e the first to be hit.
|
//Loop through the children, starting with the one closest to the ray origin. I.e the first to be hit.
|
||||||
for (const ChildInfo& info : childInfos) {
|
for (const RaySorterInfo& info : childInfos) {
|
||||||
if (m_Children[info.Index]->RayCollides(ray, data)) {
|
if (m_Children[info.Index]->RayCollides(ray, data)) {
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+148
-96
@@ -1,10 +1,8 @@
|
|||||||
#include "Network/Client.h"
|
#include "Network/Client.h"
|
||||||
|
|
||||||
using namespace boost::asio::ip;
|
using namespace boost::asio::ip;
|
||||||
|
|
||||||
Client::Client(World* world, EventBroker* eventBroker)
|
Client::Client(World* world, EventBroker* eventBroker)
|
||||||
: Network(world, eventBroker)
|
: Network(world, eventBroker)
|
||||||
, m_Socket(m_IOService)
|
|
||||||
{
|
{
|
||||||
// Asumes root node is EntityID_Invalid
|
// Asumes root node is EntityID_Invalid
|
||||||
insertIntoServerClientMaps(EntityID_Invalid, EntityID_Invalid);
|
insertIntoServerClientMaps(EntityID_Invalid, EntityID_Invalid);
|
||||||
@@ -14,7 +12,6 @@ Client::Client(World* world, EventBroker* eventBroker)
|
|||||||
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
m_PlayerName = config->Get<std::string>("Networking.Name", "Raptorcopter");
|
m_PlayerName = config->Get<std::string>("Networking.Name", "Raptorcopter");
|
||||||
m_SendInputIntervalMs = config->Get<int>("Networking.SendInputIntervalMs", 33);
|
m_SendInputIntervalMs = config->Get<int>("Networking.SendInputIntervalMs", 33);
|
||||||
|
|
||||||
LOG_INFO("Client initialized");
|
LOG_INFO("Client initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,70 +23,77 @@ Client::Client(World* world, EventBroker* eventBroker, std::unique_ptr<SnapshotF
|
|||||||
|
|
||||||
Client::~Client()
|
Client::~Client()
|
||||||
{ }
|
{ }
|
||||||
|
// Need to call connect at start
|
||||||
void Client::Connect(std::string address, int port)
|
void Client::Connect(std::string address, int port)
|
||||||
{
|
{
|
||||||
// Subscribe to events
|
// Subscribe to events
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Client::OnInputCommand);
|
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Client::OnInputCommand);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Client::OnPlayerDamage);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Client::OnPlayerDamage);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Client::OnPlayerSpawned);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Client::OnPlayerSpawned);
|
||||||
|
|
||||||
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
|
m_Address = address;
|
||||||
if (address.empty()) {
|
if (address.empty()) {
|
||||||
address = config->Get<std::string>("Networking.Address", "127.0.0.1");
|
m_Address = config->Get<std::string>("Networking.Address", "127.0.0.1");
|
||||||
}
|
}
|
||||||
|
m_Port = port;
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
port = config->Get<int>("Networking.Port", 27666);
|
m_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);
|
|
||||||
connect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Update()
|
void Client::Update()
|
||||||
{
|
{
|
||||||
m_EventBroker->Process<Client>();
|
m_EventBroker->Process<Client>();
|
||||||
readFromServer();
|
while (m_Unreliable.IsSocketAvailable()) {
|
||||||
|
// Packet will get real data in receive
|
||||||
|
Packet packet(MessageType::Invalid);
|
||||||
|
m_Unreliable.Receive(packet);
|
||||||
|
if (packet.GetMessageType() == MessageType::Connect) {
|
||||||
|
parseUDPConnect(packet);
|
||||||
|
} else {
|
||||||
|
parseMessageType(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (m_Reliable.IsSocketAvailable()) {
|
||||||
|
// Packet will get real data in receive
|
||||||
|
Packet packet(MessageType::Invalid);
|
||||||
|
m_Reliable.Receive(packet);
|
||||||
|
if (packet.GetMessageType() == MessageType::Connect) {
|
||||||
|
parseTCPConnect(packet);
|
||||||
|
} else {
|
||||||
|
parseMessageType(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (m_IsConnected) {
|
if (m_IsConnected) {
|
||||||
hasServerTimedOut();
|
// Don't send 1 input in 1 packet, bunch em up.
|
||||||
// Don't sent 1 input in 1 packet, bunch em up.
|
|
||||||
if (m_SendInputIntervalMs < (1000 * (std::clock() - m_TimeSinceSentInputs) / (double)CLOCKS_PER_SEC)) {
|
if (m_SendInputIntervalMs < (1000 * (std::clock() - m_TimeSinceSentInputs) / (double)CLOCKS_PER_SEC)) {
|
||||||
sendInputCommands();
|
sendInputCommands();
|
||||||
m_TimeSinceSentInputs = std::clock();
|
m_TimeSinceSentInputs = std::clock();
|
||||||
}
|
}
|
||||||
// HACK: Send absolute player positions for now to avoid desync until we have reliable messages
|
// HACK: Send absolute player positions for now to avoid desync until we have reliable messages
|
||||||
sendLocalPlayerTransform();
|
sendLocalPlayerTransform();
|
||||||
}
|
|
||||||
Network::Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::readFromServer()
|
hasServerTimedOut();
|
||||||
{
|
|
||||||
while (m_Socket.available()) {
|
|
||||||
bytesRead = receive(readBuf);
|
|
||||||
if (bytesRead > 0) {
|
|
||||||
Packet packet(readBuf, bytesRead);
|
|
||||||
parseMessageType(packet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
//Network::Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::parseMessageType(Packet& packet)
|
void Client::parseMessageType(Packet& packet)
|
||||||
{
|
{
|
||||||
|
// Pop packetSize which is used by TCP Client to
|
||||||
|
// create a packet of the correct size
|
||||||
|
packet.ReadPrimitive<int>();
|
||||||
int messageType = packet.ReadPrimitive<int>();
|
int messageType = packet.ReadPrimitive<int>();
|
||||||
if (messageType == -1)
|
if (messageType == -1)
|
||||||
return;
|
return;
|
||||||
// Read packet ID
|
// Read packet ID
|
||||||
m_PreviousPacketID = m_PacketID; // Set previous packet id
|
m_PreviousPacketID = m_PacketID; // Set previous packet id
|
||||||
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
|
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
|
||||||
identifyPacketLoss();
|
//identifyPacketLoss();
|
||||||
|
|
||||||
switch (static_cast<MessageType>(messageType)) {
|
switch (static_cast<MessageType>(messageType)) {
|
||||||
case MessageType::Connect:
|
|
||||||
parseConnect(packet);
|
|
||||||
break;
|
|
||||||
case MessageType::Ping:
|
case MessageType::Ping:
|
||||||
parsePing();
|
parsePing();
|
||||||
break;
|
break;
|
||||||
@@ -115,17 +119,40 @@ void Client::parseMessageType(Packet& packet)
|
|||||||
case MessageType::ComponentDeleted:
|
case MessageType::ComponentDeleted:
|
||||||
parseComponentDeletion(packet);
|
parseComponentDeletion(packet);
|
||||||
break;
|
break;
|
||||||
|
case MessageType::OnPlayerDamage:
|
||||||
|
parsePlayerDamage(packet);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::parseConnect(Packet& packet)
|
void Client::parseUDPConnect(Packet& packet)
|
||||||
{
|
{
|
||||||
// Map ServerEntityID and your PlayerID
|
// Map ServerEntityID and your PlayerID
|
||||||
LOG_INFO("I be connected PogChamp");
|
LOG_INFO("I be connected PogChamp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::parseTCPConnect(Packet& packet)
|
||||||
|
{
|
||||||
|
LOG_INFO("Received TCP connect from server");
|
||||||
|
// Pop size of message int
|
||||||
|
packet.ReadPrimitive<int>();
|
||||||
|
int messageType = packet.ReadPrimitive<int>();
|
||||||
|
// Read packet ID
|
||||||
|
m_PreviousPacketID = m_PacketID; // Set previous packet id
|
||||||
|
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
|
||||||
|
// parse player id and other stuff
|
||||||
|
m_PlayerID = packet.ReadPrimitive<int>();
|
||||||
|
m_PlayerID = packet.ReadPrimitive<int>();
|
||||||
|
LOG_INFO("A Player connected");
|
||||||
|
Packet UnreliablePacket(MessageType::Connect, m_SendPacketID);
|
||||||
|
// Add player id and other stuff
|
||||||
|
packet.WritePrimitive(m_PlayerID);
|
||||||
|
m_Unreliable.Send(packet);
|
||||||
|
LOG_INFO("Sent UDP Connect Server");
|
||||||
|
}
|
||||||
|
|
||||||
void Client::parsePlayerConnected(Packet & packet)
|
void Client::parsePlayerConnected(Packet & packet)
|
||||||
{
|
{
|
||||||
// Map ServerEntityID and other player's PlayerID
|
// Map ServerEntityID and other player's PlayerID
|
||||||
@@ -143,7 +170,7 @@ void Client::parsePing()
|
|||||||
|
|
||||||
Packet packet(MessageType::Ping, m_SendPacketID);
|
Packet packet(MessageType::Ping, m_SendPacketID);
|
||||||
packet.WriteString("Ping recieved");
|
packet.WriteString("Ping recieved");
|
||||||
send(packet);
|
m_Reliable.Send(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::parseKick()
|
void Client::parseKick()
|
||||||
@@ -152,14 +179,41 @@ void Client::parseKick()
|
|||||||
m_IsConnected = false;
|
m_IsConnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::parseSpawnEvents()
|
||||||
|
{
|
||||||
|
std::vector<Events::PlayerSpawned> tempSpawn;
|
||||||
|
for (int i = 0; i < m_PlayerSpawnEvents.size(); i++) {
|
||||||
|
Events::PlayerSpawned e;
|
||||||
|
if (!serverClientMapsHasEntity(m_PlayerSpawnEvents.at(i).Player.ID)) {
|
||||||
|
tempSpawn.push_back(m_PlayerSpawnEvents.at(i));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(m_PlayerSpawnEvents.at(i).Player.ID));
|
||||||
|
//e.Spawner = EntityWrapper(m_World, m_ServerIDToClientID.at(m_PlayerSpawnEvents.at(i).Spawner.ID));
|
||||||
|
e.PlayerID = -1;
|
||||||
|
e.PlayerName = m_PlayerSpawnEvents.at(i).PlayerName;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
m_PlayerSpawnEvents = tempSpawn;
|
||||||
|
// m_PlayerSpawnEvents.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void Client::parsePlayersSpawned(Packet& packet)
|
void Client::parsePlayersSpawned(Packet& packet)
|
||||||
{
|
{
|
||||||
|
//Events::PlayerSpawned e;
|
||||||
|
//e.Player = EntityWrapper(m_World, m_ServerIDToClientID[packet.ReadPrimitive<EntityID>()]);
|
||||||
|
//e.Spawner = EntityWrapper(m_World, m_ServerIDToClientID[packet.ReadPrimitive<EntityID>()]);
|
||||||
|
//e.PlayerID = -1;
|
||||||
|
//e.PlayerName = packet.ReadString();
|
||||||
|
//m_EventBroker->Publish(e);
|
||||||
|
|
||||||
Events::PlayerSpawned e;
|
Events::PlayerSpawned e;
|
||||||
e.Player = EntityWrapper(m_World, m_ServerIDToClientID[packet.ReadPrimitive<EntityID>()]);
|
e.Player = EntityWrapper(m_World, packet.ReadPrimitive<EntityID>());
|
||||||
e.Spawner = EntityWrapper(m_World, m_ServerIDToClientID[packet.ReadPrimitive<EntityID>()]);
|
e.Spawner = EntityWrapper(m_World, packet.ReadPrimitive<EntityID>());
|
||||||
e.PlayerID = -1;
|
e.PlayerID = -1;
|
||||||
e.PlayerName = packet.ReadString();
|
e.PlayerName = packet.ReadString();
|
||||||
m_EventBroker->Publish(e);
|
m_PlayerSpawnEvents.push_back(e);
|
||||||
|
parseSpawnEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::parseEntityDeletion(Packet & packet)
|
void Client::parseEntityDeletion(Packet & packet)
|
||||||
@@ -235,10 +289,15 @@ void Client::parseSnapshot(Packet& packet)
|
|||||||
for (std::size_t i = 0; i < numInputCommands; ++i) {
|
for (std::size_t i = 0; i < numInputCommands; ++i) {
|
||||||
Events::InputCommand e;
|
Events::InputCommand e;
|
||||||
e.PlayerID = packet.ReadPrimitive<EntityID>();
|
e.PlayerID = packet.ReadPrimitive<EntityID>();
|
||||||
e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(packet.ReadPrimitive<EntityID>()));
|
EntityID player = packet.ReadPrimitive<EntityID>();
|
||||||
e.Command = packet.ReadString();
|
std::string command = packet.ReadString();
|
||||||
e.Value = packet.ReadPrimitive<float>();
|
float value = packet.ReadPrimitive<float>();
|
||||||
m_EventBroker->Publish(e);
|
if (m_ServerIDToClientID.find(player) != m_ServerIDToClientID.end()) {
|
||||||
|
e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(player));
|
||||||
|
e.Command = command;
|
||||||
|
e.Value = value;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read world state
|
// Read world state
|
||||||
@@ -297,56 +356,17 @@ void Client::parseSnapshot(Packet& packet)
|
|||||||
m_World->SetParent(localEntityID, m_ServerIDToClientID.at(serverParentID));
|
m_World->SetParent(localEntityID, m_ServerIDToClientID.at(serverParentID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
parseSpawnEvents();
|
||||||
|
|
||||||
size_t Client::receive(char* data)
|
|
||||||
{
|
|
||||||
boost::system::error_code error;
|
|
||||||
|
|
||||||
size_t bytesReceived = m_Socket.receive_from(boost
|
|
||||||
::asio::buffer((void*)data, INPUTSIZE),
|
|
||||||
m_ReceiverEndpoint,
|
|
||||||
0, error);
|
|
||||||
// Network Debug data
|
|
||||||
if (isReadingData) {
|
|
||||||
m_NetworkData.TotalDataReceived += bytesReceived;
|
|
||||||
m_NetworkData.DataReceivedThisInterval += bytesReceived;
|
|
||||||
m_NetworkData.AmountOfMessagesReceived++;
|
|
||||||
}
|
|
||||||
if (error) {
|
|
||||||
//LOG_ERROR("receive: %s", error.message().c_str());
|
|
||||||
}
|
|
||||||
return bytesReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::send(Packet& packet)
|
|
||||||
{
|
|
||||||
m_Socket.send_to(boost::asio::buffer(
|
|
||||||
packet.Data(),
|
|
||||||
packet.Size()),
|
|
||||||
m_ReceiverEndpoint, 0);
|
|
||||||
// Network Debug data
|
|
||||||
if (isReadingData) {
|
|
||||||
m_NetworkData.TotalDataSent += packet.Size();
|
|
||||||
m_NetworkData.DataSentThisInterval += packet.Size();
|
|
||||||
m_NetworkData.AmountOfMessagesSent++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::connect()
|
|
||||||
{
|
|
||||||
Packet packet(MessageType::Connect, m_SendPacketID);
|
|
||||||
packet.WriteString(m_PlayerName);
|
|
||||||
m_StartPingTime = std::clock();
|
|
||||||
send(packet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::disconnect()
|
void Client::disconnect()
|
||||||
{
|
{
|
||||||
|
m_IsConnected = false;
|
||||||
m_PreviousPacketID = 0;
|
m_PreviousPacketID = 0;
|
||||||
m_PacketID = 0;
|
m_PacketID = 0;
|
||||||
Packet packet(MessageType::Disconnect, m_SendPacketID);
|
Packet packet(MessageType::Disconnect, m_SendPacketID);
|
||||||
send(packet);
|
m_Reliable.Send(packet);
|
||||||
|
m_Reliable.Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::OnInputCommand(const Events::InputCommand & e)
|
bool Client::OnInputCommand(const Events::InputCommand & e)
|
||||||
@@ -357,7 +377,8 @@ bool Client::OnInputCommand(const Events::InputCommand & e)
|
|||||||
|
|
||||||
if (e.Command == "ConnectToServer") { // Connect for now
|
if (e.Command == "ConnectToServer") { // Connect for now
|
||||||
if (e.Value > 0) {
|
if (e.Value > 0) {
|
||||||
connect();
|
m_Reliable.Connect(m_PlayerName, m_Address, m_Port);
|
||||||
|
m_Unreliable.Connect(m_PlayerName, m_Address, m_Port);
|
||||||
}
|
}
|
||||||
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
||||||
return true;
|
return true;
|
||||||
@@ -380,7 +401,9 @@ bool Client::OnInputCommand(const Events::InputCommand & e)
|
|||||||
m_SaveDataTimer = std::clock();
|
m_SaveDataTimer = std::clock();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_InputCommandBuffer.push_back(e);
|
if (m_IsConnected) {
|
||||||
|
m_InputCommandBuffer.push_back(e);
|
||||||
|
}
|
||||||
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -389,11 +412,17 @@ bool Client::OnInputCommand(const Events::InputCommand & e)
|
|||||||
|
|
||||||
bool Client::OnPlayerDamage(const Events::PlayerDamage & e)
|
bool Client::OnPlayerDamage(const Events::PlayerDamage & e)
|
||||||
{
|
{
|
||||||
|
if (e.Inflictor != m_LocalPlayer) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Packet packet(MessageType::OnPlayerDamage, m_SendPacketID);
|
Packet packet(MessageType::OnPlayerDamage, m_SendPacketID);
|
||||||
|
packet.WritePrimitive(m_ClientIDToServerID.at(e.Inflictor.ID));
|
||||||
|
packet.WritePrimitive(m_ClientIDToServerID.at(e.Victim.ID));
|
||||||
packet.WritePrimitive(e.Damage);
|
packet.WritePrimitive(e.Damage);
|
||||||
packet.WritePrimitive(m_ClientIDToServerID.at(e.Player.ID));
|
m_Reliable.Send(packet);
|
||||||
send(packet);
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::OnPlayerSpawned(const Events::PlayerSpawned& e)
|
bool Client::OnPlayerSpawned(const Events::PlayerSpawned& e)
|
||||||
@@ -404,23 +433,49 @@ bool Client::OnPlayerSpawned(const Events::PlayerSpawned& e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::parsePlayerDamage(Packet& packet)
|
||||||
|
{
|
||||||
|
Events::PlayerDamage e;
|
||||||
|
PlayerID victimID = packet.ReadPrimitive<EntityID>();
|
||||||
|
if(!serverClientMapsHasEntity(victimID)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.Inflictor = EntityWrapper(m_World, m_ServerIDToClientID.at(victimID));
|
||||||
|
e.Victim = EntityWrapper(m_World, m_ServerIDToClientID.at(packet.ReadPrimitive<EntityID>()));
|
||||||
|
e.Damage = packet.ReadPrimitive<double>();
|
||||||
|
// Don't rebroadcast our own player damage events or we'll have an infinite loop!
|
||||||
|
if (e.Inflictor != m_LocalPlayer) {
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Client::sendLocalPlayerTransform()
|
void Client::sendLocalPlayerTransform()
|
||||||
{
|
{
|
||||||
if (!m_LocalPlayer.Valid()) {
|
if (!m_LocalPlayer.Valid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Packet packet(MessageType::PlayerTransform, m_SendPacketID);
|
||||||
|
|
||||||
ComponentWrapper cTransform = m_LocalPlayer["Transform"];
|
ComponentWrapper cTransform = m_LocalPlayer["Transform"];
|
||||||
glm::vec3& position = cTransform["Position"];
|
glm::vec3& position = cTransform["Position"];
|
||||||
glm::vec3& orientation = cTransform["Orientation"];
|
glm::vec3& orientation = cTransform["Orientation"];
|
||||||
Packet packet(MessageType::PlayerTransform, m_SendPacketID);
|
|
||||||
packet.WritePrimitive(position.x);
|
packet.WritePrimitive(position.x);
|
||||||
packet.WritePrimitive(position.y);
|
packet.WritePrimitive(position.y);
|
||||||
packet.WritePrimitive(position.z);
|
packet.WritePrimitive(position.z);
|
||||||
packet.WritePrimitive(orientation.x);
|
packet.WritePrimitive(orientation.x);
|
||||||
packet.WritePrimitive(orientation.y);
|
packet.WritePrimitive(orientation.y);
|
||||||
packet.WritePrimitive(orientation.z);
|
packet.WritePrimitive(orientation.z);
|
||||||
send(packet);
|
|
||||||
|
bool hasAssaultWeapon = m_LocalPlayer.HasComponent("AssaultWeapon");
|
||||||
|
packet.WritePrimitive(hasAssaultWeapon);
|
||||||
|
if (hasAssaultWeapon) {
|
||||||
|
ComponentWrapper cAssaultWeapon = m_LocalPlayer["AssaultWeapon"];
|
||||||
|
packet.WritePrimitive((int)cAssaultWeapon["MagazineAmmo"]);
|
||||||
|
packet.WritePrimitive((int)cAssaultWeapon["Ammo"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Unreliable.Send(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::identifyPacketLoss()
|
void Client::identifyPacketLoss()
|
||||||
@@ -432,17 +487,15 @@ void Client::identifyPacketLoss()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::hasServerTimedOut()
|
void Client::hasServerTimedOut()
|
||||||
{
|
{
|
||||||
// Time in ms
|
// Time in ms
|
||||||
double timeSincePing = 1000 * (std::clock() - m_StartPingTime) / static_cast<double>(CLOCKS_PER_SEC);
|
double timeSincePing = 1000 * (std::clock() - m_StartPingTime) / static_cast<double>(CLOCKS_PER_SEC);
|
||||||
if (timeSincePing > m_TimeoutMs) {
|
if (timeSincePing > m_TimeoutMs) {
|
||||||
// Clear everything and go to menu.
|
// Clear everything and go to menu.
|
||||||
LOG_INFO("Server has timed out, returning to menu, Beep Boop.");
|
LOG_INFO("Server has timed out, returning to menu, Beep Boop.");
|
||||||
m_IsConnected = false;
|
disconnect();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityID Client::createPlayer()
|
EntityID Client::createPlayer()
|
||||||
@@ -463,7 +516,7 @@ void Client::sendInputCommands()
|
|||||||
packet.WriteString(m_InputCommandBuffer[i].Command);
|
packet.WriteString(m_InputCommandBuffer[i].Command);
|
||||||
packet.WritePrimitive(m_InputCommandBuffer[i].Value);
|
packet.WritePrimitive(m_InputCommandBuffer[i].Value);
|
||||||
}
|
}
|
||||||
send(packet);
|
m_Reliable.Send(packet);
|
||||||
m_InputCommandBuffer.clear();
|
m_InputCommandBuffer.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -471,7 +524,7 @@ void Client::sendInputCommands()
|
|||||||
void Client::becomePlayer()
|
void Client::becomePlayer()
|
||||||
{
|
{
|
||||||
Packet packet = Packet(MessageType::BecomePlayer, m_SendPacketID);
|
Packet packet = Packet(MessageType::BecomePlayer, m_SendPacketID);
|
||||||
send(packet);
|
m_Reliable.Send(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::clientServerMapsHasEntity(EntityID clientEntityID)
|
bool Client::clientServerMapsHasEntity(EntityID clientEntityID)
|
||||||
@@ -502,7 +555,6 @@ void Client::insertIntoServerClientMaps(EntityID serverEntityID, EntityID client
|
|||||||
{
|
{
|
||||||
m_ServerIDToClientID.insert(std::make_pair(serverEntityID, clientEntityID));
|
m_ServerIDToClientID.insert(std::make_pair(serverEntityID, clientEntityID));
|
||||||
m_ClientIDToServerID.insert(std::make_pair(clientEntityID, serverEntityID));
|
m_ClientIDToServerID.insert(std::make_pair(clientEntityID, serverEntityID));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::deleteFromServerClientMaps(EntityID serverEntityID, EntityID clientEntityID)
|
void Client::deleteFromServerClientMaps(EntityID serverEntityID, EntityID clientEntityID)
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#include "Network/HybridClient.h"
|
||||||
|
|
||||||
|
|
||||||
|
HybridClient::HybridClient()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HybridClient::~HybridClient()
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#include "Network/HybridServer.h"
|
||||||
|
|
||||||
|
HybridServer::HybridServer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HybridServer::~HybridServer()
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -14,6 +14,21 @@ void Network::Update()
|
|||||||
updateNetworkData();
|
updateNetworkData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Network::logSentData(int bytesSent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Network::logReceivedData(int bytesReceived)
|
||||||
|
{
|
||||||
|
// Network Debug data
|
||||||
|
if (isReadingData) {
|
||||||
|
m_NetworkData.TotalDataReceived += bytesReceived;
|
||||||
|
m_NetworkData.DataReceivedThisInterval += bytesReceived;
|
||||||
|
m_NetworkData.AmountOfMessagesReceived++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Network::saveToFile()
|
void Network::saveToFile()
|
||||||
{
|
{
|
||||||
std::ofstream outfile;
|
std::ofstream outfile;
|
||||||
|
|||||||
@@ -34,10 +34,12 @@ void Packet::Init(MessageType type, unsigned int & packetID)
|
|||||||
m_ReturnDataOffset = 0;
|
m_ReturnDataOffset = 0;
|
||||||
m_Offset = 0;
|
m_Offset = 0;
|
||||||
// Create message header
|
// Create message header
|
||||||
|
// allocate memory for size of packet(only used in tcp)
|
||||||
|
WritePrimitive<int>(0);
|
||||||
// Add message type
|
// Add message type
|
||||||
int messageType = static_cast<int>(type);
|
int messageType = static_cast<int>(type);
|
||||||
Packet::WritePrimitive<int>(messageType);
|
WritePrimitive<int>(messageType);
|
||||||
Packet::WritePrimitive<int>(packetID);
|
WritePrimitive<int>(packetID);
|
||||||
packetID++;
|
packetID++;
|
||||||
m_HeaderSize = m_Offset;
|
m_HeaderSize = m_Offset;
|
||||||
}
|
}
|
||||||
@@ -56,9 +58,12 @@ void Packet::WriteString(const std::string& str)
|
|||||||
|
|
||||||
void Packet::WriteData(char * data, int sizeOfData)
|
void Packet::WriteData(char * data, int sizeOfData)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_Offset + sizeOfData > m_MaxPacketSize) {
|
if (m_Offset + sizeOfData > m_MaxPacketSize) {
|
||||||
//LOG_WARNING("Packet::WriteData(): Data size in packet exceeded maximum packet size. New size is %i bytes\n", m_MaxPacketSize*2);
|
//LOG_WARNING("Packet::WriteData(): Data size in packet exceeded maximum packet size. New size is %i bytes\n", m_MaxPacketSize*2);
|
||||||
resizeData();
|
while (m_Offset + sizeOfData > m_MaxPacketSize) {
|
||||||
|
resizeData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
memcpy(m_Data + m_Offset, data, sizeOfData);
|
memcpy(m_Data + m_Offset, data, sizeOfData);
|
||||||
m_Offset += sizeOfData;
|
m_Offset += sizeOfData;
|
||||||
@@ -76,14 +81,35 @@ std::string Packet::ReadString()
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * Packet::ReadData(int SizeOfData)
|
void Packet::ReconstructFromData(char * data, size_t sizeOfData)
|
||||||
{
|
{
|
||||||
if (m_Offset < m_ReturnDataOffset + SizeOfData) {
|
if (sizeOfData > m_MaxPacketSize) {
|
||||||
|
// Delete our data
|
||||||
|
delete[] m_Data;
|
||||||
|
// Set new max size
|
||||||
|
m_MaxPacketSize = sizeOfData;
|
||||||
|
m_Data = new char[m_MaxPacketSize];
|
||||||
|
// while we resized the old data container.
|
||||||
|
}
|
||||||
|
memcpy(m_Data, data, sizeOfData);
|
||||||
|
m_Offset = sizeOfData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Packet::UpdateSize()
|
||||||
|
{
|
||||||
|
int whatisoffset = m_Offset;
|
||||||
|
memcpy(m_Data, &m_Offset, sizeof(int));
|
||||||
|
}
|
||||||
|
|
||||||
|
char * Packet::ReadData(int sizeOfData)
|
||||||
|
{
|
||||||
|
if (m_Offset < m_ReturnDataOffset + sizeOfData) {
|
||||||
//LOG_WARNING("packet ReadData(): Oh no! You are trying to remove things outside my memory kingdom");
|
//LOG_WARNING("packet ReadData(): Oh no! You are trying to remove things outside my memory kingdom");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
size_t oldReturnDataOffset = m_ReturnDataOffset;
|
size_t oldReturnDataOffset = m_ReturnDataOffset;
|
||||||
m_ReturnDataOffset += SizeOfData;
|
m_ReturnDataOffset += sizeOfData;
|
||||||
return (m_Data + oldReturnDataOffset);
|
return (m_Data + oldReturnDataOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,25 +117,36 @@ void Packet::ChangePacketID(unsigned int & packetID)
|
|||||||
{
|
{
|
||||||
packetID = packetID + 1;
|
packetID = packetID + 1;
|
||||||
// Overwrite old PacketID
|
// Overwrite old PacketID
|
||||||
memcpy(m_Data + sizeof(int), &packetID, sizeof(int));
|
memcpy(m_Data + 2*sizeof(int), &packetID, sizeof(int));
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageType Packet::GetMessageType()
|
||||||
|
{
|
||||||
|
MessageType messagType;
|
||||||
|
memcpy(&messagType, m_Data + sizeof(int), sizeof(int));
|
||||||
|
return messagType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Packet::resizeData()
|
void Packet::resizeData()
|
||||||
{
|
{
|
||||||
|
resizeData(m_MaxPacketSize * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Packet::resizeData(int size)
|
||||||
|
{
|
||||||
// Allocate memory to store our data in
|
// Allocate memory to store our data in
|
||||||
char* holdData = new char[m_MaxPacketSize];
|
char* holdData = new char[m_MaxPacketSize];
|
||||||
// Copy our data to the newly allocated memory
|
// Copy our data to the newly allocated memory
|
||||||
memcpy(holdData, m_Data, m_Offset);
|
memcpy(holdData, m_Data, m_Offset);
|
||||||
// Increase max packet size
|
// Increase max packet size
|
||||||
m_MaxPacketSize = m_MaxPacketSize * 2;
|
m_MaxPacketSize = size;
|
||||||
// Delete our data
|
// Delete our data
|
||||||
delete m_Data;
|
delete[] m_Data;
|
||||||
// Allocate twice the memory we had before
|
// Allocate memory
|
||||||
m_Data = new char[m_MaxPacketSize];
|
m_Data = new char[m_MaxPacketSize];
|
||||||
// Copy our data to new location
|
// Copy our data to new location
|
||||||
memcpy(m_Data, holdData, m_Offset);
|
memcpy(m_Data, holdData, m_Offset);
|
||||||
// Delete the memory allocated to hold our data
|
// Delete the memory allocated to hold our data
|
||||||
// while we resized the old data container.
|
// while we resized the old data container.
|
||||||
delete holdData;
|
delete[] holdData;
|
||||||
}
|
}
|
||||||
|
|||||||
+266
-208
@@ -6,19 +6,18 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
|
|||||||
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
snapshotInterval = 1000 * config->Get<float>("Networking.SnapshotInterval", 0.05f);
|
snapshotInterval = 1000 * config->Get<float>("Networking.SnapshotInterval", 0.05f);
|
||||||
pingIntervalMs = config->Get<float>("Networking.PingIntervalMs", 1000);
|
pingIntervalMs = config->Get<float>("Networking.PingIntervalMs", 1000);
|
||||||
|
|
||||||
// Subscribe to events
|
// Subscribe to events
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Server::OnInputCommand);
|
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Server::OnInputCommand);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Server::OnPlayerSpawned);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Server::OnPlayerSpawned);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &Server::OnEntityDeleted);
|
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &Server::OnEntityDeleted);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted);
|
EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
|
||||||
|
|
||||||
// Bind
|
// Bind
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
port = config->Get<float>("Networking.Port", 27666);
|
port = config->Get<float>("Networking.Port", 27666);
|
||||||
}
|
}
|
||||||
m_Port = port;
|
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);
|
LOG_INFO("Server initialized and bound to port %i", port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +28,58 @@ Server::~Server()
|
|||||||
|
|
||||||
void Server::Update()
|
void Server::Update()
|
||||||
{
|
{
|
||||||
readFromClients();
|
PlayerDefinition pd;
|
||||||
|
|
||||||
|
m_Reliable.AcceptNewConnections(m_NextPlayerID, m_ConnectedPlayers);
|
||||||
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
|
while (kv.second.TCPSocket->available()) {
|
||||||
|
// Packet will get real data in receive
|
||||||
|
Packet packet(MessageType::Invalid);
|
||||||
|
m_Reliable.Receive(packet, kv.second);
|
||||||
|
m_Address = kv.second.TCPSocket->remote_endpoint().address();
|
||||||
|
m_Port = kv.second.TCPSocket->remote_endpoint().port();
|
||||||
|
if (packet.GetMessageType() == MessageType::Connect) {
|
||||||
|
parseTCPConnect(packet);
|
||||||
|
} else {
|
||||||
|
parseMessageType(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (m_Unreliable.IsSocketAvailable()) {
|
||||||
|
// Packet will get real data in receive
|
||||||
|
Packet packet(MessageType::Invalid);
|
||||||
|
m_Unreliable.Receive(packet, pd);
|
||||||
|
m_Address = pd.Endpoint.address();
|
||||||
|
m_Port = pd.Endpoint.port();
|
||||||
|
if (packet.GetMessageType() == MessageType::Connect) {
|
||||||
|
parseUDPConnect(packet);
|
||||||
|
} else {
|
||||||
|
parseMessageType(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Check if players have disconnected
|
||||||
|
for (int i = 0; i < m_PlayersToDisconnect.size(); i++) {
|
||||||
|
disconnect(m_PlayersToDisconnect.at(i));
|
||||||
|
}
|
||||||
|
m_PlayersToDisconnect.clear();
|
||||||
|
|
||||||
|
std::clock_t currentTime = std::clock();
|
||||||
|
// Send snapshot
|
||||||
|
if (snapshotInterval < (1000 * (currentTime - previousSnapshotMessage) / (double)CLOCKS_PER_SEC)) {
|
||||||
|
sendSnapshot();
|
||||||
|
previousSnapshotMessage = currentTime;
|
||||||
|
}
|
||||||
|
// Send pings each
|
||||||
|
if (pingIntervalMs < (1000 * (currentTime - previousePingMessage) / (double)CLOCKS_PER_SEC)) {
|
||||||
|
sendPing();
|
||||||
|
previousePingMessage = currentTime;
|
||||||
|
}
|
||||||
|
// Time out logic
|
||||||
|
if (checkTimeOutInterval < (1000 * (currentTime - timOutTimer) / (double)CLOCKS_PER_SEC)) {
|
||||||
|
checkForTimeOuts();
|
||||||
|
timOutTimer = currentTime;
|
||||||
|
}
|
||||||
m_EventBroker->Process<Server>();
|
m_EventBroker->Process<Server>();
|
||||||
if (isReadingData) {
|
if (isReadingData) {
|
||||||
Network::Update();
|
Network::Update();
|
||||||
@@ -37,48 +87,20 @@ void Server::Update()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::readFromClients()
|
|
||||||
{
|
|
||||||
while (m_Socket->available()) {
|
|
||||||
try {
|
|
||||||
bytesRead = receive(readBuffer);
|
|
||||||
Packet packet(readBuffer, bytesRead);
|
|
||||||
parseMessageType(packet);
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
//LOG_ERROR("%i: Read from client crashed %s", m_PacketID, err.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::clock_t currentTime = std::clock();
|
|
||||||
// Send snapshot
|
|
||||||
if (snapshotInterval < (1000 * (currentTime - previousSnapshotMessage) / (double)CLOCKS_PER_SEC)) {
|
|
||||||
sendSnapshot();
|
|
||||||
previousSnapshotMessage = currentTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send pings each
|
|
||||||
if (pingIntervalMs < (1000 * (currentTime - previousePingMessage) / (double)CLOCKS_PER_SEC)) {
|
|
||||||
sendPing();
|
|
||||||
previousePingMessage = currentTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Time out logic
|
|
||||||
if (checkTimeOutInterval < (1000 * (currentTime - timOutTimer) / (double)CLOCKS_PER_SEC)) {
|
|
||||||
checkForTimeOuts();
|
|
||||||
timOutTimer = currentTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::parseMessageType(Packet& packet)
|
void Server::parseMessageType(Packet& packet)
|
||||||
{
|
{
|
||||||
int messageType = packet.ReadPrimitive<int>(); // Read what type off message was sent from server
|
// Pop packetSize which is used by TCP Client to
|
||||||
|
// create a packet of the correct size
|
||||||
|
packet.ReadPrimitive<int>();
|
||||||
|
|
||||||
|
int messageType = packet.ReadPrimitive<int>(); // Read what type off message was sent from server
|
||||||
// Read packet ID
|
// Read packet ID
|
||||||
m_PreviousPacketID = m_PacketID; // Set previous packet id
|
m_PreviousPacketID = m_PacketID; // Set previous packet id
|
||||||
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
|
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
|
||||||
//identifyPacketLoss();
|
//identifyPacketLoss();
|
||||||
switch (static_cast<MessageType>(messageType)) {
|
switch (static_cast<MessageType>(messageType)) {
|
||||||
case MessageType::Connect:
|
case MessageType::Connect:
|
||||||
parseConnect(packet);
|
//parseConnect(packet);
|
||||||
break;
|
break;
|
||||||
case MessageType::Ping:
|
case MessageType::Ping:
|
||||||
parsePing();
|
parsePing();
|
||||||
@@ -104,60 +126,19 @@ void Server::parseMessageType(Packet& packet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Server::receive(char * data)
|
void Server::reliableBroadcast(Packet& packet)
|
||||||
{
|
|
||||||
size_t length = m_Socket->receive_from(
|
|
||||||
boost::asio::buffer((void*)data
|
|
||||||
, INPUTSIZE)
|
|
||||||
, m_ReceiverEndpoint, 0);
|
|
||||||
// Network Debug data
|
|
||||||
if (isReadingData) {
|
|
||||||
m_NetworkData.TotalDataReceived += length;
|
|
||||||
m_NetworkData.DataReceivedThisInterval += length;
|
|
||||||
m_NetworkData.AmountOfMessagesReceived++;
|
|
||||||
}
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::send(PlayerID player, Packet& packet)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
size_t bytesSent = m_Socket->send_to(
|
|
||||||
boost::asio::buffer(packet.Data(), packet.Size()),
|
|
||||||
m_ConnectedPlayers[player].Endpoint,
|
|
||||||
0);
|
|
||||||
// Network Debug data
|
|
||||||
if (isReadingData) {
|
|
||||||
m_NetworkData.TotalDataSent += packet.Size();
|
|
||||||
m_NetworkData.DataSentThisInterval += packet.Size();
|
|
||||||
m_NetworkData.AmountOfMessagesSent++;
|
|
||||||
}
|
|
||||||
} catch (const boost::system::system_error&) {
|
|
||||||
// TODO: Clean up invalid endpoints out of m_ConnectedPlayers later
|
|
||||||
m_ConnectedPlayers[player].Endpoint = boost::asio::ip::udp::endpoint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::send(Packet & packet)
|
|
||||||
{
|
|
||||||
m_Socket->send_to(
|
|
||||||
boost::asio::buffer(
|
|
||||||
packet.Data(),
|
|
||||||
packet.Size()),
|
|
||||||
m_ReceiverEndpoint,
|
|
||||||
0);
|
|
||||||
if (isReadingData) {
|
|
||||||
// Network Debug data
|
|
||||||
m_NetworkData.TotalDataSent += packet.Size();
|
|
||||||
m_NetworkData.DataSentThisInterval += packet.Size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::broadcast(Packet& packet)
|
|
||||||
{
|
{
|
||||||
for (auto& kv : m_ConnectedPlayers) {
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
packet.ChangePacketID(kv.second.PacketID);
|
packet.ChangePacketID(kv.second.PacketID);
|
||||||
send(kv.first, packet);
|
m_Reliable.Send(packet, kv.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Server::unreliableBroadcast(Packet& packet)
|
||||||
|
{
|
||||||
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
|
packet.ChangePacketID(kv.second.PacketID);
|
||||||
|
m_Unreliable.Send(packet, kv.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +148,7 @@ void Server::sendSnapshot()
|
|||||||
Packet packet(MessageType::Snapshot);
|
Packet packet(MessageType::Snapshot);
|
||||||
addInputCommandsToPacket(packet);
|
addInputCommandsToPacket(packet);
|
||||||
addChildrenToPacket(packet, EntityID_Invalid);
|
addChildrenToPacket(packet, EntityID_Invalid);
|
||||||
broadcast(packet);
|
unreliableBroadcast(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::addInputCommandsToPacket(Packet& packet)
|
void Server::addInputCommandsToPacket(Packet& packet)
|
||||||
@@ -190,6 +171,12 @@ void Server::addChildrenToPacket(Packet & packet, EntityID entityID)
|
|||||||
// Loop through every child
|
// Loop through every child
|
||||||
for (auto it = itPair.first; it != itPair.second; it++) {
|
for (auto it = itPair.first; it != itPair.second; it++) {
|
||||||
EntityID childEntityID = it->second;
|
EntityID childEntityID = it->second;
|
||||||
|
// HACK: Only sync players for now, since the map turned out to be TOO LARGE to send in one snapshot and Simon's computer shits itself
|
||||||
|
EntityWrapper childEntity(m_World, childEntityID);
|
||||||
|
if (!shouldSendToClient(childEntity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Write EntityID and parentsID and Entity name
|
// Write EntityID and parentsID and Entity name
|
||||||
packet.WritePrimitive(childEntityID);
|
packet.WritePrimitive(childEntityID);
|
||||||
packet.WritePrimitive(entityID);
|
packet.WritePrimitive(entityID);
|
||||||
@@ -241,7 +228,7 @@ void Server::sendPing()
|
|||||||
// Time message
|
// Time message
|
||||||
m_StartPingTime = std::clock();
|
m_StartPingTime = std::clock();
|
||||||
// Send message
|
// Send message
|
||||||
broadcast(packet);
|
reliableBroadcast(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::checkForTimeOuts()
|
void Server::checkForTimeOuts()
|
||||||
@@ -249,16 +236,91 @@ void Server::checkForTimeOuts()
|
|||||||
double startPing = 1000 * m_StartPingTime
|
double startPing = 1000 * m_StartPingTime
|
||||||
/ static_cast<double>(CLOCKS_PER_SEC);
|
/ static_cast<double>(CLOCKS_PER_SEC);
|
||||||
|
|
||||||
for (int i = 0; i < m_ConnectedPlayers.size(); i++) {
|
std::vector<PlayerID> playersToRemove;
|
||||||
if (m_ConnectedPlayers[i].Endpoint.address() != boost::asio::ip::address()) {
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
double stopPing = 1000 * m_ConnectedPlayers[i].StopTime /
|
if (kv.second.TCPAddress != boost::asio::ip::address()) {
|
||||||
|
int stopPing = 1000 * kv.second.StopTime /
|
||||||
static_cast<double>(CLOCKS_PER_SEC);
|
static_cast<double>(CLOCKS_PER_SEC);
|
||||||
if (startPing > stopPing + m_TimeoutMs) {
|
if (startPing > stopPing + m_TimeoutMs) {
|
||||||
//LOG_INFO("User %i timed out!", i);
|
LOG_INFO("User %i timed out!", kv.second.Name);
|
||||||
//disconnect(i);
|
playersToRemove.push_back(kv.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (size_t i = 0; i < playersToRemove.size(); i++) {
|
||||||
|
disconnect(playersToRemove.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Server::parseUDPConnect(Packet & packet)
|
||||||
|
{
|
||||||
|
// Pop size of message int
|
||||||
|
packet.ReadPrimitive<int>();
|
||||||
|
int messageType = packet.ReadPrimitive<int>();
|
||||||
|
// Read packet ID
|
||||||
|
m_PreviousPacketID = m_PacketID; // Set previous packet id
|
||||||
|
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
|
||||||
|
// parse player id and other stuff
|
||||||
|
PlayerID playerID = packet.ReadPrimitive<int>();
|
||||||
|
// Do something here?
|
||||||
|
boost::asio::ip::udp::endpoint endpoint(m_Address, m_Port);
|
||||||
|
m_ConnectedPlayers.at(playerID).Endpoint = endpoint;
|
||||||
|
LOG_INFO("parseUDPConnect: Spectator \"%s\" connected on IP: %s", m_ConnectedPlayers.at(playerID).Name.c_str(), m_ConnectedPlayers.at(playerID).Endpoint.address().to_string().c_str());
|
||||||
|
// Send a message to the player that connected
|
||||||
|
Packet connnectPacket(MessageType::Connect, m_ConnectedPlayers.at(playerID).PacketID);
|
||||||
|
m_Unreliable.Send(connnectPacket);
|
||||||
|
LOG_INFO("UDP Connect sent to client");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Server::parseTCPConnect(Packet & packet)
|
||||||
|
{
|
||||||
|
// Pop size of message int
|
||||||
|
packet.ReadPrimitive<int>();
|
||||||
|
int messageType = packet.ReadPrimitive<int>();
|
||||||
|
// Read packet ID
|
||||||
|
m_PreviousPacketID = m_PacketID; // Set previous packet id
|
||||||
|
m_PacketID = packet.ReadPrimitive<int>(); //Read new packet id
|
||||||
|
|
||||||
|
LOG_INFO("Parsing connections");
|
||||||
|
// Check if player is already connected
|
||||||
|
// Ska vara till lagd i TCPServer receive
|
||||||
|
PlayerID playerID = GetPlayerIDFromEndpoint();
|
||||||
|
if (playerID == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Create a new player
|
||||||
|
m_ConnectedPlayers.at(playerID).EntityID = 0; // Overlook this
|
||||||
|
m_ConnectedPlayers.at(playerID).Name = packet.ReadString();
|
||||||
|
m_ConnectedPlayers.at(playerID).PacketID = 0;
|
||||||
|
m_ConnectedPlayers.at(playerID).StopTime = std::clock();
|
||||||
|
m_ConnectedPlayers.at(playerID).TCPAddress = m_Address;
|
||||||
|
m_ConnectedPlayers.at(playerID).TCPPort = m_Port;
|
||||||
|
|
||||||
|
LOG_INFO("parseTCPConnect: Spectator \"%s\" connected on IP: %s", m_ConnectedPlayers.at(playerID).Name.c_str(),
|
||||||
|
m_ConnectedPlayers.at(playerID).TCPAddress.to_string().c_str());
|
||||||
|
|
||||||
|
// Send a message to the player that connected
|
||||||
|
Packet connnectPacket(MessageType::Connect, m_ConnectedPlayers.at(playerID).PacketID);
|
||||||
|
// Write playerID to packet
|
||||||
|
connnectPacket.WritePrimitive(playerID);
|
||||||
|
m_Reliable.Send(connnectPacket);
|
||||||
|
|
||||||
|
// Send notification that a player has connected
|
||||||
|
//Packet notificationPacket(MessageType::PlayerConnected);
|
||||||
|
//broadcast(notificationPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Server::parseDisconnect()
|
||||||
|
{
|
||||||
|
LOG_INFO("%i: Parsing disconnect", m_PacketID);
|
||||||
|
|
||||||
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
|
if (kv.second.TCPAddress == m_Address &&
|
||||||
|
kv.second.TCPPort == m_Port) {
|
||||||
|
m_PlayersToDisconnect.push_back(kv.first);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::disconnect(PlayerID playerID)
|
void Server::disconnect(PlayerID playerID)
|
||||||
@@ -267,113 +329,27 @@ void Server::disconnect(PlayerID playerID)
|
|||||||
LOG_INFO("User %s disconnected/timed out", m_ConnectedPlayers[playerID].Name.c_str());
|
LOG_INFO("User %s disconnected/timed out", m_ConnectedPlayers[playerID].Name.c_str());
|
||||||
// Remove enteties and stuff (When we can remove entity, remove it and tell clients to remove the copy they have)
|
// Remove enteties and stuff (When we can remove entity, remove it and tell clients to remove the copy they have)
|
||||||
Events::PlayerDisconnected e;
|
Events::PlayerDisconnected e;
|
||||||
e.Entity = m_ConnectedPlayers[playerID].EntityID;
|
e.Entity = m_ConnectedPlayers.at(playerID).EntityID;
|
||||||
e.PlayerID = playerID;
|
e.PlayerID = playerID;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
|
//m_World->DeleteEntity(m_ConnectedPlayers[playerID].EntityID);
|
||||||
|
m_ConnectedPlayers[playerID].TCPSocket->shutdown(boost::asio::ip::tcp::socket::shutdown_both);
|
||||||
|
m_ConnectedPlayers[playerID].TCPSocket->close();
|
||||||
|
m_World->DeleteEntity(m_ConnectedPlayers[playerID].EntityID);
|
||||||
m_ConnectedPlayers.erase(playerID);
|
m_ConnectedPlayers.erase(playerID);
|
||||||
}
|
// Send disconnect to the other players.
|
||||||
|
|
||||||
void Server::parseOnInputCommand(Packet& packet)
|
|
||||||
{
|
|
||||||
PlayerID player = -1;
|
|
||||||
// Check which player it was who sent the message
|
|
||||||
player = GetPlayerIDFromEndpoint(m_ReceiverEndpoint);
|
|
||||||
if (player != -1) {
|
|
||||||
while (packet.DataReadSize() < packet.Size()) {
|
|
||||||
Events::InputCommand e;
|
|
||||||
e.Command = packet.ReadString();
|
|
||||||
e.PlayerID = player; // Set correct player id
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::parseOnPlayerDamage(Packet & packet)
|
void Server::parseOnPlayerDamage(Packet & packet)
|
||||||
{
|
{
|
||||||
Events::PlayerDamage e;
|
Events::PlayerDamage e;
|
||||||
|
e.Inflictor = EntityWrapper(m_World, packet.ReadPrimitive<EntityID>());
|
||||||
|
e.Victim = EntityWrapper(m_World, packet.ReadPrimitive<EntityID>());
|
||||||
e.Damage = packet.ReadPrimitive<double>();
|
e.Damage = packet.ReadPrimitive<double>();
|
||||||
e.Player = EntityWrapper(m_World, packet.ReadPrimitive<EntityID>());
|
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
//LOG_DEBUG("Server::parseOnPlayerDamage: Command is %s. Value is %f. PlayerID is %i.", e.DamageAmount, e.PlayerDamagedID, e.TypeOfDamage.c_str());
|
//LOG_DEBUG("Server::parseOnPlayerDamage: Command is %s. Value is %f. PlayerID is %i.", e.DamageAmount, e.PlayerDamagedID, e.TypeOfDamage.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::parseConnect(Packet& packet)
|
|
||||||
{
|
|
||||||
LOG_INFO("Parsing connections");
|
|
||||||
// Check if player is already connected
|
|
||||||
if (GetPlayerIDFromEndpoint(m_ReceiverEndpoint) != -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (auto& kv : m_ConnectedPlayers) {
|
|
||||||
if (kv.second.Endpoint.address() == m_ReceiverEndpoint.address() &&
|
|
||||||
kv.second.Endpoint.port() == m_ReceiverEndpoint.port()) {
|
|
||||||
// Already connected
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Create a new player
|
|
||||||
PlayerDefinition pd;
|
|
||||||
pd.EntityID = 0; // Overlook this
|
|
||||||
pd.Endpoint = m_ReceiverEndpoint;
|
|
||||||
pd.Name = packet.ReadString();
|
|
||||||
pd.PacketID = 0;
|
|
||||||
pd.StopTime = std::clock();
|
|
||||||
m_ConnectedPlayers[m_NextPlayerID++] = pd;
|
|
||||||
LOG_INFO("Spectator \"%s\" connected on IP: %s", pd.Name.c_str(), pd.Endpoint.address().to_string().c_str());
|
|
||||||
|
|
||||||
// Send a message to the player that connected
|
|
||||||
Packet connnectPacket(MessageType::Connect, pd.PacketID);
|
|
||||||
send(connnectPacket);
|
|
||||||
|
|
||||||
// Send notification that a player has connected
|
|
||||||
Packet notificationPacket(MessageType::PlayerConnected);
|
|
||||||
broadcast(notificationPacket);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::parseDisconnect()
|
|
||||||
{
|
|
||||||
LOG_INFO("%i: Parsing disconnect", m_PacketID);
|
|
||||||
|
|
||||||
for (auto& kv : m_ConnectedPlayers) {
|
|
||||||
if (kv.second.Endpoint.address() == m_ReceiverEndpoint.address() &&
|
|
||||||
kv.second.Endpoint.port() == m_ReceiverEndpoint.port()) {
|
|
||||||
disconnect(kv.first);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::parseClientPing()
|
|
||||||
{
|
|
||||||
LOG_INFO("%i: Parsing ping", m_PacketID);
|
|
||||||
PlayerID player = GetPlayerIDFromEndpoint(m_ReceiverEndpoint);
|
|
||||||
if (player == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Return ping
|
|
||||||
Packet packet(MessageType::Ping, m_ConnectedPlayers[player].PacketID);
|
|
||||||
packet.WriteString("Ping received");
|
|
||||||
send(packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::parsePing()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < m_ConnectedPlayers.size(); i++) {
|
|
||||||
if (m_ConnectedPlayers[i].Endpoint.address() == m_ReceiverEndpoint.address()) {
|
|
||||||
m_ConnectedPlayers[i].StopTime = std::clock();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::identifyPacketLoss()
|
void Server::identifyPacketLoss()
|
||||||
{
|
{
|
||||||
// if no packets lost, difference should be equal to 1
|
// if no packets lost, difference should be equal to 1
|
||||||
@@ -387,18 +363,7 @@ void Server::kick(PlayerID player)
|
|||||||
{
|
{
|
||||||
disconnect(player);
|
disconnect(player);
|
||||||
Packet packet = Packet(MessageType::Kick);
|
Packet packet = Packet(MessageType::Kick);
|
||||||
send(packet);
|
m_Reliable.Send(packet);
|
||||||
}
|
|
||||||
|
|
||||||
PlayerID Server::GetPlayerIDFromEndpoint(boost::asio::ip::udp::endpoint endpoint)
|
|
||||||
{
|
|
||||||
for (auto& kv : m_ConnectedPlayers) {
|
|
||||||
if (kv.second.Endpoint.address() == endpoint.address() &&
|
|
||||||
kv.second.Endpoint.port() == endpoint.port()) {
|
|
||||||
return kv.first;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Server::OnInputCommand(const Events::InputCommand & e)
|
bool Server::OnInputCommand(const Events::InputCommand & e)
|
||||||
@@ -427,7 +392,7 @@ bool Server::OnPlayerSpawned(const Events::PlayerSpawned & e)
|
|||||||
packet.WritePrimitive<EntityID>(e.Spawner.ID);
|
packet.WritePrimitive<EntityID>(e.Spawner.ID);
|
||||||
// We don't send PlayerID here because it will always be set to -1
|
// We don't send PlayerID here because it will always be set to -1
|
||||||
packet.WriteString(m_ConnectedPlayers[e.PlayerID].Name);
|
packet.WriteString(m_ConnectedPlayers[e.PlayerID].Name);
|
||||||
send(e.PlayerID, packet);
|
m_Reliable.Send(packet, m_ConnectedPlayers[e.PlayerID]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +401,7 @@ bool Server::OnEntityDeleted(const Events::EntityDeleted & e)
|
|||||||
if (!e.Cascaded) {
|
if (!e.Cascaded) {
|
||||||
Packet packet = Packet(MessageType::EntityDeleted);
|
Packet packet = Packet(MessageType::EntityDeleted);
|
||||||
packet.WritePrimitive<EntityID>(e.DeletedEntity);
|
packet.WritePrimitive<EntityID>(e.DeletedEntity);
|
||||||
broadcast(packet);
|
reliableBroadcast(packet);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -444,16 +409,79 @@ bool Server::OnEntityDeleted(const Events::EntityDeleted & e)
|
|||||||
bool Server::OnComponentDeleted(const Events::ComponentDeleted & e)
|
bool Server::OnComponentDeleted(const Events::ComponentDeleted & e)
|
||||||
{
|
{
|
||||||
if (!e.Cascaded) {
|
if (!e.Cascaded) {
|
||||||
Packet packet = Packet(MessageType::ComponentDeleted);
|
if (shouldSendToClient(EntityWrapper(m_World, e.Entity))) {
|
||||||
packet.WritePrimitive<EntityID>(e.Entity);
|
Packet packet = Packet(MessageType::ComponentDeleted);
|
||||||
packet.WriteString(e.ComponentType);
|
packet.WritePrimitive<EntityID>(e.Entity);
|
||||||
broadcast(packet);
|
packet.WriteString(e.ComponentType);
|
||||||
|
reliableBroadcast(packet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Server::OnPlayerDamage(const Events::PlayerDamage& e)
|
||||||
|
{
|
||||||
|
Packet packet(MessageType::OnPlayerDamage);
|
||||||
|
packet.WritePrimitive(e.Inflictor.ID);
|
||||||
|
packet.WritePrimitive(e.Victim.ID);
|
||||||
|
packet.WritePrimitive(e.Damage);
|
||||||
|
reliableBroadcast(packet);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Server::parseClientPing()
|
||||||
|
{
|
||||||
|
LOG_INFO("%i: Parsing ping", m_PacketID);
|
||||||
|
PlayerID player = GetPlayerIDFromEndpoint();
|
||||||
|
if (player == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Return ping
|
||||||
|
Packet packet(MessageType::Ping, m_ConnectedPlayers[player].PacketID);
|
||||||
|
packet.WriteString("Ping received");
|
||||||
|
m_Reliable.Send(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Server::parsePing()
|
||||||
|
{
|
||||||
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
|
if (kv.second.TCPAddress == m_Address &&
|
||||||
|
kv.second.TCPPort == m_Port) {
|
||||||
|
kv.second.StopTime = std::clock();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Server::parseOnInputCommand(Packet& packet)
|
||||||
|
{
|
||||||
|
PlayerID player = -1;
|
||||||
|
// Check which player it was who sent the message
|
||||||
|
player = GetPlayerIDFromEndpoint();
|
||||||
|
if (player != -1) {
|
||||||
|
while (packet.DataReadSize() < packet.Size()) {
|
||||||
|
Events::InputCommand e;
|
||||||
|
e.Command = packet.ReadString();
|
||||||
|
e.PlayerID = player; // Set correct player id
|
||||||
|
e.Player = EntityWrapper(m_World, m_ConnectedPlayers.at(player).EntityID);
|
||||||
|
e.Value = packet.ReadPrimitive<float>();
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
if (e.Command == "PrimaryFire" || e.Command == "Reload") {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Server::parsePlayerTransform(Packet& packet)
|
void Server::parsePlayerTransform(Packet& packet)
|
||||||
{
|
{
|
||||||
|
PlayerID playerID = GetPlayerIDFromEndpoint();
|
||||||
|
if (playerID == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 position;
|
glm::vec3 position;
|
||||||
glm::vec3 orientation;
|
glm::vec3 orientation;
|
||||||
position.x = packet.ReadPrimitive<float>();
|
position.x = packet.ReadPrimitive<float>();
|
||||||
@@ -463,11 +491,41 @@ void Server::parsePlayerTransform(Packet& packet)
|
|||||||
orientation.y = packet.ReadPrimitive<float>();
|
orientation.y = packet.ReadPrimitive<float>();
|
||||||
orientation.z = packet.ReadPrimitive<float>();
|
orientation.z = packet.ReadPrimitive<float>();
|
||||||
|
|
||||||
PlayerID playerID = GetPlayerIDFromEndpoint(m_ReceiverEndpoint);
|
bool hasAssaultWeapon = packet.ReadPrimitive<bool>();
|
||||||
EntityWrapper player(m_World, m_ConnectedPlayers.at(playerID).EntityID);
|
int magazineAmmo;
|
||||||
|
int ammo;
|
||||||
|
if (hasAssaultWeapon) {
|
||||||
|
magazineAmmo = packet.ReadPrimitive<int>();
|
||||||
|
ammo = packet.ReadPrimitive<int>();
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityWrapper player(m_World, m_ConnectedPlayers.at(playerID).EntityID);
|
||||||
if (player.Valid()) {
|
if (player.Valid()) {
|
||||||
player["Transform"]["Position"] = position;
|
player["Transform"]["Position"] = position;
|
||||||
player["Transform"]["Orientation"] = orientation;
|
player["Transform"]["Orientation"] = orientation;
|
||||||
|
|
||||||
|
if (hasAssaultWeapon) {
|
||||||
|
player["AssaultWeapon"]["MagazineAmmo"] = magazineAmmo;
|
||||||
|
player["AssaultWeapon"]["Ammo"] = ammo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Server::shouldSendToClient(EntityWrapper childEntity)
|
||||||
|
{
|
||||||
|
return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid();
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerID Server::GetPlayerIDFromEndpoint()
|
||||||
|
{
|
||||||
|
// check both tcp and udp connection
|
||||||
|
for (auto& kv : m_ConnectedPlayers) {
|
||||||
|
if ((kv.second.TCPAddress == m_Address
|
||||||
|
&& kv.second.TCPPort == m_Port)
|
||||||
|
|| (kv.second.Endpoint.address() == m_Address
|
||||||
|
&& kv.second.Endpoint.port() == m_Port)) {
|
||||||
|
return kv.first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
#include "Network/TCPClient.h"
|
||||||
|
|
||||||
|
using namespace boost::asio::ip;
|
||||||
|
|
||||||
|
TCPClient::TCPClient()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TCPClient::~TCPClient()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPClient::Connect(std::string playerName, std::string address, int port)
|
||||||
|
{
|
||||||
|
if (m_Socket) {
|
||||||
|
if (m_IsConnected) {
|
||||||
|
Packet packet(MessageType::Connect, m_SendPacketID);
|
||||||
|
packet.WriteString(playerName);
|
||||||
|
Send(packet);
|
||||||
|
LOG_INFO("Connect message sent again!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!m_IsConnected) {
|
||||||
|
boost::system::error_code error = boost::asio::error::host_not_found;
|
||||||
|
m_Endpoint = tcp::endpoint(boost::asio::ip::address::from_string(address), port);
|
||||||
|
m_Socket = std::unique_ptr<tcp::socket>(new tcp::socket(m_IOService));
|
||||||
|
m_Socket->connect(m_Endpoint, error);
|
||||||
|
tcp::no_delay option(true);
|
||||||
|
m_Socket->set_option(option);
|
||||||
|
LOG_INFO(error.message().c_str());
|
||||||
|
if (!error) {
|
||||||
|
m_IsConnected = true;
|
||||||
|
Packet packet(MessageType::Connect, m_SendPacketID);
|
||||||
|
packet.WriteString(playerName);
|
||||||
|
Send(packet);
|
||||||
|
LOG_INFO("Connect message sent!");
|
||||||
|
}
|
||||||
|
// If error
|
||||||
|
else {
|
||||||
|
m_Socket->close();
|
||||||
|
m_Socket = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPClient::Disconnect()
|
||||||
|
{
|
||||||
|
if (!m_IsConnected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_Socket->shutdown(boost::asio::ip::tcp::socket::shutdown_both);
|
||||||
|
m_Socket->close();
|
||||||
|
m_Socket = nullptr;
|
||||||
|
m_IsConnected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPClient::Receive(Packet& packet)
|
||||||
|
{
|
||||||
|
size_t bytesRead = readBuffer(m_ReadBuffer);
|
||||||
|
if (bytesRead > 0) {
|
||||||
|
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t TCPClient::readBuffer(char* data)
|
||||||
|
{
|
||||||
|
if (!m_Socket) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
boost::system::error_code error;
|
||||||
|
// Read size of packet
|
||||||
|
size_t bytesReceived = m_Socket->read_some(boost
|
||||||
|
::asio::buffer((void*)data, sizeof(int)),
|
||||||
|
error);
|
||||||
|
int sizeOfPacket = 0;
|
||||||
|
memcpy(&sizeOfPacket, data, sizeof(int));
|
||||||
|
|
||||||
|
// Read the rest of the message
|
||||||
|
bytesReceived += m_Socket->read_some(boost
|
||||||
|
::asio::buffer((void*)(data + bytesReceived), sizeOfPacket - bytesReceived),
|
||||||
|
error);
|
||||||
|
if (error) {
|
||||||
|
//LOG_ERROR("receive: %s", error.message().c_str());
|
||||||
|
}
|
||||||
|
return bytesReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPClient::Send(Packet & packet)
|
||||||
|
{
|
||||||
|
if (!m_Socket) {
|
||||||
|
LOG_WARNING("TCPClient::Send: Socket is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
packet.UpdateSize();
|
||||||
|
boost::system::error_code error;
|
||||||
|
m_Socket->send(boost::asio::buffer(
|
||||||
|
packet.Data(),
|
||||||
|
packet.Size()), 0, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TCPClient::IsSocketAvailable()
|
||||||
|
{
|
||||||
|
if (!m_Socket) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return m_Socket->available();
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
#include "Network/TCPServer.h"
|
||||||
|
using namespace boost::asio::ip;
|
||||||
|
|
||||||
|
TCPServer::TCPServer()
|
||||||
|
{
|
||||||
|
acceptor = std::unique_ptr<tcp::acceptor>(new tcp::acceptor(m_IOService, tcp::endpoint(tcp::v4(), 27666)));
|
||||||
|
}
|
||||||
|
|
||||||
|
TCPServer::~TCPServer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPServer::AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers)
|
||||||
|
{
|
||||||
|
boost::shared_ptr<tcp::socket> newSocket = boost::shared_ptr<tcp::socket>(new tcp::socket(m_IOService));
|
||||||
|
m_IOService.poll();
|
||||||
|
acceptor->async_accept(*newSocket,
|
||||||
|
boost::bind(&TCPServer::handle_accept, this, newSocket, boost::ref(nextPlayerID), boost::ref(connectedPlayers),
|
||||||
|
boost::asio::placeholders::error));
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerID GetPlayerIDFromEndpoint(const std::map<PlayerID, PlayerDefinition>& connectedPlayers,
|
||||||
|
boost::asio::ip::address address, unsigned short port)
|
||||||
|
{
|
||||||
|
for (auto& kv : connectedPlayers) {
|
||||||
|
if (kv.second.TCPAddress == address &&
|
||||||
|
kv.second.TCPPort == port) {
|
||||||
|
return kv.first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPServer::handle_accept(boost::shared_ptr<tcp::socket> socket,
|
||||||
|
int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers,
|
||||||
|
const boost::system::error_code& error)
|
||||||
|
{
|
||||||
|
if (!error && GetPlayerIDFromEndpoint(connectedPlayers, socket->remote_endpoint().address(),
|
||||||
|
socket->remote_endpoint().port()) == -1) {
|
||||||
|
// Add tcp socket to connections
|
||||||
|
boost::asio::ip::tcp::no_delay option(true);
|
||||||
|
socket->set_option(option);
|
||||||
|
PlayerDefinition pd;
|
||||||
|
pd.StopTime = std::clock();
|
||||||
|
pd.TCPSocket = socket;
|
||||||
|
pd.TCPAddress = socket.get()->remote_endpoint().address();
|
||||||
|
pd.TCPPort = socket.get()->remote_endpoint().port();
|
||||||
|
connectedPlayers[nextPlayerID++] = pd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPServer::Send(Packet & packet, PlayerDefinition & playerDefinition)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
packet.UpdateSize();
|
||||||
|
int bytesSent = playerDefinition.TCPSocket->send(
|
||||||
|
boost::asio::buffer(packet.Data(), packet.Size()),
|
||||||
|
0);
|
||||||
|
} catch (const boost::system::system_error& e) {
|
||||||
|
// TODO: Clean up invalid endpoints out of m_ConnectedPlayers later
|
||||||
|
playerDefinition.Endpoint = boost::asio::ip::udp::endpoint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPServer::Send(Packet & packet)
|
||||||
|
{
|
||||||
|
packet.UpdateSize();
|
||||||
|
lastReceivedSocket->send(
|
||||||
|
boost::asio::buffer(
|
||||||
|
packet.Data(),
|
||||||
|
packet.Size()),
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPServer::Disconnect()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCPServer::Receive(Packet & packet, PlayerDefinition & playerDefinition)
|
||||||
|
{
|
||||||
|
int bytesRead = readBuffer(m_ReadBuffer, playerDefinition);
|
||||||
|
if (bytesRead > 0) {
|
||||||
|
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
||||||
|
}
|
||||||
|
lastReceivedSocket = playerDefinition.TCPSocket;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TCPServer::readBuffer(char* data, PlayerDefinition & playerDefinition)
|
||||||
|
{
|
||||||
|
if (!playerDefinition.TCPSocket) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
boost::system::error_code error;
|
||||||
|
// Read size of packet
|
||||||
|
size_t bytesReceived = playerDefinition.TCPSocket->read_some(boost
|
||||||
|
::asio::buffer((void*)data, sizeof(int)),
|
||||||
|
error);
|
||||||
|
int sizeOfPacket = 0;
|
||||||
|
memcpy(&sizeOfPacket, data, sizeof(int));
|
||||||
|
|
||||||
|
// Read the rest of the message
|
||||||
|
bytesReceived += playerDefinition.TCPSocket->read_some(boost
|
||||||
|
::asio::buffer((void*)(data + bytesReceived), sizeOfPacket - bytesReceived),
|
||||||
|
error);
|
||||||
|
if (error) {
|
||||||
|
//LOG_ERROR("receive: %s", error.message().c_str());
|
||||||
|
}
|
||||||
|
return bytesReceived;
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
#include "Network/UDPClient.h"
|
||||||
|
|
||||||
|
using namespace boost::asio::ip;
|
||||||
|
|
||||||
|
UDPClient::UDPClient()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
UDPClient::~UDPClient()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPClient::Connect(std::string playerName, std::string address, int port)
|
||||||
|
{
|
||||||
|
if (m_Socket) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_ReceiverEndpoint = udp::endpoint(boost::asio::ip::address::from_string(address), port);
|
||||||
|
m_Socket = boost::shared_ptr<boost::asio::ip::udp::socket>(new boost::asio::ip::udp::socket(m_IOService));
|
||||||
|
m_Socket->connect(m_ReceiverEndpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPClient::Disconnect()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPClient::Receive(Packet& packet)
|
||||||
|
{
|
||||||
|
int bytesRead = readBuffer(m_ReadBuffer);
|
||||||
|
if (bytesRead > 0) {
|
||||||
|
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int UDPClient::readBuffer(char* data)
|
||||||
|
{
|
||||||
|
if (!m_Socket) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
boost::system::error_code error;
|
||||||
|
int bytesReceived = m_Socket->receive_from(boost
|
||||||
|
::asio::buffer((void*)data, BUFFERSIZE),
|
||||||
|
m_ReceiverEndpoint,
|
||||||
|
0, error);
|
||||||
|
if (error) {
|
||||||
|
//LOG_ERROR("receive: %s", error.message().c_str());
|
||||||
|
}
|
||||||
|
return bytesReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPClient::Send(Packet& packet)
|
||||||
|
{
|
||||||
|
m_Socket->send_to(boost::asio::buffer(
|
||||||
|
packet.Data(),
|
||||||
|
packet.Size()),
|
||||||
|
m_ReceiverEndpoint, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UDPClient::IsSocketAvailable()
|
||||||
|
{
|
||||||
|
if (!m_Socket) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return m_Socket->available();
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#include "Network/UDPServer.h"
|
||||||
|
|
||||||
|
UDPServer::UDPServer()
|
||||||
|
{
|
||||||
|
m_Socket = std::unique_ptr<boost::asio::ip::udp::socket>(new boost::asio::ip::udp::socket(m_IOService, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 27666)));
|
||||||
|
}
|
||||||
|
|
||||||
|
UDPServer::~UDPServer()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void UDPServer::Send(Packet& packet, PlayerDefinition & playerDefinition)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
int bytesSent = m_Socket->send_to(
|
||||||
|
boost::asio::buffer(packet.Data(), packet.Size()),
|
||||||
|
playerDefinition.Endpoint,
|
||||||
|
0);
|
||||||
|
} catch (const boost::system::system_error& e) {
|
||||||
|
// TODO: Clean up invalid endpoints out of m_ConnectedPlayers later
|
||||||
|
playerDefinition.Endpoint = boost::asio::ip::udp::endpoint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Send back to endpoint of received packet
|
||||||
|
void UDPServer::Send(Packet & packet)
|
||||||
|
{
|
||||||
|
m_Socket->send_to(
|
||||||
|
boost::asio::buffer(
|
||||||
|
packet.Data(),
|
||||||
|
packet.Size()),
|
||||||
|
m_ReceiverEndpoint,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPServer::Receive(Packet & packet, PlayerDefinition & playerDefinition)
|
||||||
|
{
|
||||||
|
int bytesRead = readBuffer(m_ReadBuffer);
|
||||||
|
if (bytesRead > 0) {
|
||||||
|
packet.ReconstructFromData(m_ReadBuffer, bytesRead);
|
||||||
|
}
|
||||||
|
playerDefinition.Endpoint = m_ReceiverEndpoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UDPServer::IsSocketAvailable()
|
||||||
|
{
|
||||||
|
return m_Socket->available();
|
||||||
|
}
|
||||||
|
|
||||||
|
int UDPServer::readBuffer(char* data)
|
||||||
|
{
|
||||||
|
boost::system::error_code error = boost::asio::error::host_not_found;
|
||||||
|
unsigned int length = m_Socket->receive_from(
|
||||||
|
boost::asio::buffer((void*)data
|
||||||
|
, BUFFERSIZE)
|
||||||
|
, m_ReceiverEndpoint, 0, error);
|
||||||
|
if (error) {
|
||||||
|
LOG_WARNING(error.message().c_str());
|
||||||
|
}
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPServer::AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers)
|
||||||
|
{ }
|
||||||
@@ -34,19 +34,32 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
|||||||
if (!(bool)animationComponent["Loop" + std::to_string(i)]) {
|
if (!(bool)animationComponent["Loop" + std::to_string(i)]) {
|
||||||
if (nextTime > animation->Duration) {
|
if (nextTime > animation->Duration) {
|
||||||
nextTime = animation->Duration;
|
nextTime = animation->Duration;
|
||||||
|
Events::AnimationComplete e;
|
||||||
|
e.Entity = entity;
|
||||||
|
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
} else if (nextTime < 0) {
|
} else if (nextTime < 0) {
|
||||||
|
Events::AnimationComplete e;
|
||||||
|
e.Entity = entity;
|
||||||
|
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
nextTime = 0;
|
nextTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
(double&)animationComponent["Speed" + std::to_string(i)] = 0.0;
|
(double&)animationComponent["Speed" + std::to_string(i)] = 0.0;
|
||||||
Events::AnimationComplete e;
|
|
||||||
e.Entity = entity;
|
|
||||||
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
} else {
|
} else {
|
||||||
if (nextTime > animation->Duration) {
|
if (nextTime > animation->Duration) {
|
||||||
|
Events::AnimationComplete e;
|
||||||
|
e.Entity = entity;
|
||||||
|
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
nextTime -= animation->Duration;
|
nextTime -= animation->Duration;
|
||||||
} else if (nextTime < 0) {
|
} else if (nextTime < 0) {
|
||||||
|
Events::AnimationComplete e;
|
||||||
|
e.Entity = entity;
|
||||||
|
e.Name = (std::string)animationComponent["AnimationName" + std::to_string(i)];
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
nextTime += animation->Duration;
|
nextTime += animation->Duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,32 +67,5 @@ void AnimationSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& a
|
|||||||
(double&)animationComponent["Time" + std::to_string(i)] = nextTime;
|
(double&)animationComponent["Time" + std::to_string(i)] = nextTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Calculate bone transforms
|
|
||||||
if (skeleton != nullptr) {
|
|
||||||
std::vector<Skeleton::AnimationData> animations;
|
|
||||||
if (entity.HasComponent("Animation")) {
|
|
||||||
for (int i = 1; i <= 3; i++) {
|
|
||||||
Skeleton::AnimationData animationData;
|
|
||||||
animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(entity["Animation"]["AnimationName" + std::to_string(i)]);
|
|
||||||
if (animationData.animation == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
animationData.time = (double)entity["Animation"]["Time" + std::to_string(i)];
|
|
||||||
animationData.weight = (double)entity["Animation"]["Weight" + std::to_string(i)];
|
|
||||||
|
|
||||||
animations.push_back(animationData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entity.HasComponent("AnimationOffset")) {
|
|
||||||
Skeleton::AnimationOffset animationOffset;
|
|
||||||
animationOffset.animation = skeleton->GetAnimation(entity["AnimationOffset"]["AnimationName"]);
|
|
||||||
animationOffset.time = (double)entity["AnimationOffset"]["Time"];
|
|
||||||
skeleton->CalculateFrameBones(animations, animationOffset);
|
|
||||||
} else {
|
|
||||||
skeleton->CalculateFrameBones(animations);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!model->IsSkinned()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
|
||||||
|
|
||||||
@@ -26,21 +29,45 @@ void BoneAttachmentSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Skeleton::Animation* animation = skeleton->GetAnimation(parent["Animation"]["AnimationName1"]);
|
|
||||||
|
|
||||||
if (!animation) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int id = skeleton->GetBoneID(entity["BoneAttachment"]["BoneName"]);
|
int id = skeleton->GetBoneID(entity["BoneAttachment"]["BoneName"]);
|
||||||
|
|
||||||
if(id == -1) {
|
if (id == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<::Skeleton::AnimationData> Animations;
|
||||||
|
::Skeleton::AnimationOffset AnimationOffset;
|
||||||
|
glm::mat4 boneTransform;
|
||||||
|
|
||||||
glm::mat4 boneTransform = skeleton->GetBoneTransformSuper(id);
|
if (parent.HasComponent("Animation")) {
|
||||||
//glm::mat4 boneTransform = skeleton->GetBoneTransform(skeleton->Bones[id], animation, (double)parent["Animation"]["Time1"], glm::mat4(1));
|
for (int i = 1; i <= 3; i++) {
|
||||||
|
::Skeleton::AnimationData animationData;
|
||||||
|
animationData.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["Animation"]["AnimationName" + std::to_string(i)]);
|
||||||
|
if (animationData.animation == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
animationData.time = (double)parent["Animation"]["Time" + std::to_string(i)];
|
||||||
|
animationData.weight = (double)parent["Animation"]["Weight" + std::to_string(i)];
|
||||||
|
|
||||||
|
Animations.push_back(animationData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parent.HasComponent("AnimationOffset")) {
|
||||||
|
AnimationOffset.animation = model->m_RawModel->m_Skeleton->GetAnimation(parent["AnimationOffset"]["AnimationName"]);
|
||||||
|
AnimationOffset.time = (double)parent["AnimationOffset"]["Time"];
|
||||||
|
|
||||||
|
if(AnimationOffset.animation != nullptr) {
|
||||||
|
boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, AnimationOffset, glm::mat4(1));
|
||||||
|
} else {
|
||||||
|
boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, glm::mat4(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
boneTransform = skeleton->GetBoneTransform(false, skeleton->Bones.at(id), Animations, glm::mat4(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glm::vec3 scale;
|
glm::vec3 scale;
|
||||||
glm::quat rotation;
|
glm::quat rotation;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
GLERROR("Creating sprite program");
|
GLERROR("Creating sprite program");
|
||||||
m_ForwardPlusSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram");
|
m_ForwardPlusSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram");
|
||||||
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
||||||
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl")));
|
||||||
m_ForwardPlusSplatMapProgram->Compile();
|
m_ForwardPlusSplatMapProgram->Compile();
|
||||||
m_ForwardPlusSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
m_ForwardPlusSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
||||||
m_ForwardPlusSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
m_ForwardPlusSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
||||||
@@ -100,7 +100,7 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
m_ExplosionEffectSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapProgram");
|
m_ExplosionEffectSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapProgram");
|
||||||
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
|
||||||
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
|
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
|
||||||
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
m_ExplosionEffectSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl")));
|
||||||
m_ExplosionEffectSplatMapProgram->Compile();
|
m_ExplosionEffectSplatMapProgram->Compile();
|
||||||
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(0, "sceneColor");
|
||||||
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
m_ExplosionEffectSplatMapProgram->BindFragDataLocation(1, "bloomColor");
|
||||||
@@ -128,7 +128,7 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
|
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapSkinnedProgram");
|
m_ExplosionEffectSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapSkinnedProgram");
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
m_ExplosionEffectSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl")));
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->Compile();
|
m_ExplosionEffectSplatMapSkinnedProgram->Compile();
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
||||||
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
m_ExplosionEffectSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
||||||
@@ -137,7 +137,7 @@ void DrawFinalPass::InitializeShaderPrograms()
|
|||||||
|
|
||||||
m_ForwardPlusSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapSkinnedProgram");
|
m_ForwardPlusSplatMapSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapSkinnedProgram");
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMap.frag.glsl")));
|
m_ForwardPlusSplatMapSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl")));
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->Compile();
|
m_ForwardPlusSplatMapSkinnedProgram->Compile();
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(0, "sceneColor");
|
||||||
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
m_ForwardPlusSplatMapSkinnedProgram->BindFragDataLocation(1, "bloomColor");
|
||||||
@@ -338,7 +338,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
//bind textures
|
//bind textures
|
||||||
BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob);
|
BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob);
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = explosionEffectJob->Skeleton->GetBones();
|
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
} else {
|
} else {
|
||||||
m_ExplosionEffectProgram->Bind();
|
m_ExplosionEffectProgram->Bind();
|
||||||
@@ -361,7 +365,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob);
|
BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob);
|
||||||
GLERROR("asdasd");
|
GLERROR("asdasd");
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = explosionEffectJob->Skeleton->GetBones();
|
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -402,7 +410,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
//bind textures
|
//bind textures
|
||||||
BindModelTextures(forwardSkinnedHandle, modelJob);
|
BindModelTextures(forwardSkinnedHandle, modelJob);
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = modelJob->Skeleton->GetBones();
|
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -426,7 +438,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
BindModelTextures(forwardSplatMapSkinnedHandle, modelJob);
|
BindModelTextures(forwardSplatMapSkinnedHandle, modelJob);
|
||||||
GLERROR("asdasd");
|
GLERROR("asdasd");
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = modelJob->Skeleton->GetBones();
|
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -470,7 +486,11 @@ void DrawFinalPass::DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJo
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = modelJob->Skeleton->GetBones();
|
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
} else {
|
} else {
|
||||||
m_ShieldToStencilProgram->Bind();
|
m_ShieldToStencilProgram->Bind();
|
||||||
@@ -524,7 +544,11 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = explosionEffectJob->Skeleton->GetBones();
|
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(explosionHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
if (GLERROR("Animation")) {
|
if (GLERROR("Animation")) {
|
||||||
@@ -559,7 +583,11 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
|
|||||||
BindModelTextures(forwardHandle ,modelJob);
|
BindModelTextures(forwardHandle ,modelJob);
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = modelJob->Skeleton->GetBones();
|
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(forwardHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
|
|
||||||
@@ -591,7 +619,11 @@ void DrawFinalPass::DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& job
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = modelJob->Skeleton->GetBones();
|
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -918,7 +950,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
|
|
||||||
//Bind 5 diffuse textures
|
//Bind 5 diffuse textures
|
||||||
std::string UniformName = "DiffuseUVRepeat";
|
std::string UniformName = "DiffuseUVRepeat";
|
||||||
for (unsigned int i = 0; i < 5; i++) {
|
for (unsigned int i = 0; i < 3; i++) {
|
||||||
glActiveTexture(texturePosition);
|
glActiveTexture(texturePosition);
|
||||||
if (job->DiffuseTexture.size() > i && job->DiffuseTexture[i]->Texture != nullptr) {
|
if (job->DiffuseTexture.size() > i && job->DiffuseTexture[i]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[i]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[i]->Texture->m_Texture);
|
||||||
@@ -932,7 +964,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
|
|
||||||
//Bind 5 Normal textures
|
//Bind 5 Normal textures
|
||||||
UniformName = "NormalUVRepeat";
|
UniformName = "NormalUVRepeat";
|
||||||
for (unsigned int i = 0; i < 5; i++) {
|
for (unsigned int i = 0; i < 3; i++) {
|
||||||
glActiveTexture(texturePosition);
|
glActiveTexture(texturePosition);
|
||||||
if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) {
|
if (job->NormalTexture.size() > i && job->NormalTexture[i]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[i]->Texture->m_Texture);
|
||||||
@@ -946,7 +978,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
|
|
||||||
//Bind 5 Specular textures
|
//Bind 5 Specular textures
|
||||||
UniformName = "SpecularUVRepeat";
|
UniformName = "SpecularUVRepeat";
|
||||||
for (unsigned int i = 0; i < 5; i++) {
|
for (unsigned int i = 0; i < 3; i++) {
|
||||||
glActiveTexture(texturePosition);
|
glActiveTexture(texturePosition);
|
||||||
if (job->SpecularTexture.size() > i && job->SpecularTexture[i]->Texture != nullptr) {
|
if (job->SpecularTexture.size() > i && job->SpecularTexture[i]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[i]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[i]->Texture->m_Texture);
|
||||||
@@ -960,7 +992,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
|||||||
|
|
||||||
//Bind 5 Incandescence textures
|
//Bind 5 Incandescence textures
|
||||||
UniformName = "GlowUVRepeat";
|
UniformName = "GlowUVRepeat";
|
||||||
for (unsigned int i = 0; i < 5; i++) {
|
for (unsigned int i = 0; i < 3; i++) {
|
||||||
glActiveTexture(texturePosition);
|
glActiveTexture(texturePosition);
|
||||||
if (job->IncandescenceTexture.size() > i && job->IncandescenceTexture[i]->Texture != nullptr) {
|
if (job->IncandescenceTexture.size() > i && job->IncandescenceTexture[i]->Texture != nullptr) {
|
||||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[i]->Texture->m_Texture);
|
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[i]->Texture->m_Texture);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ PickingPass::~PickingPass()
|
|||||||
|
|
||||||
void PickingPass::InitializeTextures()
|
void PickingPass::InitializeTextures()
|
||||||
{
|
{
|
||||||
m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false);
|
|
||||||
GenerateTexture(&m_PickingTexture, GL_CLAMP_TO_BORDER, GL_LINEAR,
|
GenerateTexture(&m_PickingTexture, GL_CLAMP_TO_BORDER, GL_LINEAR,
|
||||||
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
|
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
|
||||||
}
|
}
|
||||||
@@ -43,22 +42,22 @@ void PickingPass::InitializeShaderPrograms()
|
|||||||
m_PickingProgram->BindFragDataLocation(0, "TextureFragment");
|
m_PickingProgram->BindFragDataLocation(0, "TextureFragment");
|
||||||
m_PickingProgram->Link();
|
m_PickingProgram->Link();
|
||||||
|
|
||||||
m_PickingSkinnedProgram = ResourceManager::Load<ShaderProgram>("#PickingSkinnedProgram");
|
m_PickingSkinnedProgram = ResourceManager::Load<ShaderProgram>("#PickingSkinnedProgram");
|
||||||
|
|
||||||
m_PickingSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/PickingSkinned.vert.glsl")));
|
m_PickingSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/PickingSkinned.vert.glsl")));
|
||||||
m_PickingSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Picking.frag.glsl")));
|
m_PickingSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Picking.frag.glsl")));
|
||||||
m_PickingSkinnedProgram->Compile();
|
m_PickingSkinnedProgram->Compile();
|
||||||
m_PickingSkinnedProgram->BindFragDataLocation(0, "TextureFragment");
|
m_PickingSkinnedProgram->BindFragDataLocation(0, "TextureFragment");
|
||||||
m_PickingSkinnedProgram->Link();
|
m_PickingSkinnedProgram->Link();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PickingPass::Draw(RenderScene& scene)
|
void PickingPass::Draw(RenderScene& scene)
|
||||||
{
|
{
|
||||||
PickingPassState* state = new PickingPassState(m_PickingBuffer.GetHandle());
|
PickingPassState* state = new PickingPassState(m_PickingBuffer.GetHandle());
|
||||||
|
|
||||||
//TODO: Render: Add code for more jobs than modeljobs.
|
//TODO: Render: Add code for more jobs than modeljobs.
|
||||||
GLuint shaderHandle = m_PickingProgram->GetHandle();
|
GLuint shaderHandle = m_PickingProgram->GetHandle();
|
||||||
GLuint shaderSkinnedHandle = m_PickingSkinnedProgram->GetHandle();
|
GLuint shaderSkinnedHandle = m_PickingSkinnedProgram->GetHandle();
|
||||||
m_PickingProgram->Bind();
|
m_PickingProgram->Bind();
|
||||||
|
|
||||||
if (scene.ClearDepth) {
|
if (scene.ClearDepth) {
|
||||||
@@ -93,48 +92,30 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
|
|
||||||
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
||||||
|
|
||||||
if (modelJob->Model->IsSkinned())
|
if (modelJob->Model->IsSkinned()) {
|
||||||
{
|
m_PickingSkinnedProgram->Bind();
|
||||||
m_PickingSkinnedProgram->Bind();
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
glUniform4fv(glGetUniformLocation(shaderSkinnedHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = modelJob->Skeleton->GetBones();
|
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
m_PickingProgram->Bind();
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
|
||||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
m_PickingProgram->Bind();
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
|
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
}
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
glBindVertexArray(modelJob->Model->VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||||
@@ -142,7 +123,7 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &job : scene.Jobs.TransparentObjects) {
|
/* for (auto &job : scene.Jobs.TransparentObjects) {
|
||||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||||
|
|
||||||
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
||||||
@@ -174,50 +155,32 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
glUniform4fv(glGetUniformLocation(shaderSkinnedHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = modelJob->Skeleton->GetBones();
|
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
} else {
|
} else {
|
||||||
m_PickingProgram->Bind();
|
m_PickingProgram->Bind();
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
glBindVertexArray(modelJob->Model->VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||||
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
for (auto &job : scene.Jobs.OpaqueShieldedObjects) {
|
for (auto &job : scene.Jobs.OpaqueShieldedObjects) {
|
||||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||||
|
|
||||||
|
|
||||||
if (modelJob) {
|
if (modelJob) {
|
||||||
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
||||||
|
|
||||||
@@ -242,26 +205,19 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
|
|
||||||
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
||||||
|
|
||||||
if(modelJob->Model->IsSkinned()) {
|
if (modelJob->Model->IsSkinned()) {
|
||||||
m_PickingSkinnedProgram->Bind();
|
m_PickingSkinnedProgram->Bind();
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
glUniform4fv(glGetUniformLocation(shaderSkinnedHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = modelJob->Skeleton->GetBones();
|
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -269,18 +225,7 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
glBindVertexArray(modelJob->Model->VAO);
|
||||||
@@ -289,7 +234,7 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &job : scene.Jobs.TransparentShieldedObjects) {
|
/* for (auto &job : scene.Jobs.TransparentShieldedObjects) {
|
||||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||||
|
|
||||||
if (modelJob) {
|
if (modelJob) {
|
||||||
@@ -319,27 +264,21 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
|
|
||||||
if (modelJob->Model->IsSkinned()) {
|
if (modelJob->Model->IsSkinned()) {
|
||||||
m_PickingSkinnedProgram->Bind();
|
m_PickingSkinnedProgram->Bind();
|
||||||
|
|
||||||
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
glUniform4fv(glGetUniformLocation(shaderSkinnedHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderSkinnedHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
if (modelJob->Model->m_RawModel->m_Skeleton != nullptr) {
|
||||||
|
|
||||||
std::vector<glm::mat4> frameBones;
|
std::vector<glm::mat4> frameBones;
|
||||||
frameBones = modelJob->Skeleton->GetBones();
|
if (modelJob->AnimationOffset.animation != nullptr) {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
|
||||||
|
} else {
|
||||||
|
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
|
||||||
|
}
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -349,25 +288,18 @@ void PickingPass::Draw(RenderScene& scene)
|
|||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(modelJob->Color));
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
glUniform2fv(glGetUniformLocation(shaderHandle, "PickingColor"), 1, glm::value_ptr(glm::vec2(pickColor[0], pickColor[1])));
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
if (modelJob->DiffuseTexture.size() > 0 && modelJob->DiffuseTexture[0]->Texture != nullptr) {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture[0]->Texture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(modelJob->DiffuseTexture[0]->UVRepeat));
|
|
||||||
} else {
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_WhiteTexture->m_Texture);
|
|
||||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glBindVertexArray(modelJob->Model->VAO);
|
glBindVertexArray(modelJob->Model->VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
|
||||||
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex * sizeof(unsigned int)));
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
m_PickingBuffer.Unbind();
|
m_PickingBuffer.Unbind();
|
||||||
GLERROR("PickingPass Error");
|
GLERROR("PickingPass Error");
|
||||||
|
|
||||||
|
|||||||
@@ -277,8 +277,8 @@ void RawModelCustom::ReadMaterialTextureProperties(RawModelCustom::TextureProper
|
|||||||
throw Resource::FailedLoadingException("Reading Material texture UVTiling failed");
|
throw Resource::FailedLoadingException("Reading Material texture UVTiling failed");
|
||||||
}
|
}
|
||||||
memcpy(&texture.UVRepeat[0], fileData + offset, sizeof(glm::vec2));
|
memcpy(&texture.UVRepeat[0], fileData + offset, sizeof(glm::vec2));
|
||||||
offset += sizeof(glm::vec2);
|
|
||||||
}
|
}
|
||||||
|
offset += sizeof(glm::vec2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RawModelCustom::ReadAnimationFile(std::string filePath)
|
void RawModelCustom::ReadAnimationFile(std::string filePath)
|
||||||
|
|||||||
@@ -47,16 +47,8 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EntityWrapper entity(world, cSprite.EntityID);
|
EntityWrapper entity(world, cSprite.EntityID);
|
||||||
|
if (!isEntityVisible(entity)) {
|
||||||
// Only render children of a camera if that camera is currently active
|
|
||||||
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
|
|
||||||
if (entity.HasComponent("HiddenForLocalPlayer") && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +77,26 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RenderSystem::isEntityVisible(EntityWrapper& entity)
|
||||||
|
{
|
||||||
|
// Only render children of a camera if that camera is currently active
|
||||||
|
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
|
||||||
|
bool outOfBodyExperience = ResourceManager::Load<ConfigFile>("Config.ini")->Get<bool>("Debug.OutOfBodyExperience", false);
|
||||||
|
if (
|
||||||
|
(entity.HasComponent("HiddenForLocalPlayer") || entity.FirstParentWithComponent("HiddenForLocalPlayer").Valid())
|
||||||
|
&& (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))
|
||||||
|
&& !outOfBodyExperience
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool RenderSystem::isChildOfACamera(EntityWrapper entity)
|
bool RenderSystem::isChildOfACamera(EntityWrapper entity)
|
||||||
{
|
{
|
||||||
return entity.FirstParentWithComponent("Camera").Valid();
|
return entity.FirstParentWithComponent("Camera").Valid();
|
||||||
@@ -112,13 +124,7 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only render children of a camera if that camera is currently active
|
if (!isEntityVisible(entity)) {
|
||||||
if (isChildOfACamera(entity) && !isChildOfCurrentCamera(entity)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide things parented to local player if they have the HiddenFromLocalPlayer component
|
|
||||||
if ((entity.HasComponent("HiddenForLocalPlayer") || entity.FirstParentWithComponent("HiddenForLocalPlayer").Valid()) && (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer))) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +305,11 @@ void RenderSystem::fillText(std::list<std::shared_ptr<RenderJob>>& jobs, World*
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityWrapper entity(world, textComponent.EntityID);
|
||||||
|
if (!isEntityVisible(entity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Font* font;
|
Font* font;
|
||||||
try {
|
try {
|
||||||
font = ResourceManager::Load<Font>(resource);
|
font = ResourceManager::Load<Font>(resource);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user