Merge branch 'master' into Dirtybit
# Conflicts: # include/Engine/Rendering/ExplosionEffectJob.h # src/Game/Systems/ExplosionEffectSystem.cpp
This commit is contained in:
@@ -119,6 +119,21 @@ GLuint BlurHUD::Draw(GLuint texture, RenderScene& scene)
|
||||
{
|
||||
GLERROR("DrawBloomPass::Draw: Pre");
|
||||
|
||||
bool shouldRun = false;
|
||||
for (auto& job : scene.Jobs.SpriteJob) {
|
||||
auto spriteJob = std::dynamic_pointer_cast<SpriteJob>(job);
|
||||
if (!spriteJob) {
|
||||
continue;
|
||||
}
|
||||
if (!spriteJob->BlurBackground) {
|
||||
continue;
|
||||
}
|
||||
shouldRun = true;
|
||||
break;
|
||||
}
|
||||
if(!shouldRun) {
|
||||
return m_BlackTexture->m_Texture;
|
||||
}
|
||||
FillStencil(scene);
|
||||
|
||||
RenderState state;
|
||||
@@ -226,6 +241,7 @@ void BlurHUD::FillStencil(RenderScene& scene)
|
||||
GLuint shaderHandle = m_FillDepthStencilProgram->GetHandle();
|
||||
glm::mat4 VP = scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix();
|
||||
|
||||
|
||||
for (auto& job : scene.Jobs.SpriteJob) {
|
||||
auto spriteJob = std::dynamic_pointer_cast<SpriteJob>(job);
|
||||
if (!spriteJob) {
|
||||
|
||||
@@ -1333,7 +1333,12 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
||||
|
||||
glUniform3fv(glGetUniformLocation(shaderHandle, "ExplosionOrigin"), 1, glm::value_ptr(job->ExplosionOrigin));
|
||||
GLERROR("Bind 6 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), job->TimeSinceDeath);
|
||||
if (job->Reverse == false) {
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), job->TimeSinceDeath);
|
||||
}
|
||||
else {
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "TimeSinceDeath"), (job->ExplosionDuration - job->TimeSinceDeath));
|
||||
}
|
||||
GLERROR("Bind 7 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "ExplosionDuration"), job->ExplosionDuration);
|
||||
GLERROR("Bind 8 uniform");
|
||||
@@ -1351,6 +1356,10 @@ void DrawFinalPass::BindExplosionUniforms(GLuint shaderHandle, std::shared_ptr<E
|
||||
GLERROR("Bind 14 uniform");
|
||||
glUniform1i(glGetUniformLocation(shaderHandle, "ExponentialAccelaration"), job->ExponentialAccelaration);
|
||||
GLERROR("Bind 15 uniform");
|
||||
glUniform1i(glGetUniformLocation(shaderHandle, "Reverse"), job->Reverse);
|
||||
GLERROR("Bind 15-2 uniform");
|
||||
glUniform1f(glGetUniformLocation(shaderHandle, "ColorDistanceScalar"), job->ColorDistanceScalar);
|
||||
GLERROR("Bind 15-3 uniform");
|
||||
|
||||
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(job->Color));
|
||||
GLERROR("Bind 16 uniform");
|
||||
|
||||
@@ -7,12 +7,15 @@ void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrap
|
||||
delay = std::max(0.0, delay - dt);
|
||||
}
|
||||
|
||||
if (delay <= 0) {
|
||||
Field<double> timeSinceDeath = component["TimeSinceDeath"];
|
||||
timeSinceDeath += (Field<double>)component["Speed"] * dt;
|
||||
if (timeSinceDeath < 0 || timeSinceDeath > (const double&)component["ExplosionDuration"]) {
|
||||
timeSinceDeath = 0.0;
|
||||
}
|
||||
}
|
||||
if (delay <= 0) {
|
||||
Field<double> timeSinceDeath = component["TimeSinceDeath"];
|
||||
timeSinceDeath += (Field<double>)component["Speed"] * dt;
|
||||
if (timeSinceDeath < 0) {
|
||||
timeSinceDeath = 0.0;
|
||||
}
|
||||
else if (timeSinceDeath >(const double&)component["ExplosionDuration"]) {
|
||||
timeSinceDeath = (const double&)component["ExplosionDuration"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,13 +27,15 @@ void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e)
|
||||
//No submenu is open, open one.
|
||||
for (auto& menu : *menus) {
|
||||
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
|
||||
auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner");
|
||||
if (!serverListSpawner.HasComponent("Spawner")) {
|
||||
auto spawner = menuEntity.FirstChildByName(e.Command + "Spawner");
|
||||
if (!spawner.HasComponent("Spawner")) {
|
||||
return;
|
||||
}
|
||||
m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner);
|
||||
Events::SearchForServers event;
|
||||
m_EventBroker->Publish(event);
|
||||
m_OpenSubMenu = SpawnerSystem::Spawn(spawner, spawner);
|
||||
if (e.Command == "Play") {
|
||||
Events::SearchForServers event;
|
||||
m_EventBroker->Publish(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -41,22 +43,53 @@ void MainMenuSystem::OpenSubMenu(const Events::InputCommand& e)
|
||||
//Menu is open, but not the right one, delete the old one and open a new one.
|
||||
m_World->DeleteEntity(m_OpenSubMenu.ID);
|
||||
m_OpenSubMenu = EntityWrapper::Invalid;
|
||||
m_World->DeleteEntity(m_DropDown.ID);
|
||||
m_DropDown = EntityWrapper::Invalid;
|
||||
|
||||
for (auto& menu : *menus) {
|
||||
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
|
||||
auto serverListSpawner = menuEntity.FirstChildByName(e.Command + "Spawner");
|
||||
if (!serverListSpawner.HasComponent("Spawner")) {
|
||||
auto Spawner = menuEntity.FirstChildByName(e.Command + "Spawner");
|
||||
if (!Spawner.HasComponent("Spawner")) {
|
||||
return;
|
||||
}
|
||||
m_OpenSubMenu = SpawnerSystem::Spawn(serverListSpawner, serverListSpawner);
|
||||
Events::SearchForServers event;
|
||||
m_EventBroker->Publish(event);
|
||||
m_OpenSubMenu = SpawnerSystem::Spawn(Spawner, Spawner);
|
||||
if(e.Command == "Play") {
|
||||
Events::SearchForServers event;
|
||||
m_EventBroker->Publish(event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//Serverlist submenu is open, close it.
|
||||
//wanted submenu is open, close it.
|
||||
m_World->DeleteEntity(m_OpenSubMenu.ID);
|
||||
m_OpenSubMenu = EntityWrapper::Invalid;
|
||||
m_World->DeleteEntity(m_DropDown.ID);
|
||||
m_DropDown = EntityWrapper::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainMenuSystem::OpenDropDown(const Events::InputCommand& e)
|
||||
{
|
||||
auto menus = m_World->GetComponents("Menu");
|
||||
if (menus == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_DropDown == EntityWrapper::Invalid) {
|
||||
//No submenu is open, open one.
|
||||
for (auto& menu : *menus) {
|
||||
EntityWrapper menuEntity = EntityWrapper(m_World, menu.EntityID);
|
||||
auto spawner = menuEntity.FirstChildByName(e.Command + "Spawner");
|
||||
if (!spawner.HasComponent("Spawner")) {
|
||||
return;
|
||||
}
|
||||
m_DropDown = SpawnerSystem::Spawn(spawner, spawner);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
m_World->DeleteEntity(m_DropDown.ID);
|
||||
m_DropDown = EntityWrapper::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,8 +106,10 @@ bool MainMenuSystem::OnButtonClick(const Events::ButtonClicked& e)
|
||||
m_EventBroker->Publish(event);
|
||||
}
|
||||
} else if (entity.HasComponent("ConfigBtnResolution")) {
|
||||
|
||||
|
||||
m_Renderer->SetResolution(Rectangle((int)entity["ConfigBtnResolution"]["Width"], (int)entity["ConfigBtnResolution"]["Height"]));
|
||||
m_World->DeleteEntity(m_DropDown.ID);
|
||||
m_DropDown = EntityWrapper::Invalid;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -98,6 +133,8 @@ bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e)
|
||||
m_EventBroker->Publish(event);
|
||||
} else if (e.Command == "Options" && e.Value == 1) {
|
||||
OpenSubMenu(e);
|
||||
} else if (e.Command == "Resolution" && e.Value == 1) {
|
||||
OpenDropDown(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user