1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-07-31 10:20:27 +02:00

#15 fix gamepad support; #23 fix specular (wet effect)

This commit is contained in:
XProger
2017-03-24 04:01:25 +03:00
parent 2ffa5a7bf4
commit 7299446ed7
7 changed files with 21 additions and 13 deletions

Binary file not shown.

View File

@@ -23,8 +23,8 @@ namespace Game {
Core::settings.ambient = true; Core::settings.ambient = true;
Core::settings.lighting = true; Core::settings.lighting = true;
Core::settings.shadows = false;//true; Core::settings.shadows = true;
Core::settings.water = false;//Core::support.texFloat || Core::support.texHalf; Core::settings.water = Core::support.texFloat || Core::support.texHalf;
level = NULL; level = NULL;
ui = NULL; ui = NULL;

View File

@@ -3,7 +3,7 @@
android:versionCode="1" android:versionCode="1"
android:versionName="0.1" > android:versionName="0.1" >
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" /> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" />
<supports-screens android:smallScreens="true" android:largeScreens="true" android:normalScreens="true" android:xlargeScreens="true" /> <supports-screens android:smallScreens="true" android:largeScreens="true" android:normalScreens="true" android:xlargeScreens="true" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" />

View File

@@ -11,4 +11,4 @@
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target. # Project target.
target=android-9 target=android-14

View File

@@ -21,13 +21,13 @@ import android.view.InputDevice;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
//import android.view.View.OnGenericMotionListener; import android.view.View.OnGenericMotionListener;
import android.view.View.OnKeyListener; import android.view.View.OnKeyListener;
import android.view.View.OnTouchListener; import android.view.View.OnTouchListener;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
public class MainActivity extends Activity implements OnTouchListener/*, OnGenericMotionListener, OnKeyListener*/ { public class MainActivity extends Activity implements OnTouchListener, OnGenericMotionListener, OnKeyListener {
private GLSurfaceView view; private GLSurfaceView view;
//private GvrLayout gvrLayout; //private GvrLayout gvrLayout;
private Wrapper wrapper; private Wrapper wrapper;
@@ -56,8 +56,8 @@ public class MainActivity extends Activity implements OnTouchListener/*, OnGener
view.setFocusableInTouchMode(true); view.setFocusableInTouchMode(true);
view.setOnTouchListener(this); view.setOnTouchListener(this);
// view.setOnGenericMotionListener(this); view.setOnGenericMotionListener(this);
// view.setOnKeyListener(this); view.setOnKeyListener(this);
/* /*
gvrLayout = new GvrLayout(this); gvrLayout = new GvrLayout(this);
gvrLayout.setPresentationView(view); gvrLayout.setPresentationView(view);
@@ -120,7 +120,7 @@ public class MainActivity extends Activity implements OnTouchListener/*, OnGener
} }
return true; return true;
} }
/*
private int getJoyIndex(InputDevice dev) { private int getJoyIndex(InputDevice dev) {
int src = dev.getSources(); int src = dev.getSources();
if ((src & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD || if ((src & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD ||
@@ -185,7 +185,6 @@ public class MainActivity extends Activity implements OnTouchListener/*, OnGener
} }
return false; return false;
} }
*/
static { static {
System.loadLibrary("game"); System.loadLibrary("game");

View File

@@ -6,4 +6,4 @@ set FLAGS=-O3 -Wno-deprecated-register --llvm-opts 2 -fmax-type-align=2 -std=c++
set PRELOAD=./LEVEL2.PSX set PRELOAD=./LEVEL2.PSX
echo. echo.
call em++ %SRC% %FLAGS% -o %PROJ%.js --preload-file %PRELOAD% call em++ %SRC% %FLAGS% -o %PROJ%.js --preload-file %PRELOAD%
ggzip.exe -9 -f %PROJ%.data %PROJ%.js %PROJ%.js.mem gzip.exe -9 -f %PROJ%.data %PROJ%.js %PROJ%.js.mem

View File

@@ -413,14 +413,19 @@ varying vec4 vTexCoord; // xy - atlas coords, zw - caustics coords
#ifndef TYPE_FLASH #ifndef TYPE_FLASH
#ifdef OPT_SHADOW #ifdef OPT_SHADOW
#ifdef PASS_COMPOSE #ifdef PASS_COMPOSE
vec3 n = normalize(vNormal.xyz);
vec3 light = uLightColor[1].xyz * vLight.y + uLightColor[2].xyz * vLight.z; vec3 light = uLightColor[1].xyz * vLight.y + uLightColor[2].xyz * vLight.z;
#ifdef TYPE_ENTITY #ifdef TYPE_ENTITY
light += vAmbient + uLightColor[0].xyz * (vLight.x * getShadow()); float rShadow = getShadow();
light += vAmbient + uLightColor[0].xyz * (vLight.x * rShadow);
#if defined(OPT_WATER) && defined(UNDERWATER)
light += calcCaustics(n);
#endif
#endif #endif
#ifdef TYPE_ROOM #ifdef TYPE_ROOM
vec3 n = normalize(vNormal.xyz);
light += mix(vAmbient.x, vLight.x, getShadow()); light += mix(vAmbient.x, vLight.x, getShadow());
#if defined(OPT_WATER) && defined(UNDERWATER) #if defined(OPT_WATER) && defined(UNDERWATER)
light += calcCaustics(n); light += calcCaustics(n);
@@ -434,6 +439,10 @@ varying vec4 vTexCoord; // xy - atlas coords, zw - caustics coords
#ifndef TYPE_MIRROR #ifndef TYPE_MIRROR
color.xyz *= light; color.xyz *= light;
#endif #endif
#ifdef TYPE_ENTITY
color.xyz += calcSpecular(n, vViewVec.xyz, vLightVec, uLightColor[0], uMaterial.z * rShadow + 0.03);
#endif
#endif #endif
#ifdef PASS_AMBIENT #ifdef PASS_AMBIENT