Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity related changes #690

Draft
wants to merge 71 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
cacdb96
feat: Split up Decoder::DecodeMeshFromBuffer into two steps. Step 1 p…
atteneder Feb 12, 2021
ac08ac8
feat: Added option to convert mesh's coordinate space from right-hand…
atteneder Feb 15, 2021
5780e03
fix: Compilation for Emscripten
atteneder Mar 1, 2021
84cd91a
fix: Brought back DecodeBufferToGeometry (combined Step 1+2), which f…
atteneder Mar 2, 2021
0f3e467
feat: GitHub action to build Unity libraries
atteneder Mar 2, 2021
6f5f750
fix: UWP arm builds
atteneder Mar 2, 2021
65be1ed
fix: Ensure iOS bitcode generation
atteneder Mar 2, 2021
ac1abbf
fix: UWP arm builds
atteneder Mar 2, 2021
ff8e6be
feat: Added library that has C bindings for encoding meshes in Unity.
atteneder Feb 18, 2021
ce7ca01
fix: Initial, working version of draco encoding in Unity
atteneder Mar 1, 2021
59fabf4
feat: Next version of encoder based on Blender-glTF-IO C bindings yie…
atteneder Mar 1, 2021
e9518e9
feat: Added dracoenc_unity to GH actions build for Editor platforms (…
atteneder Mar 2, 2021
c568382
fix: MSVC compiler error
atteneder Mar 2, 2021
dab5b10
chore: renamed GH action yaml
atteneder Mar 2, 2021
5ab3b31
fix: dracodec_unity is a smaller, single file static lib now for Emsc…
atteneder Mar 2, 2021
615d29c
fix: Renamed action
atteneder Mar 2, 2021
ffad4bf
feat: Exposing both encode and decode speed for better fine-tuning
atteneder Mar 3, 2021
d969298
fix: Increase backwards compatibility by building Linux libs on Ubunt…
atteneder Mar 5, 2021
1dfaa56
fix: consistent GH action version
atteneder May 14, 2021
c25c02a
chore: split up long commands/lines
atteneder May 14, 2021
09cf8cd
fix: Pinned Xcode version to current live stable
atteneder May 14, 2021
d7e70ca
fix: Replaced manual ninja-build installation with GH action
atteneder May 14, 2021
f3061b2
fix: Simplified iOS C++ flag settings
atteneder May 14, 2021
a62b35f
fix: Simplified WindowsStore C++ flag settings
atteneder May 14, 2021
833c4dc
fix: Removing 32 bit Linux build (not supported anymore in Unity 2019…
atteneder May 14, 2021
95ae62d
fix: rollback using specific Xcode version
atteneder May 14, 2021
2143837
fix: Pinning gha-setup-ninja version
atteneder May 14, 2021
00fb3e7
fix: Changed the way coordinate system is converted. Instead of flipp…
atteneder May 18, 2021
e22c11c
feat: Updated Android NDK to r21e and use GH action for installing it
atteneder Jun 30, 2021
ca88721
feat: Updated Emscripten build required for Unity 2021.2
atteneder Jun 30, 2021
59d1bb2
feat: Added support for 16 bit unsigned integer indices to the Unity …
atteneder Aug 27, 2021
e2d85b9
feat: Avoid allocation of temporary index buffer by writing indices i…
atteneder Aug 27, 2021
0446a90
add point cloud compression to DRACO_GLTF options
camnewnham Aug 4, 2021
884aab3
Allow DracoMesh to be point cloud (zero faces)
camnewnham Aug 4, 2021
cd74db5
decode correct type
camnewnham Aug 4, 2021
7a59a3e
Add is_point_cloud
camnewnham Aug 4, 2021
181d832
default to edgebreaker encoding
camnewnham Apr 29, 2022
ce78fca
add support for point cloud encoding
camnewnham May 3, 2022
1b565b6
add support for overriding component count (padding color attributes)
camnewnham May 4, 2022
1a9465e
chore: Build parameter was renamed
atteneder Jan 25, 2023
eeaacc1
feat: Another Emscripten build (version 3.1.8)
atteneder Jan 25, 2023
fad7797
Add builds for dracoenc_unity for all platforms
camnewnham Jul 11, 2022
f8edba6
Update unity.yml
camnewnham Jul 11, 2022
a6fef05
Update unity.yml
camnewnham Jul 11, 2022
6e72149
Update unity.yml
camnewnham Jul 11, 2022
7da92f6
Update unity.yml
camnewnham Jul 12, 2022
792c81a
feat: Added Emscripten 3.1.8 encoder build
atteneder Jan 25, 2023
aa0ee9d
fix: Upgrade to windows-2022 to use VS 17
atteneder Jan 25, 2023
d08d253
fix: Limit action to releases on unity branch with unity prefixed tag…
atteneder Feb 1, 2023
97cace0
fix: Conflicting Emscripten cache folders
atteneder Apr 1, 2023
0ef74be
fix: typo
atteneder Apr 1, 2023
c00ed7b
feat: Easier WebGL binary structure
atteneder Apr 1, 2023
c00b810
chore: Updated download-artifact action
atteneder Apr 1, 2023
81afe07
chore: Updated Ubuntu image (18.04 is obsolete now)
atteneder Apr 1, 2023
09cf382
chore: Ignoring various files
atteneder Apr 26, 2023
950dcf6
feat: Support for flipping indices/attributes left-handed to right-ha…
atteneder May 8, 2023
6c24182
feat: `dracoEncoderGetEncodeBuffer` gives direct access to the encode…
atteneder May 9, 2023
a28e4f4
fix: Variable length arrays are not portable C++ (gave errors in MSVC)
atteneder May 15, 2023
022589f
feat: Added iOS Simulator binaries
atteneder May 17, 2023
34e7728
fix: Replace Ninja setup GitHub action that uses deprecated node.js v…
atteneder May 17, 2023
a4ee405
Draco Unity native libs refactor (#2)
atteneder Nov 2, 2023
8870e23
Added Unity WebGL sub-packages (#3)
atteneder Nov 2, 2023
402b299
Unity Binaries 3.0.0 and Unity WebGL packages 1.0.0-pre.1 (#4)
atteneder Nov 6, 2023
afd6b4e
chore: Post-release (#5)
atteneder Nov 6, 2023
7a4a3e2
fix: Removed warning about missing main package when it was installed…
atteneder Nov 8, 2023
fe505f4
chore: Consistent job names
atteneder Nov 9, 2023
2dbfc76
feat: Unity Android x86_64 binary (for Chrome OS)
atteneder Nov 9, 2023
5a8dd8b
Unity Binaries 3.1.0 and Unity WebGL packages 1.0.0-pre.2
atteneder Nov 14, 2023
7dce9c5
chore: Post-release (#9)
atteneder Dec 7, 2023
6c066d8
fix: Adding full license to third party notices. (#10)
atteneder Dec 7, 2023
921a399
Unity WebGL packages 1.0.0
atteneder Dec 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
489 changes: 489 additions & 0 deletions .github/workflows/unity.yml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
docs/_site

/.vscode
/build*

.DS_Store
44 changes: 44 additions & 0 deletions .yamato/environments.metafile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
log_path: "test_results~"

artifactory_url: "https://artifactory.prd.cds.internal.unity3d.com/artifactory"
homebrew_url: "[email protected]: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 ]
31 changes: 31 additions & 0 deletions .yamato/project.metafile
Original file line number Diff line number Diff line change
@@ -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
166 changes: 166 additions & 0 deletions .yamato/upm-ci.yml
Original file line number Diff line number Diff line change
@@ -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 -%}
58 changes: 50 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
atteneder marked this conversation as resolved.
Show resolved Hide resolved
"${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")
Expand Down Expand Up @@ -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
Expand All @@ -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()

Expand Down
31 changes: 31 additions & 0 deletions UnityPackages/com.unity.cloud.draco.webgl-2020/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading