1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-14 00:54:05 +02:00

#15 fix jump to the next level for original game owners; #23 experimental caustics blur (disabled)

This commit is contained in:
XProger
2017-10-16 08:48:06 +03:00
parent e7d194c0de
commit 6009bd7d25
3 changed files with 37 additions and 1 deletions

View File

@@ -369,6 +369,9 @@ struct WaterCache {
vec3 pos, size;
Texture *mask;
Texture *caustics;
#ifdef BLUR_CAUSTICS
Texture *caustics_tmp;
#endif
Texture *data[2];
Item() {
@@ -434,6 +437,9 @@ struct WaterCache {
data[0] = new Texture(w * 64, h * 64, Texture::RGBA_HALF);
data[1] = new Texture(w * 64, h * 64, Texture::RGBA_HALF);
caustics = Core::settings.detail.water > Core::Settings::MEDIUM ? new Texture(512, 512, Texture::RGBA) : NULL;
#ifdef BLUR_CAUSTICS
caustics_tmp = Core::settings.detail.water > Core::Settings::MEDIUM ? new Texture(512, 512, Texture::RGBA) : NULL;
#endif
mask = new Texture(w, h, Texture::RGB16, false, m, false);
delete[] m;
@@ -449,6 +455,9 @@ struct WaterCache {
delete data[0];
delete data[1];
delete caustics;
#ifdef BLUR_CAUSTICS
delete caustics_tmp;
#endif
delete mask;
mask = caustics = data[0] = data[1] = NULL;
}
@@ -614,6 +623,23 @@ struct WaterCache {
Core::setTarget(item.caustics, true);
game->getMesh()->renderPlane();
Core::invalidateTarget(false, true);
#ifdef BLUR_CAUSTICS
// v blur
Core::setTarget(item.caustics_tmp, true);
game->setShader(Core::passFilter, Shader::FILTER_BLUR, false, false);
Core::active.shader->setParam(uParam, vec4(0, 1, 1.0f / item.caustics->width, 0));;
item.caustics->bind(sDiffuse);
game->getMesh()->renderQuad();
Core::invalidateTarget(false, true);
// h blur
Core::setTarget(item.caustics, true);
game->setShader(Core::passFilter, Shader::FILTER_BLUR, false, false);
Core::active.shader->setParam(uParam, vec4(1, 0, 1.0f / item.caustics->width, 0));;
item.caustics_tmp->bind(sDiffuse);
game->getMesh()->renderQuad();
Core::invalidateTarget(false, true);
#endif
}
void renderMask() {

View File

@@ -62,14 +62,24 @@ struct Level : IGame {
buf[0] = 0;
strcat(buf, "level/");
strcat(buf, TR::LEVEL_INFO[id].name);
#ifdef __EMSCRIPTEN__
strcat(buf, ".PSX");
#else
switch (level.version) {
case TR::VER_TR1_PC : strcat(buf, ".PHD"); break;
case TR::VER_TR1_PSX : strcat(buf, ".PSX"); break;
}
#endif
new Stream(buf, loadAsync);
}
virtual void loadNextLevel() {
#ifdef __EMSCRIPTEN__
if (level.id == TR::LEVEL_2 && level.version != TR::VER_TR1_PC) {
loadLevel(TR::TITLE);
return;
}
#endif
loadLevel(level.id == TR::LEVEL_10C ? TR::TITLE : TR::LevelID(level.id + 1));
}

View File

@@ -680,7 +680,7 @@ struct Drawbridge : Controller {
#define CRYSTAL_LIGHT_RADIUS 1024.0f
#define CRYSTAL_LIGHT_COLOR vec4(0.1, 0.1, 3.0, 1.0f / CRYSTAL_LIGHT_RADIUS)
#define CRYSTAL_LIGHT_COLOR vec4(0.1f, 0.1f, 3.0f, 1.0f / CRYSTAL_LIGHT_RADIUS)
struct Crystal : Controller {
Texture *environment;