Added Android build files for PBR basic and IBL examples [skip ci]
This commit is contained in:
parent
81c79cba85
commit
d3da19a93b
12 changed files with 290 additions and 1 deletions
|
|
@ -42,3 +42,5 @@ call _build texture3d %1
|
||||||
call _build specializationconstants %1
|
call _build specializationconstants %1
|
||||||
call _build subpasses %1
|
call _build subpasses %1
|
||||||
call _build hdr %1
|
call _build hdr %1
|
||||||
|
call _build pbrbasic %1
|
||||||
|
call _build pbribl %1
|
||||||
10
android/pbrbasic/.gitignore
vendored
Normal file
10
android/pbrbasic/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
/assets/
|
||||||
|
/res/
|
||||||
|
/bin/
|
||||||
|
/libs/
|
||||||
|
/obj/
|
||||||
|
/build.xml
|
||||||
|
/local.properties
|
||||||
|
/project.properties
|
||||||
|
/proguard-project.txt
|
||||||
|
*.apk
|
||||||
27
android/pbrbasic/AndroidManifest.xml
Normal file
27
android/pbrbasic/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="de.saschawillems.vulkanPBRBasic"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
<uses-sdk android:minSdkVersion="19" />
|
||||||
|
|
||||||
|
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.hardware.gamepad" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.software.leanback" android:required="false"/>
|
||||||
|
|
||||||
|
<application android:label="vulkanPBRBasic" android:icon="@drawable/icon" android:hasCode="false">
|
||||||
|
<activity android:name="android.app.NativeActivity"
|
||||||
|
android:label="Physical based rendering"
|
||||||
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="orientation|screenSize|keyboardHidden">
|
||||||
|
<meta-data android:name="android.app.lib_name" android:value="vulkanPBRBasic" />
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
49
android/pbrbasic/build.py
Normal file
49
android/pbrbasic/build.py
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import glob
|
||||||
|
|
||||||
|
APK_NAME = "vulkanPBRBasic"
|
||||||
|
SHADER_DIR = "pbrbasic"
|
||||||
|
ASSETS_MODELS = ["cube.obj", "geosphere.obj", "teapot.dae", "torusknot.obj", "venus.fbx"]
|
||||||
|
ASSETS_TEXTURES = [""]
|
||||||
|
|
||||||
|
if subprocess.call("ndk-build", shell=True) == 0:
|
||||||
|
print("Build successful")
|
||||||
|
|
||||||
|
# Assets
|
||||||
|
if not os.path.exists("./assets"):
|
||||||
|
os.makedirs("./assets")
|
||||||
|
|
||||||
|
# Shaders
|
||||||
|
# Base
|
||||||
|
if not os.path.exists("./assets/shaders/base"):
|
||||||
|
os.makedirs("./assets/shaders/base")
|
||||||
|
for file in glob.glob("../../data/shaders/base/*.spv"):
|
||||||
|
shutil.copy(file, "./assets/shaders/base")
|
||||||
|
# Sample
|
||||||
|
if not os.path.exists("./assets/shaders/%s" % SHADER_DIR):
|
||||||
|
os.makedirs("./assets/shaders/%s" % SHADER_DIR)
|
||||||
|
for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR):
|
||||||
|
shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR)
|
||||||
|
# Models
|
||||||
|
if not os.path.exists("./assets/models"):
|
||||||
|
os.makedirs("./assets/models")
|
||||||
|
for file in ASSETS_MODELS:
|
||||||
|
shutil.copy("../../data/models/%s" % file, "./assets/models")
|
||||||
|
|
||||||
|
# Icon
|
||||||
|
if not os.path.exists("./res/drawable"):
|
||||||
|
os.makedirs("./res/drawable")
|
||||||
|
shutil.copy("../../android/images/icon.png", "./res/drawable")
|
||||||
|
|
||||||
|
if subprocess.call("ant debug -Dout.final.file=%s.apk" % APK_NAME, shell=True) == 0:
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
if sys.argv[1] == "-deploy":
|
||||||
|
if subprocess.call("adb install -r %s.apk" % APK_NAME, shell=True) != 0:
|
||||||
|
print("Could not deploy to device!")
|
||||||
|
else:
|
||||||
|
print("Error during build process!")
|
||||||
|
else:
|
||||||
|
print("Error building project!")
|
||||||
48
android/pbrbasic/jni/Android.mk
Normal file
48
android/pbrbasic/jni/Android.mk
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
LOCAL_PATH := $(call my-dir)/../../pbrbasic
|
||||||
|
|
||||||
|
# assimp
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE := assimp
|
||||||
|
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../libs/assimp/$(TARGET_ARCH_ABI)/libassimp.a
|
||||||
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
# vulkan example
|
||||||
|
|
||||||
|
DATADIR := $(LOCAL_PATH)/../../data
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE := vulkanPBRBasic
|
||||||
|
|
||||||
|
PROJECT_FILES := $(wildcard $(LOCAL_PATH)/../../pbrbasic/*.cpp)
|
||||||
|
PROJECT_FILES += $(wildcard $(LOCAL_PATH)/../../base/*.cpp)
|
||||||
|
|
||||||
|
LOCAL_CPPFLAGS := -std=c++11
|
||||||
|
LOCAL_CPPFLAGS += -D__STDC_LIMIT_MACROS
|
||||||
|
LOCAL_CPPFLAGS += -DVK_NO_PROTOTYPES
|
||||||
|
LOCAL_CPPFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR
|
||||||
|
|
||||||
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../external/
|
||||||
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/glm
|
||||||
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/gli
|
||||||
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/assimp
|
||||||
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../base/
|
||||||
|
#LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../base/android
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(PROJECT_FILES)
|
||||||
|
|
||||||
|
LOCAL_LDLIBS := -landroid -llog -lz
|
||||||
|
|
||||||
|
LOCAL_DISABLE_FORMAT_STRING_CHECKS := true
|
||||||
|
LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
|
||||||
|
|
||||||
|
LOCAL_STATIC_LIBRARIES += android_native_app_glue
|
||||||
|
LOCAL_STATIC_LIBRARIES += cpufeatures
|
||||||
|
LOCAL_STATIC_LIBRARIES += libassimp
|
||||||
|
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
$(call import-module, android/native_app_glue)
|
||||||
|
$(call import-module, android/cpufeatures)
|
||||||
5
android/pbrbasic/jni/Application.mk
Normal file
5
android/pbrbasic/jni/Application.mk
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
APP_PLATFORM := android-19
|
||||||
|
APP_ABI := armeabi-v7a
|
||||||
|
APP_STL := c++_static
|
||||||
|
APP_CPPFLAGS := -std=c++11
|
||||||
|
NDK_TOOLCHAIN_VERSION := clang
|
||||||
10
android/pbribl/.gitignore
vendored
Normal file
10
android/pbribl/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
/assets/
|
||||||
|
/res/
|
||||||
|
/bin/
|
||||||
|
/libs/
|
||||||
|
/obj/
|
||||||
|
/build.xml
|
||||||
|
/local.properties
|
||||||
|
/project.properties
|
||||||
|
/proguard-project.txt
|
||||||
|
*.apk
|
||||||
27
android/pbribl/AndroidManifest.xml
Normal file
27
android/pbribl/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="de.saschawillems.vulkanPBRBIBL"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
<uses-sdk android:minSdkVersion="19" />
|
||||||
|
|
||||||
|
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.hardware.gamepad" android:required="false"/>
|
||||||
|
<uses-feature android:name="android.software.leanback" android:required="false"/>
|
||||||
|
|
||||||
|
<application android:label="vulkanPBRBIBL" android:icon="@drawable/icon" android:hasCode="false">
|
||||||
|
<activity android:name="android.app.NativeActivity"
|
||||||
|
android:label="PBR Image based lighting"
|
||||||
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:configChanges="orientation|screenSize|keyboardHidden">
|
||||||
|
<meta-data android:name="android.app.lib_name" android:value="vulkanPBRBIBL" />
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
54
android/pbribl/build.py
Normal file
54
android/pbribl/build.py
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import glob
|
||||||
|
|
||||||
|
APK_NAME = "vulkanPBRBIBL"
|
||||||
|
SHADER_DIR = "pbribl"
|
||||||
|
ASSETS_MODELS = ["cube.obj", "geosphere.obj", "teapot.dae", "torusknot.obj", "venus.fbx"]
|
||||||
|
ASSETS_TEXTURES = ["hamarikyu_bridge_radiance_cube.ktx", "hamarikyu_bridge_irradiance_cube.ktx"]
|
||||||
|
|
||||||
|
if subprocess.call("ndk-build", shell=True) == 0:
|
||||||
|
print("Build successful")
|
||||||
|
|
||||||
|
# Assets
|
||||||
|
if not os.path.exists("./assets"):
|
||||||
|
os.makedirs("./assets")
|
||||||
|
|
||||||
|
# Shaders
|
||||||
|
# Base
|
||||||
|
if not os.path.exists("./assets/shaders/base"):
|
||||||
|
os.makedirs("./assets/shaders/base")
|
||||||
|
for file in glob.glob("../../data/shaders/base/*.spv"):
|
||||||
|
shutil.copy(file, "./assets/shaders/base")
|
||||||
|
# Sample
|
||||||
|
if not os.path.exists("./assets/shaders/%s" % SHADER_DIR):
|
||||||
|
os.makedirs("./assets/shaders/%s" % SHADER_DIR)
|
||||||
|
for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR):
|
||||||
|
shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR)
|
||||||
|
# Textures
|
||||||
|
if not os.path.exists("./assets/textures"):
|
||||||
|
os.makedirs("./assets/textures")
|
||||||
|
for file in ASSETS_TEXTURES:
|
||||||
|
shutil.copy("../../data/textures/%s" % file, "./assets/textures")
|
||||||
|
# Models
|
||||||
|
if not os.path.exists("./assets/models"):
|
||||||
|
os.makedirs("./assets/models")
|
||||||
|
for file in ASSETS_MODELS:
|
||||||
|
shutil.copy("../../data/models/%s" % file, "./assets/models")
|
||||||
|
|
||||||
|
# Icon
|
||||||
|
if not os.path.exists("./res/drawable"):
|
||||||
|
os.makedirs("./res/drawable")
|
||||||
|
shutil.copy("../../android/images/icon.png", "./res/drawable")
|
||||||
|
|
||||||
|
if subprocess.call("ant debug -Dout.final.file=%s.apk" % APK_NAME, shell=True) == 0:
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
if sys.argv[1] == "-deploy":
|
||||||
|
if subprocess.call("adb install -r %s.apk" % APK_NAME, shell=True) != 0:
|
||||||
|
print("Could not deploy to device!")
|
||||||
|
else:
|
||||||
|
print("Error during build process!")
|
||||||
|
else:
|
||||||
|
print("Error building project!")
|
||||||
48
android/pbribl/jni/Android.mk
Normal file
48
android/pbribl/jni/Android.mk
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
LOCAL_PATH := $(call my-dir)/../../pbribl
|
||||||
|
|
||||||
|
# assimp
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE := assimp
|
||||||
|
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../libs/assimp/$(TARGET_ARCH_ABI)/libassimp.a
|
||||||
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
# vulkan example
|
||||||
|
|
||||||
|
DATADIR := $(LOCAL_PATH)/../../data
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE := vulkanPBRBIBL
|
||||||
|
|
||||||
|
PROJECT_FILES := $(wildcard $(LOCAL_PATH)/../../pbribl/*.cpp)
|
||||||
|
PROJECT_FILES += $(wildcard $(LOCAL_PATH)/../../base/*.cpp)
|
||||||
|
|
||||||
|
LOCAL_CPPFLAGS := -std=c++11
|
||||||
|
LOCAL_CPPFLAGS += -D__STDC_LIMIT_MACROS
|
||||||
|
LOCAL_CPPFLAGS += -DVK_NO_PROTOTYPES
|
||||||
|
LOCAL_CPPFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR
|
||||||
|
|
||||||
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../external/
|
||||||
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/glm
|
||||||
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/gli
|
||||||
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../external/assimp
|
||||||
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../base/
|
||||||
|
#LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../base/android
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(PROJECT_FILES)
|
||||||
|
|
||||||
|
LOCAL_LDLIBS := -landroid -llog -lz
|
||||||
|
|
||||||
|
LOCAL_DISABLE_FORMAT_STRING_CHECKS := true
|
||||||
|
LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
|
||||||
|
|
||||||
|
LOCAL_STATIC_LIBRARIES += android_native_app_glue
|
||||||
|
LOCAL_STATIC_LIBRARIES += cpufeatures
|
||||||
|
LOCAL_STATIC_LIBRARIES += libassimp
|
||||||
|
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
$(call import-module, android/native_app_glue)
|
||||||
|
$(call import-module, android/cpufeatures)
|
||||||
5
android/pbribl/jni/Application.mk
Normal file
5
android/pbribl/jni/Application.mk
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
APP_PLATFORM := android-19
|
||||||
|
APP_ABI := armeabi-v7a
|
||||||
|
APP_STL := c++_static
|
||||||
|
APP_CPPFLAGS := -std=c++11
|
||||||
|
NDK_TOOLCHAIN_VERSION := clang
|
||||||
|
|
@ -48,6 +48,10 @@ adb uninstall de.saschawillems.vulkanTexture3d
|
||||||
adb uninstall de.saschawillems.vulkanSpecializationconstants
|
adb uninstall de.saschawillems.vulkanSpecializationconstants
|
||||||
adb uninstall de.saschawillems.vulkanSubpasses
|
adb uninstall de.saschawillems.vulkanSubpasses
|
||||||
adb uninstall de.saschawillems.vulkanHDR
|
adb uninstall de.saschawillems.vulkanHDR
|
||||||
|
adb uninstall de.saschawillems.vulkanSSAO
|
||||||
|
adb uninstall de.saschawillems.vulkanComputecullandlod
|
||||||
|
adb uninstall de.saschawillems.vulkanPBRBasic
|
||||||
|
adb uninstall de.saschawillems.vulkanPBRIBL
|
||||||
goto finish
|
goto finish
|
||||||
|
|
||||||
:exit
|
:exit
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue