diff --git a/android/hdr/AndroidManifest.xml b/android/hdr/AndroidManifest.xml index 0c9d4c9d..7b4a825b 100644 --- a/android/hdr/AndroidManifest.xml +++ b/android/hdr/AndroidManifest.xml @@ -15,6 +15,7 @@ android:label="High dynamic range" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:launchMode="singleTask" + android:screenOrientation="landscape" android:configChanges="orientation|screenSize|keyboardHidden"> diff --git a/android/hdr/build.py b/android/hdr/build.py index e1bc0e6a..d49b0b74 100644 --- a/android/hdr/build.py +++ b/android/hdr/build.py @@ -7,45 +7,38 @@ import glob APK_NAME = "vulkanHDR" SHADER_DIR = "hdr" ASSETS_MODELS = ["cube.obj", "sphere.obj", "teapot.dae", "torusknot.obj"] -ASSETS_TEXTURES = ["hdr_uffizi_bc6uf.DDS"] +ASSETS_TEXTURES = ["hdr_uffizi_bc6uf.DDS", "hrd_uffizi_rgba16_float.dds"] if subprocess.call("ndk-build", shell=True) == 0: print("Build successful") # Assets - if not os.path.exists("./assets"): - os.makedirs("./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 - 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": + for arg in sys.argv[1:]: + if arg == "-deploy": if subprocess.call("adb install -r %s.apk" % APK_NAME, shell=True) != 0: print("Could not deploy to device!") else: diff --git a/hdr/hdr.cpp b/hdr/hdr.cpp index 5814c2d8..6911abd7 100644 --- a/hdr/hdr.cpp +++ b/hdr/hdr.cpp @@ -610,7 +610,14 @@ public: // Load HDR texture (equirectangular projected) // VK_FORMAT_BC6H_UFLOAT_BLOCK is a compressed 16 bit unsigned floating point format for storing HDR content - textures.envmap.loadFromFile(getAssetPath() + "textures/hdr_uffizi_bc6uf.DDS", VK_FORMAT_BC6H_UFLOAT_BLOCK, vulkanDevice, queue); + if (deviceFeatures.textureCompressionBC) + { + textures.envmap.loadFromFile(getAssetPath() + "textures/hdr_uffizi_bc6uf.DDS", VK_FORMAT_BC6H_UFLOAT_BLOCK, vulkanDevice, queue); + } + else + { + textures.envmap.loadFromFile(getAssetPath() + "textures/hrd_uffizi_rgba16_float.dds", VK_FORMAT_R16G16B16A16_SFLOAT, vulkanDevice, queue); + } // Custom sampler with clamping adress mode vkDestroySampler(device, textures.envmap.sampler, nullptr);