github: add script and action for getting gltf assets (#9085)
- Script for getting models from glTF-Sample-Assets - Add support for reading gltf models from a file.
This commit is contained in:
@@ -23,6 +23,10 @@ function start_render_() {
|
||||
bash ${BUILD_COMMON_DIR}/get-mesa.sh
|
||||
fi
|
||||
|
||||
if [ ! -d ${GLTF_DIR} ]; then
|
||||
cat ${RENDERDIFF_TEST_DIR}/tests/gltf_models.txt | xargs bash ${BUILD_COMMON_DIR}/get-gltf-sample-assets.sh
|
||||
fi
|
||||
|
||||
# Install python deps
|
||||
python3 -m venv ${VENV_DIR}
|
||||
source ${VENV_DIR}/bin/activate
|
||||
|
||||
@@ -22,6 +22,7 @@ GOLDEN_OUTPUT_DIR="$(pwd)/out/renderdiff/goldens"
|
||||
RENDERDIFF_TEST_DIR="$(pwd)/test/renderdiff"
|
||||
MESA_DIR="$(pwd)/mesa/out/"
|
||||
VENV_DIR="$(pwd)/venv"
|
||||
GLTF_DIR="$(pwd)/gltf/Models"
|
||||
BUILD_COMMON_DIR="$(pwd)/build/common"
|
||||
|
||||
os_name=$(uname -s)
|
||||
|
||||
@@ -44,11 +44,22 @@ class RenderingConfig():
|
||||
class PresetConfig(RenderingConfig):
|
||||
def __init__(self, data, existing_models):
|
||||
RenderingConfig.__init__(self, data)
|
||||
models = data.get('models')
|
||||
if models:
|
||||
self.models = []
|
||||
|
||||
def _check(models):
|
||||
assert _is_list_of_strings(models)
|
||||
assert all(m in existing_models for m in models)
|
||||
|
||||
models = data.get('models')
|
||||
if models:
|
||||
_check(models)
|
||||
self.models = models
|
||||
model_list_file = data.get('model_list_file')
|
||||
if model_list_file and os.path.exists(model_list_file):
|
||||
with open(model_list_file, 'r') as f:
|
||||
models = list(filter(lambda a: len(a) > 0, map(lambda a: a.strip(), f.read().split('\n'))))
|
||||
_check(models)
|
||||
self.models += models
|
||||
|
||||
class TestConfig(RenderingConfig):
|
||||
def __init__(self, data, existing_models, presets):
|
||||
@@ -105,7 +116,9 @@ class RenderTestConfig():
|
||||
assert all(path.isdir(p) for p in model_search_paths)
|
||||
|
||||
model_paths = list(
|
||||
chain(*(glob.glob(f'{d}/**/*.glb', recursive=True) for d in model_search_paths)))
|
||||
chain(*(glob.glob(f'{d}/**/*.glb', recursive=True) for d in model_search_paths))) + \
|
||||
list(
|
||||
chain(*(glob.glob(f'{d}/**/*.gltf', recursive=True) for d in model_search_paths)))
|
||||
# This flatten the output for glob.glob
|
||||
self.models = {path.splitext(path.basename(model))[0]: model for model in model_paths}
|
||||
|
||||
|
||||
20
test/renderdiff/tests/gltf_models.txt
Normal file
20
test/renderdiff/tests/gltf_models.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
AlphaBlendModeTest
|
||||
AttenuationTest
|
||||
Box
|
||||
BoomBoxWithAxes
|
||||
BoxInterleaved
|
||||
BoxTextured
|
||||
BoxTexturedNonPowerOfTwo
|
||||
Duck
|
||||
IridescenceSuzanne
|
||||
Lantern
|
||||
MetalRoughSpheres
|
||||
NegativeScaleTest
|
||||
NormalTangentMirrorTest
|
||||
NormalTangentTest
|
||||
SpecularTest
|
||||
Sponza
|
||||
Suzanne
|
||||
TextureCoordinateTest
|
||||
TextureSettingsTest
|
||||
TwoSidedPlane
|
||||
Reference in New Issue
Block a user