Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f147929aa9 | |||
| c60e1ba7e4 | |||
| 63d205f56a | |||
| 36f6ade87a | |||
| 724d7b1586 | |||
| 8cda614de4 | |||
| 77eaa45702 | |||
| dfa224b4dd | |||
| 86df8f14f4 | |||
| eaea645068 | |||
| 21bf7f4df3 | |||
| e2b7e5400d | |||
| 658eace093 | |||
| c106768939 | |||
| c7dad79e72 | |||
| d37f8cc350 | |||
| 3c35c0a956 | |||
| d47a806c64 | |||
| 8e21c5a5e4 | |||
| db5170c699 | |||
| cd315bbaa0 |
@@ -27,7 +27,7 @@ public:
|
||||
virtual bool OnCommand(const Events::InputCommand& e) override;
|
||||
virtual void Reset();
|
||||
|
||||
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer);
|
||||
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer);
|
||||
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
|
||||
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
|
||||
|
||||
@@ -41,7 +41,6 @@ protected:
|
||||
bool m_Crouching = false;
|
||||
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
|
||||
double m_AssaultDashDoubleTapDeltaTime = 0.0;
|
||||
double m_AssaultDashCoolDownTimer = 0.0;
|
||||
//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
|
||||
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
|
||||
@@ -191,21 +190,21 @@ bool FirstPersonInputController<EventContext>::OnLockMouse(const Events::LockMou
|
||||
}
|
||||
|
||||
template <typename EventContext>
|
||||
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer) {
|
||||
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer) {
|
||||
m_AssaultDashDoubleTapDeltaTime += dt;
|
||||
m_AssaultDashCoolDownTimer -= dt;
|
||||
assaultDashCoolDownTimer -= dt;
|
||||
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
|
||||
if (m_AssaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
|
||||
if (assaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
|
||||
m_PlayerIsDashing = true;
|
||||
} else {
|
||||
m_PlayerIsDashing = false;
|
||||
}
|
||||
|
||||
//dashing with shift
|
||||
if (m_ShiftDashing && m_AssaultDashCoolDownTimer <= 0.0f) {
|
||||
if (m_ShiftDashing && assaultDashCoolDownTimer <= 0.0f) {
|
||||
//player is dashing with shift
|
||||
//the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
|
||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||
m_AssaultDashDoubleTapped = true;
|
||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||
return;
|
||||
@@ -227,7 +226,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
||||
}
|
||||
m_ValidDoubleTap = false;
|
||||
|
||||
if (!(m_AssaultDashCoolDownTimer <= 0.0f)) {
|
||||
if (!(assaultDashCoolDownTimer <= 0.0f)) {
|
||||
//if we cant dash at the moment, then just reset the tap-sensitivity-timer
|
||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||
return;
|
||||
@@ -235,7 +234,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
||||
//ok, we have a valid tap, lets do it
|
||||
m_AssaultDashDoubleTapped = true;
|
||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||
|
||||
Events::DashAbility e;
|
||||
m_EventBroker->Publish(e);
|
||||
|
||||
@@ -41,8 +41,6 @@ private:
|
||||
void DrawShieldedModelRenderQueue(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 BindModelUniforms(GLuint shaderHandle, std::shared_ptr<ModelJob>& job, RenderScene& scene);
|
||||
|
||||
@@ -55,9 +53,6 @@ private:
|
||||
Texture* m_GreyTexture;
|
||||
Texture* m_ErrorTexture;
|
||||
|
||||
Model* m_ScreenQuad;
|
||||
|
||||
FrameBuffer m_MergeFrameBuffer;
|
||||
FrameBuffer m_FinalPassFrameBuffer;
|
||||
FrameBuffer m_FinalPassFrameBufferLowRes;
|
||||
GLuint m_BloomTexture;
|
||||
@@ -76,8 +71,6 @@ private:
|
||||
const CubeMapPass* m_CubeMapPass;
|
||||
const SSAOPass* m_SSAOPass;
|
||||
|
||||
ShaderProgram* m_MergeProgram;
|
||||
|
||||
ShaderProgram* m_ForwardPlusProgram;
|
||||
ShaderProgram* m_ExplosionEffectProgram;
|
||||
ShaderProgram* m_ExplosionEffectSplatMapProgram;
|
||||
|
||||
@@ -13,8 +13,6 @@ public:
|
||||
PlayerSpawnSystem(SystemParams params);
|
||||
|
||||
virtual void Update(double dt) override;
|
||||
|
||||
static void SetRespawnTime(float respawnTime) { m_RespawnTime = respawnTime; };
|
||||
|
||||
private:
|
||||
struct SpawnRequest
|
||||
@@ -31,8 +29,8 @@ private:
|
||||
//EntityWrapper ID -> Player ID.
|
||||
std::map<EntityID, int> m_PlayerIDs;
|
||||
|
||||
static float m_RespawnTime;
|
||||
float m_Timer;
|
||||
float m_ForcedRespawnTime;
|
||||
bool m_DbgConfigForceRespawn;
|
||||
|
||||
EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand;
|
||||
bool OnInputCommand(Events::InputCommand& e);
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
<xs:include schemaLocation="Components/Page.xsd"/>
|
||||
<xs:include schemaLocation="Components/SpriteIndicator.xsd"/>
|
||||
<xs:include schemaLocation="Components/Button.xsd"/>
|
||||
<xs:include schemaLocation="Components/DoubleJump.xsd"/>
|
||||
<xs:include schemaLocation="Components/WeaponAttachment.xsd"/>
|
||||
<xs:include schemaLocation="Components/DefenderWeapon.xsd"/>
|
||||
<xs:include schemaLocation="Components/CapturePointGameMode.xsd"/>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<DashAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DashAbility.xsd">
|
||||
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
|
||||
<CoolDownTimer>0.0</CoolDownTimer>
|
||||
</DashAbility>
|
||||
@@ -10,7 +10,10 @@
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>This is the cooldown on dash</xs:documentation></xs:annotation>
|
||||
<xs:annotation><xs:documentation>This is the max 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:all>
|
||||
</xs:complexType>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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>
|
||||
@@ -2,6 +2,7 @@
|
||||
<Player xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Player.xsd">
|
||||
<MovementSpeed>3</MovementSpeed>
|
||||
<CrouchSpeed>1.5</CrouchSpeed>
|
||||
<JumpSpeed>4.0</JumpSpeed>
|
||||
<CurrentWishDirection X="0" Y="0" Z="0"/>
|
||||
<CurrentWeapon></CurrentWeapon>
|
||||
</Player>
|
||||
@@ -11,6 +11,9 @@
|
||||
<xs:all>
|
||||
<xs:element name="MovementSpeed" 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="CurrentWeapon" type="t:string" minOccurs="0"/>
|
||||
</xs:all>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<c:DefenderWeapon>
|
||||
<TimeSinceLastFire>1.6944730461160304</TimeSinceLastFire>
|
||||
</c:DefenderWeapon>
|
||||
<c:DoubleJump/>
|
||||
<c:Health/>
|
||||
<c:Physics>
|
||||
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||
|
||||
Executable → Regular
+1
@@ -15,6 +15,7 @@
|
||||
<c:DefenderWeapon>
|
||||
<TimeSinceLastFire>1.6944730461160304</TimeSinceLastFire>
|
||||
</c:DefenderWeapon>
|
||||
<c:DoubleJump/>
|
||||
<c:Health/>
|
||||
<c:Physics>
|
||||
<Velocity X="2.30999646e-23" Y="0" Z="1.05272533e-23"/>
|
||||
|
||||
@@ -171,7 +171,8 @@ void main()
|
||||
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;
|
||||
color_result = color_result * clamp(1/specularTexel, 0, 1)*2 + reflectionColor * clamp(specularTexel, 0, 1)/2;
|
||||
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;
|
||||
|
||||
|
||||
@@ -182,9 +183,9 @@ void main()
|
||||
}
|
||||
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
|
||||
//sceneColor = vec4(reflectionColor.xyz, 1);
|
||||
color_result += glowTexel*GlowIntensity;
|
||||
color_result.xyz += glowTexel.xyz*GlowIntensity;
|
||||
|
||||
bloomColor = vec4(clamp(color_result.xyz - 1.0, 0, 100), clamp(color_result.a, 0, 1));
|
||||
bloomColor = vec4(max(color_result.xyz - 1.0, 0.0), clamp(color_result.a, 0, 1));
|
||||
|
||||
//Tiled Debug Code
|
||||
/*
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
||||
if (!boundingBox) {
|
||||
return;
|
||||
}
|
||||
|
||||
ComponentWrapper& cTransform = entity["Transform"];
|
||||
EntityAABB& boxA = *boundingBox;
|
||||
bool everHitTheGround = false;
|
||||
@@ -86,10 +87,12 @@ void CollisionSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
|
||||
glm::mat4 modelMatrix = Transform::ModelMatrix(boxB.Entity);
|
||||
|
||||
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"];
|
||||
float verticalStepHeight = (float)(double)cPhysics["VerticalStepHeight"];
|
||||
if (Collision::AABBvsTriangles(boxA, model->Vertices(), model->m_Indices, modelMatrix, inOutVelocity, verticalStepHeight, isOnGround, resolutionVector)) {
|
||||
(glm::vec3&)cTransform["Position"] += 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) {
|
||||
|
||||
@@ -580,6 +580,11 @@ void EditorGUI::createWidgetToolButton(WidgetMode mode)
|
||||
|
||||
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 (m_CurrentSelection.Valid()) {
|
||||
EntityWrapper baseParent = m_CurrentSelection;
|
||||
|
||||
@@ -11,7 +11,6 @@ DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCulling
|
||||
InitializeTextures();
|
||||
InitializeShaderPrograms();
|
||||
InitializeFrameBuffers();
|
||||
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
|
||||
}
|
||||
|
||||
void DrawFinalPass::InitializeTextures()
|
||||
@@ -37,34 +36,24 @@ void DrawFinalPass::InitializeFrameBuffers()
|
||||
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_BloomTexture, GL_COLOR_ATTACHMENT1)));
|
||||
m_FinalPassFrameBuffer.Generate();
|
||||
GLERROR("FBO generation");
|
||||
|
||||
/* glGenRenderbuffers(1, &m_DepthBufferLowRes);
|
||||
|
||||
glGenRenderbuffers(1, &m_DepthBufferLowRes);
|
||||
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));
|
||||
GLERROR("RenderBufferLowRes generation");*/
|
||||
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 RenderBuffer(&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()
|
||||
@@ -179,15 +168,6 @@ void DrawFinalPass::InitializeShaderPrograms()
|
||||
m_FillDepthBufferSkinnedProgram->Compile();
|
||||
m_FillDepthBufferSkinnedProgram->Link();
|
||||
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_MergeProgram->BindFragDataLocation(0, "sceneColor");
|
||||
m_MergeProgram->BindFragDataLocation(1, "bloomColor");
|
||||
m_MergeProgram->Link();
|
||||
GLERROR("Creating merge program");
|
||||
}
|
||||
|
||||
void DrawFinalPass::Draw(RenderScene& scene)
|
||||
@@ -199,39 +179,40 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
||||
state->Disable(GL_DEPTH_TEST);
|
||||
}
|
||||
//TODO: Do we need check for this or will it be per scene always?
|
||||
state->Enable(GL_STENCIL_TEST);
|
||||
glClearStencil(0x00);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
//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->StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
state->StencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
state->StencilMask(0xFF);
|
||||
DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
|
||||
GLERROR("StencilPass");
|
||||
|
||||
//Fill depth buffer
|
||||
|
||||
state->StencilMask(0x00);
|
||||
DrawModelRenderQueues(scene.Jobs.OpaqueObjects, scene);
|
||||
GLERROR("OpaqueObjects");
|
||||
//state->BlendFunc(GL_ONE, GL_ONE);
|
||||
state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
//state->BlendFunc(GL_ONE, GL_ONE);
|
||||
//DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
|
||||
//GLERROR("TransparentObjects");
|
||||
//state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
DrawModelRenderQueues(scene.Jobs.TransparentObjects, scene);
|
||||
GLERROR("TransparentObjects");
|
||||
//state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
DrawSprites(scene.Jobs.SpriteJob, scene);
|
||||
GLERROR("SpriteJobs");
|
||||
|
||||
////Draw Transparen Shielded objects
|
||||
//DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
|
||||
//GLERROR("Shielded Transparent objects");
|
||||
//DrawStencilState* stencilState = new DrawStencilState(m_FinalPassFrameBuffer.GetHandle());
|
||||
//Draw shields to stencil pass
|
||||
state->StencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
state->StencilMask(0xFF);
|
||||
DrawShieldToStencilBuffer(scene.Jobs.ShieldObjects, scene);
|
||||
GLERROR("StencilPass");
|
||||
|
||||
// state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
// DrawSprites(scene.Jobs.SpriteJob, scene);
|
||||
// GLERROR("SpriteJobs");
|
||||
//Draw Opaque shielded objects
|
||||
state->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
||||
state->StencilMask(0x00);
|
||||
DrawModelRenderQueues(scene.Jobs.OpaqueShieldedObjects, scene); //might need changing
|
||||
GLERROR("Shielded Opaque object");
|
||||
|
||||
//Draw Transparen Shielded objects
|
||||
DrawModelRenderQueues(scene.Jobs.TransparentShieldedObjects, scene); //might need changing
|
||||
GLERROR("Shielded Transparent objects");
|
||||
|
||||
GLERROR("END");
|
||||
delete state;
|
||||
@@ -241,11 +222,6 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
||||
//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);
|
||||
@@ -257,20 +233,18 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
||||
stateLowRes->StencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
stateLowRes->StencilMask(0x00);
|
||||
DrawToDepthBuffer(scene.Jobs.OpaqueObjects, scene);
|
||||
//DrawToDepthBuffer(scene.Jobs.TransparentObjects, scene);
|
||||
DrawToDepthBuffer(scene.Jobs.TransparentObjects, scene);
|
||||
|
||||
//Draw shields to stencil pass
|
||||
stateLowRes->StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
||||
stateLowRes->StencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||
stateLowRes->StencilMask(0xFF);
|
||||
stateLowRes->DepthMask(GL_FALSE);
|
||||
stateLowRes->Enable(GL_DEPTH_TEST);
|
||||
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);
|
||||
@@ -280,34 +254,6 @@ void DrawFinalPass::Draw(RenderScene& scene)
|
||||
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");
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
|
||||
@@ -774,28 +720,6 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
|
||||
// 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)
|
||||
{
|
||||
glUniform1i(glGetUniformLocation(shaderHandle, "SSAOQuality"), m_SSAOPass->TextureQuality());
|
||||
|
||||
@@ -11,10 +11,10 @@ DrawFinalPassState::DrawFinalPassState(GLuint frameBuffer)
|
||||
DepthMask(GL_FALSE);
|
||||
DepthFunc(GL_LEQUAL);
|
||||
Enable(GL_CULL_FACE);
|
||||
//Enable(GL_STENCIL_TEST);
|
||||
//StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
||||
//StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
//StencilMask(0xFF);
|
||||
Enable(GL_STENCIL_TEST);
|
||||
StencilFunc(GL_NOTEQUAL, 1, 0xFF);
|
||||
StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
StencilMask(0xFF);
|
||||
ClearColor(glm::vec4(0.f, 0.f, 0.f, 0.f));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ PickingPassState::PickingPassState(GLuint frameBuffer)
|
||||
Enable(GL_DEPTH_TEST);
|
||||
Enable(GL_CULL_FACE);
|
||||
Disable(GL_BLEND);
|
||||
|
||||
glm::vec4 clearColor = glm::vec4(0.f);
|
||||
//ClearColor(clearColor);
|
||||
//Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
+3
-2
@@ -48,7 +48,6 @@ Game::Game(int argc, char* argv[])
|
||||
ResourceManager::UseThreading = m_Config->Get<bool>("Multithreading.ResourceLoading", true);
|
||||
DisableMemoryPool::Value = m_Config->Get<bool>("Debug.DisableMemoryPool", false);
|
||||
LOG_LEVEL = static_cast<_LOG_LEVEL>(m_Config->Get<int>("Debug.LogLevel", 1));
|
||||
PlayerSpawnSystem::SetRespawnTime(m_Config->Get<float>("Debug.RespawnTime", 15.0f));
|
||||
|
||||
// Create the core event broker
|
||||
m_EventBroker = new EventBroker();
|
||||
@@ -139,7 +138,6 @@ Game::Game(int argc, char* argv[])
|
||||
++updateOrderLevel;
|
||||
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
|
||||
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeTrigger, "Player");
|
||||
m_SystemPipeline->AddSystem<FillFrustumOctreeSystem>(updateOrderLevel, m_OctreeFrustrumCulling);
|
||||
m_SystemPipeline->AddSystem<AnimationSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<UniformScaleSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<HealthHUDSystem>(updateOrderLevel);
|
||||
@@ -149,6 +147,9 @@ Game::Game(int argc, char* argv[])
|
||||
m_SystemPipeline->AddSystem<BoneAttachmentSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<CollisionSystem>(updateOrderLevel, m_OctreeCollision);
|
||||
m_SystemPipeline->AddSystem<TriggerSystem>(updateOrderLevel, m_OctreeTrigger);
|
||||
// Octree for frustum culling must be updated after collisions, otherwise players frustum may be moved after tree is filled, and wrong things are culled.
|
||||
++updateOrderLevel;
|
||||
m_SystemPipeline->AddSystem<FillFrustumOctreeSystem>(updateOrderLevel, m_OctreeFrustrumCulling);
|
||||
++updateOrderLevel;
|
||||
m_SystemPipeline->AddSystem<RenderSystem>(updateOrderLevel, m_Renderer, m_RenderFrame, m_OctreeFrustrumCulling);
|
||||
++updateOrderLevel;
|
||||
|
||||
@@ -48,7 +48,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
||||
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
|
||||
if (playerModel.Valid()) {
|
||||
ComponentWrapper cAnimationOffset = playerModel["AnimationOffset"];
|
||||
float pitch = cameraOrientation.x + 0.2;
|
||||
float pitch = cameraOrientation.x + 0.2f;
|
||||
double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
|
||||
cAnimationOffset["Time"] = time;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
||||
ComponentWrapper cPhysics = player["Physics"];
|
||||
//Assault Dash Check
|
||||
if (player.HasComponent("DashAbility")) {
|
||||
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"]);
|
||||
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"], player["DashAbility"]["CoolDownTimer"]);
|
||||
}
|
||||
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
|
||||
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
|
||||
@@ -116,12 +116,18 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
||||
ImGui::Text("velocity: (%f, %f, %f) |%f|", velocity.x, velocity.y, velocity.z, glm::length(velocity));
|
||||
}
|
||||
|
||||
//you cant jump and dash at the same time - since there is no friction in the air and we would thus dash much further in the air
|
||||
if (!controller->PlayerIsDashing() && controller->Jumping() && !controller->Crouching() && (isOnGround || !controller->DoubleJumping())) {
|
||||
(bool)cPhysics["IsOnGround"] = false;
|
||||
if (isOnGround) {
|
||||
controller->SetDoubleJumping(false);
|
||||
}
|
||||
//If player presses Jump and is not crouching.
|
||||
if (controller->Jumping() && !controller->Crouching()) {
|
||||
if (isOnGround) {
|
||||
controller->SetDoubleJumping(false);
|
||||
} else {
|
||||
(bool)cPhysics["IsOnGround"] = false;
|
||||
velocity.y = player["Player"]["JumpSpeed"];
|
||||
} else if (player.HasComponent("DoubleJump") && !controller->DoubleJumping()) {
|
||||
//Enter here if player can double jump and is doing so.
|
||||
(bool)cPhysics["IsOnGround"] = false;
|
||||
velocity.y = player["DoubleJump"]["DoubleJumpSpeed"];
|
||||
// If IsServer and network is off this will not work
|
||||
if (IsClient) {
|
||||
//put a hexagon at the players feet
|
||||
@@ -133,7 +139,6 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
||||
m_EventBroker->Publish(e);
|
||||
}
|
||||
}
|
||||
velocity.y = 4.f;
|
||||
}
|
||||
|
||||
if (player.HasComponent("AABB")) {
|
||||
@@ -306,6 +311,7 @@ bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e)
|
||||
return false;
|
||||
}
|
||||
spawnHexagon(EntityWrapper(m_World, e.entityID));
|
||||
return true;
|
||||
}
|
||||
|
||||
void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
|
||||
|
||||
@@ -1,29 +1,40 @@
|
||||
#include "Systems/PlayerSpawnSystem.h"
|
||||
|
||||
//This should be set by the config anyway.
|
||||
float PlayerSpawnSystem::m_RespawnTime = 15.0f;
|
||||
|
||||
PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
|
||||
: System(params)
|
||||
, m_Timer(0.f)
|
||||
, m_DbgConfigForceRespawn(false)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_OnInputCommand, &PlayerSpawnSystem::OnInputCommand);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerSpawnerd, &PlayerSpawnSystem::OnPlayerSpawned);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerDeath, &PlayerSpawnSystem::OnPlayerDeath);
|
||||
m_NetworkEnabled = ResourceManager::Load<ConfigFile>("Config.ini")->Get("Networking.StartNetwork", false);
|
||||
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||
m_NetworkEnabled = config->Get("Networking.StartNetwork", false);
|
||||
m_ForcedRespawnTime = config->Get("Debug.RespawnTime", -1.0f);
|
||||
m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0;
|
||||
}
|
||||
|
||||
void PlayerSpawnSystem::Update(double dt)
|
||||
{
|
||||
//Increase timer.
|
||||
m_Timer += dt;
|
||||
if (m_Timer < m_RespawnTime) {
|
||||
return;
|
||||
// If there are no CapturePointGameMode components we will just spawn immediately.
|
||||
// Should be able to support older maps with this.
|
||||
// TODO: In the future we might want to return instead, to avoid spawning in the menu for instance.
|
||||
auto pool = m_World->GetComponents("CapturePointGameMode");
|
||||
if (pool != nullptr && pool->size() > 0)
|
||||
{
|
||||
// Take the first CapturePointGameMode component found.
|
||||
ComponentWrapper& modeComponent = *pool->begin();
|
||||
// Increase timer.
|
||||
double& timer = (double&)modeComponent["RespawnTime"];
|
||||
timer += dt;
|
||||
double maxRespawnTime = m_DbgConfigForceRespawn ? m_ForcedRespawnTime : (double)modeComponent["MaxRespawnTime"];
|
||||
if (timer < maxRespawnTime) {
|
||||
return;
|
||||
}
|
||||
// If respawn time has passed, we spawn all players that have requested to be spawned.
|
||||
timer = 0;
|
||||
}
|
||||
//If respawn time has passed, we spawn all players that have requested to be spawned.
|
||||
m_Timer = 0.f;
|
||||
|
||||
//If there are no spawn requests, return immediately, if we are client the SpawnRequests should always be empty.
|
||||
// If there are no spawn requests, return immediately, if we are client the SpawnRequests should always be empty.
|
||||
if (m_SpawnRequests.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user