1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-01-17 21:09:00 +01:00

#23 considering luminosity in downsample filter

This commit is contained in:
XProger 2016-12-26 05:40:29 +03:00
parent 3bb21d5536
commit ec67b2ee79
7 changed files with 25 additions and 15 deletions

Binary file not shown.

View File

@ -22,9 +22,15 @@ uniform int uType;
vec4 color = vec4(0.0);
for (float y = -1.5; y < 2.0; y++)
for (float x = -1.5; x < 2.0; x++)
color += texture2D(sDiffuse, vTexCoord + vec2(x, y) * k);
color /= 16.0;
for (float x = -1.5; x < 2.0; x++) {
vec4 p;
p.xyz = texture2D(sDiffuse, vTexCoord + vec2(x, y) * k).xyz;
p.w = dot(p.xyz, vec3(0.299, 0.587, 0.114));
p.xyz *= p.w;
color += p;
}
color.xyz /= color.w;
color.w = 1.0;
return color;
}

View File

@ -13,7 +13,7 @@ namespace Game {
void init() {
Core::init();
//level = new Level("LEVEL2_DEMO.PHD", true, false);
//level = new Level("GYM.PHD", false, true);
//level = new Level("GYM.PSX", false, true);
//level = new Level("LEVEL3A.PHD", false, false);
level = new Level("LEVEL2.PSX", false, false);

View File

@ -31,7 +31,7 @@
#define DESCENT_SPEED 2048.0f
#define MUZZLE_FLASH_TIME 0.1f
#define FLASH_LIGHT_COLOR vec4(0.8f, 0.7f, 0.3f, 3584 * 3584)
#define FLASH_LIGHT_COLOR vec4(0.8f, 0.7f, 0.3f, 3072 * 3072)
#define TARGET_MAX_DIST (8.0f * 1024.0f)
struct Lara : Character {
@ -289,7 +289,11 @@ struct Lara : Character {
pos = vec3(20215, 6656, 52942);
angle = vec3(0.0f, PI, 0.0f);
getEntity().room = 14;
// level 8c
pos = vec3(40913, -1012, 42252);
angle = vec3(0.0f, PI, 0.0f);
getEntity().room = 0;
*/
updateEntity();
#endif
@ -462,7 +466,7 @@ struct Lara : Character {
}
void wpnChange(Weapon::Type wType) {
if (wpnCurrent == wType) return;
if (wpnCurrent == wType || home) return;
wpnNext = wType;
wpnHide();
}

View File

@ -855,18 +855,18 @@ struct Level {
Debug::begin();
// Debug::Level::rooms(level, lara->pos, lara->getEntity().room);
Debug::Level::lights(level, lara->getRoomIndex());
// Debug::Level::lights(level, lara->getRoomIndex());
// Debug::Level::sectors(level, lara->getRoomIndex(), (int)lara->pos.y);
// Debug::Level::portals(level);
// Debug::Level::meshes(level);
// Debug::Level::entities(level);
static int dbg_ambient = 0;
dbg_ambient = int(time * 2) % 4;
shadow->unbind(sShadow);
cube->unbind(sEnvironment);
atlas->bind(sDiffuse);
glEnable(GL_TEXTURE_2D);
glDisable(GL_CULL_FACE);
glColor3f(1, 1, 1);
@ -884,17 +884,19 @@ struct Level {
glTranslatef(0, 0, 256);
ambientCache->textures[j * 4 + dbg_ambient]->bind(sDiffuse);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3f(-256, 256, 0);
glTexCoord2f(1, 0); glVertex3f( 256, 256, 0);
glTexCoord2f(1, 1); glVertex3f( 256, -256, 0);
glTexCoord2f(0, 1); glVertex3f(-256, -256, 0);
glEnd();
glPopMatrix();
}
glEnable(GL_CULL_FACE);
glDisable(GL_TEXTURE_2D);
glLineWidth(4);
glBegin(GL_LINES);
float S = 64.0f;
@ -937,7 +939,7 @@ struct Level {
glEnd();
glLineWidth(1);
/*
shaders[shGUI]->bind();
Core::mViewProj = mat4(0, (float)Core::width, (float)Core::height, 0, 0, 1);

View File

@ -3,7 +3,7 @@ cls
set SRC=main.cpp
set PROJ=OpenLara
set FLAGS=-O3 -Wno-deprecated-register --llvm-opts 2 -fmax-type-align=2 -std=c++11 -I../../
set PRELOAD=./LEVEL2.PSX
set PRELOAD=./GYM.PSX
echo.
call em++ %SRC% %FLAGS% -o %PROJ%.js --preload-file %PRELOAD%
gzip.exe -9 -f %PROJ%.data %PROJ%.js %PROJ%.js.mem

View File

@ -102,7 +102,5 @@
};
</script>
<audio autoplay loop><source src="05.ogg" type="audio/ogg"></audio>
</body>
</html>