mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 03:12:36 +01:00
Extract fade/splash rendering into its own Method.
This commit is contained in:
parent
fada60225c
commit
7337da3133
@ -373,7 +373,7 @@ void GameRenderer::renderWorld(GameWorld* world, const ViewCamera& camera,
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
GLuint splashTexName = 0;
|
||||
auto fc = world->state->fadeColour;
|
||||
const auto fc = world->state->fadeColour;
|
||||
if ((fc.r + fc.g + fc.b) == 0 && !world->state->currentSplash.empty()) {
|
||||
auto splash = world->data->findSlotTexture("generic", world->state->currentSplash);
|
||||
if (splash) {
|
||||
@ -386,8 +386,21 @@ void GameRenderer::renderWorld(GameWorld* world, const ViewCamera& camera,
|
||||
renderLetterbox();
|
||||
}
|
||||
|
||||
float fadeTimer = world->getGameTime() - world->state->fadeStart;
|
||||
if (!world->isPaused()) {
|
||||
renderSplash(world, splashTexName, fc);
|
||||
}
|
||||
|
||||
if ((world->state->isCinematic || world->state->currentCutscene) &&
|
||||
splashTexName == 0 && !world->isPaused()) {
|
||||
renderLetterbox();
|
||||
}
|
||||
|
||||
renderPostProcess();
|
||||
}
|
||||
|
||||
void GameRenderer::renderSplash(GameWorld* world, GLuint splashTexName, glm::u16vec3 fc) {
|
||||
float fadeTimer = world->getGameTime() - world->state->fadeStart;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
/// @todo rewrite this render code to use renderer class
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@ -417,14 +430,6 @@ void GameRenderer::renderWorld(GameWorld* world, const ViewCamera& camera,
|
||||
|
||||
glBindVertexArray(ssRectDraw.getVAOName());
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
if ((world->state->isCinematic || world->state->currentCutscene) &&
|
||||
splashTexName == 0 && !world->isPaused()) {
|
||||
renderLetterbox();
|
||||
}
|
||||
|
||||
renderPostProcess();
|
||||
}
|
||||
|
||||
void GameRenderer::renderPostProcess() {
|
||||
|
@ -119,6 +119,9 @@ public:
|
||||
void drawTexture(TextureData* texture, glm::vec4 extents);
|
||||
void drawColour(const glm::vec4& colour, glm::vec4 extents);
|
||||
|
||||
/** Render full screen splash / fade */
|
||||
void renderSplash(GameWorld* world, GLuint tex, glm::u16vec3 fc);
|
||||
|
||||
/** Increases cinematic value */
|
||||
void renderLetterbox();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user