Compare commits

..

2 Commits

Author SHA1 Message Date
Teejoon a806f9b1e3 WIP 2016-03-01 12:04:26 +01:00
Teejoon 22748f6594 Merge branch 'master' of https://github.com/teamfisk/TacticalZ into RenderSettings
Conflicts:
	src/Engine/Rendering/CubeMapPass.cpp
2016-02-29 11:46:08 +01:00
121 changed files with 1383 additions and 23672 deletions
+1 -1
Submodule assets updated: 72530423ad...10a611659d
+1 -3
View File
@@ -12,9 +12,7 @@ namespace Events
struct Captured : Event struct Captured : Event
{ {
int TeamNumberThatCapturedCapturePoint; int TeamNumberThatCapturedCapturePoint;
EntityID CapturePointTakenID; EntityID CapturePointID;
EntityWrapper BlueTeamNextCapturePoint;
EntityWrapper RedTeamNextCapturePoint;
}; };
} }
+153 -10
View File
@@ -1,21 +1,164 @@
#ifndef EntityFile_h__ #ifndef EntityFile_h__
#define EntityFile_h__ #define EntityFile_h__
#include "World.h" #include <stack>
#include "EntityXMLFile.h" #include <boost/lexical_cast.hpp>
#include "EntityXMLFilePreprocessor.h" #include <xercesc/util/XercesDefs.hpp>
#include "EntityXMLFileParser.h" #include <xercesc/util/PlatformUtils.hpp>
#include "EntityWrapper.h" #include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/XMLReaderFactory.hpp>
#include <xercesc/sax2/DefaultHandler.hpp>
#include <xercesc/sax2/Attributes.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLChar.hpp>
#include <xercesc/sax2/DefaultHandler.hpp>
#include <xercesc/framework/XMLDocumentHandler.hpp>
#include <xercesc/framework/psvi/XSElementDeclaration.hpp>
#include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp>
#include <xercesc/framework/psvi/XSParticle.hpp>
#include <xercesc/framework/psvi/XSModelGroup.hpp>
#include <xercesc/framework/psvi/XSAnnotation.hpp>
#include <xercesc/framework/psvi/XSValue.hpp>
#include <xercesc/framework/XMLGrammarPoolImpl.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMLSInput.hpp>
#include <xercesc/dom/DOMElement.hpp>
class EntityFile : private World, public Resource #include "../GLM.h"
#include "Util/XercesString.h"
#include "ResourceManager.h"
#include "Entity.h"
#include "ComponentInfo.h"
class EntityFileHandler
{ {
friend class EntityFileSAXHandler;
public: public:
EntityFile(std::string path); // @param EntityID The entity found
// @param EntityID The parent of the entity
EntityWrapper MergeInto(World* other); typedef std::function<void(EntityID, EntityID, const std::string&)> OnStartEntityCallback;
void SetStartEntityCallback(OnStartEntityCallback c) { m_OnStartEntityCallback = c; }
// @param EntityID The entity the component corresponds to
// @param std::string Type name of the component
typedef std::function<void(EntityID, const std::string&)> OnStartComponentCallback;
void SetStartComponentCallback(OnStartComponentCallback c) { m_OnStartComponentCallback = c; }
// @param EntityID Entity
// @param std::string Component name
// @param std::string Field name
// @param std::map<std::string, std::string> Field attribute names and values
typedef std::function<void(EntityID, const std::string&, const std::string&, const std::map<std::string, std::string>&)> OnStartFieldCallback;
void SetStartFieldCallback(OnStartFieldCallback c) { m_OnStartFieldCallback = c; }
// @param EntityID Entity
// @param std::string Component name
// @param std::string Field name
// @param char* Field data
typedef std::function<void(EntityID, const std::string&, const std::string&, const char*)> OnStartFieldDataCallback;
void SetStartFieldDataCallback(OnStartFieldDataCallback c) { m_OnStartFieldDataCallback = c; }
private: private:
EntityID m_RootEntity = EntityID_Invalid; OnStartEntityCallback m_OnStartEntityCallback = nullptr;
OnStartComponentCallback m_OnStartComponentCallback = nullptr;
OnStartFieldCallback m_OnStartFieldCallback = nullptr;
OnStartFieldDataCallback m_OnStartFieldDataCallback = nullptr;
};
class EntityFileSAXHandler : public xercesc::DefaultHandler
{
public:
enum class State
{
Unknown,
Entity,
Component,
ComponentField
};
EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader);
void startElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname, const xercesc::Attributes& attrs) override;
void characters(const XMLCh* const chars, const XMLSize_t length) override;
void endElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname) override;
void warning(const xercesc::SAXParseException& e);
void error(const xercesc::SAXParseException& e);
void fatalError(const xercesc::SAXParseException& e);
private:
const EntityFileHandler* m_Handler;
xercesc::XMLGrammarPool* m_GrammarPool;
xercesc::SAX2XMLReader* m_Reader;
//State m_CurrentScope = State::Unknown;
std::stack<State> m_StateStack;
unsigned int m_NextEntityID = 0;
std::stack<EntityID> m_EntityStack;
std::string m_CurrentComponent;
std::string m_CurrentField;
std::map<std::string, std::string> m_CurrentAttributes;
void onStartEntity(const xercesc::Attributes& attrs);
void onEndEntity();
void onStartEntityRef(const xercesc::Attributes& attrs);
void onStartComponent(const std::string& name);
void onEndComponent(const std::string& name);
void onStartComponentField(const std::string& field, const xercesc::Attributes& attrs);
void onEndComponentField(const std::string& field);
void onFieldData(char* data);
};
class EntityFileXMLErrorHandler : public xercesc::ErrorHandler
{
public:
void warning(const xercesc::SAXParseException& e) override
{
reportParseException("Warning", e);
}
void error(const xercesc::SAXParseException& e) override
{
reportParseException("Error", e);
}
void fatalError(const xercesc::SAXParseException& e) override
{
reportParseException("FATAL ERROR", e);
}
void resetErrors() override { }
private:
void reportParseException(std::string type, const xercesc::SAXParseException& e)
{
char* message = xercesc::XMLString::transcode(e.getMessage());
char* systemID = xercesc::XMLString::transcode(e.getSystemId());
std::cerr << systemID << ":" << e.getLineNumber() << ":" << e.getColumnNumber() << std::endl;
std::cerr << type << ": " << message << std::endl;
xercesc::XMLString::release(&systemID);
xercesc::XMLString::release(&message);
}
};
class EntityFile : public Resource
{
friend class ResourceManager;
friend class EntityFileSAXHandler;
private:
EntityFile(boost::filesystem::path path);
~EntityFile();
public:
static unsigned int GetTypeStride(std::string typeName);
static void WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes);
static void WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData);
xercesc::XMLGrammarPool* GrammarPool() const { return m_GrammarPool; }
void Parse(const EntityFileHandler* handler) const;
private:
boost::filesystem::path m_FilePath;
xercesc::XMLGrammarPool* m_GrammarPool;
xercesc::SAX2XMLReader* m_SAX2XMLReader;
//std::map<std::string, ::ComponentInfo> m_ComponentInfo;
//std::vector<std::string> m_EntityReferences;
static void setReaderFeatures(xercesc::SAX2XMLReader* reader);
}; };
#endif #endif
@@ -1,19 +1,18 @@
#ifndef EntityXMLFileParser_h__ #ifndef EntityFileParser_h__
#define EntityXMLFileParser_h__ #define EntityFileParser_h__
#include "EntityXMLFile.h" #include "EntityFile.h"
#include "World.h" #include "World.h"
class EntityXMLFileParser class EntityFileParser
{ {
friend class EntityFile;
public: public:
EntityXMLFileParser(const EntityXMLFile* entityFile); EntityFileParser(const EntityFile* entityFile);
private:
EntityID MergeEntities(World* world, EntityID baseParent = EntityID_Invalid); EntityID MergeEntities(World* world, EntityID baseParent = EntityID_Invalid);
const EntityXMLFile* m_EntityFile; private:
const EntityFile* m_EntityFile;
EntityFileHandler m_Handler; EntityFileHandler m_Handler;
World* m_World = nullptr; World* m_World = nullptr;
EntityID m_FirstEntity = EntityID_Invalid; EntityID m_FirstEntity = EntityID_Invalid;
@@ -1,5 +1,5 @@
#ifndef EntityXMLFilePreprocessor_h__ #ifndef EntityFilePreprocessor_h__
#define EntityXMLFilePreprocessor_h__ #define EntityFilePreprocessor_h__
#include <xercesc/framework/psvi/XSElementDeclaration.hpp> #include <xercesc/framework/psvi/XSElementDeclaration.hpp>
#include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp> #include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp>
@@ -17,18 +17,17 @@
#include "Util/XercesString.h" #include "Util/XercesString.h"
#include "ResourceManager.h" #include "ResourceManager.h"
#include "World.h" #include "World.h"
#include "EntityXMLFile.h" #include "EntityFile.h"
class EntityXMLFilePreprocessor class EntityFilePreprocessor
{ {
friend class EntityFile;
public: public:
EntityXMLFilePreprocessor(const EntityXMLFile* entityFile); EntityFilePreprocessor(const EntityFile* entityFile);
private:
void RegisterComponents(World* world); void RegisterComponents(World* world);
const EntityXMLFile* m_EntityFile; private:
const EntityFile* m_EntityFile;
std::map<std::string, unsigned int> m_ComponentCounts; std::map<std::string, unsigned int> m_ComponentCounts;
std::map<std::string, ComponentInfo> m_ComponentInfo; std::map<std::string, ComponentInfo> m_ComponentInfo;
@@ -1,5 +1,5 @@
#ifndef EntityXMLFileWriter_h__ #ifndef EntityFileWriter_h__
#define EntityXMLFileWriter_h__ #define EntityFileWriter_h__
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <xercesc/dom/DOM.hpp> #include <xercesc/dom/DOM.hpp>
@@ -8,13 +8,13 @@
#include <xercesc/framework/LocalFileFormatTarget.hpp> #include <xercesc/framework/LocalFileFormatTarget.hpp>
#include "Util/XercesString.h" #include "Util/XercesString.h"
#include "EntityXMLFile.h" #include "EntityFile.h"
#include "World.h" #include "World.h"
class EntityXMLFileWriter class EntityFileWriter
{ {
public: public:
EntityXMLFileWriter(boost::filesystem::path file) EntityFileWriter(boost::filesystem::path file)
: m_FilePath(file) : m_FilePath(file)
{ {
using namespace xercesc; using namespace xercesc;
-164
View File
@@ -1,164 +0,0 @@
#ifndef EntityXMLFile_h__
#define EntityXMLFile_h__
#include <stack>
#include <boost/lexical_cast.hpp>
#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/sax2/SAX2XMLReader.hpp>
#include <xercesc/sax2/XMLReaderFactory.hpp>
#include <xercesc/sax2/DefaultHandler.hpp>
#include <xercesc/sax2/Attributes.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLChar.hpp>
#include <xercesc/sax2/DefaultHandler.hpp>
#include <xercesc/framework/XMLDocumentHandler.hpp>
#include <xercesc/framework/psvi/XSElementDeclaration.hpp>
#include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp>
#include <xercesc/framework/psvi/XSParticle.hpp>
#include <xercesc/framework/psvi/XSModelGroup.hpp>
#include <xercesc/framework/psvi/XSAnnotation.hpp>
#include <xercesc/framework/psvi/XSValue.hpp>
#include <xercesc/framework/XMLGrammarPoolImpl.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMLSInput.hpp>
#include <xercesc/dom/DOMElement.hpp>
#include "../GLM.h"
#include "Util/XercesString.h"
#include "ResourceManager.h"
#include "Entity.h"
#include "ComponentInfo.h"
class EntityFileHandler
{
friend class EntityFileSAXHandler;
public:
// @param EntityID The entity found
// @param EntityID The parent of the entity
typedef std::function<void(EntityID, EntityID, const std::string&)> OnStartEntityCallback;
void SetStartEntityCallback(OnStartEntityCallback c) { m_OnStartEntityCallback = c; }
// @param EntityID The entity the component corresponds to
// @param std::string Type name of the component
typedef std::function<void(EntityID, const std::string&)> OnStartComponentCallback;
void SetStartComponentCallback(OnStartComponentCallback c) { m_OnStartComponentCallback = c; }
// @param EntityID Entity
// @param std::string Component name
// @param std::string Field name
// @param std::map<std::string, std::string> Field attribute names and values
typedef std::function<void(EntityID, const std::string&, const std::string&, const std::map<std::string, std::string>&)> OnStartFieldCallback;
void SetStartFieldCallback(OnStartFieldCallback c) { m_OnStartFieldCallback = c; }
// @param EntityID Entity
// @param std::string Component name
// @param std::string Field name
// @param char* Field data
typedef std::function<void(EntityID, const std::string&, const std::string&, const char*)> OnStartFieldDataCallback;
void SetStartFieldDataCallback(OnStartFieldDataCallback c) { m_OnStartFieldDataCallback = c; }
private:
OnStartEntityCallback m_OnStartEntityCallback = nullptr;
OnStartComponentCallback m_OnStartComponentCallback = nullptr;
OnStartFieldCallback m_OnStartFieldCallback = nullptr;
OnStartFieldDataCallback m_OnStartFieldDataCallback = nullptr;
};
class EntityFileSAXHandler : public xercesc::DefaultHandler
{
public:
enum class State
{
Unknown,
Entity,
Component,
ComponentField
};
EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader);
void startElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname, const xercesc::Attributes& attrs) override;
void characters(const XMLCh* const chars, const XMLSize_t length) override;
void endElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname) override;
void warning(const xercesc::SAXParseException& e);
void error(const xercesc::SAXParseException& e);
void fatalError(const xercesc::SAXParseException& e);
private:
const EntityFileHandler* m_Handler;
xercesc::XMLGrammarPool* m_GrammarPool;
xercesc::SAX2XMLReader* m_Reader;
//State m_CurrentScope = State::Unknown;
std::stack<State> m_StateStack;
unsigned int m_NextEntityID = 0;
std::stack<EntityID> m_EntityStack;
std::string m_CurrentComponent;
std::string m_CurrentField;
std::map<std::string, std::string> m_CurrentAttributes;
void onStartEntity(const xercesc::Attributes& attrs);
void onEndEntity();
void onStartEntityRef(const xercesc::Attributes& attrs);
void onStartComponent(const std::string& name);
void onEndComponent(const std::string& name);
void onStartComponentField(const std::string& field, const xercesc::Attributes& attrs);
void onEndComponentField(const std::string& field);
void onFieldData(char* data);
};
class EntityFileXMLErrorHandler : public xercesc::ErrorHandler
{
public:
void warning(const xercesc::SAXParseException& e) override
{
reportParseException("Warning", e);
}
void error(const xercesc::SAXParseException& e) override
{
reportParseException("Error", e);
}
void fatalError(const xercesc::SAXParseException& e) override
{
reportParseException("FATAL ERROR", e);
}
void resetErrors() override { }
private:
void reportParseException(std::string type, const xercesc::SAXParseException& e)
{
char* message = xercesc::XMLString::transcode(e.getMessage());
char* systemID = xercesc::XMLString::transcode(e.getSystemId());
std::cerr << systemID << ":" << e.getLineNumber() << ":" << e.getColumnNumber() << std::endl;
std::cerr << type << ": " << message << std::endl;
xercesc::XMLString::release(&systemID);
xercesc::XMLString::release(&message);
}
};
class EntityXMLFile : public Resource
{
friend class ResourceManager;
friend class EntityFileSAXHandler;
private:
EntityXMLFile(boost::filesystem::path path);
~EntityXMLFile();
public:
static unsigned int GetTypeStride(std::string typeName);
static void WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes);
static void WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData);
xercesc::XMLGrammarPool* GrammarPool() const { return m_GrammarPool; }
void Parse(const EntityFileHandler* handler) const;
private:
boost::filesystem::path m_FilePath;
xercesc::XMLGrammarPool* m_GrammarPool;
xercesc::SAX2XMLReader* m_SAX2XMLReader;
//std::map<std::string, ::ComponentInfo> m_ComponentInfo;
//std::vector<std::string> m_EntityReferences;
static void setReaderFeatures(xercesc::SAX2XMLReader* reader);
};
#endif
+3
View File
@@ -118,6 +118,9 @@ public:
else { else {
m_ExtraMemory.push_back((char*)malloc(m_Stride)); m_ExtraMemory.push_back((char*)malloc(m_Stride));
//We should preferably not enter here to avoid performance issues. Set more numMaxElements in constructor instead. //We should preferably not enter here to avoid performance issues. Set more numMaxElements in constructor instead.
if (!DisableMemoryPool::Value) {
LOG_DEBUG("Allocated slots exceed Pool size, extra memory allocated dynamically. Pool size: %u, dynamic size: %u.", m_NumSlots, m_ExtraMemory.size());
}
return m_ExtraMemory.back(); return m_ExtraMemory.back();
} }
} }
+2 -9
View File
@@ -6,7 +6,6 @@
#include "ObjectPool.h" #include "ObjectPool.h"
#include "ComponentPool.h" #include "ComponentPool.h"
#include "EventBroker.h" #include "EventBroker.h"
struct EntityWrapper;
class World class World
{ {
@@ -19,13 +18,13 @@ public:
World(const World& other); World(const World& other);
// Create empty entity // Create empty entity
EntityID CreateEntity(EntityID parent = EntityID_Invalid); EntityID CreateEntity(EntityID parent = 0);
// Delete entity and all components within // Delete entity and all components within
void DeleteEntity(EntityID entity); void DeleteEntity(EntityID entity);
// Check if an entity exists // Check if an entity exists
bool ValidEntity(EntityID entity) const; bool ValidEntity(EntityID entity) const;
// Register a component type and allocate space for it // Register a component type and allocate space for it
void RegisterComponent(const ComponentInfo& ci); void RegisterComponent(ComponentInfo& ci);
// Attach a component to an entity and fill it with default values // Attach a component to an entity and fill it with default values
ComponentWrapper AttachComponent(EntityID entity, const std::string& componentType); ComponentWrapper AttachComponent(EntityID entity, const std::string& componentType);
// Check if an entity has a component // Check if an entity has a component
@@ -50,12 +49,6 @@ public:
void SetName(EntityID entity, const std::string& name); void SetName(EntityID entity, const std::string& name);
// Get the textual name of an entity // Get the textual name of an entity
std::string GetName(EntityID entity) const; std::string GetName(EntityID entity) const;
// Get the first entity in the world with the name.
EntityWrapper GetFirstEntityByName(const std::string& name);
// Merge another world into this one
// Returns a map that maps entities from the other world to their copies in this one
std::unordered_map<EntityID, EntityID> Merge(const World* other);
private: private:
EventBroker* m_EventBroker = nullptr; EventBroker* m_EventBroker = nullptr;
@@ -105,11 +105,6 @@ protected:
return false; return false;
} }
ImGuiIO& io = ImGui::GetIO();
if (io.WantCaptureMouse || io.WantCaptureKeyboard) {
return false;
}
m_SpeedMultiplier += e.DeltaY * (0.1 * m_SpeedMultiplier); m_SpeedMultiplier += e.DeltaY * (0.1 * m_SpeedMultiplier);
m_Config->Set("Editor.CameraSpeed", m_SpeedMultiplier); m_Config->Set("Editor.CameraSpeed", m_SpeedMultiplier);
m_Config->SaveToDisk(); m_Config->SaveToDisk();
+3 -2
View File
@@ -5,8 +5,9 @@
#include "../Core/World.h" #include "../Core/World.h"
#include "../Core/SystemPipeline.h" #include "../Core/SystemPipeline.h"
#include "../Core/ResourceManager.h" #include "../Core/ResourceManager.h"
#include "../Core/EntityFile.h" #include "../Core/EntityFilePreprocessor.h"
#include "../Core/EntityXMLFileWriter.h" #include "../Core/EntityFileParser.h"
#include "../Core/EntityFileWriter.h"
#include "../Core/EMousePress.h" #include "../Core/EMousePress.h"
#include "../Input/EInputCommand.h" #include "../Input/EInputCommand.h"
#include "EditorGUI.h" #include "EditorGUI.h"
@@ -27,7 +27,7 @@ public:
virtual bool OnCommand(const Events::InputCommand& e) override; virtual bool OnCommand(const Events::InputCommand& e) override;
virtual void Reset(); virtual void Reset();
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer, EntityID playerID); void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer);
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; } virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; } virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
@@ -41,7 +41,7 @@ protected:
bool m_Crouching = false; bool m_Crouching = false;
//assault dash membervariables - needed to calculate the doubletap- and dashlogic //assault dash membervariables - needed to calculate the doubletap- and dashlogic
double m_AssaultDashDoubleTapDeltaTime = 0.0; double m_AssaultDashDoubleTapDeltaTime = 0.0;
double m_DashEffectResetTimer = 0.0; double m_AssaultDashCoolDownTimer = 0.0;
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable), //i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
//and its very unlikely that someone wants to change that value //and its very unlikely that someone wants to change that value
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f; const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
@@ -52,7 +52,7 @@ protected:
bool m_ShiftDashing = false; bool m_ShiftDashing = false;
bool m_ValidDoubleTap = false; bool m_ValidDoubleTap = false;
//specialabilities //specialabilitys
bool m_MovementKeyDown = false; bool m_MovementKeyDown = false;
bool m_SpecialAbilityKeyDown = false; bool m_SpecialAbilityKeyDown = false;
int m_NumberOfMovementKeysDown = 0; int m_NumberOfMovementKeysDown = 0;
@@ -191,33 +191,23 @@ bool FirstPersonInputController<EventContext>::OnLockMouse(const Events::LockMou
} }
template <typename EventContext> template <typename EventContext>
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer, EntityID playerID) { void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer) {
m_AssaultDashDoubleTapDeltaTime += dt; m_AssaultDashDoubleTapDeltaTime += dt;
m_DashEffectResetTimer += dt; m_AssaultDashCoolDownTimer -= dt;
assaultDashCoolDownTimer -= dt;
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work) //cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
if (assaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) { if (m_AssaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
m_PlayerIsDashing = true; m_PlayerIsDashing = true;
if (m_DashEffectResetTimer > 0.05) {
Events::DashAbility e;
e.Player = playerID;
m_EventBroker->Publish(e);
m_DashEffectResetTimer = 0.0;
}
} else { } else {
m_PlayerIsDashing = false; m_PlayerIsDashing = false;
} }
//dashing with shift //dashing with shift
if (m_ShiftDashing && assaultDashCoolDownTimer <= 0.0f) { if (m_ShiftDashing && m_AssaultDashCoolDownTimer <= 0.0f) {
//player is dashing with shift //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! //the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer; m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
m_AssaultDashDoubleTapped = true; m_AssaultDashDoubleTapped = true;
m_AssaultDashDoubleTapDeltaTime = 0.f; m_AssaultDashDoubleTapDeltaTime = 0.f;
Events::DashAbility e;
e.Player = playerID;
m_EventBroker->Publish(e);
return; return;
} }
@@ -237,7 +227,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
} }
m_ValidDoubleTap = false; m_ValidDoubleTap = false;
if (!(assaultDashCoolDownTimer <= 0.0f)) { if (!(m_AssaultDashCoolDownTimer <= 0.0f)) {
//if we cant dash at the moment, then just reset the tap-sensitivity-timer //if we cant dash at the moment, then just reset the tap-sensitivity-timer
m_AssaultDashDoubleTapDeltaTime = 0.f; m_AssaultDashDoubleTapDeltaTime = 0.f;
return; return;
@@ -245,10 +235,9 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
//ok, we have a valid tap, lets do it //ok, we have a valid tap, lets do it
m_AssaultDashDoubleTapped = true; m_AssaultDashDoubleTapped = true;
m_AssaultDashDoubleTapDeltaTime = 0.f; m_AssaultDashDoubleTapDeltaTime = 0.f;
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer; m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
Events::DashAbility e; Events::DashAbility e;
e.Player = playerID;
m_EventBroker->Publish(e); m_EventBroker->Publish(e);
} }
-7
View File
@@ -26,9 +26,7 @@
#include "Network/EInterpolate.h" #include "Network/EInterpolate.h"
#include "Network/SnapshotFilter.h" #include "Network/SnapshotFilter.h"
#include "Core/EPlayerSpawned.h" #include "Core/EPlayerSpawned.h"
#include "Core/EAmmoPickup.h"
#include "Network/ESearchForServers.h" #include "Network/ESearchForServers.h"
#include "../Game/Events/EDashAbility.h"
struct ServerInfo struct ServerInfo
{ {
@@ -108,8 +106,6 @@ private:
void parsePlayerDamage(Packet& packet); void parsePlayerDamage(Packet& packet);
void parseComponentDeletion(Packet& packet); void parseComponentDeletion(Packet& packet);
void parseDoubleJump(Packet& packet); void parseDoubleJump(Packet& packet);
void parseDashEffect(Packet& packet);
void parseAmmoPickup(Packet& packet);
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType); void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
void parseSnapshot(Packet& packet); void parseSnapshot(Packet& packet);
void identifyPacketLoss(); void identifyPacketLoss();
@@ -137,9 +133,6 @@ private:
EventRelay< Client, Events::SearchForServers> m_ESearchForServers; EventRelay< Client, Events::SearchForServers> m_ESearchForServers;
EventRelay<Client, Events::DoubleJump> m_EDoubleJump; EventRelay<Client, Events::DoubleJump> m_EDoubleJump;
bool OnDoubleJump(Events::DoubleJump & e); bool OnDoubleJump(Events::DoubleJump & e);
EventRelay<Client, Events::DashAbility> m_EDashAbility;
bool OnDashAbility(const Events::DashAbility& e);
bool OnSearchForServers(const Events::SearchForServers& e); bool OnSearchForServers(const Events::SearchForServers& e);
UDPClient m_ServerlistRequest; UDPClient m_ServerlistRequest;
std::vector<ServerInfo> m_Serverlist; std::vector<ServerInfo> m_Serverlist;
-2
View File
@@ -20,9 +20,7 @@ enum class MessageType
ComponentDeleted, ComponentDeleted,
PlayerTransform, PlayerTransform,
OnDoubleJump, OnDoubleJump,
OnDashEffect,
ServerlistRequest, ServerlistRequest,
AmmoPickup,
Invalid Invalid
}; };
+1 -5
View File
@@ -20,7 +20,6 @@
#include "../Game/Events/EDoubleJump.h" #include "../Game/Events/EDoubleJump.h"
#include "Core/EEntityDeleted.h" #include "Core/EEntityDeleted.h"
#include "Core/EComponentDeleted.h" #include "Core/EComponentDeleted.h"
#include "Core/EAmmoPickup.h"
class Server : public Network class Server : public Network
{ {
@@ -83,14 +82,13 @@ private:
void parseClientPing(); void parseClientPing();
void parsePing(); void parsePing();
bool parseDoubleJump(Packet& packet); bool parseDoubleJump(Packet& packet);
void parseDashEffect(Packet& packet);
void parseUDPConnect(Packet& packet); void parseUDPConnect(Packet& packet);
void parseTCPConnect(Packet& packet); void parseTCPConnect(Packet& packet);
void parseDisconnect(); void parseDisconnect();
void parseServerlistRequest(boost::asio::ip::udp::endpoint endpoint); void parseServerlistRequest(boost::asio::ip::udp::endpoint endpoint);
bool shouldSendToClient(EntityWrapper childEntity); bool shouldSendToClient(EntityWrapper childEntity);
// Events // Debug event
EventRelay<Server, Events::InputCommand> m_EInputCommand; EventRelay<Server, Events::InputCommand> m_EInputCommand;
bool OnInputCommand(const Events::InputCommand& e); bool OnInputCommand(const Events::InputCommand& e);
EventRelay<Server, Events::PlayerSpawned> m_EPlayerSpawned; EventRelay<Server, Events::PlayerSpawned> m_EPlayerSpawned;
@@ -101,8 +99,6 @@ private:
bool OnComponentDeleted(const Events::ComponentDeleted& e); bool OnComponentDeleted(const Events::ComponentDeleted& e);
EventRelay<Server, Events::PlayerDamage> m_EPlayerDamage; EventRelay<Server, Events::PlayerDamage> m_EPlayerDamage;
bool OnPlayerDamage(const Events::PlayerDamage& e); bool OnPlayerDamage(const Events::PlayerDamage& e);
EventRelay<Server, Events::AmmoPickup> m_EAmmoPickup;
bool OnAmmoPickup(const Events::AmmoPickup& e);
}; };
#endif #endif
@@ -17,7 +17,7 @@ public:
void InitializeFrameBuffers(); void InitializeFrameBuffers();
void InitializeShaderPrograms(); void InitializeShaderPrograms();
void Draw(GLuint sceneTexture, GLuint bloomTexture, GLfloat gamma, GLfloat exposure); void Draw(GLuint sceneTexture, GLuint bloomTexture, GLuint sceneTextureLowRes, GLuint bloomTextureLowRes, GLfloat gamma, GLfloat exposure);
private: private:
const IRenderer* m_Renderer; const IRenderer* m_Renderer;
+22 -21
View File
@@ -15,7 +15,7 @@
class DrawFinalPass class DrawFinalPass
{ {
public: public:
DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass); DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass, GLuint* depthBuffer);
~DrawFinalPass() { } ~DrawFinalPass() { }
void InitializeTextures(); void InitializeTextures();
void InitializeFrameBuffers(); void InitializeFrameBuffers();
@@ -26,17 +26,22 @@ public:
//Return the texture that is used in later stages to apply the bloom effect //Return the texture that is used in later stages to apply the bloom effect
GLuint BloomTexture() const { return m_BloomTexture; } GLuint BloomTexture() const { return m_BloomTexture; }
GLuint BloomTextureLowRes() const { return m_BloomTextureLowRes; }
//Return the texture with diffuse and lighting of the scene. //Return the texture with diffuse and lighting of the scene.
GLuint SceneTexture() const { return m_SceneTexture; } GLuint SceneTexture() const { return m_SceneTexture; }
GLuint SceneTextureLowRes() const { return m_SceneTextureLowRes; }
//Return the framebuffer used in the scene rendering stage. //Return the framebuffer used in the scene rendering stage.
FrameBuffer* FinalPassFrameBuffer() { return &m_FinalPassFrameBuffer; } FrameBuffer* FinalPassFrameBuffer() { return &m_FinalPassFrameBuffer; }
FrameBuffer* FinalPassFrameBufferLowRes() { return &m_FinalPassFrameBufferLowRes; }
private: private:
void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene); void DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, RenderScene& scene);
void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene); void DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void DrawModelRenderQueuesWithShieldCheck(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 DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene); void DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene);
void MergeLayers();
void BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene); void BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene);
void BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene); void BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene);
@@ -50,12 +55,17 @@ private:
Texture* m_GreyTexture; Texture* m_GreyTexture;
Texture* m_ErrorTexture; Texture* m_ErrorTexture;
Model* m_ScreenQuad;
FrameBuffer m_MergeFrameBuffer;
FrameBuffer m_FinalPassFrameBuffer; FrameBuffer m_FinalPassFrameBuffer;
FrameBuffer m_ShieldDepthFrameBuffer; FrameBuffer m_FinalPassFrameBufferLowRes;
GLuint m_BloomTexture; GLuint m_BloomTexture;
GLuint m_SceneTexture; GLuint m_SceneTexture;
GLuint m_DepthBuffer; GLuint m_BloomTextureLowRes;
GLuint m_ShieldBuffer; GLuint m_SceneTextureLowRes;
GLuint* m_DepthBuffer;
GLuint m_DepthBufferLowRes;
GLuint m_CubeMapTexture; GLuint m_CubeMapTexture;
//maqke this component based i guess? //maqke this component based i guess?
@@ -66,32 +76,23 @@ private:
const CubeMapPass* m_CubeMapPass; const CubeMapPass* m_CubeMapPass;
const SSAOPass* m_SSAOPass; const SSAOPass* m_SSAOPass;
ShaderProgram* m_MergeProgram;
ShaderProgram* m_ForwardPlusProgram; ShaderProgram* m_ForwardPlusProgram;
ShaderProgram* m_ExplosionEffectProgram; ShaderProgram* m_ExplosionEffectProgram;
ShaderProgram* m_ExplosionEffectSplatMapProgram; ShaderProgram* m_ExplosionEffectSplatMapProgram;
ShaderProgram* m_SpriteProgram; ShaderProgram* m_SpriteProgram;
ShaderProgram* m_ForwardPlusSplatMapProgram; ShaderProgram* m_ForwardPlusSplatMapProgram;
ShaderProgram* m_FillDepthStencilBufferProgram; ShaderProgram* m_ShieldToStencilProgram;
ShaderProgram* m_FillDepthBufferProgram;
ShaderProgram* m_ForwardPlusShieldCheckProgram;
ShaderProgram* m_ExplosionEffectShieldCheckProgram;
ShaderProgram* m_ExplosionEffectSplatMapShieldCheckProgram;
ShaderProgram* m_SpriteShieldCheckProgram;
ShaderProgram* m_ForwardPlusSplatMapShieldCheckProgram;
ShaderProgram* m_ForwardPlusSkinnedProgram; ShaderProgram* m_ForwardPlusSkinnedProgram;
ShaderProgram* m_ExplosionEffectSkinnedProgram; ShaderProgram* m_ExplosionEffectSkinnedProgram;
ShaderProgram* m_ExplosionEffectSplatMapSkinnedProgram; ShaderProgram* m_ExplosionEffectSplatMapSkinnedProgram;
ShaderProgram* m_ForwardPlusSplatMapSkinnedProgram; ShaderProgram* m_ForwardPlusSplatMapSkinnedProgram;
ShaderProgram* m_FillDepthStencilBufferSkinnedProgram; ShaderProgram* m_ShieldToStencilSkinnedProgram;
ShaderProgram* m_FillDepthBufferSkinnedProgram;
ShaderProgram* m_ForwardPlusSkinnedShieldCheckProgram;
ShaderProgram* m_ExplosionEffectSkinnedShieldCheckProgram;
ShaderProgram* m_ExplosionEffectSplatMapSkinnedShieldCheckProgram;
ShaderProgram* m_ForwardPlusSplatMapSkinnedShieldCheckProgram;
ShaderProgram* m_FillDepthBufferSkinnedShieldCheckProgram;
}; };
#endif #endif
@@ -15,8 +15,8 @@
struct ExplosionEffectJob : ModelJob struct ExplosionEffectJob : ModelJob
{ {
ExplosionEffectJob(ComponentWrapper explosionEffectComponent, ::Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matGroup, ComponentWrapper modelComponent, ::World* world, glm::vec4 fillColor, float fillPercentage, bool isShielded) ExplosionEffectJob(ComponentWrapper explosionEffectComponent, ::Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matGroup, ComponentWrapper modelComponent, ::World* world, glm::vec4 fillColor, float fillPercentage)
: ModelJob(model, camera, matrix, matGroup, modelComponent, world, fillColor, fillPercentage, isShielded) : ModelJob(model, camera, matrix, matGroup, modelComponent, world, fillColor, fillPercentage)
{ {
ExplosionOrigin = (glm::vec3)explosionEffectComponent["ExplosionOrigin"]; ExplosionOrigin = (glm::vec3)explosionEffectComponent["ExplosionOrigin"];
TimeSinceDeath = (double)explosionEffectComponent["TimeSinceDeath"]; TimeSinceDeath = (double)explosionEffectComponent["TimeSinceDeath"];
+3 -3
View File
@@ -18,7 +18,7 @@
struct ModelJob : RenderJob struct ModelJob : RenderJob
{ {
ModelJob(Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matProp, ComponentWrapper modelComponent, World* world, glm::vec4 fillColor, float fillPercentage, bool isShielded) ModelJob(Model* model, Camera* camera, glm::mat4 matrix, ::RawModel::MaterialProperties matProp, ComponentWrapper modelComponent, World* world, glm::vec4 fillColor, float fillPercentage)
: RenderJob() : RenderJob()
{ {
Model = model; Model = model;
@@ -117,7 +117,7 @@ struct ModelJob : RenderJob
FillColor = fillColor; FillColor = fillColor;
FillPercentage = fillPercentage; FillPercentage = fillPercentage;
IsShielded = isShielded;
if (model->IsSkinned()) { if (model->IsSkinned()) {
Skeleton = Model->m_RawModel->m_Skeleton; Skeleton = Model->m_RawModel->m_Skeleton;
@@ -181,7 +181,7 @@ struct ModelJob : RenderJob
glm::vec4 FillColor = glm::vec4(0); glm::vec4 FillColor = glm::vec4(0);
float FillPercentage = 0.0; float FillPercentage = 0.0;
bool IsShielded;
void CalculateHash() override void CalculateHash() override
{ {
Hash = ShaderID << 20 + ModelID << 10 + TextureID; Hash = ShaderID << 20 + ModelID << 10 + TextureID;
+2
View File
@@ -24,6 +24,7 @@ struct RenderScene
std::list<std::shared_ptr<RenderJob>> OpaqueObjects; std::list<std::shared_ptr<RenderJob>> OpaqueObjects;
std::list<std::shared_ptr<RenderJob>> TransparentObjects; std::list<std::shared_ptr<RenderJob>> TransparentObjects;
std::list<std::shared_ptr<RenderJob>> OpaqueShieldedObjects; std::list<std::shared_ptr<RenderJob>> OpaqueShieldedObjects;
std::list<std::shared_ptr<RenderJob>> TransparentShieldedObjects;
std::list<std::shared_ptr<RenderJob>> ShieldObjects; std::list<std::shared_ptr<RenderJob>> ShieldObjects;
std::list<std::shared_ptr<RenderJob>> SpriteJob; std::list<std::shared_ptr<RenderJob>> SpriteJob;
std::list<std::shared_ptr<RenderJob>> PointLight; std::list<std::shared_ptr<RenderJob>> PointLight;
@@ -40,6 +41,7 @@ struct RenderScene
Jobs.OpaqueObjects.clear(); Jobs.OpaqueObjects.clear();
Jobs.TransparentObjects.clear(); Jobs.TransparentObjects.clear();
Jobs.OpaqueShieldedObjects.clear(); Jobs.OpaqueShieldedObjects.clear();
Jobs.TransparentShieldedObjects.clear();
Jobs.ShieldObjects.clear(); Jobs.ShieldObjects.clear();
Jobs.SpriteJob.clear(); Jobs.SpriteJob.clear();
Jobs.DirectionalLight.clear(); Jobs.DirectionalLight.clear();
+1 -5
View File
@@ -2,15 +2,11 @@
#define Events_DashAbility_h__ #define Events_DashAbility_h__
#include "Core/Event.h" #include "Core/Event.h"
#include "Core/EntityWrapper.h"
namespace Events namespace Events
{ {
struct DashAbility : public Event struct DashAbility : public Event { };
{
EntityID Player;
};
} }
+3 -3
View File
@@ -13,13 +13,13 @@
#include "Input/KeyboardInputHandler.h" #include "Input/KeyboardInputHandler.h"
#include "Input/MouseInputHandler.h" #include "Input/MouseInputHandler.h"
#include "Core/EKeyDown.h" #include "Core/EKeyDown.h"
#include "Core/EntityXMLFilePreprocessor.h" #include "Core/EntityFilePreprocessor.h"
#include "Core/SystemPipeline.h" #include "Core/SystemPipeline.h"
#include "Systems/ExplosionEffectSystem.h" #include "Systems/ExplosionEffectSystem.h"
#include "Editor/EditorSystem.h" #include "Editor/EditorSystem.h"
#include "Core/EntityXMLFile.h" #include "Core/EntityFile.h"
#include "Rendering/RenderSystem.h" #include "Rendering/RenderSystem.h"
#include "Core/EntityXMLFileParser.h" #include "Core/EntityFileParser.h"
#include "Core/Octree.h" #include "Core/Octree.h"
#include "Rendering/Font.h" #include "Rendering/Font.h"
#include "Systems/InterpolationSystem.h" #include "Systems/InterpolationSystem.h"
+1 -12
View File
@@ -4,7 +4,7 @@
#include "Core/System.h" #include "Core/System.h"
#include "Core/Transform.h" #include "Core/Transform.h"
#include "Core/ResourceManager.h" #include "Core/ResourceManager.h"
#include "Core/EntityFile.h" #include "Core/EntityFileParser.h"
#include "Core/EPickupSpawned.h" #include "Core/EPickupSpawned.h"
#include "Core/EAmmoPickup.h" #include "Core/EAmmoPickup.h"
#include "Engine/Collision/ETrigger.h" #include "Engine/Collision/ETrigger.h"
@@ -20,11 +20,6 @@ public:
private: private:
EventRelay<AmmoPickupSystem, Events::TriggerTouch> m_ETriggerTouch; EventRelay<AmmoPickupSystem, Events::TriggerTouch> m_ETriggerTouch;
bool OnTriggerTouch(Events::TriggerTouch& e); bool OnTriggerTouch(Events::TriggerTouch& e);
EventRelay<AmmoPickupSystem, Events::TriggerLeave> m_ETriggerLeave;
bool OnTriggerLeave(Events::TriggerLeave& e);
EventRelay<AmmoPickupSystem, Events::AmmoPickup> m_EAmmoPickup;
bool OnAmmoPickup(Events::AmmoPickup& e);
struct NewAmmoPickup { struct NewAmmoPickup {
glm::vec3 Pos; glm::vec3 Pos;
@@ -34,11 +29,5 @@ private:
EntityID parentID; EntityID parentID;
}; };
std::vector<NewAmmoPickup> m_ETriggerTouchVector; std::vector<NewAmmoPickup> m_ETriggerTouchVector;
struct EntityAtMaxValuePickupStruct {
EntityWrapper player;
EntityWrapper trigger;
};
std::vector<EntityAtMaxValuePickupStruct> m_PickupAtMaximum;
void DoPickup(EntityWrapper &player, EntityWrapper &trigger);
}; };
#endif #endif
-21
View File
@@ -1,21 +0,0 @@
#ifndef BoostSystem_h__
#define BoostSystem_h__
#include "Core/System.h"
#include "Core/ResourceManager.h"
#include "Core/EntityFile.h"
#include "Core/EPlayerDamage.h"
#include "Common.h"
class BoostSystem : public System
{
public:
BoostSystem(SystemParams params);
private:
EventRelay<BoostSystem, Events::PlayerDamage> m_EPlayerDamage;
bool OnPlayerDamage(Events::PlayerDamage& e);
std::string DetermineClass(EntityWrapper player);
};
#endif
@@ -1,30 +0,0 @@
#ifndef CapturePointArrowHUDSystem_h__
#define CapturePointArrowHUDSystem_h__
#include <GLFW/glfw3.h>
#include <glm/common.hpp>
#include <glm/gtx/vector_angle.hpp>
#include "Common.h"
#include "Core/System.h"
#include "Core/Transform.h"
#include "Core/ECaptured.h"
class CapturePointArrowHUDSystem : public ImpureSystem
{
public:
CapturePointArrowHUDSystem(SystemParams params);
virtual void Update(double dt) override;
private:
EventRelay<CapturePointArrowHUDSystem, Events::Captured> m_ECapturedEvent;
bool OnCapturePointCaptured(Events::Captured& e);
bool m_InitialtargetsSet = false;
glm::vec3 m_RedTeamCurrentTarget;
glm::vec3 m_BlueTeamCurrentTarget;
};
#endif
+1 -1
View File
@@ -7,7 +7,7 @@
#include "Common.h" #include "Common.h"
#include "Core/System.h" #include "Core/System.h"
#include "Collision/ETrigger.h" #include "Engine/Collision/ETrigger.h"
class CapturePointHUDSystem : public ImpureSystem class CapturePointHUDSystem : public ImpureSystem
{ {
+2 -2
View File
@@ -42,9 +42,9 @@ private:
int m_NumberOfCapturePoints = 0; int m_NumberOfCapturePoints = 0;
std::map<int, EntityWrapper> m_CapturePointNumberToEntityMap; std::map<int, EntityWrapper> m_CapturePointNumberToEntityMap;
//std::vector<ComponentWrapper>
bool m_ResetTimers = false; bool m_ResetTimers = false;
bool m_RecentlyCapturedNeedNextCapturePointNow = false;
Events::Captured m_CapturedEvent;
//vectors which will keep track of enter/leave changes //vectors which will keep track of enter/leave changes
std::vector<std::tuple<EntityWrapper, EntityWrapper>> m_ETriggerTouchVector; std::vector<std::tuple<EntityWrapper, EntityWrapper>> m_ETriggerTouchVector;
+1 -1
View File
@@ -4,7 +4,7 @@
#include "Core/System.h" #include "Core/System.h"
#include "Core/Transform.h" #include "Core/Transform.h"
#include "Core/ResourceManager.h" #include "Core/ResourceManager.h"
#include "Core/EntityFile.h" #include "Core/EntityFileParser.h"
#include "Core/EPlayerDamage.h" #include "Core/EPlayerDamage.h"
#include "Common.h" #include "Common.h"
#include <tuple> #include <tuple>
@@ -1,19 +0,0 @@
#include "Common.h"
#include "Core/System.h"
class FloatingEffectSystem : public PureSystem
{
public:
FloatingEffectSystem(SystemParams params)
: System(params)
, PureSystem("FloatingEffect")
{ }
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override
{
ComponentWrapper& transform = m_World->GetComponent(component.EntityID, "Transform");
(double&)component["Time"] += dt;
(glm::vec3&)transform["Position"] = (float)(double)component["Amplitude"] * glm::sin((glm::two_pi<float>() / (float)(double)component["Period"]) * (float)(double)component["Time"]) * (glm::vec3)component["Axis"];
}
};
+2 -9
View File
@@ -4,11 +4,12 @@
#include "Core/System.h" #include "Core/System.h"
#include "Core/Transform.h" #include "Core/Transform.h"
#include "Core/ResourceManager.h" #include "Core/ResourceManager.h"
#include "Core/EntityFile.h" #include "Core/EntityFileParser.h"
#include "Core/EPickupSpawned.h" #include "Core/EPickupSpawned.h"
#include "Core/EPlayerHealthPickup.h" #include "Core/EPlayerHealthPickup.h"
#include "Engine/Collision/ETrigger.h" #include "Engine/Collision/ETrigger.h"
#include "Common.h" #include "Common.h"
#include <tuple>
class PickupSpawnSystem : public ImpureSystem class PickupSpawnSystem : public ImpureSystem
{ {
@@ -20,8 +21,6 @@ public:
private: private:
EventRelay<PickupSpawnSystem, Events::TriggerTouch> m_ETriggerTouch; EventRelay<PickupSpawnSystem, Events::TriggerTouch> m_ETriggerTouch;
bool OnTriggerTouch(Events::TriggerTouch& e); bool OnTriggerTouch(Events::TriggerTouch& e);
EventRelay<PickupSpawnSystem, Events::TriggerLeave> m_ETriggerLeave;
bool OnTriggerLeave(Events::TriggerLeave& e);
struct NewHealthPickup { struct NewHealthPickup {
glm::vec3 Pos; glm::vec3 Pos;
@@ -31,11 +30,5 @@ private:
EntityID parentID; EntityID parentID;
}; };
std::vector<NewHealthPickup> m_ETriggerTouchVector; std::vector<NewHealthPickup> m_ETriggerTouchVector;
struct EntityAtMaxValuePickupStruct {
EntityWrapper player;
EntityWrapper trigger;
};
std::vector<EntityAtMaxValuePickupStruct> m_PickupAtMaximum;
void DoPickup(EntityWrapper &player, EntityWrapper &trigger);
}; };
#endif #endif
+3 -5
View File
@@ -6,9 +6,11 @@
#include "GLM.h" #include "GLM.h"
#include "Rendering/ESetCamera.h" #include "Rendering/ESetCamera.h"
#include "Core/ConfigFile.h" #include "Core/ConfigFile.h"
#include "Core/EntityFile.h" #include "Core/EntityFile.h"
#include "Core/EntityFileParser.h"
#include "Core/EPlayerDeath.h" #include "Core/EPlayerDeath.h"
#include "Core/EEntityDeleted.h"
class PlayerDeathSystem : public ImpureSystem class PlayerDeathSystem : public ImpureSystem
{ {
@@ -18,12 +20,8 @@ public:
virtual void Update(double dt) override; virtual void Update(double dt) override;
private: private:
EntityWrapper m_LocalPlayerDeathEffect;
EventRelay<PlayerDeathSystem, Events::PlayerDeath> m_OnPlayerDeath; EventRelay<PlayerDeathSystem, Events::PlayerDeath> m_OnPlayerDeath;
bool OnPlayerDeath(Events::PlayerDeath& e); bool OnPlayerDeath(Events::PlayerDeath& e);
EventRelay<PlayerDeathSystem, Events::EntityDeleted> m_EEntityDeleted;
bool OnEntityDeleted(Events::EntityDeleted& e);
void createDeathEffect(EntityWrapper player); void createDeathEffect(EntityWrapper player);
+2 -2
View File
@@ -6,7 +6,9 @@
#include <imgui/imgui.h> #include <imgui/imgui.h>
#include "Events/EDoubleJump.h" #include "Events/EDoubleJump.h"
#include "../Engine/Sound/EPlaySoundOnEntity.h" #include "../Engine/Sound/EPlaySoundOnEntity.h"
#include "Core/EntityFile.h" #include "Core/EntityFile.h"
#include "Core/EntityFileParser.h"
class PlayerMovementSystem : public ImpureSystem class PlayerMovementSystem : public ImpureSystem
{ {
@@ -39,8 +41,6 @@ private:
bool OnPlayerSpawned(Events::PlayerSpawned& e); bool OnPlayerSpawned(Events::PlayerSpawned& e);
EventRelay<PlayerMovementSystem, Events::DoubleJump> m_EDoubleJump; EventRelay<PlayerMovementSystem, Events::DoubleJump> m_EDoubleJump;
bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e); bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e);
EventRelay<PlayerMovementSystem, Events::DashAbility> m_EDashAbility;
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e);
void updateMovementControllers(double dt); void updateMovementControllers(double dt);
void updateVelocity(EntityWrapper player, double dt); void updateVelocity(EntityWrapper player, double dt);
+4 -2
View File
@@ -14,6 +14,8 @@ public:
virtual void Update(double dt) override; virtual void Update(double dt) override;
static void SetRespawnTime(float respawnTime) { m_RespawnTime = respawnTime; };
private: private:
struct SpawnRequest struct SpawnRequest
{ {
@@ -29,8 +31,8 @@ private:
//EntityWrapper ID -> Player ID. //EntityWrapper ID -> Player ID.
std::map<EntityID, int> m_PlayerIDs; std::map<EntityID, int> m_PlayerIDs;
float m_ForcedRespawnTime; static float m_RespawnTime;
bool m_DbgConfigForceRespawn; float m_Timer;
EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand; EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand;
bool OnInputCommand(Events::InputCommand& e); bool OnInputCommand(Events::InputCommand& e);
+2 -1
View File
@@ -7,7 +7,8 @@
#include "Core/System.h" #include "Core/System.h"
#include "Events/ESpawnerSpawn.h" #include "Events/ESpawnerSpawn.h"
#include "Core/Transform.h" #include "Core/Transform.h"
#include "Core/EntityFile.h" #include "Core/ResourceManager.h"
#include "Core/EntityFileParser.h"
class SpawnerSystem : public System class SpawnerSystem : public System
{ {
+2 -2
View File
@@ -9,8 +9,8 @@
#include "Core/EShoot.h" #include "Core/EShoot.h"
#include "Core/EPlayerSpawned.h" #include "Core/EPlayerSpawned.h"
#include "Input/EInputCommand.h" #include "Input/EInputCommand.h"
#include "Core/EntityXMLFile.h" #include "Core/EntityFile.h"
#include "Core/EntityXMLFileParser.h" #include "Core/EntityFileParser.h"
#include "Core/Octree.h" #include "Core/Octree.h"
#include "Collision/EntityAABB.h" #include "Collision/EntityAABB.h"
#include "Systems/SpawnerSystem.h" #include "Systems/SpawnerSystem.h"
+2 -14
View File
@@ -4,7 +4,7 @@ LoadMap=
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation. ; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
; if false -> Use pool allocation. ; if false -> Use pool allocation.
DisableMemoryPool=false DisableMemoryPool=false
RespawnTime = -1.0 RespawnTime = 8.0
EditorEnabled=false EditorEnabled=false
OutOfBodyExperience=false OutOfBodyExperience=false
@@ -68,17 +68,5 @@ Contrast=1.5
Intensity=1.0 Intensity=1.0
NumSamples=24 NumSamples=24
NumTurns=17 NumTurns=17
NumIterations=9
TextureQuality=0
[GLOW]
Quality=3;
[GLOW1]
NumIterations=5
[GLOW2]
NumIterations=9
[GLOW3]
NumIterations=13 NumIterations=13
TextureQuality=0
-9
View File
@@ -35,12 +35,7 @@
<xs:include schemaLocation="Components/AmmoPickup.xsd"/> <xs:include schemaLocation="Components/AmmoPickup.xsd"/>
<xs:include schemaLocation="Components/AnimationOffset.xsd"/> <xs:include schemaLocation="Components/AnimationOffset.xsd"/>
<xs:include schemaLocation="Components/DashAbility.xsd"/> <xs:include schemaLocation="Components/DashAbility.xsd"/>
<xs:include schemaLocation="Components/ShieldAbility.xsd"/>
<xs:include schemaLocation="Components/SprintAbility.xsd"/>
<xs:include schemaLocation="Components/AssaultWeapon.xsd"/> <xs:include schemaLocation="Components/AssaultWeapon.xsd"/>
<xs:include schemaLocation="Components/BoostAssault.xsd"/>
<xs:include schemaLocation="Components/BoostDefender.xsd"/>
<xs:include schemaLocation="Components/BoostSniper.xsd"/>
<xs:include schemaLocation="Components/Shield.xsd"/> <xs:include schemaLocation="Components/Shield.xsd"/>
<xs:include schemaLocation="Components/Sprite.xsd"/> <xs:include schemaLocation="Components/Sprite.xsd"/>
<xs:include schemaLocation="Components/Shielded.xsd"/> <xs:include schemaLocation="Components/Shielded.xsd"/>
@@ -51,10 +46,6 @@
<xs:include schemaLocation="Components/Page.xsd"/> <xs:include schemaLocation="Components/Page.xsd"/>
<xs:include schemaLocation="Components/SpriteIndicator.xsd"/> <xs:include schemaLocation="Components/SpriteIndicator.xsd"/>
<xs:include schemaLocation="Components/Button.xsd"/> <xs:include schemaLocation="Components/Button.xsd"/>
<xs:include schemaLocation="Components/DoubleJump.xsd"/>
<xs:include schemaLocation="Components/WeaponAttachment.xsd"/> <xs:include schemaLocation="Components/WeaponAttachment.xsd"/>
<xs:include schemaLocation="Components/DefenderWeapon.xsd"/> <xs:include schemaLocation="Components/DefenderWeapon.xsd"/>
<xs:include schemaLocation="Components/CapturePointGameMode.xsd"/>
<xs:include schemaLocation="Components/CapturePointArrowHUD.xsd"/>
<xs:include schemaLocation="Components/FloatingEffect.xsd"/>
</xs:schema> </xs:schema>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<BoostAssault xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostAssault.xsd">
<StrengthOfEffect>2</StrengthOfEffect>
</BoostAssault>
@@ -1,18 +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="BoostAssault">
<xs:annotation>
<xs:documentation>This is the assault's class boost component</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<BoostDefender xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostDefender.xsd">
<StrengthOfEffect>10</StrengthOfEffect>
</BoostDefender>
@@ -1,18 +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="BoostDefender">
<xs:annotation>
<xs:documentation>This is the defender's class boost component</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<BoostSniper xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostSniper.xsd">
<StrengthOfEffect>10</StrengthOfEffect>
</BoostSniper>
@@ -1,18 +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="BoostSniper">
<xs:annotation>
<xs:documentation>This is the sniper's class boost component</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="StrengthOfEffect" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>This is the strength of the boost effect</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<CapturePointArrowHUD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePointArrowHUD.xsd">
<CurrentTarget>0</CurrentTarget>
</CapturePointArrowHUD>
@@ -1,18 +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="CapturePointArrowHUD">
<xs:annotation>
<xs:documentation>HUD element for tracking next capturable Capture Point.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="CurrentTarget" type="t:int" minOccurs="0">
<xs:annotation>
<xs:documentation>Corresponds to the current capturepoint the arrow points Towards</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<CapturePointGameMode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePointGameMode.xsd">
<RespawnTime>0.0</RespawnTime>
<MaxRespawnTime>8.0</MaxRespawnTime>
</CapturePointGameMode>
@@ -1,18 +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="CapturePointGameMode">
<xs:complexType>
<xs:all>
<xs:element name="RespawnTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The time since the last respawn wave. Players will be spawned when this reaches MaxRespawnTime.</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="MaxRespawnTime" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>Players will be spawned when RespawnTime reaches this.</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<DashAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DashAbility.xsd"> <DashAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DashAbility.xsd">
<CoolDownMaxTimer>2.0</CoolDownMaxTimer> <CoolDownMaxTimer>2.0</CoolDownMaxTimer>
<CoolDownTimer>0.0</CoolDownTimer>
</DashAbility> </DashAbility>
+1 -4
View File
@@ -10,10 +10,7 @@
<xs:complexType> <xs:complexType>
<xs:all> <xs:all>
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0"> <xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>This is the max cooldown on dash</xs:documentation></xs:annotation> <xs:annotation><xs:documentation>This is the cooldown on dash</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="CoolDownTimer" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>This is the current cooldown on dash</xs:documentation></xs:annotation>
</xs:element> </xs:element>
</xs:all> </xs:all>
</xs:complexType> </xs:complexType>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<DoubleJump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DoubleJump.xsd">
<DoubleJumpSpeed>4.0</DoubleJumpSpeed>
</DoubleJump>
@@ -1,16 +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="DoubleJump">
<xs:annotation><xs:documentation>Enables a Player to double jump.</xs:documentation></xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="DoubleJumpSpeed" type="t:float" minOccurs="0">
<xs:annotation><xs:documentation>Vertical velocity set on double jump.</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<FloatingEffect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FloatingEffect.xsd">
<Period>1</Period>
<Amplitude>1</Amplitude>
<Time>0</Time>
<Axis X="0" Y="0" Z="0"/>
<Position X="0" Y="0" Z="0"/>
</FloatingEffect>
@@ -1,17 +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="FloatingEffect">
<xs:complexType>
<xs:all>
<xs:element name="Period" type="t:double" minOccurs="0"/>
<xs:element name="Amplitude" type="t:double" minOccurs="0"/>
<xs:element name="Time" type="t:double" minOccurs="0"/>
<xs:element name="Axis" type="t:Vector" minOccurs="0"/>
<xs:element name="Position" type="t:Vector" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
-1
View File
@@ -2,7 +2,6 @@
<Player xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Player.xsd"> <Player xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Player.xsd">
<MovementSpeed>3</MovementSpeed> <MovementSpeed>3</MovementSpeed>
<CrouchSpeed>1.5</CrouchSpeed> <CrouchSpeed>1.5</CrouchSpeed>
<JumpSpeed>4.0</JumpSpeed>
<CurrentWishDirection X="0" Y="0" Z="0"/> <CurrentWishDirection X="0" Y="0" Z="0"/>
<CurrentWeapon></CurrentWeapon> <CurrentWeapon></CurrentWeapon>
</Player> </Player>
-3
View File
@@ -11,9 +11,6 @@
<xs:all> <xs:all>
<xs:element name="MovementSpeed" type="t:float" minOccurs="0"/> <xs:element name="MovementSpeed" type="t:float" minOccurs="0"/>
<xs:element name="CrouchSpeed" type="t:float" minOccurs="0"/> <xs:element name="CrouchSpeed" type="t:float" minOccurs="0"/>
<xs:element name="JumpSpeed" type="t:float" minOccurs="0">
<xs:annotation><xs:documentation>Vertical velocity set when jumping.</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="CurrentWishDirection" type="t:Vector" minOccurs="0"/> <xs:element name="CurrentWishDirection" type="t:Vector" minOccurs="0"/>
<xs:element name="CurrentWeapon" type="t:string" minOccurs="0"/> <xs:element name="CurrentWeapon" type="t:string" minOccurs="0"/>
</xs:all> </xs:all>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ShieldAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ShieldAbility.xsd">
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
</ShieldAbility>
@@ -1,18 +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="ShieldAbility">
<xs:annotation>
<xs:documentation>A shield component for one of the classes</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>This is the cooldown on shield</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SprintAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SprintAbility.xsd">
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
</SprintAbility>
@@ -1,18 +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="SprintAbility">
<xs:annotation>
<xs:documentation>A sprint component for one of the classes</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>This is the cooldown on sprint</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoostAssault/>
<c:Lifetime>
<Lifetime>10</Lifetime>
</c:Lifetime>
<c:Transform/>
</Components>
<Children/>
</Entity>
File diff suppressed because it is too large Load Diff
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoostDefender/>
<c:Lifetime>
<Lifetime>10</Lifetime>
</c:Lifetime>
<c:Transform/>
</Components>
<Children/>
</Entity>
-14
View File
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:BoostSniper/>
<c:Lifetime>
<Lifetime>10</Lifetime>
</c:Lifetime>
<c:Transform/>
</Components>
<Children/>
</Entity>
-18
View File
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="DashEffect" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Animation/>
<c:Lifetime>
<Lifetime>0.5</Lifetime>
</c:Lifetime>
<c:ExplosionEffect>
<Velocity X="0" Y="0" Z="0"/>
<TimeSinceDeath>0</TimeSinceDeath>
<ExplosionDuration>0.5</ExplosionDuration>
<EndColor A="0" B="0" G="0" R="0"/>
</c:ExplosionEffect>
<c:Model/>
<c:Transform/>
</Components>
</Entity>
+10 -10
View File
@@ -5019,7 +5019,7 @@
</Team> </Team>
</c:Team> </c:Team>
<c:Transform> <c:Transform>
<Position X="-60.3695679" Y="5.14500046" Z="-79.3789597"/> <Position X="-60.3695679" Y="5.64500046" Z="-79.3789597"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -5089,7 +5089,7 @@
</Team> </Team>
</c:Team> </c:Team>
<c:Transform> <c:Transform>
<Position X="60.0169258" Y="6.0800004" Z="76.2893906"/> <Position X="60.0169258" Y="5.78000021" Z="76.2893906"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -5165,7 +5165,7 @@
<c:Transform> <c:Transform>
<Position X="48.9189453" Y="7.06223536" Z="-78.9347992"/> <Position X="48.9189453" Y="7.06223536" Z="-78.9347992"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/> <Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
<Orientation X="0" Y="74.6042328" Z="0"/> <Orientation X="0" Y="75.6124268" Z="0"/>
</c:Transform> </c:Transform>
<c:Trigger/> <c:Trigger/>
</Components> </Components>
@@ -5184,7 +5184,7 @@
<c:Transform> <c:Transform>
<Position X="-59.3499641" Y="7.46932745" Z="-20.6276321"/> <Position X="-59.3499641" Y="7.46932745" Z="-20.6276321"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/> <Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
<Orientation X="0" Y="71.2585754" Z="0"/> <Orientation X="0" Y="72.2667694" Z="0"/>
</c:Transform> </c:Transform>
<c:Trigger/> <c:Trigger/>
</Components> </Components>
@@ -5203,7 +5203,7 @@
<c:Transform> <c:Transform>
<Position X="-1.13644195" Y="1.38919806" Z="38.9768829"/> <Position X="-1.13644195" Y="1.38919806" Z="38.9768829"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/> <Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
<Orientation X="0" Y="68.8666077" Z="0"/> <Orientation X="0" Y="69.8748016" Z="0"/>
</c:Transform> </c:Transform>
<c:Trigger/> <c:Trigger/>
</Components> </Components>
@@ -5222,7 +5222,7 @@
<c:Transform> <c:Transform>
<Position X="54.7225227" Y="6.51863909" Z="29.0052128"/> <Position X="54.7225227" Y="6.51863909" Z="29.0052128"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/> <Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
<Orientation X="0" Y="69.180542" Z="0"/> <Orientation X="0" Y="70.1887283" Z="0"/>
</c:Transform> </c:Transform>
<c:Trigger/> <c:Trigger/>
</Components> </Components>
@@ -5241,7 +5241,7 @@
<c:Transform> <c:Transform>
<Position X="-51.6792374" Y="8.44526482" Z="32.5153465"/> <Position X="-51.6792374" Y="8.44526482" Z="32.5153465"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/> <Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
<Orientation X="0" Y="68.6292572" Z="0"/> <Orientation X="0" Y="69.6374512" Z="0"/>
</c:Transform> </c:Transform>
<c:Trigger/> <c:Trigger/>
</Components> </Components>
@@ -5260,7 +5260,7 @@
<c:Transform> <c:Transform>
<Position X="-42.3974304" Y="7.28327894" Z="81.9305344"/> <Position X="-42.3974304" Y="7.28327894" Z="81.9305344"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/> <Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
<Orientation X="0" Y="66.7584839" Z="0"/> <Orientation X="0" Y="67.7666702" Z="0"/>
</c:Transform> </c:Transform>
<c:Trigger/> <c:Trigger/>
</Components> </Components>
@@ -5279,7 +5279,7 @@
<c:Transform> <c:Transform>
<Position X="-9.85184956" Y="8.25567532" Z="39.6119232"/> <Position X="-9.85184956" Y="8.25567532" Z="39.6119232"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/> <Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
<Orientation X="0" Y="65.8073425" Z="0"/> <Orientation X="0" Y="66.8154602" Z="0"/>
</c:Transform> </c:Transform>
<c:Trigger/> <c:Trigger/>
</Components> </Components>
@@ -5298,7 +5298,7 @@
<c:Transform> <c:Transform>
<Position X="49.2257118" Y="7.39368248" Z="-31.1810112"/> <Position X="49.2257118" Y="7.39368248" Z="-31.1810112"/>
<Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/> <Scale X="0.300000012" Y="0.300000012" Z="0.300000012"/>
<Orientation X="0" Y="63.0184822" Z="0"/> <Orientation X="0" Y="64.0265808" Z="0"/>
</c:Transform> </c:Transform>
<c:Trigger/> <c:Trigger/>
</Components> </Components>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+18 -26
View File
@@ -13,9 +13,8 @@
</c:AssaultWeapon> </c:AssaultWeapon>
<c:Collidable/> <c:Collidable/>
<c:DefenderWeapon> <c:DefenderWeapon>
<TimeSinceLastFire>52.867678870419283</TimeSinceLastFire> <TimeSinceLastFire>1.6944730461160304</TimeSinceLastFire>
</c:DefenderWeapon> </c:DefenderWeapon>
<c:DoubleJump/>
<c:Health/> <c:Health/>
<c:Physics> <c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/> <Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
@@ -37,10 +36,7 @@
<Children> <Children>
<Entity name="Camera"> <Entity name="Camera">
<Components> <Components>
<c:Camera> <c:Camera/>
<NearClip>0.10000000149011612</NearClip>
<FarClip>300</FarClip>
</c:Camera>
<c:Transform> <c:Transform>
<Position X="0" Y="1.27700007" Z="0"/> <Position X="0" Y="1.27700007" Z="0"/>
</c:Transform> </c:Transform>
@@ -375,7 +371,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName1>Idle</AnimationName1> <AnimationName1>Idle</AnimationName1>
<Time1>1.9408570429715581</Time1> <Time1>0.67172915251515519</Time1>
<Speed1>1</Speed1> <Speed1>1</Speed1>
<AnimationName2></AnimationName2> <AnimationName2></AnimationName2>
<AnimationName3></AnimationName3> <AnimationName3></AnimationName3>
@@ -389,25 +385,25 @@
<Children> <Children>
<Entity name="PrimaryAttachment"> <Entity name="PrimaryAttachment">
<Components> <Components>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
</c:WeaponAttachment>
<c:Spawner> <c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponView.xml</EntityFile> <EntityFile>Schema/Entities/DefenderWeaponView.xml</EntityFile>
</c:Spawner> </c:Spawner>
<c:Transform/> <c:Transform/>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
</c:WeaponAttachment>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
<Entity name="SecondaryAttachment"> <Entity name="SecondaryAttachment">
<Components> <Components>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
</c:WeaponAttachment>
<c:Spawner> <c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponView.xml</EntityFile> <EntityFile>Schema/Entities/AssaultWeaponView.xml</EntityFile>
</c:Spawner> </c:Spawner>
<c:Transform/> <c:Transform/>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
</c:WeaponAttachment>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
@@ -417,10 +413,7 @@
</Entity> </Entity>
<Entity name="ThirdPersonCamera"> <Entity name="ThirdPersonCamera">
<Components> <Components>
<c:Camera> <c:Camera/>
<NearClip>0.10000000149011612</NearClip>
<FarClip>300</FarClip>
</c:Camera>
<c:Model> <c:Model>
<Resource>Models/Widgets/Camera.mesh</Resource> <Resource>Models/Widgets/Camera.mesh</Resource>
<Visible>false</Visible> <Visible>false</Visible>
@@ -436,7 +429,6 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName1>Idle</AnimationName1> <AnimationName1>Idle</AnimationName1>
<Time1>1.5631122524686134</Time1>
<Speed1>1</Speed1> <Speed1>1</Speed1>
<AnimationName2></AnimationName2> <AnimationName2></AnimationName2>
<AnimationName3></AnimationName3> <AnimationName3></AnimationName3>
@@ -456,31 +448,31 @@
<Children> <Children>
<Entity name="PrimaryAttachment"> <Entity name="PrimaryAttachment">
<Components> <Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment> <c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon> <Weapon>DefenderWeapon</Weapon>
<Person> <Person>
<ThirdPerson/> <ThirdPerson/>
</Person> </Person>
</c:WeaponAttachment> </c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
<Entity name="SecondaryAttachment"> <Entity name="SecondaryAttachment">
<Components> <Components>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment> <c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon> <Weapon>AssaultWeapon</Weapon>
<Person> <Person>
<ThirdPerson/> <ThirdPerson/>
</Person> </Person>
</c:WeaponAttachment> </c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
+18 -26
View File
@@ -13,9 +13,8 @@
</c:AssaultWeapon> </c:AssaultWeapon>
<c:Collidable/> <c:Collidable/>
<c:DefenderWeapon> <c:DefenderWeapon>
<TimeSinceLastFire>22.22055262342397</TimeSinceLastFire> <TimeSinceLastFire>1.6944730461160304</TimeSinceLastFire>
</c:DefenderWeapon> </c:DefenderWeapon>
<c:DoubleJump/>
<c:Health/> <c:Health/>
<c:Physics> <c:Physics>
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/> <Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
@@ -37,10 +36,7 @@
<Children> <Children>
<Entity name="Camera"> <Entity name="Camera">
<Components> <Components>
<c:Camera> <c:Camera/>
<NearClip>0.10000000149011612</NearClip>
<FarClip>300</FarClip>
</c:Camera>
<c:Transform> <c:Transform>
<Position X="0" Y="1.27700007" Z="0"/> <Position X="0" Y="1.27700007" Z="0"/>
</c:Transform> </c:Transform>
@@ -375,7 +371,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName1>Idle</AnimationName1> <AnimationName1>Idle</AnimationName1>
<Time1>1.1978087298230946</Time1> <Time1>0.67172915251515519</Time1>
<Speed1>1</Speed1> <Speed1>1</Speed1>
<AnimationName2></AnimationName2> <AnimationName2></AnimationName2>
<AnimationName3></AnimationName3> <AnimationName3></AnimationName3>
@@ -389,25 +385,25 @@
<Children> <Children>
<Entity name="PrimaryAttachment"> <Entity name="PrimaryAttachment">
<Components> <Components>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
</c:WeaponAttachment>
<c:Spawner> <c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponViewRed.xml</EntityFile> <EntityFile>Schema/Entities/DefenderWeaponViewRed.xml</EntityFile>
</c:Spawner> </c:Spawner>
<c:Transform/> <c:Transform/>
<c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon>
</c:WeaponAttachment>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
<Entity name="SecondaryAttachment"> <Entity name="SecondaryAttachment">
<Components> <Components>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
</c:WeaponAttachment>
<c:Spawner> <c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponView.xml</EntityFile> <EntityFile>Schema/Entities/AssaultWeaponView.xml</EntityFile>
</c:Spawner> </c:Spawner>
<c:Transform/> <c:Transform/>
<c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon>
</c:WeaponAttachment>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
@@ -417,10 +413,7 @@
</Entity> </Entity>
<Entity name="ThirdPersonCamera"> <Entity name="ThirdPersonCamera">
<Components> <Components>
<c:Camera> <c:Camera/>
<NearClip>0.10000000149011612</NearClip>
<FarClip>300</FarClip>
</c:Camera>
<c:Model> <c:Model>
<Resource>Models/Widgets/Camera.mesh</Resource> <Resource>Models/Widgets/Camera.mesh</Resource>
<Visible>false</Visible> <Visible>false</Visible>
@@ -436,7 +429,6 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName1>Idle</AnimationName1> <AnimationName1>Idle</AnimationName1>
<Time1>0.69274608502888668</Time1>
<Speed1>1</Speed1> <Speed1>1</Speed1>
<AnimationName2></AnimationName2> <AnimationName2></AnimationName2>
<AnimationName3></AnimationName3> <AnimationName3></AnimationName3>
@@ -456,31 +448,31 @@
<Children> <Children>
<Entity name="PrimaryAttachment"> <Entity name="PrimaryAttachment">
<Components> <Components>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponWorldRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment> <c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon> <Weapon>DefenderWeapon</Weapon>
<Person> <Person>
<ThirdPerson/> <ThirdPerson/>
</Person> </Person>
</c:WeaponAttachment> </c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/DefenderWeaponWorldRed.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
<Entity name="SecondaryAttachment"> <Entity name="SecondaryAttachment">
<Components> <Components>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
<c:WeaponAttachment> <c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon> <Weapon>AssaultWeapon</Weapon>
<Person> <Person>
<ThirdPerson/> <ThirdPerson/>
</Person> </Person>
</c:WeaponAttachment> </c:WeaponAttachment>
<c:Spawner>
<EntityFile>Schema/Entities/AssaultWeaponWorld.xml</EntityFile>
</c:Spawner>
<c:Transform/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
+38 -116
View File
@@ -2,9 +2,6 @@
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd"> <Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components> <Components>
<c:CapturePointGameMode>
<RespawnTime>4.7473226580121377</RespawnTime>
</c:CapturePointGameMode>
<c:Transform> <c:Transform>
<Position X="0" Y="-1" Z="0"/> <Position X="0" Y="-1" Z="0"/>
</c:Transform> </c:Transform>
@@ -43,7 +40,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="9038.11328" Z="0"/> <Orientation X="0" Y="8433.37305" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -84,19 +81,19 @@
</Entity> </Entity>
<Entity name="DirectionalLight"> <Entity name="DirectionalLight">
<Components> <Components>
<c:RaptorCopter>
<Speed>1</Speed>
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:DirectionalLight> <c:DirectionalLight>
<Intensity>0.80000001192092896</Intensity> <Intensity>0.80000001192092896</Intensity>
</c:DirectionalLight> </c:DirectionalLight>
<c:Model> <c:Model>
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource> <Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
</c:Model> </c:Model>
<c:RaptorCopter>
<Speed>1</Speed>
<Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter>
<c:Transform> <c:Transform>
<Position X="2.1529963" Y="6.59221172" Z="0.169116676"/> <Position X="2.1529963" Y="6.59221172" Z="0.169116676"/>
<Orientation X="4.16300011" Y="18876.6172" Z="0"/> <Orientation X="4.16300011" Y="18271.9141" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children/> <Children/>
@@ -111,11 +108,7 @@
<Children> <Children>
<Entity name="RunAnim"> <Entity name="RunAnim">
<Components> <Components>
<c:Animation> <c:Animation/>
<AnimationName1></AnimationName1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
</c:Animation>
<c:Model> <c:Model>
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource> <Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
</c:Model> </c:Model>
@@ -127,11 +120,7 @@
</Entity> </Entity>
<Entity name="Walkanim"> <Entity name="Walkanim">
<Components> <Components>
<c:Animation> <c:Animation/>
<AnimationName1></AnimationName1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
</c:Animation>
<c:Model> <c:Model>
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource> <Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
</c:Model> </c:Model>
@@ -179,17 +168,13 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="2856.05518" Z="0"/> <Orientation X="0" Y="2553.63574" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
<Entity name="Asset"> <Entity name="Asset">
<Components> <Components>
<c:Animation> <c:Animation/>
<AnimationName1></AnimationName1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
</c:Animation>
<c:Model> <c:Model>
<Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource> <Resource>Models/Characters/Assault/AssaultAnimated.mesh</Resource>
</c:Model> </c:Model>
@@ -228,7 +213,7 @@
<Axis X="1" Y="1" Z="1"/> <Axis X="1" Y="1" Z="1"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="17467.0977" Y="17467.0977" Z="17467.0977"/> <Orientation X="16862.3945" Y="16862.3945" Z="16862.3945"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -292,7 +277,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="17263.0938" Z="0"/> <Orientation X="0" Y="16658.3906" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -324,7 +309,7 @@
<Axis X="0.699999988" Y="1" Z="0.300000012"/> <Axis X="0.699999988" Y="1" Z="0.300000012"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="12630.0664" Y="17990.5039" Z="5383.80176"/> <Orientation X="12206.665" Y="17385.8008" Z="5202.3335"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -674,7 +659,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1153.80225" Z="0"/> <Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -721,7 +706,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1153.80225" Z="0"/> <Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -781,7 +766,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1153.80225" Z="0"/> <Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -828,7 +813,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1153.80225" Z="0"/> <Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -874,7 +859,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1153.80225" Z="0"/> <Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -921,7 +906,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1153.80225" Z="0"/> <Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -968,7 +953,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1153.80225" Z="0"/> <Orientation X="0" Y="851.386902" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -1028,7 +1013,6 @@
</HomePointForTeam> </HomePointForTeam>
<CaptureTimer>15</CaptureTimer> <CaptureTimer>15</CaptureTimer>
</c:CapturePoint> </c:CapturePoint>
<c:Trigger/>
<c:Model> <c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource> <Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.300000012" B="0" G="0" R="1"/> <Color A="0.300000012" B="0" G="0" R="1"/>
@@ -1043,6 +1027,7 @@
<Position X="0" Y="2" Z="0"/> <Position X="0" Y="2" Z="0"/>
<Scale X="8" Y="4" Z="8"/> <Scale X="8" Y="4" Z="8"/>
</c:Transform> </c:Transform>
<c:Trigger/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
@@ -1078,7 +1063,6 @@
<c:CapturePoint> <c:CapturePoint>
<CapturePointNumber>1</CapturePointNumber> <CapturePointNumber>1</CapturePointNumber>
</c:CapturePoint> </c:CapturePoint>
<c:Trigger/>
<c:Model> <c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource> <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="1"/>
@@ -1089,6 +1073,7 @@
<Position X="0" Y="2" Z="0"/> <Position X="0" Y="2" Z="0"/>
<Scale X="8" Y="4" Z="8"/> <Scale X="8" Y="4" Z="8"/>
</c:Transform> </c:Transform>
<c:Trigger/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
@@ -1122,7 +1107,6 @@
<c:CapturePoint> <c:CapturePoint>
<CapturePointNumber>2</CapturePointNumber> <CapturePointNumber>2</CapturePointNumber>
</c:CapturePoint> </c:CapturePoint>
<c:Trigger/>
<c:Model> <c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource> <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="1"/>
@@ -1133,6 +1117,7 @@
<Position X="0" Y="2" Z="0"/> <Position X="0" Y="2" Z="0"/>
<Scale X="8" Y="4" Z="8"/> <Scale X="8" Y="4" Z="8"/>
</c:Transform> </c:Transform>
<c:Trigger/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
@@ -1168,7 +1153,6 @@
<c:CapturePoint> <c:CapturePoint>
<CapturePointNumber>3</CapturePointNumber> <CapturePointNumber>3</CapturePointNumber>
</c:CapturePoint> </c:CapturePoint>
<c:Trigger/>
<c:Model> <c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource> <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="1"/>
@@ -1179,6 +1163,7 @@
<Position X="0" Y="2" Z="0"/> <Position X="0" Y="2" Z="0"/>
<Scale X="8" Y="4" Z="8"/> <Scale X="8" Y="4" Z="8"/>
</c:Transform> </c:Transform>
<c:Trigger/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
@@ -1218,7 +1203,6 @@
<CaptureTimer>-15</CaptureTimer> <CaptureTimer>-15</CaptureTimer>
<CapturePointNumber>4</CapturePointNumber> <CapturePointNumber>4</CapturePointNumber>
</c:CapturePoint> </c:CapturePoint>
<c:Trigger/>
<c:Model> <c:Model>
<Resource>Models/Core/UnitCube.mesh</Resource> <Resource>Models/Core/UnitCube.mesh</Resource>
<Color A="0.300000012" B="1" G="0" R="0"/> <Color A="0.300000012" B="1" G="0" R="0"/>
@@ -1233,6 +1217,7 @@
<Position X="0" Y="2" Z="0"/> <Position X="0" Y="2" Z="0"/>
<Scale X="8" Y="4" Z="8"/> <Scale X="8" Y="4" Z="8"/>
</c:Transform> </c:Transform>
<c:Trigger/>
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
@@ -1382,7 +1367,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1687.52917" Z="0"/> <Orientation X="0" Y="1385.11243" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -1391,7 +1376,7 @@
<c:ExplosionEffect> <c:ExplosionEffect>
<ColorByDistance>true</ColorByDistance> <ColorByDistance>true</ColorByDistance>
<Velocity X="0.800000012" Y="0.0379999988" Z="0"/> <Velocity X="0.800000012" Y="0.0379999988" Z="0"/>
<TimeSinceDeath>2.5396116058983438</TimeSinceDeath> <TimeSinceDeath>0.8256214817261025</TimeSinceDeath>
<ExplosionDuration>3.7999999523162842</ExplosionDuration> <ExplosionDuration>3.7999999523162842</ExplosionDuration>
<EndColor A="0" B="23.5294113" G="11.7647057" R="0"/> <EndColor A="0" B="23.5294113" G="11.7647057" R="0"/>
<Randomness>true</Randomness> <Randomness>true</Randomness>
@@ -1438,7 +1423,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1687.52917" Z="0"/> <Orientation X="0" Y="1385.11243" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -1447,7 +1432,7 @@
<c:ExplosionEffect> <c:ExplosionEffect>
<Velocity X="0.5" Y="1" Z="0"/> <Velocity X="0.5" Y="1" Z="0"/>
<ExplosionOrigin X="0" Y="0.900000036" Z="0"/> <ExplosionOrigin X="0" Y="0.900000036" Z="0"/>
<TimeSinceDeath>1.5396208215609732</TimeSinceDeath> <TimeSinceDeath>1.8641349174045843</TimeSinceDeath>
</c:ExplosionEffect> </c:ExplosionEffect>
<c:Model> <c:Model>
<Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource> <Resource>Models/Characters/Assault/AssaultTPose.mesh</Resource>
@@ -1490,22 +1475,18 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1687.52917" Z="0"/> <Orientation X="0" Y="1385.11243" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
<Entity name="Asset"> <Entity name="Asset">
<Components> <Components>
<c:Animation> <c:Animation/>
<AnimationName1></AnimationName1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
</c:Animation>
<c:ExplosionEffect> <c:ExplosionEffect>
<ColorByDistance>true</ColorByDistance> <ColorByDistance>true</ColorByDistance>
<Velocity X="0.300000012" Y="2" Z="0"/> <Velocity X="0.300000012" Y="2" Z="0"/>
<ExplosionOrigin X="0" Y="1.30000007" Z="-0.200000003"/> <ExplosionOrigin X="0" Y="1.30000007" Z="-0.200000003"/>
<TimeSinceDeath>1.5396208215609732</TimeSinceDeath> <TimeSinceDeath>1.8641349174045843</TimeSinceDeath>
<EndColor A="0" B="0.333333343" G="0.933333337" R="3.92156863"/> <EndColor A="0" B="0.333333343" G="0.933333337" R="3.92156863"/>
<Randomness>true</Randomness> <Randomness>true</Randomness>
</c:ExplosionEffect> </c:ExplosionEffect>
@@ -1550,7 +1531,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1695.30933" Z="0"/> <Orientation X="0" Y="1392.89258" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -1560,7 +1541,7 @@
<ColorByDistance>true</ColorByDistance> <ColorByDistance>true</ColorByDistance>
<Velocity X="0" Y="0.699999988" Z="0"/> <Velocity X="0" Y="0.699999988" Z="0"/>
<ExplosionOrigin X="0" Y="-1.10000002" Z="0"/> <ExplosionOrigin X="0" Y="-1.10000002" Z="0"/>
<TimeSinceDeath>4.4522528839264339</TimeSinceDeath> <TimeSinceDeath>1.2301962937648341</TimeSinceDeath>
<ExplosionDuration>10</ExplosionDuration> <ExplosionDuration>10</ExplosionDuration>
<EndColor A="1" B="0" G="0" R="1"/> <EndColor A="1" B="0" G="0" R="1"/>
<RandomnessScalar>3</RandomnessScalar> <RandomnessScalar>3</RandomnessScalar>
@@ -1608,7 +1589,7 @@
<Axis X="0" Y="1" Z="0"/> <Axis X="0" Y="1" Z="0"/>
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Orientation X="0" Y="1293.42383" Z="0"/> <Orientation X="0" Y="991.007263" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
@@ -1618,7 +1599,7 @@
<ColorByDistance>true</ColorByDistance> <ColorByDistance>true</ColorByDistance>
<Velocity X="6" Y="0.100000001" Z="0"/> <Velocity X="6" Y="0.100000001" Z="0"/>
<ExplosionOrigin X="0" Y="-10" Z="0"/> <ExplosionOrigin X="0" Y="-10" Z="0"/>
<TimeSinceDeath>3.2362842141074992</TimeSinceDeath> <TimeSinceDeath>3.4214855659573402</TimeSinceDeath>
<ExponentialAccelaration>true</ExponentialAccelaration> <ExponentialAccelaration>true</ExponentialAccelaration>
<ExplosionDuration>5</ExplosionDuration> <ExplosionDuration>5</ExplosionDuration>
<Randomness>true</Randomness> <Randomness>true</Randomness>
@@ -1709,7 +1690,6 @@
</c:Physics> </c:Physics>
<c:Player> <c:Player>
<MovementSpeed>5</MovementSpeed> <MovementSpeed>5</MovementSpeed>
<CurrentWeapon></CurrentWeapon>
</c:Player> </c:Player>
<c:Team> <c:Team>
<Team> <Team>
@@ -1732,7 +1712,6 @@
<Entity name="PlayerName"> <Entity name="PlayerName">
<Components> <Components>
<c:Text> <c:Text>
<Content></Content>
<Resource>Fonts/DroidSans.ttf,100</Resource> <Resource>Fonts/DroidSans.ttf,100</Resource>
<Color A="1" B="0" G="1" R="0"/> <Color A="1" B="0" G="1" R="0"/>
</c:Text> </c:Text>
@@ -1801,7 +1780,7 @@
<c:ExplosionEffect> <c:ExplosionEffect>
<ColorByDistance>true</ColorByDistance> <ColorByDistance>true</ColorByDistance>
<Velocity X="0.800000012" Y="0.0379999988" Z="0"/> <Velocity X="0.800000012" Y="0.0379999988" Z="0"/>
<TimeSinceDeath>2.5396116058983438</TimeSinceDeath> <TimeSinceDeath>0.8256214817261025</TimeSinceDeath>
<ExplosionDuration>3.7999999523162842</ExplosionDuration> <ExplosionDuration>3.7999999523162842</ExplosionDuration>
<EndColor A="0" B="23.5294113" G="11.7647057" R="0"/> <EndColor A="0" B="23.5294113" G="11.7647057" R="0"/>
<Randomness>true</Randomness> <Randomness>true</Randomness>
@@ -1844,11 +1823,7 @@
</Entity> </Entity>
<Entity name="PlayerModel"> <Entity name="PlayerModel">
<Components> <Components>
<c:Animation> <c:Animation/>
<AnimationName1></AnimationName1>
<AnimationName2></AnimationName2>
<AnimationName3></AnimationName3>
</c:Animation>
<c:Shielded/> <c:Shielded/>
<c:HiddenForLocalPlayer/> <c:HiddenForLocalPlayer/>
<c:Model> <c:Model>
@@ -1950,7 +1925,6 @@
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Props/FoliageDiff.png</DiffuseTexture> <DiffuseTexture>Textures/Props/FoliageDiff.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform/> <c:Transform/>
</Components> </Components>
@@ -1960,7 +1934,6 @@
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Props/FoliageDiff.png</DiffuseTexture> <DiffuseTexture>Textures/Props/FoliageDiff.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="-0.177861199" Y="0" Z="-1.04673338"/> <Position X="-0.177861199" Y="0" Z="-1.04673338"/>
@@ -1981,7 +1954,6 @@
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/> <Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -1999,7 +1971,6 @@
</c:Fill> </c:Fill>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -2015,7 +1986,6 @@
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/> <Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -2033,7 +2003,6 @@
</c:Fill> </c:Fill>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -2049,7 +2018,6 @@
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/> <Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -2068,7 +2036,6 @@
</c:Fill> </c:Fill>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -2084,7 +2051,6 @@
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/> <Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -2102,7 +2068,6 @@
</c:Fill> </c:Fill>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -2118,7 +2083,6 @@
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="0" G="0" R="1"/> <Color A="0.699999988" B="0" G="0" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -2135,7 +2099,6 @@
</c:Fill> </c:Fill>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture> <DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -2204,7 +2167,6 @@
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/ErrorTexture.png</DiffuseTexture> <DiffuseTexture>Textures/Core/ErrorTexture.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="-1"/> <Position X="0" Y="0" Z="-1"/>
@@ -2216,7 +2178,6 @@
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0.388422519" Z="0.0627754927"/> <Position X="0" Y="0.388422519" Z="0.0627754927"/>
@@ -2245,7 +2206,6 @@
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0.214031488" Z="0.0627754927"/> <Position X="0" Y="0.214031488" Z="0.0627754927"/>
@@ -2274,7 +2234,6 @@
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0.0367300175" Z="0.0627754927"/> <Position X="0" Y="0.0367300175" Z="0.0627754927"/>
@@ -2303,7 +2262,6 @@
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="-0.148274168" Z="0.0627754927"/> <Position X="0" Y="-0.148274168" Z="0.0627754927"/>
@@ -2332,7 +2290,6 @@
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="-0.335298717" Z="0.0627754927"/> <Position X="0" Y="-0.335298717" Z="0.0627754927"/>
@@ -2374,7 +2331,6 @@
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/ErrorTexture.png</DiffuseTexture> <DiffuseTexture>Textures/Core/ErrorTexture.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="-1"/> <Position X="0" Y="0" Z="-1"/>
@@ -2386,7 +2342,6 @@
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0.375197947" Z="0.0627754927"/> <Position X="0" Y="0.375197947" Z="0.0627754927"/>
@@ -2415,7 +2370,6 @@
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0.199327558" Z="0.0627754927"/> <Position X="0" Y="0.199327558" Z="0.0627754927"/>
@@ -2444,7 +2398,6 @@
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0.0159880854" Z="0.0627754927"/> <Position X="0" Y="0.0159880854" Z="0.0627754927"/>
@@ -2473,7 +2426,6 @@
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture> <DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="-0.164955258" Z="0.0627754927"/> <Position X="0" Y="-0.164955258" Z="0.0627754927"/>
@@ -2530,36 +2482,6 @@
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
<Entity>
<Components>
<c:Team/>
<c:Transform>
<Position X="9.42733288" Y="8.22214794" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="CapturePointArrow">
<Components>
<c:CapturePointArrowHUD>
<CurrentTarget>2</CurrentTarget>
</c:CapturePointArrowHUD>
<c:Model>
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
</c:Model>
<c:Team>
<Team>
<Red/>
</Team>
</c:Team>
<c:Transform>
<Scale X="10.7000008" Y="1.4000001" Z="5.30000019"/>
<Orientation X="-0.648448348" Y="-0.417814791" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children> </Children>
</Entity> </Entity>
@@ -1,219 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SpectatorCamera" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Camera/>
<c:Transform>
<Position X="0" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="SpectatorHUD">
<Components>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
</c:Transform>
</Components>
<Children>
<Entity name="RespawnTimer">
<Components>
<c:Text>
<Content>Time to respawn: 0</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="0" G="1" R="0.784313738"/>
<Alignment>
<Left/>
</Alignment>
</c:Text>
<c:Transform>
<Position X="-0.115000000" Y="0.15304254" Z="0"/>
<Scale X="0.0250000004" Y="0.0250000004" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="CapturePointHUD">
<Components>
<c:Transform>
<Position X="0" Y="0.190541431" Z="0"/>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>2</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="0.811270177" Y="0.440691769" Z="-0.100000001"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>3</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="1.62788737" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>4</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="-0.820431828" Y="0.441878349" Z="-0.100000001"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>1</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Percentage>0.59265931447347009</Percentage>
<Color A="0.699999988" B="0" G="0" R="1"/>
</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"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="4.71238899"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="0" G="0" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD/>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
-8
View File
@@ -52,14 +52,6 @@
<xs:element ref="c:Button" minOccurs="0"/> <xs:element ref="c:Button" minOccurs="0"/>
<xs:element ref="c:WeaponAttachment" minOccurs="0"/> <xs:element ref="c:WeaponAttachment" minOccurs="0"/>
<xs:element ref="c:DefenderWeapon" minOccurs="0"/> <xs:element ref="c:DefenderWeapon" minOccurs="0"/>
<xs:element ref="c:CapturePointArrowHUD" minOccurs="0"/>
<xs:element ref="c:FloatingEffect" minOccurs="0"/>
<xs:element ref="c:AmmoPickup" minOccurs="0"/>
<xs:element ref="c:HealthPickup" minOccurs="0"/>
<xs:element ref="c:CapturePointGameMode" minOccurs="0"/>
<xs:element ref="c:DoubleJump" minOccurs="0"/>
<xs:element ref="c:HealthHUD" minOccurs="0"/>
<xs:element ref="c:SpriteIndicator" minOccurs="0"/>
</xs:all> </xs:all>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
@@ -2,6 +2,8 @@
layout (binding = 0) uniform sampler2D SceneTexture; layout (binding = 0) uniform sampler2D SceneTexture;
layout (binding = 1) uniform sampler2D BloomTexture; layout (binding = 1) uniform sampler2D BloomTexture;
layout (binding = 2) uniform sampler2D SceneTextureLowRes;
layout (binding = 3) uniform sampler2D BloomTextureLowRes;
uniform float Exposure; uniform float Exposure;
uniform float Gamma; uniform float Gamma;
@@ -15,12 +17,21 @@ void main()
{ {
vec4 hdrColor = texture(SceneTexture, Input.TextureCoordinate); vec4 hdrColor = texture(SceneTexture, Input.TextureCoordinate);
vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate); vec4 bloomColor = texture(BloomTexture, Input.TextureCoordinate);
vec4 hdrColorLowRes = texture(SceneTextureLowRes, Input.TextureCoordinate);
vec4 bloomColorLowRes = texture(BloomTextureLowRes, Input.TextureCoordinate);
//hdrColor = hdrColor * SSAO; //hdrColor = hdrColor * SSAO;
hdrColor += bloomColor; hdrColor += bloomColor;
hdrColorLowRes;
float hdrColorsum = hdrColorLowRes.r + hdrColorLowRes.g + hdrColorLowRes.b;
//Toon mapping thingy //Toon mapping thingy
vec3 result = vec3(1.0) - exp(-hdrColor.rgb * Exposure); vec3 result;
if(hdrColorsum > 0.0) {
result = vec3(1.0) - exp(-hdrColorLowRes.rgb * Exposure);
} else {
result = vec3(1.0) - exp(-hdrColor.rgb * Exposure);
}
//gamme correction //gamme correction
result = pow(result, vec3(1.0 / Gamma)); result = pow(result, vec3(1.0 / Gamma));
+3 -4
View File
@@ -171,8 +171,7 @@ void main()
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed); vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)); color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0; float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0;
vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a; color_result = color_result * clamp(1/specularTexel, 0, 1)*2 + reflectionColor * clamp(specularTexel, 0, 1)/2;
color_result = color_result * clamp(1/specularTexel.a, 0, 1) + reflectionTotal;
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color; //vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
@@ -183,9 +182,9 @@ void main()
} }
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1)); sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
//sceneColor = vec4(reflectionColor.xyz, 1); //sceneColor = vec4(reflectionColor.xyz, 1);
color_result.xyz += glowTexel.xyz*GlowIntensity; color_result += glowTexel*GlowIntensity;
bloomColor = vec4(max(color_result.xyz - 1.0, 0.0), clamp(color_result.a, 0, 1)); bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), clamp(color_result.a, 0, 1));
//Tiled Debug Code //Tiled Debug Code
/* /*
@@ -1,207 +0,0 @@
#version 430
#define MIN_AMBIENT_LIGHT 0.3
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
uniform vec4 Color;
uniform vec4 DiffuseColor;
uniform vec2 ScreenDimensions;
uniform vec4 FillColor;
uniform vec4 AmbientColor;
uniform float FillPercentage;
uniform float GlowIntensity = 10;
uniform vec3 CameraPosition;
uniform int SSAOQuality;
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 = 5) uniform samplerCube CubeMap;
layout (binding = 31) uniform sampler2D ShieldBuffer;
#define TILE_SIZE 16
struct LightSource {
vec4 Position;
vec4 Direction;
vec4 Color;
float Radius;
float Intensity;
float Falloff;
int Type;
};
layout (std430, binding = 1) buffer LightBuffer
{
LightSource List[];
} LightSources;
struct LightGrid {
float Start;
float Amount;
vec2 Padding;
};
layout (std430, binding = 2) buffer LightGridBuffer
{
LightGrid Data[];
} LightGrids;
layout (std430, binding = 4) buffer LightIndexBuffer
{
float LightIndex[];
};
in VertexData{
vec3 Position;
vec3 Normal;
vec3 Tangent;
vec3 BiTangent;
vec2 TextureCoordinate;
vec4 ExplosionColor;
float ExplosionPercentageElapsed;
}Input;
out vec4 sceneColor;
out vec4 bloomColor;
struct LightResult {
vec4 Diffuse;
vec4 Specular;
};
float CalcAttenuation(float radius, float dist, float falloff) {
return 1.0 - smoothstep(radius * falloff, radius, dist);
}
vec4 CalcSpecular(vec4 lightColor, vec4 viewVec, vec4 lightVec, vec4 normal) {
vec4 R = normalize( reflect(-lightVec, normal));
float RdotV = max( dot(R, viewVec), 0.0);
return lightColor * pow(RdotV, 90.0);
}
vec4 CalcDiffuse(vec4 lightColor, vec4 lightVec, vec4 normal) {
float power = max( dot(normal, lightVec), 0.0);
return lightColor * power;
}
LightResult CalcPointLightSource(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal, float falloff)
{
vec4 L = lightPos - position;
float dist = length(L);
L = normalize(L);
float attenuation = CalcAttenuation(lightRadius, dist, falloff);
LightResult result;
result.Diffuse = CalcDiffuse(lightColor, L, normal) * attenuation * intensity;
result.Specular = CalcSpecular(lightColor, viewVec, L, normal) * attenuation * intensity;
return result;
}
LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensity, vec4 viewVec, vec4 vertNormal)
{
vec4 L = normalize( -vec4(direction.xyz, 0) );
LightResult result;
result.Diffuse = CalcDiffuse(color, L, vertNormal) * intensity;
result.Specular = CalcSpecular(color, viewVec, L, vertNormal) * intensity;
return result;
}
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
{
mat3 TBN = mat3(tangent, bitangent, normal);
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
return vec4(TBN * normalize(NormalMap), 0.0);
}
void main()
{
float shieldDepthValue = texelFetch(ShieldBuffer, ivec2(gl_FragCoord.xy), 0).r;
if(shieldDepthValue < gl_FragCoord.z){
discard;
}
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy) >> int(SSAOQuality), 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);
vec4 position = V * M * vec4(Input.Position, 1.0);
vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate * NormalUVRepeat, NormalMapTexture);
normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-position);
vec3 I = normalize(vec3(M * vec4(Input.Position, 1.0)) - CameraPosition);
vec3 R = reflect(-I, Input.Normal);
//R = vec3(P * vec4(R, 1.0));
vec4 reflectionColor = texture(CubeMap, R);
vec2 tilePos;
tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
LightResult totalLighting;
totalLighting.Diffuse = vec4(AmbientColor.rgb * ao, 1.0);
int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE)));
int start = int(LightGrids.Data[currentTile].Start);
int amount = int(LightGrids.Data[currentTile].Amount);
for(int i = start; i < start + amount; i++) {
int l = int(LightIndex[i]);
LightSource light = LightSources.List[l];
LightResult light_result;
//These if statements should be removed.
if(light.Type == 1) { // point
light_result = CalcPointLightSource(V * light.Position, light.Radius, light.Color, light.Intensity, viewVec, position, normal, light.Falloff);
} else if (light.Type == 2) { //Directional
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
}
totalLighting.Diffuse += vec4(light_result.Diffuse.rgb * ao, light_result.Diffuse.a);
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
}
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
float specularResult = (specularTexel.r + specularTexel.g + specularTexel.b)/3.0;
vec4 reflectionTotal = reflectionColor * (1-specularTexel.a) * color_result.a;
color_result = color_result * clamp(1/specularTexel.a, 0, 1) + reflectionTotal;
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
if(pos <= FillPercentage) {
color_result += FillColor;
}
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
//sceneColor = vec4(reflectionColor.xyz, 1);
color_result.xyz += glowTexel.xyz*GlowIntensity;
bloomColor = vec4(max(color_result.xyz - 1.0, 0.0), clamp(color_result.a, 0, 1));
//Tiled Debug Code
/*
if(int(gl_FragCoord.x)%16 == 0 || int(gl_FragCoord.y)%16 == 0 ) {
sceneColor += vec4(0.5, 0, 0, 0);
} else {
sceneColor += vec4(LightGrids.Data[int(tilePos.x + tilePos.y*80)].Amount/LightSources.List.length(), 0, 0, 1);
}
*/
}
@@ -1,253 +0,0 @@
#version 430
#define MIN_AMBIENT_LIGHT 0.3
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
uniform vec2 ScreenDimensions;
uniform float FillPercentage;
uniform vec4 DiffuseColor;
uniform vec4 FillColor;
uniform vec4 Color;
uniform vec4 AmbientColor;
uniform int SSAOQuality;
//Get bineded at the same time as the textures
uniform vec2 DiffuseUVRepeat1;
uniform vec2 DiffuseUVRepeat2;
uniform vec2 DiffuseUVRepeat3;
uniform vec2 NormalUVRepeat1;
uniform vec2 NormalUVRepeat2;
uniform vec2 NormalUVRepeat3;
uniform vec2 SpecularUVRepeat1;
uniform vec2 SpecularUVRepeat2;
uniform vec2 SpecularUVRepeat3;
uniform vec2 GlowUVRepeat1;
uniform vec2 GlowUVRepeat2;
uniform vec2 GlowUVRepeat3;
layout (binding = 0) uniform sampler2D 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 = 31) uniform samplerCube ShieldBuffer;
#define TILE_SIZE 16
struct LightSource {
vec4 Position;
vec4 Direction;
vec4 Color;
float Radius;
float Intensity;
float Falloff;
int Type;
};
layout (std430, binding = 1) buffer LightBuffer
{
LightSource List[];
} LightSources;
struct LightGrid {
float Start;
float Amount;
vec2 Padding;
};
layout (std430, binding = 2) buffer LightGridBuffer
{
LightGrid Data[];
} LightGrids;
layout (std430, binding = 4) buffer LightIndexBuffer
{
float LightIndex[];
};
in VertexData{
vec3 Position;
vec3 Normal;
vec3 Tangent;
vec3 BiTangent;
vec2 TextureCoordinate;
vec4 ExplosionColor;
float ExplosionPercentageElapsed;
}Input;
out vec4 sceneColor;
out vec4 bloomColor;
struct LightResult {
vec4 Diffuse;
vec4 Specular;
};
float CalcAttenuation(float radius, float dist, float falloff) {
return 1.0 - smoothstep(radius * 0.3, radius, dist);
}
vec4 CalcSpecular(vec4 lightColor, vec4 viewVec, vec4 lightVec, vec4 normal) {
vec4 R = normalize( reflect(-lightVec, normal));
float RdotV = max( dot(R, viewVec), 0.0);
return lightColor * pow(RdotV, 90.0);
}
vec4 CalcDiffuse(vec4 lightColor, vec4 lightVec, vec4 normal) {
float power = max( dot(normal, lightVec), 0.0);
return lightColor * power;
}
LightResult CalcPointLightSource(vec4 lightPos, float lightRadius, vec4 lightColor, float intensity, vec4 viewVec, vec4 position, vec4 normal, float falloff)
{
vec4 L = lightPos - position;
float dist = length(L);
L = normalize(L);
float attenuation = CalcAttenuation(lightRadius, dist, falloff);
LightResult result;
result.Diffuse = CalcDiffuse(lightColor, L, normal) * attenuation * intensity;
result.Specular = CalcSpecular(lightColor, viewVec, L, normal) * attenuation * intensity;
return result;
}
LightResult CalcDirectionalLightSource(vec4 direction, vec4 color, float intensity, vec4 viewVec, vec4 vertNormal)
{
vec4 L = normalize( -vec4(direction.xyz, 0) );
LightResult result;
result.Diffuse = CalcDiffuse(color, L, vertNormal) * intensity;
result.Specular = CalcSpecular(color, viewVec, L, vertNormal) * intensity;
return result;
}
vec4 CalcNormalMappedValue(vec3 normal, vec3 tangent, vec3 bitangent, vec2 textureCoordinate, sampler2D normalMap)
{
mat3 TBN = mat3(tangent, bitangent, normal);
vec3 NormalMap = texture(normalMap, textureCoordinate).xyz * 2.0 - vec3(1.0);
return vec4(TBN * normalize(NormalMap), 0.0);
}
vec4 CalcBlendedTexel(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){
vec4 R_Channel = texture2D(R, Input.TextureCoordinate * R_TileValues);
vec4 G_Channel = texture2D(G, Input.TextureCoordinate * G_TileValues);
vec4 B_Channel = texture2D(B, Input.TextureCoordinate * B_TileValues);
float total = blendValue.r + blendValue.g + blendValue.b;
float totalDiv = 1.0f / total;
blendValue.r = blendValue.r * totalDiv;
blendValue.g = blendValue.g * totalDiv;
blendValue.b = blendValue.b * totalDiv;
return blendValue.r * R_Channel
+ blendValue.g * G_Channel
+ blendValue.b * B_Channel;
}
vec4 CalcBlendedNormal(vec4 blendValue, sampler2D R, sampler2D G, sampler2D B,
vec2 R_TileValues, vec2 G_TileValues, vec2 B_TileValues){
mat3 TBN = mat3(Input.Tangent, Input.BiTangent, Input.Normal);
vec3 R_Channel = texture(R, Input.TextureCoordinate * R_TileValues).xyz * 2.0 - vec3(1.0);
vec3 G_Channel = texture(G, Input.TextureCoordinate * G_TileValues).xyz * 2.0 - vec3(1.0);
vec3 B_Channel = texture(B, Input.TextureCoordinate * B_TileValues).xyz * 2.0 - vec3(1.0);
float total = blendValue.r + blendValue.g + blendValue.b + blendValue.a;
float totalDiv = 1 / total;
blendValue.r = blendValue.r * totalDiv;
blendValue.g = blendValue.g * totalDiv;
blendValue.b = blendValue.b * totalDiv;
vec3 Normal_result = blendValue.r * R_Channel
+ blendValue.g * G_Channel
+ blendValue.b * B_Channel;
return vec4(TBN * normalize(Normal_result), 0.0);
}
void main()
{
float ao = texelFetch(AOTexture, ivec2(gl_FragCoord.xy) >> int(SSAOQuality), 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,
DiffuseUVRepeat1, DiffuseUVRepeat2, DiffuseUVRepeat3);
vec4 glowTexel = CalcBlendedTexel(splatTexel, GlowMapTexture1, GlowMapTexture2, GlowMapTexture3,
GlowUVRepeat1, GlowUVRepeat2, GlowUVRepeat3);
vec4 specularTexel = CalcBlendedTexel(splatTexel, SpecularMapTexture1, SpecularMapTexture2, SpecularMapTexture3,
SpecularUVRepeat1, SpecularUVRepeat2, SpecularUVRepeat3);
vec4 position = V * M * vec4(Input.Position, 1.0);
//vec4 normal = V * CalcNormalMappedValue(Input.Normal, Input.Tangent, Input.BiTangent, Input.TextureCoordinate, SplatMapTexture);
vec4 normal = V * CalcBlendedNormal(splatTexel, NormalMapTexture1, NormalMapTexture2, NormalMapTexture3,
NormalUVRepeat1, NormalUVRepeat2, NormalUVRepeat3);
normal = normalize(normal);
//vec4 normal = normalize(V * vec4(Input.Normal, 0.0));
vec4 viewVec = normalize(-position);
vec2 tilePos;
tilePos.x = int(gl_FragCoord.x/TILE_SIZE);
tilePos.y = int(gl_FragCoord.y/TILE_SIZE);
LightResult totalLighting;
totalLighting.Diffuse = vec4(AmbientColor.rgb * ao, 1.0);
int currentTile = int(floor(gl_FragCoord.x/TILE_SIZE) + (floor(gl_FragCoord.y/TILE_SIZE) * int(ScreenDimensions.x/TILE_SIZE)));
int start = int(LightGrids.Data[currentTile].Start);
int amount = int(LightGrids.Data[currentTile].Amount);
for(int i = start; i < start + amount; i++) {
int l = int(LightIndex[i]);
LightSource light = LightSources.List[l];
LightResult light_result;
//These if statements should be removed.
if(light.Type == 1) { // point
light_result = CalcPointLightSource(V * light.Position, light.Radius, light.Color, light.Intensity, viewVec, position, normal, light.Falloff);
} else if (light.Type == 2) { //Directional
light_result = CalcDirectionalLightSource(V * light.Direction, light.Color, light.Intensity, viewVec, normal);
}
totalLighting.Diffuse += vec4(light_result.Diffuse.rgb * ao, light_result.Diffuse.a);
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
}
vec4 color_result = mix((Color * diffuseTexel * DiffuseColor), Input.ExplosionColor, Input.ExplosionPercentageElapsed);
color_result = color_result * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel));
//vec4 color_result = (DiffuseColor + Input.ExplosionColor) * (totalLighting.Diffuse + (totalLighting.Specular * specularTexel)) * diffuseTexel * Color;
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
if(pos <= FillPercentage) {
color_result += FillColor;
}
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
color_result += glowTexel*3;
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), 1.0);
//Tiled Debug Code
/*
if(int(gl_FragCoord.x)%16 == 0 || int(gl_FragCoord.y)%16 == 0 ) {
sceneColor += vec4(0.5, 0, 0, 0);
} else {
sceneColor += vec4(LightGrids.Data[int(tilePos.x + tilePos.y*80)].Amount/LightSources.List.length(), 0, 0, 1);
}
*/
}
+27
View File
@@ -0,0 +1,27 @@
#version 430
layout (binding = 1) uniform sampler2D DepthStencilTexture;
layout (binding = 2) uniform sampler2D SceneTexture;
layout (binding = 3) uniform sampler2D BloomTexture;
in VertexData{
vec2 TextureCoordinate;
}Input;
out vec4 sceneColor;
out vec4 bloomColor;
void main()
{
float texel = texelFetch(DepthStencilTexture, ivec2(gl_FragCoord.xy / 8.0f), 0).g;
if(texel >= 0.9f)
{
discard;
}
sceneColor = vec4(texture2D(SceneTexture, Input.TextureCoordinate).rgb * texel, 1.0f);
bloomColor = vec4(texture2D(BloomTexture, Input.TextureCoordinate).rgb * texel, 1.0f);
//sceneColor = texel;
//bloomColor = vec4(1,0.5,0.7,1);
}
@@ -1,41 +0,0 @@
#version 430
uniform vec4 Color;
uniform vec4 FillColor;
uniform float FillPercentage;
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
layout (binding = 1) uniform sampler2D DiffuseTexture;
layout (binding = 2) uniform sampler2D GlowMapTexture;
in VertexData{
vec3 Position;
vec3 Normal;
vec2 TextureCoordinate;
}Input;
out vec4 sceneColor;
out vec4 bloomColor;
void main()
{
vec4 diffuseTexel = texture2D(DiffuseTexture, Input.TextureCoordinate);
vec4 glowTexel = texture2D(GlowMapTexture, Input.TextureCoordinate);
vec4 color_result = Color * diffuseTexel;
float pos = ((P * vec4(Input.Position, 1)).y + 1.0)/2.0;
if(pos <= FillPercentage) {
color_result = FillColor*diffuseTexel.a;
}
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
//bloomColor = vec4(clamp((glowTexel.xyz*3) - 1.0, 0, 100), 1.0);
bloomColor = vec4(1.0, 1.0, 1.0, 0.0);
}
+1 -4
View File
@@ -12,7 +12,6 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
if (!boundingBox) { if (!boundingBox) {
return; return;
} }
ComponentWrapper& cTransform = entity["Transform"]; ComponentWrapper& cTransform = entity["Transform"];
EntityAABB& boxA = *boundingBox; EntityAABB& boxA = *boundingBox;
bool everHitTheGround = false; bool everHitTheGround = false;
@@ -87,12 +86,10 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
glm::mat4 modelMatrix = Transform::ModelMatrix(boxB.Entity); glm::mat4 modelMatrix = Transform::ModelMatrix(boxB.Entity);
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"]; glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
bool notMovingxz = glm::all(glm::lessThan(glm::abs(glm::vec2(inOutVelocity.x, inOutVelocity.z)), glm::vec2(0.01f))) && prevPosIt != m_PrevPositions.end();
bool isOnGround = (bool)cPhysics["IsOnGround"]; bool isOnGround = (bool)cPhysics["IsOnGround"];
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"]; float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) { if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
//Move the position to previous position if it is not moving in the xz-plane, else resolve with the resolution vector. (glm::vec3&)cTransform["Position"] += resolutionVector;
(glm::vec3&)cTransform["Position"] += notMovingxz ? prevPosIt->second - boxA.Origin() : resolutionVector;
boxA = *Collision::EntityAbsoluteAABB(entity); boxA = *Collision::EntityAbsoluteAABB(entity);
cPhysics["Velocity"] = inOutVelocity; cPhysics["Velocity"] = inOutVelocity;
if (isOnGround) { if (isOnGround) {
+284 -18
View File
@@ -1,25 +1,291 @@
#include "Core/EntityFile.h" #include "Core/EntityFile.h"
EntityFile::EntityFile(std::string path) EntityFile::EntityFile(boost::filesystem::path path)
: m_FilePath(path)
{ {
EntityXMLFile* xml = ResourceManager::Load<EntityXMLFile>(path); using namespace xercesc;
XMLPlatformUtils::Initialize();
EntityXMLFilePreprocessor preprocessor(xml); m_GrammarPool = new XMLGrammarPoolImpl();
preprocessor.RegisterComponents(this); m_SAX2XMLReader = XMLReaderFactory::createXMLReader(XMLPlatformUtils::fgMemoryManager, m_GrammarPool);
EntityXMLFileParser parser(xml);
m_RootEntity = parser.MergeEntities(this);
if (m_RootEntity == EntityID_Invalid) {
ResourceManager::Release("EntityXMLFile", path);
throw Resource::FailedLoadingException("Failed to merge entities; root entity is invalid");
} }
ResourceManager::Release("EntityXMLFile", path); EntityFile::~EntityFile()
}
EntityWrapper EntityFile::MergeInto(World* other)
{ {
auto mapping = other->Merge(this); delete m_SAX2XMLReader;
return EntityWrapper(other, mapping.at(m_RootEntity)); delete m_GrammarPool;
xercesc::XMLPlatformUtils::Terminate();
}
void EntityFile::Parse(const EntityFileHandler* handler) const
{
using namespace xercesc;
EntityFileSAXHandler saxHandler(handler, m_SAX2XMLReader);
setReaderFeatures(m_SAX2XMLReader);
m_SAX2XMLReader->setContentHandler(&saxHandler);
m_SAX2XMLReader->setErrorHandler(&saxHandler);
m_SAX2XMLReader->setDeclarationHandler(&saxHandler);
m_SAX2XMLReader->parse(m_FilePath.string().c_str());
}
void EntityFile::setReaderFeatures(xercesc::SAX2XMLReader* reader)
{
using namespace xercesc;
reader->setFeature(XMLUni::fgXercesCacheGrammarFromParse, true);
reader->setFeature(XMLUni::fgXercesUseCachedGrammarInParse, true);
reader->setFeature(XMLUni::fgSAX2CoreValidation, true);
reader->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
reader->setFeature(XMLUni::fgXercesSchema, true);
reader->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
reader->setFeature(XMLUni::fgXercesCalculateSrcOfs, true);
reader->setFeature(XMLUni::fgXercesIdentityConstraintChecking, true);
}
unsigned int EntityFile::GetTypeStride(std::string typeName)
{
std::map<std::string, unsigned int> typeStrides{
{ "bool", sizeof(bool) },
{ "int", sizeof(int) },
{ "float", sizeof(float) },
{ "double", sizeof(double) },
{ "string", sizeof(std::string) },
{ "enum", sizeof(ComponentInfo::EnumType) },
{ "Vector", sizeof(glm::vec3) },
{ "Quaternion", sizeof(glm::quat) },
{ "Color", sizeof(glm::vec4) }
};
auto it = typeStrides.find(typeName);
return (it != typeStrides.end()) ? it->second : 0;
}
void EntityFile::WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes)
{
if (field.Type == "Vector") {
glm::vec3 vec;
vec.x = boost::lexical_cast<float>(attributes.at("X"));
vec.y = boost::lexical_cast<float>(attributes.at("Y"));
vec.z = boost::lexical_cast<float>(attributes.at("Z"));
memcpy(outData, reinterpret_cast<char*>(&vec), field.Stride);
} else if (field.Type == "Color") {
glm::vec4 vec;
vec.r = boost::lexical_cast<float>(attributes.at("R"));
vec.g = boost::lexical_cast<float>(attributes.at("G"));
vec.b = boost::lexical_cast<float>(attributes.at("B"));
vec.a = boost::lexical_cast<float>(attributes.at("A"));
memcpy(outData, reinterpret_cast<char*>(&vec), field.Stride);
} else if (field.Type == "Quaternion") {
glm::quat q;
q.x = boost::lexical_cast<float>(attributes.at("X"));
q.y = boost::lexical_cast<float>(attributes.at("Y"));
q.z = boost::lexical_cast<float>(attributes.at("Z"));
q.w = boost::lexical_cast<float>(attributes.at("W"));
memcpy(outData, reinterpret_cast<char*>(&q), field.Stride);
} else if (!attributes.empty()) {
LOG_WARNING("%i attributes not handled by any type conversion!", attributes.size());
}
}
void EntityFile::WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData)
{
// Catch and ignore casting errors so whitespace around string enums won't mess anything up
try {
if (field.Type == "int") {
int value = boost::lexical_cast<int>(valueData);
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "enum") {
ComponentInfo::EnumType value = boost::lexical_cast<ComponentInfo::EnumType>(valueData);
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "float") {
float value = boost::lexical_cast<float>(valueData);
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "double") {
double value = boost::lexical_cast<double>(valueData);
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "bool") {
bool value = (valueData[0] == 't'); // Lazy bool evaluation
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "string") {
new (outData) std::string(valueData);
} else {
LOG_WARNING("Unknown value data type: %s", field.Type.c_str());
}
} catch (const boost::bad_lexical_cast&) { }
}
EntityFileSAXHandler::EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader)
: m_Handler(handler)
, m_Reader(reader)
{
// 0 is imaginary base parent
m_EntityStack.push(0);
m_StateStack.push(State::Unknown);
}
void EntityFileSAXHandler::startElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname, const xercesc::Attributes& attrs)
{
std::string name = XS::ToString(_localName);
if (m_StateStack.top() == State::Unknown || m_StateStack.top() == State::Entity) {
if (name == "Entity") {
m_StateStack.push(State::Entity);
onStartEntity(attrs);
return;
}
if (name == "EntityRef") {
onStartEntityRef(attrs);
return;
}
}
std::string uri = XS::ToString(_uri);
if (m_StateStack.top() == State::Entity) {
if (uri == "components") {
m_StateStack.push(State::Component);
onStartComponent(name);
return;
}
}
if (m_StateStack.top() == State::Component) {
m_StateStack.push(State::ComponentField);
onStartComponentField(name, attrs);
return;
}
}
void EntityFileSAXHandler::endElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname)
{
std::string name = XS::ToString(_localName);
if (m_StateStack.top() == State::Entity) {
if (name == "Entity") {
m_StateStack.pop();
onEndEntity();
return;
}
}
std::string uri = XS::ToString(_uri);
if (m_StateStack.top() == State::Component) {
//if (uri == "components") {
m_StateStack.pop();
onEndComponent(name);
return;
//}
}
if (m_StateStack.top() == State::ComponentField && name == m_CurrentField) {
m_StateStack.pop();
onEndComponentField(name);
return;
}
}
void EntityFileSAXHandler::characters(const XMLCh* const chars, const XMLSize_t length)
{
if (m_StateStack.top() == State::ComponentField) {
char* transcoded = xercesc::XMLString::transcode(chars);
onFieldData(transcoded);
}
}
void EntityFileSAXHandler::fatalError(const xercesc::SAXParseException& e)
{
std::string message = XS::ToString(e.getMessage());
std::string systemId = XS::ToString(e.getSystemId());
XMLFileLoc line = e.getLineNumber();
XMLFileLoc column = e.getColumnNumber();
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tFatal Error: %s", systemId.c_str(), line, column, message.c_str());
}
void EntityFileSAXHandler::error(const xercesc::SAXParseException& e)
{
std::string message = XS::ToString(e.getMessage());
std::string systemId = XS::ToString(e.getSystemId());
XMLFileLoc line = e.getLineNumber();
XMLFileLoc column = e.getColumnNumber();
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tError: %s", systemId.c_str(), line, column, message.c_str());
}
void EntityFileSAXHandler::warning(const xercesc::SAXParseException& e)
{
std::string message = XS::ToString(e.getMessage());
std::string systemId = XS::ToString(e.getSystemId());
XMLFileLoc line = e.getLineNumber();
XMLFileLoc column = e.getColumnNumber();
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tWarning: %s", systemId.c_str(), line, column, message.c_str());
}
void EntityFileSAXHandler::onStartEntity(const xercesc::Attributes& attrs)
{
EntityID parent = m_EntityStack.top();
if (m_Handler->m_OnStartEntityCallback) {
std::string name;
auto xName = attrs.getValue(XS::ToXMLCh("name"));
if (xName != nullptr) {
name = XS::ToString(xName);
}
m_Handler->m_OnStartEntityCallback(m_NextEntityID, parent, name);
}
m_EntityStack.push(m_NextEntityID);
m_NextEntityID++;
}
void EntityFileSAXHandler::onEndEntity()
{
m_EntityStack.pop();
}
void EntityFileSAXHandler::onStartEntityRef(const xercesc::Attributes& attrs)
{
std::string path = XS::ToString(attrs.getValue(XS::ToXMLCh("file")));
xercesc::SAX2XMLReader* reader = xercesc::XMLReaderFactory::createXMLReader();
EntityFile::setReaderFeatures(reader);
reader->setContentHandler(this);
reader->setErrorHandler(this);
reader->parse(path.c_str());
delete reader;
}
void EntityFileSAXHandler::onStartComponentField(const std::string& field, const xercesc::Attributes& attrs)
{
//LOG_DEBUG(" Field: %s", field.c_str());
m_CurrentField = field;
m_CurrentAttributes.clear();
for (int i = 0; i < attrs.getLength(); i++) {
auto name = attrs.getQName(i);
auto value = attrs.getValue(name);
//LOG_DEBUG(" %s = %s", (char*)XS::ToString(name), (char*)XS::ToString(value));
m_CurrentAttributes[XS::ToString(name).operator std::string()] = XS::ToString(value).operator std::string();
}
if (m_Handler->m_OnStartFieldCallback) {
m_Handler->m_OnStartFieldCallback(m_EntityStack.top(), m_CurrentComponent, field, m_CurrentAttributes);
}
}
void EntityFileSAXHandler::onEndComponent(const std::string& name) { }
void EntityFileSAXHandler::onStartComponent(const std::string& name)
{
//LOG_DEBUG(" Component: %s", name.c_str());
m_CurrentComponent = name;
if (m_Handler->m_OnStartComponentCallback) {
m_Handler->m_OnStartComponentCallback(m_EntityStack.top(), name);
}
}
void EntityFileSAXHandler::onEndComponentField(const std::string& field) { }
void EntityFileSAXHandler::onFieldData(char* data)
{
//LOG_DEBUG(" Data: %s", data);
if (m_Handler->m_OnStartFieldDataCallback) {
m_Handler->m_OnStartFieldDataCallback(m_EntityStack.top(), m_CurrentComponent, m_CurrentField, data);
}
xercesc::XMLString::release(&data);
} }
+74
View File
@@ -0,0 +1,74 @@
#include "Core/EntityFileParser.h"
EntityFileParser::EntityFileParser(const EntityFile* entityFile)
: m_EntityFile(entityFile)
{
m_Handler.SetStartEntityCallback(std::bind(&EntityFileParser::onStartEntity, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_Handler.SetStartComponentCallback(std::bind(&EntityFileParser::onStartComponent, this, std::placeholders::_1, std::placeholders::_2));
m_Handler.SetStartFieldCallback(std::bind(&EntityFileParser::onStartComponentField, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
m_Handler.SetStartFieldDataCallback(std::bind(&EntityFileParser::onFieldData, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
}
EntityID EntityFileParser::MergeEntities(World* world, EntityID baseParent /*= EntityID_Invalid */)
{
m_World = world;
m_EntityIDMapper[0] = baseParent;
m_EntityFile->Parse(&m_Handler);
return m_FirstEntity;
}
void EntityFileParser::onStartEntity(EntityID entity, EntityID parent, const std::string& name)
{
EntityID realParent = m_EntityIDMapper.at(parent);
EntityID realEntity = m_World->CreateEntity(realParent);
if (m_FirstEntity == EntityID_Invalid) {
m_FirstEntity = realEntity;
}
if (!name.empty()) {
m_World->SetName(realEntity, name);
}
m_EntityIDMapper[entity] = realEntity;
//LOG_DEBUG("Created entity #%i (%i) with parent %i (%i)", entity, realEntity, parent, realParent);
}
void EntityFileParser::onStartComponent(EntityID entity, const std::string& component)
{
EntityID realEntity = m_EntityIDMapper.at(entity);
m_World->AttachComponent(realEntity, component);
//LOG_DEBUG("Attached component of type \"%s\" to entity #%i (%i)", component.c_str(), entity, realEntity);
}
void EntityFileParser::onStartComponentField(EntityID entity, const std::string& componentType, const std::string& fieldName, const std::map<std::string, std::string>& attributes)
{
EntityID realEntity = m_EntityIDMapper.at(entity);
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
auto fieldIt = component.Info.Fields.find(fieldName);
if (fieldIt == component.Info.Fields.end()) {
LOG_ERROR("Tried to set unknown field \"%s\" of component type \"%s\"! Ignoring.", fieldName.c_str(), componentType.c_str());
return;
}
auto& field = fieldIt->second;
//LOG_DEBUG("Field \"%s\" type \"%s\"", fieldName.c_str(), field.Type.c_str());
//LOG_DEBUG("Attributes:");
//for (auto& kv : attributes) {
// LOG_DEBUG("\t%s = %s", kv.first.c_str(), kv.second.c_str());
//}
char* data = component.Data + field.Offset;
EntityFile::WriteAttributeData(data, field, attributes);
}
void EntityFileParser::onFieldData(EntityID entity, const std::string& componentType, const std::string& fieldName, const char* fieldData)
{
EntityID realEntity = m_EntityIDMapper.at(entity);
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
auto fieldIt = component.Info.Fields.find(fieldName);
if (fieldIt == component.Info.Fields.end()) {
return;
}
auto& field = fieldIt->second;
char* data = component.Data + field.Offset;
EntityFile::WriteValueData(data, field, fieldData);
}
@@ -1,10 +1,10 @@
#include "Core/EntityXMLFilePreprocessor.h" #include "Core/EntityFilePreprocessor.h"
EntityXMLFilePreprocessor::EntityXMLFilePreprocessor(const EntityXMLFile* entityFile) EntityFilePreprocessor::EntityFilePreprocessor(const EntityFile* entityFile)
: m_EntityFile(entityFile) : m_EntityFile(entityFile)
{ {
EntityFileHandler handler; EntityFileHandler handler;
handler.SetStartComponentCallback(std::bind(&EntityXMLFilePreprocessor::onStartComponent, this, std::placeholders::_1, std::placeholders::_2)); handler.SetStartComponentCallback(std::bind(&EntityFilePreprocessor::onStartComponent, this, std::placeholders::_1, std::placeholders::_2));
m_EntityFile->Parse(&handler); m_EntityFile->Parse(&handler);
//LOG_DEBUG("___ COMPONENT DEFINITIONS ___"); //LOG_DEBUG("___ COMPONENT DEFINITIONS ___");
@@ -28,20 +28,20 @@ EntityXMLFilePreprocessor::EntityXMLFilePreprocessor(const EntityXMLFile* entity
parseDefaults(); parseDefaults();
} }
void EntityXMLFilePreprocessor::RegisterComponents(World* world) void EntityFilePreprocessor::RegisterComponents(World* world)
{ {
for (auto& kv : m_ComponentInfo) { for (auto& kv : m_ComponentInfo) {
world->RegisterComponent(kv.second); world->RegisterComponent(kv.second);
} }
} }
void EntityXMLFilePreprocessor::onStartComponent(EntityID entity, std::string type) void EntityFilePreprocessor::onStartComponent(EntityID entity, std::string type)
{ {
//LOG_DEBUG("Component: %s", type.c_str()); //LOG_DEBUG("Component: %s", type.c_str());
m_ComponentCounts[type]++; m_ComponentCounts[type]++;
} }
void EntityXMLFilePreprocessor::parseComponentInfo() void EntityFilePreprocessor::parseComponentInfo()
{ {
using namespace xercesc; using namespace xercesc;
EntityFileXMLErrorHandler errorHandler; EntityFileXMLErrorHandler errorHandler;
@@ -141,9 +141,9 @@ void EntityXMLFilePreprocessor::parseComponentInfo()
std::string baseType = XS::ToString(elementDeclaration->getTypeDefinition()->getBaseType()->getName()); std::string baseType = XS::ToString(elementDeclaration->getTypeDefinition()->getBaseType()->getName());
std::string effectiveType = type; std::string effectiveType = type;
unsigned int stride = EntityXMLFile::GetTypeStride(type); unsigned int stride = EntityFile::GetTypeStride(type);
if (stride == 0) { if (stride == 0) {
stride = EntityXMLFile::GetTypeStride(baseType); stride = EntityFile::GetTypeStride(baseType);
if (stride == 0) { if (stride == 0) {
LOG_WARNING("Field \"%s\" in component \"%s\" uses unexpected field type \"%s\" with base type \"%s\". Skipping.", name.c_str(), compInfo.Name.c_str(), type.c_str(), baseType.c_str()); LOG_WARNING("Field \"%s\" in component \"%s\" uses unexpected field type \"%s\" with base type \"%s\". Skipping.", name.c_str(), compInfo.Name.c_str(), type.c_str(), baseType.c_str());
continue; continue;
@@ -196,7 +196,7 @@ void EntityXMLFilePreprocessor::parseComponentInfo()
} }
} }
void EntityXMLFilePreprocessor::parseDefaults() void EntityFilePreprocessor::parseDefaults()
{ {
using namespace xercesc; using namespace xercesc;
@@ -261,7 +261,7 @@ void EntityXMLFilePreprocessor::parseDefaults()
auto attribItem = attributeMap->item(i); auto attribItem = attributeMap->item(i);
attributes[XS::ToString(attribItem->getNodeName())] = XS::ToString(attribItem->getNodeValue()); attributes[XS::ToString(attribItem->getNodeName())] = XS::ToString(attribItem->getNodeValue());
} }
EntityXMLFile::WriteAttributeData(data, field, attributes); EntityFile::WriteAttributeData(data, field, attributes);
} }
auto childNode = fieldElement->getFirstChild(); auto childNode = fieldElement->getFirstChild();
@@ -278,14 +278,14 @@ void EntityXMLFilePreprocessor::parseDefaults()
// Handle potential field values // Handle potential field values
if (childNode->getNodeType() == DOMNode::TEXT_NODE) { if (childNode->getNodeType() == DOMNode::TEXT_NODE) {
char* cstrValue = XMLString::transcode(childNode->getNodeValue()); char* cstrValue = XMLString::transcode(childNode->getNodeValue());
EntityXMLFile::WriteValueData(data, field, cstrValue); EntityFile::WriteValueData(data, field, cstrValue);
XMLString::release(&cstrValue); XMLString::release(&cstrValue);
} }
} }
} }
} }
std::string EntityXMLFilePreprocessor::parseAnnotationXML(const XMLCh* xml) std::string EntityFilePreprocessor::parseAnnotationXML(const XMLCh* xml)
{ {
using namespace xercesc; using namespace xercesc;
@@ -1,13 +1,13 @@
#include "Core/EntityXMLFileWriter.h" #include "Core/EntityFileWriter.h"
#define X(str) XS::ToXMLCh(str) #define X(str) XS::ToXMLCh(str)
void EntityXMLFileWriter::WriteWorld(World* world) void EntityFileWriter::WriteWorld(World* world)
{ {
WriteEntity(world, 0); WriteEntity(world, 0);
} }
void EntityXMLFileWriter::WriteEntity(World* world, EntityID entity) void EntityFileWriter::WriteEntity(World* world, EntityID entity)
{ {
using namespace xercesc; using namespace xercesc;
DOMDocument* doc = m_DOMImplementation->createDocument(nullptr, X("Entity"), nullptr); DOMDocument* doc = m_DOMImplementation->createDocument(nullptr, X("Entity"), nullptr);
@@ -41,7 +41,7 @@ void EntityXMLFileWriter::WriteEntity(World* world, EntityID entity)
doc->release(); doc->release();
} }
void EntityXMLFileWriter::appendEntityChildren(xercesc::DOMElement* parentElement, const World* world, EntityID entity) void EntityFileWriter::appendEntityChildren(xercesc::DOMElement* parentElement, const World* world, EntityID entity)
{ {
using namespace xercesc; using namespace xercesc;
DOMDocument* doc = parentElement->getOwnerDocument(); DOMDocument* doc = parentElement->getOwnerDocument();
@@ -67,7 +67,7 @@ void EntityXMLFileWriter::appendEntityChildren(xercesc::DOMElement* parentElemen
} }
} }
void EntityXMLFileWriter::appentEntityComponents(xercesc::DOMElement* parentElement, const World* world, EntityID entity) void EntityFileWriter::appentEntityComponents(xercesc::DOMElement* parentElement, const World* world, EntityID entity)
{ {
using namespace xercesc; using namespace xercesc;
DOMDocument* doc = parentElement->getOwnerDocument(); DOMDocument* doc = parentElement->getOwnerDocument();
-291
View File
@@ -1,291 +0,0 @@
#include "Core/EntityXMLFile.h"
EntityXMLFile::EntityXMLFile(boost::filesystem::path path)
: m_FilePath(path)
{
using namespace xercesc;
XMLPlatformUtils::Initialize();
m_GrammarPool = new XMLGrammarPoolImpl();
m_SAX2XMLReader = XMLReaderFactory::createXMLReader(XMLPlatformUtils::fgMemoryManager, m_GrammarPool);
}
EntityXMLFile::~EntityXMLFile()
{
delete m_SAX2XMLReader;
delete m_GrammarPool;
xercesc::XMLPlatformUtils::Terminate();
}
void EntityXMLFile::Parse(const EntityFileHandler* handler) const
{
using namespace xercesc;
EntityFileSAXHandler saxHandler(handler, m_SAX2XMLReader);
setReaderFeatures(m_SAX2XMLReader);
m_SAX2XMLReader->setContentHandler(&saxHandler);
m_SAX2XMLReader->setErrorHandler(&saxHandler);
m_SAX2XMLReader->setDeclarationHandler(&saxHandler);
m_SAX2XMLReader->parse(m_FilePath.string().c_str());
}
void EntityXMLFile::setReaderFeatures(xercesc::SAX2XMLReader* reader)
{
using namespace xercesc;
reader->setFeature(XMLUni::fgXercesCacheGrammarFromParse, true);
reader->setFeature(XMLUni::fgXercesUseCachedGrammarInParse, true);
reader->setFeature(XMLUni::fgSAX2CoreValidation, true);
reader->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
reader->setFeature(XMLUni::fgXercesSchema, true);
reader->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
reader->setFeature(XMLUni::fgXercesCalculateSrcOfs, true);
reader->setFeature(XMLUni::fgXercesIdentityConstraintChecking, true);
}
unsigned int EntityXMLFile::GetTypeStride(std::string typeName)
{
std::map<std::string, unsigned int> typeStrides{
{ "bool", sizeof(bool) },
{ "int", sizeof(int) },
{ "float", sizeof(float) },
{ "double", sizeof(double) },
{ "string", sizeof(std::string) },
{ "enum", sizeof(ComponentInfo::EnumType) },
{ "Vector", sizeof(glm::vec3) },
{ "Quaternion", sizeof(glm::quat) },
{ "Color", sizeof(glm::vec4) }
};
auto it = typeStrides.find(typeName);
return (it != typeStrides.end()) ? it->second : 0;
}
void EntityXMLFile::WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes)
{
if (field.Type == "Vector") {
glm::vec3 vec;
vec.x = boost::lexical_cast<float>(attributes.at("X"));
vec.y = boost::lexical_cast<float>(attributes.at("Y"));
vec.z = boost::lexical_cast<float>(attributes.at("Z"));
memcpy(outData, reinterpret_cast<char*>(&vec), field.Stride);
} else if (field.Type == "Color") {
glm::vec4 vec;
vec.r = boost::lexical_cast<float>(attributes.at("R"));
vec.g = boost::lexical_cast<float>(attributes.at("G"));
vec.b = boost::lexical_cast<float>(attributes.at("B"));
vec.a = boost::lexical_cast<float>(attributes.at("A"));
memcpy(outData, reinterpret_cast<char*>(&vec), field.Stride);
} else if (field.Type == "Quaternion") {
glm::quat q;
q.x = boost::lexical_cast<float>(attributes.at("X"));
q.y = boost::lexical_cast<float>(attributes.at("Y"));
q.z = boost::lexical_cast<float>(attributes.at("Z"));
q.w = boost::lexical_cast<float>(attributes.at("W"));
memcpy(outData, reinterpret_cast<char*>(&q), field.Stride);
} else if (!attributes.empty()) {
LOG_WARNING("%i attributes not handled by any type conversion!", attributes.size());
}
}
void EntityXMLFile::WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData)
{
// Catch and ignore casting errors so whitespace around string enums won't mess anything up
try {
if (field.Type == "int") {
int value = boost::lexical_cast<int>(valueData);
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "enum") {
ComponentInfo::EnumType value = boost::lexical_cast<ComponentInfo::EnumType>(valueData);
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "float") {
float value = boost::lexical_cast<float>(valueData);
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "double") {
double value = boost::lexical_cast<double>(valueData);
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "bool") {
bool value = (valueData[0] == 't'); // Lazy bool evaluation
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
} else if (field.Type == "string") {
new (outData) std::string(valueData);
} else {
LOG_WARNING("Unknown value data type: %s", field.Type.c_str());
}
} catch (const boost::bad_lexical_cast&) { }
}
EntityFileSAXHandler::EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader)
: m_Handler(handler)
, m_Reader(reader)
{
// 0 is imaginary base parent
m_EntityStack.push(0);
m_StateStack.push(State::Unknown);
}
void EntityFileSAXHandler::startElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname, const xercesc::Attributes& attrs)
{
std::string name = XS::ToString(_localName);
if (m_StateStack.top() == State::Unknown || m_StateStack.top() == State::Entity) {
if (name == "Entity") {
m_StateStack.push(State::Entity);
onStartEntity(attrs);
return;
}
if (name == "EntityRef") {
onStartEntityRef(attrs);
return;
}
}
std::string uri = XS::ToString(_uri);
if (m_StateStack.top() == State::Entity) {
if (uri == "components") {
m_StateStack.push(State::Component);
onStartComponent(name);
return;
}
}
if (m_StateStack.top() == State::Component) {
m_StateStack.push(State::ComponentField);
onStartComponentField(name, attrs);
return;
}
}
void EntityFileSAXHandler::endElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname)
{
std::string name = XS::ToString(_localName);
if (m_StateStack.top() == State::Entity) {
if (name == "Entity") {
m_StateStack.pop();
onEndEntity();
return;
}
}
std::string uri = XS::ToString(_uri);
if (m_StateStack.top() == State::Component) {
//if (uri == "components") {
m_StateStack.pop();
onEndComponent(name);
return;
//}
}
if (m_StateStack.top() == State::ComponentField && name == m_CurrentField) {
m_StateStack.pop();
onEndComponentField(name);
return;
}
}
void EntityFileSAXHandler::characters(const XMLCh* const chars, const XMLSize_t length)
{
if (m_StateStack.top() == State::ComponentField) {
char* transcoded = xercesc::XMLString::transcode(chars);
onFieldData(transcoded);
}
}
void EntityFileSAXHandler::fatalError(const xercesc::SAXParseException& e)
{
std::string message = XS::ToString(e.getMessage());
std::string systemId = XS::ToString(e.getSystemId());
XMLFileLoc line = e.getLineNumber();
XMLFileLoc column = e.getColumnNumber();
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tFatal Error: %s", systemId.c_str(), line, column, message.c_str());
}
void EntityFileSAXHandler::error(const xercesc::SAXParseException& e)
{
std::string message = XS::ToString(e.getMessage());
std::string systemId = XS::ToString(e.getSystemId());
XMLFileLoc line = e.getLineNumber();
XMLFileLoc column = e.getColumnNumber();
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tError: %s", systemId.c_str(), line, column, message.c_str());
}
void EntityFileSAXHandler::warning(const xercesc::SAXParseException& e)
{
std::string message = XS::ToString(e.getMessage());
std::string systemId = XS::ToString(e.getSystemId());
XMLFileLoc line = e.getLineNumber();
XMLFileLoc column = e.getColumnNumber();
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tWarning: %s", systemId.c_str(), line, column, message.c_str());
}
void EntityFileSAXHandler::onStartEntity(const xercesc::Attributes& attrs)
{
EntityID parent = m_EntityStack.top();
if (m_Handler->m_OnStartEntityCallback) {
std::string name;
auto xName = attrs.getValue(XS::ToXMLCh("name"));
if (xName != nullptr) {
name = XS::ToString(xName);
}
m_Handler->m_OnStartEntityCallback(m_NextEntityID, parent, name);
}
m_EntityStack.push(m_NextEntityID);
m_NextEntityID++;
}
void EntityFileSAXHandler::onEndEntity()
{
m_EntityStack.pop();
}
void EntityFileSAXHandler::onStartEntityRef(const xercesc::Attributes& attrs)
{
std::string path = XS::ToString(attrs.getValue(XS::ToXMLCh("file")));
xercesc::SAX2XMLReader* reader = xercesc::XMLReaderFactory::createXMLReader();
EntityXMLFile::setReaderFeatures(reader);
reader->setContentHandler(this);
reader->setErrorHandler(this);
reader->parse(path.c_str());
delete reader;
}
void EntityFileSAXHandler::onStartComponentField(const std::string& field, const xercesc::Attributes& attrs)
{
//LOG_DEBUG(" Field: %s", field.c_str());
m_CurrentField = field;
m_CurrentAttributes.clear();
for (int i = 0; i < attrs.getLength(); i++) {
auto name = attrs.getQName(i);
auto value = attrs.getValue(name);
//LOG_DEBUG(" %s = %s", (char*)XS::ToString(name), (char*)XS::ToString(value));
m_CurrentAttributes[XS::ToString(name).operator std::string()] = XS::ToString(value).operator std::string();
}
if (m_Handler->m_OnStartFieldCallback) {
m_Handler->m_OnStartFieldCallback(m_EntityStack.top(), m_CurrentComponent, field, m_CurrentAttributes);
}
}
void EntityFileSAXHandler::onEndComponent(const std::string& name) { }
void EntityFileSAXHandler::onStartComponent(const std::string& name)
{
//LOG_DEBUG(" Component: %s", name.c_str());
m_CurrentComponent = name;
if (m_Handler->m_OnStartComponentCallback) {
m_Handler->m_OnStartComponentCallback(m_EntityStack.top(), name);
}
}
void EntityFileSAXHandler::onEndComponentField(const std::string& field) { }
void EntityFileSAXHandler::onFieldData(char* data)
{
//LOG_DEBUG(" Data: %s", data);
if (m_Handler->m_OnStartFieldDataCallback) {
m_Handler->m_OnStartFieldDataCallback(m_EntityStack.top(), m_CurrentComponent, m_CurrentField, data);
}
xercesc::XMLString::release(&data);
}
-84
View File
@@ -1,84 +0,0 @@
#include "Core/EntityXMLFileParser.h"
EntityXMLFileParser::EntityXMLFileParser(const EntityXMLFile* entityFile)
: m_EntityFile(entityFile)
{
m_Handler.SetStartEntityCallback(std::bind(&EntityXMLFileParser::onStartEntity, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_Handler.SetStartComponentCallback(std::bind(&EntityXMLFileParser::onStartComponent, this, std::placeholders::_1, std::placeholders::_2));
m_Handler.SetStartFieldCallback(std::bind(&EntityXMLFileParser::onStartComponentField, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
m_Handler.SetStartFieldDataCallback(std::bind(&EntityXMLFileParser::onFieldData, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
}
EntityID EntityXMLFileParser::MergeEntities(World* world, EntityID baseParent /*= EntityID_Invalid */)
{
m_World = world;
m_EntityIDMapper[0] = baseParent;
m_EntityFile->Parse(&m_Handler);
return m_FirstEntity;
}
void EntityXMLFileParser::onStartEntity(EntityID entity, EntityID parent, const std::string& name)
{
EntityID realParent = m_EntityIDMapper.at(parent);
EntityID realEntity = m_World->CreateEntity(realParent);
if (m_FirstEntity == EntityID_Invalid) {
m_FirstEntity = realEntity;
}
if (!name.empty()) {
m_World->SetName(realEntity, name);
}
m_EntityIDMapper[entity] = realEntity;
//LOG_DEBUG("Created entity #%i (%i) with parent %i (%i)", entity, realEntity, parent, realParent);
}
void EntityXMLFileParser::onStartComponent(EntityID entity, const std::string& component)
{
if (m_World->GetComponentPools().count(component) != 0) {
EntityID realEntity = m_EntityIDMapper.at(entity);
m_World->AttachComponent(realEntity, component);
} else {
LOG_ERROR("Tried to attach unregistered component \"%s\"! to entity #%i. Ignoring.", component.c_str(), entity);
}
//LOG_DEBUG("Attached component of type \"%s\" to entity #%i (%i)", component.c_str(), entity, realEntity);
}
void EntityXMLFileParser::onStartComponentField(EntityID entity, const std::string& componentType, const std::string& fieldName, const std::map<std::string, std::string>& attributes)
{
if (m_World->GetComponentPools().count(componentType) == 0) {
return;
}
EntityID realEntity = m_EntityIDMapper.at(entity);
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
auto fieldIt = component.Info.Fields.find(fieldName);
if (fieldIt == component.Info.Fields.end()) {
LOG_ERROR("Tried to set unknown field \"%s\" of component type \"%s\"! Ignoring.", fieldName.c_str(), componentType.c_str());
return;
}
auto& field = fieldIt->second;
//LOG_DEBUG("Field \"%s\" type \"%s\"", fieldName.c_str(), field.Type.c_str());
//LOG_DEBUG("Attributes:");
//for (auto& kv : attributes) {
// LOG_DEBUG("\t%s = %s", kv.first.c_str(), kv.second.c_str());
//}
char* data = component.Data + field.Offset;
EntityXMLFile::WriteAttributeData(data, field, attributes);
}
void EntityXMLFileParser::onFieldData(EntityID entity, const std::string& componentType, const std::string& fieldName, const char* fieldData)
{
if (m_World->GetComponentPools().count(componentType) == 0) {
return;
}
EntityID realEntity = m_EntityIDMapper.at(entity);
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
auto fieldIt = component.Info.Fields.find(fieldName);
if (fieldIt == component.Info.Fields.end()) {
return;
}
auto& field = fieldIt->second;
char* data = component.Data + field.Offset;
EntityXMLFile::WriteValueData(data, field, fieldData);
}
+2 -2
View File
@@ -33,8 +33,8 @@ void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int
va_end(args); va_end(args);
if (logLevel == LOG_LEVEL_ERROR) { if (logLevel == LOG_LEVEL_ERROR) {
std::cerr << file << ":" << line << " " << func << std::endl; //std::cerr << file << ":" << line << " " << func << std::endl;
std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl; //std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
} else { } else {
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl; std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
} }
+1 -58
View File
@@ -1,7 +1,6 @@
#include "Core/World.h" #include "Core/World.h"
#include "Core/EEntityDeleted.h" #include "Core/EEntityDeleted.h"
#include "Core/EComponentDeleted.h" #include "Core/EComponentDeleted.h"
#include "Core/EntityWrapper.h"
World::~World() World::~World()
{ {
@@ -45,7 +44,7 @@ bool World::ValidEntity(EntityID entity) const
return m_EntityParents.find(entity) != m_EntityParents.end(); return m_EntityParents.find(entity) != m_EntityParents.end();
} }
void World::RegisterComponent(const ComponentInfo& ci) void World::RegisterComponent(ComponentInfo& ci)
{ {
if (m_ComponentPools.find(ci.Name) == m_ComponentPools.end()) { if (m_ComponentPools.find(ci.Name) == m_ComponentPools.end()) {
m_ComponentPools[ci.Name] = new ComponentPool(ci); m_ComponentPools[ci.Name] = new ComponentPool(ci);
@@ -152,62 +151,6 @@ std::string World::GetName(EntityID entity) const
} }
} }
EntityWrapper World::GetFirstEntityByName(const std::string& name)
{
auto itPair = GetDirectChildren(EntityID_Invalid);
for (auto it = itPair.first; it != itPair.second; it++) {
EntityID childEntityID = it->second;
EntityWrapper childEntity(this, childEntityID);
if (!childEntity.Valid()) {
continue;
}
EntityWrapper entityWithName = childEntity.Name() == name ? childEntity : childEntity.FirstChildByName(name);
if (entityWithName.Valid()) {
return entityWithName;
}
}
return EntityWrapper::Invalid;
}
std::unordered_map<EntityID, EntityID> World::Merge(const World* other)
{
std::unordered_map<EntityID, EntityID> oldToNew;
// Create new entities
for (auto& kv : other->m_EntityParents) {
EntityID entity = kv.first;
EntityID newEntity = CreateEntity();
SetName(newEntity, other->GetName(entity));
oldToNew[entity] = newEntity;
}
// Fix relationships
for (auto& kv : other->m_EntityParents) {
EntityID entity = kv.first;
EntityID parent = kv.second;
if (parent != EntityID_Invalid) {
SetParent(oldToNew.at(entity), oldToNew.at(parent));
}
}
// Transfer components
for (auto& kv : other->m_ComponentPools) {
auto& componentType = kv.first;
ComponentPool* pool = kv.second;
// Register pool if it's not present in world
if (m_ComponentPools.count(componentType) == 0) {
RegisterComponent(pool->ComponentInfo());
}
// Copy components
for (auto component : *pool) {
ComponentWrapper newComponent = AttachComponent(oldToNew.at(component.EntityID), componentType);
component.Copy(newComponent);
}
}
return oldToNew;
}
EntityID World::generateEntityID() EntityID World::generateEntityID()
{ {
// TODO: Make EntityID generation smarter // TODO: Make EntityID generation smarter
-5
View File
@@ -580,11 +580,6 @@ void EditorGUI::createWidgetToolButton(WidgetMode mode)
bool EditorGUI::OnKeyDown(const Events::KeyDown& e) bool EditorGUI::OnKeyDown(const Events::KeyDown& e)
{ {
ImGuiIO& io = ImGui::GetIO();
if (io.WantCaptureKeyboard) {
return false;
}
if (e.ModCtrl && e.KeyCode == GLFW_KEY_S) { if (e.ModCtrl && e.KeyCode == GLFW_KEY_S) {
if (m_CurrentSelection.Valid()) { if (m_CurrentSelection.Valid()) {
EntityWrapper baseParent = m_CurrentSelection; EntityWrapper baseParent = m_CurrentSelection;
+1 -1
View File
@@ -54,7 +54,7 @@ void EditorRenderSystem::Update(double dt)
EntityWrapper entity(m_World, cModel.EntityID); EntityWrapper entity(m_World, cModel.EntityID);
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World); glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World);
for (auto matGroup : model->MaterialGroups()) { for (auto matGroup : model->MaterialGroups()) {
std::shared_ptr<ModelJob> modelJob = std::make_shared<ModelJob>(model, scene.Camera, modelMatrix, matGroup, cModel, entity.World, glm::vec4(0), 0.f, false); std::shared_ptr<ModelJob> modelJob = std::make_shared<ModelJob>(model, scene.Camera, modelMatrix, matGroup, cModel, entity.World, glm::vec4(0), 0.f);
if (cModel["Transparent"]) { if (cModel["Transparent"]) {
scene.Jobs.TransparentObjects.push_back(modelJob); scene.Jobs.TransparentObjects.push_back(modelJob);
} else { } else {
+7 -7
View File
@@ -2,7 +2,6 @@
#include "Core/UniformScaleSystem.h" #include "Core/UniformScaleSystem.h"
#include "Editor/EditorRenderSystem.h" #include "Editor/EditorRenderSystem.h"
#include "Editor/EditorWidgetSystem.h" #include "Editor/EditorWidgetSystem.h"
#include "Core/EntityFile.h"
EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame) EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
: System(params) : System(params)
@@ -130,7 +129,7 @@ void EditorSystem::OnEntitySelected(EntityWrapper entity)
void EditorSystem::OnEntitySave(EntityWrapper entity, boost::filesystem::path filePath) void EditorSystem::OnEntitySave(EntityWrapper entity, boost::filesystem::path filePath)
{ {
EntityXMLFileWriter writer(filePath); EntityFileWriter writer(filePath);
writer.WriteEntity(entity.World, entity.ID); writer.WriteEntity(entity.World, entity.ID);
} }
@@ -261,11 +260,12 @@ EntityWrapper EditorSystem::importEntity(EntityWrapper parent, boost::filesystem
try { try {
auto entityFile = ResourceManager::Load<EntityFile>(filePath.string()); auto entityFile = ResourceManager::Load<EntityFile>(filePath.string());
EntityWrapper newEntity = entityFile->MergeInto(parent.World); EntityFilePreprocessor fpp(entityFile);
parent.World->SetParent(newEntity.ID, parent.ID); fpp.RegisterComponents(parent.World);
return newEntity; EntityFileParser fp(entityFile);
} catch (const std::exception& e) { EntityID newEntity = fp.MergeEntities(parent.World, parent.ID);
LOG_ERROR("Failed to import entity \"%s\": \"%s\"", filePath.string().c_str(), e.what()); return EntityWrapper(parent.World, newEntity);
} catch (const std::exception&) {
return EntityWrapper::Invalid; return EntityWrapper::Invalid;
} }
} }
+3 -42
View File
@@ -33,7 +33,6 @@ void Client::Connect(std::string address, int port)
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Client::OnPlayerDamage); EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Client::OnPlayerDamage);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Client::OnPlayerSpawned); EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Client::OnPlayerSpawned);
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &Client::OnDoubleJump); EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &Client::OnDoubleJump);
EVENT_SUBSCRIBE_MEMBER(m_EDashAbility, &Client::OnDashAbility);
EVENT_SUBSCRIBE_MEMBER(m_ESearchForServers, &Client::OnSearchForServers); EVENT_SUBSCRIBE_MEMBER(m_ESearchForServers, &Client::OnSearchForServers);
auto config = ResourceManager::Load<ConfigFile>("Config.ini"); auto config = ResourceManager::Load<ConfigFile>("Config.ini");
m_Address = address; m_Address = address;
@@ -102,7 +101,8 @@ void Client::Update()
void Client::parseMessageType(Packet& packet) void Client::parseMessageType(Packet& packet)
{ {
// Pop packetSize // Pop packetSize which is used by TCP Client to
// create a packet of the correct size
packet.ReadPrimitive<int>(); packet.ReadPrimitive<int>();
int messageType = packet.ReadPrimitive<int>(); int messageType = packet.ReadPrimitive<int>();
if (messageType == -1) if (messageType == -1)
@@ -144,12 +144,6 @@ void Client::parseMessageType(Packet& packet)
case MessageType::OnDoubleJump: case MessageType::OnDoubleJump:
parseDoubleJump(packet); parseDoubleJump(packet);
break; break;
case MessageType::OnDashEffect:
parseDashEffect(packet);
break;
case MessageType::AmmoPickup:
parseAmmoPickup(packet);
break;
default: default:
break; break;
} }
@@ -239,6 +233,7 @@ void Client::parseSpawnEvents()
m_EventBroker->Publish(e); m_EventBroker->Publish(e);
} }
m_PlayerSpawnEvents = tempSpawn; m_PlayerSpawnEvents = tempSpawn;
// m_PlayerSpawnEvents.clear();
} }
void Client::parsePlayersSpawned(Packet& packet) void Client::parsePlayersSpawned(Packet& packet)
@@ -301,28 +296,6 @@ void Client::parseDoubleJump(Packet & packet)
} }
} }
void Client::parseDashEffect(Packet& packet)
{
EntityID serverID = packet.ReadPrimitive<EntityID>();
if (!serverClientMapsHasEntity(serverID)) {
return;
}
Events::DashAbility e;
e.Player = m_ServerIDToClientID.at(serverID);
if (e.Player != m_LocalPlayer.ID) {
m_EventBroker->Publish(e);
}
}
void Client::parseAmmoPickup(Packet & packet)
{
Events::AmmoPickup e;
e.AmmoGain = packet.ReadPrimitive<int>();
e.Player = m_LocalPlayer;
m_EventBroker->Publish(e);
}
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID) void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
{ {
for (auto field : componentInfo.FieldsInOrder) { for (auto field : componentInfo.FieldsInOrder) {
@@ -536,18 +509,6 @@ bool Client::OnPlayerSpawned(const Events::PlayerSpawned& e)
return true; return true;
} }
bool Client::OnDashAbility(const Events::DashAbility& e)
{
if (!clientServerMapsHasEntity(e.Player) || e.Player != m_LocalPlayer.ID) {
return false;
}
Packet packet(MessageType::OnDashEffect);
packet.WritePrimitive(m_ClientIDToServerID.at(e.Player));
m_Reliable.Send(packet);
return true;
}
bool Client::OnSearchForServers(const Events::SearchForServers& e) bool Client::OnSearchForServers(const Events::SearchForServers& e)
{ {
m_SearchingForServers = true; m_SearchingForServers = true;
+3 -26
View File
@@ -13,7 +13,7 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &Server::OnEntityDeleted); EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &Server::OnEntityDeleted);
EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted); EVENT_SUBSCRIBE_MEMBER(m_EComponentDeleted, &Server::OnComponentDeleted);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage); EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
EVENT_SUBSCRIBE_MEMBER(m_EAmmoPickup, &Server::OnAmmoPickup);
// BindWW // BindWW
if (port == 0) { if (port == 0) {
port = config->Get<float>("Networking.Port", 27666); port = config->Get<float>("Networking.Port", 27666);
@@ -141,9 +141,6 @@ void Server::parseMessageType(Packet& packet)
case MessageType::OnDoubleJump: case MessageType::OnDoubleJump:
parseDoubleJump(packet); parseDoubleJump(packet);
break; break;
case MessageType::OnDashEffect:
parseDashEffect(packet);
break;
default: default:
break; break;
} }
@@ -513,19 +510,6 @@ bool Server::OnPlayerDamage(const Events::PlayerDamage& e)
return true; return true;
} }
bool Server::OnAmmoPickup(const Events::AmmoPickup & e)
{
for (auto& kv : m_ConnectedPlayers) {
if (e.Player.ID == kv.second.EntityID) {
Packet packet(MessageType::AmmoPickup);
// We dont send playerID as it will be set at client to local
packet.WritePrimitive(e.AmmoGain);
m_Reliable.Send(packet, kv.second);
}
}
return true;
}
void Server::parseClientPing() void Server::parseClientPing()
{ {
LOG_INFO("%i: Parsing ping", m_PacketID); LOG_INFO("%i: Parsing ping", m_PacketID);
@@ -558,11 +542,6 @@ bool Server::parseDoubleJump(Packet & packet)
return true; return true;
} }
void Server::parseDashEffect(Packet& packet)
{
reliableBroadcast(packet);
}
void Server::parseOnInputCommand(Packet& packet) void Server::parseOnInputCommand(Packet& packet)
{ {
PlayerID player = -1; PlayerID player = -1;
@@ -625,14 +604,12 @@ bool Server::shouldSendToClient(EntityWrapper childEntity)
auto children = m_World->GetDirectChildren(childEntity.ID); auto children = m_World->GetDirectChildren(childEntity.ID);
for (auto it = children.first; it != children.second; it++) { for (auto it = children.first; it != children.second; it++) {
EntityWrapper child(m_World, it->second); EntityWrapper child(m_World, it->second);
if (child.HasComponent("CapturePoint") || child.HasComponent("HealthPickup") if(child.HasComponent("CapturePoint")) {
|| child.HasComponent("AmmoPickup")) {
return true; return true;
} }
} }
return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid() return childEntity.HasComponent("Player") || childEntity.FirstParentWithComponent("Player").Valid()
|| childEntity.HasComponent("CapturePoint") || childEntity.HasComponent("HealthPickup") || childEntity.HasComponent("CapturePoint");
|| childEntity.HasComponent("AmmoPickup");
} }
PlayerID Server::GetPlayerIDFromEndpoint() PlayerID Server::GetPlayerIDFromEndpoint()
@@ -18,7 +18,7 @@ void DrawColorCorrectionPass::InitializeShaderPrograms()
m_ColorCorrectionProgram->Link(); m_ColorCorrectionProgram->Link();
} }
void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLfloat gamma, GLfloat exposure) void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLuint sceneTextureLowRes, GLuint bloomTextureLowRes, GLfloat gamma, GLfloat exposure)
{ {
//glBindFramebuffer(GL_FRAMEBUFFER, 0); //glBindFramebuffer(GL_FRAMEBUFFER, 0);
GLERROR("DrawScreenQuadPass::Draw: Pre"); GLERROR("DrawScreenQuadPass::Draw: Pre");
@@ -33,6 +33,10 @@ void DrawColorCorrectionPass::Draw(GLuint sceneTexture, GLuint bloomTexture, GLf
glBindTexture(GL_TEXTURE_2D, sceneTexture); glBindTexture(GL_TEXTURE_2D, sceneTexture);
glActiveTexture(GL_TEXTURE1); glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, bloomTexture); glBindTexture(GL_TEXTURE_2D, bloomTexture);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, sceneTextureLowRes);
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, bloomTextureLowRes);
glBindVertexArray(m_ScreenQuad->VAO); glBindVertexArray(m_ScreenQuad->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer);
+246 -487
View File
@@ -1,15 +1,17 @@
#include "Rendering/DrawFinalPass.h" #include "Rendering/DrawFinalPass.h"
DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass) DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCullingPass, CubeMapPass* cubeMapPass, SSAOPass* ssaoPass, GLuint* depthBuffer)
: m_Renderer(renderer) : m_Renderer(renderer)
, m_LightCullingPass(lightCullingPass) , m_LightCullingPass(lightCullingPass)
, m_CubeMapPass(cubeMapPass) , m_CubeMapPass(cubeMapPass)
, m_SSAOPass(ssaoPass) , m_SSAOPass(ssaoPass)
, m_DepthBuffer(depthBuffer)
{ {
//TODO: Make sure that uniforms are not sent into shader if not needed. //TODO: Make sure that uniforms are not sent into shader if not needed.
m_ShieldPixelRate = 8; m_ShieldPixelRate = 8;
InitializeTextures(); InitializeTextures();
InitializeShaderPrograms(); InitializeShaderPrograms();
InitializeFrameBuffers(); InitializeFrameBuffers();
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
} }
void DrawFinalPass::InitializeTextures() void DrawFinalPass::InitializeTextures()
@@ -29,20 +31,40 @@ void DrawFinalPass::InitializeFrameBuffers()
//GenerateMipMapTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_FLOAT, 4); //GenerateMipMapTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_FLOAT, 4);
//GenerateTexture(&m_StencilTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_STENCIL, GL_STENCIL_INDEX8, GL_INT); //GenerateTexture(&m_StencilTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_STENCIL, GL_STENCIL_INDEX8, GL_INT);
CommonFunctions::GenerateTexture(&m_DepthBuffer, GL_CLAMP_TO_BORDER, GL_NEAREST, m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(m_DepthBuffer, GL_DEPTH_STENCIL_ATTACHMENT)));
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthBuffer, GL_DEPTH_STENCIL_ATTACHMENT)));
//m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_StencilTexture, GL_STENCIL_ATTACHMENT))); //m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_StencilTexture, GL_STENCIL_ATTACHMENT)));
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SceneTexture, GL_COLOR_ATTACHMENT0))); m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SceneTexture, GL_COLOR_ATTACHMENT0)));
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_BloomTexture, GL_COLOR_ATTACHMENT1))); m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_BloomTexture, GL_COLOR_ATTACHMENT1)));
m_FinalPassFrameBuffer.Generate(); m_FinalPassFrameBuffer.Generate();
GLERROR("FBO generation"); GLERROR("FBO generation");
CommonFunctions::GenerateTexture(&m_ShieldBuffer, GL_CLAMP_TO_BORDER, GL_NEAREST, /* glGenRenderbuffers(1, &m_DepthBufferLowRes);
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT); glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBufferLowRes);
m_ShieldDepthFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_ShieldBuffer, GL_DEPTH_ATTACHMENT))); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, (int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate));
m_ShieldDepthFrameBuffer.Generate(); GLERROR("RenderBufferLowRes generation");*/
CommonFunctions::GenerateTexture(&m_DepthBufferLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST,
glm::vec2((int)(m_Renderer->GetViewportSize().Width / m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height / m_ShieldPixelRate)),
GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
CommonFunctions::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_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
CommonFunctions::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);
//GenerateMipMapTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_FLOAT, 4);
//GenerateTexture(&m_StencilTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_STENCIL, GL_STENCIL_INDEX8, GL_INT);
m_FinalPassFrameBufferLowRes.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthBufferLowRes, GL_DEPTH_STENCIL_ATTACHMENT)));
//m_FinalPassFrameBufferLowRes.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_StencilTexture, GL_STENCIL_ATTACHMENT)));
m_FinalPassFrameBufferLowRes.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SceneTextureLowRes, GL_COLOR_ATTACHMENT0)));
m_FinalPassFrameBufferLowRes.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_BloomTextureLowRes, GL_COLOR_ATTACHMENT1)));
m_FinalPassFrameBufferLowRes.Generate();
GLERROR("FBO2 generation");
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(m_DepthBuffer, GL_DEPTH_STENCIL_ATTACHMENT)));
m_MergeFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SceneTexture, GL_COLOR_ATTACHMENT0)));
m_MergeFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_BloomTexture, GL_COLOR_ATTACHMENT1)));
m_MergeFrameBuffer.Generate();
GLERROR("FBO3 generation");
} }
void DrawFinalPass::InitializeShaderPrograms() void DrawFinalPass::InitializeShaderPrograms()
@@ -74,7 +96,6 @@ void DrawFinalPass::InitializeShaderPrograms()
m_SpriteProgram->BindFragDataLocation(1, "bloomColor"); m_SpriteProgram->BindFragDataLocation(1, "bloomColor");
m_SpriteProgram->Link(); m_SpriteProgram->Link();
GLERROR("Creating sprite program"); GLERROR("Creating sprite program");
m_ForwardPlusSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram"); m_ForwardPlusSplatMapProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapProgram");
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl"))); m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl"))); m_ForwardPlusSplatMapProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGB.frag.glsl")));
@@ -131,183 +152,194 @@ void DrawFinalPass::InitializeShaderPrograms()
m_ForwardPlusSplatMapSkinnedProgram->Link(); m_ForwardPlusSplatMapSkinnedProgram->Link();
GLERROR("Creating Forward SplatMap Skinned program"); GLERROR("Creating Forward SplatMap Skinned program");
m_FillDepthStencilBufferProgram = ResourceManager::Load<ShaderProgram>("#FillDepthBufferProgram"); m_ShieldToStencilProgram = ResourceManager::Load<ShaderProgram>("#ShieldToStencilProgram");
m_FillDepthStencilBufferProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FillDepthBuffer.vert.glsl"))); m_ShieldToStencilProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ShieldStencil.vert.glsl")));
m_FillDepthStencilBufferProgram->Compile(); m_ShieldToStencilProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ShieldStencil.frag.glsl")));
m_FillDepthStencilBufferProgram->Link(); m_ShieldToStencilProgram->Compile();
m_ShieldToStencilProgram->Link();
GLERROR("Creating Shield program");
m_ShieldToStencilSkinnedProgram = ResourceManager::Load<ShaderProgram>("#ShieldToStencilProgramSkinned");
m_ShieldToStencilSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ShieldStencilSkinned.vert.glsl")));
m_ShieldToStencilSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ShieldStencil.frag.glsl")));
m_ShieldToStencilSkinnedProgram->Compile();
m_ShieldToStencilSkinnedProgram->Link();
GLERROR("Creating Shield Skinned program");
m_FillDepthBufferProgram = ResourceManager::Load<ShaderProgram>("#FillDepthBufferProgram");
m_FillDepthBufferProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FillDepthBuffer.vert.glsl")));
//m_FillDepthBufferProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/FillDepthBuffer.frag.glsl")));
m_FillDepthBufferProgram->Compile();
m_FillDepthBufferProgram->Link();
GLERROR("Creating DepthFill program"); GLERROR("Creating DepthFill program");
m_FillDepthStencilBufferSkinnedProgram = ResourceManager::Load<ShaderProgram>("#FillDepthBufferProgramSkinned"); m_FillDepthBufferSkinnedProgram = ResourceManager::Load<ShaderProgram>("#FillDepthBufferProgramSkinned");
m_FillDepthStencilBufferSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FillDepthBufferSkinned.vert.glsl"))); m_FillDepthBufferSkinnedProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/FillDepthBufferSkinned.vert.glsl")));
m_FillDepthStencilBufferSkinnedProgram->Compile(); //m_FillDepthBufferSkinnedProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/FillDepthBuffer.frag.glsl")));
m_FillDepthStencilBufferSkinnedProgram->Link(); m_FillDepthBufferSkinnedProgram->Compile();
m_FillDepthBufferSkinnedProgram->Link();
GLERROR("Creating DepthFill program"); GLERROR("Creating DepthFill program");
m_MergeProgram = ResourceManager::Load<ShaderProgram>("#MergeProgram");
m_MergeProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/DrawScreenQuad.vert.glsl")));
m_MergeProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/MergeProgram.frag.glsl")));
m_MergeProgram->Compile();
m_ForwardPlusShieldCheckProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusShieldCheckProgram"); m_MergeProgram->BindFragDataLocation(0, "sceneColor");
m_ForwardPlusShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl"))); m_MergeProgram->BindFragDataLocation(1, "bloomColor");
m_ForwardPlusShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusShieldCheck.frag.glsl"))); m_MergeProgram->Link();
m_ForwardPlusShieldCheckProgram->Compile(); GLERROR("Creating merge program");
m_ForwardPlusShieldCheckProgram->BindFragDataLocation(0, "sceneColor");
m_ForwardPlusShieldCheckProgram->BindFragDataLocation(1, "bloomColor");
m_ForwardPlusShieldCheckProgram->Link();
GLERROR("Creating forward+ program");
m_ExplosionEffectShieldCheckProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectShieldCheckProgram");
m_ExplosionEffectShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
m_ExplosionEffectShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
m_ExplosionEffectShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusShieldCheck.frag.glsl")));
m_ExplosionEffectShieldCheckProgram->Compile();
m_ExplosionEffectShieldCheckProgram->BindFragDataLocation(0, "sceneColor");
m_ExplosionEffectShieldCheckProgram->BindFragDataLocation(1, "bloomColor");
m_ExplosionEffectShieldCheckProgram->Link();
GLERROR("Creating explosion program");
m_SpriteShieldCheckProgram = ResourceManager::Load<ShaderProgram>("#SpriteShieldCheckProgram");
m_SpriteShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/Sprite.vert.glsl")));
m_SpriteShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/SpriteShieldCheck.frag.glsl")));
m_SpriteShieldCheckProgram->Compile();
m_SpriteShieldCheckProgram->BindFragDataLocation(0, "sceneColor");
m_SpriteShieldCheckProgram->BindFragDataLocation(1, "bloomColor");
m_SpriteShieldCheckProgram->Link();
GLERROR("Creating sprite program");
m_ForwardPlusSplatMapShieldCheckProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapShieldCheckProgram");
m_ForwardPlusSplatMapShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
m_ForwardPlusSplatMapShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGBShieldCheck.frag.glsl")));
m_ForwardPlusSplatMapShieldCheckProgram->Compile();
m_ForwardPlusSplatMapShieldCheckProgram->BindFragDataLocation(0, "sceneColor");
m_ForwardPlusSplatMapShieldCheckProgram->BindFragDataLocation(1, "bloomColor");
m_ForwardPlusSplatMapShieldCheckProgram->Link();
GLERROR("Creating Forward SplatMap program");
m_ExplosionEffectSplatMapShieldCheckProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapShieldCheckProgram");
m_ExplosionEffectSplatMapShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlus.vert.glsl")));
m_ExplosionEffectSplatMapShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
m_ExplosionEffectSplatMapShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGBShieldCheck.frag.glsl")));
m_ExplosionEffectSplatMapShieldCheckProgram->Compile();
m_ExplosionEffectSplatMapShieldCheckProgram->BindFragDataLocation(0, "sceneColor");
m_ExplosionEffectSplatMapShieldCheckProgram->BindFragDataLocation(1, "bloomColor");
m_ExplosionEffectSplatMapShieldCheckProgram->Link();
GLERROR("Creating explosion SplatMap program");
m_ForwardPlusSkinnedShieldCheckProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSkinnedShieldCheckProgram");
m_ForwardPlusSkinnedShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
m_ForwardPlusSkinnedShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusShieldCheck.frag.glsl")));
m_ForwardPlusSkinnedShieldCheckProgram->Compile();
m_ForwardPlusSkinnedShieldCheckProgram->BindFragDataLocation(0, "sceneColor");
m_ForwardPlusSkinnedShieldCheckProgram->BindFragDataLocation(1, "bloomColor");
m_ForwardPlusSkinnedShieldCheckProgram->Link();
GLERROR("Creating forward+ Skinned program");
m_ExplosionEffectSkinnedShieldCheckProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSkinnedShieldCheckProgram");
m_ExplosionEffectSkinnedShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
m_ExplosionEffectSkinnedShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new GeometryShader("Shaders/ExplosionEffect.geom.glsl")));
m_ExplosionEffectSkinnedShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusShieldCheck.frag.glsl")));
m_ExplosionEffectSkinnedShieldCheckProgram->Compile();
m_ExplosionEffectSkinnedShieldCheckProgram->BindFragDataLocation(0, "sceneColor");
m_ExplosionEffectSkinnedShieldCheckProgram->BindFragDataLocation(1, "bloomColor");
m_ExplosionEffectSkinnedShieldCheckProgram->Link();
GLERROR("Creating explosion Skinned program");
m_ExplosionEffectSplatMapSkinnedShieldCheckProgram = ResourceManager::Load<ShaderProgram>("#ExplosionEffectSplatMapSkinnedShieldCheckProgram");
m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGBShieldCheck.frag.glsl")));
m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->Compile();
m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->BindFragDataLocation(0, "sceneColor");
m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->BindFragDataLocation(1, "bloomColor");
m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->Link();
GLERROR("Creating Forward SplatMap Skinned program");
m_ForwardPlusSplatMapSkinnedShieldCheckProgram = ResourceManager::Load<ShaderProgram>("#ForwardPlusSplatMapSkinnedShieldCheckProgram");
m_ForwardPlusSplatMapSkinnedShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new VertexShader("Shaders/ForwardPlusSkinned.vert.glsl")));
m_ForwardPlusSplatMapSkinnedShieldCheckProgram->AddShader(std::shared_ptr<Shader>(new FragmentShader("Shaders/ForwardPlusSplatMapRGBShieldCheck.frag.glsl")));
m_ForwardPlusSplatMapSkinnedShieldCheckProgram->Compile();
m_ForwardPlusSplatMapSkinnedShieldCheckProgram->BindFragDataLocation(0, "sceneColor");
m_ForwardPlusSplatMapSkinnedShieldCheckProgram->BindFragDataLocation(1, "bloomColor");
m_ForwardPlusSplatMapSkinnedShieldCheckProgram->Link();
GLERROR("Creating Forward SplatMap Skinned program");
} }
void DrawFinalPass::Draw(RenderScene& scene) void DrawFinalPass::Draw(RenderScene& scene)
{ {
GLERROR("Pre"); GLERROR("Pre");
DrawFinalPassState* stateDethp = new DrawFinalPassState(m_ShieldDepthFrameBuffer.GetHandle());
//Draw shields to stencil
DrawToDepthStencilBuffer(scene.Jobs.ShieldObjects, scene);
GLERROR("StencilPass");
delete stateDethp;
DrawFinalPassState* state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle()); DrawFinalPassState* state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
if (scene.ClearDepth) { if (scene.ClearDepth) {
//glClear(GL_DEPTH_BUFFER_BIT); //glClear(GL_DEPTH_BUFFER_BIT);
state->Disable(GL_DEPTH_TEST); state->Disable(GL_DEPTH_TEST);
state->DepthMask(GL_FALSE);
} }
//TODO: Do we need check for this or will it be per scene always? //TODO: Do we need check for this or will it be per scene always?
state->Enable(GL_STENCIL_TEST);
glClearStencil(0x00); glClearStencil(0x00);
glClear(GL_STENCIL_BUFFER_BIT); glClear(GL_STENCIL_BUFFER_BIT);
//Fill depth buffer //Draw Opaque shielded objects
state->Disable(GL_STENCIL_TEST);
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
GLERROR("OpaqueObjects");
DrawModelRenderQueues(scene.Jobs.OpaqueShieldedObjects, scene); //might need changing
GLERROR("Shielded Opaque object");
//DrawStencilState* stencilState = new DrawStencilState(m_FinalPassFrameBuffer.GetHandle());
//Draw shields to stencil pass
state->Enable(GL_STENCIL_TEST); state->Enable(GL_STENCIL_TEST);
state->StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); state->StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state->StencilFunc(GL_ALWAYS, 1, 0xFF); state->StencilFunc(GL_ALWAYS, 1, 0xFF);
state->StencilMask(0xFF); state->StencilMask(0xFF);
state->DepthMask(GL_FALSE); DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
//DrawToDepthStencilBuffer(scene.Jobs.ShieldObjects, scene); GLERROR("StencilPass");
state->DepthMask(GL_TRUE);
//Draw Opaque shielded objects
state->Disable(GL_STENCIL_TEST);
state->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
state->StencilMask(0x00);
DrawModelRenderQueuesWithShieldCheck(scene.Jobs.OpaqueShieldedObjects, scene); //might need changing
GLERROR("Shielded Opaque object");
//Draw Opaque objects
//state->StencilMask(0x00); //state->BlendFunc(GL_ONE, GL_ONE);
//DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
//GLERROR("TransparentObjects");
////Draw Transparen Shielded objects
//DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
//GLERROR("Shielded Transparent objects");
// state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// DrawSprites(scene.Jobs.SpriteJob, scene);
// GLERROR("SpriteJobs");
GLERROR("END");
delete state;
DrawFinalPassState* stateLowRes = new DrawFinalPassState(m_FinalPassFrameBufferLowRes.GetHandle());
//Draw the lowres texture that will be shown behind the shield.
stateLowRes->Enable(GL_SCISSOR_TEST);
stateLowRes->Enable(GL_DEPTH_TEST);
stateLowRes->DepthMask(GL_TRUE);
stateLowRes->Enable(GL_STENCIL_TEST);
stateLowRes->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
stateLowRes->StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
stateLowRes->StencilMask(0xFF);
//TODO: Viewports and scissor should be in state
glViewport(0, 0, m_Renderer->GetViewportSize().Width/m_ShieldPixelRate, m_Renderer->GetViewportSize().Height/m_ShieldPixelRate);
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
glClearStencil(0x00);
glClear(GL_STENCIL_BUFFER_BIT);
//TODO: This should not be here...
stateLowRes->StencilFunc(GL_ALWAYS, 1, 0xFF);
stateLowRes->StencilMask(0x00);
DrawToDepthBuffer(scene.Jobs.OpaqueObjects, scene);
//DrawToDepthBuffer(scene.Jobs.TransparentObjects, scene);
//Draw shields to stencil pass
stateLowRes->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
stateLowRes->StencilMask(0xFF);
stateLowRes->DepthMask(GL_FALSE);
DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
GLERROR("StencilPass");
//glClear(GL_DEPTH_BUFFER_BIT);
stateLowRes->Enable(GL_DEPTH_TEST);
//stateLowRes->DepthMask(GL_TRUE);
stateLowRes->DepthFunc(GL_LEQUAL);
stateLowRes->StencilFunc(GL_LEQUAL, 1, 0xFF);
stateLowRes->StencilMask(0x00);
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene); DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
GLERROR("OpaqueObjects"); GLERROR("OpaqueObjects");
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);
delete stateLowRes;
m_FinalPassFrameBuffer.Unbind();
m_FinalPassFrameBufferLowRes.Unbind();
state = new DrawFinalPassState(m_MergeFrameBuffer.GetHandle());
state->Disable(GL_DEPTH_TEST);
state->Enable(GL_STENCIL_TEST);
state->StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
state->StencilFunc(GL_LEQUAL, 1, 0xFF);
state->StencilMask(0x00);
MergeLayers();
delete state;
state = new DrawFinalPassState(m_FinalPassFrameBuffer.GetHandle());
//Draw Transparancy
state->BlendFunc(GL_ONE, GL_ONE);
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
GLERROR("TransparentObjects");
//state->Disable(GL_STENCIL_TEST);
//Draw Transparen Shielded objects //Draw Transparen Shielded objects
state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
DrawModelRenderQueuesWithShieldCheck(scene.Jobs.TransparentObjects, scene); //might need changing
GLERROR("Shielded Transparent objects"); GLERROR("Shielded Transparent objects");
//Draw Transparen objects state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//state->BlendFunc(GL_ONE, GL_ONE);
//state->StencilFunc(GL_EQUAL, 1, 0xFF);
//DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
GLERROR("TransparentObjects");
//state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
DrawSprites(scene.Jobs.SpriteJob, scene); DrawSprites(scene.Jobs.SpriteJob, scene);
GLERROR("SpriteJobs"); GLERROR("SpriteJobs");
delete state;
GLERROR("END"); GLERROR("END");
delete state;
} }
void DrawFinalPass::ClearBuffer() void DrawFinalPass::ClearBuffer()
{ {
GLERROR("PRE"); GLERROR("PRE");
m_ShieldDepthFrameBuffer.Bind(); m_FinalPassFrameBufferLowRes.Bind();
glClear(GL_DEPTH_BUFFER_BIT); GLERROR("Bind LowRes");
m_ShieldDepthFrameBuffer.Unbind();
glViewport(0, 0, m_Renderer->GetViewportSize().Width/m_ShieldPixelRate, m_Renderer->GetViewportSize().Height/m_ShieldPixelRate);
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
GLERROR("ViewPort,Scissor LowRes");
glClearColor(0.f, 0.f, 0.f, 0.f);
GLERROR("1");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GLERROR("2");
glDisable(GL_SCISSOR_TEST);
GLERROR("3");
m_FinalPassFrameBufferLowRes.Unbind();
GLERROR("prebind HighRes");
m_FinalPassFrameBuffer.Bind(); m_FinalPassFrameBuffer.Bind();
GLERROR("Bind HighRes"); GLERROR("Bind HighRes");
glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); glViewport(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height); glScissor(0, 0, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
GLERROR("ViewPort,Scissor LowRes"); GLERROR("ViewPort,Scissor LowRes");
glClearColor(0.f, 0.f, 0.f, 0.f); glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
m_FinalPassFrameBuffer.Unbind(); m_FinalPassFrameBuffer.Unbind();
GLERROR("END"); GLERROR("END");
} }
@@ -316,25 +348,39 @@ void DrawFinalPass::ClearBuffer()
void DrawFinalPass::OnWindowResize() void DrawFinalPass::OnWindowResize()
{ {
//InitializeFrameBuffers(); //InitializeFrameBuffers();
CommonFunctions::GenerateTexture(&m_DepthBuffer, GL_CLAMP_TO_BORDER, GL_NEAREST,
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
CommonFunctions::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); CommonFunctions::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);
CommonFunctions::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); CommonFunctions::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(); 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));
CommonFunctions::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);
CommonFunctions::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"); GLERROR("Error changing texture resolutions");
} }
void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene) void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
{ {
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle(); GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
GLERROR("forwardHandle");
GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle(); GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle();
GLERROR("explosionHandle");
GLuint explosionSplatMapHandle = m_ExplosionEffectSplatMapProgram->GetHandle(); GLuint explosionSplatMapHandle = m_ExplosionEffectSplatMapProgram->GetHandle();
GLuint forwardSplatMapHandle = m_ForwardPlusSplatMapProgram->GetHandle(); GLERROR("explosionSplatMapHandle");
GLuint forwardSplatHandle = m_ForwardPlusSplatMapProgram->GetHandle();
GLERROR("forwardSplatHandle");
GLuint forwardSkinnedHandle = m_ForwardPlusSkinnedProgram->GetHandle(); GLuint forwardSkinnedHandle = m_ForwardPlusSkinnedProgram->GetHandle();
GLERROR("forwardSkinnedHandle");
GLuint explosionSkinnedHandle = m_ExplosionEffectSkinnedProgram->GetHandle(); GLuint explosionSkinnedHandle = m_ExplosionEffectSkinnedProgram->GetHandle();
GLERROR("explosionSkinnedHandle");
GLuint explosionSplatMapSkinnedHandle = m_ExplosionEffectSplatMapSkinnedProgram->GetHandle(); GLuint explosionSplatMapSkinnedHandle = m_ExplosionEffectSplatMapSkinnedProgram->GetHandle();
GLERROR("explosionSplatMapSkinnedHandle");
GLuint forwardSplatMapSkinnedHandle = m_ForwardPlusSplatMapSkinnedProgram->GetHandle(); GLuint forwardSplatMapSkinnedHandle = m_ForwardPlusSplatMapSkinnedProgram->GetHandle();
GLERROR("forwardSplatSkinnedHandle");
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightCullingPass->LightSSBO()); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightCullingPass->LightSSBO());
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO()); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, m_LightCullingPass->LightGridSSBO());
@@ -365,13 +411,11 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
std::vector<glm::mat4> frameBones; std::vector<glm::mat4> frameBones;
if (explosionEffectJob->AnimationOffset.animation != nullptr) { if (explosionEffectJob->AnimationOffset.animation != nullptr) {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset); frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
} } else {
else {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations); frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
} }
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
} } else {
else {
m_ExplosionEffectProgram->Bind(); m_ExplosionEffectProgram->Bind();
GLERROR("Bind ExplosionEffect program"); GLERROR("Bind ExplosionEffect program");
//bind uniforms //bind uniforms
@@ -381,6 +425,7 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
glActiveTexture(GL_TEXTURE5); glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture); glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(explosionHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position())); glUniform3fv(glGetUniformLocation(explosionHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
} }
break; break;
} }
@@ -397,13 +442,12 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
std::vector<glm::mat4> frameBones; std::vector<glm::mat4> frameBones;
if (explosionEffectJob->AnimationOffset.animation != nullptr) { if (explosionEffectJob->AnimationOffset.animation != nullptr) {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset); frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
} } else {
else {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations); frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
} }
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else { } else {
m_ExplosionEffectSplatMapProgram->Bind(); m_ExplosionEffectSplatMapProgram->Bind();
GLERROR("Bind ExplosionEffectSplatMap program"); GLERROR("Bind ExplosionEffectSplatMap program");
//bind uniforms //bind uniforms
@@ -447,14 +491,12 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
std::vector<glm::mat4> frameBones; std::vector<glm::mat4> frameBones;
if (modelJob->AnimationOffset.animation != nullptr) { if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
} } else {
else {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
} }
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
} } else {
else {
m_ForwardPlusProgram->Bind(); m_ForwardPlusProgram->Bind();
GLERROR("Bind ForwardPlusProgram"); GLERROR("Bind ForwardPlusProgram");
//bind uniforms //bind uniforms
@@ -480,20 +522,18 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
std::vector<glm::mat4> frameBones; std::vector<glm::mat4> frameBones;
if (modelJob->AnimationOffset.animation != nullptr) { if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
} } else {
else {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
} }
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
} } else {
else {
m_ForwardPlusSplatMapProgram->Bind(); m_ForwardPlusSplatMapProgram->Bind();
GLERROR("Bind SplatMap program"); GLERROR("Bind SplatMap program");
//bind uniforms //bind uniforms
BindModelUniforms(forwardSplatMapHandle, modelJob, scene); BindModelUniforms(forwardSplatHandle, modelJob, scene);
//bind textures //bind textures
BindModelTextures(forwardSplatMapHandle, modelJob); BindModelTextures(forwardSplatHandle, modelJob);
GLERROR("asdasd"); GLERROR("asdasd");
} }
break; break;
@@ -511,341 +551,39 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
} }
} }
void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
void DrawFinalPass::DrawShieldToStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
{ {
GLuint forwardHandle = m_ForwardPlusProgram->GetHandle();
GLuint explosionHandle = m_ExplosionEffectProgram->GetHandle();
GLuint explosionSplatMapHandle = m_ExplosionEffectSplatMapProgram->GetHandle();
GLuint forwardSplatMapHandle = m_ForwardPlusSplatMapProgram->GetHandle();
GLuint forwardSkinnedHandle = m_ForwardPlusSkinnedProgram->GetHandle();
GLuint explosionSkinnedHandle = m_ExplosionEffectSkinnedProgram->GetHandle();
GLuint explosionSplatMapSkinnedHandle = m_ExplosionEffectSplatMapSkinnedProgram->GetHandle();
GLuint forwardSplatMapSkinnedHandle = m_ForwardPlusSplatMapSkinnedProgram->GetHandle();
GLuint forwardShieldCheckHandle = m_ForwardPlusShieldCheckProgram->GetHandle();
GLuint explosionShieldCheckHandle = m_ExplosionEffectShieldCheckProgram->GetHandle();
GLuint explosionSplatMapShieldCheckHandle = m_ExplosionEffectSplatMapShieldCheckProgram->GetHandle();
GLuint forwardSplatShieldCheckHandle = m_ForwardPlusSplatMapShieldCheckProgram->GetHandle();
GLuint forwardSkinnedShieldCheckHandle = m_ForwardPlusSkinnedShieldCheckProgram->GetHandle();
GLuint explosionSkinnedShieldCheckHandle = m_ExplosionEffectSkinnedShieldCheckProgram->GetHandle();
GLuint explosionSplatMapSkinnedShieldCheckHandle = m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->GetHandle();
GLuint forwardSplatMapSkinnedShieldCheckHandle = m_ForwardPlusSplatMapSkinnedShieldCheckProgram->GetHandle();
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, m_LightCullingPass->LightSSBO());
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, m_SSAOPass->SSAOTexture());
glActiveTexture(GL_TEXTURE31);
glBindTexture(GL_TEXTURE_2D, m_ShieldBuffer);
for (auto &job : jobs) { for (auto &job : jobs) {
auto explosionEffectJob = std::dynamic_pointer_cast<ExplosionEffectJob>(job);
if (explosionEffectJob) {
if (explosionEffectJob->IsShielded) {
switch (explosionEffectJob->Type) {
case RawModel::MaterialType::Basic:
case RawModel::MaterialType::SingleTextures:
{
if (explosionEffectJob->Model->IsSkinned()) {
m_ExplosionEffectSkinnedShieldCheckProgram->Bind();
GLERROR("Bind ExplosionEffectSkinned program");
//bind uniforms
BindExplosionUniforms(explosionSkinnedShieldCheckHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionSkinnedShieldCheckHandle, explosionEffectJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
}
else {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ExplosionEffectShieldCheckProgram->Bind();
GLERROR("Bind ExplosionEffect program");
//bind uniforms
BindExplosionUniforms(explosionShieldCheckHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionShieldCheckHandle, explosionEffectJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(explosionShieldCheckHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
}
break;
}
case RawModel::MaterialType::SplatMapping:
{
if (explosionEffectJob->Model->IsSkinned()) {
m_ExplosionEffectSplatMapSkinnedShieldCheckProgram->Bind();
GLERROR("Bind ExplosionEffectSplatMapSkinned program");
//bind uniforms
BindExplosionUniforms(explosionSplatMapSkinnedShieldCheckHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionSplatMapSkinnedShieldCheckHandle, explosionEffectJob);
GLERROR("asdasd");
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
}
else {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ExplosionEffectSplatMapShieldCheckProgram->Bind();
GLERROR("Bind ExplosionEffectSplatMap program");
//bind uniforms
//bind uniforms
BindExplosionUniforms(explosionSplatMapShieldCheckHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionSplatMapShieldCheckHandle, explosionEffectJob);
GLERROR("asdasd");
}
break;
}
}
} else {
switch (explosionEffectJob->Type) {
case RawModel::MaterialType::Basic:
case RawModel::MaterialType::SingleTextures:
{
if (explosionEffectJob->Model->IsSkinned()) {
m_ExplosionEffectSkinnedProgram->Bind();
GLERROR("Bind ExplosionEffectSkinned program");
//bind uniforms
BindExplosionUniforms(explosionSkinnedHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionSkinnedHandle, explosionEffectJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(explosionSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
}
else {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(explosionSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ExplosionEffectProgram->Bind();
GLERROR("Bind ExplosionEffect program");
//bind uniforms
BindExplosionUniforms(explosionHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionHandle, explosionEffectJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(explosionHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
}
break;
}
case RawModel::MaterialType::SplatMapping:
{
if (explosionEffectJob->Model->IsSkinned()) {
m_ExplosionEffectSplatMapSkinnedProgram->Bind();
GLERROR("Bind ExplosionEffectSplatMapSkinned program");
//bind uniforms
BindExplosionUniforms(explosionSplatMapSkinnedHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionSplatMapSkinnedHandle, explosionEffectJob);
GLERROR("asdasd");
std::vector<glm::mat4> frameBones;
if (explosionEffectJob->AnimationOffset.animation != nullptr) {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations, explosionEffectJob->AnimationOffset);
}
else {
frameBones = explosionEffectJob->Skeleton->GetFrameBones(explosionEffectJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(explosionSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ExplosionEffectSplatMapProgram->Bind();
GLERROR("Bind ExplosionEffectSplatMap program");
//bind uniforms
//bind uniforms
BindExplosionUniforms(explosionSplatMapHandle, explosionEffectJob, scene);
//bind textures
BindExplosionTextures(explosionSplatMapHandle, explosionEffectJob);
GLERROR("asdasd");
}
break;
}
}
}
glDisable(GL_CULL_FACE);
//draw
glBindVertexArray(explosionEffectJob->Model->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, explosionEffectJob->Model->ElementBuffer);
glDrawElements(GL_TRIANGLES, explosionEffectJob->EndIndex - explosionEffectJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(explosionEffectJob->StartIndex*sizeof(unsigned int)));
glEnable(GL_CULL_FACE);
GLERROR("explosion effect end");
} else {
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job); auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
if (modelJob) { if (modelJob) {
//bind forward program
//TODO: JOHAN/TOBIAS: Bind shader based on ModelJob->ShaderID;
if (modelJob->IsShielded) {
switch (modelJob->Type) {
case RawModel::MaterialType::Basic:
case RawModel::MaterialType::SingleTextures:
{
if (modelJob->Model->IsSkinned()) {
m_ForwardPlusSkinnedShieldCheckProgram->Bind();
GLERROR("Bind ForwardPlusSkinnedProgram");
//bind uniforms
BindModelUniforms(forwardSkinnedShieldCheckHandle, modelJob, scene);
//bind textures
BindModelTextures(forwardSkinnedShieldCheckHandle, modelJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
if(modelJob->Model->IsSkinned()) {
m_ShieldToStencilSkinnedProgram->Bind();
GLuint shaderHandle = m_ShieldToStencilSkinnedProgram->GetHandle();
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
std::vector<glm::mat4> frameBones; std::vector<glm::mat4> frameBones;
if (modelJob->AnimationOffset.animation != nullptr) { if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset); frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
}
else {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ForwardPlusShieldCheckProgram->Bind();
GLERROR("Bind ForwardPlusProgram");
//bind uniforms
BindModelUniforms(forwardShieldCheckHandle, modelJob, scene);
//bind textures
BindModelTextures(forwardShieldCheckHandle, modelJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(forwardShieldCheckHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
}
break;
}
case RawModel::MaterialType::SplatMapping:
{
if (modelJob->Model->IsSkinned()) {
m_ForwardPlusSplatMapSkinnedShieldCheckProgram->Bind();
GLERROR("Bind SplatMap program");
//bind uniforms
BindModelUniforms(forwardSplatMapSkinnedShieldCheckHandle, modelJob, scene);
//bind textures
BindModelTextures(forwardSplatMapSkinnedShieldCheckHandle, modelJob);
GLERROR("asdasd");
std::vector<glm::mat4> frameBones;
if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
}
else {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedShieldCheckHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ForwardPlusSplatMapShieldCheckProgram->Bind();
GLERROR("Bind SplatMap program");
//bind uniforms
BindModelUniforms(forwardSplatShieldCheckHandle, modelJob, scene);
//bind textures
BindModelTextures(forwardSplatShieldCheckHandle, modelJob);
GLERROR("asdasd");
}
break;
}
}
} else { } else {
switch (modelJob->Type) {
case RawModel::MaterialType::Basic:
case RawModel::MaterialType::SingleTextures:
{
if (modelJob->Model->IsSkinned()) {
m_ForwardPlusSkinnedProgram->Bind();
GLERROR("Bind ForwardPlusSkinnedProgram");
//bind uniforms
BindModelUniforms(forwardSkinnedHandle, modelJob, scene);
//bind textures
BindModelTextures(forwardSkinnedHandle, modelJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(forwardSkinnedHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
std::vector<glm::mat4> frameBones;
if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
}
else {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations); frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
} }
glUniformMatrix4fv(glGetUniformLocation(forwardSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
} else {
m_ShieldToStencilProgram->Bind();
GLuint shaderHandle = m_ShieldToStencilProgram->GetHandle();
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
} }
else {
m_ForwardPlusProgram->Bind();
GLERROR("Bind ForwardPlusProgram");
//bind uniforms
BindModelUniforms(forwardHandle, modelJob, scene);
//bind textures
BindModelTextures(forwardHandle, modelJob);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_CUBE_MAP, m_CubeMapPass->m_CubeMapTexture);
glUniform3fv(glGetUniformLocation(forwardHandle, "CameraPosition"), 1, glm::value_ptr(scene.Camera->Position()));
}
break;
}
case RawModel::MaterialType::SplatMapping:
{
if (modelJob->Model->IsSkinned()) {
m_ForwardPlusSplatMapSkinnedProgram->Bind();
GLERROR("Bind SplatMap program");
//bind uniforms
BindModelUniforms(forwardSplatMapSkinnedHandle, modelJob, scene);
//bind textures
BindModelTextures(forwardSplatMapSkinnedHandle, modelJob);
GLERROR("asdasd");
std::vector<glm::mat4> frameBones;
if (modelJob->AnimationOffset.animation != nullptr) {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations, modelJob->AnimationOffset);
}
else {
frameBones = modelJob->Skeleton->GetFrameBones(modelJob->Animations);
}
glUniformMatrix4fv(glGetUniformLocation(forwardSplatMapSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
}
else {
m_ForwardPlusSplatMapProgram->Bind();
GLERROR("Bind SplatMap program");
//bind uniforms
BindModelUniforms(forwardSplatMapHandle, modelJob, scene);
//bind textures
BindModelTextures(forwardSplatMapHandle, modelJob);
GLERROR("asdasd");
}
break;
}
}
}
//draw
glBindVertexArray(modelJob->Model->VAO); glBindVertexArray(modelJob->Model->VAO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelJob->Model->ElementBuffer);
glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex*sizeof(unsigned int))); glDrawElements(GL_TRIANGLES, modelJob->EndIndex - modelJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(modelJob->StartIndex*sizeof(unsigned int)));
@@ -855,7 +593,6 @@ void DrawFinalPass::DrawModelRenderQueuesWithShieldCheck(std::list<std::shared_p
} }
} }
} }
}
void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene) void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
{ {
@@ -949,7 +686,7 @@ void DrawFinalPass::DrawShieldedModelRenderQueue(std::list<std::shared_ptr<Rende
} }
void DrawFinalPass::DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene) void DrawFinalPass::DrawToDepthBuffer(std::list<std::shared_ptr<RenderJob>>& jobs, RenderScene& scene)
{ {
@@ -957,8 +694,8 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob
auto modelJob = std::dynamic_pointer_cast<ModelJob>(job); auto modelJob = std::dynamic_pointer_cast<ModelJob>(job);
if(modelJob->Model->IsSkinned()) { if(modelJob->Model->IsSkinned()) {
m_FillDepthStencilBufferSkinnedProgram->Bind(); m_FillDepthBufferSkinnedProgram->Bind();
GLuint shaderHandle = m_FillDepthStencilBufferSkinnedProgram->GetHandle(); GLuint shaderHandle = m_FillDepthBufferSkinnedProgram->GetHandle();
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
@@ -972,8 +709,8 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0])); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
} else { } else {
m_FillDepthStencilBufferProgram->Bind(); m_FillDepthBufferProgram->Bind();
GLuint shaderHandle = m_FillDepthStencilBufferProgram->GetHandle(); GLuint shaderHandle = m_FillDepthBufferProgram->GetHandle();
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "V"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ViewMatrix()));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix)); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "M"), 1, GL_FALSE, glm::value_ptr(modelJob->Matrix));
@@ -1037,6 +774,28 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
// m_SpriteProgram->Unbind(); // m_SpriteProgram->Unbind();
} }
void DrawFinalPass::MergeLayers()
{
GLuint shaderHandle = m_MergeProgram->GetHandle();
m_MergeProgram->Bind();
GLERROR("MergeLayers 1");
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, m_DepthBufferLowRes);
GLERROR("MergeLayers 2");
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, m_SceneTextureLowRes);
GLERROR("MergeLayers 3");
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, m_BloomTextureLowRes);
GLERROR("MergeLayers 4");
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);
GLERROR("MergeLayers 5");
}
void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene) void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<ExplosionEffectJob>& job, RenderScene& scene)
{ {
glUniform1i(glGetUniformLocation(shaderHandle, "SSAOQuality"), m_SSAOPass->TextureQuality()); glUniform1i(glGetUniformLocation(shaderHandle, "SSAOQuality"), m_SSAOPass->TextureQuality());
+6 -3
View File
@@ -8,7 +8,8 @@ DrawFinalPassState::DrawFinalPassState(GLuint frameBuffer)
Enable(GL_BLEND); Enable(GL_BLEND);
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Enable(GL_DEPTH_TEST); Enable(GL_DEPTH_TEST);
DepthMask(GL_TRUE); DepthMask(GL_FALSE);
DepthFunc(GL_LEQUAL);
Enable(GL_CULL_FACE); Enable(GL_CULL_FACE);
//Enable(GL_STENCIL_TEST); //Enable(GL_STENCIL_TEST);
//StencilFunc(GL_NOTEQUAL, 1, 0xFF); //StencilFunc(GL_NOTEQUAL, 1, 0xFF);
@@ -25,9 +26,11 @@ DrawFinalPassState::~DrawFinalPassState()
DrawStencilState::DrawStencilState(GLuint frameBuffer) DrawStencilState::DrawStencilState(GLuint frameBuffer)
{ {
BindFramebuffer(frameBuffer); BindFramebuffer(frameBuffer);
Enable(GL_STENCIL_TEST);
StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
StencilFunc(GL_ALWAYS, 1, 0xFF);
StencilMask(0xFF);
Enable(GL_DEPTH_TEST); Enable(GL_DEPTH_TEST);
DepthMask(GL_TRUE);
Enable(GL_CULL_FACE);
ClearColor(glm::vec4(0.f)); ClearColor(glm::vec4(0.f));
} }
+1 -1
View File
@@ -70,7 +70,7 @@ void FrameBuffer::Generate()
} }
GLERROR("3"); GLERROR("3");
GLenum* bufferTextures = attachments.data(); GLenum* bufferTextures = &attachments[0];
glDrawBuffers(attachments.size(), bufferTextures); glDrawBuffers(attachments.size(), bufferTextures);
if (GLERROR("GLBufferAttachement error")) { if (GLERROR("GLBufferAttachement error")) {
printf(": AttachmentSize %i", attachments.size()); printf(": AttachmentSize %i", attachments.size());
+1 -2
View File
@@ -23,12 +23,11 @@ void PickingPass::InitializeTextures()
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RG8, GL_RG, GL_UNSIGNED_BYTE); glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
CommonFunctions::GenerateTexture(&m_DepthBuffer, GL_CLAMP_TO_BORDER, GL_NEAREST, CommonFunctions::GenerateTexture(&m_DepthBuffer, GL_CLAMP_TO_BORDER, GL_NEAREST,
glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT); glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
} }
void PickingPass::InitializeFrameBuffers() void PickingPass::InitializeFrameBuffers()
{ {
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthBuffer, GL_DEPTH_ATTACHMENT))); m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_DepthBuffer, GL_DEPTH_ATTACHMENT)));
m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_PickingTexture, GL_COLOR_ATTACHMENT0))); m_PickingBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_PickingTexture, GL_COLOR_ATTACHMENT0)));
m_PickingBuffer.Generate(); m_PickingBuffer.Generate();
@@ -9,6 +9,7 @@ PickingPassState::PickingPassState(GLuint frameBuffer)
Enable(GL_DEPTH_TEST); Enable(GL_DEPTH_TEST);
Enable(GL_CULL_FACE); Enable(GL_CULL_FACE);
Disable(GL_BLEND); Disable(GL_BLEND);
glm::vec4 clearColor = glm::vec4(0.f); glm::vec4 clearColor = glm::vec4(0.f);
//ClearColor(clearColor); //ClearColor(clearColor);
//Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+9 -10
View File
@@ -240,8 +240,6 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
fillColor = (glm::vec4)fillComponent["Color"]; fillColor = (glm::vec4)fillComponent["Color"];
} }
bool isShielded = m_World->HasComponent(cModel.EntityID, "Shielded") || m_World->HasComponent(cModel.EntityID, "Player");
glm::mat4 modelMatrix = Transform::ModelMatrix(cModel.EntityID, m_World); glm::mat4 modelMatrix = Transform::ModelMatrix(cModel.EntityID, m_World);
//Loop through all materialgroups of a model //Loop through all materialgroups of a model
for (auto matGroup : model->MaterialGroups()) { for (auto matGroup : model->MaterialGroups()) {
@@ -257,19 +255,20 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
cModel, cModel,
m_World, m_World,
fillColor, fillColor,
fillPercentage, fillPercentage
isShielded
)); ));
if (m_World->HasComponent(cModel.EntityID, "Shield")){ if (m_World->HasComponent(cModel.EntityID, "Shield")){
explosionEffectJob->CalculateHash(); explosionEffectJob->CalculateHash();
Jobs.ShieldObjects.push_back(explosionEffectJob); Jobs.ShieldObjects.push_back(explosionEffectJob);
} else if (isShielded) { } else if (m_World->HasComponent(cModel.EntityID, "Shielded")
|| m_World->HasComponent(cModel.EntityID, "Player")) {
if (explosionEffectJob->Color.a != 1.f || explosionEffectJob->EndColor.a != 1.f || explosionEffectJob->DiffuseColor.a != 1.f) { if (explosionEffectJob->Color.a != 1.f || explosionEffectJob->EndColor.a != 1.f || explosionEffectJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true; cModel["Transparent"] = true;
} }
if (cModel["Transparent"]) { if (cModel["Transparent"]) {
Jobs.TransparentObjects.push_back(explosionEffectJob); Jobs.TransparentShieldedObjects.push_back(explosionEffectJob);
} else { } else {
explosionEffectJob->CalculateHash(); explosionEffectJob->CalculateHash();
Jobs.OpaqueShieldedObjects.push_back(explosionEffectJob); Jobs.OpaqueShieldedObjects.push_back(explosionEffectJob);
@@ -295,20 +294,20 @@ void RenderSystem::fillModels(RenderScene::Queues &Jobs)
cModel, cModel,
m_World, m_World,
fillColor, fillColor,
fillPercentage, fillPercentage
isShielded
)); ));
if (m_World->HasComponent(cModel.EntityID, "Shield")) { if (m_World->HasComponent(cModel.EntityID, "Shield")) {
modelJob->CalculateHash(); modelJob->CalculateHash();
Jobs.ShieldObjects.push_back(modelJob); Jobs.ShieldObjects.push_back(modelJob);
} else if (isShielded) { } else if (m_World->HasComponent(cModel.EntityID, "Shielded")
|| m_World->HasComponent(cModel.EntityID, "Player")) {
if (modelJob->Color.a != 1.f || modelJob->DiffuseColor.a != 1.f) { if (modelJob->Color.a != 1.f || modelJob->DiffuseColor.a != 1.f) {
cModel["Transparent"] = true; cModel["Transparent"] = true;
} }
if (cModel["Transparent"]) { if (cModel["Transparent"]) {
Jobs.TransparentObjects.push_back(modelJob); Jobs.TransparentShieldedObjects.push_back(modelJob);
} else { } else {
modelJob->CalculateHash(); modelJob->CalculateHash();
Jobs.OpaqueShieldedObjects.push_back(modelJob); Jobs.OpaqueShieldedObjects.push_back(modelJob);

Some files were not shown because too many files have changed in this diff Show More