fixed Android version (Sony Xperia Z3 Compact)
This commit is contained in:
parent
77616bef24
commit
1d4b103f06
@ -1,15 +1,15 @@
|
||||
precision lowp float;
|
||||
|
||||
uniform sampler2D Texture;
|
||||
uniform sampler2D NormalMap;
|
||||
//uniform sampler2D NormalMap;
|
||||
|
||||
uniform vec3 LightDirection;
|
||||
uniform float TimeOfDayCoef1;
|
||||
uniform float TimeOfDayCoef2;
|
||||
uniform float invCoef;
|
||||
//uniform float invCoef;
|
||||
uniform vec3 TimeOfDayColor;
|
||||
varying vec2 texCoord;
|
||||
|
||||
varying vec3 camVec;
|
||||
varying vec2 texCoord;
|
||||
varying vec3 normVec;
|
||||
varying vec3 posVec;
|
||||
|
||||
|
@ -1,15 +1,11 @@
|
||||
attribute vec3 vPosition;
|
||||
attribute vec3 Normal;
|
||||
attribute vec3 Tangent;
|
||||
attribute vec3 Binormal;
|
||||
attribute vec2 vTexCoord;
|
||||
|
||||
uniform mat4 ModelViewMatrix;
|
||||
//uniform mat4 ModelViewMatrix;
|
||||
uniform mat4 ProjectionMatrix;
|
||||
uniform vec3 CamPos;
|
||||
|
||||
varying vec2 texCoord;
|
||||
varying vec3 camVec;
|
||||
varying vec3 normVec;
|
||||
varying vec3 posVec;
|
||||
|
||||
@ -19,15 +15,6 @@ void main()
|
||||
gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0);
|
||||
texCoord = vTexCoord;
|
||||
|
||||
vec3 cVec = (CamPos - vPosition.xyz);
|
||||
|
||||
mat3 rot;
|
||||
rot[0] = Tangent;
|
||||
rot[1] = Binormal;
|
||||
rot[2] = Normal;
|
||||
|
||||
camVec = cVec * rot;
|
||||
|
||||
normVec = Normal;
|
||||
|
||||
posVec = vPosition.xyz;
|
||||
|
8
jni/android_api.cpp
Normal file → Executable file
8
jni/android_api.cpp
Normal file → Executable file
@ -26,13 +26,15 @@ JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_SetSnowPre
|
||||
|
||||
JNIEXPORT void JNICALL Java_fishrungames_mountainwallpaper_JniWrapper_Init(JNIEnv * env, jobject obj, jint width, jint height)
|
||||
{
|
||||
auto app = JniInitApp<TAndroidApplication>(width, height, 800.f, 480.f);
|
||||
|
||||
Application = JniInitApp<TAndroidApplication>(width, height, 800.f, 480.f);
|
||||
if (app)
|
||||
{
|
||||
Application = app;
|
||||
}
|
||||
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).SetAlpha((lastOffsetX) * pi / 180.f);
|
||||
Application->SkyTexShift = lastOffsetX*0.01f;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,6 +36,8 @@ TPanoramicCamera mCamera;
|
||||
const float cameraDistance = 100.f;
|
||||
std::vector<int> iceIndexes;
|
||||
|
||||
TRenderPair water;
|
||||
|
||||
class LoadingQueueVisitor : public boost::static_visitor<void>
|
||||
{
|
||||
public:
|
||||
@ -351,9 +353,9 @@ void TAndroidApplication::DrawSnow()
|
||||
Renderer->PopProjectionMatrix();
|
||||
}
|
||||
|
||||
void TAndroidApplication::DrawAllScene(bool toScreen)
|
||||
{
|
||||
void TAndroidApplication::DrawAllScene(bool toScreen) {
|
||||
//glClearColor(1.f, 0.f, 1.f, 1.0f);
|
||||
//glClearColor(0.9f, 0.9f, 1.f, 1.0f);
|
||||
glClearColor(0.9f, 0.9f, 1.f, 1.0f);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
@ -363,8 +365,6 @@ void TAndroidApplication::DrawAllScene(bool toScreen)
|
||||
Renderer->PushShader("ClipShader");
|
||||
|
||||
|
||||
|
||||
|
||||
Renderer->SwitchToFrameBuffer("WaterFrame");
|
||||
Renderer->SetGLCamView();
|
||||
Renderer->ScaleMatrix(Vector3f(1, -1, 1));
|
||||
@ -376,19 +376,19 @@ void TAndroidApplication::DrawAllScene(bool toScreen)
|
||||
|
||||
Renderer->ScaleMatrix(Vector3f(1, -1, 1));
|
||||
|
||||
if (toScreen)
|
||||
{
|
||||
if (toScreen) {
|
||||
Renderer->SwitchToScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Renderer->SwitchToFrameBuffer("ScreenshotFrame");
|
||||
}
|
||||
|
||||
Renderer->SetGLCamView();
|
||||
|
||||
{
|
||||
Renderer->PushShader("NormShader");
|
||||
|
||||
RenderUniform1f("Time", WaterTimer);
|
||||
|
||||
if (Renderer->GetScreenWidth() < 600)
|
||||
{
|
||||
RenderUniform1f("WaterScale", 0.7f);
|
||||
@ -397,9 +397,11 @@ void TAndroidApplication::DrawAllScene(bool toScreen)
|
||||
{
|
||||
RenderUniform1f("WaterScale", 1.f);
|
||||
}
|
||||
glActiveTexture(GL_TEXTURE0); // THIS IS A NORMAL MAP (UNIFORM IS SETTED BY ENGINE IN Renderer->PushShader() -> SetUnifroms())
|
||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["water_nmap.png"]);
|
||||
glActiveTexture(GL_TEXTURE1); // THIS IS A COLOR MAP (UNIFORM IS SETTED BY ENGINE IN Renderer->PushShader() -> SetUnifroms())
|
||||
|
||||
// glActiveTexture(GL_TEXTURE0); // THIS IS A NORMAL MAP (UNIFORM IS SETTED BY ENGINE IN Renderer->PushShader() -> SetUnifroms())
|
||||
// glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["water_nmap.png"]);
|
||||
// glActiveTexture(GL_TEXTURE1); // THIS IS A COLOR MAP (UNIFORM IS SETTED BY ENGINE IN Renderer->PushShader() -> SetUnifroms())
|
||||
|
||||
if (toScreen)
|
||||
{
|
||||
Renderer->SetFullScreenViewport();
|
||||
@ -409,11 +411,26 @@ void TAndroidApplication::DrawAllScene(bool toScreen)
|
||||
Renderer->SetFrameViewport("ScreenshotFrame");
|
||||
}
|
||||
|
||||
Renderer->DrawFramePartScreen("WaterFrame", Vector2f(0, 0), Vector2f(1.f, 0.55f));
|
||||
// size_t texID = ResourceManager->FrameManager.GetFrameTexture("WaterFrame");
|
||||
//
|
||||
// if (texID != 0)
|
||||
// {
|
||||
Renderer->PushProjectionMatrix(1, 1);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0); // return back
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
Renderer->LoadIdentity();
|
||||
// glBindTexture(GL_TEXTURE_2D, texID);
|
||||
|
||||
TRenderParamsSetter setter(water.first);
|
||||
Renderer->DrawTriangleList(water.second);
|
||||
|
||||
Renderer->PopProjectionMatrix();
|
||||
//}
|
||||
|
||||
Renderer->PopShader();
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0); // return back
|
||||
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
@ -448,7 +465,7 @@ void TAndroidApplication::InnerInit()
|
||||
GetConsole() << "Inner init go!\n";
|
||||
|
||||
#ifdef TARGET_ANDROID
|
||||
ResourceManager->PathToResources = "";
|
||||
ST::PathToResources = "";
|
||||
#endif
|
||||
#ifdef TARGET_WIN32
|
||||
ST::PathToResources = "../../assets/";
|
||||
@ -486,6 +503,10 @@ void TAndroidApplication::InnerInit()
|
||||
|
||||
CheckGlError();
|
||||
|
||||
water.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "WaterFrame";
|
||||
water.first.SamplerMap[CONST_STRING_NORMALMAP_UNIFORM] = "water_nmap.png";
|
||||
water.second.Data = MakeDataTriangleList(Vector2f(0, 0), Vector2f(1.f, 0.55f), Vector4f(1, 1, 1, 1), 0, Vector2f(0, 0), Vector2f(1.f, 0.55f));
|
||||
|
||||
boost::get<TPanoramicCamera>(Renderer->Camera).MovePhi(pi / 360.f * 5);
|
||||
mCamera.MovePhi(pi / 360.f * 5);
|
||||
|
||||
|
@ -1,7 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
set(BOOST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../boost_1_67_0)
|
||||
set(BOOST_GIL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/boost-gil-extension)
|
||||
#set( CMAKE_CXX_STANDARD 17 )
|
||||
|
||||
|
||||
#add_definitions(-DEIGEN_HAS_CXX11_MATH=0)
|
||||
|
||||
|
||||
#set(BOOST_GIL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/boost-gil-extension)
|
||||
|
||||
set(BOOST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../boost_1_68_0)
|
||||
set(ZIP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/julienr-libzip-android/jni)
|
||||
set(LIBPNG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/libpng_1.4.1_android)
|
||||
set(LIBJPEG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/jpeg-9)
|
||||
@ -9,15 +16,17 @@ set(EIGEN_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../eigen)
|
||||
set(SOL2_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../sol2)
|
||||
set(LUA_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/lua-5.3.4/src)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../tes-engine)
|
||||
include_directories(${BOOST_PATH})
|
||||
include_directories(${LIBJPEG_PATH}/vc10)
|
||||
include_directories(${LUA_PATH})
|
||||
include_directories(${EIGEN_PATH})
|
||||
include_directories(${SOL2_PATH})
|
||||
include_directories(${LUA_PATH})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
include_directories(${BOOST_PATH})
|
||||
include_directories(${LIBPNG_PATH})
|
||||
include_directories(${LIBJPEG_PATH})
|
||||
include_directories(${ZIP_PATH})
|
||||
include_directories(${BOOST_GIL_PATH})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../tes-engine)
|
||||
|
||||
add_definitions(-DTARGET_ANDROID)
|
||||
|
||||
|
@ -1,25 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="fishrungames.mountainwallpaper" android:versionCode="1" android:versionName="1.0.0">
|
||||
<application android:label="@string/app_name" android:icon="@drawable/icon" >
|
||||
<activity android:launchMode="standard" android:name=".Prefs">
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="fishrungames.mountainwallpaper"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0.0">
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true"/>
|
||||
|
||||
<application
|
||||
android:label="@string/app_name"
|
||||
android:icon="@drawable/icon" >
|
||||
|
||||
<activity
|
||||
android:name=".Prefs">
|
||||
<intent-filter>
|
||||
<category android:name="android.intent.category.PREFERENCE"/>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name="MountainWallpaperService" android:enabled="true"
|
||||
android:icon="@drawable/icon" android:label="@string/app_name"
|
||||
<service
|
||||
android:name=".MountainWallpaperService"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:permission="android.permission.BIND_WALLPAPER">
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="android.service.wallpaper.WallpaperService" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.service.wallpaper"
|
||||
<meta-data
|
||||
android:name="android.service.wallpaper"
|
||||
android:resource="@xml/wallpaper"/>
|
||||
</service>
|
||||
|
||||
</application>
|
||||
<uses-feature android:glEsVersion="0x00020000"/>
|
||||
|
||||
</manifest>
|
0
proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/Prefs.java
Normal file → Executable file
0
proj.android-studio/app/src/main/java/fishrungames/mountainwallpaper/Prefs.java
Normal file → Executable file
@ -2,9 +2,35 @@
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent">
|
||||
<RelativeLayout android:id="@+id/LinearLayout01" android:layout_height="wrap_content" android:layout_width="fill_parent"><ImageView android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon" android:layout_alignParentLeft="true" android:layout_marginLeft="3dp"></ImageView>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/LinearLayout01"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ImageView01"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="3dp">
|
||||
</ImageView>
|
||||
|
||||
</RelativeLayout>
|
||||
<ListView android:layout_width="fill_parent" android:id="@+id/android_list" android:layout_height="wrap_content"></ListView>
|
||||
<TextView android:layout_width="fill_parent" android:id="@+id/android_text_feedback" android:padding="20px" android:text="@string/feedback" android:layout_height="wrap_content"></TextView>
|
||||
|
||||
<ListView
|
||||
android:layout_width="fill_parent"
|
||||
android:id="@android:id/list"
|
||||
android:layout_height="wrap_content">
|
||||
</ListView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:id="@+id/android_text_feedback"
|
||||
android:padding="20px"
|
||||
android:text="@string/feedback"
|
||||
android:layout_height="wrap_content">
|
||||
</TextView>
|
||||
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user