Some fixes for scale rtts.

- Don't force using rtts when advanced lighting is disabled because it actually makes the game slower
- Keep the minimap and kart selection screen in high quality
This commit is contained in:
Deve 2017-03-18 22:26:35 +01:00
parent 21cbcd9185
commit 2a64ce94c8
5 changed files with 19 additions and 28 deletions

View File

@ -49,10 +49,10 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G
return result;
}
RTT::RTT(size_t width, size_t height)
RTT::RTT(size_t width, size_t height, float rtt_scale)
{
m_width = width;
m_height = height;
m_width = width * rtt_scale;
m_height = height * rtt_scale;
m_shadow_FBO = NULL;
m_RH_FBO = NULL;
m_RSM = NULL;
@ -60,14 +60,13 @@ RTT::RTT(size_t width, size_t height)
using namespace video;
using namespace core;
dimension2du res(int(width * UserConfigParams::m_scale_rtts_factor),
int(height * UserConfigParams::m_scale_rtts_factor) );
dimension2du res(m_width, m_height);
const dimension2du half = res/2;
const dimension2du quarter = res/4;
const dimension2du eighth = res/8;
const u16 shadowside = u16(1024 * UserConfigParams::m_scale_rtts_factor);
const u16 shadowside = u16(1024 * rtt_scale);
const dimension2du shadowsize0(shadowside, shadowside);
const dimension2du shadowsize1(shadowside / 2, shadowside / 2);
const dimension2du shadowsize2(shadowside / 4, shadowside / 4);

View File

@ -144,7 +144,7 @@ enum TypeRTT : unsigned int
class RTT
{
public:
RTT(size_t width, size_t height);
RTT(size_t width, size_t height, float rtt_scale = 1.0f);
~RTT();
size_t getWidth () const { return m_width ; }

View File

@ -199,10 +199,8 @@ void ShaderBasedRenderer::uploadLightingData() const
void ShaderBasedRenderer::computeMatrixesAndCameras(scene::ICameraSceneNode *const camnode,
size_t width, size_t height)
{
float w = width * UserConfigParams::m_scale_rtts_factor;
float h = height * UserConfigParams::m_scale_rtts_factor;
m_current_screen_size = core::vector2df(w, h);
m_shadow_matrices.computeMatrixesAndCameras(camnode, int(w), int(h),
m_current_screen_size = core::vector2df((float)width, (float)height);
m_shadow_matrices.computeMatrixesAndCameras(camnode, width, height,
m_rtts->getDepthStencilTexture());
} // computeMatrixesAndCameras
@ -669,7 +667,8 @@ void ShaderBasedRenderer::onLoadWorld()
const core::recti &viewport = Camera::getCamera(0)->getViewport();
size_t width = viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X;
size_t height = viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y;
RTT* rtts = new RTT(width, height);
RTT* rtts = new RTT(width, height, CVS->isDefferedEnabled() ?
UserConfigParams::m_scale_rtts_factor : 1.0f);
setRTT(rtts);
}
@ -787,9 +786,7 @@ void ShaderBasedRenderer::render(float dt)
RaceGUIBase *rg = world->getRaceGUI();
if (rg) rg->update(dt);
bool force_rtt = UserConfigParams::m_scale_rtts_factor != 1.0f;
if (!CVS->isDefferedEnabled() && !force_rtt)
if (!CVS->isDefferedEnabled())
{
prepareForwardRenderer();
}
@ -803,12 +800,10 @@ void ShaderBasedRenderer::render(float dt)
oss << "drawAll() for kart " << cam;
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), (cam+1)*60,
0x00, 0x00);
camera->activate(!CVS->isDefferedEnabled() && !force_rtt);
camera->activate(!CVS->isDefferedEnabled());
rg->preRenderCallback(camera); // adjusts start referee
irr_driver->getSceneManager()->setActiveCamera(camnode);
const core::recti &viewport = camera->getViewport();
if (!CVS->isDefferedEnabled())
glEnable(GL_FRAMEBUFFER_SRGB);
@ -816,12 +811,12 @@ void ShaderBasedRenderer::render(float dt)
m_lighting_passes.updateLightsInfo(camnode, dt);
PROFILER_POP_CPU_MARKER();
PROFILER_PUSH_CPU_MARKER("UBO upload", 0x0, 0xFF, 0x0);
computeMatrixesAndCameras(camnode, viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
computeMatrixesAndCameras(camnode, m_rtts->getWidth(), m_rtts->getHeight());
m_shadow_matrices.updateSunOrthoMatrices();
if(CVS->isARBUniformBufferObjectUsable())
uploadLightingData();
PROFILER_POP_CPU_MARKER();
renderScene(camnode, dt, track->hasShadows(), force_rtt);
renderScene(camnode, dt, track->hasShadows(), false);
if (irr_driver->getBoundingBoxesViz())
{
@ -830,7 +825,7 @@ void ShaderBasedRenderer::render(float dt)
debugPhysics();
if (CVS->isDefferedEnabled() || force_rtt)
if (CVS->isDefferedEnabled())
{
renderPostProcessing(camera);
}

View File

@ -404,8 +404,7 @@ void RaceGUI::drawGlobalMiniMap()
const Vec3& xyz = kart->getXYZ();
Vec3 draw_at;
track->mapPoint2MiniMap(xyz, &draw_at);
draw_at *= UserConfigParams::m_scale_rtts_factor;
video::ITexture* icon = sta ?
irr_driver->getTexture(FileManager::GUI, "heart.png") :
kart->getKartProperties()->getMinimapIcon();
@ -427,7 +426,7 @@ void RaceGUI::drawGlobalMiniMap()
{
Vec3 draw_at;
track->mapPoint2MiniMap(sw->getBallPosition(), &draw_at);
draw_at *= UserConfigParams::m_scale_rtts_factor;
video::ITexture* icon =
irr_driver->getTexture(FileManager::GUI, "soccer_ball_normal.png");

View File

@ -395,8 +395,7 @@ void RaceGUIOverworld::drawGlobalMiniMap()
kart_xyz= kart->getXYZ();
Vec3 draw_at;
track->mapPoint2MiniMap(kart_xyz, &draw_at);
draw_at *= UserConfigParams::m_scale_rtts_factor;
video::ITexture* icon = kart->getKartProperties()->getMinimapIcon();
core::rect<s32> source(core::position2di(0, 0), icon->getSize());
int marker_half_size = (kart->getController()->isLocalPlayerController()
@ -433,8 +432,7 @@ void RaceGUIOverworld::drawGlobalMiniMap()
Vec3 draw_at;
track->mapPoint2MiniMap(challenges[n].m_position, &draw_at);
draw_at *= UserConfigParams::m_scale_rtts_factor;
const ChallengeData* challenge = unlock_manager->getChallengeData(challenges[n].m_challenge_id);
const unsigned int val = challenge->getNumTrophies();
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);