diff --git a/.gitignore b/.gitignore index 60b5ae10..a2d2f979 100644 --- a/.gitignore +++ b/.gitignore @@ -207,4 +207,10 @@ vulkanCapsViewer/vulkanreport.json !bin/*.dll # Android validation layer libraries -android/layers/*/*.so \ No newline at end of file +android/layers/*/*.so + +# Downloadable assets +vulkan_asset_pack.* +data/textures/hdr/*.* +data/readme.txt +!data/textures/hdr/README.md \ No newline at end of file diff --git a/README.md b/README.md index 50cb2ca1..9d384d29 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ Note that you need [assimp](https://github.com/assimp/assimp) in order to compil Building on Android is done using the [Android NDK](http://developer.android.com/tools/sdk/ndk/index.html) and requires a device that supports Vulkan. Please see the [Android readme](./android/README.md) on how to build and deploy the examples. +## Additional asset pack + +**Note:** Binary assets (textures, models) will no longer be added directly to the repository to keep it's size down, so newer examples will require the download of an [additional asset pack](data/README.md). + ## Precompiled binaries Precompiled binaries for Windows (x64), Linux (x64) and Android can be [found here](http://vulkan.gpuinfo.org/examples.php). Note that these may not always be up-to-date with the repository. diff --git a/data/README.md b/data/README.md new file mode 100644 index 00000000..07d6359b --- /dev/null +++ b/data/README.md @@ -0,0 +1,25 @@ +# Additional asset pack + +Newer assets (textures and models) will no longer be added to the repository in order to keep it's size down. Especially HDR assets tend to be much larger than most of the ldr textures and compressing them is problematic due to the multi-platform target of the examples (Not all platforms support compressed HDR texture formats). + +So these are provided as a separate download required to run some of the newer examples. + +Examples that require assets from this pack will have a note in the header: +```cpp +/* +* Vulkan Example +* +* Note: Requires the separate (HDR) asset pack (see data/textures/hdr/README.md) +* +*/ +``` + +## Getting the asset pack + +### Option 1: Run the python script + +Run the [download_assets.py](../download_assets.py) python script which will download the asset pack and unpacks it into the appropriate folder. + +### Option 2: Manual download + +Download the asset pack from [http://vulkan.gpuinfo.org/downloads/vulkan_asset_pack.zip](http://vulkan.gpuinfo.org/downloads/vulkan_asset_pack.zip) and extract it in the ```data``` directory. \ No newline at end of file diff --git a/download_assets.py b/download_assets.py new file mode 100644 index 00000000..9aaf6783 --- /dev/null +++ b/download_assets.py @@ -0,0 +1,29 @@ +import sys +from urllib.request import urlretrieve +from zipfile import ZipFile + +ASSET_PACK_URL = 'http://vulkan.gpuinfo.org/downloads/vulkan_asset_pack.zip' +ASSET_PACK_FILE_NAME = 'vulkan_asset_pack.zip' + +print("Downloading asset pack from '%s'" % ASSET_PACK_URL) + +def reporthook(blocknum, blocksize, totalsize): + bytesread = blocknum * blocksize + if totalsize > 0: + percent = bytesread * 1e2 / totalsize + s = "\r%5.1f%% (%*d / %d bytes)" % (percent, len(str(totalsize)), bytesread, totalsize) + sys.stderr.write(s) + if bytesread >= totalsize: + sys.stderr.write("\n") + else: + sys.stderr.write("read %d\n" % (bytesread,)) + +urlretrieve(ASSET_PACK_URL, ASSET_PACK_FILE_NAME, reporthook) + +print("Download finished") + +print("Extracting assets") + +zip = ZipFile(ASSET_PACK_FILE_NAME, 'r') +zip.extractall("./") +zip.close() \ No newline at end of file