Skip to content

Commit

Permalink
fix for for mediump, enable mipmaps for low filter settings
Browse files Browse the repository at this point in the history
  • Loading branch information
XProger committed May 30, 2018
1 parent dfdd112 commit 04fce6d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define _GAPI_GL 1
#define _GAPI_GLES 1

//#define DYNGEOM_NO_VBO
#define DYNGEOM_NO_VBO
#elif __linux__
#define _OS_LINUX 1
#define _GAPI_GL 1
Expand Down
4 changes: 2 additions & 2 deletions src/gapi_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ namespace GAPI {
}

void setFilterQuality(int value) {
bool filter = value > Core::Settings::LOW;
bool mipmaps = value > Core::Settings::MEDIUM;
bool filter = (opt & OPT_NEAREST) == 0 && (value > Core::Settings::LOW);
bool mipmaps = (opt & OPT_MIPMAPS) != 0;

Core::active.textures[0] = NULL;
bind(0);
Expand Down
7 changes: 4 additions & 3 deletions src/lara.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#define LARA_SWIM_SPEED 50.0f
#define LARA_SWIM_FRICTION 1.0f

#define LARA_MIN_SPECULAR 0.03f
#define LARA_WET_SPECULAR 0.5f
#define LARA_WET_TIMER (LARA_WET_SPECULAR / 16.0f) // 4 sec

Expand Down Expand Up @@ -2813,10 +2814,10 @@ struct Lara : Character {
updateWeapon();

if (stand == STAND_UNDERWATER)
specular = 0.0f;
specular = LARA_MIN_SPECULAR;
else
if (specular > 0.0f)
specular = max(0.0f, specular - LARA_WET_TIMER * Core::deltaTime);
if (specular > LARA_MIN_SPECULAR)
specular = max(LARA_MIN_SPECULAR, specular - LARA_WET_TIMER * Core::deltaTime);

if (state == STATE_MIDAS_DEATH || state == STATE_MIDAS_USE) {
uint32 sparklesMask = getMidasMask();
Expand Down
2 changes: 1 addition & 1 deletion src/platform/clover/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set -e
clang++ -std=c++11 -Os -s -g -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DNDEBUG -D__CLOVER__ main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I/opt/vc/include -I../../ -L/opt/vc/lib/ -lGLESv2 -lEGL -lm -lrt -lpthread -lasound -ludev -o../../../bin/OpenLara
clang++ -std=c++11 -Os -s -g -marm -march=armv7ve -mtune=cortex-a7 -mfloat-abi=hard -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DNDEBUG -D__CLOVER__ main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I/opt/vc/include -I../../ -L/opt/vc/lib/ -lGLESv2 -lEGL -lm -lrt -lpthread -lasound -ludev -o../../../bin/OpenLara
strip ../../../bin/OpenLara --strip-all --remove-section=.comment --remove-section=.note
8 changes: 4 additions & 4 deletions src/platform/clover/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool sndInit() {
int err;

// In the perfect world ReedPlayer-Clover process
// will release ALSA devicbefore app running, but...
// will release ALSA device before app running, but...
for (int i = 0; i < 20; i++) { // 20 * 0.1 = 2 secs
sndOut = NULL;
if ((err = snd_pcm_open(&sndOut, "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
Expand Down Expand Up @@ -581,10 +581,10 @@ LOG("start\n");

inputFree();

//sndFree();
//Game::deinit();

Game::deinit();
eglFree();

sndFree();

return 0;
}
8 changes: 4 additions & 4 deletions src/shaders/shader.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ uniform vec4 uFogParams;
float fog;
#ifdef UNDERWATER
float d;
if (uViewPos.y < uParam.y)
d = abs((coord.y - uParam.y) / normalize(vViewVec.xyz).y);
else
//if (uViewPos.y < uParam.y) // TODO: fix for mediump
// d = abs((coord.y - uParam.y) / normalize(uViewPos.xyz - coord.xyz).y);
//else
d = length(uViewPos.xyz - coord.xyz);
fog = d * WATER_FOG_DIST;
#else
Expand Down Expand Up @@ -436,7 +436,7 @@ uniform vec4 uFogParams;
vec3 normal = normalize(vNormal.xyz);

#ifdef TYPE_ENTITY
float rSpecular = uMaterial.z + 0.03;
float rSpecular = uMaterial.z;
#endif

#ifdef OPT_SHADOW
Expand Down

0 comments on commit 04fce6d

Please sign in to comment.