Merge remote-tracking branch 'origin/master' into FriendlyHost/Join
This commit is contained in:
@@ -45,7 +45,7 @@ void InputProxy::Update(double dt)
|
||||
}
|
||||
}
|
||||
|
||||
void InputProxy::Process()
|
||||
void InputProxy::Process(bool suppressNewEvents /*= false*/)
|
||||
{
|
||||
for (auto& pair : m_CommandHandlers) {
|
||||
const std::string& command = pair.first;
|
||||
@@ -62,8 +62,10 @@ void InputProxy::Process()
|
||||
e.PlayerID = -1;
|
||||
e.Command = command;
|
||||
e.Value = currentValue;
|
||||
m_EventBroker->Publish(e);
|
||||
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
|
||||
if (!suppressNewEvents || e.Value == 0) {
|
||||
m_EventBroker->Publish(e);
|
||||
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
|
||||
}
|
||||
m_LastCommandValues[command] = currentValue;
|
||||
}
|
||||
}
|
||||
@@ -78,8 +80,10 @@ void InputProxy::Process()
|
||||
e.Value += value;
|
||||
}
|
||||
//e.Value = std::max(-1.f, std::min(e.Value, 1.f));
|
||||
m_EventBroker->Publish(e);
|
||||
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
|
||||
if (!suppressNewEvents || e.Value == 0) {
|
||||
m_EventBroker->Publish(e);
|
||||
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
|
||||
}
|
||||
}
|
||||
m_CommandQueue.clear();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ BlurHUD::BlurHUD(IRenderer* renderer)
|
||||
|
||||
void BlurHUD::InitializeTextures()
|
||||
{
|
||||
m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false);
|
||||
m_BlackTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/Black.png");
|
||||
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ DrawBloomPass::DrawBloomPass(IRenderer* renderer, ConfigFile* config)
|
||||
|
||||
void DrawBloomPass::InitializeTextures()
|
||||
{
|
||||
m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false);
|
||||
m_BlackTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/Black.png");
|
||||
}
|
||||
|
||||
void DrawBloomPass::ChangeQuality(int quality)
|
||||
|
||||
@@ -14,11 +14,11 @@ DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCulling
|
||||
|
||||
void DrawFinalPass::InitializeTextures()
|
||||
{
|
||||
m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false);
|
||||
m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false);
|
||||
m_NeutralNormalTexture = CommonFunctions::LoadTexture("Textures/Core/NeutralNormalMap.png", false);
|
||||
m_GreyTexture = CommonFunctions::LoadTexture("Textures/Core/Grey.png", false);
|
||||
m_ErrorTexture = CommonFunctions::LoadTexture("Textures/Core/ErrorTexture.png", false);
|
||||
m_WhiteTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/White.png");
|
||||
m_BlackTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/Black.png");
|
||||
m_NeutralNormalTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/NeutralNormalMap.png");
|
||||
m_GreyTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/Grey.png");
|
||||
m_ErrorTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/ErrorTexture.png");
|
||||
}
|
||||
|
||||
void DrawFinalPass::InitializeFrameBuffers()
|
||||
|
||||
@@ -10,31 +10,31 @@ Model::Model(std::string fileName)
|
||||
case RawModel::MaterialType::SingleTextures:
|
||||
{
|
||||
RawModel::MaterialSingleTextures* materialSingleTexture = static_cast<RawModel::MaterialSingleTextures*>(materialProperty.material);
|
||||
materialSingleTexture->ColorMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->ColorMap.TexturePath, false);
|
||||
materialSingleTexture->NormalMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->NormalMap.TexturePath, false);
|
||||
materialSingleTexture->SpecularMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->SpecularMap.TexturePath, false);
|
||||
materialSingleTexture->IncandescenceMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->IncandescenceMap.TexturePath, false);
|
||||
materialSingleTexture->ColorMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSingleTexture->ColorMap.TexturePath);
|
||||
materialSingleTexture->NormalMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSingleTexture->NormalMap.TexturePath);
|
||||
materialSingleTexture->SpecularMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSingleTexture->SpecularMap.TexturePath);
|
||||
materialSingleTexture->IncandescenceMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSingleTexture->IncandescenceMap.TexturePath);
|
||||
}
|
||||
break;
|
||||
case RawModel::MaterialType::SplatMapping:
|
||||
{
|
||||
RawModel::MaterialSplatMapping* materialSplatMapping = static_cast<RawModel::MaterialSplatMapping*>(materialProperty.material);
|
||||
materialSplatMapping->SplatMap.Texture = CommonFunctions::LoadTexture(materialSplatMapping->SplatMap.TexturePath, false);
|
||||
materialSplatMapping->SplatMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSplatMapping->SplatMap.TexturePath);
|
||||
for (auto& texture : materialSplatMapping->ColorMaps)
|
||||
{
|
||||
texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false);
|
||||
texture.Texture = CommonFunctions::TryLoadResource<Texture, false>(texture.TexturePath);
|
||||
}
|
||||
for (auto& texture : materialSplatMapping->NormalMaps)
|
||||
{
|
||||
texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false);
|
||||
texture.Texture = CommonFunctions::TryLoadResource<Texture, false>(texture.TexturePath);
|
||||
}
|
||||
for (auto& texture : materialSplatMapping->SpecularMaps)
|
||||
{
|
||||
texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false);
|
||||
texture.Texture = CommonFunctions::TryLoadResource<Texture, false>(texture.TexturePath);
|
||||
}
|
||||
for (auto& texture : materialSplatMapping->IncandescenceMaps)
|
||||
{
|
||||
texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false);
|
||||
texture.Texture = CommonFunctions::TryLoadResource<Texture, false>(texture.TexturePath);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -220,8 +220,8 @@ PickData Renderer::Pick(glm::vec2 screenCoord)
|
||||
|
||||
void Renderer::InitializeTextures()
|
||||
{
|
||||
m_ErrorTexture = CommonFunctions::LoadTexture("Textures/Core/ErrorTexture.png", false);
|
||||
m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false);
|
||||
m_ErrorTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/ErrorTexture.png");
|
||||
m_WhiteTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/White.png");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ SSAOPass::SSAOPass(IRenderer* renderer, ConfigFile* config)
|
||||
: m_Renderer(renderer)
|
||||
, m_Config(config)
|
||||
{
|
||||
m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false);
|
||||
m_WhiteTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/White.png");
|
||||
|
||||
ChangeQuality(m_Config->Get<int>("SSAO.Quality", 0));
|
||||
|
||||
|
||||
@@ -4,18 +4,6 @@ Texture::Texture(std::string path)
|
||||
{
|
||||
PNG* img = ResourceManager::Load<PNG, true>(path); //TODO: Make this threaded. Catch exeptions in all other load places.
|
||||
|
||||
//PNG image(path);
|
||||
|
||||
//if (img->Width == 0 && img->Height == 0 || img->Format == Image::ImageFormat::Unknown) {
|
||||
// //image = PNG("Textures/Core/ErrorTexture.png");
|
||||
// //return; // Temporary fix to remove crash
|
||||
|
||||
// if (img->Width == 0 && img->Height == 0 || img->Format == Image::ImageFormat::Unknown) {
|
||||
// LOG_ERROR("Couldn't even load the error texture. This is a dark day indeed.");
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
this->Width = img->Width;
|
||||
this->Height = img->Height;
|
||||
this->Data = img->Data;
|
||||
@@ -29,9 +17,9 @@ Texture::Texture(std::string path)
|
||||
format = GL_RGBA;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Construct the OpenGL texture
|
||||
|
||||
glGenTextures(1, &m_Texture);
|
||||
glBindTexture(GL_TEXTURE_2D, m_Texture);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#include "Rendering/TextureSprite.h"
|
||||
|
||||
TextureSprite::TextureSprite(std::string path)
|
||||
:Texture(path)
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST);
|
||||
GLERROR("Texture load");
|
||||
}
|
||||
@@ -1,23 +1,5 @@
|
||||
#include "Rendering/Util/CommonFunctions.h"
|
||||
|
||||
Texture* CommonFunctions::LoadTexture(std::string path, bool threaded)
|
||||
{
|
||||
Texture* img;
|
||||
try {
|
||||
if(threaded) {
|
||||
img = ResourceManager::Load<Texture, true>(path);
|
||||
} else {
|
||||
img = ResourceManager::Load<Texture, false>(path);
|
||||
}
|
||||
} catch (const Resource::StillLoadingException&) {
|
||||
img = ResourceManager::Load<Texture>("Textures/Core/ErrorTexture.png");
|
||||
} catch (const std::exception&) {
|
||||
img = nullptr;
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
void CommonFunctions::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type)
|
||||
{
|
||||
glDeleteTextures(1, texture);
|
||||
|
||||
Reference in New Issue
Block a user