Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b547938928 | |||
| d1832c1741 | |||
| 4432891437 | |||
| a006db9e63 | |||
| 717af2c4a4 |
+1
-1
Submodule assets updated: 651f65a98d...1e7adc749e
@@ -78,21 +78,13 @@ bool AABBvsTriangles(const AABB& box,
|
||||
bool& isOnGround,
|
||||
glm::vec3& outResolutionVector);
|
||||
|
||||
//Detects collision, but does not resolve.
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix);
|
||||
|
||||
//Return true if the boxes are intersecting.
|
||||
bool AABBVsAABB(const AABB& a, const AABB& b);
|
||||
//Return true if the boxes are intersecting.
|
||||
//Also outputs the minimum translation that box [a] would need in order to resolve collision.
|
||||
bool AABBVsAABB(const AABB& a, const AABB& b, glm::vec3& minimumTranslation);
|
||||
|
||||
// Calculates an absolute AABB from an entity AABB component or Model component.
|
||||
// if takeModelBox is true, the AABB component will be ignored and box is calculated from Model.
|
||||
// if takeModelBox is false, the AABB component will be prefered, if it exists.
|
||||
// Calculates an absolute AABB from an entity AABB component
|
||||
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox = false);
|
||||
boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity);
|
||||
//Returns the first entity hit by the input ray. entitiesPotentiallyHitSorted needs to be sorted
|
||||
|
||||
@@ -15,11 +15,11 @@ class CollisionSystem : public PureSystem
|
||||
public:
|
||||
CollisionSystem(SystemParams params, Octree<EntityAABB>* octree)
|
||||
: System(params)
|
||||
, PureSystem("Physics")
|
||||
, PureSystem("Collidable")
|
||||
, m_Octree(octree)
|
||||
{ }
|
||||
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPhysics, double dt) override;
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override;
|
||||
|
||||
private:
|
||||
Octree<EntityAABB>* m_Octree;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define ComponentInfo_h__
|
||||
|
||||
#include "../Common.h"
|
||||
#include <boost/shared_array.hpp>
|
||||
|
||||
struct ComponentInfo
|
||||
{
|
||||
@@ -28,9 +27,8 @@ struct ComponentInfo
|
||||
std::string Name;
|
||||
std::unordered_map<std::string, Field_t> Fields;
|
||||
std::vector<std::string> FieldsInOrder;
|
||||
std::vector<std::string> StringFields;
|
||||
unsigned int Stride = 0;
|
||||
boost::shared_array<char> Defaults = nullptr;
|
||||
std::shared_ptr<char> Defaults = nullptr;
|
||||
std::shared_ptr<Meta_t> Meta = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef ComponentPool_h__
|
||||
#define ComponentPool_h__
|
||||
|
||||
#include <set>
|
||||
#include "MemoryPool.h"
|
||||
#include "ComponentInfo.h"
|
||||
#include "ComponentWrapper.h"
|
||||
@@ -46,8 +45,7 @@ public:
|
||||
: m_ComponentInfo(ci)
|
||||
, m_Pool(ci.Meta->Allocation, sizeof(EntityID) + ci.Stride)
|
||||
{ }
|
||||
~ComponentPool();
|
||||
ComponentPool(const ComponentPool& other);
|
||||
ComponentPool(const ComponentPool& other) = delete;
|
||||
ComponentPool(const ComponentPool&& other) = delete;
|
||||
|
||||
const ::ComponentInfo& ComponentInfo() const { return m_ComponentInfo; }
|
||||
|
||||
@@ -2,29 +2,11 @@
|
||||
#define ComponentWrapper_h__
|
||||
|
||||
#include <boost/shared_array.hpp>
|
||||
#include <boost/any.hpp>
|
||||
#include "../Common.h"
|
||||
#include "Entity.h"
|
||||
#include "ComponentInfo.h"
|
||||
#include "Util/Any.h"
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct ComponentField { };
|
||||
|
||||
template <typename T>
|
||||
struct ComponentField<T, typename std::enable_if<std::is_trivially_copyable<T>::value>::type>
|
||||
{
|
||||
static T& Get(const ComponentInfo::Field_t& info, char* data) { return *reinterpret_cast<T*>(data); }
|
||||
static void Set(const ComponentInfo::Field_t& info, char* data, const T& value) { Get(data) = value; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ComponentField<std::string, void>
|
||||
{
|
||||
static std::string& Get(const ComponentInfo::Field_t& info, char* data) { return **reinterpret_cast<std::string**>(data); }
|
||||
static void Set(const ComponentInfo::Field_t& info, char* data, const std::string& value) { Get(info, data) = value; }
|
||||
};
|
||||
|
||||
struct ComponentWrapper
|
||||
{
|
||||
ComponentWrapper(const ComponentInfo& componentInfo, char* data)
|
||||
@@ -65,31 +47,7 @@ struct ComponentWrapper
|
||||
|
||||
void Copy(ComponentWrapper& destination)
|
||||
{
|
||||
// Copy trivial data
|
||||
memcpy(destination.Data, Data, Info.Stride);
|
||||
// Duplicate strings
|
||||
SolidifyStrings(destination);
|
||||
}
|
||||
|
||||
// When component data has been copied, strings need to be reconstructed or they'll refer to the same data!
|
||||
static void SolidifyStrings(ComponentWrapper& component)
|
||||
{
|
||||
for (auto& name : component.Info.StringFields) {
|
||||
std::size_t offset = component.Info.Fields.at(name).Offset;
|
||||
std::string value = *reinterpret_cast<const std::string*>(component.Data + offset);
|
||||
new (component.Data + offset) std::string(value);
|
||||
}
|
||||
}
|
||||
|
||||
// This needs to be called to properly free component data, because strings.
|
||||
static void Destroy(ComponentInfo info, char* data)
|
||||
{
|
||||
// Call std::string destructors
|
||||
for (auto& name : info.StringFields) {
|
||||
std::size_t offset = info.Fields.at(name).Offset;
|
||||
auto field = reinterpret_cast<std::string*>(data + offset);
|
||||
field->~basic_string();
|
||||
}
|
||||
memcpy(destination.Data, this->Data, Info.Stride);
|
||||
}
|
||||
|
||||
struct SubscriptProxy
|
||||
@@ -144,38 +102,26 @@ public:
|
||||
ComponentWrapperFactory(std::string componentTypeName, unsigned int allocation = 0)
|
||||
{
|
||||
m_ComponentInfo.Name = componentTypeName;
|
||||
m_ComponentInfo.Meta = std::make_shared<ComponentInfo::Meta_t>();
|
||||
m_ComponentInfo.Meta->Allocation = allocation;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void AddProperty(std::string fieldName, T defaultValue)
|
||||
{
|
||||
auto& field = m_ComponentInfo.Fields[fieldName];
|
||||
field.Name = fieldName;
|
||||
field.Type = typeid(T).name();
|
||||
field.Offset = m_ComponentInfo.Stride;
|
||||
field.Stride = sizeof(T);
|
||||
m_ComponentInfo.FieldsInOrder.push_back(field.Name);
|
||||
if (field.Type == typeid(std::string).name()) {
|
||||
field.Type = "string";
|
||||
m_ComponentInfo.StringFields.push_back(field.Name);
|
||||
}
|
||||
m_DefaultValues.push_back(defaultValue);
|
||||
m_ComponentInfo.Fields[fieldName].Type = typeid(T).name();
|
||||
m_ComponentInfo.Fields[fieldName].Offset = m_ComponentInfo.Stride;
|
||||
m_ComponentInfo.Fields[fieldName].Stride = sizeof(T);
|
||||
m_ComponentInfo.Stride += sizeof(T);
|
||||
m_DefaultValues.push_back(std::make_pair(field, defaultValue));
|
||||
}
|
||||
|
||||
|
||||
ComponentInfo& Finalize()
|
||||
{
|
||||
m_ComponentInfo.Defaults = boost::shared_array<char>(new char[m_ComponentInfo.Stride]);
|
||||
m_ComponentInfo.Defaults = std::shared_ptr<char>(new char[m_ComponentInfo.Stride]);
|
||||
std::size_t offset = 0;
|
||||
for (auto& pair : m_DefaultValues) {
|
||||
if (pair.first.Type == "string") {
|
||||
new (m_ComponentInfo.Defaults.get() + offset) std::string(*reinterpret_cast<std::string*>(pair.second.Data.get()));
|
||||
} else {
|
||||
memcpy(m_ComponentInfo.Defaults.get() + offset, pair.second.Data.get(), pair.second.Size);
|
||||
}
|
||||
offset += pair.second.Size;
|
||||
for (auto& val : m_DefaultValues) {
|
||||
memcpy(m_ComponentInfo.Defaults.get() + offset, val.Data.get(), val.Size);
|
||||
offset += val.Size;
|
||||
}
|
||||
|
||||
return m_ComponentInfo;
|
||||
@@ -185,7 +131,7 @@ public:
|
||||
|
||||
private:
|
||||
ComponentInfo m_ComponentInfo;
|
||||
std::vector<std::pair<ComponentInfo::Field_t, Any>> m_DefaultValues;
|
||||
std::vector<Any> m_DefaultValues;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -66,25 +66,9 @@ public:
|
||||
, m_LowestAllocatedSlot(m_NumSlots)
|
||||
{ }
|
||||
|
||||
MemoryPool(const MemoryPool<T>& other)
|
||||
: m_StartAddress(new char[other.m_NumSlots*other.m_Stride])
|
||||
, m_SlotIsAllocated(other.m_SlotIsAllocated)
|
||||
, m_ExtraMemory()
|
||||
, m_NumSlots(other.m_NumSlots)
|
||||
, m_LowestAllocatedSlot(other.m_LowestAllocatedSlot)
|
||||
, m_NumAllocatedSlots(other.m_NumAllocatedSlots)
|
||||
, m_Stride(other.m_Stride)
|
||||
, m_CurrentAllocSlot(other.m_CurrentAllocSlot)
|
||||
{
|
||||
// Copy statically allocated pool
|
||||
memcpy(m_StartAddress, other.m_StartAddress, m_NumSlots*m_Stride);
|
||||
// Copy dynamically allocated memory
|
||||
for (char* otherAddr : other.m_ExtraMemory) {
|
||||
char* addr = (char*)malloc(m_Stride);
|
||||
memcpy(addr, otherAddr, m_Stride);
|
||||
m_ExtraMemory.push_back(addr);
|
||||
}
|
||||
}
|
||||
//We may get problems with memory being released
|
||||
//prematurely, etc. if we allow copies.
|
||||
MemoryPool(const MemoryPool<T>& other) = delete;
|
||||
MemoryPool(const MemoryPool<T>&& other) = delete;
|
||||
|
||||
//Free all memory that has been allocated.
|
||||
@@ -94,9 +78,8 @@ public:
|
||||
delete[] m_StartAddress;
|
||||
m_StartAddress = nullptr;
|
||||
}
|
||||
for (char* addr : m_ExtraMemory) {
|
||||
free(addr);
|
||||
}
|
||||
for (char* addr : m_ExtraMemory)
|
||||
free(addr);
|
||||
m_ExtraMemory.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef PerformanceTimer_h__
|
||||
#define PerformanceTimer_h__
|
||||
|
||||
#include "../Common.h"
|
||||
#include <boost/timer/timer.hpp>
|
||||
using boost::timer::cpu_timer;
|
||||
|
||||
class PerformanceTimer
|
||||
{
|
||||
public:
|
||||
static void StartTimer(std::string nameOfTimer);
|
||||
static void StartTimerAndStopPrevious(std::string nameOfTimer);
|
||||
static void StopTimer(std::string nameOfTimer);
|
||||
static void SetFrameNumber(int frameNumber);
|
||||
|
||||
static void ResetAllTimers();
|
||||
static void CreateExcelData();
|
||||
|
||||
private:
|
||||
static std::map<std::string, cpu_timer> timers;
|
||||
static cpu_timer m_Timer;
|
||||
static std::string currentTimerRunning;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "System.h"
|
||||
#include "World.h"
|
||||
#include "EPause.h"
|
||||
#include "PerformanceTimer.h"
|
||||
|
||||
class SystemPipeline
|
||||
{
|
||||
@@ -73,10 +72,7 @@ public:
|
||||
|
||||
// Update
|
||||
for (auto& system : group.ImpureSystems) {
|
||||
auto className = (std::string)typeid(*system).name();
|
||||
PerformanceTimer::StartTimer(className);
|
||||
system->Update(dt);
|
||||
PerformanceTimer::StopTimer(className);
|
||||
}
|
||||
for (auto& pair : group.PureSystems) {
|
||||
const std::string& componentName = pair.first;
|
||||
@@ -87,10 +83,7 @@ public:
|
||||
}
|
||||
for (auto& component : *pool) {
|
||||
for (auto& system : systems) {
|
||||
auto className = (std::string)typeid(*system).name();
|
||||
PerformanceTimer::StartTimer(className);
|
||||
system->UpdateComponent(EntityWrapper(m_World, component.EntityID), component, dt);
|
||||
PerformanceTimer::StopTimer(className);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,9 +106,9 @@ private:
|
||||
std::vector<UnorderedSystems> m_OrderedSystemGroups;
|
||||
|
||||
EventRelay<SystemPipeline, Events::Pause> m_EPause;
|
||||
bool OnPause(const Events::Pause& e) {
|
||||
if (e.World == m_World) {
|
||||
m_Paused = true;
|
||||
bool OnPause(const Events::Pause& e) {
|
||||
if (e.World == m_World) {
|
||||
m_Paused = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define Util_Any_h__
|
||||
|
||||
#include <memory>
|
||||
#include <boost/shared_array.hpp>
|
||||
|
||||
struct Any
|
||||
{
|
||||
@@ -11,7 +10,7 @@ struct Any
|
||||
template <typename T>
|
||||
Any(const T& value)
|
||||
{
|
||||
Data = boost::shared_array<char>(new char[sizeof(T)]);
|
||||
Data = std::shared_ptr<char>(new char[sizeof(T)]);
|
||||
Size = sizeof(T);
|
||||
memcpy(Data.get(), &value, Size);
|
||||
}
|
||||
@@ -19,7 +18,7 @@ struct Any
|
||||
template <typename T>
|
||||
Any(T&& value)
|
||||
{
|
||||
Data = boost::shared_array<char>(new char[sizeof(T)]);
|
||||
Data = std::shared_ptr<char>(new char[sizeof(T)]);
|
||||
Size = sizeof(T);
|
||||
memcpy(Data.get(), &value, Size);
|
||||
}
|
||||
@@ -36,7 +35,7 @@ struct Any
|
||||
return Any(value);
|
||||
}
|
||||
|
||||
boost::shared_array<char> Data = nullptr;
|
||||
std::shared_ptr<char> Data = nullptr;
|
||||
std::size_t Size = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ public:
|
||||
: m_EventBroker(eventBroker)
|
||||
{ }
|
||||
~World();
|
||||
World(const World& other);
|
||||
|
||||
// Create empty entity
|
||||
EntityID CreateEntity(EntityID parent = 0);
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
#ifndef GUI_BUTTON_H__
|
||||
#define GUI_BUTTON_H__
|
||||
|
||||
#include "GUI/TextureFrame.h"
|
||||
#include "GUI/EButtonEnter.h"
|
||||
#include "GUI/EButtonLeave.h"
|
||||
#include "GUI/EButtonPress.h"
|
||||
#include "GUI/EButtonRelease.h"
|
||||
#include "Core/EMouseMove.h"
|
||||
#include "Core/EMousePress.h"
|
||||
#include "Core/EMouseRelease.h"
|
||||
|
||||
namespace dd
|
||||
{
|
||||
namespace GUI
|
||||
{
|
||||
|
||||
class Button : public TextureFrame
|
||||
{
|
||||
public:
|
||||
Button(Frame* parent, std::string name)
|
||||
: TextureFrame(parent, name)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMouseMove, &Button::OnMouseMove);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMousePress, &Button::OnMousePress);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMouseRelease, &Button::OnMouseRelease);
|
||||
}
|
||||
|
||||
void SetTextureHover(std::string resourceName)
|
||||
{
|
||||
m_TextureHover = resourceName;
|
||||
}
|
||||
void SetTextureReleased(std::string resourceName)
|
||||
{
|
||||
m_TextureReleased = resourceName;
|
||||
SetTexture(resourceName);
|
||||
}
|
||||
void SetTexturePressed(std::string resourceName)
|
||||
{
|
||||
m_TexturePressed = resourceName;
|
||||
}
|
||||
|
||||
void Draw(RenderScene& rq) override
|
||||
{
|
||||
if (m_Texture == nullptr && !m_TextureReleased.empty()) {
|
||||
SetTexture(m_TextureReleased);
|
||||
}
|
||||
|
||||
TextureFrame::Draw(rq);
|
||||
}
|
||||
|
||||
virtual void OnEnter() { }
|
||||
virtual void OnLeave() { }
|
||||
virtual void OnPress() { }
|
||||
virtual void OnRelease() { }
|
||||
|
||||
protected:
|
||||
bool m_MouseIsOver = false;
|
||||
bool m_IsDown = false;
|
||||
|
||||
virtual bool OnMouseMove(const Events::MouseMove& event)
|
||||
{
|
||||
if (Hidden()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isOver = Rectangle::Intersects(AbsoluteRectangle(), Rectangle(event.X, event.Y, 1, 1));
|
||||
if (isOver && !m_MouseIsOver) { // Enter
|
||||
if (!m_IsDown) {
|
||||
if (!m_TextureHover.empty()) {
|
||||
SetTexture(m_TextureHover);
|
||||
}
|
||||
}
|
||||
OnEnter();
|
||||
Events::ButtonEnter e;
|
||||
e.FrameName = m_Name;
|
||||
EventBroker->Publish(e);
|
||||
Events::PlaySound soundEvent;
|
||||
soundEvent.FilePath = "Sounds/GUI/hover-n.wav";
|
||||
EventBroker->Publish(soundEvent);
|
||||
|
||||
} else if (!isOver && m_MouseIsOver) { // Leave
|
||||
if (!m_IsDown) {
|
||||
if (!m_TextureReleased.empty()) {
|
||||
SetTexture(m_TextureReleased);
|
||||
}
|
||||
}
|
||||
OnLeave();
|
||||
Events::ButtonLeave e;
|
||||
e.FrameName = m_Name;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
m_MouseIsOver = isOver;
|
||||
|
||||
return true;
|
||||
}
|
||||
virtual bool OnMousePress(const Events::MousePress& event)
|
||||
{
|
||||
if (Hidden()) {
|
||||
//LOG_DEBUG("Pressed hidden button");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Rectangle::Intersects(AbsoluteRectangle(), Rectangle(event.X, event.Y, 1, 1))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_TexturePressed.empty()) {
|
||||
SetTexture(m_TexturePressed);
|
||||
}
|
||||
|
||||
m_IsDown = true;
|
||||
OnPress();
|
||||
Events::ButtonPress e;
|
||||
e.FrameName = m_Name;
|
||||
e.Button = this;
|
||||
EventBroker->Publish(e);
|
||||
|
||||
return true;
|
||||
}
|
||||
virtual bool OnMouseRelease(const Events::MouseRelease& event)
|
||||
{
|
||||
if (Hidden()) {
|
||||
//LOG_DEBUG("Released hidden button");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isOver = Rectangle::Intersects(AbsoluteRectangle(), Rectangle(event.X, event.Y, 1, 1));
|
||||
if (!isOver && !m_IsDown) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_MouseIsOver) {
|
||||
if (!m_TextureHover.empty()) {
|
||||
SetTexture(m_TextureHover);
|
||||
}
|
||||
} else {
|
||||
if (!m_TextureReleased.empty()) {
|
||||
SetTexture(m_TextureReleased);
|
||||
}
|
||||
}
|
||||
|
||||
m_IsDown = false;
|
||||
OnRelease();
|
||||
Events::ButtonRelease e;
|
||||
e.FrameName = m_Name;
|
||||
e.Button = this;
|
||||
EventBroker->Publish(e);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
EventRelay<Frame, Events::MouseMove> m_EMouseMove;
|
||||
EventRelay<Frame, Events::MousePress> m_EMousePress;
|
||||
EventRelay<Frame, Events::MouseRelease> m_EMouseRelease;
|
||||
|
||||
std::string m_TextureHover;
|
||||
std::string m_TexturePressed;
|
||||
std::string m_TextureReleased;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef ButtonSystem_h__
|
||||
#define ButtonSystem_h__
|
||||
|
||||
#include "../Rendering/IRenderer.h"
|
||||
#include "../Core/ConfigFile.h"
|
||||
#include "../Rendering/PickingPass.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
#include "../Core/System.h"
|
||||
#include "../Core/Event.h"
|
||||
#include "../Core/EMousePress.h"
|
||||
#include "../Core/EMouseRelease.h"
|
||||
#include "../Core/ELockMouse.h"
|
||||
|
||||
#include "EButtonPressed.h"
|
||||
#include "EButtonReleased.h"
|
||||
#include "EButtonClicked.h"
|
||||
|
||||
|
||||
class ButtonSystem : public PureSystem
|
||||
{
|
||||
public:
|
||||
ButtonSystem(SystemParams params, IRenderer* renderer);
|
||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override;
|
||||
private:
|
||||
IRenderer* m_Renderer;
|
||||
bool m_MouseIsLocked = false;
|
||||
|
||||
EntityWrapper m_PickEntity = EntityWrapper::Invalid;
|
||||
PickData m_PickData;
|
||||
|
||||
EventRelay<ButtonSystem, Events::LockMouse> m_EMouseLock;
|
||||
bool OnMouseLock(const Events::LockMouse& e);
|
||||
EventRelay<ButtonSystem, Events::UnlockMouse> m_EMouseUnlock;
|
||||
bool OnMouseUnlock(const Events::UnlockMouse& e);
|
||||
|
||||
EventRelay<ButtonSystem, Events::MousePress> m_EMousePress;
|
||||
bool OnMousePress(const Events::MousePress& e);
|
||||
EventRelay<ButtonSystem, Events::MouseRelease> m_EMouseRelease;
|
||||
bool OnMouseRelease(const Events::MouseRelease& e);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef Events_ButtonClicked_h__
|
||||
#define Events_ButtonClicked_h__
|
||||
|
||||
#include "Core/Event.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct ButtonClicked : public Event {
|
||||
std::string EntityName;
|
||||
EntityWrapper Entity;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef Events_ButtonEnter_h__
|
||||
#define Events_ButtonEnter_h__
|
||||
|
||||
#include "../Core/EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
/** Thrown on GUI button hover. */
|
||||
struct ButtonEnter : Event
|
||||
{
|
||||
std::string FrameName;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef Events_ButtonLeave_h__
|
||||
#define Events_ButtonLeave_h__
|
||||
|
||||
#include "../Core/EventBroker.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
/** Thrown on GUI button hover. */
|
||||
struct ButtonLeave : Event
|
||||
{
|
||||
std::string FrameName;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef Events_ButtonPress_h__
|
||||
#define Events_ButtonPress_h__
|
||||
|
||||
#include "../Core/EventBroker.h"
|
||||
|
||||
namespace GUI { class Button; }
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
/** Thrown on GUI button press. */
|
||||
struct ButtonPress : Event
|
||||
{
|
||||
std::string FrameName;
|
||||
GUI::Button* Button;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef Events_ButtonPressed_h__
|
||||
#define Events_ButtonPressed_h__
|
||||
|
||||
#include "Core/Event.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct ButtonPressed : public Event {
|
||||
std::string EntityName;
|
||||
EntityWrapper Entity;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef Events_ButtonRelease_h__
|
||||
#define Events_ButtonRelease_h__
|
||||
|
||||
#include "../Core/EventBroker.h"
|
||||
|
||||
namespace GUI { class Button; }
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
/** Thrown on GUI button release. */
|
||||
struct ButtonRelease : Event
|
||||
{
|
||||
std::string FrameName;
|
||||
GUI::Button* Button;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef Events_ButtonReleased_h__
|
||||
#define Events_ButtonReleased_h__
|
||||
|
||||
#include "Core/Event.h"
|
||||
|
||||
namespace Events
|
||||
{
|
||||
|
||||
struct ButtonReleased : public Event {
|
||||
std::string EntityName;
|
||||
EntityWrapper Entity;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,261 @@
|
||||
#ifndef GUI_Frame_h__
|
||||
#define GUI_Frame_h__
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../Core/Util/Rectangle.h"
|
||||
#include "../Core/EventBroker.h"
|
||||
#include "../Core/EKeyDown.h"
|
||||
#include "../Core/EKeyUp.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
#include "../Rendering/RenderQueue.h"
|
||||
#include "../Rendering/Texture.h"
|
||||
#include "../Input/EInputCommand.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
|
||||
class Frame : public Rectangle
|
||||
{
|
||||
public:
|
||||
enum class Anchor
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Top,
|
||||
Bottom
|
||||
};
|
||||
|
||||
static const int BaseWidth = 1280;
|
||||
static const int BaseHeight = 720;
|
||||
|
||||
// Set up a base frame with an event broker
|
||||
Frame(EventBroker* eventBroker)
|
||||
: m_EventBroker(eventBroker)
|
||||
, BaseFrame(this)
|
||||
, m_Name("UIParent")
|
||||
, Rectangle() { }
|
||||
|
||||
// Create a frame as a child
|
||||
Frame(Frame* parent, std::string name)
|
||||
: m_Name(name)
|
||||
{
|
||||
SetParent(parent);
|
||||
Width = parent->Width;
|
||||
Height = parent->Height;
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &Frame::OnKeyDown);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &Frame::OnKeyUp);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &Frame::OnCommand);
|
||||
}
|
||||
|
||||
~Frame()
|
||||
{
|
||||
/*for (auto layer : m_Children)
|
||||
{
|
||||
for (auto child : layer.second)
|
||||
{
|
||||
delete child.second;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Parent)
|
||||
{
|
||||
m_Parent->RemoveChild(this);
|
||||
}*/
|
||||
}
|
||||
|
||||
Frame* Parent() const { return m_Parent; }
|
||||
|
||||
void SetParent(Frame* parent)
|
||||
{
|
||||
if (parent == nullptr) {
|
||||
LOG_ERROR("Failed to parent frame \"%s\": Invalid parent", m_Name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
m_Layer = parent->Layer() + 1;
|
||||
parent->AddChild(this);
|
||||
m_Parent = parent;
|
||||
m_EventBroker = parent->m_EventBroker;
|
||||
BaseFrame = parent->BaseFrame;
|
||||
}
|
||||
|
||||
void AddChild(Frame* child)
|
||||
{
|
||||
m_Children[child->m_Layer].insert(std::make_pair(child->Name(), child));
|
||||
if (m_Parent) {
|
||||
m_Parent->AddChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveChild(Frame* child)
|
||||
{
|
||||
auto it = m_Children.find(child->m_Layer);
|
||||
if (it != m_Children.end()) {
|
||||
m_Children.erase(it);
|
||||
}
|
||||
|
||||
if (m_Parent) {
|
||||
m_Parent->RemoveChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Name() const { return m_Name; }
|
||||
void SetName(std::string val) { m_Name = val; }
|
||||
|
||||
int Layer() const { return m_Layer; }
|
||||
|
||||
bool Hidden() const
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->Hidden() || m_Hidden;
|
||||
else
|
||||
return m_Hidden;
|
||||
}
|
||||
bool Visible() const
|
||||
{
|
||||
return !Hidden();
|
||||
}
|
||||
|
||||
virtual void Hide() { m_Hidden = true; }
|
||||
virtual void Show() { m_Hidden = false; }
|
||||
|
||||
int Left() const override
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->Left() + X;
|
||||
else
|
||||
return X;
|
||||
}
|
||||
void SetLeft(int absLeft) override
|
||||
{
|
||||
if (m_Parent) {
|
||||
X = absLeft - m_Parent->Left();
|
||||
} else {
|
||||
X = absLeft;
|
||||
}
|
||||
}
|
||||
int Right() const override
|
||||
{
|
||||
return Left() + Width;
|
||||
}
|
||||
void SetRight(int absRight) override
|
||||
{
|
||||
if (m_Parent) {
|
||||
X = absRight - Width - m_Parent->Left();
|
||||
} else {
|
||||
X = absRight - Width;
|
||||
}
|
||||
}
|
||||
int Top() const override
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->Top() + Y;
|
||||
else
|
||||
return Y;
|
||||
}
|
||||
void SetTop(int absTop) override
|
||||
{
|
||||
if (m_Parent) {
|
||||
Y = absTop - m_Parent->Top();
|
||||
} else {
|
||||
Y = absTop;
|
||||
}
|
||||
}
|
||||
int Bottom() const override
|
||||
{
|
||||
return Top() + Height;
|
||||
}
|
||||
void SetBottom(int absBottom) override
|
||||
{
|
||||
if (m_Parent) {
|
||||
Y = absBottom - Height - m_Parent->Top();
|
||||
} else {
|
||||
Y = absBottom - Height;
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec2 Scale()
|
||||
{
|
||||
if (m_Parent)
|
||||
return m_Parent->Scale();
|
||||
else
|
||||
return glm::vec2(Width, Height) / glm::vec2(BaseWidth, BaseHeight);
|
||||
}
|
||||
|
||||
Rectangle AbsoluteRectangle()
|
||||
{
|
||||
int left = Left();
|
||||
if (m_Parent)
|
||||
left = std::max(left, m_Parent->Left());
|
||||
int top = Top();
|
||||
if (m_Parent)
|
||||
top = std::max(top, m_Parent->Top());
|
||||
int width = Right() - left;
|
||||
int height = Bottom() - top;
|
||||
return Rectangle(left, top, width, height);
|
||||
}
|
||||
|
||||
void UpdateLayered(double dt)
|
||||
{
|
||||
// Update ourselves
|
||||
this->Update(dt);
|
||||
|
||||
// Update children
|
||||
for (auto& pairLayer : m_Children) {
|
||||
auto children = pairLayer.second;
|
||||
for (auto& pairChild : children) {
|
||||
auto child = pairChild.second;
|
||||
child->Update(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Update(double dt) { }
|
||||
|
||||
void DrawLayered(RenderScene& rq)
|
||||
{
|
||||
if (this->Hidden())
|
||||
return;
|
||||
|
||||
// Draw ourselves
|
||||
this->Draw(rq);
|
||||
|
||||
// Draw children
|
||||
for (auto& pairLayer : m_Children) {
|
||||
auto children = pairLayer.second;
|
||||
for (auto& pairChild : children) {
|
||||
auto child = pairChild.second;
|
||||
if (child->Hidden())
|
||||
continue;
|
||||
child->Draw(rq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Draw(RenderScene& rq) { }
|
||||
|
||||
protected:
|
||||
::EventBroker* m_EventBroker;
|
||||
Frame* BaseFrame = nullptr;
|
||||
|
||||
std::string m_Name = "Unnamed";
|
||||
int m_Layer = 0;
|
||||
bool m_Hidden = false;
|
||||
|
||||
Frame* m_Parent = nullptr;
|
||||
typedef std::multimap<std::string, Frame*> Children_t; // name -> frame
|
||||
std::map<int, Children_t> m_Children; // layer -> Children_t
|
||||
|
||||
virtual bool OnKeyDown(const Events::KeyDown& event) { return false; }
|
||||
virtual bool OnKeyUp(const Events::KeyUp& event) { return false; }
|
||||
virtual bool OnCommand(const Events::InputCommand& event) { return false; }
|
||||
|
||||
private:
|
||||
EventRelay<Frame, Events::KeyDown> m_EKeyDown;
|
||||
EventRelay<Frame, Events::KeyUp> m_EKeyUp;
|
||||
EventRelay<Frame, Events::InputCommand> m_EInputCommand;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef MainMenuSystem_h__
|
||||
#define MainMenuSystem_h__
|
||||
|
||||
#include "../Core/System.h"
|
||||
#include "../Rendering/IRenderer.h"
|
||||
#include "../Core/ResourceManager.h"
|
||||
#include "../Core/Event.h"
|
||||
|
||||
|
||||
#include "EButtonClicked.h"
|
||||
#include "EButtonPressed.h"
|
||||
#include "EButtonReleased.h"
|
||||
|
||||
|
||||
class MainMenuSystem : public ImpureSystem
|
||||
{
|
||||
public:
|
||||
MainMenuSystem(SystemParams params, IRenderer* renderer);
|
||||
virtual void Update(double dt) override;
|
||||
|
||||
private:
|
||||
IRenderer* m_Renderer;
|
||||
|
||||
EventRelay<MainMenuSystem, Events::ButtonClicked> m_EClicked;
|
||||
bool OnButtonClick(const Events::ButtonClicked& e);
|
||||
EventRelay<MainMenuSystem, Events::ButtonReleased> m_EReleased;
|
||||
bool OnButtonRelease(const Events::ButtonReleased& e);
|
||||
EventRelay<MainMenuSystem, Events::ButtonPressed> m_EPressed;
|
||||
bool OnButtonPress(const Events::ButtonPressed& e);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,112 @@
|
||||
#ifndef GUI_TextureFrame_h__
|
||||
#define GUI_TextureFrame_h__
|
||||
|
||||
#include "Frame.h"
|
||||
#include "../Rendering/Texture.h"
|
||||
#include "../Rendering/Util/CommonFunctions.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
|
||||
class TextureFrame : public Frame
|
||||
{
|
||||
public:
|
||||
TextureFrame(Frame* parent, std::string name)
|
||||
: Frame(parent, name) { }
|
||||
|
||||
void EnableScissor() { m_ScissorEnabled = true; }
|
||||
void DisableScissor() { m_ScissorEnabled = false; }
|
||||
|
||||
void Draw(RenderScene& rq) override
|
||||
{
|
||||
if (m_Texture == nullptr)
|
||||
return;
|
||||
|
||||
// Texture while fading
|
||||
if (m_FadeTexture && m_CurrentFade < 1) {
|
||||
FrameJob job;
|
||||
job.Scissor = (m_ScissorEnabled) ? m_Parent->AbsoluteRectangle() : Rectangle();
|
||||
job.Viewport = Rectangle(Left(), Top(), Width, Height);
|
||||
job.TextureID = m_FadeTexture->ResourceID;
|
||||
job.DiffuseTexture = m_FadeTexture;
|
||||
job.Color = glm::vec4(m_Color.r, m_Color.g, m_Color.b, m_Color.a);
|
||||
job.Name = Name();
|
||||
rq.GUI.Add(job);
|
||||
}
|
||||
|
||||
// Main texture
|
||||
{
|
||||
FrameJob job;
|
||||
job.Scissor = (m_ScissorEnabled) ? m_Parent->AbsoluteRectangle() : Rectangle();
|
||||
job.Viewport = Rectangle(Left(), Top(), Width, Height);
|
||||
job.TextureID = m_Texture->ResourceID;
|
||||
job.DiffuseTexture = m_Texture;
|
||||
job.Color = glm::vec4(m_Color.r, m_Color.g, m_Color.b, m_Color.a * m_CurrentFade);
|
||||
job.Name = Name();
|
||||
rq.GUI.Add(job);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Texture() const { return m_TextureName; }
|
||||
|
||||
void SetTexture(std::string resourceName)
|
||||
{
|
||||
if (resourceName.empty()) {
|
||||
m_Texture = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Texture = CommonFunctions::LoadTexture(resourceName, false);
|
||||
m_TextureName = resourceName;
|
||||
if (m_Texture == nullptr) {
|
||||
m_Texture = CommonFunctions::LoadTexture("Textures/Core/ErrorTexture.png", false);
|
||||
}
|
||||
|
||||
SizeToTexture();
|
||||
}
|
||||
|
||||
void SizeToTexture()
|
||||
{
|
||||
if (m_Texture != nullptr) {
|
||||
this->Width = m_Texture->Width;
|
||||
this->Height = m_Texture->Height;
|
||||
}
|
||||
}
|
||||
|
||||
void FadeToTexture(std::string resourceName, double duration)
|
||||
{
|
||||
m_FadeTexture = m_Texture;
|
||||
SetTexture(resourceName);
|
||||
m_FadeDuration = duration;
|
||||
m_CurrentFade = 0.f;
|
||||
}
|
||||
|
||||
void Update(double dt) override
|
||||
{
|
||||
if (m_CurrentFade < 1) {
|
||||
m_CurrentFade += dt / m_FadeDuration;
|
||||
if (m_CurrentFade > 1) {
|
||||
m_FadeTexture = nullptr;
|
||||
m_CurrentFade = 1;
|
||||
m_FadeDuration = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec4 Color() const { return m_Color; }
|
||||
void SetColor(glm::vec4 val) { m_Color = val; }
|
||||
|
||||
protected:
|
||||
bool m_ScissorEnabled = true;
|
||||
Texture* m_Texture = nullptr;
|
||||
std::string m_TextureName;
|
||||
Texture* m_FadeTexture = nullptr;
|
||||
glm::vec4 m_Color = glm::vec4(1.f, 1.f, 1.f, 1.f);
|
||||
float m_FadeDuration = 0.f;
|
||||
float m_CurrentFade = 1.f;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,6 +16,8 @@ struct InputCommand : Event
|
||||
std::string Command;
|
||||
/** The value of the command. */
|
||||
float Value = 0;
|
||||
/** Timestamp of the command. */
|
||||
double TimeStamp = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
||||
}
|
||||
|
||||
//dashing with shift
|
||||
if (m_ShiftDashing && m_AssaultDashCoolDownTimer <= 0.0f) {
|
||||
if (m_ShiftDashing && m_AssaultDashCoolDownTimer <= 0.0f && !isJumping) {
|
||||
//player is dashing with shift
|
||||
//the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
|
||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||
@@ -227,7 +227,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
||||
}
|
||||
m_ValidDoubleTap = false;
|
||||
|
||||
if (!(m_AssaultDashCoolDownTimer <= 0.0f)) {
|
||||
if (!(m_AssaultDashCoolDownTimer <= 0.0f && !isJumping)) {
|
||||
//if we cant dash at the moment, then just reset the tap-sensitivity-timer
|
||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||
return;
|
||||
|
||||
@@ -33,8 +33,8 @@ public:
|
||||
~Client();
|
||||
|
||||
void Connect(std::string address, int port);
|
||||
void Update() override;
|
||||
|
||||
void Update(double dt) override;
|
||||
private:
|
||||
std::vector<Events::PlayerSpawned> m_PlayerSpawnEvents;
|
||||
void parseSpawnEvents();
|
||||
// Save for children
|
||||
@@ -56,13 +56,13 @@ public:
|
||||
bool m_IsConnected = false;
|
||||
EntityWrapper m_LocalPlayer = EntityWrapper::Invalid;
|
||||
// Server Client Lookup map
|
||||
// Assumes that root node for client and server is EntityID 0.
|
||||
|
||||
// Don't Add items to these two maps with insert, use insertIntoServerClientMaps(EntityID, EntityID)!!!!
|
||||
std::unordered_map<EntityID, EntityID> m_ServerIDToClientID;
|
||||
std::unordered_map<EntityID, EntityID> m_ClientIDToServerID;
|
||||
|
||||
// Network logic
|
||||
UDPClient m_Unreliable;
|
||||
TCPClient m_Reliable;
|
||||
PlayerDefinition m_PlayerDefinitions[8];
|
||||
SnapshotDefinitions m_NextSnapshot;
|
||||
double m_DurationOfPingTime;
|
||||
@@ -70,9 +70,9 @@ public:
|
||||
std::clock_t m_TimeSinceSentInputs;
|
||||
unsigned int m_SendInputIntervalMs;
|
||||
std::vector<Events::InputCommand> m_InputCommandBuffer;
|
||||
std::vector<Events::InputCommand> m_ReceivedInputCommands;
|
||||
|
||||
// Private member functions
|
||||
size_t receive(char* data);
|
||||
void disconnect();
|
||||
void parseMessageType(Packet& packet);
|
||||
void updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID);
|
||||
@@ -88,6 +88,8 @@ public:
|
||||
void parseComponentDeletion(Packet& packet);
|
||||
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
||||
void parseSnapshot(Packet& packet);
|
||||
void parseOnInputCommand(Packet& packet);
|
||||
void publishInputCommands();
|
||||
void identifyPacketLoss();
|
||||
void hasServerTimedOut();
|
||||
EntityID createPlayer();
|
||||
@@ -110,9 +112,6 @@ public:
|
||||
EventRelay<Client, Events::PlayerSpawned> m_EPlayerSpawned;
|
||||
bool OnPlayerSpawned(const Events::PlayerSpawned& e);
|
||||
void parsePlayerDamage(Packet& packet);
|
||||
private:
|
||||
UDPClient m_Unreliable;
|
||||
TCPClient m_Reliable;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,11 +22,13 @@ public:
|
||||
Network(World* world, EventBroker* eventBroker);
|
||||
virtual ~Network() { };
|
||||
|
||||
virtual void Update() = 0;
|
||||
virtual void Update(double dt) = 0;
|
||||
|
||||
protected:
|
||||
World* m_World;
|
||||
EventBroker* m_EventBroker;
|
||||
// for network
|
||||
double m_TimeStamp = 0;
|
||||
|
||||
// For Debug
|
||||
bool isReadingData = false;
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
Server(World* world, EventBroker* eventBroker, int port);
|
||||
~Server();
|
||||
|
||||
void Update() override;
|
||||
void Update(double dt) override;
|
||||
|
||||
private:
|
||||
// Network channels
|
||||
@@ -52,6 +52,7 @@ private:
|
||||
int checkTimeOutInterval = 100;
|
||||
int m_NextPlayerID = 0;
|
||||
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
||||
std::vector<Events::InputCommand> m_InputCommandsToPublish;
|
||||
//Timers
|
||||
std::clock_t m_StartPingTime;
|
||||
|
||||
@@ -82,6 +83,7 @@ private:
|
||||
void parseTCPConnect(Packet & packet);
|
||||
void parseDisconnect();
|
||||
bool shouldSendToClient(EntityWrapper childEntity);
|
||||
void publishInputCommands();
|
||||
|
||||
// Debug event
|
||||
EventRelay<Server, Events::InputCommand> m_EInputCommand;
|
||||
|
||||
@@ -24,8 +24,6 @@ public:
|
||||
|
||||
void Draw(GLuint texture);
|
||||
|
||||
void OnWindowResize();
|
||||
|
||||
//Getters
|
||||
//Return the blurred result of the texture that was sent into draw
|
||||
GLuint GaussianTexture() const { return m_GaussianTexture_vert; }
|
||||
|
||||
@@ -18,9 +18,8 @@ public:
|
||||
void InitializeTextures();
|
||||
void InitializeFrameBuffers();
|
||||
void InitializeShaderPrograms();
|
||||
void Draw(RenderScene& scene, GLuint SSAOTexture);
|
||||
void Draw(RenderScene& scene);
|
||||
void ClearBuffer();
|
||||
void OnWindowResize();
|
||||
|
||||
//Return the texture that is used in later stages to apply the bloom effect
|
||||
GLuint BloomTexture() const { return m_BloomTexture; }
|
||||
@@ -32,12 +31,13 @@ public:
|
||||
FrameBuffer* FinalPassFrameBuffer() { return &m_FinalPassFrameBuffer; }
|
||||
FrameBuffer* FinalPassFrameBufferLowRes() { return &m_FinalPassFrameBufferLowRes; }
|
||||
|
||||
|
||||
private:
|
||||
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
|
||||
void GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm::vec2 dimensions, GLint format, GLenum type, GLint numMipMaps) const;
|
||||
|
||||
void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene);
|
||||
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene, GLuint SSAOTexture);
|
||||
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||
void DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||
void DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||
void DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
|
||||
|
||||
@@ -21,7 +21,6 @@ public:
|
||||
void SetSSBOSizes();
|
||||
void CullLights(RenderScene& scene);
|
||||
void FillLightList(RenderScene& scene);
|
||||
void OnWindowResize();
|
||||
|
||||
GLuint FrustumSSBO() const { return m_FrustumSSBO; }
|
||||
GLuint LightSSBO() const { return m_LightSSBO; }
|
||||
|
||||
@@ -108,7 +108,6 @@ struct ModelJob : RenderJob
|
||||
EndIndex = matGroup->EndIndex;
|
||||
Matrix = matrix;
|
||||
Color = modelComponent["Color"];
|
||||
GlowIntensity = ((double)modelComponent["GlowIntensity"]);
|
||||
Entity = modelComponent.EntityID;
|
||||
glm::vec3 abspos = Transform::AbsolutePosition(world, modelComponent.EntityID);
|
||||
glm::vec3 worldpos = glm::vec3(camera->ViewMatrix() * glm::vec4(abspos, 1));
|
||||
@@ -171,7 +170,7 @@ struct ModelJob : RenderJob
|
||||
::Skeleton::AnimationOffset AnimationOffset;
|
||||
|
||||
|
||||
float GlowIntensity = 8.0;
|
||||
|
||||
glm::vec4 DiffuseColor;
|
||||
glm::vec4 SpecularColor;
|
||||
glm::vec4 IncandescenceColor;
|
||||
@@ -184,7 +183,7 @@ struct ModelJob : RenderJob
|
||||
|
||||
void CalculateHash() override
|
||||
{
|
||||
Hash = ShaderID << 20 + ModelID << 10 + TextureID;
|
||||
Hash = TextureID + ModelID << 10 + ShaderID << 20;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@ public:
|
||||
void Draw(RenderScene& scene);
|
||||
void ClearPicking();
|
||||
|
||||
void OnWindowResize();
|
||||
|
||||
//Getters
|
||||
const ShaderProgram& PickingProgram() const { return *m_PickingProgram; }
|
||||
//const std::unordered_map<glm::ivec2, EntityID>& PickingColorsToEntity() const { return m_PickingColorsToEntity; }
|
||||
@@ -42,7 +40,7 @@ private:
|
||||
const IRenderer* m_Renderer;
|
||||
|
||||
ShaderProgram* m_PickingProgram;
|
||||
ShaderProgram* m_PickingSkinnedProgram;
|
||||
ShaderProgram* m_PickingSkinnedProgram;
|
||||
Camera* m_Camera;
|
||||
|
||||
struct PickingInfo
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "DrawScreenQuadPass.h"
|
||||
#include "DrawBloomPass.h"
|
||||
#include "DrawColorCorrectionPass.h"
|
||||
#include "SSAOPass.h"
|
||||
#include "../Core/EventBroker.h"
|
||||
#include "ImGuiRenderPass.h"
|
||||
#include "Camera.h"
|
||||
@@ -24,12 +23,9 @@
|
||||
#include "imgui/imgui.h"
|
||||
#include "TextPass.h"
|
||||
#include "Util/CommonFunctions.h"
|
||||
#include "Core/PerformanceTimer.h"
|
||||
|
||||
class Renderer : public IRenderer
|
||||
{
|
||||
static void glfwFrameBufferCallback(GLFWwindow* window, int width, int height);
|
||||
|
||||
public:
|
||||
Renderer(EventBroker* eventBroker)
|
||||
: m_EventBroker(eventBroker)
|
||||
@@ -41,12 +37,8 @@ public:
|
||||
|
||||
virtual PickData Pick(glm::vec2 screenCoord) override;
|
||||
|
||||
|
||||
private:
|
||||
//----------------------Variables----------------------//
|
||||
|
||||
static std::unordered_map <GLFWwindow*, Renderer*> m_WindowToRenderer;
|
||||
|
||||
EventBroker* m_EventBroker;
|
||||
TextPass* m_TextPass;
|
||||
|
||||
@@ -58,13 +50,6 @@ private:
|
||||
Model* m_UnitSphere;
|
||||
|
||||
int m_DebugTextureToDraw = 0;
|
||||
bool m_ResizeWindow = false;
|
||||
float m_SSAO_Radius = 1.0f;
|
||||
float m_SSAO_Bias = 0.05f;
|
||||
float m_SSAO_Contrast = 1.5f;
|
||||
float m_SSAO_IntensityScale = 1.0f;
|
||||
int m_SSAO_NumOfSamples = 24;
|
||||
int m_SSAO_NumOfTurns = 7;
|
||||
|
||||
PickingPass* m_PickingPass;
|
||||
LightCullingPass* m_LightCullingPass;
|
||||
@@ -73,7 +58,6 @@ private:
|
||||
DrawScreenQuadPass* m_DrawScreenQuadPass;
|
||||
DrawBloomPass* m_DrawBloomPass;
|
||||
DrawColorCorrectionPass* m_DrawColorCorrectionPass;
|
||||
SSAOPass* m_SSAOPass;
|
||||
|
||||
//----------------------Functions----------------------//
|
||||
void InitializeWindow();
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#ifndef SSAOPass_h__
|
||||
#define SSAOPass_h__
|
||||
|
||||
#include "IRenderer.h"
|
||||
#include "SSAOPassState.h"
|
||||
//#include "LightCullingPass.h" Finalpass om den skall skickas in
|
||||
#include "FrameBuffer.h"
|
||||
#include "ShaderProgram.h"
|
||||
#include "DrawBloomPass.h"
|
||||
//#include "Util/UnorderedMapVec2.h"
|
||||
#include "Texture.h"
|
||||
|
||||
class SSAOPass
|
||||
{
|
||||
public:
|
||||
SSAOPass(IRenderer* rendere);
|
||||
~SSAOPass() { };
|
||||
|
||||
void Draw(GLuint depthBuffer, Camera* camera);
|
||||
void Setting(float radius, float bias, float contrast, float intensityScale, int numOfSamples, int NumOfTurns);
|
||||
void ClearBuffer();
|
||||
|
||||
//Return the SSAO of the texture sent to Draw
|
||||
GLuint SSAOTexture() const { return m_DrawBloomPass->GaussianTexture(); }
|
||||
|
||||
private:
|
||||
void InitializeTexture();
|
||||
void InitializeFrameBuffer();
|
||||
void InitializeShaderProgram();
|
||||
void InitializeBuffer();
|
||||
|
||||
void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const;
|
||||
|
||||
void ComputeAO(GLuint depthBuffer, Camera* camera);
|
||||
//void blurHorizontal(GLuint depthBuffer);
|
||||
//void blurVertical(GLuint depthBuffer);
|
||||
|
||||
Model* m_ScreenQuad;
|
||||
|
||||
const IRenderer* m_Renderer;
|
||||
|
||||
float m_Radius;
|
||||
float m_Bias;
|
||||
float m_Contrast;
|
||||
float m_IntensityScale;
|
||||
int m_NumOfSamples;
|
||||
int m_NumOfTurns;
|
||||
|
||||
GLuint m_SSAOTexture;
|
||||
FrameBuffer m_SSAOFramBuffer;
|
||||
|
||||
GLuint m_SSAOViewSpaceZTexture;
|
||||
FrameBuffer m_SSAOViewSpaceZFramBuffer;
|
||||
|
||||
ShaderProgram* m_SSAOProgram;
|
||||
ShaderProgram* m_SSAOViewSpaceZProgram;
|
||||
|
||||
DrawBloomPass* m_DrawBloomPass;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef SSAOPassState_h__
|
||||
#define SSAOPassState_h__
|
||||
|
||||
#include "Rendering/RenderState.h"
|
||||
|
||||
class SSAOPassState : public RenderState
|
||||
{
|
||||
public:
|
||||
SSAOPassState();
|
||||
~SSAOPassState();
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
struct SpriteJob : RenderJob
|
||||
{
|
||||
SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted, bool isIndicator)
|
||||
SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted)
|
||||
: RenderJob()
|
||||
{
|
||||
Model = ResourceManager::Load<::Model>("Models/Core/UnitQuad.mesh");
|
||||
@@ -30,7 +30,7 @@ struct SpriteJob : RenderJob
|
||||
|
||||
StartIndex = matProp.material->StartIndex;
|
||||
EndIndex = matProp.material->EndIndex;
|
||||
Matrix = matrix;
|
||||
Matrix = matrix;
|
||||
Color = cSprite["Color"];
|
||||
Entity = cSprite.EntityID;
|
||||
Position = Transform::AbsolutePosition(world, cSprite.EntityID);
|
||||
@@ -40,8 +40,6 @@ struct SpriteJob : RenderJob
|
||||
Depth = viewpos.z;
|
||||
}
|
||||
World = world;
|
||||
Pickable = world->HasComponent(cSprite.EntityID, "Button");
|
||||
IsIndicator = isIndicator;
|
||||
|
||||
FillColor = fillColor;
|
||||
FillPercentage = fillPercentage;
|
||||
@@ -63,9 +61,6 @@ struct SpriteJob : RenderJob
|
||||
unsigned int EndIndex = 0;
|
||||
World* World;
|
||||
|
||||
bool Pickable;
|
||||
bool IsIndicator = false;
|
||||
|
||||
glm::vec4 FillColor = glm::vec4(0);
|
||||
float FillPercentage = 0.0;
|
||||
|
||||
|
||||
+2
-3
@@ -8,6 +8,7 @@
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Rendering/Renderer.h"
|
||||
#include "Core/InputManager.h"
|
||||
#include "GUI/Frame.h"
|
||||
#include "Core/World.h"
|
||||
#include "Input/InputProxy.h"
|
||||
#include "Input/KeyboardInputHandler.h"
|
||||
@@ -34,9 +35,6 @@
|
||||
#include "Sound/SoundManager.h"
|
||||
#include "Systems/SoundSystem.h"
|
||||
|
||||
//Performance
|
||||
#include "Core/PerformanceTimer.h"
|
||||
|
||||
class Game
|
||||
{
|
||||
public:
|
||||
@@ -55,6 +53,7 @@ private:
|
||||
IRenderer* m_Renderer;
|
||||
InputManager* m_InputManager;
|
||||
InputProxy* m_InputProxy;
|
||||
GUI::Frame* m_FrameStack;
|
||||
World* m_World;
|
||||
Octree<EntityAABB>* m_OctreeCollision;
|
||||
Octree<EntityAABB>* m_OctreeTrigger;
|
||||
|
||||
@@ -27,16 +27,17 @@ public:
|
||||
private:
|
||||
bool m_NetworkEnabled;
|
||||
|
||||
// methods which will take care of specific events
|
||||
//methods which will take care of specific events
|
||||
EventRelay<HealthSystem, Events::PlayerDamage> m_EPlayerDamage;
|
||||
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e);
|
||||
EventRelay<HealthSystem, Events::PlayerHealthPickup> m_EPlayerHealthPickup;
|
||||
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
|
||||
std::vector<std::tuple<EntityID, double>> m_DeltaHealthVector;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -39,5 +39,5 @@ private:
|
||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||
|
||||
void updateMovementControllers(double dt);
|
||||
void updateVelocity(double dt);
|
||||
void updateVelocity(EntityWrapper player, double dt);
|
||||
};
|
||||
@@ -15,16 +15,11 @@ class SpawnerSystem : public System
|
||||
public:
|
||||
SpawnerSystem(SystemParams params);
|
||||
|
||||
// If dontCollideComponent is set, to e.g. "Player", then all the spawner
|
||||
// will try to pick a spawn location so that the spawned entity doesn't
|
||||
// collide with anything that has that component and is collidable.
|
||||
static EntityWrapper Spawn(EntityWrapper spawner, EntityWrapper parent = EntityWrapper::Invalid, const std::string& dontCollideComponent = "");
|
||||
static EntityWrapper Spawn(EntityWrapper spawner, EntityWrapper parent = EntityWrapper::Invalid);
|
||||
|
||||
private:
|
||||
EventRelay<SpawnerSystem, Events::SpawnerSpawn> m_OnSpawnerSpawn;
|
||||
bool OnSpawnerSpawn(Events::SpawnerSpawn& e);
|
||||
static void transformEntityToSpawnPoint(EntityWrapper spawnedEntity, EntityWrapper spawnPoint);
|
||||
static bool spawnedEntityIsColliding(EntityWrapper spawnedEntity, EntityWrapper spawnPoint, const std::string& dontCollideComponent);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -25,6 +25,4 @@ C=ConnectToServer
|
||||
N=SwitchToServer
|
||||
M=SwitchToClient
|
||||
P=SwitchToPlayer
|
||||
K=TakeDamage,1500
|
||||
F2=PerformanceTimingResetAllTimers
|
||||
F3=PerformanceTimingCreateExcelData
|
||||
K=TakeDamage,1500
|
||||
@@ -41,9 +41,5 @@
|
||||
<xs:include schemaLocation="Components/Shielded.xsd"/>
|
||||
<xs:include schemaLocation="Components/CapturePointHUD.xsd"/>
|
||||
<xs:include schemaLocation="Components/AmmunitionHUD.xsd"/>
|
||||
<xs:include schemaLocation="Components/Menu.xsd"/>
|
||||
<xs:include schemaLocation="Components/KillFeed.xsd"/>
|
||||
<xs:include schemaLocation="Components/Page.xsd"/>
|
||||
<xs:include schemaLocation="Components/SpriteIndicator.xsd"/>
|
||||
<xs:include schemaLocation="Components/Button.xsd"/>
|
||||
</xs:schema>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Button xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Button.xsd">
|
||||
</Button>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||
|
||||
<xs:element name="Button">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Makes sprites klickable.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Menu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Menu.xsd">
|
||||
</Menu>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||
<xs:element name="Menu">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Attach this to the center point of a menu that uses several pages.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -8,5 +8,4 @@
|
||||
<NormalMap>true</NormalMap>
|
||||
<SpecularMap>true</SpecularMap>
|
||||
<GlowMap>true</GlowMap>
|
||||
<GlowIntensity>3.0</GlowIntensity>
|
||||
</Model>
|
||||
@@ -33,9 +33,6 @@
|
||||
<xs:element name="GlowMap" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Whether the model should use the Glowmap or not</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="GlowIntensity" type="t:double" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Intensity of the glow map</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Page.xsd">
|
||||
<ID>0</ID>
|
||||
</Page>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||
<xs:element name="Page">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Use this on a child to a Menu entity and make sure that ID is not the same as other pages.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="ID" type="t:int" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -2,7 +2,6 @@
|
||||
<Physics xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Physics.xsd">
|
||||
<Velocity X="0" Y="0" Z="0"/>
|
||||
<Gravity>true</Gravity>
|
||||
<PrevOrigin X="-9876.5" Y="-9876.5" Z="-9876.5"/>
|
||||
<IsOnGround>false</IsOnGround>
|
||||
<VerticalStepHeight>0.33</VerticalStepHeight>
|
||||
</Physics>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
<xs:annotation><xs:documentation>m/s^2</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="Gravity" type="t:bool" minOccurs="0"/>
|
||||
<xs:element name="PrevOrigin" type="t:Vector" minOccurs="0"/>
|
||||
<xs:element name="IsOnGround" type="t:bool" minOccurs="0"/>
|
||||
<xs:element name="VerticalStepHeight" type="t:double" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>The largest height of a "stair-step" that can be walked over</xs:documentation></xs:annotation>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<SpriteIndicator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SpriteIndicator.xsd">
|
||||
<MinScale>10</MinScale>
|
||||
<VisibleForSingleTeamOnly>false</VisibleForSingleTeamOnly>
|
||||
</SpriteIndicator>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||
|
||||
<xs:element name="SpriteIndicator">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Billbord a Sprite around global Y axis</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="MinScale" type="t:double" minOccurs="0"/>
|
||||
<xs:element name="VisibleForSingleTeamOnly" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Add a Team component to this Entity or Parent to make it visible only for that team</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -5,15 +5,10 @@
|
||||
<c:AABB/>
|
||||
<c:AmmoPickup/>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/PickUps/AmmoPickUp.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:RaptorCopter>
|
||||
<Speed>0.1</Speed>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1" Z="0"/>
|
||||
<Scale X="0.3" Y="0.3" Z="0.3"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="Button" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.375197947" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Play</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -144,7 +144,7 @@
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="57.7363472" Y="4.98900032" Z="79.5"/>
|
||||
<Position X="57.7363472" Y="2.38900018" Z="79.5"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -206,16 +206,14 @@
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="-60.2567062" Y="9.40000057" Z="-78.1000061"/>
|
||||
<Position X="-60.2567062" Y="3.4000001" Z="-78.1000061"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:SpawnPoint/>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="2.10000014" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
|
||||
@@ -5,15 +5,10 @@
|
||||
<c:AABB/>
|
||||
<c:HealthPickup/>
|
||||
<c:Model>
|
||||
<Resource>Models/Props/PickUps/HealthPickUp.mesh</Resource>
|
||||
<Resource>Models/Core/UnitSphere.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:RaptorCopter>
|
||||
<Speed>0.1</Speed>
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1" Z="0"/>
|
||||
<Scale X="0.3" Y="0.3" Z="0.3"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
|
||||
@@ -5019,7 +5019,7 @@
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="-60.3695679" Y="5.64500046" Z="-79.3789597"/>
|
||||
<Position X="-60.3695679" Y="2.14482641" Z="-79.3789597"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -5089,7 +5089,7 @@
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:Transform>
|
||||
<Position X="60.0169258" Y="5.78000021" Z="76.2893906"/>
|
||||
<Position X="60.0169258" Y="2.37972379" Z="76.2893906"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -5165,7 +5165,7 @@
|
||||
<c:Transform>
|
||||
<Position X="48.9189453" Y="7.06223536" Z="-78.9347992"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
<Orientation X="0" Y="75.6124268" Z="0"/>
|
||||
<Orientation X="0" Y="71.4059677" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
@@ -5184,7 +5184,7 @@
|
||||
<c:Transform>
|
||||
<Position X="-59.3499641" Y="7.46932745" Z="-20.6276321"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
<Orientation X="0" Y="72.2667694" Z="0"/>
|
||||
<Orientation X="0" Y="68.0603104" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
@@ -5203,7 +5203,7 @@
|
||||
<c:Transform>
|
||||
<Position X="-1.13644195" Y="1.38919806" Z="38.9768829"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
<Orientation X="0" Y="69.8748016" Z="0"/>
|
||||
<Orientation X="0" Y="65.6683426" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
@@ -5222,7 +5222,7 @@
|
||||
<c:Transform>
|
||||
<Position X="54.7225227" Y="6.51863909" Z="29.0052128"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
<Orientation X="0" Y="70.1887283" Z="0"/>
|
||||
<Orientation X="0" Y="65.9822693" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
@@ -5241,7 +5241,7 @@
|
||||
<c:Transform>
|
||||
<Position X="-51.6792374" Y="8.44526482" Z="32.5153465"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
<Orientation X="0" Y="69.6374512" Z="0"/>
|
||||
<Orientation X="0" Y="65.4309921" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
@@ -5260,7 +5260,7 @@
|
||||
<c:Transform>
|
||||
<Position X="-42.3974304" Y="7.28327894" Z="81.9305344"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
<Orientation X="0" Y="67.7666702" Z="0"/>
|
||||
<Orientation X="0" Y="63.560215" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
@@ -5279,7 +5279,7 @@
|
||||
<c:Transform>
|
||||
<Position X="-9.85184956" Y="8.25567532" Z="39.6119232"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
<Orientation X="0" Y="66.8154602" Z="0"/>
|
||||
<Orientation X="0" Y="62.6090584" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
@@ -5298,7 +5298,7 @@
|
||||
<c:Transform>
|
||||
<Position X="49.2257118" Y="7.39368248" Z="-31.1810112"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
<Orientation X="0" Y="64.0265808" Z="0"/>
|
||||
<Orientation X="0" Y="59.8201942" Z="0"/>
|
||||
</c:Transform>
|
||||
<c:Trigger/>
|
||||
</Components>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
<c:DashAbility/>
|
||||
<c:Health/>
|
||||
<c:Physics>
|
||||
<PrevOrigin X="0" Y="0.772000015" Z="0"/>
|
||||
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||
</c:Physics>
|
||||
<c:Player>
|
||||
@@ -61,7 +60,6 @@
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
||||
<DepthSort>false</DepthSort>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.200000003"/>
|
||||
@@ -112,7 +110,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:HealthHUD/>
|
||||
@@ -138,7 +135,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -156,7 +152,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -172,7 +167,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -191,7 +185,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -207,7 +200,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -225,7 +217,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -241,7 +232,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -259,7 +249,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -275,7 +264,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -291,7 +279,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -317,7 +304,6 @@
|
||||
<Entity name="KillFeed1">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content></Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Right/>
|
||||
@@ -330,7 +316,6 @@
|
||||
<Entity name="KillFeed2">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content></Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Right/>
|
||||
@@ -345,7 +330,6 @@
|
||||
<Entity name="KillFeed3">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content></Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Right/>
|
||||
@@ -365,14 +349,13 @@
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName1>Idle</AnimationName1>
|
||||
<Time1>0.97725610639912475</Time1>
|
||||
<Time1>1.6050530664521858</Time1>
|
||||
<Speed1>1</Speed1>
|
||||
<AnimationName2></AnimationName2>
|
||||
<AnimationName3></AnimationName3>
|
||||
</c:Animation>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.309803933" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -384,10 +367,11 @@
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.12043038" Y="-0.244988307" Z="-0.181454808"/>
|
||||
<Orientation X="0.010404544" Y="-0.00268173823" Z="0.0428441577"/>
|
||||
<Position X="0.12043035" Y="-0.234149337" Z="-0.181454644"/>
|
||||
<Orientation X="0.0104045281" Y="-0.00268131681" Z="0.0428438708"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -424,7 +408,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -494,10 +477,8 @@
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName1>Idle</AnimationName1>
|
||||
<Time1>0.87583812735846323</Time1>
|
||||
<Time1>1.620305457513453</Time1>
|
||||
<Speed1>1</Speed1>
|
||||
<AnimationName2></AnimationName2>
|
||||
<AnimationName3></AnimationName3>
|
||||
</c:Animation>
|
||||
<c:AnimationOffset>
|
||||
<AnimationName>AimRifle</AnimationName>
|
||||
@@ -520,8 +501,8 @@
|
||||
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.163429111" Y="1.0235405" Z="-0.215489209"/>
|
||||
<Orientation X="-0.0631071255" Y="-0.0576644838" Z="0.118255548"/>
|
||||
<Position X="0.160351232" Y="1.02591991" Z="-0.215102971"/>
|
||||
<Orientation X="-0.0627480298" Y="-0.0432248674" Z="0.119431816"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -591,26 +572,6 @@
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="Indicator">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Icons/Arrow.png</DiffuseTexture>
|
||||
<DepthSort>false</DepthSort>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="1" B="1" G="0.309803933" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:HiddenForLocalPlayer/>
|
||||
<c:SpriteIndicator>
|
||||
<MinScale>50</MinScale>
|
||||
<VisibleForSingleTeamOnly>true</VisibleForSingleTeamOnly>
|
||||
</c:SpriteIndicator>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.84019077" Z="0"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
<c:DashAbility/>
|
||||
<c:Health/>
|
||||
<c:Physics>
|
||||
<PrevOrigin X="0" Y="0.772000015" Z="0"/>
|
||||
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||
</c:Physics>
|
||||
<c:Player>
|
||||
@@ -61,7 +60,6 @@
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Weapons/Crosshair/SmallThickHoleDot.png</DiffuseTexture>
|
||||
<DepthSort>false</DepthSort>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.200000003"/>
|
||||
@@ -112,7 +110,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/HealthHUD3.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:HealthHUD/>
|
||||
@@ -138,7 +135,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -156,7 +152,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -172,7 +167,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -191,7 +185,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -207,7 +200,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -225,7 +217,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -241,7 +232,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -259,7 +249,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -275,7 +264,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -291,7 +279,6 @@
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||
@@ -317,7 +304,6 @@
|
||||
<Entity name="KillFeed1">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content></Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Right/>
|
||||
@@ -330,7 +316,6 @@
|
||||
<Entity name="KillFeed2">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content></Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Right/>
|
||||
@@ -345,7 +330,6 @@
|
||||
<Entity name="KillFeed3">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content></Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Right/>
|
||||
@@ -365,14 +349,13 @@
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName1>Idle</AnimationName1>
|
||||
<Time1>1.2667383999985162</Time1>
|
||||
<Time1>1.6050530664521858</Time1>
|
||||
<Speed1>1</Speed1>
|
||||
<AnimationName2></AnimationName2>
|
||||
<AnimationName3></AnimationName3>
|
||||
</c:Animation>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/FirstPerson.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
@@ -384,10 +367,11 @@
|
||||
</c:BoneAttachment>
|
||||
<c:Model>
|
||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.120430425" Y="-0.242105931" Z="-0.181454822"/>
|
||||
<Orientation X="0.010404665" Y="-0.00268179877" Z="0.0428443067"/>
|
||||
<Position X="0.12043035" Y="-0.234149337" Z="-0.181454644"/>
|
||||
<Orientation X="0.0104045281" Y="-0.00268131681" Z="0.0428438708"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -424,7 +408,6 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="0.588235319" B="0" G="0" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
@@ -494,10 +477,8 @@
|
||||
<Components>
|
||||
<c:Animation>
|
||||
<AnimationName1>Idle</AnimationName1>
|
||||
<Time1>0.26532318661337229</Time1>
|
||||
<Time1>1.620305457513453</Time1>
|
||||
<Speed1>1</Speed1>
|
||||
<AnimationName2></AnimationName2>
|
||||
<AnimationName3></AnimationName3>
|
||||
</c:Animation>
|
||||
<c:AnimationOffset>
|
||||
<AnimationName>AimRifle</AnimationName>
|
||||
@@ -520,8 +501,8 @@
|
||||
<Resource>Models/Weapons/Red/AssaultWeaponRed.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0.159282878" Y="1.0300566" Z="-0.216084003"/>
|
||||
<Orientation X="-0.0626799241" Y="-0.0390551724" Z="0.119761385"/>
|
||||
<Position X="0.160351232" Y="1.02591991" Z="-0.215102971"/>
|
||||
<Orientation X="-0.0627480298" Y="-0.0432248674" Z="0.119431816"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -591,26 +572,6 @@
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity>
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Icons/Arrow.png</DiffuseTexture>
|
||||
<DepthSort>false</DepthSort>
|
||||
<GlowMap></GlowMap>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:HiddenForLocalPlayer/>
|
||||
<c:SpriteIndicator>
|
||||
<MinScale>50</MinScale>
|
||||
<VisibleForSingleTeamOnly>true</VisibleForSingleTeamOnly>
|
||||
</c:SpriteIndicator>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="1.84000003" Z="0"/>
|
||||
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="8433.37305" Z="0"/>
|
||||
<Orientation X="0" Y="7364.79053" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -77,6 +77,18 @@
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="ListenerText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Sound Test</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="3.31600022" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="DirectionalLight">
|
||||
@@ -93,7 +105,7 @@
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Position X="2.1529963" Y="6.59221172" Z="0.169116676"/>
|
||||
<Orientation X="4.16300011" Y="18271.9141" Z="0"/>
|
||||
<Orientation X="4.16300011" Y="17199.7988" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
@@ -168,7 +180,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="2553.63574" Z="0"/>
|
||||
<Orientation X="0" Y="2019.28589" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -213,7 +225,7 @@
|
||||
<Axis X="1" Y="1" Z="1"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="16862.3945" Y="16862.3945" Z="16862.3945"/>
|
||||
<Orientation X="15792.2051" Y="15792.2051" Z="15792.2051"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -277,7 +289,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="16658.3906" Z="0"/>
|
||||
<Orientation X="0" Y="15589.2383" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -309,7 +321,7 @@
|
||||
<Axis X="0.699999988" Y="1" Z="0.300000012"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="12206.665" Y="17385.8008" Z="5202.3335"/>
|
||||
<Orientation X="11456.2695" Y="16313.6973" Z="4881.66504"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -659,7 +671,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="851.386902" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -706,7 +718,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="851.386902" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -766,7 +778,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="851.386902" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -813,7 +825,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="851.386902" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -859,7 +871,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="851.386902" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -906,7 +918,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="851.386902" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -953,7 +965,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="851.386902" Z="0"/>
|
||||
<Orientation X="0" Y="316.505432" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1015,7 +1027,7 @@
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="0.300000012" B="0" G="0" R="1"/>
|
||||
<Color A="0.300000012" B="0" G="0.200000003" R="1"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -1065,7 +1077,7 @@
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
<Color A="0.300000012" B="0" G="1" R="1"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
@@ -1155,7 +1167,7 @@
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||
<Color A="0.300000012" B="1" G="1" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Team/>
|
||||
@@ -1205,7 +1217,7 @@
|
||||
</c:CapturePoint>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="0.300000012" B="1" G="0" R="0"/>
|
||||
<Color A="0.300000012" B="1" G="0.200000003" R="0"/>
|
||||
<Transparent>true</Transparent>
|
||||
</c:Model>
|
||||
<c:Team>
|
||||
@@ -1367,7 +1379,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1385.11243" Z="0"/>
|
||||
<Orientation X="0" Y="850.207886" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1376,7 +1388,7 @@
|
||||
<c:ExplosionEffect>
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="0.800000012" Y="0.0379999988" Z="0"/>
|
||||
<TimeSinceDeath>0.8256214817261025</TimeSinceDeath>
|
||||
<TimeSinceDeath>0.75205058136495551</TimeSinceDeath>
|
||||
<ExplosionDuration>3.7999999523162842</ExplosionDuration>
|
||||
<EndColor A="0" B="23.5294113" G="11.7647057" R="0"/>
|
||||
<Randomness>true</Randomness>
|
||||
@@ -1423,7 +1435,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1385.11243" Z="0"/>
|
||||
<Orientation X="0" Y="850.207886" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1432,7 +1444,7 @@
|
||||
<c:ExplosionEffect>
|
||||
<Velocity X="0.5" Y="1" Z="0"/>
|
||||
<ExplosionOrigin X="0" Y="0.900000036" Z="0"/>
|
||||
<TimeSinceDeath>1.8641349174045843</TimeSinceDeath>
|
||||
<TimeSinceDeath>1.2019563319790627</TimeSinceDeath>
|
||||
</c:ExplosionEffect>
|
||||
<c:Model>
|
||||
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
|
||||
@@ -1475,7 +1487,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1385.11243" Z="0"/>
|
||||
<Orientation X="0" Y="850.207886" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1486,7 +1498,7 @@
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="0.300000012" Y="2" Z="0"/>
|
||||
<ExplosionOrigin X="0" Y="1.30000007" Z="-0.200000003"/>
|
||||
<TimeSinceDeath>1.8641349174045843</TimeSinceDeath>
|
||||
<TimeSinceDeath>0.68540211563899389</TimeSinceDeath>
|
||||
<EndColor A="0" B="0.333333343" G="0.933333337" R="3.92156863"/>
|
||||
<Randomness>true</Randomness>
|
||||
</c:ExplosionEffect>
|
||||
@@ -1531,7 +1543,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="1392.89258" Z="0"/>
|
||||
<Orientation X="0" Y="857.984314" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1541,7 +1553,7 @@
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="0" Y="0.699999988" Z="0"/>
|
||||
<ExplosionOrigin X="0" Y="-1.10000002" Z="0"/>
|
||||
<TimeSinceDeath>1.2301962937648341</TimeSinceDeath>
|
||||
<TimeSinceDeath>0.95150063648635763</TimeSinceDeath>
|
||||
<ExplosionDuration>10</ExplosionDuration>
|
||||
<EndColor A="1" B="0" G="0" R="1"/>
|
||||
<RandomnessScalar>3</RandomnessScalar>
|
||||
@@ -1589,7 +1601,7 @@
|
||||
<Axis X="0" Y="1" Z="0"/>
|
||||
</c:RaptorCopter>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="991.007263" Z="0"/>
|
||||
<Orientation X="0" Y="456.136078" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
@@ -1599,7 +1611,7 @@
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="6" Y="0.100000001" Z="0"/>
|
||||
<ExplosionOrigin X="0" Y="-10" Z="0"/>
|
||||
<TimeSinceDeath>3.4214855659573402</TimeSinceDeath>
|
||||
<TimeSinceDeath>1.3515288978624223</TimeSinceDeath>
|
||||
<ExponentialAccelaration>true</ExponentialAccelaration>
|
||||
<ExplosionDuration>5</ExplosionDuration>
|
||||
<Randomness>true</Randomness>
|
||||
@@ -1666,10 +1678,10 @@
|
||||
</Entity>
|
||||
<Entity name="ShieldedCube">
|
||||
<Components>
|
||||
<c:Shielded/>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Shielded/>
|
||||
<c:Transform>
|
||||
<Position X="-3.34650159" Y="1.19966424" Z="3.09996605"/>
|
||||
</c:Transform>
|
||||
@@ -1780,7 +1792,7 @@
|
||||
<c:ExplosionEffect>
|
||||
<ColorByDistance>true</ColorByDistance>
|
||||
<Velocity X="0.800000012" Y="0.0379999988" Z="0"/>
|
||||
<TimeSinceDeath>0.8256214817261025</TimeSinceDeath>
|
||||
<TimeSinceDeath>1.3682019578975679</TimeSinceDeath>
|
||||
<ExplosionDuration>3.7999999523162842</ExplosionDuration>
|
||||
<EndColor A="0" B="23.5294113" G="11.7647057" R="0"/>
|
||||
<Randomness>true</Randomness>
|
||||
@@ -1824,12 +1836,12 @@
|
||||
<Entity name="PlayerModel">
|
||||
<Components>
|
||||
<c:Animation/>
|
||||
<c:Shielded/>
|
||||
<c:HiddenForLocalPlayer/>
|
||||
<c:Model>
|
||||
<Resource>Models/AssaultAnimated.mesh</Resource>
|
||||
<Color A="1" B="0" G="0" R="1"/>
|
||||
</c:Model>
|
||||
<c:Shielded/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
@@ -2083,7 +2095,7 @@
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||
<Color A="0.699999988" B="0" G="0" R="1"/>
|
||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
||||
@@ -2095,7 +2107,7 @@
|
||||
<c:CapturePointHUD/>
|
||||
<c:Fill>
|
||||
<Percentage>1</Percentage>
|
||||
<Color A="0.699999988" B="0" G="0" R="1"/>
|
||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
||||
</c:Fill>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||
@@ -2133,355 +2145,6 @@
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="MenuOirign">
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="-23.0533829" Y="0.938369572" Z="14.068408"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Camera">
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Model>
|
||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||
<Visible>false</Visible>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="MenuCenterPoint">
|
||||
<Components>
|
||||
<c:Menu/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Page0">
|
||||
<Components>
|
||||
<c:Page/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="MenuBackground">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/ErrorTexture.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="-1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Play">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.388422519" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Play</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Host">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.214031488" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Host</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Connecting">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0367300175" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Connect</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Settings">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.148274168" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Settings</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Quit">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.335298717" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Quit</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Page1">
|
||||
<Components>
|
||||
<c:Page>
|
||||
<ID>1</ID>
|
||||
</c:Page>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="0.989000022" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="MenuBackground">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/ErrorTexture.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="-1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Res1080">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.375197947" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>1920x1080</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Res720">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.199327558" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>1280x720</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Res480">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0159880854" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>854x480</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="FullScreen">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.164955258" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>FullScreen</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Menu test area</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="4.22317314" Z="0"/>
|
||||
<Orientation X="0" Y="1.68700004" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="ListenerText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Sound Test</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="3.31600022" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
|
||||
@@ -1,299 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="MenuOirign" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="-23.0533829" Y="0.938369572" Z="14.068408"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
|
||||
<Children>
|
||||
<Entity name="Camera">
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:Model>
|
||||
<Resource>Models/Widgets/Camera.mesh</Resource>
|
||||
</c:Model>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="MenuCenterPoint">
|
||||
<Components>
|
||||
<c:Menu/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Page0">
|
||||
<Components>
|
||||
<c:Page/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="MenuBackground">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/ErrorTexture.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="-1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Button">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.388422519" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Play</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Button">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.214031488" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Host</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Button">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0367300175" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Connect</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Button">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.148274168" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Settings</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Button">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.335298717" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Quit</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Page1">
|
||||
<Components>
|
||||
<c:Page>
|
||||
<ID>1</ID>
|
||||
</c:Page>
|
||||
<c:Transform>
|
||||
<Orientation X="0" Y="0.989000022" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="MenuBackground">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/ErrorTexture.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="-1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Button">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.375197947" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Resolution</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Button">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.199327558" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Option2</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Button">
|
||||
<Components>
|
||||
<c:Button/>
|
||||
<c:Sprite>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.0159880854" Z="0.0627754927"/>
|
||||
<Scale X="0.600000024" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Text">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Butts</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Color A="1" B="1" G="0.847058833" R="0"/>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-0.00710564246" Y="-0.203304529" Z="0.00999999978"/>
|
||||
<Scale X="0.300000012" Y="0.699999988" Z="4.30000019"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
@@ -47,9 +47,6 @@
|
||||
<xs:element ref="c:KillFeed" minOccurs="0"/>
|
||||
<xs:element ref="c:Sprite" minOccurs="0"/>
|
||||
<xs:element ref="c:AnimationOffset" minOccurs="0"/>
|
||||
<xs:element ref="c:Menu" minOccurs="0"/>
|
||||
<xs:element ref="c:Page" minOccurs="0"/>
|
||||
<xs:element ref="c:Button" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
@@ -19,8 +19,6 @@ void main()
|
||||
vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate);
|
||||
vec4 hdrColorLowRes = texture(SceneTextureLowRes, Input.TextureCoordinate);
|
||||
vec4 bloomColorLowRes = texture(BloomTextureLowRes, Input.TextureCoordinate);
|
||||
|
||||
//hdrColor = hdrColor * SSAO;
|
||||
hdrColor += bloomColor;
|
||||
hdrColorLowRes;
|
||||
|
||||
@@ -35,6 +33,7 @@ void main()
|
||||
|
||||
//gamme correction
|
||||
result = pow(result, vec3(1.0 / Gamma));
|
||||
|
||||
fragmentColor = vec4(result, 1.0);
|
||||
//fragmentColor = hdrColor;
|
||||
//fragmentColor = bloomColor;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#version 430
|
||||
|
||||
#define MIN_AMBIENT_LIGHT 0.3
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
@@ -11,17 +9,15 @@ uniform vec2 ScreenDimensions;
|
||||
uniform vec4 FillColor;
|
||||
uniform vec4 AmbientColor;
|
||||
uniform float FillPercentage;
|
||||
uniform float GlowIntensity = 10;
|
||||
|
||||
uniform vec2 DiffuseUVRepeat;
|
||||
uniform vec2 NormalUVRepeat;
|
||||
uniform vec2 SpecularUVRepeat;
|
||||
uniform vec2 GlowUVRepeat;
|
||||
layout (binding = 0) uniform sampler2D AOTexture;
|
||||
layout (binding = 1) uniform sampler2D DiffuseTexture;
|
||||
layout (binding = 2) uniform sampler2D NormalMapTexture;
|
||||
layout (binding = 3) uniform sampler2D SpecularMapTexture;
|
||||
layout (binding = 4) uniform sampler2D GlowMapTexture;
|
||||
layout (binding = 0) uniform sampler2D DiffuseTexture;
|
||||
layout (binding = 1) uniform sampler2D NormalMapTexture;
|
||||
layout (binding = 2) uniform sampler2D SpecularMapTexture;
|
||||
layout (binding = 3) uniform sampler2D GlowMapTexture;
|
||||
|
||||
#define TILE_SIZE 16
|
||||
|
||||
@@ -123,8 +119,6 @@ vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textu
|
||||
|
||||
void main()
|
||||
{
|
||||
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy), 0).r;
|
||||
ao = (clamp(1.0 - (1.0 - ao), 0.0, 1.0) + MIN_AMBIENT_LIGHT) / (1.0 + MIN_AMBIENT_LIGHT);
|
||||
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate * DiffuseUVRepeat);
|
||||
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate * GlowUVRepeat);
|
||||
vec4 specularTexel = texture2D(SpecularMapTexture, Input.TextureCoordinate * SpecularUVRepeat);
|
||||
@@ -139,7 +133,7 @@ void main()
|
||||
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
||||
|
||||
LightResult totalLighting;
|
||||
totalLighting.Diffuse = vec4(AmbientColor.rgb * ao, 1.0);
|
||||
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);
|
||||
@@ -157,8 +151,8 @@ void main()
|
||||
} else if (light.Type == 2) { //Directional
|
||||
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
||||
}
|
||||
totalLighting.Diffuse += vec4(light_result.Diffuse.rgb * ao, light_result.Diffuse.a);
|
||||
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
|
||||
totalLighting.Diffuse += light_result.Diffuse;
|
||||
totalLighting.Specular += light_result.Specular;
|
||||
}
|
||||
|
||||
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
||||
@@ -172,7 +166,7 @@ void main()
|
||||
color_result += FillColor;
|
||||
}
|
||||
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||
color_result += glowTexel*GlowIntensity;
|
||||
color_result += glowTexel*3;
|
||||
|
||||
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#version 430
|
||||
|
||||
#define MIN_AMBIENT_LIGHT 0.3
|
||||
|
||||
uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
@@ -25,20 +23,19 @@ uniform vec2 SpecularUVRepeat3;
|
||||
uniform vec2 GlowUVRepeat1;
|
||||
uniform vec2 GlowUVRepeat2;
|
||||
uniform vec2 GlowUVRepeat3;
|
||||
layout (binding = 0) uniform sampler2D AOTexture;
|
||||
layout (binding = 1) uniform sampler2D SplatMapTexture;
|
||||
layout (binding = 2) uniform sampler2D DiffuseTexture1;
|
||||
layout (binding = 3) uniform sampler2D DiffuseTexture2;
|
||||
layout (binding = 4) uniform sampler2D DiffuseTexture3;
|
||||
layout (binding = 5) uniform sampler2D NormalMapTexture1;
|
||||
layout (binding = 6) uniform sampler2D NormalMapTexture2;
|
||||
layout (binding = 7) uniform sampler2D NormalMapTexture3;
|
||||
layout (binding = 8) uniform sampler2D SpecularMapTexture1;
|
||||
layout (binding = 9) uniform sampler2D SpecularMapTexture2;
|
||||
layout (binding = 10) uniform sampler2D SpecularMapTexture3;
|
||||
layout (binding = 11) uniform sampler2D GlowMapTexture1;
|
||||
layout (binding = 12) uniform sampler2D GlowMapTexture2;
|
||||
layout (binding = 13) uniform sampler2D GlowMapTexture3;
|
||||
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
|
||||
|
||||
@@ -177,9 +174,6 @@ vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
|
||||
|
||||
void main()
|
||||
{
|
||||
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy), 0).r;
|
||||
ao = (clamp(1.0 - (1.0 - ao), 0.0, 1.0) + MIN_AMBIENT_LIGHT) / (1.0 + MIN_AMBIENT_LIGHT);
|
||||
|
||||
vec4 splatTexel = texture2D(SplatMapTexture, Input.TextureCoordinate);
|
||||
|
||||
vec4 diffuseTexel = CalcBlendedTexel(splatTexel, DiffuseTexture1, DiffuseTexture2, DiffuseTexture3,
|
||||
@@ -201,7 +195,7 @@ void main()
|
||||
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
|
||||
|
||||
LightResult totalLighting;
|
||||
totalLighting.Diffuse = vec4(AmbientColor.rgb * ao, 1.0);
|
||||
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);
|
||||
@@ -219,8 +213,8 @@ void main()
|
||||
} else if (light.Type == 2) { //Directional
|
||||
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
|
||||
}
|
||||
totalLighting.Diffuse += vec4(light_result.Diffuse.rgb * ao, light_result.Diffuse.a);
|
||||
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
|
||||
totalLighting.Diffuse += light_result.Diffuse;
|
||||
totalLighting.Specular += light_result.Specular;
|
||||
}
|
||||
|
||||
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
#version 430
|
||||
|
||||
//Number of samples per pixel
|
||||
uniform int uNumOfSamples;
|
||||
//#define NUM_SAMPLES (11)
|
||||
|
||||
//Number of turns around the cirle
|
||||
uniform int uNumOfTurns;
|
||||
//#define NUM_TURNS (7)
|
||||
|
||||
layout (binding = 0) uniform sampler2D ViewSpaceZ;
|
||||
|
||||
uniform vec4 uProjInfo;
|
||||
|
||||
uniform float uProjScale;
|
||||
//#define ProjScale 500
|
||||
|
||||
uniform float uRadius;
|
||||
//#define Radius 1.0f
|
||||
|
||||
uniform float uBias;
|
||||
//#define Bias 0.012f
|
||||
|
||||
uniform float uContrast;
|
||||
//#define IntensityDivR6 1
|
||||
|
||||
uniform float uIntensityScale;
|
||||
|
||||
out float AO;
|
||||
|
||||
vec3 getVSPosition(ivec2 ScreenSpaceCoord) {
|
||||
float z = texelFetch(ViewSpaceZ, ScreenSpaceCoord, 0).r;
|
||||
//Get the xy view space coordinates and add the z value from ViewSpaceZ buffer.
|
||||
return vec3((uProjInfo[0] + (ScreenSpaceCoord.x * uProjInfo[1])) * z, (uProjInfo[2] + (ScreenSpaceCoord.y * uProjInfo[3])) * z, z);
|
||||
}
|
||||
|
||||
vec3 getVSFaceNormal(vec3 ViewSpacePosition) {
|
||||
// Get tangets vector for the plane and ViewSpacePositin... don't ask how this functions works. It's pure magic.
|
||||
// They do this and it just works... I would guess that they approximate the function of a plane from pixels close to the pixel were on now.
|
||||
return normalize(cross(dFdx(ViewSpacePosition), dFdy(ViewSpacePosition)));
|
||||
}
|
||||
|
||||
|
||||
vec3 getSampleViewSpacePos(ivec2 ScreenSpaceCoord, int SampleIndex, float RotationAngle, float ScreenSpaceSampleRadius){
|
||||
// Pure Magic...
|
||||
float alpha = float(SampleIndex) * (1.0 / uNumOfSamples);
|
||||
|
||||
// Angle to where to sample
|
||||
float angle = alpha * (uNumOfTurns * 6.28) + RotationAngle;
|
||||
|
||||
//Lenght to were to sample
|
||||
ScreenSpaceSampleRadius = ScreenSpaceSampleRadius * alpha;
|
||||
|
||||
vec2 screenSpaceSampleOffsetVecor = vec2(cos(angle), sin(angle));
|
||||
|
||||
// Get texel coordinate on where to sample by going screenSpaceSampleOffsetVecor direction in ScreenSpaceSampleRadius units from ScreenSpaceCoord (the point being shaded);
|
||||
ivec2 screenSpaceSampleTexel = ivec2(ScreenSpaceSampleRadius * screenSpaceSampleOffsetVecor) + ScreenSpaceCoord;
|
||||
|
||||
return getVSPosition(screenSpaceSampleTexel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
float sampleAO(ivec2 ScreenSpaceCoord, vec3 Origin, vec3 OriginNormal, float ScreenSpaceSampleRadius, int SampleIndex, float RotationAngle, float Radius) {
|
||||
float radius2 = Radius * Radius;
|
||||
vec3 sampleViewSpacePosition = getSampleViewSpacePos(ScreenSpaceCoord, SampleIndex, RotationAngle, ScreenSpaceSampleRadius);
|
||||
|
||||
vec3 sampleVector = Origin - sampleViewSpacePosition;
|
||||
|
||||
// vv = sampleVectorLenght ^ 2
|
||||
float vv = dot(sampleVector, sampleVector);
|
||||
// vn = angle between sampleVector and Normal
|
||||
float vn = dot(sampleVector, OriginNormal);
|
||||
|
||||
const float epsilon = 0.0001f;
|
||||
|
||||
// vv < radius2 if the vector is shorter then the radius;
|
||||
// vn - bias, offset the angle to reduse self occlusion.
|
||||
// epsilon is here to make divison by 0 impossible.
|
||||
return float(vv < radius2) * max((vn - uBias) / (epsilon + vv), 0.0);
|
||||
//float f = max(radius2 - vv, 0.0);
|
||||
//return f * f * f * max((vn - uBias) / (epsilon + vv), 0.0);
|
||||
}
|
||||
|
||||
|
||||
void main() {
|
||||
ivec2 originScreenCoord = ivec2(gl_FragCoord.xy);
|
||||
|
||||
vec3 origin = getVSPosition(originScreenCoord);
|
||||
|
||||
float radius;
|
||||
if(origin.z < uRadius){
|
||||
radius = origin.z;
|
||||
} else {
|
||||
radius = uRadius;
|
||||
}
|
||||
|
||||
|
||||
vec3 originNormal = getVSFaceNormal(origin);
|
||||
|
||||
float screenSpaceSampleRadius = -uProjScale * radius / origin.z;
|
||||
|
||||
float rotationAngleOffset = 30 * originScreenCoord.x ^ originScreenCoord.y + 10 * originScreenCoord.x * originScreenCoord.y;
|
||||
|
||||
float sum = 0.0;
|
||||
for (int i = 0; i < uNumOfSamples; i++) {
|
||||
sum += sampleAO(originScreenCoord, origin, originNormal, screenSpaceSampleRadius, i, rotationAngleOffset, radius);
|
||||
}
|
||||
|
||||
//float A = max(0.0, 1.0 - sum * (2.0f / uNumOfSamples));
|
||||
float A = 1.0 - sum * (2.0f * uIntensityScale / float(uNumOfSamples));
|
||||
AO = clamp(pow(A, uContrast), 0.0f, 1.0f);
|
||||
//AO = vec4(originNormal, 1.0f);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#version 430
|
||||
|
||||
layout (location = 0) in vec3 Position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#version 430
|
||||
|
||||
layout (binding = 0) uniform sampler2D DepthBuffer;
|
||||
uniform vec3 ClipInfo;
|
||||
|
||||
out float depthLinear;
|
||||
//Just for Debug, should be depthLinear
|
||||
//out vec4 fragmentColor;
|
||||
void main() {
|
||||
float depthSample = texelFetch(DepthBuffer, ivec2(gl_FragCoord.xy), 0).r;
|
||||
depthLinear = ClipInfo[0] / (ClipInfo[1] * depthSample + ClipInfo[2]);
|
||||
//float depthLinear = (NearClip) / ( -depthSample + 1.0f);
|
||||
//fragmentColor = vec4(depthLinear, depthLinear, depthLinear, 1.0f);
|
||||
}
|
||||
@@ -7,8 +7,8 @@ uniform mat4 M;
|
||||
uniform mat4 V;
|
||||
uniform mat4 P;
|
||||
|
||||
layout (binding = 1) uniform sampler2D DiffuseTexture;
|
||||
layout (binding = 2) uniform sampler2D GlowMapTexture;
|
||||
layout (binding = 0) uniform sampler2D DiffuseTexture;
|
||||
layout (binding = 1) uniform sampler2D GlowMapTexture;
|
||||
|
||||
|
||||
in VertexData{
|
||||
|
||||
@@ -3,7 +3,7 @@ project(TacticalZ-Engine)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(GLFW REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS system filesystem thread chrono timer program_options)
|
||||
find_package(Boost REQUIRED COMPONENTS system filesystem thread chrono program_options)
|
||||
find_package(assimp REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
|
||||
@@ -207,7 +207,7 @@ bool RayVsModel(const Ray& ray,
|
||||
glm::vec3 v0 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v1 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
glm::vec3 v2 = Transform::TransformPoint(modelVertices[modelIndices[i++]].Position, modelMatrix);
|
||||
float dist = outDistance;
|
||||
float dist = INFINITY;
|
||||
float u;
|
||||
float v;
|
||||
if (RayVsTriangle(ray, v0, v1, v2, dist, u, v)) {
|
||||
@@ -366,8 +366,7 @@ bool AABBvsTriangle(const AABB& box,
|
||||
float verticalStepHeight,
|
||||
bool& isOnGround,
|
||||
glm::vec3& boxVelocity,
|
||||
glm::vec3& outResolution,
|
||||
bool resolveCollision)
|
||||
glm::vec3& outResolution)
|
||||
{
|
||||
//Check so we don't have a zero area triangle when calculating the normal.
|
||||
//Also, don't check a triangle facing away from the player.
|
||||
@@ -427,7 +426,7 @@ bool AABBvsTriangle(const AABB& box,
|
||||
//if projections don't overlap, return false.
|
||||
if (!rectangleVsTriangle(boxMin, boxMax, t2D, resolutionVector, resolutionDist, pushedFromTriangleLine)) {
|
||||
return false;
|
||||
} else if (resolveCollision) {
|
||||
} else {
|
||||
//Overwrite the smallest resolution if this is smaller.
|
||||
if (resolutionDist < resolveShortest.DistanceSq) {
|
||||
resolveShortest.Vector = glm::vec3(0.f);
|
||||
@@ -464,11 +463,6 @@ bool AABBvsTriangle(const AABB& box,
|
||||
if (glm::abs(t) > 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!resolveCollision) {
|
||||
return true;
|
||||
}
|
||||
|
||||
glm::vec3 cornerResolution = (1+t) * diagonal;
|
||||
//Overwrite the smallest resolution if cornerResolution is smaller.
|
||||
float lenSq = glm::length2(cornerResolution);
|
||||
@@ -543,8 +537,7 @@ bool AABBvsTriangles(const AABB& box,
|
||||
glm::vec3& boxVelocity,
|
||||
float verticalStepHeight,
|
||||
bool& isOnGround,
|
||||
glm::vec3& outResolutionVector,
|
||||
bool resolveCollision)
|
||||
glm::vec3& outResolutionVector)
|
||||
{
|
||||
bool hit = false;
|
||||
|
||||
@@ -560,7 +553,7 @@ bool AABBvsTriangles(const AABB& box,
|
||||
};
|
||||
glm::vec3 outVec;
|
||||
bool collideWithGround = isOnGround;
|
||||
if (AABBvsTriangle(newBox, triVertices, originalBoxVelocity, verticalStepHeight, collideWithGround, boxVelocity, outVec, resolveCollision)) {
|
||||
if (AABBvsTriangle(newBox, triVertices, originalBoxVelocity, verticalStepHeight, collideWithGround, boxVelocity, outVec)) {
|
||||
hit = true;
|
||||
outResolutionVector += outVec;
|
||||
newBox = AABB::FromOriginSize(newBox.Origin() + outVec, newBox.Size());
|
||||
@@ -576,44 +569,6 @@ bool AABBvsTriangles(const AABB& box,
|
||||
return hit;
|
||||
}
|
||||
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix,
|
||||
glm::vec3& boxVelocity,
|
||||
float verticalStepHeight,
|
||||
bool& isOnGround,
|
||||
glm::vec3& outResolutionVector)
|
||||
{
|
||||
return AABBvsTriangles(box,
|
||||
modelVertices,
|
||||
modelIndices,
|
||||
modelMatrix,
|
||||
boxVelocity,
|
||||
verticalStepHeight,
|
||||
isOnGround,
|
||||
outResolutionVector,
|
||||
true);
|
||||
}
|
||||
|
||||
bool AABBvsTriangles(const AABB& box,
|
||||
const RawModel::Vertex* modelVertices,
|
||||
const std::vector<unsigned int>& modelIndices,
|
||||
const glm::mat4& modelMatrix)
|
||||
{
|
||||
glm::vec3 vel, outres;
|
||||
bool g;
|
||||
return AABBvsTriangles(box,
|
||||
modelVertices,
|
||||
modelIndices,
|
||||
modelMatrix,
|
||||
vel,
|
||||
0.f,
|
||||
g,
|
||||
outres,
|
||||
false);
|
||||
}
|
||||
|
||||
boost::optional<EntityAABB> EntityAbsoluteAABB(EntityWrapper& entity, bool takeModelBox)
|
||||
{
|
||||
AABB modelSpaceBox;
|
||||
@@ -693,9 +648,8 @@ boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<Enti
|
||||
if (!entityBox.Entity.HasComponent("Model")) {
|
||||
continue;
|
||||
}
|
||||
auto& cModel = entityBox.Entity["Model"];
|
||||
std::string res = cModel["Resource"];
|
||||
if (res.empty() || (bool)cModel["Transparent"] || !((bool)cModel["Visible"])) {
|
||||
std::string res = entityBox.Entity["Model"]["Resource"];
|
||||
if (res.empty()) {
|
||||
continue;
|
||||
}
|
||||
Model* model;
|
||||
|
||||
@@ -3,71 +3,24 @@
|
||||
#include "Core/AABB.h"
|
||||
#include "Rendering/Model.h"
|
||||
|
||||
void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cPhysics, double dt)
|
||||
void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
|
||||
{
|
||||
if (!entity.HasComponent("Collidable")) {
|
||||
if (!entity.HasComponent("Physics")) {
|
||||
return;
|
||||
}
|
||||
ComponentWrapper& cPhysics = entity["Physics"];
|
||||
|
||||
boost::optional<EntityAABB> boundingBox = Collision::EntityAbsoluteAABB(entity);
|
||||
if (!boundingBox) {
|
||||
return;
|
||||
}
|
||||
ComponentWrapper& cTransform = entity["Transform"];
|
||||
EntityAABB& boxA = *boundingBox;
|
||||
bool everHitTheGround = false;
|
||||
|
||||
glm::vec3 size = boxA.Size();
|
||||
float diameter = std::min(size.x, size.z);
|
||||
glm::vec3 prevOrigin = (glm::vec3)cPhysics["PrevOrigin"];
|
||||
glm::vec3 toCurrentPos = boxA.Origin() - prevOrigin;
|
||||
float rayLength = glm::length(toCurrentPos) + 0.5f*diameter;
|
||||
//If the entity has moved farther than the size of its box, we need to handle it specially.
|
||||
bool traceCollision = rayLength > diameter;
|
||||
//hack solution: If prevOrigin is less than -9000 in all dimensions,
|
||||
//then it means it is not set, i.e. this is the first collision check for the entity.
|
||||
if (traceCollision && glm::any(glm::greaterThan((glm::vec3)cPhysics["PrevOrigin"], glm::vec3(-9000.f)))) {
|
||||
Ray ray(prevOrigin, toCurrentPos);
|
||||
m_OctreeResult.clear();
|
||||
m_Octree->ObjectsPossiblyHitByRay(ray, m_OctreeResult);
|
||||
for (auto& boxB : m_OctreeResult) {
|
||||
if (boxA.Entity == boxB.Entity) {
|
||||
continue;
|
||||
}
|
||||
bool hit;
|
||||
float dist;
|
||||
if (boxB.Entity.HasComponent("Model")) {
|
||||
RawModel* model;
|
||||
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
|
||||
try {
|
||||
model = ResourceManager::Load<RawModel, true>(res);
|
||||
} catch (const std::exception&) {
|
||||
continue;
|
||||
}
|
||||
float u, v;
|
||||
hit = Collision::RayVsModel(ray, model->Vertices(), model->m_Indices, Transform::ModelMatrix(boxB.Entity), dist, u, v);
|
||||
} else {
|
||||
hit = Collision::RayVsAABB(ray, boxB, dist);
|
||||
}
|
||||
if (hit && dist < rayLength) {
|
||||
//Set the entity to where it was colliding, minus the maximum box size.
|
||||
//TODO: Perhaps this should be done slightly more properly.
|
||||
glm::vec3 newOriginPos = ray.Origin() + (dist - 0.707107f*diameter) * ray.Direction();
|
||||
glm::vec3 resolve = newOriginPos - boxA.Origin();
|
||||
(glm::vec3&)cTransform["Position"] += resolve;
|
||||
boxA = *Collision::EntityAbsoluteAABB(entity);
|
||||
if (resolve.y > 0) {
|
||||
everHitTheGround = true;
|
||||
(bool)cPhysics["IsOnGround"] = true;
|
||||
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Collide against octree items
|
||||
m_OctreeResult.clear();
|
||||
m_Octree->ObjectsInSameRegion(*boundingBox, m_OctreeResult);
|
||||
bool everHitTheGround = false;
|
||||
for (auto& boxB : m_OctreeResult) {
|
||||
glm::vec3 resolutionVector;
|
||||
if (boxA.Entity == boxB.Entity) {
|
||||
@@ -111,6 +64,4 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
||||
if (!everHitTheGround) {
|
||||
(bool)cPhysics["IsOnGround"] = false;
|
||||
}
|
||||
|
||||
(glm::vec3&)cPhysics["PrevOrigin"] = boxA.Origin();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "Core/ComponentPool.h"
|
||||
|
||||
|
||||
|
||||
ComponentWrapper ComponentPoolForwardIterator::operator*() const
|
||||
{
|
||||
char* data = &(*m_MemoryPoolIterator);
|
||||
@@ -30,34 +32,6 @@ ComponentPoolForwardIterator& ComponentPoolForwardIterator::operator++()
|
||||
return *this;
|
||||
}
|
||||
|
||||
ComponentPool::ComponentPool(const ComponentPool& other)
|
||||
: m_ComponentInfo(other.m_ComponentInfo)
|
||||
, m_Pool(other.m_Pool)
|
||||
, m_EntityToComponent()
|
||||
{
|
||||
// Update EntityToComponent pointers
|
||||
for (char& ptr : m_Pool) {
|
||||
EntityID entity = *reinterpret_cast<EntityID*>(&ptr);
|
||||
m_EntityToComponent[entity] = &ptr;
|
||||
}
|
||||
|
||||
// Duplicate strings
|
||||
for (auto& name : m_ComponentInfo.StringFields) {
|
||||
for (auto& c : *this) {
|
||||
std::string& val = c[name];
|
||||
ComponentWrapper::SolidifyStrings(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ComponentPool::~ComponentPool()
|
||||
{
|
||||
// Destroy component data
|
||||
for (auto& c : *this) {
|
||||
ComponentWrapper::Destroy(c.Info, c.Data);
|
||||
}
|
||||
}
|
||||
|
||||
//const ::ComponentInfo& ComponentPool::ComponentInfo() const
|
||||
//{
|
||||
// return m_ComponentInfo;
|
||||
@@ -65,19 +39,10 @@ ComponentPool::~ComponentPool()
|
||||
|
||||
ComponentWrapper ComponentPool::Allocate(EntityID entity)
|
||||
{
|
||||
// Allocate pool data
|
||||
char* data = m_Pool.Allocate();
|
||||
// Copy EntityID
|
||||
memcpy(data, &entity, sizeof(EntityID));
|
||||
|
||||
m_EntityToComponent[entity] = data;
|
||||
ComponentWrapper component(m_ComponentInfo, data);
|
||||
|
||||
// Copy defaults
|
||||
memcpy(component.Data, m_ComponentInfo.Defaults.get(), m_ComponentInfo.Stride);
|
||||
ComponentWrapper::SolidifyStrings(component);
|
||||
|
||||
return component;
|
||||
return ComponentWrapper(m_ComponentInfo, data);
|
||||
}
|
||||
|
||||
ComponentWrapper ComponentPool::GetByEntity(EntityID ent)
|
||||
@@ -92,7 +57,6 @@ bool ComponentPool::KnowsEntity(EntityID ent)
|
||||
|
||||
void ComponentPool::Delete(ComponentWrapper& wrapper)
|
||||
{
|
||||
ComponentWrapper::Destroy(wrapper.Info, wrapper.Data);
|
||||
m_EntityToComponent.erase(wrapper.EntityID);
|
||||
m_Pool.Free(wrapper.Data - sizeof(EntityID));
|
||||
}
|
||||
|
||||
@@ -185,9 +185,6 @@ void EntityFilePreprocessor::parseComponentInfo()
|
||||
field.Offset = fieldOffset;
|
||||
field.Stride = stride;
|
||||
compInfo.FieldsInOrder.push_back(name);
|
||||
if (field.Type == "string") {
|
||||
compInfo.StringFields.push_back(name);
|
||||
}
|
||||
fieldOffset += stride;
|
||||
}
|
||||
|
||||
@@ -204,7 +201,7 @@ void EntityFilePreprocessor::parseDefaults()
|
||||
|
||||
for (auto& ci : m_ComponentInfo) {
|
||||
// Allocate memory for default values
|
||||
ci.second.Defaults = boost::shared_array<char>(new char[ci.second.Stride], std::bind(&ComponentWrapper::Destroy, ci.second, std::placeholders::_1));
|
||||
ci.second.Defaults = std::shared_ptr<char>(new char[ci.second.Stride]);
|
||||
memset(ci.second.Defaults.get(), 0, ci.second.Stride);
|
||||
|
||||
std::string componentName = ci.first;
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
#include "Core/PerformanceTimer.h"
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
|
||||
cpu_timer PerformanceTimer::m_Timer;
|
||||
std::map<std::string, cpu_timer> PerformanceTimer::timers;
|
||||
std::string PerformanceTimer::currentTimerRunning = "";
|
||||
|
||||
void PerformanceTimer::StartTimer(std::string nameOfTimer)
|
||||
{
|
||||
timers[nameOfTimer].stop();
|
||||
timers[nameOfTimer].start();
|
||||
currentTimerRunning = nameOfTimer;
|
||||
}
|
||||
|
||||
void PerformanceTimer::StartTimerAndStopPrevious(std::string nameOfTimer)
|
||||
{
|
||||
//stop the current timer and start some other - useful to not have to stop timers all the time
|
||||
if (currentTimerRunning != "") {
|
||||
timers[currentTimerRunning].stop();
|
||||
}
|
||||
timers[nameOfTimer].stop();
|
||||
timers[nameOfTimer].start();
|
||||
currentTimerRunning = nameOfTimer;
|
||||
}
|
||||
|
||||
void PerformanceTimer::StopTimer(std::string nameOfTimer)
|
||||
{
|
||||
timers[nameOfTimer].stop();
|
||||
currentTimerRunning = nameOfTimer;
|
||||
}
|
||||
|
||||
void PerformanceTimer::SetFrameNumber(int frameNumber)
|
||||
{
|
||||
}
|
||||
|
||||
void PerformanceTimer::ResetAllTimers()
|
||||
{
|
||||
//stop all timers
|
||||
for (auto aTimer : timers)
|
||||
{
|
||||
aTimer.second.stop();
|
||||
}
|
||||
currentTimerRunning = "";
|
||||
timers.clear();
|
||||
}
|
||||
|
||||
void PerformanceTimer::CreateExcelData()
|
||||
{
|
||||
//get time
|
||||
std::time_t t = std::time(NULL);
|
||||
char tStr[16];
|
||||
std::strftime(tStr, 32, " %a %H-%M-%S", std::localtime(&t));
|
||||
std::string time(tStr);
|
||||
std::string path("TacticalZ");
|
||||
path += time + ".csv";
|
||||
std::ofstream someFileStream;
|
||||
someFileStream.open(path, std::ofstream::out);
|
||||
someFileStream << "classname" << ',' << "walltime" << ',' << "userTime" << ',' << "systemTime" << '\n';
|
||||
|
||||
//write all timers to file
|
||||
for (auto aTimer : timers)
|
||||
{
|
||||
//remove the "class" name in front of the string
|
||||
auto className = aTimer.first;
|
||||
if (className.find("class ") != std::string::npos) {
|
||||
className.replace(0, 6, "");
|
||||
}
|
||||
auto wallTime = (double)aTimer.second.elapsed().wall*1e-3;
|
||||
auto userTime = (double)aTimer.second.elapsed().user*1e-3;
|
||||
auto systemTime = (double)aTimer.second.elapsed().system*1e-3;
|
||||
|
||||
someFileStream << className << "," << wallTime << ',' << userTime << ',' << systemTime << '\n';
|
||||
}
|
||||
someFileStream.close();
|
||||
}
|
||||
@@ -9,20 +9,7 @@ World::~World()
|
||||
}
|
||||
}
|
||||
|
||||
World::World(const World& other)
|
||||
: m_EventBroker(other.m_EventBroker)
|
||||
, m_CurrentEntityID(other.m_CurrentEntityID)
|
||||
, m_EntityParents(other.m_EntityParents)
|
||||
, m_EntityChildren(other.m_EntityChildren)
|
||||
, m_EntityNames(other.m_EntityNames)
|
||||
{
|
||||
// Deep copy component pools
|
||||
for (auto& kv : other.m_ComponentPools) {
|
||||
m_ComponentPools[kv.first] = new ComponentPool(*kv.second);
|
||||
}
|
||||
}
|
||||
|
||||
EntityID World::CreateEntity(EntityID parent /*= EntityID_Invalid*/)
|
||||
EntityID World::CreateEntity(EntityID parent /*= 0*/)
|
||||
{
|
||||
EntityID newEntity = generateEntityID();
|
||||
if (newEntity == parent) {
|
||||
@@ -57,8 +44,10 @@ ComponentWrapper World::AttachComponent(EntityID entity, const std::string& comp
|
||||
ComponentPool* pool = m_ComponentPools.at(componentType);
|
||||
const ComponentInfo& ci = pool->ComponentInfo();
|
||||
|
||||
// Allocate component with default values
|
||||
// Allocate space for the component
|
||||
ComponentWrapper c = pool->Allocate(entity);
|
||||
// Write default values
|
||||
memcpy(c.Data, ci.Defaults.get(), ci.Stride);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
|
||||
m_Enabled = ResourceManager::Load<ConfigFile>("Config.ini")->Get<bool>("Debug.EditorEnabled", false);
|
||||
if (m_Enabled) {
|
||||
Enable();
|
||||
} else {
|
||||
Disable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,12 +223,6 @@ bool EditorSystem::OnInputCommand(const Events::InputCommand& e)
|
||||
Enable();
|
||||
}
|
||||
}
|
||||
if (e.Command == "PerformanceTimingResetAllTimers" && e.Value > 0) {
|
||||
PerformanceTimer::ResetAllTimers();
|
||||
}
|
||||
if (e.Command == "PerformanceTimingCreateExcelData" && e.Value > 0) {
|
||||
PerformanceTimer::CreateExcelData();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
#include "GUI/ButtonSystem.h"
|
||||
|
||||
ButtonSystem::ButtonSystem(SystemParams params, IRenderer* renderer)
|
||||
: System(params)
|
||||
, PureSystem("Button")
|
||||
, m_Renderer(renderer)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMousePress, &ButtonSystem::OnMousePress);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMouseRelease, &ButtonSystem::OnMouseRelease);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMouseLock, &ButtonSystem::OnMouseLock);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EMouseUnlock, &ButtonSystem::OnMouseUnlock);
|
||||
}
|
||||
|
||||
|
||||
bool ButtonSystem::OnMouseLock(const Events::LockMouse& e)
|
||||
{
|
||||
m_MouseIsLocked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ButtonSystem::OnMouseUnlock(const Events::UnlockMouse& e)
|
||||
{
|
||||
m_MouseIsLocked = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ButtonSystem::OnMousePress(const Events::MousePress& e)
|
||||
{
|
||||
if (e.Button == GLFW_MOUSE_BUTTON_1 && !m_MouseIsLocked) {
|
||||
m_PickData = m_Renderer->Pick(glm::vec2(e.X, e.Y));
|
||||
if (m_PickData.Entity != EntityID_Invalid && m_PickData.World == m_World) {
|
||||
if(m_World->HasComponent(m_PickData.Entity, "Button")) {
|
||||
//Entity is a button, save it and send pressed event.
|
||||
|
||||
m_PickEntity = EntityWrapper(m_World, m_PickData.Entity);
|
||||
|
||||
//You have clicked on a button entity, send pressed event.
|
||||
Events::ButtonPressed ePressed;
|
||||
ePressed.Entity = m_PickEntity;
|
||||
ePressed.EntityName = m_PickEntity.Name();
|
||||
m_EventBroker->Publish(ePressed);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ButtonSystem::OnMouseRelease(const Events::MouseRelease& e)
|
||||
{
|
||||
if(!m_MouseIsLocked) {
|
||||
//Mouse is not locked, send release event.
|
||||
m_PickData = m_Renderer->Pick(glm::vec2(e.X, e.Y));
|
||||
if(m_PickData.Entity != EntityID_Invalid && m_PickData.World == m_World) {
|
||||
EntityWrapper ent = EntityWrapper(m_World, m_PickData.Entity);
|
||||
|
||||
Events::ButtonReleased eReleased;
|
||||
eReleased.EntityName = m_PickEntity.Name();
|
||||
eReleased.Entity = m_PickEntity;
|
||||
m_EventBroker->Publish(eReleased);
|
||||
|
||||
if(m_World->HasComponent(m_PickData.Entity, "Button")) {
|
||||
if (ent == m_PickEntity) {
|
||||
//The entity you released the mouse button on is the same as you pressed it on. "Clicked"
|
||||
Events::ButtonClicked eClicked;
|
||||
eClicked.Entity = m_PickEntity;
|
||||
eClicked.EntityName = m_PickEntity.Name();
|
||||
m_EventBroker->Publish(eClicked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ButtonSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cHealth, double dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#include "GUI/MainMenuSystem.h"
|
||||
|
||||
MainMenuSystem::MainMenuSystem(SystemParams params, IRenderer* renderer)
|
||||
: System(params)
|
||||
, ImpureSystem()
|
||||
, m_Renderer(renderer)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPressed, &MainMenuSystem::OnButtonPress);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EReleased, &MainMenuSystem::OnButtonRelease);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EClicked, &MainMenuSystem::OnButtonClick);
|
||||
}
|
||||
|
||||
void MainMenuSystem::Update(double dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
|
||||
{
|
||||
if(e.EntityName == "Play") {
|
||||
//Run play code
|
||||
} else if(e.EntityName == "Connect") {
|
||||
//Run connect code
|
||||
} else if(e.EntityName == "Host") {
|
||||
//Run host code
|
||||
} else if(e.EntityName == "Quit") {
|
||||
printf("No, you stay");
|
||||
} else if (e.EntityName == "Res1080") {
|
||||
glfwSetWindowSize(m_Renderer->Window(), 1920, 1080);
|
||||
printf("\n1080");
|
||||
} else if (e.EntityName == "Res720") {
|
||||
glfwSetWindowSize(m_Renderer->Window(), 1280, 720);
|
||||
glViewport(0, 0, 1280, 720);
|
||||
printf("\n720");
|
||||
} else if (e.EntityName == "Res480") {
|
||||
glfwSetWindowSize(m_Renderer->Window(), 854, 480);
|
||||
glViewport(0, 0, 854, 480);
|
||||
printf("\n480");
|
||||
} else if (e.EntityName == "FullScreen") {
|
||||
printf("No fullscreen for now");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainMenuSystem::OnButtonRelease(const Events::ButtonReleased& e)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainMenuSystem::OnButtonPress(const Events::ButtonPressed& e)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,9 +41,11 @@ void Client::Connect(std::string address, int port)
|
||||
}
|
||||
}
|
||||
|
||||
void Client::Update()
|
||||
void Client::Update(double dt)
|
||||
{
|
||||
m_EventBroker->Process<Client>();
|
||||
//m_TimeStamp += dt;
|
||||
publishInputCommands();
|
||||
while (m_Unreliable.IsSocketAvailable()) {
|
||||
// Packet will get real data in receive
|
||||
Packet packet(MessageType::Invalid);
|
||||
@@ -72,7 +74,8 @@ void Client::Update()
|
||||
sendInputCommands();
|
||||
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.
|
||||
// Reliable messages and timestamps did not fix it.
|
||||
sendLocalPlayerTransform();
|
||||
|
||||
hasServerTimedOut();
|
||||
@@ -122,6 +125,9 @@ void Client::parseMessageType(Packet& packet)
|
||||
case MessageType::OnPlayerDamage:
|
||||
parsePlayerDamage(packet);
|
||||
break;
|
||||
case MessageType::OnInputCommand:
|
||||
//parsePlayerDamage(packet);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -284,21 +290,30 @@ void Client::ignoreFields(Packet& packet, const ComponentInfo& componentInfo)
|
||||
|
||||
void Client::parseSnapshot(Packet& packet)
|
||||
{
|
||||
// Read input commands
|
||||
std::size_t numInputCommands = packet.ReadPrimitive<std::size_t>();
|
||||
for (std::size_t i = 0; i < numInputCommands; ++i) {
|
||||
Events::InputCommand e;
|
||||
e.PlayerID = packet.ReadPrimitive<EntityID>();
|
||||
EntityID player = packet.ReadPrimitive<EntityID>();
|
||||
std::string command = packet.ReadString();
|
||||
float value = packet.ReadPrimitive<float>();
|
||||
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 input commands
|
||||
//std::size_t numInputCommands = packet.ReadPrimitive<std::size_t>();
|
||||
//for (std::size_t i = 0; i < numInputCommands; ++i) {
|
||||
// Events::InputCommand e;
|
||||
// e.PlayerID = packet.ReadPrimitive<EntityID>();
|
||||
// EntityID player = packet.ReadPrimitive<EntityID>();
|
||||
// std::string command = packet.ReadString();
|
||||
// float value = packet.ReadPrimitive<float>();
|
||||
// double timestamp = packet.ReadPrimitive<double>();
|
||||
// if (m_ServerIDToClientID.find(player) != m_ServerIDToClientID.end()) {
|
||||
// e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(player));
|
||||
// e.Command = command;
|
||||
// e.Value = value;
|
||||
// e.TimeStamp = timestamp;
|
||||
// m_EventBroker->Publish(e);
|
||||
// }
|
||||
//}
|
||||
|
||||
// Read timestamp
|
||||
double remoteTimestamp = packet.ReadPrimitive<double>();
|
||||
//if (abs(remoteTimestamp - m_TimeStamp) > 0.100) {
|
||||
// m_TimeStamp = remoteTimestamp;
|
||||
// LOG_INFO("Resynced remote and local timestamp");
|
||||
//}
|
||||
|
||||
// Read world state
|
||||
while (packet.DataReadSize() < packet.Size()) {
|
||||
@@ -359,6 +374,36 @@ void Client::parseSnapshot(Packet& packet)
|
||||
parseSpawnEvents();
|
||||
}
|
||||
|
||||
|
||||
void Client::parseOnInputCommand(Packet & packet)
|
||||
{
|
||||
while (packet.DataReadSize() < packet.Size()) {
|
||||
Events::InputCommand e;
|
||||
e.PlayerID = packet.ReadPrimitive<int>();
|
||||
e.Player = EntityWrapper(m_World, packet.ReadPrimitive<int>());
|
||||
e.Command = packet.ReadString();
|
||||
e.Value = packet.ReadPrimitive<float>();
|
||||
e.TimeStamp = packet.ReadPrimitive<double>();
|
||||
m_EventBroker->Publish(e);
|
||||
m_ReceivedInputCommands.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 Client::publishInputCommands()
|
||||
{
|
||||
std::vector<Events::InputCommand> notPublishedEvents;
|
||||
for (int i = 0; i < m_ReceivedInputCommands.size(); i++) {
|
||||
if (m_ReceivedInputCommands.at(i).TimeStamp < m_TimeStamp) {
|
||||
m_EventBroker->Publish(m_ReceivedInputCommands.at(i));
|
||||
}
|
||||
else {
|
||||
notPublishedEvents.push_back(m_ReceivedInputCommands.at(i));
|
||||
}
|
||||
}
|
||||
m_ReceivedInputCommands = notPublishedEvents;
|
||||
}
|
||||
|
||||
void Client::disconnect()
|
||||
{
|
||||
m_IsConnected = false;
|
||||
@@ -402,7 +447,9 @@ bool Client::OnInputCommand(const Events::InputCommand & e)
|
||||
}
|
||||
} else {
|
||||
if (m_IsConnected) {
|
||||
m_InputCommandBuffer.push_back(e);
|
||||
Events::InputCommand setTimestamp = e;
|
||||
setTimestamp.TimeStamp = m_TimeStamp;
|
||||
m_InputCommandBuffer.push_back(setTimestamp);
|
||||
}
|
||||
//LOG_DEBUG("Client::OnInputCommand: Command is %s. Value is %f. PlayerID is %i.", e.Command.c_str(), e.Value, e.PlayerID);
|
||||
return true;
|
||||
@@ -516,6 +563,7 @@ void Client::sendInputCommands()
|
||||
for (int i = 0; i < m_InputCommandBuffer.size(); i++) {
|
||||
packet.WriteString(m_InputCommandBuffer[i].Command);
|
||||
packet.WritePrimitive(m_InputCommandBuffer[i].Value);
|
||||
packet.WritePrimitive(m_InputCommandBuffer[i].TimeStamp);
|
||||
}
|
||||
m_Reliable.Send(packet);
|
||||
m_InputCommandBuffer.clear();
|
||||
|
||||
@@ -9,7 +9,7 @@ Network::Network(World* world, EventBroker* eventBroker)
|
||||
m_TimeoutMs = config->Get<int>("Networking.TimeoutMs", 20000);
|
||||
}
|
||||
|
||||
void Network::Update()
|
||||
void Network::Update(double dt)
|
||||
{
|
||||
updateNetworkData();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "Network/Server.h"
|
||||
|
||||
Server::Server(World* world, EventBroker* eventBroker, int port)
|
||||
Server::Server(World* world, EventBroker* eventBroker, int port)
|
||||
: Network(world, eventBroker)
|
||||
{
|
||||
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
@@ -26,10 +26,12 @@ Server::~Server()
|
||||
|
||||
}
|
||||
|
||||
void Server::Update()
|
||||
void Server::Update(double dt)
|
||||
{
|
||||
m_EventBroker->Process<Server>();
|
||||
m_TimeStamp += dt;
|
||||
publishInputCommands();
|
||||
PlayerDefinition pd;
|
||||
|
||||
m_Reliable.AcceptNewConnections(m_NextPlayerID, m_ConnectedPlayers);
|
||||
for (auto& kv : m_ConnectedPlayers) {
|
||||
while (kv.second.TCPSocket->available()) {
|
||||
@@ -80,9 +82,8 @@ void Server::Update()
|
||||
checkForTimeOuts();
|
||||
timOutTimer = currentTime;
|
||||
}
|
||||
m_EventBroker->Process<Server>();
|
||||
if (isReadingData) {
|
||||
Network::Update();
|
||||
Network::Update(dt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +146,8 @@ void Server::unreliableBroadcast(Packet& packet)
|
||||
void Server::sendSnapshot()
|
||||
{
|
||||
Packet packet(MessageType::Snapshot);
|
||||
addInputCommandsToPacket(packet);
|
||||
//addInputCommandsToPacket(packet);
|
||||
packet.WritePrimitive(m_TimeStamp/*+ somePingvalue + offset*/);
|
||||
addChildrenToPacket(packet, EntityID_Invalid);
|
||||
unreliableBroadcast(packet);
|
||||
}
|
||||
@@ -159,6 +161,7 @@ void Server::addInputCommandsToPacket(Packet& packet)
|
||||
packet.WritePrimitive(m_ConnectedPlayers.at(command.PlayerID).EntityID);
|
||||
packet.WriteString(command.Command);
|
||||
packet.WritePrimitive(command.Value);
|
||||
packet.WritePrimitive(command.TimeStamp);
|
||||
}
|
||||
m_InputCommandsToBroadcast.clear();
|
||||
}
|
||||
@@ -279,7 +282,7 @@ void Server::parseTCPConnect(Packet & packet)
|
||||
// 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
|
||||
@@ -332,6 +335,7 @@ void Server::disconnect(PlayerID playerID)
|
||||
e.PlayerID = playerID;
|
||||
m_EventBroker->Publish(e);
|
||||
//m_World->DeleteEntity(m_ConnectedPlayers[playerID].EntityID);
|
||||
// TODO Kolla Anders crashade efter timeout med break point
|
||||
m_ConnectedPlayers[playerID].TCPSocket->shutdown(boost::asio::ip::tcp::socket::shutdown_both);
|
||||
m_ConnectedPlayers[playerID].TCPSocket->close();
|
||||
m_World->DeleteEntity(m_ConnectedPlayers[playerID].EntityID);
|
||||
@@ -374,8 +378,7 @@ bool Server::OnInputCommand(const Events::InputCommand & e)
|
||||
}
|
||||
isReadingData = !isReadingData;
|
||||
m_SaveDataTimer = std::clock();
|
||||
}
|
||||
if (e.Command == "KickPlayer" && e.Value > 0) {
|
||||
} else if (e.Command == "KickPlayer" && e.Value > 0) {
|
||||
kick(0);
|
||||
}
|
||||
|
||||
@@ -465,7 +468,9 @@ void Server::parseOnInputCommand(Packet& packet)
|
||||
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);
|
||||
e.TimeStamp = packet.ReadPrimitive<double>();
|
||||
/* m_EventBroker->Publish(e);*/
|
||||
m_InputCommandsToPublish.push_back(e);
|
||||
if (e.Command == "PrimaryFire" || e.Command == "Reload") {
|
||||
m_InputCommandsToBroadcast.push_back(e);
|
||||
}
|
||||
@@ -515,6 +520,20 @@ bool Server::shouldSendToClient(EntityWrapper childEntity)
|
||||
return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid();
|
||||
}
|
||||
|
||||
void Server::publishInputCommands()
|
||||
{
|
||||
std::vector<Events::InputCommand> notPublishedEvents;
|
||||
for (int i = 0; i < m_InputCommandsToPublish.size(); i++) {
|
||||
if (m_InputCommandsToPublish.at(i).TimeStamp < m_TimeStamp) {
|
||||
m_EventBroker->Publish(m_InputCommandsToPublish.at(i));
|
||||
} else {
|
||||
LOG_INFO("Did not instantly publish command");
|
||||
notPublishedEvents.push_back(m_InputCommandsToPublish.at(i));
|
||||
}
|
||||
}
|
||||
m_InputCommandsToPublish = notPublishedEvents;
|
||||
}
|
||||
|
||||
PlayerID Server::GetPlayerIDFromEndpoint()
|
||||
{
|
||||
// check both tcp and udp connection
|
||||
|
||||
@@ -19,20 +19,16 @@ void DrawBloomPass::InitializeTextures()
|
||||
void DrawBloomPass::InitializeShaderPrograms()
|
||||
{
|
||||
m_GaussianProgram_horiz = ResourceManager::Load<ShaderProgram>("##GaussianProgramHoriz");
|
||||
if (m_GaussianProgram_horiz->GetHandle() == 0) {
|
||||
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_horiz.vert.glsl")));
|
||||
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl")));
|
||||
m_GaussianProgram_horiz->Compile();
|
||||
m_GaussianProgram_horiz->Link();
|
||||
}
|
||||
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_horiz.vert.glsl")));
|
||||
m_GaussianProgram_horiz->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl")));
|
||||
m_GaussianProgram_horiz->Compile();
|
||||
m_GaussianProgram_horiz->Link();
|
||||
|
||||
m_GaussianProgram_vert = ResourceManager::Load<ShaderProgram>("##GaussianProgramVert");
|
||||
if (m_GaussianProgram_vert->GetHandle() == 0) {
|
||||
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_vert.vert.glsl")));
|
||||
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_vert.frag.glsl")));
|
||||
m_GaussianProgram_vert->Compile();
|
||||
m_GaussianProgram_vert->Link();
|
||||
}
|
||||
m_GaussianProgram_vert = ResourceManager::Load<ShaderProgram>("##GaussianProgramVert");
|
||||
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Gaussian_vert.vert.glsl")));
|
||||
m_GaussianProgram_vert->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/Gaussian_vert.frag.glsl")));
|
||||
m_GaussianProgram_vert->Compile();
|
||||
m_GaussianProgram_vert->Link();
|
||||
}
|
||||
|
||||
|
||||
@@ -75,12 +71,15 @@ void DrawBloomPass::Draw(GLuint texture)
|
||||
//Horizontal pass, first use the given texture then save it to the horizontal framebuffer.
|
||||
m_GaussianFrameBuffer_horiz.Bind();
|
||||
m_GaussianProgram_horiz->Bind();
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
|
||||
glBindVertexArray(m_ScreenQuad->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
|
||||
//Iterate some times to make it more gaussian.
|
||||
for (int i = 1; i < m_iterations; i++) {
|
||||
//Vertical pass
|
||||
@@ -93,6 +92,7 @@ void DrawBloomPass::Draw(GLuint texture)
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
|
||||
//horizontal pass
|
||||
|
||||
m_GaussianFrameBuffer_horiz.Bind();
|
||||
@@ -112,6 +112,7 @@ void DrawBloomPass::Draw(GLuint texture)
|
||||
m_GaussianProgram_vert->Bind();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz);
|
||||
|
||||
glBindVertexArray(m_ScreenQuad->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex +1
|
||||
@@ -120,15 +121,6 @@ void DrawBloomPass::Draw(GLuint texture)
|
||||
GLERROR("DrawBloomPass::Draw: END");
|
||||
}
|
||||
|
||||
|
||||
void DrawBloomPass::OnWindowResize()
|
||||
{
|
||||
GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
m_GaussianFrameBuffer_vert.Generate();
|
||||
GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
m_GaussianFrameBuffer_horiz.Generate();
|
||||
}
|
||||
|
||||
void DrawBloomPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
|
||||
{
|
||||
glGenTextures(1, texture);
|
||||
|
||||
@@ -27,7 +27,6 @@ void DrawFinalPass::InitializeFrameBuffers()
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
GLERROR("RenderBuffer generation");
|
||||
|
||||
|
||||
GenerateTexture(&m_SceneTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
//GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
@@ -174,25 +173,25 @@ void DrawFinalPass::InitializeShaderPrograms()
|
||||
GLERROR("Creating DepthFill program");
|
||||
}
|
||||
|
||||
void DrawFinalPass::Draw(RenderScene& scene, GLuint SSAOTexture)
|
||||
void DrawFinalPass::Draw(RenderScene& scene)
|
||||
{
|
||||
GLERROR("Pre");
|
||||
|
||||
DrawFinalPassState* state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
|
||||
if (scene.ClearDepth) {
|
||||
//glClear(GL_DEPTH_BUFFER_BIT);
|
||||
state->Disable(GL_DEPTH_TEST);
|
||||
state->DepthMask(GL_FALSE);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
//TODO: Do we need check for this or will it be per scene always?
|
||||
glClearStencil(0x00);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
//Fill depth buffer
|
||||
|
||||
|
||||
|
||||
state->StencilMask(0x00);
|
||||
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene, SSAOTexture);
|
||||
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
|
||||
GLERROR("OpaqueObjects");
|
||||
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene, SSAOTexture);
|
||||
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
|
||||
GLERROR("TransparentObjects");
|
||||
DrawSprites(scene.Jobs.SpriteJob, scene);
|
||||
GLERROR("SpriteJobs");
|
||||
@@ -207,11 +206,11 @@ void DrawFinalPass::Draw(RenderScene& scene, GLuint SSAOTexture)
|
||||
//Draw Opaque shielded objects
|
||||
state->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
||||
state->StencilMask(0x00);
|
||||
DrawModelRenderQueues(scene.Jobs.OpaqueShieldedObjects, scene, SSAOTexture); //might need changing
|
||||
DrawModelRenderQueues(scene.Jobs.OpaqueShieldedObjects, scene); //might need changing
|
||||
GLERROR("Shielded Opaque object");
|
||||
|
||||
//Draw Transparen Shielded objects
|
||||
DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene, SSAOTexture); //might need changing
|
||||
DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
|
||||
GLERROR("Shielded Transparent objects");
|
||||
|
||||
GLERROR("END");
|
||||
@@ -242,14 +241,14 @@ void DrawFinalPass::Draw(RenderScene& scene, GLuint SSAOTexture)
|
||||
DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
|
||||
GLERROR("StencilPass");
|
||||
|
||||
//glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
stateLowRes->Enable(GL_DEPTH_TEST);
|
||||
stateLowRes->StencilFunc(GL_LEQUAL, 1, 0xFF);
|
||||
stateLowRes->StencilMask(0x00);
|
||||
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene, SSAOTexture);
|
||||
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
|
||||
GLERROR("OpaqueObjects");
|
||||
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene, SSAOTexture);
|
||||
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
|
||||
GLERROR("TransparentObjects");
|
||||
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
@@ -275,27 +274,6 @@ void DrawFinalPass::ClearBuffer()
|
||||
m_FinalPassFrameBuffer.Unbind();
|
||||
}
|
||||
|
||||
|
||||
void DrawFinalPass::OnWindowResize()
|
||||
{
|
||||
//InitializeFrameBuffers();
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
|
||||
GenerateTexture(&m_SceneTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
m_FinalPassFrameBuffer.Generate();
|
||||
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBufferLowRes);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, (int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate));
|
||||
|
||||
GenerateTexture(&m_SceneTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
GenerateTexture(&m_BloomTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
m_FinalPassFrameBufferLowRes.Generate();
|
||||
GLERROR("Error changing texture resolutions");
|
||||
}
|
||||
|
||||
void DrawFinalPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
|
||||
{
|
||||
glGenTextures(1, texture);
|
||||
@@ -322,7 +300,7 @@ void DrawFinalPass::GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm:
|
||||
GLERROR("MipMap Texture initialization failed");
|
||||
}
|
||||
|
||||
void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene, GLuint SSAOTexture)
|
||||
void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
|
||||
{
|
||||
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
|
||||
GLERROR("forwardHandle");
|
||||
@@ -345,9 +323,6 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO());
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, m_LightCullingPass->LightIndexSSBO());
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, SSAOTexture);
|
||||
|
||||
for (auto &job : jobs) {
|
||||
auto explosionEffectJob = std::dynamic_pointer_cast<ExplosionEffectJob>(job);
|
||||
if (explosionEffectJob) {
|
||||
@@ -694,14 +669,14 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "FillColor"), 1, glm::value_ptr(spriteJob->FillColor));
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), spriteJob->FillPercentage);
|
||||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
if (spriteJob->DiffuseTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, spriteJob->DiffuseTexture->m_Texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, m_ErrorTexture->m_Texture);
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
if (spriteJob->IncandescenceTexture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, spriteJob->IncandescenceTexture->m_Texture);
|
||||
} else {
|
||||
@@ -714,6 +689,9 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
|
||||
glDrawElements(GL_TRIANGLES, spriteJob->EndIndex - spriteJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(spriteJob->StartIndex*sizeof(unsigned int)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// m_SpriteProgram->Unbind();
|
||||
}
|
||||
|
||||
@@ -727,7 +705,7 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
|
||||
GLERROR("Bind 4 uniform");
|
||||
|
||||
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
glUniform2f(glGetUniformLocation(shaderHandle, "ScreenDimensions"), m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
|
||||
GLERROR("Bind 5 uniform");
|
||||
|
||||
glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin));
|
||||
@@ -760,8 +738,6 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "FillPercentage"), job->FillPercentage);
|
||||
GLERROR("Bind 19 uniform");
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "AmbientColor"), 1, glm::value_ptr(scene.AmbientColor));
|
||||
GLERROR("Bind 20 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "GlowIntensity"), job->GlowIntensity);
|
||||
GLERROR("END");
|
||||
}
|
||||
|
||||
@@ -779,7 +755,7 @@ void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr<Model
|
||||
GLERROR("Bind 4 uniform");
|
||||
|
||||
GLint Location_ScreenDimensions = glGetUniformLocation(shaderHandle, "ScreenDimensions");
|
||||
glUniform2f(Location_ScreenDimensions, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
glUniform2f(Location_ScreenDimensions, m_Renderer->Resolution().Width, m_Renderer->Resolution().Height);
|
||||
GLERROR("Bind 5 uniform");
|
||||
|
||||
GLint Location_FillPercentage = glGetUniformLocation(shaderHandle, "FillPercentage");
|
||||
@@ -797,11 +773,6 @@ void DrawFinalPass::BindModelUniforms(GLuint shaderHandle, std::shared_ptr<Model
|
||||
GLint Location_AmbientColor = glGetUniformLocation(shaderHandle, "AmbientColor");
|
||||
glUniform4fv(Location_AmbientColor, 1, glm::value_ptr(scene.AmbientColor));
|
||||
|
||||
GLERROR("Bind 10 uniform");
|
||||
GLint Location_GlowIntensity = glGetUniformLocation(shaderHandle, "GlowIntensity");
|
||||
|
||||
glUniform1f(Location_GlowIntensity, job->GlowIntensity);
|
||||
|
||||
GLERROR("END");
|
||||
}
|
||||
|
||||
@@ -811,7 +782,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
case RawModel::MaterialType::Basic:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
if (job->DiffuseTexture.size() > 0 && job->DiffuseTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(job->DiffuseTexture[0]->UVRepeat));
|
||||
@@ -821,7 +792,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
if (job->NormalTexture.size() > 0 && job->NormalTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(job->NormalTexture[0]->UVRepeat));
|
||||
@@ -831,7 +802,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
if (job->SpecularTexture.size() > 0 && job->SpecularTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(job->SpecularTexture[0]->UVRepeat));
|
||||
@@ -841,7 +812,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE4);
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
if (job->IncandescenceTexture.size() > 0 && job->IncandescenceTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(job->IncandescenceTexture[0]->UVRepeat));
|
||||
@@ -854,7 +825,7 @@ void DrawFinalPass::BindExplosionTextures(GLuint shaderHandle, std::shared_ptr<E
|
||||
}
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, job->SplatMap->Texture->m_Texture);
|
||||
|
||||
int texturePosition = GL_TEXTURE1;
|
||||
@@ -929,7 +900,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
case RawModel::MaterialType::Basic:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
if (job->DiffuseTexture.size() > 0 && job->DiffuseTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->DiffuseTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(job->DiffuseTexture[0]->UVRepeat));
|
||||
@@ -939,7 +910,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "DiffuseUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
if (job->NormalTexture.size() > 0 && job->NormalTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->NormalTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(job->NormalTexture[0]->UVRepeat));
|
||||
@@ -949,7 +920,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "NormalUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
if (job->SpecularTexture.size() > 0 && job->SpecularTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->SpecularTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(job->SpecularTexture[0]->UVRepeat));
|
||||
@@ -959,7 +930,7 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "SpecularUVRepeat"), 1, glm::value_ptr(glm::vec2(1.0f, 1.0f)));
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE4);
|
||||
glActiveTexture(GL_TEXTURE3);
|
||||
if (job->IncandescenceTexture.size() > 0 && job->IncandescenceTexture[0]->Texture != nullptr) {
|
||||
glBindTexture(GL_TEXTURE_2D, job->IncandescenceTexture[0]->Texture->m_Texture);
|
||||
glUniform2fv(glGetUniformLocation(shaderHandle, "GlowUVRepeat"), 1, glm::value_ptr(job->IncandescenceTexture[0]->UVRepeat));
|
||||
@@ -972,10 +943,10 @@ void DrawFinalPass::BindModelTextures(GLuint shaderHandle, std::shared_ptr<Model
|
||||
}
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, job->SplatMap->Texture->m_Texture);
|
||||
|
||||
int texturePosition = GL_TEXTURE2;
|
||||
int texturePosition = GL_TEXTURE1;
|
||||
|
||||
//Bind 5 diffuse textures
|
||||
std::string UniformName = "DiffuseUVRepeat";
|
||||
|
||||
@@ -72,8 +72,8 @@ void FrameBuffer::Generate()
|
||||
|
||||
GLenum* bufferTextures = &attachments[0];
|
||||
glDrawBuffers(attachments.size(), bufferTextures);
|
||||
if (GLERROR("GLBufferAttachement error")) {
|
||||
printf(": AttachmentSize %i", attachments.size());
|
||||
if(GLERROR("4")) {
|
||||
printf("hello");
|
||||
}
|
||||
|
||||
if (GLenum frameBufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
|
||||
@@ -110,34 +110,6 @@ void LightCullingPass::FillLightList(RenderScene& scene)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LightCullingPass::OnWindowResize()
|
||||
{
|
||||
SetSSBOSizes();
|
||||
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_FrustumSSBO);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(Frustum)*m_NumberOfTiles, nullptr, GL_DYNAMIC_COPY);
|
||||
GLERROR("m_FrustumSSBO");
|
||||
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightSSBO);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(LightSource) * 200, nullptr, GL_DYNAMIC_COPY);
|
||||
GLERROR("m_LightSSBO");
|
||||
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightGridSSBO);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(LightGrid)*m_NumberOfTiles, nullptr, GL_DYNAMIC_COPY);
|
||||
GLERROR("m_LightGridSSBO");
|
||||
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightOffsetSSBO);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_LightOffset), &m_LightOffset, GL_DYNAMIC_COPY);
|
||||
GLERROR("m_LightOffsetSSBO");
|
||||
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightIndexSSBO);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(float)*m_NumberOfTiles*MAX_LIGHTS_PER_TILE, m_LightIndex, GL_DYNAMIC_COPY);
|
||||
GLERROR("m_LightIndexSSBO");
|
||||
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
||||
}
|
||||
|
||||
void LightCullingPass::InitializeSSBOs()
|
||||
{
|
||||
glGenBuffers(1, &m_FrustumSSBO);
|
||||
|
||||
@@ -15,8 +15,6 @@ PickingPass::~PickingPass()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PickingPass::InitializeTextures()
|
||||
{
|
||||
GenerateTexture(&m_PickingTexture, GL_CLAMP_TO_BORDER, GL_LINEAR,
|
||||
@@ -25,20 +23,11 @@ void PickingPass::InitializeTextures()
|
||||
|
||||
void PickingPass::InitializeFrameBuffers()
|
||||
{
|
||||
/* glGenRenderbuffers(1, &m_DepthBuffer);
|
||||
glGenRenderbuffers(1, &m_DepthBuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);*/
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
|
||||
glGenTextures(1, &m_DepthBuffer);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_DepthBuffer);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, (int)(m_Renderer->GetViewportSize().Width), (int)(m_Renderer->GetViewportSize().Height), 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
|
||||
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthBuffer, GL_DEPTH_ATTACHMENT)));
|
||||
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new RenderBuffer(&m_DepthBuffer, GL_DEPTH_ATTACHMENT)));
|
||||
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_PickingTexture, GL_COLOR_ATTACHMENT0)));
|
||||
m_PickingBuffer.Generate();
|
||||
}
|
||||
@@ -72,9 +61,7 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
m_PickingProgram->Bind();
|
||||
|
||||
if (scene.ClearDepth) {
|
||||
//glClear(GL_DEPTH_BUFFER_BIT);
|
||||
state->Disable(GL_DEPTH_TEST);
|
||||
state->DepthMask(GL_FALSE);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
m_Camera = scene.Camera;
|
||||
|
||||
@@ -247,52 +234,6 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& job : scene.Jobs.SpriteJob) {
|
||||
auto spriteJob = std::dynamic_pointer_cast<SpriteJob>(job);
|
||||
if (!spriteJob->Pickable) {
|
||||
continue;
|
||||
}
|
||||
RenderState jobState;
|
||||
|
||||
if (spriteJob) {
|
||||
if (spriteJob->Depth == 0) {
|
||||
jobState.Disable(GL_DEPTH_TEST);
|
||||
}
|
||||
int pickColor[2] = { m_ColorCounter[0], m_ColorCounter[1] };
|
||||
|
||||
PickingInfo pickInfo;
|
||||
pickInfo.Entity = spriteJob->Entity;
|
||||
pickInfo.World = spriteJob->World;
|
||||
pickInfo.Camera = scene.Camera;
|
||||
|
||||
auto color = m_EntityColors.find(std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera));
|
||||
if (color != m_EntityColors.end()) {
|
||||
pickColor[0] = color->second[0];
|
||||
pickColor[1] = color->second[1];
|
||||
} else {
|
||||
m_EntityColors[std::make_tuple(pickInfo.Entity, pickInfo.World, pickInfo.Camera)] = glm::ivec2(pickColor[0], pickColor[1]);
|
||||
if (m_ColorCounter[0] > 255) {
|
||||
m_ColorCounter[0] = 0;
|
||||
m_ColorCounter[1] += 1;
|
||||
} else {
|
||||
m_ColorCounter[0] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
m_PickingColorsToEntity[glm::ivec2(pickColor[0], pickColor[1])] = pickInfo;
|
||||
|
||||
m_PickingProgram->Bind();
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(spriteJob->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(spriteJob->Model->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, spriteJob->Model->ElementBuffer);
|
||||
glDrawElements(GL_TRIANGLES, spriteJob->EndIndex - spriteJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(spriteJob->StartIndex * sizeof(unsigned int)));
|
||||
}
|
||||
}
|
||||
|
||||
/* for (auto &job : scene.Jobs.TransparentShieldedObjects) {
|
||||
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
|
||||
|
||||
@@ -365,6 +306,8 @@ void PickingPass::Draw(RenderScene& scene)
|
||||
delete state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PickingPass::ClearPicking()
|
||||
{
|
||||
m_PickingColorsToEntity.clear();
|
||||
@@ -378,15 +321,6 @@ void PickingPass::ClearPicking()
|
||||
m_PickingBuffer.Unbind();
|
||||
}
|
||||
|
||||
|
||||
void PickingPass::OnWindowResize()
|
||||
{
|
||||
InitializeTextures();
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||
m_PickingBuffer.Generate();
|
||||
}
|
||||
|
||||
PickData PickingPass::Pick(glm::vec2 screenCoord)
|
||||
{
|
||||
int fbWidth;
|
||||
|
||||
@@ -52,101 +52,6 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
|
||||
continue;
|
||||
}
|
||||
|
||||
glm::mat4 modelMatrix;
|
||||
|
||||
// See a sprite is an SpriteIndicator
|
||||
bool isIndicator = false;
|
||||
if (world->HasComponent(entity.ID, "SpriteIndicator"))
|
||||
{
|
||||
auto indicator = entity["SpriteIndicator"];
|
||||
|
||||
float minScale = (float)(double)indicator["MinScale"];
|
||||
bool hasTeam = indicator["VisibleForSingleTeamOnly"];
|
||||
isIndicator = true;
|
||||
glm::vec3 pos = Transform::AbsolutePosition(entity);
|
||||
|
||||
|
||||
EntityWrapper entityTeam;
|
||||
if (hasTeam && (entity.HasComponent("Team") || entity.FirstParentWithComponent("Team").Valid()) && m_LocalPlayer.World != nullptr) {
|
||||
if (!entity.HasComponent("Team")) {
|
||||
entityTeam = entity.FirstParentWithComponent("Team");
|
||||
}
|
||||
else {
|
||||
entityTeam = entity;
|
||||
}
|
||||
|
||||
ComponentWrapper& entityTeamComponent = entityTeam["Team"];
|
||||
ComponentWrapper& localComponent = m_LocalPlayer["Team"];
|
||||
int entityTeamInt = entityTeamComponent["Team"];
|
||||
int localComponentInt = localComponent["Team"];
|
||||
int SpectatorInt = localComponent["Team"].Enum("Spectator");
|
||||
if (entityTeamInt != localComponentInt && localComponentInt != SpectatorInt) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Code for check if sprite is inside or outside of screen
|
||||
//glm::vec4 projectedPos = m_Camera->ProjectionMatrix() * m_Camera->ViewMatrix() * glm::vec4(pos, 1.0f);
|
||||
//projectedPos /= projectedPos.w;
|
||||
//// Check if inside of outside of screen.
|
||||
//if (projectedPos.x < -1.0f || projectedPos.x > 1.0f || projectedPos.y < -1.0f || projectedPos.y > 1.0f) {
|
||||
// // is outside of screen
|
||||
//} else {
|
||||
// // is inside of screen
|
||||
//}
|
||||
|
||||
|
||||
glm::vec3 zAxis = glm::vec3(0.0f, 1.0f, 0.0f);
|
||||
glm::vec3 normal = pos - m_Camera->Position();
|
||||
|
||||
//float distance = glm::length(normal);
|
||||
//if (distance < minDistance) {
|
||||
// pos = pos - glm::normalize(normal) * (distance - minDistance);
|
||||
//} else if (distance > maxDistance) {
|
||||
// pos = pos - glm::normalize(normal) * (distance - maxDistance);
|
||||
//}
|
||||
normal.y = 0;
|
||||
normal = glm::normalize(normal);
|
||||
glm::vec3 right = glm::cross(normal, zAxis);
|
||||
glm::vec3 up = glm::cross(right, normal);
|
||||
|
||||
modelMatrix[0][0] = right.x;
|
||||
modelMatrix[0][1] = right.y;
|
||||
modelMatrix[0][2] = right.z;
|
||||
modelMatrix[0][3] = 0.0f;
|
||||
|
||||
modelMatrix[1][0] = zAxis.x;
|
||||
modelMatrix[1][1] = zAxis.y;
|
||||
modelMatrix[1][2] = zAxis.z;
|
||||
modelMatrix[1][3] = 0.0f;
|
||||
|
||||
modelMatrix[2][0] = normal.x;
|
||||
modelMatrix[2][1] = normal.y;
|
||||
modelMatrix[2][2] = normal.z;
|
||||
modelMatrix[2][3] = 0.0f;
|
||||
|
||||
modelMatrix[3][0] = pos.x;
|
||||
modelMatrix[3][1] = pos.y;
|
||||
modelMatrix[3][2] = pos.z;
|
||||
modelMatrix[3][3] = 1.0f;
|
||||
|
||||
glm::mat4 tranformationMatrix = modelMatrix * glm::scale(Transform::AbsoluteScale(entity));
|
||||
glm::vec4 tmp = tranformationMatrix * glm::vec4(glm::vec3(0.5, 0.5, 0), 1.0f);
|
||||
glm::vec2 projectedTopRight = m_Camera->WorldToScreen(glm::vec3(tmp), m_Renderer->GetViewportSize());
|
||||
tmp = tranformationMatrix * glm::vec4(glm::vec3(-0.5, -0.5, 0), 1.0f);
|
||||
glm::vec2 projectedBottomLeft = m_Camera->WorldToScreen(glm::vec3(tmp), m_Renderer->GetViewportSize());
|
||||
|
||||
float diag = glm::length(projectedBottomLeft - projectedTopRight);
|
||||
if (diag < minScale) {
|
||||
tranformationMatrix = tranformationMatrix * glm::scale(glm::vec3(minScale / diag, minScale / diag, minScale / diag));
|
||||
}
|
||||
modelMatrix = tranformationMatrix;
|
||||
}
|
||||
else {
|
||||
modelMatrix = Transform::ModelMatrix(entity.ID, world);
|
||||
}
|
||||
|
||||
|
||||
std::string diffuseResource = cSprite["DiffuseTexture"];
|
||||
std::string glowResource = cSprite["GlowMap"];
|
||||
bool depthSorted = cSprite["DepthSort"];
|
||||
@@ -162,7 +67,11 @@ void RenderSystem::fillSprites(std::list<std::shared_ptr<RenderJob>>& jobs, Worl
|
||||
fillColor = (glm::vec4)fillComponent["Color"];
|
||||
}
|
||||
|
||||
std::shared_ptr<SpriteJob> spriteJob = std::shared_ptr<SpriteJob>(new SpriteJob(cSprite, m_Camera, modelMatrix, world, fillColor, fillPercentage, depthSorted, isIndicator));
|
||||
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, world);
|
||||
//modelMatrix *= m_Camera->BillboardMatrix();
|
||||
|
||||
|
||||
std::shared_ptr<SpriteJob> spriteJob = std::shared_ptr<SpriteJob>(new SpriteJob(cSprite, m_Camera, modelMatrix, world, fillColor, fillPercentage, depthSorted));
|
||||
|
||||
jobs.push_back(spriteJob);
|
||||
}
|
||||
@@ -184,6 +93,7 @@ bool RenderSystem::isEntityVisible(EntityWrapper& entity)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "Rendering/Renderer.h"
|
||||
|
||||
std::unordered_map<GLFWwindow*, Renderer*> Renderer::m_WindowToRenderer;
|
||||
|
||||
void Renderer::Initialize()
|
||||
{
|
||||
InitializeWindow();
|
||||
@@ -14,6 +12,7 @@ void Renderer::Initialize()
|
||||
m_TextPass = new TextPass();
|
||||
m_TextPass->Initialize();
|
||||
|
||||
|
||||
/* m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.obj");
|
||||
m_UnitQuad = ResourceManager::Load<Model>("Models/Core/UnitQuad.obj");
|
||||
m_UnitSphere = ResourceManager::Load<Model>("Models/Core/UnitSphere.obj");*/
|
||||
@@ -21,17 +20,6 @@ void Renderer::Initialize()
|
||||
m_ImGuiRenderPass = new ImGuiRenderPass(this, m_EventBroker);
|
||||
}
|
||||
|
||||
void Renderer::glfwFrameBufferCallback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
Renderer* currentRenderer = m_WindowToRenderer[window];
|
||||
currentRenderer->m_ViewportSize = Rectangle(width, height);
|
||||
currentRenderer->m_DrawFinalPass->OnWindowResize();
|
||||
currentRenderer->m_LightCullingPass->OnWindowResize();
|
||||
currentRenderer->m_PickingPass->OnWindowResize();
|
||||
currentRenderer->m_DrawBloomPass->OnWindowResize();
|
||||
}
|
||||
|
||||
void Renderer::InitializeWindow()
|
||||
{
|
||||
// Initialize GLFW
|
||||
@@ -51,7 +39,6 @@ void Renderer::InitializeWindow()
|
||||
LOG_ERROR("GLFW: Failed to create window");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
glfwSetFramebufferSizeCallback(m_Window, &glfwFrameBufferCallback);
|
||||
glfwMakeContextCurrent(m_Window);
|
||||
|
||||
// GL version info
|
||||
@@ -72,10 +59,8 @@ void Renderer::InitializeWindow()
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
m_WindowToRenderer[m_Window] = this;
|
||||
|
||||
int windowSize[2];
|
||||
glfwGetFramebufferSize(m_Window, &windowSize[0], &windowSize[1]);
|
||||
glfwGetWindowSize(m_Window, &windowSize[0], &windowSize[1]);
|
||||
m_ViewportSize = Rectangle(windowSize[0], windowSize[1]);
|
||||
}
|
||||
|
||||
@@ -108,71 +93,40 @@ void Renderer::Update(double dt)
|
||||
|
||||
void Renderer::Draw(RenderFrame& frame)
|
||||
{
|
||||
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0SceneLowRes\0BloomLowRes\0Gaussian\0Picking\0Ambient Occlusion");
|
||||
|
||||
ImGui::SliderFloat("SSAO sample radius", &m_SSAO_Radius, 0.01f, 5.0f);
|
||||
ImGui::SliderFloat("SSAO bias", &m_SSAO_Bias, 0.0f, 0.1f);
|
||||
ImGui::SliderFloat("SSAO contrast", &m_SSAO_Contrast, 0.0f, 10.0f);
|
||||
ImGui::SliderFloat("SSAO IntensityScale", &m_SSAO_IntensityScale, 0.0f, 10.0f);
|
||||
ImGui::SliderInt("SSAO Number of Samples", &m_SSAO_NumOfSamples, 2, 100);
|
||||
ImGui::SliderInt("SSAO Number of Turns", &m_SSAO_NumOfTurns, 0, 50);
|
||||
m_SSAOPass->Setting(m_SSAO_Radius, m_SSAO_Bias, m_SSAO_Contrast, m_SSAO_IntensityScale, m_SSAO_NumOfSamples, m_SSAO_NumOfTurns);
|
||||
ImGui::Combo("Draw textures", &m_DebugTextureToDraw, "Final\0Scene\0Bloom\0SceneLowRes\0BloomLowRes\0Gaussian\0Picking");
|
||||
//clear buffer 0
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
//Clear other buffers
|
||||
PerformanceTimer::StartTimer("Renderer-ClearBuffers");
|
||||
m_PickingPass->ClearPicking();
|
||||
m_DrawFinalPass->ClearBuffer();
|
||||
m_DrawBloomPass->ClearBuffer();
|
||||
PerformanceTimer::StopTimer("Renderer-ClearBuffers");
|
||||
for (auto scene : frame.RenderScenes) {
|
||||
PerformanceTimer::StartTimer("Renderer-Depth");
|
||||
m_PickingPass->Draw(*scene);
|
||||
GLERROR("Drawing pickingpass");
|
||||
PerformanceTimer::StopTimer("Renderer-Depth");
|
||||
}
|
||||
PerformanceTimer::StartTimer("AO generation");
|
||||
m_SSAOPass->Draw(m_PickingPass->DepthBuffer(), frame.RenderScenes.front()->Camera);
|
||||
GLuint ao = m_SSAOPass->SSAOTexture();
|
||||
PerformanceTimer::StopTimer("AO generation");
|
||||
|
||||
for (auto scene : frame.RenderScenes){
|
||||
|
||||
PerformanceTimer::StartTimer("Renderer-Drawing PickingPass");
|
||||
SortRenderJobsByDepth(*scene);
|
||||
GLERROR("SortByDepth");
|
||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Generate Frustrums");
|
||||
m_PickingPass->Draw(*scene);
|
||||
GLERROR("Drawing pickingpass");
|
||||
m_LightCullingPass->GenerateNewFrustum(*scene);
|
||||
GLERROR("Generate frustums");
|
||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Filling Light List");
|
||||
m_LightCullingPass->FillLightList(*scene);
|
||||
GLERROR("Filling light list");
|
||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Light Culling");
|
||||
m_LightCullingPass->CullLights(*scene);
|
||||
GLERROR("LightCulling");
|
||||
m_DrawFinalPass->Draw(*scene, ao);
|
||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Geometry+Light");
|
||||
m_DrawFinalPass->Draw(*scene);
|
||||
GLERROR("Draw Geometry+Light");
|
||||
//m_DrawScenePass->Draw(*scene);
|
||||
|
||||
PerformanceTimer::StartTimerAndStopPrevious("Renderer-Draw Text");
|
||||
m_TextPass->Draw(*scene, *m_DrawFinalPass->FinalPassFrameBuffer());
|
||||
GLERROR("Draw Text");
|
||||
PerformanceTimer::StopTimer("Renderer-Draw Text");
|
||||
}
|
||||
|
||||
PerformanceTimer::StartTimer("Renderer-Draw Bloom");
|
||||
}
|
||||
m_DrawBloomPass->Draw(m_DrawFinalPass->BloomTexture());
|
||||
PerformanceTimer::StopTimer("Renderer-Draw Bloom");
|
||||
|
||||
if (m_DebugTextureToDraw == 0) {
|
||||
PerformanceTimer::StartTimer("Renderer-Color Correction Pass");
|
||||
m_DrawColorCorrectionPass->Draw(m_DrawFinalPass->SceneTexture(), m_DrawBloomPass->GaussianTexture(), m_DrawFinalPass->SceneTextureLowRes(), m_DrawFinalPass->BloomTextureLowRes(), frame.Gamma, frame.Exposure);
|
||||
PerformanceTimer::StopTimer("Renderer-Color Correction Pass");
|
||||
}
|
||||
|
||||
PerformanceTimer::StartTimer("Renderer-Misc Debug Draws");
|
||||
if (m_DebugTextureToDraw == 1) {
|
||||
m_DrawScreenQuadPass->Draw(m_DrawFinalPass->SceneTexture());
|
||||
}
|
||||
@@ -191,16 +145,10 @@ void Renderer::Draw(RenderFrame& frame)
|
||||
if (m_DebugTextureToDraw == 6) {
|
||||
m_DrawScreenQuadPass->Draw(m_PickingPass->PickingTexture());
|
||||
}
|
||||
if (m_DebugTextureToDraw == 7) {
|
||||
m_DrawScreenQuadPass->Draw(m_SSAOPass->SSAOTexture());
|
||||
}
|
||||
PerformanceTimer::StopTimer("Renderer-Misc Debug Draws");
|
||||
|
||||
PerformanceTimer::StartTimer("Renderer-ImGuiRenderPass");
|
||||
m_ImGuiRenderPass->Draw();
|
||||
GLERROR("Imgui draw");
|
||||
glfwSwapBuffers(m_Window);
|
||||
PerformanceTimer::StopTimer("Renderer-ImGuiRenderPass");
|
||||
}
|
||||
|
||||
PickData Renderer::Pick(glm::vec2 screenCoord)
|
||||
@@ -243,5 +191,4 @@ void Renderer::InitializeRenderPasses()
|
||||
m_DrawScreenQuadPass = new DrawScreenQuadPass(this);
|
||||
m_DrawBloomPass = new DrawBloomPass(this);
|
||||
m_DrawColorCorrectionPass = new DrawColorCorrectionPass(this);
|
||||
m_SSAOPass = new SSAOPass(this);
|
||||
}
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
#include "Rendering/SSAOPass.h"
|
||||
|
||||
SSAOPass::SSAOPass(IRenderer* renderer)
|
||||
{
|
||||
m_Renderer = renderer;
|
||||
|
||||
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
|
||||
|
||||
InitializeBuffer();
|
||||
InitializeShaderProgram();
|
||||
Setting(0.1f, 0.012f, 1.0f, 1.0f, 13, 7);
|
||||
|
||||
m_DrawBloomPass = new DrawBloomPass(renderer);
|
||||
}
|
||||
|
||||
void SSAOPass::InitializeShaderProgram()
|
||||
{
|
||||
m_SSAOProgram = ResourceManager::Load<ShaderProgram>("##SSAOProgram");
|
||||
m_SSAOProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/SSAO.vert.glsl")));
|
||||
m_SSAOProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/SSAO.frag.glsl")));
|
||||
m_SSAOProgram->Compile();
|
||||
m_SSAOProgram->Link();
|
||||
|
||||
m_SSAOViewSpaceZProgram = ResourceManager::Load<ShaderProgram>("##SSAOViewSpaceZProgram");
|
||||
m_SSAOViewSpaceZProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/SSAO.vert.glsl")));
|
||||
m_SSAOViewSpaceZProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/SSAOViewSpaceZ.frag.glsl")));
|
||||
m_SSAOViewSpaceZProgram->Compile();
|
||||
m_SSAOViewSpaceZProgram->Link();
|
||||
}
|
||||
|
||||
|
||||
void SSAOPass::InitializeBuffer()
|
||||
{
|
||||
GenerateTexture(&m_SSAOTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_R8, GL_RED, GL_FLOAT);
|
||||
|
||||
m_SSAOFramBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SSAOTexture, GL_COLOR_ATTACHMENT0)));
|
||||
m_SSAOFramBuffer.Generate();
|
||||
|
||||
GenerateTexture(&m_SSAOViewSpaceZTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_R32F, GL_RED, GL_FLOAT);
|
||||
|
||||
m_SSAOViewSpaceZFramBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SSAOViewSpaceZTexture, GL_COLOR_ATTACHMENT0)));
|
||||
m_SSAOViewSpaceZFramBuffer.Generate();
|
||||
}
|
||||
|
||||
void SSAOPass::ClearBuffer()
|
||||
{
|
||||
m_SSAOFramBuffer.Bind();
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
m_SSAOFramBuffer.Unbind();
|
||||
|
||||
m_SSAOViewSpaceZFramBuffer.Bind();
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
m_SSAOViewSpaceZFramBuffer.Unbind();
|
||||
}
|
||||
|
||||
void SSAOPass::Setting(float radius, float bias, float contrast, float intensityScale, int numOfSamples, int NumOfTurns) {
|
||||
m_Radius = radius;
|
||||
m_Bias = bias;
|
||||
m_Contrast = contrast;
|
||||
m_IntensityScale = intensityScale;
|
||||
m_NumOfSamples = numOfSamples;
|
||||
m_NumOfTurns = NumOfTurns;
|
||||
}
|
||||
|
||||
void SSAOPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
|
||||
{
|
||||
glGenTextures(1, texture);
|
||||
glBindTexture(GL_TEXTURE_2D, *texture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapping);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, dimensions.x, dimensions.y, 0, format, type, nullptr);
|
||||
GLERROR("Texture initialization failed");
|
||||
}
|
||||
|
||||
void SSAOPass::Draw(GLuint depthBuffer, Camera* camera)
|
||||
{
|
||||
SSAOPassState state;
|
||||
GLuint viewSpaceZPShaderHandle = m_SSAOViewSpaceZProgram->GetHandle();
|
||||
GLuint SSAOShaderHandle = m_SSAOProgram->GetHandle();
|
||||
|
||||
m_SSAOViewSpaceZFramBuffer.Bind();
|
||||
m_SSAOViewSpaceZProgram->Bind();
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, depthBuffer);
|
||||
glm::vec3 clipInfo = glm::vec3(
|
||||
(camera->NearClip() * camera->FarClip()),
|
||||
(camera->NearClip() - camera->FarClip()),
|
||||
(camera->FarClip())
|
||||
);
|
||||
/*glm::vec3 clipInfo = glm::vec3(
|
||||
(camera->NearClip()),
|
||||
(-1.0f),
|
||||
(+1.0f)
|
||||
);*/
|
||||
glUniform3fv(glGetUniformLocation(viewSpaceZPShaderHandle, "ClipInfo"), 1, glm::value_ptr(clipInfo));
|
||||
|
||||
glBindVertexArray(m_ScreenQuad->VAO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex + 1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
|
||||
glm::vec4 projInfo = glm::vec4(
|
||||
((1.0 - camera->ProjectionMatrix()[0][2]) / camera->ProjectionMatrix()[0][0]),
|
||||
(-2.0 / (m_Renderer->GetViewportSize().Width * camera->ProjectionMatrix()[0][0])),
|
||||
((1.0 + camera->ProjectionMatrix()[1][2]) / camera->ProjectionMatrix()[1][1]),
|
||||
(-2.0 / (m_Renderer->GetViewportSize().Height * camera->ProjectionMatrix()[1][1]))
|
||||
);
|
||||
|
||||
|
||||
m_SSAOFramBuffer.Bind();
|
||||
m_SSAOProgram->Bind();
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, m_SSAOViewSpaceZTexture);
|
||||
|
||||
// How many pixel there are in a 1m long object 1m away from the camera
|
||||
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uProjScale"), m_Renderer->GetViewportSize().Height / (-2.0f * glm::tan(camera->FOV() * 0.5f)));
|
||||
|
||||
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uRadius"), m_Radius);
|
||||
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uBias"), m_Bias);
|
||||
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uContrast"), m_Contrast);
|
||||
glUniform1f(glGetUniformLocation(SSAOShaderHandle, "uIntensityScale"), m_IntensityScale);
|
||||
glUniform1i(glGetUniformLocation(SSAOShaderHandle, "uNumOfSamples"), m_NumOfSamples);
|
||||
glUniform1i(glGetUniformLocation(SSAOShaderHandle, "uNumOfTurns"), m_NumOfTurns);;
|
||||
|
||||
glUniform4fv(glGetUniformLocation(SSAOShaderHandle, "uProjInfo"), 1, glm::value_ptr(projInfo));
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].material->EndIndex - m_ScreenQuad->MaterialGroups()[0].material->StartIndex + 1
|
||||
, GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].material->StartIndex);
|
||||
|
||||
m_DrawBloomPass->ClearBuffer();
|
||||
m_DrawBloomPass->Draw(m_SSAOTexture);
|
||||
}
|
||||
|
||||
void ComputeAO(GLuint depthBuffer, Camera* camera) {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#include "Rendering/SSAOPassState.h"
|
||||
|
||||
|
||||
SSAOPassState::SSAOPassState()
|
||||
{
|
||||
//BindFramebuffer(0);
|
||||
Disable(GL_BLEND);
|
||||
Disable(GL_DEPTH_TEST);
|
||||
Disable(GL_CULL_FACE);
|
||||
}
|
||||
|
||||
SSAOPassState::~SSAOPassState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -98,7 +98,8 @@ void ShaderProgram::AddShader(std::shared_ptr<Shader> shader)
|
||||
|
||||
void ShaderProgram::Compile()
|
||||
{
|
||||
if (m_ShaderProgramHandle == 0) {
|
||||
if (m_ShaderProgramHandle == 0)
|
||||
{
|
||||
m_ShaderProgramHandle = glCreateProgram();
|
||||
}
|
||||
|
||||
|
||||
+8
-14
@@ -26,8 +26,6 @@
|
||||
#include "Network/MultiplayerSnapshotFilter.h"
|
||||
#include "Game/Systems/AmmunitionHUDSystem.h"
|
||||
#include "Game/Systems/KillFeedSystem.h"
|
||||
#include "GUI/ButtonSystem.h"
|
||||
#include "GUI/MainMenuSystem.h"
|
||||
|
||||
|
||||
Game::Game(int argc, char* argv[])
|
||||
@@ -74,6 +72,11 @@ Game::Game(int argc, char* argv[])
|
||||
m_InputProxy->AddHandler<MouseInputHandler>();
|
||||
m_InputProxy->LoadBindings("Input.ini");
|
||||
|
||||
// Create the root level GUI frame
|
||||
m_FrameStack = new GUI::Frame(m_EventBroker);
|
||||
m_FrameStack->Width = m_Renderer->Resolution().Width;
|
||||
m_FrameStack->Height = m_Renderer->Resolution().Height;
|
||||
|
||||
// Create a world
|
||||
m_World = new World(m_EventBroker);
|
||||
std::string mapToLoad = m_Config->Get<std::string>("Debug.LoadMap", "");
|
||||
@@ -129,8 +132,6 @@ Game::Game(int argc, char* argv[])
|
||||
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<AmmunitionHUDSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<ButtonSystem>(updateOrderLevel, m_Renderer);
|
||||
m_SystemPipeline->AddSystem<MainMenuSystem>(updateOrderLevel, m_Renderer);
|
||||
// Populate Octree with collidables
|
||||
++updateOrderLevel;
|
||||
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
||||
@@ -167,6 +168,7 @@ Game::~Game()
|
||||
delete m_NetworkServer;
|
||||
}
|
||||
delete m_World;
|
||||
delete m_FrameStack;
|
||||
delete m_InputProxy;
|
||||
delete m_InputManager;
|
||||
delete m_RenderFrame;
|
||||
@@ -185,38 +187,30 @@ void Game::Tick()
|
||||
// Handle input in a weird looking but responsive way
|
||||
m_EventBroker->Process<InputManager>();
|
||||
m_EventBroker->Swap();
|
||||
PerformanceTimer::StartTimer("InputManager");
|
||||
m_InputManager->Update(dt);
|
||||
m_EventBroker->Swap();
|
||||
PerformanceTimer::StartTimerAndStopPrevious("InputProxy");
|
||||
m_InputProxy->Update(dt);
|
||||
m_EventBroker->Swap();
|
||||
m_InputProxy->Process();
|
||||
m_EventBroker->Swap();
|
||||
|
||||
PerformanceTimer::StartTimerAndStopPrevious("SoundManager");
|
||||
m_SoundManager->Update(dt);
|
||||
|
||||
// Update network
|
||||
PerformanceTimer::StartTimerAndStopPrevious("Network");
|
||||
m_EventBroker->Process<MultiplayerSnapshotFilter>();
|
||||
if (m_NetworkClient != nullptr) {
|
||||
m_NetworkClient->Update();
|
||||
m_NetworkClient->Update(dt);
|
||||
}
|
||||
if (m_NetworkServer != nullptr) {
|
||||
m_NetworkServer->Update();
|
||||
m_NetworkServer->Update(dt);
|
||||
}
|
||||
//m_SoundManager->Update(dt);
|
||||
|
||||
// Iterate through systems and update world!
|
||||
PerformanceTimer::StartTimerAndStopPrevious("SystemPipeline");
|
||||
m_EventBroker->Process<SystemPipeline>();
|
||||
m_SystemPipeline->Update(dt);
|
||||
PerformanceTimer::StartTimerAndStopPrevious("RendererUpdate");
|
||||
m_Renderer->Update(dt);
|
||||
PerformanceTimer::StartTimerAndStopPrevious("RendererDraw");
|
||||
m_Renderer->Draw(*m_RenderFrame);
|
||||
PerformanceTimer::StopTimer("RendererDraw");
|
||||
m_RenderFrame->Clear();
|
||||
m_EventBroker->Swap();
|
||||
m_EventBroker->Clear();
|
||||
|
||||
@@ -24,7 +24,7 @@ void HealthSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cHea
|
||||
|
||||
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
|
||||
{
|
||||
if (!IsServer && m_NetworkEnabled || !e.Victim.Valid()) {
|
||||
if (!IsServer && m_NetworkEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,9 @@ PlayerMovementSystem::~PlayerMovementSystem()
|
||||
void PlayerMovementSystem::Update(double dt)
|
||||
{
|
||||
updateMovementControllers(dt);
|
||||
updateVelocity(dt);
|
||||
if (LocalPlayer.Valid()) {
|
||||
updateVelocity(LocalPlayer, dt);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerMovementSystem::updateMovementControllers(double dt)
|
||||
@@ -221,15 +223,11 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
||||
}
|
||||
|
||||
|
||||
void PlayerMovementSystem::updateVelocity(double dt)
|
||||
void PlayerMovementSystem::updateVelocity(EntityWrapper player, double dt)
|
||||
{
|
||||
// Only apply velocity to local player
|
||||
if (!LocalPlayer.Valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ComponentWrapper& cTransform = LocalPlayer["Transform"];
|
||||
ComponentWrapper& cPhysics = LocalPlayer["Physics"];
|
||||
ComponentWrapper& cTransform = player["Transform"];
|
||||
ComponentWrapper& cPhysics = player["Physics"];
|
||||
glm::vec3& velocity = cPhysics["Velocity"];
|
||||
bool isOnGround = (bool)cPhysics["IsOnGround"];
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//This should be set by the config anyway.
|
||||
float PlayerSpawnSystem::m_RespawnTime = 15.0f;
|
||||
|
||||
PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
|
||||
PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
|
||||
: System(params)
|
||||
, m_Timer(0.f)
|
||||
{
|
||||
@@ -49,7 +49,7 @@ void PlayerSpawnSystem::Update(double dt)
|
||||
}
|
||||
|
||||
// Spawn the player!
|
||||
EntityWrapper player = SpawnerSystem::Spawn(spawner, EntityWrapper::Invalid, "Player");
|
||||
EntityWrapper player = SpawnerSystem::Spawn(spawner);
|
||||
// Set the player team affiliation
|
||||
player["Team"]["Team"] = req.Team;
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#include "Systems/SpawnerSystem.h"
|
||||
#include "Collision/Collision.h"
|
||||
|
||||
SpawnerSystem::SpawnerSystem(SystemParams params)
|
||||
SpawnerSystem::SpawnerSystem(SystemParams params)
|
||||
: System(params)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_OnSpawnerSpawn, &SpawnerSystem::OnSpawnerSpawn);
|
||||
}
|
||||
|
||||
EntityWrapper SpawnerSystem::Spawn(EntityWrapper spawner, EntityWrapper parent /*= EntityWrapper::Invalid*/, const std::string& dontCollideComponent)
|
||||
EntityWrapper SpawnerSystem::Spawn(EntityWrapper spawner, EntityWrapper parent /*= EntityWrapper::Invalid*/)
|
||||
{
|
||||
// Spawn the entity in the parent's world if it exists, otherwise in the spawner's world
|
||||
World* world = parent.World;
|
||||
@@ -15,41 +14,17 @@ EntityWrapper SpawnerSystem::Spawn(EntityWrapper spawner, EntityWrapper parent /
|
||||
world = spawner.World;
|
||||
}
|
||||
|
||||
// Load the entity file and parse it
|
||||
const std::string& entityFilePath = spawner["Spawner"]["EntityFile"];
|
||||
auto entityFile = ResourceManager::Load<EntityFile>(entityFilePath);
|
||||
if (entityFile == nullptr) {
|
||||
return EntityWrapper::Invalid;
|
||||
}
|
||||
EntityFileParser parser(entityFile);
|
||||
EntityWrapper spawnedEntity(world, parser.MergeEntities(world, parent.ID));
|
||||
|
||||
//If the spawned entity is collideable, then we must not spawn it where it collides with something that
|
||||
//has a dontCollideComponent attached.
|
||||
bool spawnOnCollidable = dontCollideComponent.empty() || !spawnedEntity.HasComponent("Collidable");
|
||||
if (!spawnOnCollidable) {
|
||||
boost::optional<EntityAABB> optBox = Collision::EntityAbsoluteAABB(spawnedEntity);
|
||||
//If we can't calculate the box for some reason, then just spawn somewhere anyway.
|
||||
if (!optBox) {
|
||||
spawnOnCollidable = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Find any SpawnPoints existing as children of spawner
|
||||
auto children = spawner.World->GetChildren(spawner.ID);
|
||||
std::vector<EntityWrapper> spawnPoints;
|
||||
for (auto kv = children.first; kv != children.second; ++kv) {
|
||||
const EntityID& child = kv->second;
|
||||
if (spawner.World->HasComponent(child, "SpawnPoint")) {
|
||||
EntityWrapper spawnPoint = EntityWrapper(spawner.World, child);
|
||||
if (spawnOnCollidable || !spawnedEntityIsColliding(spawnedEntity, spawnPoint, dontCollideComponent)) {
|
||||
spawnPoints.push_back(spawnPoint);
|
||||
}
|
||||
spawnPoints.push_back(EntityWrapper(spawner.World, child));
|
||||
}
|
||||
}
|
||||
|
||||
// Choose a random SpawnPoint
|
||||
// If there are no children, or if they are all blocked, then the entity will be spawned at the spawner itself.
|
||||
EntityWrapper spawnPoint = spawner;
|
||||
if (!spawnPoints.empty()) {
|
||||
if (spawnPoints.size() > 1) {
|
||||
@@ -64,61 +39,25 @@ EntityWrapper SpawnerSystem::Spawn(EntityWrapper spawner, EntityWrapper parent /
|
||||
}
|
||||
}
|
||||
|
||||
// Load the entity file and parse it
|
||||
const std::string& entityFilePath = spawner["Spawner"]["EntityFile"];
|
||||
auto entityFile = ResourceManager::Load<EntityFile>(entityFilePath);
|
||||
if (entityFile == nullptr) {
|
||||
return EntityWrapper::Invalid;
|
||||
}
|
||||
EntityFileParser parser(entityFile);
|
||||
EntityWrapper spawnedEntity(world, parser.MergeEntities(world, parent.ID));
|
||||
|
||||
if (spawnPoint != parent) {
|
||||
transformEntityToSpawnPoint(spawnedEntity, spawnPoint);
|
||||
// Set its position and orientation to that of the SpawnPoint
|
||||
spawnedEntity["Transform"]["Position"] = Transform::AbsolutePosition(spawnPoint.World, spawnPoint.ID);
|
||||
// TODO: Quaternions, bitch
|
||||
spawnedEntity["Transform"]["Orientation"] = glm::eulerAngles(Transform::AbsoluteOrientation(spawnPoint));
|
||||
}
|
||||
|
||||
return spawnedEntity;
|
||||
}
|
||||
|
||||
void SpawnerSystem::transformEntityToSpawnPoint(EntityWrapper spawnedEntity, EntityWrapper spawnPoint)
|
||||
{
|
||||
// Set its position and orientation to that of the SpawnPoint
|
||||
spawnedEntity["Transform"]["Position"] = Transform::AbsolutePosition(spawnPoint.World, spawnPoint.ID);
|
||||
// TODO: Quaternions, bitch
|
||||
spawnedEntity["Transform"]["Orientation"] = glm::eulerAngles(Transform::AbsoluteOrientation(spawnPoint));
|
||||
}
|
||||
|
||||
bool SpawnerSystem::spawnedEntityIsColliding(EntityWrapper spawnedEntity, EntityWrapper spawnPoint, const std::string& dontCollideComponent)
|
||||
{
|
||||
transformEntityToSpawnPoint(spawnedEntity, spawnPoint);
|
||||
//Check if the spawned entity collides with anything, and if so, continue to the next spawnpoint.
|
||||
EntityAABB spawnedBox = *Collision::EntityAbsoluteAABB(spawnedEntity);
|
||||
const ComponentPool* otherSpawnedEntities = spawnPoint.World->GetComponents(dontCollideComponent);
|
||||
for (const auto& obj : *otherSpawnedEntities) {
|
||||
if (spawnedEntity.ID == obj.EntityID) {
|
||||
continue;
|
||||
}
|
||||
EntityWrapper otherEntity = EntityWrapper(spawnPoint.World, obj.EntityID);
|
||||
if (!otherEntity.HasComponent("Collidable")) {
|
||||
continue;
|
||||
}
|
||||
auto otherBox = Collision::EntityAbsoluteAABB(otherEntity);
|
||||
if (!otherBox) {
|
||||
continue;
|
||||
}
|
||||
if (Collision::AABBVsAABB(spawnedBox, *otherBox)) {
|
||||
if (!spawnedBox.Entity.HasComponent("Model")) {
|
||||
return true;
|
||||
}
|
||||
RawModel* model = nullptr;
|
||||
try {
|
||||
model = ResourceManager::Load<RawModel, true>(otherEntity["Model"]["Resource"]);
|
||||
} catch (const std::exception&) {
|
||||
}
|
||||
|
||||
if (model != nullptr && Collision::AABBvsTriangles(
|
||||
spawnedBox,
|
||||
model->Vertices(),
|
||||
model->m_Indices,
|
||||
Transform::ModelMatrix(otherEntity))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SpawnerSystem::OnSpawnerSpawn(Events::SpawnerSpawn& e)
|
||||
{
|
||||
EntityWrapper spawnedEntity = Spawn(e.Spawner, e.Parent);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user