Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7de7ccf8c | |||
| fe36e8b423 | |||
| a7bff92899 | |||
| bfcf7b240e | |||
| 73b8bff1f3 | |||
| 1deb506fb2 | |||
| ae3cab6cd1 | |||
| a9b19d9af1 | |||
| cb7beae28c | |||
| 7ea26d10ee | |||
| 28e9ba1208 | |||
| f0c2fdead1 | |||
| e1ca104fc9 | |||
| 2cb4a307eb | |||
| 6507efc0db | |||
| 96a3e68bf4 | |||
| 2d438060dd | |||
| a339c61f5b | |||
| 8b81ba9019 | |||
| 7af17049e9 | |||
| 85ba5552e9 | |||
| 8b66d29adc | |||
| a9a19193ad | |||
| 0a6653d079 | |||
| cdbc348cfa | |||
| 502a290d36 | |||
| cfba8efd24 | |||
| 5a6374f013 | |||
| 1ae2f3f5f3 | |||
| 1961c16fe2 | |||
| d32a483bb4 | |||
| e23ea78aeb | |||
| 4153a31e3a | |||
| 0908be1e02 | |||
| 2ed5fad699 | |||
| 70374fa10e | |||
| 20468cba1b | |||
| 7749fc5474 | |||
| 6dd7f1a657 | |||
| 144e548b7a | |||
| 14b0a64720 | |||
| 8647267cad | |||
| ecab5de056 | |||
| 38d8cdded2 | |||
| 22c391df54 | |||
| f220d8088c | |||
| df2e4abb52 | |||
| 8867e7ac3c | |||
| 73a4336206 | |||
| f2ab02d860 | |||
| bf376f54b6 | |||
| 178402e964 | |||
| 36043010af | |||
| cb77c1ff97 | |||
| 69db32337d | |||
| 6af167675d | |||
| ecd823cb9f | |||
| 847c539373 | |||
| cb7f06573f | |||
| 6542d1b444 | |||
| bbf6058c17 | |||
| 0e51ae7dc9 | |||
| c912cd7a42 | |||
| 7f1016476b |
Executable → Regular
+6
-3
@@ -1,3 +1,6 @@
|
|||||||
|
#ifndef EditorRenderSystem_h__
|
||||||
|
#define EditorRenderSystem_h__
|
||||||
|
|
||||||
#include "../Core/System.h"
|
#include "../Core/System.h"
|
||||||
#include "../Rendering/IRenderer.h"
|
#include "../Rendering/IRenderer.h"
|
||||||
#include "../Rendering/ModelJob.h"
|
#include "../Rendering/ModelJob.h"
|
||||||
@@ -14,11 +17,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
IRenderer* m_Renderer;
|
IRenderer* m_Renderer;
|
||||||
RenderFrame* m_RenderFrame;
|
RenderFrame* m_RenderFrame;
|
||||||
Camera* m_Camera;
|
Camera* m_EditorCamera;
|
||||||
EntityWrapper m_CurrentCamera = EntityWrapper::Invalid;
|
EntityWrapper m_CurrentCamera = EntityWrapper::Invalid;
|
||||||
|
|
||||||
EventRelay<EditorRenderSystem, Events::SetCamera> m_ESetCamera;
|
EventRelay<EditorRenderSystem, Events::SetCamera> m_ESetCamera;
|
||||||
bool OnSetCamera(Events::SetCamera& e);
|
bool OnSetCamera(Events::SetCamera& e);
|
||||||
|
};
|
||||||
|
|
||||||
void enqueueModel(RenderScene& scene, EntityWrapper entity, const glm::mat4& modelMatrix, const std::string& modelResource, ComponentWrapper cModel, bool wireframe);
|
#endif
|
||||||
};
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#ifndef EditorWidgetRenderSystem_h__
|
|
||||||
#define EditorWidgetRenderSystem_h__
|
|
||||||
|
|
||||||
#include "../Core/System.h"
|
|
||||||
#include "../Rendering/IRenderer.h"
|
|
||||||
#include "../Rendering/ModelJob.h"
|
|
||||||
#include "../Rendering/Camera.h"
|
|
||||||
#include "../Rendering/ESetCamera.h"
|
|
||||||
|
|
||||||
class EditorWidgetRenderSystem : public ImpureSystem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
EditorWidgetRenderSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame);
|
|
||||||
|
|
||||||
virtual void Update(double dt) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
IRenderer* m_Renderer;
|
|
||||||
RenderFrame* m_RenderFrame;
|
|
||||||
Camera* m_EditorCamera;
|
|
||||||
EntityWrapper m_CurrentCamera = EntityWrapper::Invalid;
|
|
||||||
|
|
||||||
EventRelay<EditorWidgetRenderSystem, Events::SetCamera> m_ESetCamera;
|
|
||||||
bool OnSetCamera(Events::SetCamera& e);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -24,7 +24,9 @@ public:
|
|||||||
{
|
{
|
||||||
// Check if we are trying to add more than the package can fit.
|
// Check if we are trying to add more than the package can fit.
|
||||||
if (m_MaxPacketSize < m_Offset + sizeof(T)) {
|
if (m_MaxPacketSize < m_Offset + sizeof(T)) {
|
||||||
LOG_WARNING("Packet AddPrimitive(): You are trying to add more than we have allocated for! New size is %i bytes\n", m_MaxPacketSize*2);
|
if (m_MaxPacketSize >= 32000) {
|
||||||
|
LOG_WARNING("Package::WritePrimitive(): New size is huge %i bytes\n", m_MaxPacketSize*2);
|
||||||
|
}
|
||||||
resizeData();
|
resizeData();
|
||||||
}
|
}
|
||||||
memcpy(m_Data + m_Offset, &val, sizeof(T));
|
memcpy(m_Data + m_Offset, &val, sizeof(T));
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ struct ModelJob : RenderJob
|
|||||||
std::vector<const ::RawModel::TextureProperties*> SpecularTexture;
|
std::vector<const ::RawModel::TextureProperties*> SpecularTexture;
|
||||||
std::vector<const ::RawModel::TextureProperties*> IncandescenceTexture;
|
std::vector<const ::RawModel::TextureProperties*> IncandescenceTexture;
|
||||||
float Shininess = 0.f;
|
float Shininess = 0.f;
|
||||||
glm::vec4 Color = glm::vec4(1.f, 1.f, 1.f, 1.f);
|
glm::vec4 Color;
|
||||||
const ::Model* Model = nullptr;
|
const ::Model* Model = nullptr;
|
||||||
::Skeleton* Skeleton = nullptr;
|
::Skeleton* Skeleton = nullptr;
|
||||||
std::vector<::Skeleton::AnimationData> Animations;
|
std::vector<::Skeleton::AnimationData> Animations;
|
||||||
@@ -182,7 +182,6 @@ 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;
|
bool IsShielded;
|
||||||
bool Wireframe = false;
|
|
||||||
void CalculateHash() override
|
void CalculateHash() override
|
||||||
{
|
{
|
||||||
Hash = ShaderID << 20 + ModelID << 10 + TextureID;
|
Hash = ShaderID << 20 + ModelID << 10 + TextureID;
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ public:
|
|||||||
bool StencilMask(GLuint mask);
|
bool StencilMask(GLuint mask);
|
||||||
bool DepthMask(GLboolean flag);
|
bool DepthMask(GLboolean flag);
|
||||||
bool DepthFunc(GLenum func);
|
bool DepthFunc(GLenum func);
|
||||||
bool PolygonMode(GLenum face, GLenum mode);
|
|
||||||
bool AlphaFunc(GLenum func, GLclampf thresholder);
|
bool AlphaFunc(GLenum func, GLclampf thresholder);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef AbilityCooldownHUDSystem_h__
|
||||||
|
#define AbilityCooldownHUDSystem_h__
|
||||||
|
|
||||||
|
#include "../../Engine/Core/System.h"
|
||||||
|
#include "../../Engine/GLM.h"
|
||||||
|
|
||||||
|
class AbilityCooldownHUDSystem : public ImpureSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AbilityCooldownHUDSystem(SystemParams params)
|
||||||
|
: System(params)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual void Update(double dt) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef BoostIconsHUDSystem_h__
|
||||||
|
#define BoostIconsHUDSystem_h__
|
||||||
|
|
||||||
|
#include "../../Engine/Core/System.h"
|
||||||
|
#include "../../Engine/GLM.h"
|
||||||
|
|
||||||
|
class BoostIconsHUDSystem : public PureSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BoostIconsHUDSystem(SystemParams params)
|
||||||
|
: System(params)
|
||||||
|
, PureSystem("BoostIconsHUD")
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -51,10 +51,12 @@
|
|||||||
<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/AbilityCooldownHUD.xsd"/>
|
||||||
<xs:include schemaLocation="Components/DoubleJump.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/CapturePointGameMode.xsd"/>
|
||||||
<xs:include schemaLocation="Components/CapturePointArrowHUD.xsd"/>
|
<xs:include schemaLocation="Components/CapturePointArrowHUD.xsd"/>
|
||||||
<xs:include schemaLocation="Components/FloatingEffect.xsd"/>
|
<xs:include schemaLocation="Components/FloatingEffect.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/BoostIconsHUD.xsd"/>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<AbilityCooldownHUD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AbilityCooldownHUD.xsd">
|
||||||
|
</AbilityCooldownHUD>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?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="AbilityCooldownHUD">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>HUD element for tracking ability cooldown. If it has a sprite and fill component it will fill the sprite with chosen color depending on the cooldown.\n A child with text component named "Cooldown"</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<BoostIconsHUD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostIconsHUD.xsd"/>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="BoostIconsHUD">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Origin for the 3 boost states. Create 3 children with Sprite and Fill components, name them "Sprint", "Defender", "Assault"</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<Text xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Text.xsd">
|
<Text xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Text.xsd">
|
||||||
<Content></Content>
|
<Content></Content>
|
||||||
<Resource></Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Color R="1" G="1" B="1" A="1"/>
|
<Color R="1" G="1" B="1" A="1"/>
|
||||||
<Visible>true</Visible>
|
<Visible>true</Visible>
|
||||||
<Alignment><Center/></Alignment>
|
<Alignment><Center/></Alignment>
|
||||||
|
|||||||
@@ -100,12 +100,12 @@
|
|||||||
<Percentage>1</Percentage>
|
<Percentage>1</Percentage>
|
||||||
<Color A="1" B="1" G="0" R="0"/>
|
<Color A="1" B="1" G="0" R="0"/>
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:HealthHUD/>
|
|
||||||
<c:Text>
|
<c:Text>
|
||||||
<Content>100/100</Content>
|
<Content>100/100</Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
<Color A="0.505882382" B="3.92156863" G="1.17647064" R="0"/>
|
<Color A="0.505882382" B="3.92156863" G="1.17647064" R="0"/>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
|
<c:HealthHUD/>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.355000019" Y="-0.203000009" Z="0.0410000011"/>
|
<Position X="-0.355000019" Y="-0.203000009" Z="0.0410000011"/>
|
||||||
<Scale X="0.0350000001" Y="0.0350000001" Z="0.0350000001"/>
|
<Scale X="0.0350000001" Y="0.0350000001" Z="0.0350000001"/>
|
||||||
@@ -132,7 +132,70 @@
|
|||||||
<Orientation X="5.87300014" Y="0" Z="4.71200037"/>
|
<Orientation X="5.87300014" Y="0" Z="4.71200037"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children>
|
||||||
|
<Entity name="BoostIcons">
|
||||||
|
<Components>
|
||||||
|
<c:BoostIconsHUD/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Assault">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Color A="1" B="0.533333361" G="1" R="0.329411775"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||||
|
<DepthSort>false</DepthSort>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="0.588235319" B="0.0392156877" G="0.184313729" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.225000009" Y="0.168000013" Z="0"/>
|
||||||
|
<Scale X="0.27700001" Y="0.100000001" Z="0.200000003"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Defender">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Color A="1" B="1" G="0.58431375" R="0.105882354"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||||
|
<DepthSort>false</DepthSort>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="0.588235319" B="0.34117648" G="0.192156866" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.224999994" Y="0.27700001" Z="0"/>
|
||||||
|
<Scale X="0.27700001" Y="0.100000001" Z="0.200000003"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Sniper">
|
||||||
|
<Components>
|
||||||
|
<c:Fill>
|
||||||
|
<Color A="1" B="0.345098048" G="0" R="1"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||||
|
<DepthSort>false</DepthSort>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="0.588235319" B="0.121568628" G="0" R="0.443137258"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.225000009" Y="0.38500002" Z="0"/>
|
||||||
|
<Scale X="0.27700001" Y="0.100000001" Z="0.200000003"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
@@ -196,7 +259,6 @@
|
|||||||
<CapturePointNumber>3</CapturePointNumber>
|
<CapturePointNumber>3</CapturePointNumber>
|
||||||
</c:CapturePointHUD>
|
</c:CapturePointHUD>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
<Percentage>0.80222018197612788</Percentage>
|
|
||||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
@@ -231,6 +293,7 @@
|
|||||||
<CapturePointNumber>4</CapturePointNumber>
|
<CapturePointNumber>4</CapturePointNumber>
|
||||||
</c:CapturePointHUD>
|
</c:CapturePointHUD>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
|
<Percentage>1</Percentage>
|
||||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
@@ -286,7 +349,7 @@
|
|||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
<GlowMap></GlowMap>
|
<GlowMap></GlowMap>
|
||||||
<Color A="0.699999988" B="0" G="0.200000003" R="1"/>
|
<Color A="0.699999988" B="0" G="0" R="1"/>
|
||||||
</c:Sprite>
|
</c:Sprite>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
||||||
@@ -297,7 +360,8 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:CapturePointHUD/>
|
<c:CapturePointHUD/>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
<Percentage>1</Percentage>
|
||||||
|
<Color A="0.699999988" B="0" G="0" R="1"/>
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Sprite>
|
<c:Sprite>
|
||||||
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
@@ -306,7 +370,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.00999999978"/>
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||||
<Orientation X="0" Y="0" Z="1.57079637"/>
|
<Orientation X="0" Y="0" Z="4.71238899"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -369,6 +433,25 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity name="CapturePointArrow">
|
||||||
|
<Components>
|
||||||
|
<c:CapturePointArrowHUD/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Widgets/Arrows/Arrow5.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Blue/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.714000046" Z="-1.30000007"/>
|
||||||
|
<Scale X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||||
|
<Orientation X="0.405680239" Y="0.369605929" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Hands">
|
<Entity name="Hands">
|
||||||
|
|||||||
@@ -51,8 +51,10 @@
|
|||||||
<xs:element ref="c:Page" minOccurs="0"/>
|
<xs:element ref="c:Page" minOccurs="0"/>
|
||||||
<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:AbilityCooldownHUD" 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:CapturePointArrowHUD" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:BoostIconsHUD" minOccurs="0"/>
|
||||||
<xs:element ref="c:FloatingEffect" minOccurs="0"/>
|
<xs:element ref="c:FloatingEffect" minOccurs="0"/>
|
||||||
<xs:element ref="c:AmmoPickup" minOccurs="0"/>
|
<xs:element ref="c:AmmoPickup" minOccurs="0"/>
|
||||||
<xs:element ref="c:HealthPickup" minOccurs="0"/>
|
<xs:element ref="c:HealthPickup" minOccurs="0"/>
|
||||||
|
|||||||
@@ -17,105 +17,107 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
|||||||
EntityAABB& boxA = *boundingBox;
|
EntityAABB& boxA = *boundingBox;
|
||||||
bool everHitTheGround = false;
|
bool everHitTheGround = false;
|
||||||
|
|
||||||
auto prevPosIt = m_PrevPositions.find(entity);
|
if (entity == LocalPlayer) {
|
||||||
if (prevPosIt != m_PrevPositions.end()) {
|
auto prevPosIt = m_PrevPositions.find(entity);
|
||||||
glm::vec3 size = boxA.Size();
|
if (prevPosIt != m_PrevPositions.end()) {
|
||||||
float diameter = std::min(size.x, size.z);
|
glm::vec3 size = boxA.Size();
|
||||||
glm::vec3 prevOrigin = prevPosIt->second;
|
float diameter = std::min(size.x, size.z);
|
||||||
glm::vec3 toCurrentPos = boxA.Origin() - prevOrigin;
|
glm::vec3 prevOrigin = prevPosIt->second;
|
||||||
float rayLength = glm::length(toCurrentPos) + 0.5f*diameter;
|
glm::vec3 toCurrentPos = boxA.Origin() - prevOrigin;
|
||||||
//If the entity has moved farther than the size of its box, we need to handle it specially.
|
float rayLength = glm::length(toCurrentPos) + 0.5f*diameter;
|
||||||
if (rayLength > diameter) {
|
//If the entity has moved farther than the size of its box, we need to handle it specially.
|
||||||
Ray ray(prevOrigin, toCurrentPos);
|
if (rayLength > diameter) {
|
||||||
m_OctreeResult.clear();
|
Ray ray(prevOrigin, toCurrentPos);
|
||||||
m_Octree->ObjectsPossiblyHitByRay(ray, m_OctreeResult);
|
m_OctreeResult.clear();
|
||||||
for (auto& boxB : m_OctreeResult) {
|
m_Octree->ObjectsPossiblyHitByRay(ray, m_OctreeResult);
|
||||||
if (boxA.Entity == boxB.Entity) {
|
for (auto& boxB : m_OctreeResult) {
|
||||||
continue;
|
if (boxA.Entity == boxB.Entity) {
|
||||||
}
|
|
||||||
bool hit;
|
|
||||||
float dist;
|
|
||||||
if (boxB.Entity.HasComponent("Model")) {
|
|
||||||
RawModel* model;
|
|
||||||
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
|
|
||||||
try {
|
|
||||||
model = ResourceManager::Load<RawModel, true>(res);
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float u, v;
|
bool hit;
|
||||||
hit = Collision::RayVsModel(ray, model->Vertices(), model->m_Indices, Transform::ModelMatrix(boxB.Entity), dist, u, v);
|
float dist;
|
||||||
} else {
|
if (boxB.Entity.HasComponent("Model")) {
|
||||||
hit = Collision::RayVsAABB(ray, boxB, dist);
|
RawModel* model;
|
||||||
}
|
std::string res = (std::string)boxB.Entity["Model"]["Resource"];
|
||||||
if (hit && dist < rayLength) {
|
try {
|
||||||
//Set the entity to where it was colliding, minus the maximum box size.
|
model = ResourceManager::Load<RawModel, true>(res);
|
||||||
//TODO: Perhaps this should be done slightly more properly.
|
} catch (const std::exception&) {
|
||||||
glm::vec3 newOriginPos = ray.Origin() + (dist - 0.707107f*diameter) * ray.Direction();
|
continue;
|
||||||
glm::vec3 resolve = newOriginPos - boxA.Origin();
|
}
|
||||||
(glm::vec3&)cTransform["Position"] += resolve;
|
float u, v;
|
||||||
boxA = *Collision::EntityAbsoluteAABB(entity);
|
hit = Collision::RayVsModel(ray, model->Vertices(), model->m_Indices, Transform::ModelMatrix(boxB.Entity), dist, u, v);
|
||||||
if (resolve.y > 0) {
|
} else {
|
||||||
everHitTheGround = true;
|
hit = Collision::RayVsAABB(ray, boxB, dist);
|
||||||
(bool)cPhysics["IsOnGround"] = true;
|
}
|
||||||
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
|
if (hit && dist < rayLength) {
|
||||||
|
//Set the entity to where it was colliding, minus the maximum box size.
|
||||||
|
//TODO: Perhaps this should be done slightly more properly.
|
||||||
|
glm::vec3 newOriginPos = ray.Origin() + (dist - 0.707107f*diameter) * ray.Direction();
|
||||||
|
glm::vec3 resolve = newOriginPos - boxA.Origin();
|
||||||
|
(glm::vec3&)cTransform["Position"] += resolve;
|
||||||
|
boxA = *Collision::EntityAbsoluteAABB(entity);
|
||||||
|
if (resolve.y > 0) {
|
||||||
|
everHitTheGround = true;
|
||||||
|
(bool)cPhysics["IsOnGround"] = true;
|
||||||
|
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Collide against octree items
|
// Collide against octree items
|
||||||
m_OctreeResult.clear();
|
m_OctreeResult.clear();
|
||||||
m_Octree->ObjectsInSameRegion(*boundingBox, m_OctreeResult);
|
m_Octree->ObjectsInSameRegion(*boundingBox, m_OctreeResult);
|
||||||
for (auto& boxB : m_OctreeResult) {
|
for (auto& boxB : m_OctreeResult) {
|
||||||
glm::vec3 resolutionVector;
|
glm::vec3 resolutionVector;
|
||||||
if (boxA.Entity == boxB.Entity) {
|
if (boxA.Entity == boxB.Entity) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (boxB.Entity.HasComponent("Model") && Collision::AABBVsAABB(boxA, boxB)) {
|
|
||||||
//Here we know boxB is a entity with Collideable, AABB, and Model.
|
|
||||||
RawModel* model;
|
|
||||||
try {
|
|
||||||
model = ResourceManager::Load<RawModel, true>(boxB.Entity["Model"]["Resource"]);
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 modelMatrix = Transform::ModelMatrix(boxB.Entity);
|
if (boxB.Entity.HasComponent("Model") && Collision::AABBVsAABB(boxA, boxB)) {
|
||||||
|
//Here we know boxB is a entity with Collideable, AABB, and Model.
|
||||||
|
RawModel* model;
|
||||||
|
try {
|
||||||
|
model = ResourceManager::Load<RawModel, true>(boxB.Entity["Model"]["Resource"]);
|
||||||
|
} catch (const std::exception&) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
|
glm::mat4 modelMatrix = Transform::ModelMatrix(boxB.Entity);
|
||||||
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"];
|
glm::vec3 inOutVelocity = (glm::vec3)cPhysics["Velocity"];
|
||||||
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
|
bool notMovingxz = glm::all(glm::lessThan(glm::abs(glm::vec2(inOutVelocity.x, inOutVelocity.z)), glm::vec2(0.01f))) && prevPosIt != m_PrevPositions.end();
|
||||||
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
|
bool isOnGround = (bool)cPhysics["IsOnGround"];
|
||||||
//Move the position to previous position if it is not moving in the xz-plane, else resolve with the resolution vector.
|
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
|
||||||
(glm::vec3&)cTransform["Position"] += notMovingxz ? prevPosIt->second - boxA.Origin() : 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"] += notMovingxz ? prevPosIt->second - boxA.Origin() : resolutionVector;
|
||||||
|
boxA = *Collision::EntityAbsoluteAABB(entity);
|
||||||
|
cPhysics["Velocity"] = inOutVelocity;
|
||||||
|
if (isOnGround) {
|
||||||
|
everHitTheGround = true;
|
||||||
|
(bool)cPhysics["IsOnGround"] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) {
|
||||||
|
//Enter here if boxB has no Model.
|
||||||
|
(glm::vec3&)cTransform["Position"] += resolutionVector;
|
||||||
boxA = *Collision::EntityAbsoluteAABB(entity);
|
boxA = *Collision::EntityAbsoluteAABB(entity);
|
||||||
cPhysics["Velocity"] = inOutVelocity;
|
if (resolutionVector.y > 0) {
|
||||||
if (isOnGround) {
|
|
||||||
everHitTheGround = true;
|
everHitTheGround = true;
|
||||||
(bool)cPhysics["IsOnGround"] = true;
|
(bool)cPhysics["IsOnGround"] = true;
|
||||||
|
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Collision::AABBVsAABB(boxA, boxB, resolutionVector)) {
|
|
||||||
//Enter here if boxB has no Model.
|
|
||||||
(glm::vec3&)cTransform["Position"] += resolutionVector;
|
|
||||||
boxA = *Collision::EntityAbsoluteAABB(entity);
|
|
||||||
if (resolutionVector.y > 0) {
|
|
||||||
everHitTheGround = true;
|
|
||||||
(bool)cPhysics["IsOnGround"] = true;
|
|
||||||
((glm::vec3&)cPhysics["Velocity"]).y = 0.f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//This should apply air friction and such, iff zero models were hit.
|
//This should apply air friction and such, iff zero models were hit.
|
||||||
if (!everHitTheGround) {
|
if (!everHitTheGround) {
|
||||||
(bool)cPhysics["IsOnGround"] = false;
|
(bool)cPhysics["IsOnGround"] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_PrevPositions[entity] = boxA.Origin();
|
m_PrevPositions[entity] = boxA.Origin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ void EditorGUI::drawEntitiesRecursive(World* world, EntityID parent)
|
|||||||
auto entityChildren = world->GetEntityChildren();
|
auto entityChildren = world->GetEntityChildren();
|
||||||
auto range = entityChildren.equal_range(parent);
|
auto range = entityChildren.equal_range(parent);
|
||||||
for (auto it = range.first; it != range.second; it++) {
|
for (auto it = range.first; it != range.second; it++) {
|
||||||
if (drawEntityNode(EntityWrapper(world, it->second))) {
|
if (EditorGUI::drawEntityNode(EntityWrapper(world, it->second))) {
|
||||||
drawEntitiesRecursive(world, it->second);
|
drawEntitiesRecursive(world, it->second);
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,6 @@ bool EditorGUI::drawEntityNode(EntityWrapper entity)
|
|||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PushID(("EntityNode" + std::to_string(entity.ID)).c_str());
|
|
||||||
ImGui::SetNextTreeNodeOpened(true, ImGuiSetCond_Once);
|
ImGui::SetNextTreeNodeOpened(true, ImGuiSetCond_Once);
|
||||||
if (ImGui::TreeNode(formatEntityName(entity).c_str())) {
|
if (ImGui::TreeNode(formatEntityName(entity).c_str())) {
|
||||||
// Handle drop events for reparenting
|
// Handle drop events for reparenting
|
||||||
@@ -225,10 +224,8 @@ bool EditorGUI::drawEntityNode(EntityWrapper entity)
|
|||||||
entityChangeParent(m_CurrentlyDragging, entity);
|
entityChangeParent(m_CurrentlyDragging, entity);
|
||||||
m_CurrentlyDragging = EntityWrapper::Invalid;
|
m_CurrentlyDragging = EntityWrapper::Invalid;
|
||||||
}
|
}
|
||||||
ImGui::PopID();
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
ImGui::PopID();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Executable → Regular
+64
-59
@@ -1,44 +1,81 @@
|
|||||||
#include "Editor/EditorRenderSystem.h"
|
#include "Editor/EditorRenderSystem.h"
|
||||||
|
|
||||||
EditorRenderSystem::EditorRenderSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
|
EditorRenderSystem::EditorRenderSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
|
||||||
: System(params)
|
: System(params)
|
||||||
, m_Renderer(renderer)
|
, m_Renderer(renderer)
|
||||||
, m_RenderFrame(renderFrame)
|
, m_RenderFrame(renderFrame)
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &EditorRenderSystem::OnSetCamera);
|
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &EditorRenderSystem::OnSetCamera);
|
||||||
auto resolution = renderer->Resolution();
|
auto resolution = Rectangle::Rectangle(1280, 720);
|
||||||
m_Camera = new Camera((float)resolution.Width / resolution.Height, glm::radians(45.f), 0.01f, 5000.f);
|
m_EditorCamera = new Camera((float)resolution.Width / resolution.Height, glm::radians(45.f), 0.01f, 5000.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorRenderSystem::Update(double dt)
|
void EditorRenderSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
if (m_CurrentCamera.Valid()) {
|
if (m_CurrentCamera.Valid()) {
|
||||||
m_Camera->SetPosition(Transform::AbsolutePosition(m_CurrentCamera));
|
ComponentWrapper cameraTransform = m_CurrentCamera["Transform"];
|
||||||
m_Camera->SetOrientation(Transform::AbsoluteOrientation(m_CurrentCamera));
|
m_EditorCamera->SetPosition(cameraTransform["Position"]);
|
||||||
|
m_EditorCamera->SetOrientation(glm::quat((const glm::vec3&)cameraTransform["Orientation"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderScene scene;
|
RenderScene scene;
|
||||||
scene.Camera = m_Camera;
|
scene.ClearDepth = true;
|
||||||
|
scene.Camera = m_EditorCamera;
|
||||||
|
scene.Viewport = Rectangle(1920, 1080);
|
||||||
|
|
||||||
auto cameras = m_World->GetComponents("Camera");
|
auto cSceneLight = m_World->GetComponents("SceneLight");
|
||||||
if (cameras != nullptr) {
|
if (cSceneLight != nullptr) {
|
||||||
for (auto& cCamera : *cameras) {
|
//these are hardcoded since they want special light treatment and a component just for widgets is stupid.
|
||||||
EntityWrapper entity(m_World, cCamera.EntityID);
|
scene.AmbientColor = glm::vec4(0.8, 0.8, 0.8, 1.0);
|
||||||
entity["Model"]["Resource"] = "Models/Widgets/Camera.mesh";
|
}
|
||||||
glm::mat4 modelMatrix = Transform::ModelMatrix(entity);
|
|
||||||
enqueueModel(scene, entity, modelMatrix, "Models/Widgets/Camera.mesh", entity["Model"], false);
|
auto models = m_World->GetComponents("Model");
|
||||||
|
if (models != nullptr) {
|
||||||
|
for (auto& cModel : *models) {
|
||||||
|
if (!(bool)cModel["Visible"]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& resource = cModel["Resource"];
|
||||||
|
|
||||||
|
Model* model;
|
||||||
|
try {
|
||||||
|
model = ResourceManager::Load<::Model, true>(resource);
|
||||||
|
} catch (const Resource::StillLoadingException&) {
|
||||||
|
continue;
|
||||||
|
} catch (const std::exception&) {
|
||||||
|
try {
|
||||||
|
model = ResourceManager::Load<::Model>("Models/Core/Error.mesh");
|
||||||
|
} catch (const std::exception&) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityWrapper entity(m_World, cModel.EntityID);
|
||||||
|
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World);
|
||||||
|
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);
|
||||||
|
if (cModel["Transparent"]) {
|
||||||
|
scene.Jobs.TransparentObjects.push_back(modelJob);
|
||||||
|
} else {
|
||||||
|
scene.Jobs.OpaqueObjects.push_back(modelJob);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto aabbs = m_World->GetComponents("AABB");
|
auto pointLights = m_World->GetComponents("PointLight");
|
||||||
if (aabbs != nullptr) {
|
if (pointLights != nullptr) {
|
||||||
for (auto& cAABB : *aabbs) {
|
for (auto& cPointLight : *pointLights) {
|
||||||
EntityWrapper entity(m_World, cAABB.EntityID);
|
bool visible = cPointLight["Visible"];
|
||||||
glm::vec3 absPosition = Transform::AbsolutePosition(entity) + (glm::vec3)cAABB["Origin"];
|
if (!visible) {
|
||||||
glm::vec3 absScale = Transform::AbsoluteScale(entity) * (glm::vec3)cAABB["Size"];
|
continue;
|
||||||
glm::mat4 modelMatrix = glm::translate(absPosition) * glm::scale(absScale);
|
}
|
||||||
entity["Model"]["Resource"] = "Models/Core/UnitCube.mesh";
|
|
||||||
enqueueModel(scene, entity, modelMatrix, "Models/Core/UnitCube.mesh", entity["Model"], true);
|
EntityWrapper entity(m_World, cPointLight.EntityID);
|
||||||
|
ComponentWrapper& cTransform = entity["Transform"];
|
||||||
|
std::shared_ptr<PointLightJob> pointLightJob = std::make_shared<PointLightJob>(cTransform, cPointLight, entity.World);
|
||||||
|
scene.Jobs.PointLight.push_back(pointLightJob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,44 +86,12 @@ bool EditorRenderSystem::OnSetCamera(Events::SetCamera& e)
|
|||||||
{
|
{
|
||||||
ComponentWrapper cTransform = e.CameraEntity["Transform"];
|
ComponentWrapper cTransform = e.CameraEntity["Transform"];
|
||||||
ComponentWrapper cCamera = e.CameraEntity["Camera"];
|
ComponentWrapper cCamera = e.CameraEntity["Camera"];
|
||||||
m_Camera->SetFOV(static_cast<float>((double)cCamera["FOV"]));
|
m_EditorCamera->SetFOV(static_cast<float>((double)cCamera["FOV"]));
|
||||||
m_Camera->SetNearClip(static_cast<float>((double)cCamera["NearClip"]));
|
m_EditorCamera->SetNearClip(static_cast<float>((double)cCamera["NearClip"]));
|
||||||
m_Camera->SetFarClip(static_cast<float>((double)cCamera["FarClip"]));
|
m_EditorCamera->SetFarClip(static_cast<float>((double)cCamera["FarClip"]));
|
||||||
m_Camera->SetPosition(cTransform["Position"]);
|
m_EditorCamera->SetPosition(cTransform["Position"]);
|
||||||
m_Camera->SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
|
m_EditorCamera->SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
|
||||||
m_CurrentCamera = e.CameraEntity;
|
m_CurrentCamera = e.CameraEntity;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorRenderSystem::enqueueModel(RenderScene& scene, EntityWrapper entity, const glm::mat4& modelMatrix, const std::string& modelResource, ComponentWrapper cModel, bool wireframe)
|
|
||||||
{
|
|
||||||
Model* model;
|
|
||||||
try {
|
|
||||||
model = ResourceManager::Load<::Model, true>(modelResource);
|
|
||||||
} catch (const Resource::StillLoadingException&) {
|
|
||||||
return;
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
try {
|
|
||||||
model = ResourceManager::Load<::Model>("Models/Core/Error.mesh");
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto matGroup : model->MaterialGroups()) {
|
|
||||||
std::shared_ptr<ModelJob> modelJob = std::shared_ptr<ModelJob>(new ModelJob(
|
|
||||||
model,
|
|
||||||
m_Camera,
|
|
||||||
modelMatrix,
|
|
||||||
matGroup,
|
|
||||||
cModel,
|
|
||||||
m_World,
|
|
||||||
glm::vec4(1.f, 1.f, 1.f, 1.f),
|
|
||||||
0.f,
|
|
||||||
false
|
|
||||||
));
|
|
||||||
modelJob->Wireframe = wireframe;
|
|
||||||
scene.Jobs.OpaqueObjects.push_back(modelJob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "Editor/EditorSystem.h"
|
#include "Editor/EditorSystem.h"
|
||||||
#include "Core/UniformScaleSystem.h"
|
#include "Core/UniformScaleSystem.h"
|
||||||
#include "Editor/EditorWidgetRenderSystem.h"
|
#include "Editor/EditorRenderSystem.h"
|
||||||
#include "Editor/EditorWidgetSystem.h"
|
#include "Editor/EditorWidgetSystem.h"
|
||||||
#include "Core/EntityFile.h"
|
#include "Core/EntityFile.h"
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame
|
|||||||
m_EditorWorldSystemPipeline = new SystemPipeline(m_EditorWorld, m_EventBroker, IsClient, IsServer);
|
m_EditorWorldSystemPipeline = new SystemPipeline(m_EditorWorld, m_EventBroker, IsClient, IsServer);
|
||||||
m_EditorWorldSystemPipeline->AddSystem<UniformScaleSystem>(0);
|
m_EditorWorldSystemPipeline->AddSystem<UniformScaleSystem>(0);
|
||||||
m_EditorWorldSystemPipeline->AddSystem<EditorWidgetSystem>(0, m_Renderer);
|
m_EditorWorldSystemPipeline->AddSystem<EditorWidgetSystem>(0, m_Renderer);
|
||||||
m_EditorWorldSystemPipeline->AddSystem<EditorWidgetRenderSystem>(2, m_Renderer, m_RenderFrame);
|
m_EditorWorldSystemPipeline->AddSystem<EditorRenderSystem>(1, m_Renderer, m_RenderFrame);
|
||||||
|
|
||||||
m_EditorCamera = importEntity(EntityWrapper(m_EditorWorld, EntityID_Invalid), "Schema/Entities/Empty.xml");
|
m_EditorCamera = importEntity(EntityWrapper(m_EditorWorld, EntityID_Invalid), "Schema/Entities/Empty.xml");
|
||||||
m_ActualCamera = m_EditorCamera;
|
m_ActualCamera = m_EditorCamera;
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
#include "Editor/EditorWidgetRenderSystem.h"
|
|
||||||
|
|
||||||
EditorWidgetRenderSystem::EditorWidgetRenderSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
|
|
||||||
: System(params)
|
|
||||||
, m_Renderer(renderer)
|
|
||||||
, m_RenderFrame(renderFrame)
|
|
||||||
{
|
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &EditorWidgetRenderSystem::OnSetCamera);
|
|
||||||
auto resolution = Rectangle::Rectangle(1280, 720);
|
|
||||||
m_EditorCamera = new Camera((float)resolution.Width / resolution.Height, glm::radians(45.f), 0.01f, 5000.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditorWidgetRenderSystem::Update(double dt)
|
|
||||||
{
|
|
||||||
if (m_CurrentCamera.Valid()) {
|
|
||||||
ComponentWrapper cameraTransform = m_CurrentCamera["Transform"];
|
|
||||||
m_EditorCamera->SetPosition(cameraTransform["Position"]);
|
|
||||||
m_EditorCamera->SetOrientation(glm::quat((const glm::vec3&)cameraTransform["Orientation"]));
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderScene scene;
|
|
||||||
scene.ClearDepth = true;
|
|
||||||
scene.Camera = m_EditorCamera;
|
|
||||||
scene.Viewport = Rectangle(1920, 1080);
|
|
||||||
|
|
||||||
auto cSceneLight = m_World->GetComponents("SceneLight");
|
|
||||||
if (cSceneLight != nullptr) {
|
|
||||||
//these are hardcoded since they want special light treatment and a component just for widgets is stupid.
|
|
||||||
scene.AmbientColor = glm::vec4(0.8, 0.8, 0.8, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto models = m_World->GetComponents("Model");
|
|
||||||
if (models != nullptr) {
|
|
||||||
for (auto& cModel : *models) {
|
|
||||||
if (!(bool)cModel["Visible"]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string& resource = cModel["Resource"];
|
|
||||||
|
|
||||||
Model* model;
|
|
||||||
try {
|
|
||||||
model = ResourceManager::Load<::Model, true>(resource);
|
|
||||||
} catch (const Resource::StillLoadingException&) {
|
|
||||||
continue;
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
try {
|
|
||||||
model = ResourceManager::Load<::Model>("Models/Core/Error.mesh");
|
|
||||||
} catch (const std::exception&) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityWrapper entity(m_World, cModel.EntityID);
|
|
||||||
glm::mat4 modelMatrix = Transform::ModelMatrix(entity.ID, entity.World);
|
|
||||||
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);
|
|
||||||
if (cModel["Transparent"]) {
|
|
||||||
scene.Jobs.TransparentObjects.push_back(modelJob);
|
|
||||||
} else {
|
|
||||||
scene.Jobs.OpaqueObjects.push_back(modelJob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto pointLights = m_World->GetComponents("PointLight");
|
|
||||||
if (pointLights != nullptr) {
|
|
||||||
for (auto& cPointLight : *pointLights) {
|
|
||||||
bool visible = cPointLight["Visible"];
|
|
||||||
if (!visible) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityWrapper entity(m_World, cPointLight.EntityID);
|
|
||||||
ComponentWrapper& cTransform = entity["Transform"];
|
|
||||||
std::shared_ptr<PointLightJob> pointLightJob = std::make_shared<PointLightJob>(cTransform, cPointLight, entity.World);
|
|
||||||
scene.Jobs.PointLight.push_back(pointLightJob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_RenderFrame->Add(scene);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EditorWidgetRenderSystem::OnSetCamera(Events::SetCamera& e)
|
|
||||||
{
|
|
||||||
ComponentWrapper cTransform = e.CameraEntity["Transform"];
|
|
||||||
ComponentWrapper cCamera = e.CameraEntity["Camera"];
|
|
||||||
m_EditorCamera->SetFOV(static_cast<float>((double)cCamera["FOV"]));
|
|
||||||
m_EditorCamera->SetNearClip(static_cast<float>((double)cCamera["NearClip"]));
|
|
||||||
m_EditorCamera->SetFarClip(static_cast<float>((double)cCamera["FarClip"]));
|
|
||||||
m_EditorCamera->SetPosition(cTransform["Position"]);
|
|
||||||
m_EditorCamera->SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
|
|
||||||
m_CurrentCamera = e.CameraEntity;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -49,18 +49,24 @@ void Packet::WriteString(const std::string& str)
|
|||||||
// Message, add one extra byte for null terminator
|
// Message, add one extra byte for null terminator
|
||||||
size_t sizeOfString = str.size() + 1;
|
size_t sizeOfString = str.size() + 1;
|
||||||
if (m_Offset + sizeOfString > m_MaxPacketSize) {
|
if (m_Offset + sizeOfString > m_MaxPacketSize) {
|
||||||
//LOG_WARNING("Package::WriteString(): Data size in packet exceeded maximum package size. New size is %i bytes\n", m_MaxPacketSize*2);
|
if (m_MaxPacketSize >= 32000) {
|
||||||
|
LOG_WARNING("Package::WriteString(): New size is huge %i bytes\n", m_MaxPacketSize*2);
|
||||||
|
}
|
||||||
resizeData();
|
resizeData();
|
||||||
}
|
}
|
||||||
memcpy(m_Data + m_Offset, str.data(), sizeOfString * sizeof(char));
|
memcpy(m_Data + m_Offset, str.data(), str.size() * sizeof(char));
|
||||||
m_Offset += sizeOfString * sizeof(char);
|
m_Offset += str.size() * sizeof(char);
|
||||||
|
m_Data[m_Offset] = '\0';
|
||||||
|
m_Offset += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Packet::WriteData(char * data, int sizeOfData)
|
void Packet::WriteData(char * data, int sizeOfData)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_Offset + sizeOfData > m_MaxPacketSize) {
|
if (m_Offset + sizeOfData > m_MaxPacketSize) {
|
||||||
//LOG_WARNING("Packet::WriteData(): Data size in packet exceeded maximum packet size. New size is %i bytes\n", m_MaxPacketSize*2);
|
if (m_MaxPacketSize >= 32000) {
|
||||||
|
LOG_WARNING("Package::WriteData(): New size is huge %i bytes\n", m_MaxPacketSize*2);
|
||||||
|
}
|
||||||
while (m_Offset + sizeOfData > m_MaxPacketSize) {
|
while (m_Offset + sizeOfData > m_MaxPacketSize) {
|
||||||
resizeData();
|
resizeData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,10 @@ size_t TCPClient::readBuffer()
|
|||||||
boost::asio::ip::tcp::socket::message_peek, error);
|
boost::asio::ip::tcp::socket::message_peek, error);
|
||||||
unsigned int sizeOfPacket = 0;
|
unsigned int sizeOfPacket = 0;
|
||||||
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
||||||
|
if (sizeOfPacket > m_Socket->available()) {
|
||||||
|
LOG_WARNING("TCPClient::readBuffer(): We haven't got the whole packet yet.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
// if the buffer is to small increase the size of it
|
// if the buffer is to small increase the size of it
|
||||||
// TODO if message is huge 1 time the buffer will not decrease.
|
// TODO if message is huge 1 time the buffer will not decrease.
|
||||||
if (sizeOfPacket > m_BufferSize) {
|
if (sizeOfPacket > m_BufferSize) {
|
||||||
|
|||||||
@@ -106,7 +106,10 @@ int TCPServer::readBuffer(PlayerDefinition & playerDefinition)
|
|||||||
boost::asio::ip::tcp::socket::message_peek, error);
|
boost::asio::ip::tcp::socket::message_peek, error);
|
||||||
unsigned int sizeOfPacket = 0;
|
unsigned int sizeOfPacket = 0;
|
||||||
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
||||||
|
if (sizeOfPacket > playerDefinition.TCPSocket->available()) {
|
||||||
|
LOG_WARNING("TCPServer::readBuffer(): We haven't got the whole packet yet.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
// if the buffer is to small increase the size of it
|
// if the buffer is to small increase the size of it
|
||||||
if (sizeOfPacket > m_BufferSize) {
|
if (sizeOfPacket > m_BufferSize) {
|
||||||
delete[] m_ReadBuffer;
|
delete[] m_ReadBuffer;
|
||||||
|
|||||||
@@ -45,7 +45,10 @@ int UDPClient::readBuffer()
|
|||||||
boost::asio::ip::udp::socket::message_peek, error);
|
boost::asio::ip::udp::socket::message_peek, error);
|
||||||
int sizeOfPacket = 0;
|
int sizeOfPacket = 0;
|
||||||
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
||||||
|
if (sizeOfPacket > m_Socket->available()) {
|
||||||
|
LOG_WARNING("UDPClient::readBuffer(): We haven't got the whole packet yet.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
// if the buffer is to small increase the size of it
|
// if the buffer is to small increase the size of it
|
||||||
if (sizeOfPacket > m_BufferSize) {
|
if (sizeOfPacket > m_BufferSize) {
|
||||||
delete[] m_ReadBuffer;
|
delete[] m_ReadBuffer;
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ int UDPServer::readBuffer()
|
|||||||
unsigned int sizeOfPacket = 0;
|
unsigned int sizeOfPacket = 0;
|
||||||
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
memcpy(&sizeOfPacket, m_ReadBuffer, sizeof(int));
|
||||||
|
|
||||||
|
if (sizeOfPacket > m_Socket->available()) {
|
||||||
|
LOG_WARNING("UDPServer::readBuffer(): We haven't got the whole packet yet.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// if the buffer is to small increase the size of it
|
// if the buffer is to small increase the size of it
|
||||||
if (sizeOfPacket > m_BufferSize) {
|
if (sizeOfPacket > m_BufferSize) {
|
||||||
delete[] m_ReadBuffer;
|
delete[] m_ReadBuffer;
|
||||||
|
|||||||
@@ -429,12 +429,6 @@ void DrawFinalPass::DrawModelRenderQueues(std::list<std::shared_ptr<RenderJob>>&
|
|||||||
if (modelJob) {
|
if (modelJob) {
|
||||||
//bind forward program
|
//bind forward program
|
||||||
//TODO: JOHAN/TOBIAS: Bind shader based on ModelJob->ShaderID;
|
//TODO: JOHAN/TOBIAS: Bind shader based on ModelJob->ShaderID;
|
||||||
RenderState jobState;
|
|
||||||
if (modelJob->Wireframe) {
|
|
||||||
jobState.Disable(GL_CULL_FACE);
|
|
||||||
jobState.PolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (modelJob->Type) {
|
switch (modelJob->Type) {
|
||||||
case RawModel::MaterialType::Basic:
|
case RawModel::MaterialType::Basic:
|
||||||
case RawModel::MaterialType::SingleTextures:
|
case RawModel::MaterialType::SingleTextures:
|
||||||
|
|||||||
@@ -155,20 +155,6 @@ bool RenderState::AlphaFunc(GLenum func, GLclampf thresholder)
|
|||||||
return !GLERROR("AlphaFunc");
|
return !GLERROR("AlphaFunc");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderState::PolygonMode(GLenum face, GLenum mode)
|
|
||||||
{
|
|
||||||
GLint originalMode[2];
|
|
||||||
glGetIntegerv(GL_POLYGON_MODE, &originalMode[0]);
|
|
||||||
if (face == GL_FRONT || face == GL_FRONT_AND_BACK) {
|
|
||||||
m_ResetFunctions.push_back(std::bind(glPolygonMode, GL_FRONT, originalMode[0]));
|
|
||||||
}
|
|
||||||
if (face == GL_BACK || face == GL_FRONT_AND_BACK) {
|
|
||||||
m_ResetFunctions.push_back(std::bind(glPolygonMode, GL_BACK, originalMode[1]));
|
|
||||||
}
|
|
||||||
glPolygonMode(face, mode);
|
|
||||||
return !GLERROR("RenderState::PolygonMode");
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderState::~RenderState()
|
RenderState::~RenderState()
|
||||||
{
|
{
|
||||||
for (auto& f : boost::adaptors::reverse(m_ResetFunctions)) {
|
for (auto& f : boost::adaptors::reverse(m_ResetFunctions)) {
|
||||||
|
|||||||
+4
-2
@@ -4,7 +4,6 @@
|
|||||||
#include "Collision/EntityAABB.h"
|
#include "Collision/EntityAABB.h"
|
||||||
#include "Collision/TriggerSystem.h"
|
#include "Collision/TriggerSystem.h"
|
||||||
#include "Collision/CollisionSystem.h"
|
#include "Collision/CollisionSystem.h"
|
||||||
#include "Editor/EditorRenderSystem.h"
|
|
||||||
#include "Systems/RaptorCopterSystem.h"
|
#include "Systems/RaptorCopterSystem.h"
|
||||||
#include "Systems/HealthSystem.h"
|
#include "Systems/HealthSystem.h"
|
||||||
#include "Systems/PlayerMovementSystem.h"
|
#include "Systems/PlayerMovementSystem.h"
|
||||||
@@ -28,9 +27,11 @@
|
|||||||
#include "Rendering/AnimationSystem.h"
|
#include "Rendering/AnimationSystem.h"
|
||||||
#include "Network/MultiplayerSnapshotFilter.h"
|
#include "Network/MultiplayerSnapshotFilter.h"
|
||||||
#include "Game/Systems/AmmunitionHUDSystem.h"
|
#include "Game/Systems/AmmunitionHUDSystem.h"
|
||||||
|
#include "Game/Systems/AbilityCooldownHUDSystem.h"
|
||||||
#include "Game/Systems/CapturePointArrowHUDSystem.h"
|
#include "Game/Systems/CapturePointArrowHUDSystem.h"
|
||||||
#include "Game/Systems/KillFeedSystem.h"
|
#include "Game/Systems/KillFeedSystem.h"
|
||||||
#include "Game/Systems/BoostSystem.h"
|
#include "Game/Systems/BoostSystem.h"
|
||||||
|
#include "Game/Systems/BoostIconsHUDSystem.h"
|
||||||
#include "GUI/ButtonSystem.h"
|
#include "GUI/ButtonSystem.h"
|
||||||
#include "GUI/MainMenuSystem.h"
|
#include "GUI/MainMenuSystem.h"
|
||||||
|
|
||||||
@@ -135,6 +136,7 @@ Game::Game(int argc, char* argv[])
|
|||||||
m_SystemPipeline->AddSystem<AmmoPickupSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<AmmoPickupSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<DamageIndicatorSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<AmmunitionHUDSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<AmmunitionHUDSystem>(updateOrderLevel);
|
||||||
|
m_SystemPipeline->AddSystem<AbilityCooldownHUDSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<CapturePointArrowHUDSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<CapturePointArrowHUDSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<KillFeedSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<LifetimeSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<LifetimeSystem>(updateOrderLevel);
|
||||||
@@ -148,6 +150,7 @@ Game::Game(int argc, char* argv[])
|
|||||||
m_SystemPipeline->AddSystem<BoostSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<BoostSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<ButtonSystem>(updateOrderLevel, m_Renderer);
|
m_SystemPipeline->AddSystem<ButtonSystem>(updateOrderLevel, m_Renderer);
|
||||||
m_SystemPipeline->AddSystem<MainMenuSystem>(updateOrderLevel, m_Renderer);
|
m_SystemPipeline->AddSystem<MainMenuSystem>(updateOrderLevel, m_Renderer);
|
||||||
|
m_SystemPipeline->AddSystem<BoostIconsHUDSystem>(updateOrderLevel);
|
||||||
// Populate Octree with collidables
|
// Populate Octree with collidables
|
||||||
++updateOrderLevel;
|
++updateOrderLevel;
|
||||||
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
||||||
@@ -165,7 +168,6 @@ Game::Game(int argc, char* argv[])
|
|||||||
++updateOrderLevel;
|
++updateOrderLevel;
|
||||||
m_SystemPipeline->AddSystem<FillFrustumOctreeSystem>(updateOrderLevel, m_OctreeFrustrumCulling);
|
m_SystemPipeline->AddSystem<FillFrustumOctreeSystem>(updateOrderLevel, m_OctreeFrustrumCulling);
|
||||||
++updateOrderLevel;
|
++updateOrderLevel;
|
||||||
m_SystemPipeline->AddSystem<EditorRenderSystem>(updateOrderLevel, m_Renderer, m_RenderFrame);
|
|
||||||
m_SystemPipeline->AddSystem<RenderSystem>(updateOrderLevel, m_Renderer, m_RenderFrame, m_OctreeFrustrumCulling);
|
m_SystemPipeline->AddSystem<RenderSystem>(updateOrderLevel, m_Renderer, m_RenderFrame, m_OctreeFrustrumCulling);
|
||||||
++updateOrderLevel;
|
++updateOrderLevel;
|
||||||
m_SystemPipeline->AddSystem<EditorSystem>(updateOrderLevel, m_Renderer, m_RenderFrame);
|
m_SystemPipeline->AddSystem<EditorSystem>(updateOrderLevel, m_Renderer, m_RenderFrame);
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#include "Game/Systems/AbilityCooldownHUDSystem.h"
|
||||||
|
|
||||||
|
void AbilityCooldownHUDSystem::Update(double dt)
|
||||||
|
{
|
||||||
|
//HUD element for tracking cooldown on the parent entity with Dashability TODO: Make sure it support other abilities when they are made.
|
||||||
|
|
||||||
|
auto abilityHUDs = m_World->GetComponents("AbilityCooldownHUD");
|
||||||
|
if (abilityHUDs == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (auto& abilityHUDC : *abilityHUDs) {
|
||||||
|
EntityWrapper entity = EntityWrapper(m_World, abilityHUDC.EntityID);
|
||||||
|
EntityWrapper abilityEntity = entity.FirstParentWithComponent("DashAbility");
|
||||||
|
if (!abilityEntity.Valid())
|
||||||
|
return;
|
||||||
|
EntityWrapper cooldownTextEntity = entity.FirstChildByName("Cooldown");
|
||||||
|
if(cooldownTextEntity.Valid()) {
|
||||||
|
if(cooldownTextEntity.HasComponent("Text"))
|
||||||
|
{
|
||||||
|
double maxAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownMaxTimer"];
|
||||||
|
double currentAbilityCD = (double)abilityEntity["DashAbility"]["CoolDownTimer"];
|
||||||
|
currentAbilityCD = currentAbilityCD >= 0.0 ? currentAbilityCD : 0.0;
|
||||||
|
std::string t = (std::string&)cooldownTextEntity["Text"]["Content"] = std::to_string(currentAbilityCD).substr(0, 3);
|
||||||
|
if(entity.HasComponent("Fill")) {
|
||||||
|
entity["Fill"]["Percentage"] = currentAbilityCD/maxAbilityCD; //TODO: current time needs to be in the component.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#include "Game/Systems/BoostIconsHUDSystem.h"
|
||||||
|
|
||||||
|
void BoostIconsHUDSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt)
|
||||||
|
{
|
||||||
|
EntityWrapper assaultEntity = entity.FirstChildByName("Assault");
|
||||||
|
EntityWrapper defenderEntity = entity.FirstChildByName("Defender");
|
||||||
|
EntityWrapper sniperEntity = entity.FirstChildByName("Sniper");
|
||||||
|
|
||||||
|
if(assaultEntity.Valid()) {
|
||||||
|
if (assaultEntity.HasComponent("Fill")) {
|
||||||
|
EntityWrapper parentWithAssaultBoost = assaultEntity.FirstParentWithComponent("BoostAssault");
|
||||||
|
if (parentWithAssaultBoost.Valid()) {
|
||||||
|
(double&)assaultEntity["Fill"]["Percentage"] = 1.0;
|
||||||
|
} else {
|
||||||
|
(double&)assaultEntity["Fill"]["Percentage"] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defenderEntity.Valid()) {
|
||||||
|
if (defenderEntity.HasComponent("Fill")) {
|
||||||
|
EntityWrapper parentWithAssaultBoost = defenderEntity.FirstParentWithComponent("BoostDefender");
|
||||||
|
if (parentWithAssaultBoost.Valid()) {
|
||||||
|
(double&)defenderEntity["Fill"]["Percentage"] = 1.0;
|
||||||
|
} else {
|
||||||
|
(double&)defenderEntity["Fill"]["Percentage"] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sniperEntity.Valid()) {
|
||||||
|
if (sniperEntity.HasComponent("Fill")) {
|
||||||
|
EntityWrapper parentWithAssaultBoost = sniperEntity.FirstParentWithComponent("BoostSniper");
|
||||||
|
if (parentWithAssaultBoost.Valid()) {
|
||||||
|
(double&)sniperEntity["Fill"]["Percentage"] = 1.0;
|
||||||
|
} else {
|
||||||
|
(double&)sniperEntity["Fill"]["Percentage"] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -18,14 +18,9 @@ PlayerMovementSystem::~PlayerMovementSystem()
|
|||||||
void PlayerMovementSystem::Update(double dt)
|
void PlayerMovementSystem::Update(double dt)
|
||||||
{
|
{
|
||||||
updateMovementControllers(dt);
|
updateMovementControllers(dt);
|
||||||
if (IsServer) {
|
// Only do physics calculations on client and only for themselves.
|
||||||
for (auto& kv : m_PlayerInputControllers) {
|
if (IsClient && LocalPlayer.Valid()) {
|
||||||
updateVelocity(kv.first, dt);
|
updateVelocity(LocalPlayer, dt);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (LocalPlayer.Valid()) {
|
|
||||||
updateVelocity(LocalPlayer, dt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void DefenderWeaponBehaviour::dealDamage(WeaponInfo& wi, glm::vec3 direction, do
|
|||||||
if (!wi.Player.Valid()) {
|
if (!wi.Player.Valid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 maxRange = direction * 2.f;
|
glm::vec3 maxRange = direction * 2.f;
|
||||||
EntityWrapper camera = wi.Player.FirstChildByName("Camera");
|
EntityWrapper camera = wi.Player.FirstChildByName("Camera");
|
||||||
glm::vec3 cameraPosition = Transform::AbsolutePosition(camera);
|
glm::vec3 cameraPosition = Transform::AbsolutePosition(camera);
|
||||||
@@ -147,8 +147,9 @@ void DefenderWeaponBehaviour::dealDamage(WeaponInfo& wi, glm::vec3 direction, do
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for friendly fire
|
// Check for friendly fire
|
||||||
|
//this needs to not return, for the boosts. in all weaponclasses: assault,defender,sniper
|
||||||
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) {
|
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) {
|
||||||
return;
|
damage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deal damage!
|
// Deal damage!
|
||||||
@@ -177,11 +178,11 @@ Camera DefenderWeaponBehaviour::cameraFromEntity(EntityWrapper camera)
|
|||||||
ComponentWrapper cTransform = camera["Transform"];
|
ComponentWrapper cTransform = camera["Transform"];
|
||||||
ComponentWrapper cCamera = camera["Camera"];
|
ComponentWrapper cCamera = camera["Camera"];
|
||||||
Camera cam(
|
Camera cam(
|
||||||
(float)m_Renderer->Resolution().Width / m_Renderer->Resolution().Height,
|
(float)m_Renderer->Resolution().Width / m_Renderer->Resolution().Height,
|
||||||
(double)cCamera["FOV"],
|
(double)cCamera["FOV"],
|
||||||
(double)cCamera["NearClip"],
|
(double)cCamera["NearClip"],
|
||||||
(double)cCamera["FarClip"]
|
(double)cCamera["FarClip"]
|
||||||
);
|
);
|
||||||
cam.SetPosition(cTransform["Position"]);
|
cam.SetPosition(cTransform["Position"]);
|
||||||
cam.SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
|
cam.SetOrientation(glm::quat((const glm::vec3&)cTransform["Orientation"]));
|
||||||
return cam;
|
return cam;
|
||||||
|
|||||||
Reference in New Issue
Block a user