Some further small fizes to resolution //Tobias

This commit is contained in:
viktorljung
2016-01-25 01:26:41 +01:00
parent 6aeb281249
commit d12246833e
4 changed files with 6 additions and 4 deletions
+2
View File
@@ -25,12 +25,14 @@ class IRenderer
{ {
public: public:
GLFWwindow* Window() const { return m_Window; } GLFWwindow* Window() const { return m_Window; }
//Returns screensize including window border and header
Rectangle Resolution() const { return m_Resolution; } Rectangle Resolution() const { return m_Resolution; }
void SetResolution(const Rectangle& resolution) { m_Resolution = resolution; } void SetResolution(const Rectangle& resolution) { m_Resolution = resolution; }
bool Fullscreen() { return m_Fullscreen; } bool Fullscreen() { return m_Fullscreen; }
void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; } void SetFullscreen(bool fullscreen) { m_Fullscreen = fullscreen; }
bool VSYNC() const { return m_VSYNC; } bool VSYNC() const { return m_VSYNC; }
void SetVSYNC(bool vsync) { m_VSYNC = vsync; } void SetVSYNC(bool vsync) { m_VSYNC = vsync; }
//Returns screensize excluding window border and header
Rectangle GetViewPortSize() const { return m_ViewPortWidth; } Rectangle GetViewPortSize() const { return m_ViewPortWidth; }
void SetViewPortSize(const Rectangle& viewportWidth) { m_ViewPortWidth = viewportWidth; } void SetViewPortSize(const Rectangle& viewportWidth) { m_ViewPortWidth = viewportWidth; }
virtual void Initialize() = 0; virtual void Initialize() = 0;
+1 -1
View File
@@ -30,7 +30,7 @@ void EditorWidgetSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper
auto camera = m_PickData.Camera; auto camera = m_PickData.Camera;
glm::vec3 axis = cEditorWidget["Axis"]; glm::vec3 axis = cEditorWidget["Axis"];
glm::vec2 axisScreen = camera->WorldToScreen(axis, m_Renderer->Resolution()) - camera->WorldToScreen(glm::vec3(0, 0, 0), m_Renderer->Resolution()); glm::vec2 axisScreen = camera->WorldToScreen(axis, m_Renderer->GetViewPortSize()) - camera->WorldToScreen(glm::vec3(0, 0, 0), m_Renderer->GetViewPortSize());
float dot = glm::dot(m_MouseDelta, glm::normalize(axisScreen)) / glm::length(axisScreen); float dot = glm::dot(m_MouseDelta, glm::normalize(axisScreen)) / glm::length(axisScreen);
glm::vec3 worldMovement = dot * axis; glm::vec3 worldMovement = dot * axis;
+2 -2
View File
@@ -22,9 +22,9 @@ void DrawFinalPass::InitializeFrameBuffers()
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height);
GenerateTexture(&m_SceneTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT); GenerateTexture(&m_SceneTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
//GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->Resolution().Width, m_Renderer->Resolution().Height), 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);
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); 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);
//GenerateMipMapTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, glm::vec2(m_Renderer->Resolution().Width, m_Renderer->Resolution().Height), GL_RGB16F, GL_FLOAT, 4); //GenerateMipMapTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, glm::vec2(m_Renderer->GetViewPortSize().Width, m_Renderer->GetViewPortSize().Height), GL_RGB16F, GL_FLOAT, 4);
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new RenderBuffer(&m_DepthBuffer, GL_DEPTH_ATTACHMENT))); m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new RenderBuffer(&m_DepthBuffer, GL_DEPTH_ATTACHMENT)));
m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SceneTexture, GL_COLOR_ATTACHMENT0))); m_FinalPassFrameBuffer.AddResource(std::shared_ptr<BufferResource>(new Texture2D(&m_SceneTexture, GL_COLOR_ATTACHMENT0)));
+1 -1
View File
@@ -47,7 +47,7 @@ bool WeaponSystem::OnInputCommand(const Events::InputCommand& e)
bool WeaponSystem::OnShoot(const Events::Shoot& eShoot) { bool WeaponSystem::OnShoot(const Events::Shoot& eShoot) {
// Screen center, based on current resolution! // Screen center, based on current resolution!
//TODO: check if player has enough ammo and if weapon has a cooldown or not //TODO: check if player has enough ammo and if weapon has a cooldown or not
Rectangle screenResolution = m_Renderer->Resolution(); Rectangle screenResolution = m_Renderer->GetViewPortSize();
glm::vec2 centerScreen = glm::vec2(screenResolution.Width / 2, screenResolution.Height / 2); glm::vec2 centerScreen = glm::vec2(screenResolution.Width / 2, screenResolution.Height / 2);
// TODO: check if player has enough ammo and if weapon has a cooldown or not // TODO: check if player has enough ammo and if weapon has a cooldown or not