Download script and note on (new) additional asset pack [skip ci]

This commit is contained in:
saschawillems 2017-04-21 23:38:21 +02:00
parent b672bee4e5
commit 1dd45a4ddf
4 changed files with 65 additions and 1 deletions

6
.gitignore vendored
View file

@ -208,3 +208,9 @@ vulkanCapsViewer/vulkanreport.json
# Android validation layer libraries
android/layers/*/*.so
# Downloadable assets
vulkan_asset_pack.*
data/textures/hdr/*.*
data/readme.txt
!data/textures/hdr/README.md

View file

@ -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.

25
data/README.md vendored Normal file
View file

@ -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.

29
download_assets.py Normal file
View file

@ -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()