diff --git a/.github/workflows/unity.yml b/.github/workflows/unity.yml new file mode 100644 index 00000000..5041af98 --- /dev/null +++ b/.github/workflows/unity.yml @@ -0,0 +1,489 @@ +name: Draco Unity library CI + +on: + # Trigger the workflow on pull request, + # but only for the main branch + pull_request: + branches: + - main + # Also trigger on release created events + release: + types: + - created + branches: + - unity + tags: + - unity* + workflow_dispatch: + +# env: +# # Emscripten version for Unity 2022.2 or newer +# EM_3_VERSION: 3.1.8 +# EM_3_CACHE_FOLDER: 'emsdk-3-cache' +# # Emscripten version for Unity 2021.2 and 2021.3 +# EM_2_VERSION: 2.0.19 +# EM_2_CACHE_FOLDER: 'emsdk-2-cache' +# # Emscripten version that comes with older Unity versions +# EM_1_VERSION: 1.38.48-fastcomp +# EM_1_CACHE_FOLDER: 'emsdk-1-cache' + +jobs: + + mac: + + runs-on: macOS-11 + + steps: + - uses: actions/checkout@v3 + + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + + - name: Install Ninja + run: brew install ninja + + - name: Configure macOS + # ARCHS_STANDARD explicitly enables Apple silicon on Xcode 12.2 + run: > + cmake . -G Ninja -B build_mac + -DCMAKE_BUILD_TYPE=MinSizeRel + -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build macOS + run: cmake --build build_mac --config MinSizeRel --target draco_unity + + - name: Configure iOS + run: > + cmake . -G Xcode -B build_ios + -DCMAKE_BUILD_TYPE=MinSizeRel + -DCMAKE_SYSTEM_NAME=iOS + -DCMAKE_OSX_ARCHITECTURES=armv7\;armv7s\;arm64 + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build iOS + run: cmake --build build_ios --config MinSizeRel --target draco_unity + - name: Build iOS Simulator + run: > + cmake + --build build_ios + --config MinSizeRel + --target draco_unity + -- + -sdk iphonesimulator + -arch "arm64" + -arch "x86_64" + EXECUTABLE_SUFFIX=-simulator.a + ONLY_ACTIVE_ARCH=NO + + - name: Configure tvOS + run: > + cmake . -G Xcode -B build_tvos + -DCMAKE_BUILD_TYPE=MinSizeRel + -DCMAKE_SYSTEM_NAME=tvOS + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.0 + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build tvOS + run: cmake --build build_tvos --config MinSizeRel --target draco_unity + - name: Build tvOS Simulator + run: > + cmake + --build build_tvos + --config MinSizeRel + --target draco_unity + -- + -sdk appletvsimulator + EXECUTABLE_SUFFIX=-simulator.a + ONLY_ACTIVE_ARCH=NO + + - name: Package Apple + run: | + mkdir draco_apple + mkdir draco_apple/x86_64 + mv build_mac/draco_unity.bundle draco_apple/x86_64 + mkdir -p draco_apple/iOS + mv build_ios/MinSizeRel-iphoneos/libdraco_unity.a draco_apple/iOS + mv build_ios/MinSizeRel-iphonesimulator/libdraco_unity-simulator.a draco_apple/iOS + mkdir -p draco_apple/tvOS + mv build_tvos/MinSizeRel-appletvos/libdraco_unity.a draco_apple/tvOS + mv build_tvos/MinSizeRel-appletvsimulator/libdraco_unity-simulator.a draco_apple/tvOS + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: draco_apple + path: draco_apple + + + windows: + + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v3 + + - name: Configure Windows x64 + run: > + cmake . -G "Visual Studio 17 2022" -A x64 -B build_win_64 + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build Windows x64 + run: cmake --build build_win_64 --config MinSizeRel --target draco_unity + + - name: Configure Windows Win32 + run: > + cmake . -G "Visual Studio 17 2022" -A Win32 -B build_win_32 + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build Windows Win32 + run: cmake --build build_win_32 --config MinSizeRel --target draco_unity + + - name: Configure Windows ARM64 + run: > + cmake . -G "Visual Studio 17 2022" -A ARM64 -B build_win_arm64 + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build Windows ARM64 + run: cmake --build build_win_arm64 --config MinSizeRel --target draco_unity + + # Universal Windows Platform + - name: Configure Universal Windows Platform ARM + run: > + cmake . -G "Visual Studio 17 2022" -A ARM -B build_uwp_arm + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + -DCMAKE_SYSTEM_NAME:String=WindowsStore + -DCMAKE_SYSTEM_VERSION:String="10.0" + - name: Build Universal Windows Platform ARM + run: cmake --build build_uwp_arm --config MinSizeRel --target draco_unity + + - name: Configure Universal Windows Platform ARM64 + run: > + cmake . -G "Visual Studio 17 2022" -A ARM64 -B build_uwp_arm64 + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + -DCMAKE_SYSTEM_NAME:String=WindowsStore + -DCMAKE_SYSTEM_VERSION:String="10.0" + - name: Build Universal Windows Platform ARM64 + run: cmake --build build_uwp_arm64 --config MinSizeRel --target draco_unity + + - name: Configure Universal Windows Platform Win32 + run: > + cmake . -G "Visual Studio 17 2022" -A Win32 -B build_uwp_x86 + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + -DCMAKE_SYSTEM_NAME:String=WindowsStore + -DCMAKE_SYSTEM_VERSION:String="10.0" + - name: Build Universal Windows Platform Win32 + run: cmake --build build_uwp_x86 --config MinSizeRel --target draco_unity + + - name: Configure Universal Windows Platform x64 + run: > + cmake . -G "Visual Studio 17 2022" -A x64 -B build_uwp_x64 + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + -DCMAKE_SYSTEM_NAME:String=WindowsStore + -DCMAKE_SYSTEM_VERSION:String="10.0" + - name: Build Universal Windows Platform x64 + run: cmake --build build_uwp_x64 --config MinSizeRel --target draco_unity + + - name: Package Windows + run: | + mkdir draco_win/x86 + mkdir draco_win/x86_64 + mkdir draco_win/WSA/ARM + mkdir draco_win/WSA/ARM64 + mkdir draco_win/WSA/x86 + mkdir draco_win/WSA/x64 + mkdir draco_win/Windows/ARM64 + mv build_win_32\MinSizeRel\draco_unity.dll draco_win/x86 + mv build_win_64\MinSizeRel\draco_unity.dll draco_win/x86_64 + mv build_uwp_arm\MinSizeRel\draco_unity.dll draco_win/WSA/ARM + mv build_uwp_arm64\MinSizeRel\draco_unity.dll draco_win/WSA/ARM64 + mv build_uwp_x86\MinSizeRel\draco_unity.dll draco_win/WSA/x86 + mv build_uwp_x64\MinSizeRel\draco_unity.dll draco_win/WSA/x64 + mv build_win_arm64\MinSizeRel\draco_unity.dll draco_win/Windows/ARM64 + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: draco_win + path: draco_win + + + linux: + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + # - name: Setup cache + # id: cache-system-libraries + # uses: actions/cache@v3 + # with: + # path: ${{env.EM_2_CACHE_FOLDER}} + # key: ${{env.EM_2_VERSION}}-${{ runner.os }} + - name: Install Ninja + shell: bash + run: sudo apt-get install ninja-build + + # Android + - name: Install Android NDK + uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r21e + add-to-path: false + + - name: Configure Android arm64-v8a + run: > + cmake -B build_android_arm64-v8a + -DANDROID_ABI=arm64-v8a + -DCMAKE_BUILD_TYPE=MinSizeRel + -DANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} + -DCMAKE_TOOLCHAIN_FILE="${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build Android arm64-v8a + run: cmake --build build_android_arm64-v8a --target draco_unity -j + + - name: Configure Android armeabi-v7a + run: > + cmake -B build_android_armeabi-v7a + -DANDROID_ABI=armeabi-v7a + -DCMAKE_BUILD_TYPE=MinSizeRel + -DANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} + -DCMAKE_TOOLCHAIN_FILE="${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build Android armeabi-v7a + run: cmake --build build_android_armeabi-v7a --target draco_unity -j + + - name: Configure Android x86 + run: > + cmake -B build_android_x86 + -DANDROID_ABI=x86 + -DCMAKE_BUILD_TYPE=MinSizeRel + -DANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} + -DCMAKE_TOOLCHAIN_FILE="${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build Android x86 + run: cmake --build build_android_x86 --target draco_unity -j + + - name: Configure Android x86_64 + run: > + cmake -B build_android_x86_64 + -DANDROID_ABI=x86_64 + -DCMAKE_BUILD_TYPE=MinSizeRel + -DANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} + -DCMAKE_TOOLCHAIN_FILE="${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build Android x86_64 + run: cmake --build build_android_x86_64 --target draco_unity -j + + # # Emscripten + # - name: Setup Emscripten + # uses: mymindstorm/setup-emsdk@v12 + # with: + # version: ${{env.EM_2_VERSION}} + # actions-cache-folder: ${{env.EM_2_CACHE_FOLDER}} + # - name: Configure WebAssembly + # run: > + # emcmake cmake -B build_web + # -DCMAKE_BUILD_TYPE=MinSizeRel + # -DDRACO_JS_GLUE=OFF + # -DDRACO_UNITY_PLUGIN=ON + # -DDRACO_GLTF_BITSTREAM=ON + # -DDRACO_BACKWARDS_COMPATIBILITY=OFF + # - name: Build WebAssembly + # run: cmake --build build_web --target draco_unity -j + + # Linux artifacts + - name: Package Linux + run: | + # mkdir -p draco_linux/WebGL/2021 + # mv build_web/libdraco_unity.a draco_linux/WebGL/2021 + mkdir -p draco_linux/Android/libs/arm64-v8a + mkdir -p draco_linux/Android/libs/armeabi-v7a + mkdir -p draco_linux/Android/libs/x86 + mkdir -p draco_linux/Android/libs/x86_64 + mv build_android_arm64-v8a/libdraco_unity.so \ + draco_linux/Android/libs/arm64-v8a + mv build_android_armeabi-v7a/libdraco_unity.so \ + draco_linux/Android/libs/armeabi-v7a + mv build_android_x86/libdraco_unity.so \ + draco_linux/Android/libs/x86 + mv build_android_x86_64/libdraco_unity.so \ + draco_linux/Android/libs/x86_64 + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: draco_linux + path: draco_linux + + + # linux_emscripten_3: + + # runs-on: ubuntu-22.04 + + # steps: + # - uses: actions/checkout@v3 + # - name: Setup cache + # id: cache-system-libraries + # uses: actions/cache@v3 + # with: + # path: ${{env.EM_3_CACHE_FOLDER}} + # key: ${{env.EM_3_VERSION}}-${{ runner.os }} + + # # Emscripten 3 + # - name: Setup Emscripten + # uses: mymindstorm/setup-emsdk@v12 + # with: + # version: ${{env.EM_3_VERSION}} + # actions-cache-folder: ${{env.EM_3_CACHE_FOLDER}} + # - name: Configure WebAssembly + # run: > + # EMSCRIPTEN="$EMSDK/upstream/emscripten" emcmake cmake -B build_web + # -DCMAKE_BUILD_TYPE=MinSizeRel + # -DDRACO_JS_GLUE=OFF + # -DDRACO_UNITY_PLUGIN=ON + # -DDRACO_GLTF_BITSTREAM=ON \ + # -DDRACO_BACKWARDS_COMPATIBILITY=OFF + # - name: Build WebAssembly + # run: cmake --build build_web --target draco_unity -j + + # # Artifacts + # - name: Package Linux Emscripten 3 + # run: | + # mkdir -p draco_emscripten_3/WebGL/2022 + # mv build_web/libdraco_unity.a draco_emscripten_3/WebGL/2022 + # - name: Upload artifact + # uses: actions/upload-artifact@v3 + # with: + # name: draco_emscripten_3 + # path: draco_emscripten_3 + + + linux_legacy: + + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + # - name: Setup cache + # id: cache-system-libraries + # uses: actions/cache@v3 + # with: + # path: ${{env.EM_1_CACHE_FOLDER}} + # key: ${{env.EM_1_VERSION}}-${{ runner.os }} + + - name: Get latest CMake and ninja + uses: lukka/get-cmake@latest + + # Linux 64 + - name: Configure Linux 64 + run: > + cmake . -G Ninja -B build_linux_64 + -DCMAKE_BUILD_TYPE=MinSizeRel + -DDRACO_UNITY_PLUGIN=ON + -DDRACO_GLTF_BITSTREAM=ON + -DDRACO_BACKWARDS_COMPATIBILITY=OFF + - name: Build Linux 64 + run: cmake --build build_linux_64 --target draco_unity -j + + # # Emscripten 1 + # - name: Setup Emscripten 1 + # uses: numworks/setup-emscripten@latest + # with: + # sdk: ${{env.EM_1_VERSION}} + # - name: Configure WebAssembly 1 + # run: > + # emcmake cmake -B build_web + # -DCMAKE_BUILD_TYPE=MinSizeRel + # -DEMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES=1 + # -DDRACO_JS_GLUE=OFF + # -DDRACO_UNITY_PLUGIN=ON + # -DDRACO_GLTF_BITSTREAM=ON + # -DDRACO_BACKWARDS_COMPATIBILITY=OFF + # - name: Build WebAssembly 1 + # run: cmake --build build_web --target draco_unity -j + + # Linux legacy artifacts + - name: Package Linux Legacy + run: | + mkdir -p draco_linux_legacy/x86_64 + mv build_linux_64/libdraco_unity.so draco_linux_legacy/x86_64 + # mkdir -p draco_linux_legacy/WebGL/2020 + # mv build_web/libdraco_unity.bc draco_linux_legacy/WebGL/2020 + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: draco_linux_legacy + path: draco_linux_legacy + + + + combine: + name: combine artifacts + runs-on: ubuntu-22.04 + needs: + - mac + - windows + - linux + - linux_legacy + # - linux_emscripten_3 + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + - name: Display structure of downloaded files + run: ls -R + working-directory: artifacts + - name: Combine + run: | + mkdir draco + cp -r artifacts/draco_apple/* draco + cp -r artifacts/draco_win/* draco + cp -r artifacts/draco_linux/* draco + cp -r artifacts/draco_linux_legacy/* draco + # cp -r artifacts/draco_emscripten_3/* draco + - name: Zip + run: zip -r draco.zip draco + - name: Upload release assets + uses: AButler/upload-release-assets@v2.0 + if: github.event_name == 'release' && github.event.action == 'created' + with: + files: draco.zip + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: draco + path: draco + - name: Delete obsolete artifacts + uses: geekyeggo/delete-artifact@v2 + with: + name: | + draco_apple + draco_win + draco_linux + draco_linux_legacy + # draco_emscripten_3 diff --git a/.gitignore b/.gitignore index 522866ee..067659fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ docs/_site + +/.vscode +/build* + +.DS_Store diff --git a/.yamato/environments.metafile b/.yamato/environments.metafile new file mode 100644 index 00000000..4f8aa63a --- /dev/null +++ b/.yamato/environments.metafile @@ -0,0 +1,44 @@ +log_path: "test_results~" + +artifactory_url: "https://artifactory.prd.cds.internal.unity3d.com/artifactory" +homebrew_url: "git@github.cds.internal.unity3d.com:unity/homebrew-unity.git" + +sonarqube_ci: + url: "https://sonarqube.internal.unity3d.com" + dependency: + name: "com.unity.ide.rider" + version: "3.0.13" + analysis: + - pr + - branch + +generic_project_path: .yamato/common/test_project~ +player_path: build/player + +npm_registry: "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates" +upm_ci_registry: "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm" + +ci: + win: + env_sonar_token: "!SONARQUBE_PROD_ACCESS_TOKEN!" + env_unity_path: "%UNITY_EDITOR_PATH%" + env_yamato_src_dir: "%YAMATO_SOURCE_DIR%" + tool_utr: "utr.bat" + android: + env_sonar_token: "!SONARQUBE_PROD_ACCESS_TOKEN!" + env_unity_path: "%UNITY_EDITOR_PATH%" + env_yamato_src_dir: "%YAMATO_SOURCE_DIR%" + tool_utr: "utr.bat" + mac: + env_sonar_token: "$SONARQUBE_PROD_ACCESS_TOKEN" + env_unity_path: "$UNITY_EDITOR_PATH" + env_yamato_src_dir: "$YAMATO_SOURCE_DIR" + tool_utr: "./utr" + +editor_component: + android: + args: "-c Android" + ios: + args: "-c iOS" + +build_and_run: [ build, run ] diff --git a/.yamato/project.metafile b/.yamato/project.metafile new file mode 100644 index 00000000..765279a3 --- /dev/null +++ b/.yamato/project.metafile @@ -0,0 +1,31 @@ +is_monorepo: !!bool true +enable_nightly: !!bool true +using_submodule: !!bool false +git_main_branch: main + +enable_codecov: !!bool false +enable_sonarqube: !!bool true + +upm_test_platforms: + - name: win + type: Unity::VM + flavor: b1.large + image: package-ci/win10:v4 + - name: mac + type: Unity::VM::osx + image: package-ci/macos-13:v4 + flavor: m1.mac + +web_packages: + - name: 2020 + emscripten_version: 1.38.48-fastcomp + unity_version: 2020.3 + - name: 2021 + emscripten_version: 2.0.19 + unity_version: 2021.2 + - name: 2022 + emscripten_version: 3.1.8 + unity_version: 2022.2 + - name: 2023 + emscripten_version: 3.1.38 + unity_version: 2023.2 diff --git a/.yamato/upm-ci.yml b/.yamato/upm-ci.yml new file mode 100644 index 00000000..92e6d759 --- /dev/null +++ b/.yamato/upm-ci.yml @@ -0,0 +1,166 @@ +{% metadata_file .yamato/environments.metafile %} +{% metadata_file .yamato/project.metafile %} +--- +{% for pkg in web_packages -%} +{% assign emscripten_version_suffix = pkg.emscripten_version | split: "-" | last %} +emscripten_{{pkg.name}}: + name: "Emscripten {{ pkg.name }}" + agent: + type: Unity::VM + image: package-ci/ubuntu-22.04:v4 + flavor: b1.small + commands: + +# TODO: Remove fastcomp support once 2020 is dropped +{% if emscripten_version_suffix == "fastcomp" %} + ## Fastcomp requires legacy version (tag 3.1.29 or sooner; Unity fork latest synced tag is 2.0.18) + - git clone -b 2.0.18 --single-branch https://github.com/Unity-Technologies/emsdk.git +{% else %} + # Clone Emscripten + - git clone -b 3.1.38-unity --single-branch https://github.com/Unity-Technologies/emsdk.git +{% endif %} + + # Install and activate correct Emscripten version + - | + pushd emsdk + ./emsdk install {{ pkg.emscripten_version }} + ./emsdk activate {{ pkg.emscripten_version }} + popd + + # Configure +{% if emscripten_version_suffix == "fastcomp" %} + - | + source ./emsdk/emsdk_env.sh + emcmake cmake . -B build_web -DEMSCRIPTEN_GENERATE_BITCODE_STATIC_LIBRARIES=1 -DCMAKE_BUILD_TYPE=MinSizeRel -DDRACO_JS_GLUE=OFF -DDRACO_UNITY_PLUGIN=ON -DDRACO_GLTF_BITSTREAM=ON -DDRACO_BACKWARDS_COMPATIBILITY=OFF +{% else %} + - | + source ./emsdk/emsdk_env.sh + EMSCRIPTEN="$EMSDK/upstream/emscripten" emcmake cmake . -B build_web -DCMAKE_BUILD_TYPE=MinSizeRel -DDRACO_JS_GLUE=OFF -DDRACO_UNITY_PLUGIN=ON -DDRACO_GLTF_BITSTREAM=ON -DDRACO_BACKWARDS_COMPATIBILITY=OFF +{% endif %} + + # Build + - | + source ./emsdk/emsdk_env.sh + cmake --build build_web --target draco_unity + + # Create and fill results folder + - | + mkdir -p wasm-binaries~/{{ pkg.name }} + mv build_web/libdraco_unity.* wasm-binaries~/{{ pkg.name }} + + artifacts: + wasm-binaries: + paths: + - "wasm-binaries~/**/*" +{% endfor -%} + +{% for pkg in web_packages -%} +upm_ci_pack_{{pkg.name}}: + name: "Pack {{ pkg.name }}" + agent: + type: Unity::VM + image: package-ci/ubuntu-22.04:v4 + flavor: b1.small + commands: + # Install upm-ci + - npm install upm-ci-utils@stable -g --registry {{upm_ci_registry}} + + # Move binaries into package + - mv wasm-binaries~/{{ pkg.name }}/lib*.* UnityPackages/com.unity.cloud.draco.webgl-{{ pkg.name }}/Runtime/Plugins/WebGL + + # Pack + - upm-ci package pack --package-path "UnityPackages/com.unity.cloud.draco.webgl-{{ pkg.name }}" + dependencies: + - .yamato/upm-ci.yml#emscripten_{{pkg.name}} + artifacts: + packages: + paths: + - "upm-ci~/packages/**/*" +{% endfor -%} + +{% for pkg in web_packages -%} +{% for platform in upm_test_platforms -%} +upm_ci_test_{{pkg.name}}_{{pkg.unity_version}}_{{platform.name}}: + name : "Test Editor {{pkg.name}} ({{ pkg.unity_version }}) on {{ platform.name }}" + agent: + type: {{platform.type}} + image: {{platform.image}} + flavor: {{platform.flavor}} + commands: + - npm install upm-ci-utils@stable -g --registry {{upm_ci_registry}} + - upm-ci package test --package-path "UnityPackages/com.unity.cloud.draco.webgl-{{ pkg.name }}" -u {{pkg.unity_version}} --type isolation-tests --enable-load-and-test-isolation + artifacts: + packages: + paths: + - "upm-ci~/packages/**/*" + logs: + paths: + - "upm-ci~/test-results/**/*" + dependencies: + - .yamato/upm-ci.yml#upm_ci_pack_{{pkg.name}} +{% endfor -%} +{% endfor -%} + +{% for pkg in web_packages -%} +upm_ci_publish_dry_run_{{pkg.name}}: + name: "Dry Run Publish {{ pkg.name }}" + agent: + type: Unity::VM + image: package-ci/win10:v4 + flavor: b1.small + commands: + - npm install upm-ci-utils@stable -g --registry {{ upm_ci_registry }} + # going for dry run until we're ready to do a real publish + - upm-ci package publish --package-path "UnityPackages/com.unity.cloud.draco.webgl-{{ pkg.name }}" --dry-run + dependencies: +{% for platform in upm_test_platforms -%} + - .yamato/upm-ci.yml#upm_ci_test_{{pkg.name}}_{{pkg.unity_version}}_{{platform.name}} +{% endfor -%} + artifacts: + logs_{{pkg.name}}: + paths: + - "{{ log_path }}/**/*" + package: + paths: + - "upm-ci~/packages/*.tgz" +{% endfor -%} + + +upm_ci_publish_dry_run: + name: "Dry Run Publish" + dependencies: +{% for pkg in web_packages -%} + - .yamato/upm-ci.yml#upm_ci_publish_dry_run_{{pkg.name}} +{% endfor -%} + + +{% for pkg in web_packages -%} +upm_ci_publish_{{pkg.name}}: + name: "Publish to Internal Registry {{ pkg.name }}" + agent: + type: Unity::VM + image: package-ci/win10:v4 + flavor: b1.small + commands: + - npm install upm-ci-utils@stable -g --registry {{ upm_ci_registry }} + # going for dry run until we're ready to do a real publish + - upm-ci package publish --package-path "UnityPackages/com.unity.cloud.draco.webgl-{{ pkg.name }}" + dependencies: +{% for platform in upm_test_platforms -%} + - .yamato/upm-ci.yml#upm_ci_test_{{pkg.name}}_{{pkg.unity_version}}_{{platform.name}} +{% endfor -%} + artifacts: + logs_{{pkg.name}}: + paths: + - "{{ log_path }}/**/*" + package: + paths: + - "upm-ci~/packages/*.tgz" +{% endfor -%} + +upm_ci_publish: + name: "Publish to Internal Registry" + dependencies: +{% for pkg in web_packages -%} + - .yamato/upm-ci.yml#upm_ci_publish_{{pkg.name}} +{% endfor -%} diff --git a/CMakeLists.txt b/CMakeLists.txt index a93267d2..51bfe48e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations under # the License. -cmake_minimum_required(VERSION 3.12 FATAL_ERROR) +cmake_minimum_required(VERSION 3.15 FATAL_ERROR) project(draco C CXX) if(NOT CMAKE_BUILD_TYPE) @@ -533,6 +533,10 @@ list(APPEND draco_unity_plug_sources "${draco_src_root}/unity/draco_unity_plugin.cc" "${draco_src_root}/unity/draco_unity_plugin.h") +list(APPEND draco_unity_enc_plug_sources + "${draco_src_root}/unity/draco_unity_enc_plugin.cc" + "${draco_src_root}/unity/draco_unity_enc_plugin.h") + list(APPEND draco_maya_plug_sources "${draco_src_root}/maya/draco_maya_plugin.cc" "${draco_src_root}/maya/draco_maya_plugin.h") @@ -1049,12 +1053,43 @@ else() endif() if(DRACO_UNITY_PLUGIN) - if(IOS) + if(IOS OR EMSCRIPTEN OR CMAKE_SYSTEM_NAME STREQUAL "tvOS") set(unity_decoder_lib_type STATIC) + elseif(CMAKE_SYSTEM_NAME STREQUAL "visionOS") + set(unity_decoder_lib_type SHARED) else() set(unity_decoder_lib_type MODULE) endif() + set(unity_objlib_dependency draco_unity_plugin) + + list(APPEND unity_objlib_dependency + # Link selected object libs directly instead of ${draco_plugin_dependency} + # minimizes build size by omitting animation/IO/transcoder related symbols + # results in a single static lib file (no dependency on target `draco`) + draco_attributes + draco_compression_attributes_dec + draco_compression_attributes_enc + draco_compression_attributes_pred_schemes_dec + draco_compression_attributes_pred_schemes_enc + draco_compression_bit_coders + draco_compression_decode + draco_compression_encode + draco_compression_entropy + draco_compression_mesh_dec + draco_compression_mesh_enc + draco_compression_point_cloud_dec + draco_compression_point_cloud_enc + draco_core + draco_mesh + draco_metadata + draco_metadata_dec + draco_metadata_enc + draco_point_cloud + draco_points_dec + draco_points_enc + ) + draco_add_library( NAME draco_unity_plugin TYPE OBJECT @@ -1063,16 +1098,23 @@ else() INCLUDES ${draco_include_paths}) draco_add_library( - NAME dracodec_unity + NAME draco_unity_enc_plugin + TYPE OBJECT + SOURCES ${draco_unity_enc_plug_sources} + DEFINES ${draco_defines} + INCLUDES ${draco_include_paths}) + + draco_add_library( + NAME draco_unity TYPE ${unity_decoder_lib_type} DEFINES ${draco_defines} INCLUDES ${draco_include_paths} - OBJLIB_DEPS draco_unity_plugin - LIB_DEPS ${draco_plugin_dependency}) + OBJLIB_DEPS ${unity_objlib_dependency} draco_unity_enc_plugin + ) - # For Mac, we need to build a .bundle for the unity plugin. - if(APPLE) - set_target_properties(dracodec_unity PROPERTIES BUNDLE true) + # For macOS, we need to build a .bundle for the unity plugin. + if(APPLE AND CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set_target_properties(draco_unity PROPERTIES BUNDLE true) endif() endif() diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/CHANGELOG.md b/UnityPackages/com.unity.cloud.draco.webgl-2020/CHANGELOG.md new file mode 100644 index 00000000..b9736716 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/CHANGELOG.md @@ -0,0 +1,31 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2023-12-15 + +### Fixed + +- Added copy of license to `Third Party Notices.md` + +## [1.0.0-pre.2] - 2023-11-13 + +### Added + +- Empty runtime tests + +### Changed + +- Increased minimum required version to Unity 2020.3 + +### Fixed + +- Removed warning about missing main package when it was installed as indirect dependency +- Correct namespace for Editor tests + +## [1.0.0-pre.1] - 2023-11-03 + +Initial sub package publication diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/CHANGELOG.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/CHANGELOG.md.meta new file mode 100644 index 00000000..bd0c1721 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c64fbbf7ad61f48138ee945a58fc837d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Documentation~/api_index.md b/UnityPackages/com.unity.cloud.draco.webgl-2020/Documentation~/api_index.md new file mode 100644 index 00000000..62116d29 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Documentation~/api_index.md @@ -0,0 +1,17 @@ +--- +uid: api-index +--- + +# Draco for Unity WebGL Sub-Package API Documentation + +This package does not provide any public API. Instead please consult the documentation of its main package [Draco for Unity][DracoForUnity]. + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Documentation~/index.md b/UnityPackages/com.unity.cloud.draco.webgl-2020/Documentation~/index.md new file mode 100644 index 00000000..58012a7e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Documentation~/index.md @@ -0,0 +1,16 @@ +# Draco for Unity WebGL Sub-Package Documentation + +This package contains a Unity® version specific WebGL native library of Draco™ (in the form of pre-compiled, binary [WebAssembly][wasm]). + +By itself it provides no functionality and should not get installed manually. It is a sub-package of its main package [Draco for Unity][DracoForUnity], which will install it automatically. If the main package is removed, this sub-package will remove itself automatically as well. + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com +[wasm]: https://webassembly.org/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor.meta new file mode 100644 index 00000000..e9271113 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f80dedebc7bb4fbe902d6e26074c807 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts.meta new file mode 100644 index 00000000..8c11f8db --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a7f6146f61be4586b8fd6ee6c4d40ef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/Draco.Webgl-2020.Editor.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/Draco.Webgl-2020.Editor.asmdef new file mode 100644 index 00000000..f242fe9d --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/Draco.Webgl-2020.Editor.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Draco.Webgl-2020.Editor", + "rootNamespace": "", + "references": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/Draco.Webgl-2020.Editor.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/Draco.Webgl-2020.Editor.asmdef.meta new file mode 100644 index 00000000..e391fc5c --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/Draco.Webgl-2020.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a57b457131de14eecb45ae7aa1283957 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/SubPackageCleanup.cs b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/SubPackageCleanup.cs new file mode 100644 index 00000000..bf168874 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/SubPackageCleanup.cs @@ -0,0 +1,41 @@ +using System.Threading.Tasks; +using UnityEditor; +using UnityEditor.PackageManager; +using UnityEngine; +using UnityEngine.Assertions; +using System.Linq; + +namespace SubPackage +{ + static class SubPackageCleanup + { + + const string k_Name = "com.unity.cloud.draco.webgl-2020"; + const string k_DisplayName = "Draco for Unity WebGL 2020"; + + static readonly string[] k_MainPackageNames = { + "com.unity.cloud.draco", + "com.atteneder.draco" + }; + +#if !DISABLE_SUB_PACKAGE_CHECK + [InitializeOnLoadMethod] +#endif + static async void InitializeOnLoad() + { + var request = Client.List(offlineMode: true, includeIndirectDependencies: true); + + while (!request.IsCompleted) + await Task.Yield(); + + Assert.AreEqual(StatusCode.Success, request.Status); + + var mainPackageInManifest = request.Result.Select(package => package.name).Intersect(k_MainPackageNames).Any(); + + if (!mainPackageInManifest) + { + Debug.LogWarning($"Package {k_DisplayName} ({k_Name}) is missing its main package Draco for Unity and should get removed."); + } + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/SubPackageCleanup.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/SubPackageCleanup.cs.meta new file mode 100644 index 00000000..36f0060e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Editor/Scripts/SubPackageCleanup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1f2dafca8575b4ba28a3606a0d099668 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/LICENSE.md b/UnityPackages/com.unity.cloud.draco.webgl-2020/LICENSE.md new file mode 100644 index 00000000..8bef61a0 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/LICENSE.md @@ -0,0 +1,190 @@ +Draco for Unity WebGL 2020 copyright © 2023 Unity Technologies + +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. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/LICENSE.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/LICENSE.md.meta new file mode 100644 index 00000000..e8b0bc70 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a26b6bf724d744387907396fd3acf00c +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/README.md b/UnityPackages/com.unity.cloud.draco.webgl-2020/README.md new file mode 100644 index 00000000..7c3a8894 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/README.md @@ -0,0 +1,24 @@ +# Draco for Unity WebGL + +This package contains a Unity® version specific WebGL native library of Draco™ (in the form of pre-compiled, binary [WebAssembly][wasm]). + +By itself it provides no functionality. It is a sub-package of its main package [Draco for Unity][DracoForUnity]. + +## Documentation + +- [Package Documentation](Documentation~/index.md) + +## License + +- [License](LICENSE.md). + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com +[wasm]: https://webassembly.org/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/README.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/README.md.meta new file mode 100644 index 00000000..2850453a --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b6579a96d68c04f228541c77d3c5f9d5 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime.meta new file mode 100644 index 00000000..2d55e345 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d0c51af3fbe11462abb9bb1178eb2f1f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins.meta new file mode 100644 index 00000000..50ec821e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 048800f5e23504c4c9752c50e5afcd4c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL.meta new file mode 100644 index 00000000..6609f053 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4810bdff38bf748dcb8a511027328375 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL/libdraco_unity.bc b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL/libdraco_unity.bc new file mode 100644 index 00000000..2e76cd11 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL/libdraco_unity.bc @@ -0,0 +1 @@ +This file is just a placeholder. Replace it with the actual binary library before packaging a release. diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL/libdraco_unity.bc.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL/libdraco_unity.bc.meta new file mode 100644 index 00000000..1613a496 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL/libdraco_unity.bc.meta @@ -0,0 +1,120 @@ +fileFormatVersion: 2 +guid: 692d6c209477c4cb1bc13b62f8de2477 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 0 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + Exclude tvOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: WebGL + second: + enabled: 1 + settings: {} + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + - first: + tvOS: tvOS + second: + enabled: 0 + settings: + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests.meta new file mode 100644 index 00000000..42d9088a --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa64b979bff5d4d99949c13d66629961 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor.meta new file mode 100644 index 00000000..6ff19f80 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f50a28e5c18e4f668ea0c95beca5f9e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/Draco.Webgl-2020.Editor.Tests.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/Draco.Webgl-2020.Editor.Tests.asmdef new file mode 100644 index 00000000..91bd599c --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/Draco.Webgl-2020.Editor.Tests.asmdef @@ -0,0 +1,24 @@ +{ + "name": "Draco.Webgl-2020.Editor.Tests", + "rootNamespace": "", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "Unity.Mathematics" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/Draco.Webgl-2020.Editor.Tests.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/Draco.Webgl-2020.Editor.Tests.asmdef.meta new file mode 100644 index 00000000..fcf93abe --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/Draco.Webgl-2020.Editor.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fe6036014c2d74ed5b4b69b6b0a6c38a +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/WebglEditorTests.cs b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/WebglEditorTests.cs new file mode 100644 index 00000000..0c7d7f99 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/WebglEditorTests.cs @@ -0,0 +1,29 @@ +using System.IO; +using NUnit.Framework; +using UnityEngine; +using File = UnityEngine.Windows.File; + +namespace Draco.Webgl.Editor.Tests +{ + class WebglEditorTests + { + const string k_PackagePrefix = "Packages/com.unity.cloud.draco.webgl-2020/Runtime/Plugins/WebGL"; + + static readonly string[] k_WebglBinaries = { + $"{k_PackagePrefix}/libdraco_unity.bc" + }; + + [Test] + public void CheckNativeLibSize() + { + foreach (var webglBinary in k_WebglBinaries) + { + Assert.IsTrue(File.Exists(webglBinary)); + var fi = new FileInfo(webglBinary); + // In source (GIT) the native WebGL library files are placeholders with a few bytes of text in them. + // The CI will replace them with actual binaries, all significantly bigger than 1024 bytes. + Assert.Greater(fi.Length, 1024); + } + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/WebglEditorTests.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/WebglEditorTests.cs.meta new file mode 100644 index 00000000..489185bb --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Editor/WebglEditorTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f5eb616797dda46bcb26e589af0f1060 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime.meta new file mode 100644 index 00000000..ad766ae4 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c6f0c13cebcc547d2b030d1cc9dc1dd6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/Draco.Webgl-2020.Tests.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/Draco.Webgl-2020.Tests.asmdef new file mode 100644 index 00000000..e78d09d2 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/Draco.Webgl-2020.Tests.asmdef @@ -0,0 +1,20 @@ +{ + "name": "Draco.Webgl-2020.Tests", + "rootNamespace": "Draco.Tests", + "references": [ + "UnityEngine.TestRunner" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": true, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/Draco.Webgl-2020.Tests.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/Draco.Webgl-2020.Tests.asmdef.meta new file mode 100644 index 00000000..a92e8e8c --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/Draco.Webgl-2020.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cb9d3968bd2a0428e9fe608bf14cdc76 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/DummyTest.cs b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/DummyTest.cs new file mode 100644 index 00000000..32d67fb5 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/DummyTest.cs @@ -0,0 +1,14 @@ +using UnityEngine; +using NUnit.Framework; + +namespace Draco.Tests +{ + class DummyTest + { + [Test] + public void Foo() + { + Assert.AreEqual(42,42); + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/DummyTest.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/DummyTest.cs.meta new file mode 100644 index 00000000..0d7de45e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Tests/Runtime/DummyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 29aea59c7d3c34b9cb5964e7c8e37b2a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Third Party Notices.md b/UnityPackages/com.unity.cloud.draco.webgl-2020/Third Party Notices.md new file mode 100644 index 00000000..1d5bcb3b --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Third Party Notices.md @@ -0,0 +1,234 @@ +# Third party notices + +This package contains third-party software components governed by the license(s) indicated below: + +## Draco + +Component Name: Draco™ 3D Data Compression + +License Type: Apache 2.0 + +Copyright © 2018 The Draco Authors + +[Draco][Draco] + +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. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + +## Trademarks + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[Draco]: https://github.com/google/draco +[GoogleLLC]: https://about.google/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/Third Party Notices.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/Third Party Notices.md.meta new file mode 100644 index 00000000..82de3c29 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/Third Party Notices.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8246ead4c0f034134a737cce7030c13b +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/package.json b/UnityPackages/com.unity.cloud.draco.webgl-2020/package.json new file mode 100644 index 00000000..8c244276 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/package.json @@ -0,0 +1,7 @@ +{ + "name": "com.unity.cloud.draco.webgl-2020", + "version": "1.0.0", + "displayName": "Draco for Unity WebGL 2020", + "description": "Provides the Draco for Unity package with WebGL native libraries for Unity versions 2020.1 to 2021.1", + "unity": "2020.3" +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2020/package.json.meta b/UnityPackages/com.unity.cloud.draco.webgl-2020/package.json.meta new file mode 100644 index 00000000..d735128b --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2020/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 382cbd2d2416e499ba6711f5212b4e67 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/CHANGELOG.md b/UnityPackages/com.unity.cloud.draco.webgl-2021/CHANGELOG.md new file mode 100644 index 00000000..debc102d --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/CHANGELOG.md @@ -0,0 +1,27 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2023-12-15 + +### Fixed + +- Added copy of license to `Third Party Notices.md` + +## [1.0.0-pre.2] - 2023-11-13 + +### Added + +- Empty runtime tests + +### Fixed + +- Removed warning about missing main package when it was installed as indirect dependency +- Correct namespace for Editor tests + +## [1.0.0-pre.1] - 2023-11-03 + +Initial sub package publication diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/CHANGELOG.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/CHANGELOG.md.meta new file mode 100644 index 00000000..7de43b33 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ec935b784efe04171af1a0da9c416e32 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Documentation~/api_index.md b/UnityPackages/com.unity.cloud.draco.webgl-2021/Documentation~/api_index.md new file mode 100644 index 00000000..62116d29 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Documentation~/api_index.md @@ -0,0 +1,17 @@ +--- +uid: api-index +--- + +# Draco for Unity WebGL Sub-Package API Documentation + +This package does not provide any public API. Instead please consult the documentation of its main package [Draco for Unity][DracoForUnity]. + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Documentation~/index.md b/UnityPackages/com.unity.cloud.draco.webgl-2021/Documentation~/index.md new file mode 100644 index 00000000..58012a7e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Documentation~/index.md @@ -0,0 +1,16 @@ +# Draco for Unity WebGL Sub-Package Documentation + +This package contains a Unity® version specific WebGL native library of Draco™ (in the form of pre-compiled, binary [WebAssembly][wasm]). + +By itself it provides no functionality and should not get installed manually. It is a sub-package of its main package [Draco for Unity][DracoForUnity], which will install it automatically. If the main package is removed, this sub-package will remove itself automatically as well. + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com +[wasm]: https://webassembly.org/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor.meta new file mode 100644 index 00000000..03a90673 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1c55d1aa684e34900bc58e74e395ecff +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts.meta new file mode 100644 index 00000000..fdef8d09 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 21d09c099fe9946e58b447a37c33a539 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/Draco.Webgl-2021.Editor.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/Draco.Webgl-2021.Editor.asmdef new file mode 100644 index 00000000..2fbb58be --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/Draco.Webgl-2021.Editor.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Draco.Webgl-2021.Editor", + "rootNamespace": "", + "references": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/Draco.Webgl-2021.Editor.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/Draco.Webgl-2021.Editor.asmdef.meta new file mode 100644 index 00000000..f5ada19f --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/Draco.Webgl-2021.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bd6f034f2e1e44f42b4132fc11c13f1a +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/SubPackageCleanup.cs b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/SubPackageCleanup.cs new file mode 100644 index 00000000..140505e8 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/SubPackageCleanup.cs @@ -0,0 +1,41 @@ +using System.Threading.Tasks; +using UnityEditor; +using UnityEditor.PackageManager; +using UnityEngine; +using UnityEngine.Assertions; +using System.Linq; + +namespace SubPackage +{ + static class SubPackageCleanup + { + + const string k_Name = "com.unity.cloud.draco.webgl-2021"; + const string k_DisplayName = "Draco for Unity WebGL 2021"; + + static readonly string[] k_MainPackageNames = { + "com.unity.cloud.draco", + "com.atteneder.draco" + }; + +#if !DISABLE_SUB_PACKAGE_CHECK + [InitializeOnLoadMethod] +#endif + static async void InitializeOnLoad() + { + var request = Client.List(offlineMode: true, includeIndirectDependencies: true); + + while (!request.IsCompleted) + await Task.Yield(); + + Assert.AreEqual(StatusCode.Success, request.Status); + + var mainPackageInManifest = request.Result.Select(package => package.name).Intersect(k_MainPackageNames).Any(); + + if (!mainPackageInManifest) + { + Debug.LogWarning($"Package {k_DisplayName} ({k_Name}) is missing its main package Draco for Unity and should get removed."); + } + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/SubPackageCleanup.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/SubPackageCleanup.cs.meta new file mode 100644 index 00000000..75203e78 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Editor/Scripts/SubPackageCleanup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c09bfecf0894540cdbaad5ca8e01d15f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/LICENSE.md b/UnityPackages/com.unity.cloud.draco.webgl-2021/LICENSE.md new file mode 100644 index 00000000..b5a74a6d --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/LICENSE.md @@ -0,0 +1,190 @@ +Draco for Unity WebGL 2021 copyright © 2023 Unity Technologies + +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. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/LICENSE.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/LICENSE.md.meta new file mode 100644 index 00000000..177e4909 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7867c8945535949ffa2a2b69d925d2a9 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/README.md b/UnityPackages/com.unity.cloud.draco.webgl-2021/README.md new file mode 100644 index 00000000..7c3a8894 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/README.md @@ -0,0 +1,24 @@ +# Draco for Unity WebGL + +This package contains a Unity® version specific WebGL native library of Draco™ (in the form of pre-compiled, binary [WebAssembly][wasm]). + +By itself it provides no functionality. It is a sub-package of its main package [Draco for Unity][DracoForUnity]. + +## Documentation + +- [Package Documentation](Documentation~/index.md) + +## License + +- [License](LICENSE.md). + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com +[wasm]: https://webassembly.org/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/README.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/README.md.meta new file mode 100644 index 00000000..046ee817 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4ba200b4fe6a14729aa882b5f3dc3a04 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime.meta new file mode 100644 index 00000000..0b292695 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3bbfbfc4be76144e49c0d81db97f61f0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins.meta new file mode 100644 index 00000000..e03801dd --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ffe004ac2d8ee48ad8e8ff2cc115d892 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL.meta new file mode 100644 index 00000000..eaf5e110 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6353ad8a4126467bbc242b6efa98e1b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL/libdraco_unity.a b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL/libdraco_unity.a new file mode 100644 index 00000000..2e76cd11 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL/libdraco_unity.a @@ -0,0 +1 @@ +This file is just a placeholder. Replace it with the actual binary library before packaging a release. diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL/libdraco_unity.a.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL/libdraco_unity.a.meta new file mode 100644 index 00000000..7c3c860e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL/libdraco_unity.a.meta @@ -0,0 +1,120 @@ +fileFormatVersion: 2 +guid: 074a3850ab1b5464ab623ec133d00dd5 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 0 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + Exclude tvOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: WebGL + second: + enabled: 1 + settings: {} + - first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + - first: + tvOS: tvOS + second: + enabled: 0 + settings: + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests.meta new file mode 100644 index 00000000..b04941ac --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b8a8c1a85d2134cb7a8b19dfd05fc131 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor.meta new file mode 100644 index 00000000..3e3cdd8e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f3f82c16686da4e39ac4746535eb2509 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/Draco.Webgl-2021.Editor.Tests.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/Draco.Webgl-2021.Editor.Tests.asmdef new file mode 100644 index 00000000..a7803c17 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/Draco.Webgl-2021.Editor.Tests.asmdef @@ -0,0 +1,24 @@ +{ + "name": "Draco.Webgl-2021.Editor.Tests", + "rootNamespace": "", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "Unity.Mathematics" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/Draco.Webgl-2021.Editor.Tests.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/Draco.Webgl-2021.Editor.Tests.asmdef.meta new file mode 100644 index 00000000..27750281 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/Draco.Webgl-2021.Editor.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b5d8b88ebb9e74348b10be4366c5bd2a +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/WebglEditorTests.cs b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/WebglEditorTests.cs new file mode 100644 index 00000000..f70fdaea --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/WebglEditorTests.cs @@ -0,0 +1,29 @@ +using System.IO; +using NUnit.Framework; +using UnityEngine; +using File = UnityEngine.Windows.File; + +namespace Draco.Webgl.Editor.Tests +{ + class WebglEditorTests + { + const string k_PackagePrefix = "Packages/com.unity.cloud.draco.webgl-2021/Runtime/Plugins/WebGL"; + + static readonly string[] k_WebglBinaries = { + $"{k_PackagePrefix}/libdraco_unity.a" + }; + + [Test] + public void CheckNativeLibSize() + { + foreach (var webglBinary in k_WebglBinaries) + { + Assert.IsTrue(File.Exists(webglBinary)); + var fi = new FileInfo(webglBinary); + // In source (GIT) the native WebGL library files are placeholders with a few bytes of text in them. + // The CI will replace them with actual binaries, all significantly bigger than 1024 bytes. + Assert.Greater(fi.Length, 1024); + } + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/WebglEditorTests.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/WebglEditorTests.cs.meta new file mode 100644 index 00000000..e9d5b3f9 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Editor/WebglEditorTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8a4ea1ec9340f449897f33640aa92ece +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime.meta new file mode 100644 index 00000000..35d34eed --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 891c353f53ce94994b7c575ed4316258 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/Draco.Webgl-2021.Tests.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/Draco.Webgl-2021.Tests.asmdef new file mode 100644 index 00000000..fef7ddc3 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/Draco.Webgl-2021.Tests.asmdef @@ -0,0 +1,20 @@ +{ + "name": "Draco.Webgl-2021.Tests", + "rootNamespace": "Draco.Tests", + "references": [ + "UnityEngine.TestRunner" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": true, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/Draco.Webgl-2021.Tests.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/Draco.Webgl-2021.Tests.asmdef.meta new file mode 100644 index 00000000..02d42ad1 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/Draco.Webgl-2021.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 43f12e28b9b2b4471b6bef6cc0adf61a +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/DummyTest.cs b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/DummyTest.cs new file mode 100644 index 00000000..32d67fb5 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/DummyTest.cs @@ -0,0 +1,14 @@ +using UnityEngine; +using NUnit.Framework; + +namespace Draco.Tests +{ + class DummyTest + { + [Test] + public void Foo() + { + Assert.AreEqual(42,42); + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/DummyTest.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/DummyTest.cs.meta new file mode 100644 index 00000000..f17cd959 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Tests/Runtime/DummyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 18b89859790664477b159f5a577c4cdc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Third Party Notices.md b/UnityPackages/com.unity.cloud.draco.webgl-2021/Third Party Notices.md new file mode 100644 index 00000000..1d5bcb3b --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Third Party Notices.md @@ -0,0 +1,234 @@ +# Third party notices + +This package contains third-party software components governed by the license(s) indicated below: + +## Draco + +Component Name: Draco™ 3D Data Compression + +License Type: Apache 2.0 + +Copyright © 2018 The Draco Authors + +[Draco][Draco] + +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. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + +## Trademarks + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[Draco]: https://github.com/google/draco +[GoogleLLC]: https://about.google/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/Third Party Notices.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/Third Party Notices.md.meta new file mode 100644 index 00000000..dedbddda --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/Third Party Notices.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3c0dcb86684f14d848d65f7eb07f39a9 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/package.json b/UnityPackages/com.unity.cloud.draco.webgl-2021/package.json new file mode 100644 index 00000000..58eb33dd --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/package.json @@ -0,0 +1,7 @@ +{ + "name": "com.unity.cloud.draco.webgl-2021", + "version": "1.0.0", + "displayName": "Draco for Unity WebGL 2021", + "description": "Provides the Draco for Unity package with WebGL native libraries for Unity versions 2021.2 to 2022.1", + "unity": "2021.2" +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2021/package.json.meta b/UnityPackages/com.unity.cloud.draco.webgl-2021/package.json.meta new file mode 100644 index 00000000..8a771baa --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2021/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 351edd2b504e245759e5195b72edf612 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/CHANGELOG.md b/UnityPackages/com.unity.cloud.draco.webgl-2022/CHANGELOG.md new file mode 100644 index 00000000..debc102d --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/CHANGELOG.md @@ -0,0 +1,27 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2023-12-15 + +### Fixed + +- Added copy of license to `Third Party Notices.md` + +## [1.0.0-pre.2] - 2023-11-13 + +### Added + +- Empty runtime tests + +### Fixed + +- Removed warning about missing main package when it was installed as indirect dependency +- Correct namespace for Editor tests + +## [1.0.0-pre.1] - 2023-11-03 + +Initial sub package publication diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/CHANGELOG.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/CHANGELOG.md.meta new file mode 100644 index 00000000..01b57b4f --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 18a072c52df7f4eec9c41d63e6d8277c +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Documentation~/api_index.md b/UnityPackages/com.unity.cloud.draco.webgl-2022/Documentation~/api_index.md new file mode 100644 index 00000000..62116d29 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Documentation~/api_index.md @@ -0,0 +1,17 @@ +--- +uid: api-index +--- + +# Draco for Unity WebGL Sub-Package API Documentation + +This package does not provide any public API. Instead please consult the documentation of its main package [Draco for Unity][DracoForUnity]. + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Documentation~/index.md b/UnityPackages/com.unity.cloud.draco.webgl-2022/Documentation~/index.md new file mode 100644 index 00000000..58012a7e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Documentation~/index.md @@ -0,0 +1,16 @@ +# Draco for Unity WebGL Sub-Package Documentation + +This package contains a Unity® version specific WebGL native library of Draco™ (in the form of pre-compiled, binary [WebAssembly][wasm]). + +By itself it provides no functionality and should not get installed manually. It is a sub-package of its main package [Draco for Unity][DracoForUnity], which will install it automatically. If the main package is removed, this sub-package will remove itself automatically as well. + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com +[wasm]: https://webassembly.org/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor.meta new file mode 100644 index 00000000..5feb38d6 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e84e6bdc08ae04891a66e0c94f9ca9c7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts.meta new file mode 100644 index 00000000..574932a5 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e7ed3a37b5c1c49b9b6d0f8947f3c13a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/Draco.Webgl-2022.Editor.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/Draco.Webgl-2022.Editor.asmdef new file mode 100644 index 00000000..d027a579 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/Draco.Webgl-2022.Editor.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Draco.Webgl-2022.Editor", + "rootNamespace": "", + "references": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/Draco.Webgl-2022.Editor.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/Draco.Webgl-2022.Editor.asmdef.meta new file mode 100644 index 00000000..b4fb93b5 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/Draco.Webgl-2022.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0046984de76af46b188691c4c2c87244 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/SubPackageCleanup.cs b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/SubPackageCleanup.cs new file mode 100644 index 00000000..7470d51d --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/SubPackageCleanup.cs @@ -0,0 +1,41 @@ +using System.Threading.Tasks; +using UnityEditor; +using UnityEditor.PackageManager; +using UnityEngine; +using UnityEngine.Assertions; +using System.Linq; + +namespace SubPackage +{ + static class SubPackageCleanup + { + + const string k_Name = "com.unity.cloud.draco.webgl-2022"; + const string k_DisplayName = "Draco for Unity WebGL 2022"; + + static readonly string[] k_MainPackageNames = { + "com.unity.cloud.draco", + "com.atteneder.draco" + }; + +#if !DISABLE_SUB_PACKAGE_CHECK + [InitializeOnLoadMethod] +#endif + static async void InitializeOnLoad() + { + var request = Client.List(offlineMode: true, includeIndirectDependencies: true); + + while (!request.IsCompleted) + await Task.Yield(); + + Assert.AreEqual(StatusCode.Success, request.Status); + + var mainPackageInManifest = request.Result.Select(package => package.name).Intersect(k_MainPackageNames).Any(); + + if (!mainPackageInManifest) + { + Debug.LogWarning($"Package {k_DisplayName} ({k_Name}) is missing its main package Draco for Unity and should get removed."); + } + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/SubPackageCleanup.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/SubPackageCleanup.cs.meta new file mode 100644 index 00000000..8a18fc08 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Editor/Scripts/SubPackageCleanup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 728726a72bdfe442dab4f46c17fb5ce9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/LICENSE.md b/UnityPackages/com.unity.cloud.draco.webgl-2022/LICENSE.md new file mode 100644 index 00000000..2598378a --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/LICENSE.md @@ -0,0 +1,190 @@ +Draco for Unity WebGL 2022 copyright © 2023 Unity Technologies + +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. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/LICENSE.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/LICENSE.md.meta new file mode 100644 index 00000000..10ba7ccb --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f9f4dc5f045614770ba8176b259e2c92 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/README.md b/UnityPackages/com.unity.cloud.draco.webgl-2022/README.md new file mode 100644 index 00000000..7c3a8894 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/README.md @@ -0,0 +1,24 @@ +# Draco for Unity WebGL + +This package contains a Unity® version specific WebGL native library of Draco™ (in the form of pre-compiled, binary [WebAssembly][wasm]). + +By itself it provides no functionality. It is a sub-package of its main package [Draco for Unity][DracoForUnity]. + +## Documentation + +- [Package Documentation](Documentation~/index.md) + +## License + +- [License](LICENSE.md). + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com +[wasm]: https://webassembly.org/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/README.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/README.md.meta new file mode 100644 index 00000000..96cc6792 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 80fafea728f7446a7abb83eed6241982 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime.meta new file mode 100644 index 00000000..725c4314 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bd9000a6c26f54904b82e3f3ee1cb060 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins.meta new file mode 100644 index 00000000..3ad60b1a --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a2de489330434900817b5905649e4da +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL.meta new file mode 100644 index 00000000..285ab94c --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0587fdbd8edb47018f4491a91833351 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL/libdraco_unity.a b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL/libdraco_unity.a new file mode 100644 index 00000000..2e76cd11 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL/libdraco_unity.a @@ -0,0 +1 @@ +This file is just a placeholder. Replace it with the actual binary library before packaging a release. diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL/libdraco_unity.a.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL/libdraco_unity.a.meta new file mode 100644 index 00000000..879a55f5 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL/libdraco_unity.a.meta @@ -0,0 +1,88 @@ +fileFormatVersion: 2 +guid: 06fc7fca094804c01ae9588a1501496e +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 0 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + Exclude tvOS: 1 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: None + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + - first: + tvOS: tvOS + second: + enabled: 0 + settings: + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests.meta new file mode 100644 index 00000000..f76f0c70 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f289c492ad2b64993b4fa2a76e211966 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor.meta new file mode 100644 index 00000000..00d26790 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a375453e35efc4a21b03228b1df14eee +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/Draco.Webgl-2022.Editor.Tests.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/Draco.Webgl-2022.Editor.Tests.asmdef new file mode 100644 index 00000000..77ab5049 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/Draco.Webgl-2022.Editor.Tests.asmdef @@ -0,0 +1,24 @@ +{ + "name": "Draco.Webgl-2022.Editor.Tests", + "rootNamespace": "", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "Unity.Mathematics" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/Draco.Webgl-2022.Editor.Tests.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/Draco.Webgl-2022.Editor.Tests.asmdef.meta new file mode 100644 index 00000000..9a574f50 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/Draco.Webgl-2022.Editor.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 13cf5a345d9ca40438bd0054e7132616 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/WebglEditorTests.cs b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/WebglEditorTests.cs new file mode 100644 index 00000000..c8ca0137 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/WebglEditorTests.cs @@ -0,0 +1,29 @@ +using System.IO; +using NUnit.Framework; +using UnityEngine; +using File = UnityEngine.Windows.File; + +namespace Draco.Webgl.Editor.Tests +{ + class WebglEditorTests + { + const string k_PackagePrefix = "Packages/com.unity.cloud.draco.webgl-2022/Runtime/Plugins/WebGL"; + + static readonly string[] k_WebglBinaries = { + $"{k_PackagePrefix}/libdraco_unity.a" + }; + + [Test] + public void CheckNativeLibSize() + { + foreach (var webglBinary in k_WebglBinaries) + { + Assert.IsTrue(File.Exists(webglBinary)); + var fi = new FileInfo(webglBinary); + // In source (GIT) the native WebGL library files are placeholders with a few bytes of text in them. + // The CI will replace them with actual binaries, all significantly bigger than 1024 bytes. + Assert.Greater(fi.Length, 1024); + } + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/WebglEditorTests.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/WebglEditorTests.cs.meta new file mode 100644 index 00000000..dc17a604 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Editor/WebglEditorTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2eaea761a65f44b25b162cde149b0108 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime.meta new file mode 100644 index 00000000..441c1098 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b0676cb3ea36944e887c90ef6fc00f19 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/Draco.Webgl-2022.Tests.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/Draco.Webgl-2022.Tests.asmdef new file mode 100644 index 00000000..8207949f --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/Draco.Webgl-2022.Tests.asmdef @@ -0,0 +1,20 @@ +{ + "name": "Draco.Webgl-2022.Tests", + "rootNamespace": "Draco.Tests", + "references": [ + "UnityEngine.TestRunner" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": true, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/Draco.Webgl-2022.Tests.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/Draco.Webgl-2022.Tests.asmdef.meta new file mode 100644 index 00000000..ede76c17 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/Draco.Webgl-2022.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8df82da1f249a4c3291125b4ee55e4b1 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/DummyTest.cs b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/DummyTest.cs new file mode 100644 index 00000000..32d67fb5 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/DummyTest.cs @@ -0,0 +1,14 @@ +using UnityEngine; +using NUnit.Framework; + +namespace Draco.Tests +{ + class DummyTest + { + [Test] + public void Foo() + { + Assert.AreEqual(42,42); + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/DummyTest.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/DummyTest.cs.meta new file mode 100644 index 00000000..f96f4788 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Tests/Runtime/DummyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 882bd11ff5650471bab26cc00296877e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Third Party Notices.md b/UnityPackages/com.unity.cloud.draco.webgl-2022/Third Party Notices.md new file mode 100644 index 00000000..1d5bcb3b --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Third Party Notices.md @@ -0,0 +1,234 @@ +# Third party notices + +This package contains third-party software components governed by the license(s) indicated below: + +## Draco + +Component Name: Draco™ 3D Data Compression + +License Type: Apache 2.0 + +Copyright © 2018 The Draco Authors + +[Draco][Draco] + +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. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + +## Trademarks + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[Draco]: https://github.com/google/draco +[GoogleLLC]: https://about.google/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/Third Party Notices.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/Third Party Notices.md.meta new file mode 100644 index 00000000..39216de1 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/Third Party Notices.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8abb454b592e34cc1aeb8551fd256e8a +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/package.json b/UnityPackages/com.unity.cloud.draco.webgl-2022/package.json new file mode 100644 index 00000000..411bde2d --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/package.json @@ -0,0 +1,7 @@ +{ + "name": "com.unity.cloud.draco.webgl-2022", + "version": "1.0.0", + "displayName": "Draco for Unity WebGL 2022", + "description": "Provides the Draco for Unity package with WebGL native libraries for Unity versions 2022.2 to 2023.1", + "unity": "2022.2" +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2022/package.json.meta b/UnityPackages/com.unity.cloud.draco.webgl-2022/package.json.meta new file mode 100644 index 00000000..bfeb3080 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2022/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d769dd7a3016a44219fe8989992d7df2 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/CHANGELOG.md b/UnityPackages/com.unity.cloud.draco.webgl-2023/CHANGELOG.md new file mode 100644 index 00000000..debc102d --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/CHANGELOG.md @@ -0,0 +1,27 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2023-12-15 + +### Fixed + +- Added copy of license to `Third Party Notices.md` + +## [1.0.0-pre.2] - 2023-11-13 + +### Added + +- Empty runtime tests + +### Fixed + +- Removed warning about missing main package when it was installed as indirect dependency +- Correct namespace for Editor tests + +## [1.0.0-pre.1] - 2023-11-03 + +Initial sub package publication diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/CHANGELOG.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/CHANGELOG.md.meta new file mode 100644 index 00000000..51b2fcba --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2279e7034f7de431f9be7a1896576707 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Documentation~/api_index.md b/UnityPackages/com.unity.cloud.draco.webgl-2023/Documentation~/api_index.md new file mode 100644 index 00000000..62116d29 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Documentation~/api_index.md @@ -0,0 +1,17 @@ +--- +uid: api-index +--- + +# Draco for Unity WebGL Sub-Package API Documentation + +This package does not provide any public API. Instead please consult the documentation of its main package [Draco for Unity][DracoForUnity]. + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Documentation~/index.md b/UnityPackages/com.unity.cloud.draco.webgl-2023/Documentation~/index.md new file mode 100644 index 00000000..58012a7e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Documentation~/index.md @@ -0,0 +1,16 @@ +# Draco for Unity WebGL Sub-Package Documentation + +This package contains a Unity® version specific WebGL native library of Draco™ (in the form of pre-compiled, binary [WebAssembly][wasm]). + +By itself it provides no functionality and should not get installed manually. It is a sub-package of its main package [Draco for Unity][DracoForUnity], which will install it automatically. If the main package is removed, this sub-package will remove itself automatically as well. + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com +[wasm]: https://webassembly.org/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor.meta new file mode 100644 index 00000000..ea8ca3fa --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4dc22260ff39d482ba09e693a964a960 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts.meta new file mode 100644 index 00000000..2220006f --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f4aede89671404478a682b449201d24b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/Draco.Webgl-2023.Editor.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/Draco.Webgl-2023.Editor.asmdef new file mode 100644 index 00000000..62eabb96 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/Draco.Webgl-2023.Editor.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Draco.Webgl-2023.Editor", + "rootNamespace": "", + "references": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/Draco.Webgl-2023.Editor.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/Draco.Webgl-2023.Editor.asmdef.meta new file mode 100644 index 00000000..0cc7d6b5 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/Draco.Webgl-2023.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 394154ffdc1f9462c993365ac7ba5cc8 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/SubPackageCleanup.cs b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/SubPackageCleanup.cs new file mode 100644 index 00000000..80b0497f --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/SubPackageCleanup.cs @@ -0,0 +1,41 @@ +using System.Threading.Tasks; +using UnityEditor; +using UnityEditor.PackageManager; +using UnityEngine; +using UnityEngine.Assertions; +using System.Linq; + +namespace SubPackage +{ + static class SubPackageCleanup + { + + const string k_Name = "com.unity.cloud.draco.webgl-2023"; + const string k_DisplayName = "Draco for Unity WebGL 2023"; + + static readonly string[] k_MainPackageNames = { + "com.unity.cloud.draco", + "com.atteneder.draco" + }; + +#if !DISABLE_SUB_PACKAGE_CHECK + [InitializeOnLoadMethod] +#endif + static async void InitializeOnLoad() + { + var request = Client.List(offlineMode: true, includeIndirectDependencies: true); + + while (!request.IsCompleted) + await Task.Yield(); + + Assert.AreEqual(StatusCode.Success, request.Status); + + var mainPackageInManifest = request.Result.Select(package => package.name).Intersect(k_MainPackageNames).Any(); + + if (!mainPackageInManifest) + { + Debug.LogWarning($"Package {k_DisplayName} ({k_Name}) is missing its main package Draco for Unity and should get removed."); + } + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/SubPackageCleanup.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/SubPackageCleanup.cs.meta new file mode 100644 index 00000000..e0ef368f --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Editor/Scripts/SubPackageCleanup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 76f3dac9a90054df09945b72d2caad07 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/LICENSE.md b/UnityPackages/com.unity.cloud.draco.webgl-2023/LICENSE.md new file mode 100644 index 00000000..8f40ca6a --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/LICENSE.md @@ -0,0 +1,190 @@ +Draco for Unity WebGL 2023 copyright © 2023 Unity Technologies + +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. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/LICENSE.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/LICENSE.md.meta new file mode 100644 index 00000000..67b0774e --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 613469ae9fbc44843b769f6a17fd2fe3 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/README.md b/UnityPackages/com.unity.cloud.draco.webgl-2023/README.md new file mode 100644 index 00000000..7c3a8894 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/README.md @@ -0,0 +1,24 @@ +# Draco for Unity WebGL + +This package contains a Unity® version specific WebGL native library of Draco™ (in the form of pre-compiled, binary [WebAssembly][wasm]). + +By itself it provides no functionality. It is a sub-package of its main package [Draco for Unity][DracoForUnity]. + +## Documentation + +- [Package Documentation](Documentation~/index.md) + +## License + +- [License](LICENSE.md). + +## Trademarks + +*Unity®* is a registered trademark of [Unity Technologies][Unity]. + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[DracoForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.draco@latest +[GoogleLLC]: https://about.google/ +[unity]: https://unity.com +[wasm]: https://webassembly.org/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/README.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/README.md.meta new file mode 100644 index 00000000..3200df02 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5d42efab512ba4accb390c689f91313f +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime.meta new file mode 100644 index 00000000..d7839047 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3b93db59d2f6a45029ddb49293d46ef3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins.meta new file mode 100644 index 00000000..62ddca86 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b4e16b0a42bb2437c91d13f947c5a290 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL.meta new file mode 100644 index 00000000..b99adae7 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e7138506b6a89408d95b1dcd80b9df07 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL/libdraco_unity.a b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL/libdraco_unity.a new file mode 100644 index 00000000..2e76cd11 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL/libdraco_unity.a @@ -0,0 +1 @@ +This file is just a placeholder. Replace it with the actual binary library before packaging a release. diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL/libdraco_unity.a.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL/libdraco_unity.a.meta new file mode 100644 index 00000000..b9eb5dff --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL/libdraco_unity.a.meta @@ -0,0 +1,95 @@ +fileFormatVersion: 2 +guid: 22483904bc44e4eb8b65f46ea3cf16a9 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 0 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + Exclude tvOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: None + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + - first: + tvOS: tvOS + second: + enabled: 0 + settings: + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests.meta new file mode 100644 index 00000000..62a70a92 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7377f5feff1624f84bf8c849de9ce952 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor.meta new file mode 100644 index 00000000..c05e9054 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7eec5cfa7e61344c39ef4b4b56c68d53 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/Draco.Webgl-2023.Editor.Tests.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/Draco.Webgl-2023.Editor.Tests.asmdef new file mode 100644 index 00000000..e544c04c --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/Draco.Webgl-2023.Editor.Tests.asmdef @@ -0,0 +1,24 @@ +{ + "name": "Draco.Webgl-2023.Editor.Tests", + "rootNamespace": "", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "Unity.Mathematics" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/Draco.Webgl-2023.Editor.Tests.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/Draco.Webgl-2023.Editor.Tests.asmdef.meta new file mode 100644 index 00000000..749a1a5f --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/Draco.Webgl-2023.Editor.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5aef8aa16b1d842f4b5d5be1d5181f32 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/WebglEditorTests.cs b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/WebglEditorTests.cs new file mode 100644 index 00000000..f5c18631 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/WebglEditorTests.cs @@ -0,0 +1,29 @@ +using System.IO; +using NUnit.Framework; +using UnityEngine; +using File = UnityEngine.Windows.File; + +namespace Draco.Webgl.Editor.Tests +{ + class WebglEditorTests + { + const string k_PackagePrefix = "Packages/com.unity.cloud.draco.webgl-2023/Runtime/Plugins/WebGL"; + + static readonly string[] k_WebglBinaries = { + $"{k_PackagePrefix}/libdraco_unity.a" + }; + + [Test] + public void CheckNativeLibSize() + { + foreach (var webglBinary in k_WebglBinaries) + { + Assert.IsTrue(File.Exists(webglBinary)); + var fi = new FileInfo(webglBinary); + // In source (GIT) the native WebGL library files are placeholders with a few bytes of text in them. + // The CI will replace them with actual binaries, all significantly bigger than 1024 bytes. + Assert.Greater(fi.Length, 1024); + } + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/WebglEditorTests.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/WebglEditorTests.cs.meta new file mode 100644 index 00000000..651dc5ff --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Editor/WebglEditorTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ce74fd0ffa6554aea8b160212dd10f0a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime.meta new file mode 100644 index 00000000..e471f589 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5bc95882d7343422480f093662e196e0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/Draco.Webgl-2023.Tests.asmdef b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/Draco.Webgl-2023.Tests.asmdef new file mode 100644 index 00000000..d110647f --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/Draco.Webgl-2023.Tests.asmdef @@ -0,0 +1,20 @@ +{ + "name": "Draco.Webgl-2023.Tests", + "rootNamespace": "Draco.Tests", + "references": [ + "UnityEngine.TestRunner" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": true, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/Draco.Webgl-2023.Tests.asmdef.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/Draco.Webgl-2023.Tests.asmdef.meta new file mode 100644 index 00000000..8fd03fb2 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/Draco.Webgl-2023.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 583be4ae3dcae4daeb5cd4b81bbf462e +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/DummyTest.cs b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/DummyTest.cs new file mode 100644 index 00000000..32d67fb5 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/DummyTest.cs @@ -0,0 +1,14 @@ +using UnityEngine; +using NUnit.Framework; + +namespace Draco.Tests +{ + class DummyTest + { + [Test] + public void Foo() + { + Assert.AreEqual(42,42); + } + } +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/DummyTest.cs.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/DummyTest.cs.meta new file mode 100644 index 00000000..d8a85964 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Tests/Runtime/DummyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b322b8e169f6b4427997aabe529f1956 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Third Party Notices.md b/UnityPackages/com.unity.cloud.draco.webgl-2023/Third Party Notices.md new file mode 100644 index 00000000..1d5bcb3b --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Third Party Notices.md @@ -0,0 +1,234 @@ +# Third party notices + +This package contains third-party software components governed by the license(s) indicated below: + +## Draco + +Component Name: Draco™ 3D Data Compression + +License Type: Apache 2.0 + +Copyright © 2018 The Draco Authors + +[Draco][Draco] + +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. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + +## Trademarks + +*Draco™* is a trademark of [*Google LLC*][GoogleLLC]. + +[Draco]: https://github.com/google/draco +[GoogleLLC]: https://about.google/ diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/Third Party Notices.md.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/Third Party Notices.md.meta new file mode 100644 index 00000000..218a54d7 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/Third Party Notices.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e4bcf0cf33c8c428781ac253133f6b29 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/package.json b/UnityPackages/com.unity.cloud.draco.webgl-2023/package.json new file mode 100644 index 00000000..7e50be86 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/package.json @@ -0,0 +1,8 @@ +{ + "name": "com.unity.cloud.draco.webgl-2023", + "version": "1.0.0", + "displayName": "Draco for Unity WebGL 2023", + "description": "Provides the Draco for Unity package with WebGL native libraries for Unity versions 2023.2 and newer", + "unity": "2023.2", + "unityRelease": "0a17" +} diff --git a/UnityPackages/com.unity.cloud.draco.webgl-2023/package.json.meta b/UnityPackages/com.unity.cloud.draco.webgl-2023/package.json.meta new file mode 100644 index 00000000..6b82af59 --- /dev/null +++ b/UnityPackages/com.unity.cloud.draco.webgl-2023/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 646d660dda8fa4b9ca5afcd9bcb0bfe7 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/cmake/draco_build_definitions.cmake b/cmake/draco_build_definitions.cmake index 4dc23233..252255be 100644 --- a/cmake/draco_build_definitions.cmake +++ b/cmake/draco_build_definitions.cmake @@ -153,5 +153,17 @@ macro(draco_set_build_definitions) FLAG_LIST_VAR_LINKER draco_base_exe_linker_flags) endif() + if(IOS) + # ensure bitcode is generated when generating an iOS library with Makefiles + # as generator. + list(APPEND draco_base_cxx_flags "-fembed-bitcode") + endif() + + if(WIN32 AND ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore") + # Ignoring Error C4146 unary minus operator applied to unsigned type, result + # still unsigned + list(APPEND draco_msvc_cxx_flags "/wd4146") + endif() + draco_configure_sanitizer() endmacro() diff --git a/cmake/draco_install.cmake b/cmake/draco_install.cmake index 3be1ba16..6d211142 100644 --- a/cmake/draco_install.cmake +++ b/cmake/draco_install.cmake @@ -81,7 +81,7 @@ macro(draco_setup_install_target) endif() if(DRACO_UNITY_PLUGIN) - install(TARGETS dracodec_unity DESTINATION "${libs_path}") + install(TARGETS draco_unity DESTINATION "${libs_path}") endif() if(DRACO_MAYA_PLUGIN) diff --git a/cmake/draco_options.cmake b/cmake/draco_options.cmake index 08514977..ce6fe3ec 100644 --- a/cmake/draco_options.cmake +++ b/cmake/draco_options.cmake @@ -190,6 +190,7 @@ macro(draco_set_optional_features) draco_enable_feature(FEATURE "DRACO_MESH_COMPRESSION_SUPPORTED") draco_enable_feature(FEATURE "DRACO_NORMAL_ENCODING_SUPPORTED") draco_enable_feature(FEATURE "DRACO_STANDARD_EDGEBREAKER_SUPPORTED") + draco_enable_feature(FEATURE "DRACO_POINT_CLOUD_COMPRESSION_SUPPORTED") else() if(DRACO_POINT_CLOUD_COMPRESSION) draco_enable_feature(FEATURE "DRACO_POINT_CLOUD_COMPRESSION_SUPPORTED") diff --git a/src/draco/animation/keyframe_animation_decoder.cc b/src/draco/animation/keyframe_animation_decoder.cc index 20659468..09248763 100644 --- a/src/draco/animation/keyframe_animation_decoder.cc +++ b/src/draco/animation/keyframe_animation_decoder.cc @@ -19,11 +19,15 @@ namespace draco { Status KeyframeAnimationDecoder::Decode(const DecoderOptions &options, DecoderBuffer *in_buffer, KeyframeAnimation *animation) { - const auto status = PointCloudSequentialDecoder::Decode( + auto status = PointCloudSequentialDecoder::DecodeStep1( options, in_buffer, static_cast(animation)); if (!status.ok()) { return status; } + status = PointCloudSequentialDecoder::DecodeStep2(); + if (!status.ok()) { + return status; + } return OkStatus(); } diff --git a/src/draco/compression/decode.cc b/src/draco/compression/decode.cc index 92ae4ff6..f2c5182d 100644 --- a/src/draco/compression/decode.cc +++ b/src/draco/compression/decode.cc @@ -90,6 +90,18 @@ StatusOr> Decoder::DecodeMeshFromBuffer( return std::move(mesh); } +StatusOr> Decoder::DecodeMeshFromBufferStep1( + DecoderBuffer *in_buffer) { + mesh_ = std::unique_ptr(new Mesh()); + DRACO_RETURN_IF_ERROR(DecodeBufferToGeometryStep1(in_buffer, mesh_.get())) + return std::move(mesh_); +} + +Status Decoder::DecodeMeshFromBufferStep2() { + DRACO_RETURN_IF_ERROR(DecodeBufferToGeometryStep2()) + return OkStatus(); +} + Status Decoder::DecodeBufferToGeometry(DecoderBuffer *in_buffer, PointCloud *out_geometry) { #ifdef DRACO_POINT_CLOUD_COMPRESSION_SUPPORTED @@ -102,7 +114,8 @@ Status Decoder::DecodeBufferToGeometry(DecoderBuffer *in_buffer, DRACO_ASSIGN_OR_RETURN(std::unique_ptr decoder, CreatePointCloudDecoder(header.encoder_method)) - DRACO_RETURN_IF_ERROR(decoder->Decode(options_, in_buffer, out_geometry)) + DRACO_RETURN_IF_ERROR(decoder->DecodeStep1(options_, in_buffer, out_geometry)) + DRACO_RETURN_IF_ERROR(decoder->DecodeStep2()) return OkStatus(); #else return Status(Status::DRACO_ERROR, "Unsupported geometry type."); @@ -111,6 +124,13 @@ Status Decoder::DecodeBufferToGeometry(DecoderBuffer *in_buffer, Status Decoder::DecodeBufferToGeometry(DecoderBuffer *in_buffer, Mesh *out_geometry) { + DRACO_RETURN_IF_ERROR(DecodeBufferToGeometryStep1(in_buffer,out_geometry)) + DRACO_RETURN_IF_ERROR(DecodeBufferToGeometryStep2()) + return OkStatus(); +} + +Status Decoder::DecodeBufferToGeometryStep1(DecoderBuffer *in_buffer, + Mesh *out_geometry) { #ifdef DRACO_MESH_COMPRESSION_SUPPORTED DecoderBuffer temp_buffer(*in_buffer); DracoHeader header; @@ -118,10 +138,29 @@ Status Decoder::DecodeBufferToGeometry(DecoderBuffer *in_buffer, if (header.encoder_type != TRIANGULAR_MESH) { return Status(Status::DRACO_ERROR, "Input is not a mesh."); } - DRACO_ASSIGN_OR_RETURN(std::unique_ptr decoder, + DRACO_ASSIGN_OR_RETURN(decoder_, CreateMeshDecoder(header.encoder_method)) - DRACO_RETURN_IF_ERROR(decoder->Decode(options_, in_buffer, out_geometry)) + { + const draco::Status _local_status = decoder_->DecodeStep1(options_, in_buffer, out_geometry); + if (!_local_status.ok()) { + decoder_.reset(); + return _local_status; + } + } + return OkStatus(); +#else + return Status(Status::DRACO_ERROR, "Unsupported geometry type."); +#endif +} + +Status Decoder::DecodeBufferToGeometryStep2() { +#ifdef DRACO_MESH_COMPRESSION_SUPPORTED + const draco::Status _local_status = decoder_->DecodeStep2(); + decoder_.reset(); + if (!_local_status.ok()) { + return _local_status; + } return OkStatus(); #else return Status(Status::DRACO_ERROR, "Unsupported geometry type."); diff --git a/src/draco/compression/decode.h b/src/draco/compression/decode.h index 5f3fad26..57c03997 100644 --- a/src/draco/compression/decode.h +++ b/src/draco/compression/decode.h @@ -21,6 +21,7 @@ #include "draco/core/status_or.h" #include "draco/draco_features.h" #include "draco/mesh/mesh.h" +#include "draco/compression/mesh/mesh_decoder.h" namespace draco { @@ -50,6 +51,9 @@ class Decoder { StatusOr> DecodeMeshFromBuffer( DecoderBuffer *in_buffer); + StatusOr> DecodeMeshFromBufferStep1(DecoderBuffer *in_buffer); + Status DecodeMeshFromBufferStep2(); + // Decodes the buffer into a provided geometry. If the geometry is // incompatible with the encoded data. For example, when |out_geometry| is // draco::Mesh while the data contains a point cloud, the function will return @@ -57,6 +61,8 @@ class Decoder { Status DecodeBufferToGeometry(DecoderBuffer *in_buffer, PointCloud *out_geometry); Status DecodeBufferToGeometry(DecoderBuffer *in_buffer, Mesh *out_geometry); + Status DecodeBufferToGeometryStep1(DecoderBuffer *in_buffer, Mesh *out_geometry); + Status DecodeBufferToGeometryStep2(); // When set, the decoder is going to skip attribute transform for a given // attribute type. For example for quantized attributes, the decoder would @@ -73,6 +79,8 @@ class Decoder { private: DecoderOptions options_; + std::unique_ptr mesh_; + std::unique_ptr decoder_; }; } // namespace draco diff --git a/src/draco/compression/mesh/mesh_decoder.cc b/src/draco/compression/mesh/mesh_decoder.cc index 6e48e56f..6757a07b 100644 --- a/src/draco/compression/mesh/mesh_decoder.cc +++ b/src/draco/compression/mesh/mesh_decoder.cc @@ -18,10 +18,14 @@ namespace draco { MeshDecoder::MeshDecoder() : mesh_(nullptr) {} -Status MeshDecoder::Decode(const DecoderOptions &options, +Status MeshDecoder::DecodeStep1(const DecoderOptions &options, DecoderBuffer *in_buffer, Mesh *out_mesh) { mesh_ = out_mesh; - return PointCloudDecoder::Decode(options, in_buffer, out_mesh); + return PointCloudDecoder::DecodeStep1(options, in_buffer, out_mesh); +} + +Status MeshDecoder::DecodeStep2() { + return PointCloudDecoder::DecodeStep2(); } bool MeshDecoder::DecodeGeometryData() { diff --git a/src/draco/compression/mesh/mesh_decoder.h b/src/draco/compression/mesh/mesh_decoder.h index 397a679d..eecf7721 100644 --- a/src/draco/compression/mesh/mesh_decoder.h +++ b/src/draco/compression/mesh/mesh_decoder.h @@ -33,9 +33,12 @@ class MeshDecoder : public PointCloudDecoder { } // The main entry point for mesh decoding. - Status Decode(const DecoderOptions &options, DecoderBuffer *in_buffer, + Status DecodeStep1(const DecoderOptions &options, DecoderBuffer *in_buffer, Mesh *out_mesh); + // The main entry point for mesh decoding. + Status DecodeStep2(); + // Returns the base connectivity of the decoded mesh (or nullptr if it is not // initialized). virtual const CornerTable *GetCornerTable() const { return nullptr; } diff --git a/src/draco/compression/mesh/mesh_edgebreaker_encoding_test.cc b/src/draco/compression/mesh/mesh_edgebreaker_encoding_test.cc index 523303b0..f0bb2bed 100644 --- a/src/draco/compression/mesh/mesh_edgebreaker_encoding_test.cc +++ b/src/draco/compression/mesh/mesh_edgebreaker_encoding_test.cc @@ -53,7 +53,9 @@ class MeshEdgebreakerEncodingTest : public ::testing::Test { std::unique_ptr decoded_mesh(new Mesh()); DecoderOptions dec_options; DRACO_ASSERT_OK( - decoder.Decode(dec_options, &dec_buffer, decoded_mesh.get())); + decoder.DecodeStep1(dec_options, &dec_buffer, decoded_mesh.get())); + DRACO_ASSERT_OK( + decoder.DecodeStep2()); // Cleanup the input mesh to make sure that input and output can be // compared (edgebreaker method discards degenerated triangles and isolated @@ -133,12 +135,15 @@ TEST_F(MeshEdgebreakerEncodingTest, TestDecoderReuse) { std::unique_ptr decoded_mesh_0(new Mesh()); DecoderOptions dec_options; DRACO_ASSERT_OK( - decoder.Decode(dec_options, &dec_buffer, decoded_mesh_0.get())); - + decoder.DecodeStep1(dec_options, &dec_buffer, decoded_mesh_0.get())); + DRACO_ASSERT_OK( + decoder.DecodeStep2()); dec_buffer.Init(buffer.data(), buffer.size()); std::unique_ptr decoded_mesh_1(new Mesh()); DRACO_ASSERT_OK( - decoder.Decode(dec_options, &dec_buffer, decoded_mesh_1.get())); + decoder.DecodeStep1(dec_options, &dec_buffer, decoded_mesh_1.get())); + DRACO_ASSERT_OK( + decoder.DecodeStep2()); // Make sure both of the meshes are identical. MeshAreEquivalent eq; diff --git a/src/draco/compression/point_cloud/point_cloud_decoder.cc b/src/draco/compression/point_cloud/point_cloud_decoder.cc index 85f7bc94..6b8d1630 100644 --- a/src/draco/compression/point_cloud/point_cloud_decoder.cc +++ b/src/draco/compression/point_cloud/point_cloud_decoder.cc @@ -63,7 +63,7 @@ Status PointCloudDecoder::DecodeMetadata() { return OkStatus(); } -Status PointCloudDecoder::Decode(const DecoderOptions &options, +Status PointCloudDecoder::DecodeStep1(const DecoderOptions &options, DecoderBuffer *in_buffer, PointCloud *out_point_cloud) { options_ = &options; @@ -119,21 +119,29 @@ Status PointCloudDecoder::Decode(const DecoderOptions &options, if (!DecodeGeometryData()) { return Status(Status::DRACO_ERROR, "Failed to decode geometry data."); } - if (!DecodePointAttributes()) { + if (!DecodePointAttributesStep1()) { return Status(Status::DRACO_ERROR, "Failed to decode point attributes."); } return OkStatus(); } -bool PointCloudDecoder::DecodePointAttributes() { - uint8_t num_attributes_decoders; - if (!buffer_->Decode(&num_attributes_decoders)) { +Status PointCloudDecoder::DecodeStep2() { + if (!DecodePointAttributesStep2()) { + return Status(Status::DRACO_ERROR, "Failed to decode point attributes."); + } + return OkStatus(); +} + +bool PointCloudDecoder::DecodePointAttributesStep1() { + + uint8_t tmp_num_attributes_decoders; + if (!buffer_->Decode(&tmp_num_attributes_decoders)) { return false; } // Create all attribute decoders. This is implementation specific and the // derived classes can use any data encoded in the // PointCloudEncoder::EncodeAttributesEncoderIdentifier() call. - for (int i = 0; i < num_attributes_decoders; ++i) { + for (int i = 0; i < tmp_num_attributes_decoders; ++i) { if (!CreateAttributesDecoder(i)) { return false; } @@ -147,14 +155,18 @@ bool PointCloudDecoder::DecodePointAttributes() { } // Decode any data needed by the attribute decoders. - for (int i = 0; i < num_attributes_decoders; ++i) { + for (int i = 0; i < tmp_num_attributes_decoders; ++i) { if (!attributes_decoders_[i]->DecodeAttributesDecoderData(buffer_)) { return false; } } + return true; +} + +bool PointCloudDecoder::DecodePointAttributesStep2() { // Create map between attribute and decoder ids. - for (int i = 0; i < num_attributes_decoders; ++i) { + for (int i = 0; i < num_attributes_decoders(); ++i) { const int32_t num_attributes = attributes_decoders_[i]->GetNumAttributes(); for (int j = 0; j < num_attributes; ++j) { int att_id = attributes_decoders_[i]->GetAttributeId(j); diff --git a/src/draco/compression/point_cloud/point_cloud_decoder.h b/src/draco/compression/point_cloud/point_cloud_decoder.h index 4af7f5cd..24dd26b3 100644 --- a/src/draco/compression/point_cloud/point_cloud_decoder.h +++ b/src/draco/compression/point_cloud/point_cloud_decoder.h @@ -37,9 +37,11 @@ class PointCloudDecoder { static Status DecodeHeader(DecoderBuffer *buffer, DracoHeader *out_header); // The main entry point for point cloud decoding. - Status Decode(const DecoderOptions &options, DecoderBuffer *in_buffer, + Status DecodeStep1(const DecoderOptions &options, DecoderBuffer *in_buffer, PointCloud *out_point_cloud); + Status DecodeStep2(); + bool SetAttributesDecoder( int att_decoder_id, std::unique_ptr decoder) { if (att_decoder_id < 0) { @@ -87,7 +89,8 @@ class PointCloudDecoder { // Creates an attribute decoder. virtual bool CreateAttributesDecoder(int32_t att_decoder_id) = 0; virtual bool DecodeGeometryData() { return true; } - virtual bool DecodePointAttributes(); + virtual bool DecodePointAttributesStep1(); + virtual bool DecodePointAttributesStep2(); virtual bool DecodeAllAttributes(); virtual bool OnAttributesDecoded() { return true; } diff --git a/src/draco/compression/point_cloud/point_cloud_kd_tree_encoding_test.cc b/src/draco/compression/point_cloud/point_cloud_kd_tree_encoding_test.cc index 7a7b597f..ba985a72 100644 --- a/src/draco/compression/point_cloud/point_cloud_kd_tree_encoding_test.cc +++ b/src/draco/compression/point_cloud/point_cloud_kd_tree_encoding_test.cc @@ -76,7 +76,8 @@ class PointCloudKdTreeEncodingTest : public ::testing::Test { std::unique_ptr out_pc(new PointCloud()); DecoderOptions dec_options; - DRACO_ASSERT_OK(decoder.Decode(dec_options, &dec_buffer, out_pc.get())); + DRACO_ASSERT_OK(decoder.DecodeStep1(dec_options, &dec_buffer, out_pc.get())); + DRACO_ASSERT_OK(decoder.DecodeStep2()); ComparePointClouds(pc, *out_pc); } diff --git a/src/draco/compression/point_cloud/point_cloud_sequential_encoding_test.cc b/src/draco/compression/point_cloud/point_cloud_sequential_encoding_test.cc index 32be120d..721e2e33 100644 --- a/src/draco/compression/point_cloud/point_cloud_sequential_encoding_test.cc +++ b/src/draco/compression/point_cloud/point_cloud_sequential_encoding_test.cc @@ -37,7 +37,10 @@ class PointCloudSequentialEncodingTest : public ::testing::Test { std::unique_ptr out_pc(new PointCloud()); DecoderOptions dec_options; - if (!decoder.Decode(dec_options, &dec_buffer, out_pc.get()).ok()) { + if (!decoder.DecodeStep1(dec_options, &dec_buffer, out_pc.get()).ok()) { + return nullptr; + } + if (!decoder.DecodeStep2().ok()) { return nullptr; } return out_pc; diff --git a/src/draco/unity/draco_unity_enc_plugin.cc b/src/draco/unity/draco_unity_enc_plugin.cc new file mode 100644 index 00000000..7cb94a48 --- /dev/null +++ b/src/draco/unity/draco_unity_enc_plugin.cc @@ -0,0 +1,350 @@ +// Copyright 2021 The Draco Authors. +// +// 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. +// + +#include "draco/unity/draco_unity_enc_plugin.h" + +#ifdef DRACO_UNITY_PLUGIN + +#include + +namespace draco { + + DracoEncoder *dracoEncoderCreate(uint32_t vertexCount) + { + DracoMeshEncoder *encoder = new DracoMeshEncoder; + encoder->is_point_cloud = false; + encoder->mesh.set_num_points(vertexCount); + return encoder; + } + + DracoEncoder *dracoEncoderCreatePointCloud(uint32_t vertexCount) { + DracoPointsEncoder *encoder = new DracoPointsEncoder; + encoder->is_point_cloud = true; + encoder->mesh.set_num_points(vertexCount); + return encoder; + } + + void dracoEncoderRelease(DracoEncoder *encoder) + { + delete encoder; + } + + void dracoEncoderSetCompressionSpeed(DracoEncoder *encoder, uint32_t encodingSpeed, uint32_t decodingSpeed) { + encoder->encodingSpeed = encodingSpeed; + encoder->decodingSpeed = decodingSpeed; + } + + void dracoEncoderSetQuantizationBits(DracoEncoder *encoder, uint32_t position, uint32_t normal, uint32_t uv, uint32_t color, uint32_t generic) + { + encoder->quantization.position = position; + encoder->quantization.normal = normal; + encoder->quantization.uv = uv; + encoder->quantization.color = color; + encoder->quantization.generic = generic; + } + + bool dracoEncoderEncode(DracoEncoder *encoder, uint8_t sequentialEncode) + { + if (encoder->is_point_cloud) { + return dracoEncode((DracoPointsEncoder *)encoder, sequentialEncode); + } else { + return dracoEncode((DracoMeshEncoder *)encoder, sequentialEncode); + } + } + + template + bool dracoEncode(T *encoderT, uint8_t sequentialEncode) { + auto encoder = (DracoEncoder *)encoderT; + draco::Encoder dracoEncoder; + dracoEncoder.SetSpeedOptions(encoder->encodingSpeed, + encoder->decodingSpeed); + dracoEncoder.SetAttributeQuantization(draco::GeometryAttribute::POSITION, + encoder->quantization.position); + dracoEncoder.SetAttributeQuantization(draco::GeometryAttribute::NORMAL, + encoder->quantization.normal); + dracoEncoder.SetAttributeQuantization(draco::GeometryAttribute::TEX_COORD, + encoder->quantization.uv); + dracoEncoder.SetAttributeQuantization(draco::GeometryAttribute::COLOR, + encoder->quantization.color); + dracoEncoder.SetAttributeQuantization(draco::GeometryAttribute::GENERIC, + encoder->quantization.generic); + dracoEncoder.SetTrackEncodedProperties(true); + + draco::Status encodeStatus; + + if (encoder->is_point_cloud) { + if (sequentialEncode) { + dracoEncoder.SetEncodingMethod(draco::POINT_CLOUD_SEQUENTIAL_ENCODING); + } else { + dracoEncoder.SetEncodingMethod(draco::POINT_CLOUD_KD_TREE_ENCODING); + } + + encodeStatus = dracoEncoder.EncodePointCloudToBuffer( + ((DracoPointsEncoder *)encoder)->mesh, &encoder->encoderBuffer); + } else { + if (sequentialEncode) { + dracoEncoder.SetEncodingMethod(draco::MESH_SEQUENTIAL_ENCODING); + } else { + dracoEncoder.SetEncodingMethod(draco::MESH_EDGEBREAKER_ENCODING); + } + + encodeStatus = dracoEncoder.EncodeMeshToBuffer( + ((DracoMeshEncoder *)encoder)->mesh, &encoder->encoderBuffer); + } + + if (encodeStatus.ok()) { + encoder->encodedVertices = + static_cast(dracoEncoder.num_encoded_points()); + encoder->encodedIndices = + static_cast(dracoEncoder.num_encoded_faces() * 3); + return true; + } else { + return false; + } + } + + uint32_t dracoEncoderGetEncodedVertexCount(DracoEncoder *encoder) + { + return encoder->encodedVertices; + } + + uint32_t dracoEncoderGetEncodedIndexCount(DracoEncoder *encoder) + { + return encoder->encodedIndices; + } + + uint64_t dracoEncoderGetByteLength(DracoEncoder *encoder) + { + return encoder->encoderBuffer.size(); + } + + void dracoEncoderCopy(DracoEncoder *encoder, uint8_t *data) + { + memcpy(data, encoder->encoderBuffer.data(), encoder->encoderBuffer.size()); + } + + void dracoEncoderGetEncodeBuffer(DracoEncoder *encoder, void **data, uint64_t *size) + { + *data = (void*) encoder->encoderBuffer.data(); + *size = encoder->encoderBuffer.size(); + } + + bool dracoEncodeIndices(DracoMeshEncoder *encoder, uint32_t indexCount, DataType indexType, bool flip, void *indices) + { + switch (indexType) + { + case DataType::DT_UINT16: + dracoEncodeIndices(encoder,indexCount,flip,static_cast(indices)); + break; + case DataType::DT_UINT32: + dracoEncodeIndices(encoder,indexCount,flip,static_cast(indices)); + break; + default: + return false; + } + + return true; + } + + template + void dracoEncodeIndices(DracoMeshEncoder *encoder, uint32_t indexCount, bool flip, T *indices) + { + int face_count = indexCount / 3; + encoder->mesh.SetNumFaces(static_cast(face_count)); + encoder->rawSize += indexCount * sizeof(T); + + if(flip) { + for (int i = 0; i < face_count; ++i) + { + draco::Mesh::Face face = { + draco::PointIndex(indices[3 * i + 0]), + draco::PointIndex(indices[3 * i + 2]), + draco::PointIndex(indices[3 * i + 1]) + }; + encoder->mesh.SetFace(draco::FaceIndex(static_cast(i)), face); + } + } + else { + for (int i = 0; i < face_count; ++i) + { + draco::Mesh::Face face = { + draco::PointIndex(indices[3 * i + 0]), + draco::PointIndex(indices[3 * i + 1]), + draco::PointIndex(indices[3 * i + 2]) + }; + encoder->mesh.SetFace(draco::FaceIndex(static_cast(i)), face); + } + } + } + + bool dracoEncoderSetIndices(DracoMeshEncoder *encoder, DataType indexComponentType, uint32_t indexCount, bool flip, void *indices) + { + switch (indexComponentType) + { + case DataType::DT_INT8: + dracoEncodeIndices(encoder, indexCount, flip, reinterpret_cast(indices)); + break; + case DataType::DT_UINT8: + dracoEncodeIndices(encoder, indexCount, flip, reinterpret_cast(indices)); + break; + case DataType::DT_INT16: + dracoEncodeIndices(encoder, indexCount, flip, reinterpret_cast(indices)); + break; + case DataType::DT_UINT16: + dracoEncodeIndices(encoder, indexCount, flip, reinterpret_cast(indices)); + break; + case DataType::DT_UINT32: + dracoEncodeIndices(encoder, indexCount, flip, reinterpret_cast(indices)); + break; + default: + return false; + } + return true; + } + + + uint32_t dracoEncoderSetAttribute(DracoEncoder *encoder, + GeometryAttribute::Type attributeType, + draco::DataType dracoDataType, + int32_t componentCount, int32_t stride, + bool flip, + void *data) { + if (encoder->is_point_cloud) { + return dracoSetAttribute( + (DracoPointsEncoder*)encoder, attributeType, dracoDataType, + componentCount, stride, flip, data); + } else { + return dracoSetAttribute((DracoMeshEncoder *)encoder, attributeType, + dracoDataType, + componentCount, stride, flip, data); + } + + } + + template + void SetAttributeValuesFlipped(E *encoder, uint32_t id, uint32_t count, int32_t componentCount, int32_t stride, uint8_t * dataBytes) { + + switch (componentCount) { + case 2: + { + T tmp[2]; + for (uint32_t i = 0; i < count; i++) + { + T* srcPtr = (T*) (dataBytes + i * stride); + // Texture coordinate left-handed lower left to right-handed top left conversion + tmp[0] = *srcPtr; + tmp[1] = ((T)1) - (*(srcPtr+1)); + encoder->mesh.attribute(id)->SetAttributeValue(draco::AttributeValueIndex(i), tmp); + } + break; + } + case 3: + { + T tmp[3]; + for (uint32_t i = 0; i < count; i++) + { + T* srcPtr = (T*) (dataBytes + i * stride); + // Position/Normal left-hand to right-handed coordinate system switch: flip X axis + tmp[0] = -(*srcPtr); + tmp[1] = *(srcPtr+1); + tmp[2] = *(srcPtr+2); + encoder->mesh.attribute(id)->SetAttributeValue(draco::AttributeValueIndex(i), tmp); + } + break; + } + case 4: + { + T tmp[4]; + for (uint32_t i = 0; i < count; i++) + { + T* srcPtr = (T*) (dataBytes + i * stride); + // Tangent left-hand to right-handed coordinate system switch: flip Y and Z axis + tmp[0] = *(srcPtr+0); + tmp[1] = -*(srcPtr+1); + tmp[2] = -*(srcPtr+2); + tmp[3] = *(srcPtr+3); + encoder->mesh.attribute(id)->SetAttributeValue(draco::AttributeValueIndex(i), tmp); + } + break; + } + default: + { + for (uint32_t i = 0; i < count; i++) + { + encoder->mesh.attribute(id)->SetAttributeValue(draco::AttributeValueIndex(i), dataBytes + i * stride); + } + break; + } + } + } + + template + uint32_t dracoSetAttribute(T *encoder, + GeometryAttribute::Type attributeType, + draco::DataType dracoDataType, + int32_t componentCount, int32_t stride, + bool flip, + void *data) + { + auto buffer = std::unique_ptr( new draco::DataBuffer()); + uint32_t count = encoder->mesh.num_points(); + + draco::GeometryAttribute attribute; + attribute.Init(attributeType, &*buffer, componentCount, dracoDataType, false, stride, 0); + + auto id = static_cast(encoder->mesh.AddAttribute(attribute, true, count)); + auto dataBytes = reinterpret_cast(data); + + if(flip) { + switch (dracoDataType) { + case draco::DataType::DT_INT8: + SetAttributeValuesFlipped(encoder, id, count, componentCount, stride, dataBytes); + break; + case draco::DataType::DT_UINT8: + SetAttributeValuesFlipped(encoder, id, count, componentCount, stride, dataBytes); + break; + case draco::DataType::DT_INT16: + SetAttributeValuesFlipped(encoder, id, count, componentCount, stride, dataBytes); + break; + case draco::DataType::DT_UINT16: + SetAttributeValuesFlipped(encoder, id, count, componentCount, stride, dataBytes); + break; + case draco::DataType::DT_INT32: + SetAttributeValuesFlipped(encoder, id, count, componentCount, stride, dataBytes); + break; + case draco::DataType::DT_UINT32: + SetAttributeValuesFlipped(encoder, id, count, componentCount, stride, dataBytes); + break; + case draco::DataType::DT_FLOAT32: + SetAttributeValuesFlipped(encoder, id, count, componentCount, stride, dataBytes); + break; + default: + break; + } + } else { + for (uint32_t i = 0; i < count; i++) + { + encoder->mesh.attribute(id)->SetAttributeValue(draco::AttributeValueIndex(i), dataBytes + i * stride); + } + } + + encoder->buffers.emplace_back(std::move(buffer)); + encoder->rawSize += count * stride; + return id; + } + +} // namespace draco + +#endif // DRACO_UNITY_PLUGIN diff --git a/src/draco/unity/draco_unity_enc_plugin.h b/src/draco/unity/draco_unity_enc_plugin.h new file mode 100644 index 00000000..d177d22e --- /dev/null +++ b/src/draco/unity/draco_unity_enc_plugin.h @@ -0,0 +1,112 @@ +// Copyright 2021 The Draco Authors. +// +// 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. +// +#ifndef DRACO_UNITY_ENC_DRACO_UNITY_PLUGIN_H_ +#define DRACO_UNITY_ENC_DRACO_UNITY_PLUGIN_H_ + +// No idea why, but if this (or any other draco header) is not included DRACO_UNITY_PLUGIN is not defined +#include "draco/core/draco_types.h" +#include "draco/mesh/mesh.h" +#include "draco/core/encoder_buffer.h" +#include "draco/compression/encode.h" + + +#ifdef DRACO_UNITY_PLUGIN + +// If compiling with Visual Studio. +#if defined(_MSC_VER) +#define EXPORT_API __declspec(dllexport) +#else +// Other platforms don't need this. +#define EXPORT_API +#endif // defined(_MSC_VER) + +namespace draco { + + struct DracoEncoder + { + uint32_t encodedVertices; + uint32_t encodedIndices; + std::vector> buffers; + draco::EncoderBuffer encoderBuffer; + uint32_t encodingSpeed = 0; + uint32_t decodingSpeed = 0; + std::size_t rawSize = 0; + struct + { + uint32_t position = 14; + uint32_t normal = 10; + uint32_t uv = 12; + uint32_t color = 10; + uint32_t generic = 12; + } quantization; + bool is_point_cloud; + }; + + struct DracoMeshEncoder : DracoEncoder { + draco::Mesh mesh; + }; + + struct DracoPointsEncoder : DracoEncoder { + draco::PointCloud mesh; + }; + + template + void dracoEncodeIndices(DracoMeshEncoder *encoder, uint32_t indexCount, + bool flip, T *indices); + template + uint32_t dracoSetAttribute(T *encoder, GeometryAttribute::Type attributeType, + draco::DataType dracoDataType, + int32_t componentCount, int32_t stride, + bool flip, + void *data); + + template + bool dracoEncode(T *encoder, uint8_t sequentialEncode); + + +extern "C" { + + EXPORT_API DracoEncoder *dracoEncoderCreate(uint32_t vertexCount); + EXPORT_API DracoEncoder *dracoEncoderCreatePointCloud(uint32_t pointCount); + void EXPORT_API dracoEncoderRelease(DracoEncoder *encoder); + void EXPORT_API dracoEncoderSetCompressionSpeed(DracoEncoder *encoder, uint32_t encodingSpeed, uint32_t decodingSpeed); + void EXPORT_API dracoEncoderSetQuantizationBits(DracoEncoder *encoder, uint32_t position, uint32_t normal, uint32_t uv, uint32_t color, uint32_t generic); + bool EXPORT_API dracoEncoderEncode(DracoEncoder *encoder, uint8_t preserveTriangleOrder); + uint32_t EXPORT_API dracoEncoderGetEncodedVertexCount(DracoEncoder *encoder); + uint32_t EXPORT_API dracoEncoderGetEncodedIndexCount(DracoEncoder *encoder); + uint64_t EXPORT_API dracoEncoderGetByteLength(DracoEncoder *encoder); + void EXPORT_API dracoEncoderCopy(DracoEncoder *encoder, uint8_t *data); + void EXPORT_API dracoEncoderGetEncodeBuffer(DracoEncoder *encoder, void **data, uint64_t *size); + bool EXPORT_API dracoEncoderSetIndices(DracoMeshEncoder *encoder, + DataType indexComponentType, + uint32_t indexCount, + bool flip, + void *indices); + uint32_t EXPORT_API dracoEncoderSetAttribute( + DracoEncoder *encoder, + GeometryAttribute::Type attributeType, + draco::DataType dracoDataType, + int32_t componentCount, + int32_t stride, + bool flip, + void *data + ); + } // extern "C" + +} // namespace draco + +#endif // DRACO_UNITY_PLUGIN + +#endif // DRACO_UNITY_ENC_DRACO_UNITY_PLUGIN_H_ diff --git a/src/draco/unity/draco_unity_plugin.cc b/src/draco/unity/draco_unity_plugin.cc index e80279b8..4378e8aa 100644 --- a/src/draco/unity/draco_unity_plugin.cc +++ b/src/draco/unity/draco_unity_plugin.cc @@ -31,29 +31,67 @@ draco::DracoAttribute *CreateDracoAttribute(const draco::PointAttribute *attr) { // Returns the attribute data in |attr| as an array of type T. template -T *CopyAttributeData(int num_points, const draco::PointAttribute *attr) { +T *CopyAttributeData(int num_points, const draco::PointAttribute *attr, int component_stride) { const int num_components = attr->num_components(); - T *const data = new T[num_points * num_components]; + T *const data = new T[num_points * component_stride]; for (draco::PointIndex i(0); i < num_points; ++i) { const draco::AttributeValueIndex val_index = attr->mapped_index(i); bool got_data = false; switch (num_components) { case 1: - got_data = attr->ConvertValue(val_index, - data + i.value() * num_components); + got_data = attr->ConvertValue(val_index, data + i.value() * component_stride); break; case 2: - got_data = attr->ConvertValue(val_index, - data + i.value() * num_components); + got_data = attr->ConvertValue(val_index, data + i.value() * component_stride); break; case 3: - got_data = attr->ConvertValue(val_index, - data + i.value() * num_components); + got_data = attr->ConvertValue(val_index, data + i.value() * component_stride); break; case 4: - got_data = attr->ConvertValue(val_index, - data + i.value() * num_components); + got_data = attr->ConvertValue(val_index, data + i.value() * component_stride); + break; + default: + break; + } + if (!got_data) { + delete[] data; + return nullptr; + } + } + + return data; +} + +// Returns the attribute data in |attr| as an array of type T. +template +T *CopyAttributeDataFlipped(int num_points, const draco::PointAttribute *attr, int component_stride) { + const int num_components = attr->num_components(); + T *const data = new T[num_points * component_stride]; + + for (draco::PointIndex i(0); i < num_points; ++i) { + const draco::AttributeValueIndex val_index = attr->mapped_index(i); + bool got_data = false; + T *outPtr = data + i.value() * component_stride; + switch (num_components) { + case 1: + got_data = attr->ConvertValue(val_index,outPtr); + break; + case 2: + got_data = attr->ConvertValue(val_index,outPtr); + // Texture coordinate right-handed top left to left-handed lower left conversion + *(outPtr+1) = 1-*(outPtr+1); + break; + case 3: + got_data = attr->ConvertValue(val_index,outPtr); + // Position/Normal right-hand to left-handed coordinate system switch: flip X axis + *(outPtr) *= -1; + break; + case 4: + got_data = attr->ConvertValue(val_index,outPtr); + // Tangent right-hand to left-handed coordinate system switch: flip Y and Z axis + *(outPtr+1) *= -1; + *(outPtr+2) *= -1; break; default: break; @@ -68,26 +106,84 @@ T *CopyAttributeData(int num_points, const draco::PointAttribute *attr) { } // Returns the attribute data in |attr| as an array of void*. -void *ConvertAttributeData(int num_points, const draco::PointAttribute *attr) { +void *ConvertAttributeData(int num_points, const draco::PointAttribute *attr, + bool flip, int component_stride) { switch (attr->data_type()) { case draco::DataType::DT_INT8: - return static_cast(CopyAttributeData(num_points, attr)); + return static_cast(flip ? CopyAttributeDataFlipped(num_points, attr, component_stride) : CopyAttributeData(num_points, attr, component_stride)); case draco::DataType::DT_UINT8: - return static_cast(CopyAttributeData(num_points, attr)); + return static_cast(flip ? CopyAttributeDataFlipped(num_points, attr, component_stride) : CopyAttributeData(num_points, attr, component_stride)); case draco::DataType::DT_INT16: - return static_cast(CopyAttributeData(num_points, attr)); + return static_cast(flip ? CopyAttributeDataFlipped(num_points, attr, component_stride) : CopyAttributeData(num_points, attr, component_stride)); case draco::DataType::DT_UINT16: - return static_cast(CopyAttributeData(num_points, attr)); + return static_cast(flip ? CopyAttributeDataFlipped(num_points, attr, component_stride) : CopyAttributeData(num_points, attr, component_stride)); case draco::DataType::DT_INT32: - return static_cast(CopyAttributeData(num_points, attr)); + return static_cast(flip ? CopyAttributeDataFlipped(num_points, attr, component_stride) : CopyAttributeData(num_points, attr, component_stride)); case draco::DataType::DT_UINT32: - return static_cast(CopyAttributeData(num_points, attr)); + return static_cast(flip ? CopyAttributeDataFlipped(num_points, attr, component_stride) : CopyAttributeData(num_points, attr, component_stride)); case draco::DataType::DT_FLOAT32: - return static_cast(CopyAttributeData(num_points, attr)); + return static_cast(flip ? CopyAttributeDataFlipped(num_points, attr, component_stride) : CopyAttributeData(num_points, attr, component_stride)); default: return nullptr; } } + +bool GetMeshIndicesUInt16(const draco::DracoMesh *mesh, void* indices, uint32_t indicesCount, bool flip) { + + const draco::Mesh *const m = static_cast(mesh->private_mesh); + if(indicesCount < m->num_faces() * 3) { + return false; + } + uint16_t *const temp_indices = static_cast(indices); + + if(flip) { + for (draco::FaceIndex face_id(0); face_id < m->num_faces(); ++face_id) { + const draco::Mesh::Face &face = m->face(draco::FaceIndex(face_id)); + uint16_t* const dest = temp_indices + face_id.value() * 3; + const int32_t* src = reinterpret_cast(face.data()); + *dest = *src; + *(dest+1) = *(src+2); + *(dest+2) = *(src+1); + } + } else { + for (draco::FaceIndex face_id(0); face_id < m->num_faces(); ++face_id) { + const draco::Mesh::Face &face = m->face(draco::FaceIndex(face_id)); + uint16_t* const dest = temp_indices + face_id.value() * 3; + const int32_t* src = reinterpret_cast(face.data()); + *dest = *src; + *(dest+1) = *(src+1); + *(dest+2) = *(src+2); + } + } + return true; +} + +bool GetMeshIndicesUInt32(const draco::DracoMesh *mesh, void* indices, uint32_t indicesCount, bool flip) { + + const draco::Mesh *const m = static_cast(mesh->private_mesh); + if(indicesCount < m->num_faces() * 3) { + return false; + } + uint32_t *const temp_indices = static_cast(indices); + + if(flip) { + for (draco::FaceIndex face_id(0); face_id < m->num_faces(); ++face_id) { + const draco::Mesh::Face &face = m->face(draco::FaceIndex(face_id)); + uint32_t* const dest = temp_indices + face_id.value() * 3; + const int32_t* src = reinterpret_cast(face.data()); + *dest = *src; + *(dest+1) = *(src+2); + *(dest+2) = *(src+1); + } + } else { + for (draco::FaceIndex face_id(0); face_id < m->num_faces(); ++face_id) { + const draco::Mesh::Face &face = m->face(draco::FaceIndex(face_id)); + memcpy(temp_indices + face_id.value() * 3, + reinterpret_cast(face.data()), sizeof(uint32_t) * 3); + } + } + return true; +} } // namespace namespace draco { @@ -152,38 +248,78 @@ void EXPORT_API ReleaseDracoData(DracoData **data_ptr) { *data_ptr = nullptr; } -int EXPORT_API DecodeDracoMesh(char *data, unsigned int length, - DracoMesh **mesh) { +int EXPORT_API DecodeDracoMeshStep1( + char *data, + unsigned int length, + DracoMesh **mesh, + draco::Decoder** decoder, + draco::DecoderBuffer** buffer + ) +{ if (mesh == nullptr || *mesh != nullptr) { return -1; } - draco::DecoderBuffer buffer; - buffer.Init(data, length); - auto type_statusor = draco::Decoder::GetEncodedGeometryType(&buffer); + *buffer = new draco::DecoderBuffer(); + (*buffer)->Init(data, length); + auto type_statusor = draco::Decoder::GetEncodedGeometryType(*buffer); if (!type_statusor.ok()) { // TODO(draco-eng): Use enum instead. return -2; } const draco::EncodedGeometryType geom_type = type_statusor.value(); - if (geom_type != draco::TRIANGULAR_MESH) { + if (geom_type != draco::TRIANGULAR_MESH && geom_type != draco::POINT_CLOUD) { return -3; } - draco::Decoder decoder; - auto statusor = decoder.DecodeMeshFromBuffer(&buffer); - if (!statusor.ok()) { - return -4; - } - std::unique_ptr in_mesh = std::move(statusor).value(); - *mesh = new DracoMesh(); + *decoder = new draco::Decoder(); + + if (geom_type == draco::TRIANGULAR_MESH) { + auto statusor = (*decoder)->DecodeMeshFromBufferStep1(*buffer); + if (!statusor.ok()) { + return -4; + } + + std::unique_ptr in_mesh = std::move(statusor).value(); + DracoMesh *const unity_mesh = *mesh; + unity_mesh->num_faces = in_mesh->num_faces(); + unity_mesh->num_vertices = in_mesh->num_points(); + unity_mesh->num_attributes = in_mesh->num_attributes(); + unity_mesh->is_point_cloud = false; + unity_mesh->private_mesh = static_cast(in_mesh.release()); + + } else if (geom_type == draco::POINT_CLOUD) { + auto statusor = (*decoder)->DecodePointCloudFromBuffer(*buffer); + if (!statusor.ok()) { + return -5; + } + + std::unique_ptr in_cloud = std::move(statusor).value(); + DracoMesh *const unity_mesh = *mesh; + unity_mesh->num_faces = 0; + unity_mesh->num_vertices = in_cloud->num_points(); + unity_mesh->num_attributes = in_cloud->num_attributes(); + unity_mesh->is_point_cloud = true; + unity_mesh->private_mesh = static_cast(in_cloud.release()); + } + return 0; +} + +int EXPORT_API DecodeDracoMeshStep2(DracoMesh **mesh,draco::Decoder* decoder, draco::DecoderBuffer* buffer) { DracoMesh *const unity_mesh = *mesh; - unity_mesh->num_faces = in_mesh->num_faces(); - unity_mesh->num_vertices = in_mesh->num_points(); - unity_mesh->num_attributes = in_mesh->num_attributes(); - unity_mesh->private_mesh = static_cast(in_mesh.release()); + if (unity_mesh->is_point_cloud) { + delete decoder; + delete buffer; + return 0; + } - return unity_mesh->num_faces; + auto status = decoder->DecodeMeshFromBufferStep2(); + delete decoder; + delete buffer; + if (!status.ok()) { + return -4; + } + return 0; } bool EXPORT_API GetAttribute(const DracoMesh *mesh, int index, @@ -231,27 +367,27 @@ bool EXPORT_API GetAttributeByUniqueId(const DracoMesh *mesh, int unique_id, return true; } -bool EXPORT_API GetMeshIndices(const DracoMesh *mesh, DracoData **indices) { - if (mesh == nullptr || indices == nullptr || *indices != nullptr) { +bool EXPORT_API GetMeshIndices(const DracoMesh *mesh, DataType dataType, void* indices, uint32_t indicesCount, bool flip) { + if (mesh == nullptr || indices == nullptr || mesh->is_point_cloud) { return false; } - const Mesh *const m = static_cast(mesh->private_mesh); - int *const temp_indices = new int[m->num_faces() * 3]; - for (draco::FaceIndex face_id(0); face_id < m->num_faces(); ++face_id) { - const Mesh::Face &face = m->face(draco::FaceIndex(face_id)); - memcpy(temp_indices + face_id.value() * 3, - reinterpret_cast(face.data()), sizeof(int) * 3); + + void *tmp; + switch(dataType) { + case DT_UINT16: + return GetMeshIndicesUInt16(mesh,indices,indicesCount,flip); + case DT_UINT32: + return GetMeshIndicesUInt32(mesh,indices,indicesCount,flip); + default: + return false; } - DracoData *const draco_data = new DracoData(); - draco_data->data = temp_indices; - draco_data->data_type = DT_INT32; - *indices = draco_data; + return true; } bool EXPORT_API GetAttributeData(const DracoMesh *mesh, const DracoAttribute *attribute, - DracoData **data) { + DracoData **data, bool flip,int stride) { if (mesh == nullptr || data == nullptr || *data != nullptr) { return false; } @@ -259,7 +395,7 @@ bool EXPORT_API GetAttributeData(const DracoMesh *mesh, const PointAttribute *const attr = static_cast(attribute->private_attribute); - void *temp_data = ConvertAttributeData(m->num_points(), attr); + void *temp_data = ConvertAttributeData(m->num_points(), attr, flip, stride); if (temp_data == nullptr) { return false; } diff --git a/src/draco/unity/draco_unity_plugin.h b/src/draco/unity/draco_unity_plugin.h index 2f878889..55f6560e 100644 --- a/src/draco/unity/draco_unity_plugin.h +++ b/src/draco/unity/draco_unity_plugin.h @@ -64,11 +64,13 @@ struct EXPORT_API DracoMesh { : num_faces(0), num_vertices(0), num_attributes(0), + is_point_cloud(false), private_mesh(nullptr) {} int num_faces; int num_vertices; int num_attributes; + bool is_point_cloud; void *private_mesh; }; @@ -81,8 +83,10 @@ void EXPORT_API ReleaseDracoData(DracoData **data_ptr); // Decodes compressed Draco mesh in |data| and returns |mesh|. On input, |mesh| // must be null. The returned |mesh| must be released with ReleaseDracoMesh. -int EXPORT_API DecodeDracoMesh(char *data, unsigned int length, - DracoMesh **mesh); +int EXPORT_API DecodeDracoMeshStep1(char *data, unsigned int length, + DracoMesh **mesh, draco::Decoder** decoder,draco::DecoderBuffer** buffer); +int EXPORT_API DecodeDracoMeshStep2(DracoMesh **mesh,draco::Decoder* decoder, draco::DecoderBuffer* buffer); + // Returns |attribute| at |index| in |mesh|. On input, |attribute| must be // null. The returned |attribute| must be released with ReleaseDracoAttribute. @@ -100,16 +104,16 @@ bool EXPORT_API GetAttributeByType(const DracoMesh *mesh, // null. The returned |attribute| must be released with ReleaseDracoAttribute. bool EXPORT_API GetAttributeByUniqueId(const DracoMesh *mesh, int unique_id, DracoAttribute **attribute); -// Returns the indices as well as the type of data in |indices|. On input, -// |indices| must be null. The returned |indices| must be released with -// ReleaseDracoData. -bool EXPORT_API GetMeshIndices(const DracoMesh *mesh, DracoData **indices); +// Write the indices into |indices|, a provided buffer. +// |indicesCount| multiplied by |dataType| specific component length +// gives you the size of |indices| +bool EXPORT_API GetMeshIndices(const DracoMesh *mesh, DataType dataType, void* indices, uint32_t indicesCount, bool flip); // Returns the attribute data from attribute as well as the type of data in // |data|. On input, |data| must be null. The returned |data| must be released // with ReleaseDracoData. bool EXPORT_API GetAttributeData(const DracoMesh *mesh, const DracoAttribute *attribute, - DracoData **data); + DracoData **data, bool flip, int component_stride); // DracoToUnityMesh is deprecated. struct EXPORT_API DracoToUnityMesh {