diff --git a/lib/graphics_engine/src/ge_vulkan_camera_scene_node.hpp b/lib/graphics_engine/src/ge_vulkan_camera_scene_node.hpp index fbd34b34c..4379b27c4 100644 --- a/lib/graphics_engine/src/ge_vulkan_camera_scene_node.hpp +++ b/lib/graphics_engine/src/ge_vulkan_camera_scene_node.hpp @@ -24,6 +24,8 @@ private: GEVulkanDynamicBuffer* m_buffer; GEVulkanCameraUBO m_ubo_data; + + irr::core::rect m_viewport; public: // ------------------------------------------------------------------------ GEVulkanCameraSceneNode(irr::scene::ISceneNode* parent, @@ -36,6 +38,11 @@ public: virtual void render(); // ------------------------------------------------------------------------ GEVulkanDynamicBuffer* getBuffer() const { return m_buffer; } + // ------------------------------------------------------------------------ + void setViewPort(const irr::core::rect& area) + { m_viewport = area; } + // ------------------------------------------------------------------------ + const irr::core::rect& getViewPort() const { return m_viewport; } }; // GEVulkanCameraSceneNode } diff --git a/lib/graphics_engine/src/ge_vulkan_driver.cpp b/lib/graphics_engine/src/ge_vulkan_driver.cpp index d14b1f8ad..de8b5c988 100644 --- a/lib/graphics_engine/src/ge_vulkan_driver.cpp +++ b/lib/graphics_engine/src/ge_vulkan_driver.cpp @@ -3,11 +3,12 @@ #include "ge_main.hpp" #include "ge_vulkan_2d_renderer.hpp" +#include "ge_vulkan_camera_scene_node.hpp" +#include "ge_vulkan_command_loader.hpp" #include "ge_vulkan_features.hpp" #include "ge_vulkan_mesh_cache.hpp" #include "ge_vulkan_shader_manager.hpp" #include "ge_vulkan_texture.hpp" -#include "ge_vulkan_command_loader.hpp" #include "ICameraSceneNode.h" #include "ISceneManager.h" @@ -1896,7 +1897,16 @@ void GEVulkanDriver::setViewPort(const core::rect& area) core::rect rendert(0,0, getCurrentRenderTargetSize().Width, getCurrentRenderTargetSize().Height); vp.clipAgainst(rendert); if (vp.getHeight() > 0 && vp.getWidth() > 0) + { m_viewport = vp; + if (m_irrlicht_device->getSceneManager() && + m_irrlicht_device->getSceneManager()->getActiveCamera()) + { + GEVulkanCameraSceneNode* cam = static_cast + (m_irrlicht_device->getSceneManager()->getActiveCamera()); + cam->setViewPort(area); + } + } } // setViewPort // ---------------------------------------------------------------------------- diff --git a/src/graphics/fixed_pipeline_renderer.cpp b/src/graphics/fixed_pipeline_renderer.cpp index 261c6a8cf..a302907fb 100644 --- a/src/graphics/fixed_pipeline_renderer.cpp +++ b/src/graphics/fixed_pipeline_renderer.cpp @@ -74,6 +74,9 @@ void FixedPipelineRenderer::render(float dt, bool is_loading) Physics::get()->draw(); } // for igetNumKarts() + // For GEVulkanDriver + irr_driver->getSceneManager()->setActiveCamera(NULL); + // Set the viewport back to the full screen for race gui irr_driver->getVideoDriver()->setViewPort(core::recti(0, 0, UserConfigParams::m_width,