diff --git a/android/texturecubemap/AndroidManifest.xml b/android/texturecubemap/AndroidManifest.xml index 56f9d885..9cf18008 100644 --- a/android/texturecubemap/AndroidManifest.xml +++ b/android/texturecubemap/AndroidManifest.xml @@ -15,6 +15,7 @@ android:label="Cubemap Texture" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:launchMode="singleTask" + android:screenOrientation="landscape" android:configChanges="orientation|screenSize|keyboardHidden"> diff --git a/android/texturecubemap/build.bat b/android/texturecubemap/build.bat deleted file mode 100644 index 26b2e801..00000000 --- a/android/texturecubemap/build.bat +++ /dev/null @@ -1,29 +0,0 @@ -cd jni -call ndk-build -if %ERRORLEVEL% EQU 0 ( - echo ndk-build has failed, build cancelled - cd.. - - mkdir "assets\shaders\base" - xcopy "..\..\data\shaders\base\*.spv" "assets\shaders\base" /Y - - mkdir "assets\shaders\cubemap" - xcopy "..\..\data\shaders\cubemap\*.spv" "assets\shaders\cubemap" /Y - - mkdir "assets\textures" - xcopy "..\..\data\textures\cubemap_yokohama.ktx" "assets\textures" /Y - - mkdir "assets\models" - xcopy "..\..\data\models\sphere.obj" "assets\models" /Y - xcopy "..\..\data\models\teapot.dae" "assets\models" /Y - xcopy "..\..\data\models\torusknot.obj" "assets\models" /Y - xcopy "..\..\data\models\cube.obj" "assets\models" /Y - - mkdir "res\drawable" - xcopy "..\..\android\images\icon.png" "res\drawable" /Y - - call ant debug -Dout.final.file=vulkanTexturecubemap.apk -) ELSE ( - echo error : ndk-build failed with errors! - cd.. -) diff --git a/android/texturecubemap/build.py b/android/texturecubemap/build.py new file mode 100644 index 00000000..4f30992f --- /dev/null +++ b/android/texturecubemap/build.py @@ -0,0 +1,47 @@ +import os +import shutil +import subprocess +import sys +import glob + +APK_NAME = "vulkanTexturecubemap" +SHADER_DIR = "cubemap" +ASSETS_MODELS = ["sphere.obj", "teapot.dae", "torusknot.obj", "cube.obj"] +ASSETS_TEXTURES = ["cubemap_yokohama_bc3_unorm.ktx", "cubemap_yokohama_etc2_unorm.ktx", "cubemap_yokohama_astc_8x8_unorm.ktx"] + +if subprocess.call("ndk-build", shell=True) == 0: + print("Build successful") + + # Assets + os.makedirs("./assets/shaders/base", exist_ok=True) + os.makedirs("./assets/shaders/%s" % SHADER_DIR, exist_ok=True) + os.makedirs("./assets/textures", exist_ok=True) + os.makedirs("./assets/models", exist_ok=True) + os.makedirs("./res/drawable", exist_ok=True) + + # Shaders + # Base + for file in glob.glob("../../data/shaders/base/*.spv"): + shutil.copy(file, "./assets/shaders/base") + # Sample + for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR): + shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR) + # Textures + for file in ASSETS_TEXTURES: + shutil.copy("../../data/textures/%s" % file, "./assets/textures") + # Models + for file in ASSETS_MODELS: + shutil.copy("../../data/models/%s" % file, "./assets/models") + + # Icon + 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!") diff --git a/android/texturemipmapgen/AndroidManifest.xml b/android/texturemipmapgen/AndroidManifest.xml index a31002e0..0eea6e7e 100644 --- a/android/texturemipmapgen/AndroidManifest.xml +++ b/android/texturemipmapgen/AndroidManifest.xml @@ -15,6 +15,7 @@ android:label="Texture mip map generation" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:launchMode="singleTask" + android:screenOrientation="landscape" android:configChanges="orientation|screenSize|keyboardHidden"> diff --git a/android/texturemipmapgen/build.bat b/android/texturemipmapgen/build.bat deleted file mode 100644 index 0b3b70d7..00000000 --- a/android/texturemipmapgen/build.bat +++ /dev/null @@ -1,25 +0,0 @@ -cd jni -call ndk-build -if %ERRORLEVEL% EQU 0 ( - cd.. - - mkdir "assets\shaders\base" - xcopy "..\..\data\shaders\base\*.spv" "assets\shaders\base" /Y - - mkdir "assets\shaders\texturemipmapgen" - xcopy "..\..\data\shaders\texturemipmapgen\*.spv" "assets\shaders\texturemipmapgen" /Y - - mkdir "assets\textures" - xcopy "..\..\data\textures\metalplate_nomips_rgba.ktx" "assets\textures" /Y - - mkdir "assets\models" - xcopy "..\..\data\models\tunnel_cylinder.dae" "assets\models" /Y - - mkdir "res\drawable" - xcopy "..\..\android\images\icon.png" "res\drawable" /Y - - call ant debug -Dout.final.file=vulkanTexturemipmapgen.apk -) ELSE ( - echo error : ndk-build failed with errors! - cd.. -) diff --git a/android/texturemipmapgen/build.py b/android/texturemipmapgen/build.py new file mode 100644 index 00000000..a9f1e96e --- /dev/null +++ b/android/texturemipmapgen/build.py @@ -0,0 +1,47 @@ +import os +import shutil +import subprocess +import sys +import glob + +APK_NAME = "vulkanTexturemipmapgen" +SHADER_DIR = "texturemipmapgen" +ASSETS_MODELS = ["tunnel_cylinder.dae"] +ASSETS_TEXTURES = ["metalplate_nomips_rgba.ktx"] + +if subprocess.call("ndk-build", shell=True) == 0: + print("Build successful") + + # Assets + os.makedirs("./assets/shaders/base", exist_ok=True) + os.makedirs("./assets/shaders/%s" % SHADER_DIR, exist_ok=True) + os.makedirs("./assets/textures", exist_ok=True) + os.makedirs("./assets/models", exist_ok=True) + os.makedirs("./res/drawable", exist_ok=True) + + # Shaders + # Base + for file in glob.glob("../../data/shaders/base/*.spv"): + shutil.copy(file, "./assets/shaders/base") + # Sample + for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR): + shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR) + # Textures + for file in ASSETS_TEXTURES: + shutil.copy("../../data/textures/%s" % file, "./assets/textures") + # Models + for file in ASSETS_MODELS: + shutil.copy("../../data/models/%s" % file, "./assets/models") + + # Icon + 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!") diff --git a/android/vulkanscene/AndroidManifest.xml b/android/vulkanscene/AndroidManifest.xml index ef5a4431..af49f7e5 100644 --- a/android/vulkanscene/AndroidManifest.xml +++ b/android/vulkanscene/AndroidManifest.xml @@ -15,7 +15,7 @@ android:label="Demo Scene" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:launchMode="singleTask" - android:screenOrientation="landscape" + android:screenOrientation="landscape" android:configChanges="orientation|screenSize|keyboardHidden"> diff --git a/android/vulkanscene/build.bat b/android/vulkanscene/build.bat deleted file mode 100644 index 835501c7..00000000 --- a/android/vulkanscene/build.bat +++ /dev/null @@ -1,30 +0,0 @@ -cd jni -call ndk-build -if %ERRORLEVEL% EQU 0 ( - echo ndk-build has failed, build cancelled - cd.. - - mkdir "assets\shaders\base" - xcopy "..\..\data\shaders\base\*.spv" "assets\shaders\base" /Y - - - mkdir "assets\shaders\vulkanscene" - xcopy "..\..\data\shaders\vulkanscene\*.spv" "assets\shaders\vulkanscene" /Y - - mkdir "assets\textures" - xcopy "..\..\data\textures\cubemap_vulkan.ktx" "assets\textures" /Y - - mkdir "assets\models" - xcopy "..\..\data\models\vulkanscenelogos.dae" "assets\models" /Y - xcopy "..\..\data\models\vulkanscenebackground.dae" "assets\models" /Y - xcopy "..\..\data\models\vulkanscenemodels.dae" "assets\models" /Y - xcopy "..\..\data\models\cube.obj" "assets\models" /Y - - mkdir "res\drawable" - xcopy "..\..\android\images\icon.png" "res\drawable" /Y - - call ant debug -Dout.final.file=vulkanVulkanscene.apk -) ELSE ( - echo error : ndk-build failed with errors! - cd.. -) diff --git a/android/vulkanscene/build.py b/android/vulkanscene/build.py new file mode 100644 index 00000000..477f05c4 --- /dev/null +++ b/android/vulkanscene/build.py @@ -0,0 +1,47 @@ +import os +import shutil +import subprocess +import sys +import glob + +APK_NAME = "vulkanVulkanscene" +SHADER_DIR = "vulkanscene" +ASSETS_MODELS = ["vulkanscenelogos.dae", "vulkanscenebackground.dae", "vulkanscenemodels.dae", "cube.obj"] +ASSETS_TEXTURES = ["cubemap_vulkan.ktx"] + +if subprocess.call("ndk-build", shell=True) == 0: + print("Build successful") + + # Assets + os.makedirs("./assets/shaders/base", exist_ok=True) + os.makedirs("./assets/shaders/%s" % SHADER_DIR, exist_ok=True) + os.makedirs("./assets/textures", exist_ok=True) + os.makedirs("./assets/models", exist_ok=True) + os.makedirs("./res/drawable", exist_ok=True) + + # Shaders + # Base + for file in glob.glob("../../data/shaders/base/*.spv"): + shutil.copy(file, "./assets/shaders/base") + # Sample + for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR): + shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR) + # Textures + for file in ASSETS_TEXTURES: + shutil.copy("../../data/textures/%s" % file, "./assets/textures") + # Models + for file in ASSETS_MODELS: + shutil.copy("../../data/models/%s" % file, "./assets/models") + + # Icon + 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!")