diff --git a/test/gltf-compare/createExecutable.sh b/test/gltf-compare/createExecutable.sh new file mode 100755 index 0000000000..754b1ed998 --- /dev/null +++ b/test/gltf-compare/createExecutable.sh @@ -0,0 +1,28 @@ +# Copyright (C) 2024 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#!/bin/bash + +source test/renderdiff/src/preamble.sh + +if [[ "$GITHUB_WORKFLOW" ]]; then + echo "This is meant to run locally (not part of the CI)" + exit 1 +else + GOLDEN_BRANCH=$(git log -1 | python3 test/renderdiff/src/commit_msg.py) +fi + +./build.sh -f "$@" -p desktop debug gltf_viewer +# -f -W -q arm64-v8a + diff --git a/test/gltf-compare/generate.sh b/test/gltf-compare/generate.sh new file mode 100755 index 0000000000..048af0d0df --- /dev/null +++ b/test/gltf-compare/generate.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Directory containing the GLTF files +GLTF_DIR="path/to/your/gltf/files" +GLTF_VIEWER_PATH="out/cmake-debug/samples/gltf_viewer" + +GLTF_OUT_DIR="`dirname $0`/generated" + +echo "The dirname is $GLTF_OUT_DIR" +# echo `dirname $0` +rm -rf $GLTF_OUT_DIR +mkdir -p $GLTF_OUT_DIR +# exit 0 + +# Base directory for the glTF-Sample-Assets repository +GLTF_SAMPLES_DIR="../glTF-Sample-Assets/Models" + +# Loop through each subdirectory in the base directory +find "$GLTF_SAMPLES_DIR" -type f -name "*.gltf" | while read -r gltf_file; do + # Get the base name of the file (e.g., "Box") + base_name=$(basename "$gltf_file" .gltf) + + echo "Processing $gltf_file..." + + # Run the gltf_viewer command + # You may need to adjust this path based on your project structure + ./out/cmake-debug/samples/gltf_viewer --api vulkan --batch=test/gltf-compare/test.json --headless "$gltf_file" + + # Rename the generated .js and .tif files + # The generated files are assumed to be in the same directory where the script is run + + mv "Base0.tif" "${base_name}.tif" + + # Move the newly renamed files to the Output directory + + mv "${base_name}.tif" "$GLTF_OUT_DIR/" + + echo "Generated files moved to $GLTF_OUT_DIR" + echo "---" +done + +echo "Script finished." \ No newline at end of file diff --git a/test/gltf-compare/test.json b/test/gltf-compare/test.json new file mode 100644 index 0000000000..9101e19f05 --- /dev/null +++ b/test/gltf-compare/test.json @@ -0,0 +1,9 @@ +[ + { + "name": "Base", + "base": { + "view.postProcessingEnabled": true, + "view.dithering": "NONE" + } + } +] \ No newline at end of file