Skip to content

Commit

Permalink
com.unity.cloud.gltfast@6.9.0
Browse files Browse the repository at this point in the history
## [6.9.0] - 2024-10-30

### Added
- Package coherence tests that make sure package versions match across exported generator string and documentation.

### Changed
- Moved code examples that are referenced by the documentation into a different folder (`DocExamples`).
- Renamed code example assembly/namespace to `GLTFast.Documentation.Examples` for consistency.

### Fixed
- (Test) LoadTests on Android now succeed by using `UnityWebRequest` to retrieve data from the compressed JAR file.
- Loading glTFs from `StreamingAssets` with relative URIs containing Unicode characters on Android. UriHelper.GetBaseUri and UriHelper.GetUriString handle Android `jar:file://` schema URIs with unicode characters correctly (fixes [#667](atteneder/glTFast#667)).
- XML documentation fixes
- Removed unnecessary "type" property from `package.json`.
- Removed warning about obsolete `GraphicsDeviceType.OpenGLES2` in Unity 2023.1 or newer.
- (Export) Missing texture transform if texture on glTFast material was scaled vertically only.
- Improved reliability by adding null checks and imprecision-aware floating-point comparisons in various places.
- Using immutable fields only in hash code calculation for `ImageExport` classes.
- Refactored `GetHashCode` implementations referencing mutable fields to avoid potential unexpected behavior.
  - `TextureComparer.Equals` made `GetHashCode`/`Equals` for `TextureBase` obsolete, so they've been removed.
  - `MeshPrimitiveComparer` is now used for clustering mesh primitives (instead of `GetHashCode`/`Equals` on `MeshPrimitive` and sub-types).
- Set minimum required Unity version to 2020.3.48f1 in the documentation.
- (Export) Avoid potential loss of data by allocating output streams persistently.
- (Test) Render export test inconclusive if the result has not been validated.
- (Test) More explicit error message by throwing innermost exception while preserving the stack trace during async tests.
- (Documentation) Various clarifications, improvements and fixes, based on user feedback.

### Removed
- Outdated and unused code coverage badge.
  • Loading branch information
Unity Technologies committed Oct 30, 2024
1 parent fef9171 commit b6e5b26
Show file tree
Hide file tree
Showing 68 changed files with 744 additions and 516 deletions.
1 change: 1 addition & 0 deletions .signature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"timestamp":1730304508,"signature":"Z4RXg93CZkelTzHD1G0aQFlEzZX8hgZeoZK89lpIx3Ve8rzlS0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jlSdm1jMGdpclA4T0lLQWxBRWZ2TzV5Z2hSKy8vd1RpTFlzUQp1SllDM0V2UE16ZGdKUzdGR2FscnFLZzlPTCsxVzROY05yNWdveVdSUUJ0cktKaWlTZEJVWmVxb0RvSUY5NHpCCndGbzJJT1JFdXFqcU51M3diMWZIM3p1dGdtalFra3IxVjJhd3hmcExLWlROQWdNQkFBRT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg"}
38 changes: 35 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,43 @@ 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).

## [6.9.0] - 2024-10-30

### Added
- Package coherence tests that make sure package versions match across exported generator string and documentation.

### Changed
- Moved code examples that are referenced by the documentation into a different folder (`DocExamples`).
- Renamed code example assembly/namespace to `GLTFast.Documentation.Examples` for consistency.

### Fixed
- (Test) LoadTests on Android now succeed by using `UnityWebRequest` to retrieve data from the compressed JAR file.
- Loading glTFs from `StreamingAssets` with relative URIs containing Unicode characters on Android. UriHelper.GetBaseUri and UriHelper.GetUriString handle Android `jar:file://` schema URIs with unicode characters correctly (fixes [#667](https://github.com/atteneder/glTFast/issues/667)).
- XML documentation fixes
- Removed unnecessary "type" property from `package.json`.
- Removed warning about obsolete `GraphicsDeviceType.OpenGLES2` in Unity 2023.1 or newer.
- (Export) Missing texture transform if texture on glTFast material was scaled vertically only.
- Improved reliability by adding null checks and imprecision-aware floating-point comparisons in various places.
- Using immutable fields only in hash code calculation for `ImageExport` classes.
- Refactored `GetHashCode` implementations referencing mutable fields to avoid potential unexpected behavior.
- `TextureComparer.Equals` made `GetHashCode`/`Equals` for `TextureBase` obsolete, so they've been removed.
- `MeshPrimitiveComparer` is now used for clustering mesh primitives (instead of `GetHashCode`/`Equals` on `MeshPrimitive` and sub-types).
- Set minimum required Unity version to 2020.3.48f1 in the documentation.
- (Export) Avoid potential loss of data by allocating output streams persistently.
- (Test) Render export test inconclusive if the result has not been validated.
- (Test) More explicit error message by throwing innermost exception while preserving the stack trace during async tests.
- (Documentation) Various clarifications, improvements and fixes, based on user feedback.

### Removed
- Outdated and unused code coverage badge.

## [6.8.0] - 2024-09-05

### Added
- (Import) Setting to create textures readable. This allows users to access resulting textures from their scripts.
- (Export) Non-readable meshes can be exported as well now.
- (Export) Added support for exporting meshes with vertex compression enabled (effectively converting 16-bit float positions/normals/tangents/texture coordinates to 32-bit floats).
- (Export) Skinned meshes export support (thanks [Hugo Pereira][Hugo-Didimo] for [#512](https://github.com/atteneder/glTFast/pull/512)).
- (Export) [Buffer view targets](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#_bufferview_target) are set properly now.
- (Import) Support for mesh primitive modes `TRIANGLE_STRIP` and `TRIANGLE_FAN` (thanks [Hexer611][Hexer611] for [#22](https://github.com/Unity-Technologies/com.unity.cloud.gltfast/pull/22))

Expand Down Expand Up @@ -114,20 +145,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [6.3.0] - 2024-03-27

## Added
### Added
- Runtime import tests.
- Runtime export tests.
- (Export) Added development-time checks for valid JSON string literals.
- Added Apple Privacy Manifest file to `/Plugins` directory.

## Changed
### Changed
- Refactored test scripts folder layout.
- (Export) Normal maps are exported in PNG format by default.
- (Export) HDRP area lights are still exported as spot-lights, but their intensity is taken from `Light.intensity` (still incorrect, but more consistent).
- Switched from asset-path-based to GUID-based shader loading (in the Editor 2021 and newer) in order to allow for a flexible folder layout without risking breaks/regressions should the layout change in the future.
- Avoid expensive UnityEngine.Object null check when accessing cached default shaders.

## Fixed
### Fixed
- Exception when required glTF shader is not included.
- Compiler errors when safe mode (`GLTFAST_SAFE` scripting define) is enabled.
- Compiler error with High Definition Render Pipeline version 17 (2023.3)
Expand Down Expand Up @@ -1228,6 +1259,7 @@ This release contains multiple breaking changes. Please read the [upgrade guide]
[EricBeetsOfficial-Opuscope]: https://github.com/EricBeetsOfficial-Opuscope
[Hexer611]: https://github.com/Hexer611
[Holo-Krzysztof]: https://github.com/Holo-Krzysztof
[Hugo-Didimo]: https://github.com/Hugo-Didimo
[hybridherbst]: https://github.com/hybridherbst
[krisrok]: https://github.com/krisrok
[Kushulain]: https://github.com/Kushulain
Expand Down
7 changes: 0 additions & 7 deletions CODE_OF_CONDUCT.md.meta

This file was deleted.

61 changes: 0 additions & 61 deletions CONTRIBUTING.md

This file was deleted.

7 changes: 0 additions & 7 deletions CONTRIBUTING.md.meta

This file was deleted.

2 changes: 1 addition & 1 deletion Samples~/Documentation.meta → DocExamples.meta

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

Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// SPDX-License-Identifier: Apache-2.0

#if NEWTONSOFT_JSON
namespace Samples.Documentation.Manual
namespace GLTFast.Documentation.Examples
{
#region CustomGltfImport
using GLTFast;
using GLTFast.Addons;
using Addons;
using System;
using System.Threading.Tasks;
using UnityEngine;
using GltfImport = GLTFast.Newtonsoft.GltfImport;

public class CustomGltfImport : MonoBehaviour
class CustomGltfImport : MonoBehaviour
{
// Path to the gltf asset to be imported
public string Uri;

async Task Start()
async void Start()
{
try
{
Expand Down Expand Up @@ -64,7 +63,7 @@ public override bool SupportsGltfExtension(string extensionName)
}
}

public class MyInstantiatorAddon
class MyInstantiatorAddon
{
GltfImport m_GltfImport;
GameObjectInstantiator m_Instantiator;
Expand All @@ -86,7 +85,7 @@ void OnNodeCreated(uint nodeIndex, GameObject gameObject)
var gltf = m_GltfImport.GetSourceRoot();

var node = gltf.Nodes[(int)nodeIndex] as GLTFast.Newtonsoft.Schema.Node;
var extras = node.extras;
var extras = node?.extras;

if (extras == null)
return;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using System.Threading.Tasks;
using UnityEngine.Serialization;

namespace Samples.Documentation.Manual
namespace GLTFast.Documentation.Examples
{
using UnityEngine;
using GLTFast;
using GLTFast.Export;
using GLTFast.Logging;
using Export;
using Logging;

class ExportSamples : MonoBehaviour
{
Expand All @@ -18,7 +18,7 @@ class ExportSamples : MonoBehaviour
[SerializeField]
string destinationFilePath;

async void AdvancedExport()
async Task AdvancedExport()
{
#region AdvancedExport

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0

namespace Samples.Documentation.Manual
namespace GLTFast.Documentation.Examples
{

#region ExtraData
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0

using GLTFast;

#if NEWTONSOFT_JSON
namespace Samples.Documentation.Manual
namespace GLTFast.Documentation.Examples
{
#region MultipleInstances
using System;
using UnityEngine;
using GltfImport = GLTFast.Newtonsoft.GltfImport;

public class MultipleInstances : MonoBehaviour
class MultipleInstances : MonoBehaviour
{
// Path to the gltf asset to be imported
public string Uri;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0

namespace Samples.Documentation.Manual
namespace GLTFast.Documentation.Examples
{
#region SimpleExport
using UnityEngine;
using GLTFast.Export;
using Export;

class SimpleExport : MonoBehaviour
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Unity.Cloud.Gltfast.Documentation",
"rootNamespace": "",
"name": "glTFast.Documentation.Examples",
"rootNamespace": "GLTFast.Documentation.Examples",
"references": [
"Unity.Mathematics",
"glTFast",
Expand All @@ -12,7 +12,7 @@
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [
{
Expand Down
17 changes: 10 additions & 7 deletions Documentation~/ExportRuntime.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ The easiest way to include them is to add `glTFExport.shadervariants` to the lis

## Export via Script

> **NOTE:** The `GLTFast.Export` namespace can only be used if you reference both `glTFast` and `glTFast.Export` Assemblies in your [Assembly Definition][asmdef].
> [!IMPORTANT]
> The `GLTFast.Export` namespace can only be used if you reference both `glTFast` and `glTFast.Export` Assemblies in your [Assembly Definition][asmdef].
Here's a step-by-step guide to export a GameObject hierarchy/scene from script

Expand All @@ -22,23 +23,24 @@ Here's a step-by-step guide to export a GameObject hierarchy/scene from script

glTF export might create more than one file. For example the binary buffer is usually a separate `.bin` file and textures might be separate files as well.

[!code-cs [simple-export](../Samples/Documentation/Manual/SimpleExport.cs#SimpleExport)]
[!code-cs [simple-export](../DocExamples/SimpleExport.cs#SimpleExport)]

After calling [SaveToFileAndDispose](xref:GLTFast.Export.GameObjectExport.SaveToFileAndDispose*) the GameObjectExport instance becomes invalid. Do not re-use it.

Further, the export can be customized by passing [ExportSettings](xref:GLTFast.Export.ExportSettings), [GameObjectExportSettings](xref:GLTFast.Export.GameObjectExportSettings) and injectables to [GameObjectExport](xref:GLTFast.Export.GameObjectExport)'s constructor:

[!code-cs [advanced-export](../Samples/Documentation/Manual/ExportSamples.cs#AdvancedExport)]
[!code-cs [advanced-export](../DocExamples/ExportSamples.cs#AdvancedExport)]

> **NOTE:** Exporting to a [Stream][Stream] currently only works for self-contained glTF-Binary files (where the binary buffer and all textures are included in the `.glb` file). Trying other export settings will fail.
> [!WARNING]
> Exporting to a [Stream][Stream] currently only works for self-contained glTF-Binary files (where the binary buffer and all textures are included in the `.glb` file). Trying other export settings will fail.
### Scene Origin

When adding GameObjects to a glTF scene, the resulting glTF root nodes' positions will be their original GameObjects' world position in the Unity scene. That might be undesirable (e.g. if the scene is far off the origin and thus not centered), so [AddScene](xref:GLTFast.Export.GameObjectExport.AddScene(ICollection{UnityEngine.GameObject},Unity.Mathematics.float4x4,System.String)) allows you to provide an inverse scene origin matrix that'll be applied to all root-level nodes.

Here's an example how to export a GameObject, discarding its transform:

[!code-cs [local-transform](../Samples/Documentation/Manual/ExportSamples.cs#LocalTransform)]
[!code-cs [local-transform](../DocExamples/ExportSamples.cs#LocalTransform)]

### Vertex Attribute Discarding

Expand All @@ -52,13 +54,14 @@ Examples of vertex attribute discarding:
- Normals and tangents, when the assigned material is unlit and does not require them for shading.
- When no material was assigned, a default fallback material will be assumed. This does not require tangents nor texture coordinates, hence those are discarded.

> **NOTE:** Not all cases of potential discarding are covered at the moment (e.g. unused texture coordinates when no textures are assigned).
> [!NOTE]
> Not all cases of potential discarding are covered at the moment (e.g. unused texture coordinates when no textures are assigned).
### Draco Compression

*Unity glTFast* supports applying [Google Draco™ 3D Data compression][Draco] to meshes. This requires the [Draco for Unity][DracoForUnity] package to be installed.

[!code-cs [draco-export](../Samples/Documentation/Manual/ExportSamples.cs#ExportSettingsDraco)]
[!code-cs [draco-export](../DocExamples/ExportSamples.cs#ExportSettingsDraco)]

## Trademarks

Expand Down
Loading

0 comments on commit b6e5b26

Please sign in to comment.