Skip to content

Commit

Permalink
Version 2.0.0-dev.3.8 (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
lexaknyazev authored May 6, 2022
1 parent e3feece commit ae85e07
Show file tree
Hide file tree
Showing 31 changed files with 899 additions and 59 deletions.
91 changes: 55 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# Changelog

## 2.0.0-dev.3.8

### New Features

* Added support for `KHR_materials_iridescence` extension. Added:
* `KHR_MATERIALS_IRIDESCENCE_THICKNESS_RANGE_INVALID` error;
* `KHR_MATERIALS_IRIDESCENCE_THICKNESS_RANGE_WITHOUT_TEXTURE` info;
* `KHR_MATERIALS_IRIDESCENCE_THICKNESS_TEXTURE_UNUSED` info.

* Added `KHR_MATERIALS_VOLUME_DOUBLE_SIDED` warning.

* Added new vendor prefixes.

### Bugfixes

* Fixed inconsistent handling of meshes with morphed and non-morphed primitives.

## 2.0.0-dev.3.7

### New Features
Expand Down Expand Up @@ -142,17 +161,17 @@

### Integration updates

* npm tool no longer re-defines `require` (#139).
* npm tool no longer re-defines `require` (#139).

* npm tool no longer requires `options.externalResourceFunction` for GLB or assets with embedded data (#138).
* npm tool no longer requires `options.externalResourceFunction` for GLB or assets with embedded data (#138).

* `options.validateAccessorData` npm tool flag is removed, accessors' data validation is always enabled.
* `options.validateAccessorData` npm tool flag is removed, accessors' data validation is always enabled.

* npm tool now reports `IO_ERROR` for external resources when `options.externalResourceFunction` is not provided.
* npm tool now reports `IO_ERROR` for external resources when `options.externalResourceFunction` is not provided.

* CLI tool now supports `--stdout` flag for writing a single validation report to STDOUT instead of a new file.
* CLI tool now supports `--stdout` flag for writing a single validation report to STDOUT instead of a new file.

* CLI tool validates binary data by default (#138).
* CLI tool validates binary data by default (#138).

## 2.0.0-dev.3.2

Expand Down Expand Up @@ -198,15 +217,15 @@

* Added support for `KHR_mesh_quantization` extension.

* Added `NON_REQUIRED_EXTENSION` error for extensions that cannot be optional (such as `KHR_quantized_geometry`).
* Added `NON_REQUIRED_EXTENSION` error for extensions that cannot be optional (such as `KHR_quantized_geometry`).

* Added vendor prefixes: `MESHOPT`, `POLUTROPON`, and `AGT` (#119).

* Added vendor prefixes: `ALCM` and `SKYLINE`.

* Added vendor prefixes: `FOXIT`, `KDAB`, and `CAPTURE`.

* Extension names are now validated to have an upper-case prefix separated from the rest on the name with underscore (new `INVALID_EXTENSION_NAME_FORMAT` warning).
* Extension names are now validated to have an upper-case prefix separated from the rest on the name with underscore (new `INVALID_EXTENSION_NAME_FORMAT` warning).

* Referencing an image of type defined by an extension from the core objects now results in `TEXTURE_INVALID_IMAGE_MIME_TYPE` error.

Expand All @@ -231,53 +250,53 @@
* A node with a skinned mesh should be a root node (`NODE_SKINNED_MESH_NON_ROOT` warning).

* A node with a skinned mesh should not have local transforms (`NODE_SKINNED_MESH_LOCAL_TRANSFORMS` warning).

* Vertex influences validation:

* All joints values must be within the range of joints in the skin (`ACCESSOR_JOINTS_INDEX_OOB` error).

* No joint may have more than one non-zero weight for a given vertex (`ACCESSOR_JOINTS_INDEX_DUPLICATE` error).

* Weights must be non-negative (`ACCESSOR_WEIGHTS_NEGATIVE` error).

* Weights for each vertex must be normalized to have a linear sum of `1.0` (`ACCESSOR_WEIGHTS_NON_NORMALIZED` error).

* Unused joint values (i.e. joints with a weight of zero) should be set to zero (`ACCESSOR_JOINTS_USED_ZERO_WEIGHT` warning).

### Integration updates

* Upgraded to the latest stable SDK.
* Upgraded to the latest stable SDK.

* Generated npm package no longer requires polyfills when using webpack with certain configurations (fixes #110).

* It is now possible to omit timestamps from validation reports.

* It is now possible to set the number of used threads for directory validation (cmd-line tool only).

* Validation report now consistently uses lower-case enums.

* Native executable binaries can now be compiled. See the [readme](README.md) for details (fixes #113).

* Generated npm package no longer requires polyfills when using webpack with certain configurations (fixes #110).
* Generated report filename is now `<asset>.report.json`.

* It is now possible to omit timestamps from validation reports.

* It is now possible to set the number of used threads for directory validation (cmd-line tool only).

* Validation report now consistently uses lower-case enums.

* Native executable binaries can now be compiled. See the [readme](README.md) for details (fixes #113).

* Generated report filename is now `<asset>.report.json`.

* Unit tests (300+) are now consistently stored: an asset and its validation report. Combined with provided JSON catalogs, they could be used for testing other glTF implementations.
* Unit tests (300+) are now consistently stored: an asset and its validation report. Combined with provided JSON catalogs, they could be used for testing other glTF implementations.

### Changes

* Major refactoring of binary data validation. Now, mesh and animation accessor issues are attributed to the corresponding binding points rather than to accessor objects. This change makes validation reports more precise when accessors are reused. Namely:

* `ACCESSOR_ANIMATION_INPUT_NEGATIVE` and `ACCESSOR_ANIMATION_INPUT_NON_INCREASING` are attributed to `animation.sampler.input`.
* `ANIMATION_SAMPLER_OUTPUT_ACCESSOR_NON_NORMALIZED_QUATERNION` (new) is attributed to `animation.channel.sampler`.

* `ANIMATION_SAMPLER_OUTPUT_ACCESSOR_NON_NORMALIZED_QUATERNION` (new) is attributed to `animation.channel.sampler`.

* `ACCESSOR_INVALID_SIGN` is attributed to `mesh.primitive.attributes.TANGENT`; its message is more sound now.

* `ACCESSOR_VECTOR3_NON_UNIT` (renamed from `ACCESSOR_NON_UNIT`) is attributed to `mesh.primitive.attributes.NORMAL` or `mesh.primitive.attributes.TANGENT`.

* `ACCESSOR_NON_CLAMPED` is attributed to `mesh.primitive.attributes.COLOR`.

* `ACCESSOR_INVALID_IBM` is attributed to `skin.inverseBindMatrices`.

* `ACCESSOR_INDEX_OOB`, `ACCESSOR_INDEX_PRIMITIVE_RESTART`, and `ACCESSOR_INDEX_TRIANGLE_DEGENERATE` are attributed to `mesh.primitive.indices`.

* `ACCESSOR_INVALID_FLOAT` message is more specific.
Expand Down Expand Up @@ -346,7 +365,7 @@

* Added `KHR_lights_punctual` support.

* Renamed error code `NODE_ROTATION_NON_UNIT` to `ROTATION_NON_UNIT`.
* Renamed error code `NODE_ROTATION_NON_UNIT` to `ROTATION_NON_UNIT`.

## 2.0.0-dev.2.6

Expand Down Expand Up @@ -386,7 +405,7 @@

* Changed `MESH_PRIMITIVE_NO_POSITION` default severity to Warning.

* Added UTF-8 BOM detection for byte inputs.
* Added UTF-8 BOM detection for byte inputs.

## 2.0.0-dev.2.1

Expand Down Expand Up @@ -422,7 +441,7 @@

* Fixed issue pointer corruption on empty accessors.

* Improved drag-n-drop validator UX when assets contain many issues (#60, #65).
* Improved drag-n-drop validator UX when assets contain many issues (#60, #65).

* Fixed crash on malformed JSON (#66).

Expand Down
4 changes: 4 additions & 0 deletions ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
|INVALID_GL_VALUE|Invalid value `%1` for GL type '`%2`'.|Error|
|KHR_LIGHTS_PUNCTUAL_LIGHT_SPOT_ANGLES|outerConeAngle (`%2`) is less than or equal to innerConeAngle (`%1`).|Error|
|KHR_MATERIALS_EMISSIVE_STRENGTH_ZERO_FACTOR|Emissive strength has no effect when the emissive factor is zero or undefined.|Warning|
|KHR_MATERIALS_IRIDESCENCE_THICKNESS_RANGE_INVALID|Thickness maximum must be greater than or equal to the thickness minimum.|Error|
|KHR_MATERIALS_IRIDESCENCE_THICKNESS_RANGE_WITHOUT_TEXTURE|Thickness minimum has no effect when a thickness texture is not defined.|Information|
|KHR_MATERIALS_IRIDESCENCE_THICKNESS_TEXTURE_UNUSED|Thickness texture has no effect when the thickness minimum is equal to the thickness maximum.|Information|
|KHR_MATERIALS_VOLUME_DOUBLE_SIDED|The volume extension should not be used with double-sided materials.|Warning|
|KHR_MATERIALS_VOLUME_NO_TRANSMISSION|The volume extension needs to be combined with an extension that allows light to transmit through the surface.|Warning|
|MATERIAL_ALPHA_CUTOFF_INVALID_MODE|Alpha cutoff is supported only for 'MASK' alpha mode.|Warning|
|MESH_INVALID_WEIGHTS_COUNT|The length of weights array (`%1`) does not match the number of morph targets (`%2`).|Error|
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ NuGet package [Third-party contribution]: https://www.nuget.org/packages/GltfVal
- KHR_materials_clearcoat
- KHR_materials_emissive_strength
- KHR_materials_ior
- KHR_materials_iridescence
- KHR_materials_pbrSpecularGlossiness
- KHR_materials_sheen
- KHR_materials_specular
Expand Down
6 changes: 3 additions & 3 deletions lib/src/base/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class CameraOrthographic extends GltfProperty {
final znear = getFloat(map, ZNEAR, context, req: true, min: 0);

if (context.validate) {
if (!zfar.isNaN && !znear.isNaN && zfar <= znear) {
if (zfar <= znear) {
context.addIssue(SemanticError.cameraZfarLequalZnear);
}

Expand Down Expand Up @@ -128,14 +128,14 @@ class CameraPerspective extends GltfProperty {

final yfov = getFloat(map, YFOV, context, req: true, exclMin: 0);

if (context.validate && !yfov.isNaN && yfov >= math.pi) {
if (context.validate && yfov >= math.pi) {
context.addIssue(SemanticError.cameraYFovGequalPi);
}

final zfar = getFloat(map, ZFAR, context, exclMin: 0);
final znear = getFloat(map, ZNEAR, context, req: true, exclMin: 0);

if (context.validate && !zfar.isNaN && !znear.isNaN && zfar <= znear) {
if (context.validate && zfar <= znear) {
context.addIssue(SemanticError.cameraZfarLequalZnear);
}

Expand Down
16 changes: 8 additions & 8 deletions lib/src/base/mesh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ class Mesh extends GltfChildOfRootProperty {
primitives = SafeList<MeshPrimitive>(primitivesMaps.length, PRIMITIVES);

context.path.add(PRIMITIVES);
int targetsCount;
var targetCount = 0;
for (var i = 0; i < primitivesMaps.length; i++) {
context.path.add(i.toString());
final primitive = MeshPrimitive.fromMap(primitivesMaps[i], context);
if (context.validate) {
if (targetsCount == null) {
targetsCount = primitive._targetsIndices?.length;
} else if (targetsCount != primitive._targetsIndices?.length) {
final primitiveTargetCount = primitive._targetsIndices?.length ?? 0;
if (i == 0) {
targetCount = primitiveTargetCount;
} else if (targetCount != primitiveTargetCount) {
context.addIssue(SemanticError.meshPrimitivesUnequalTargetsCount,
name: TARGETS);
name: primitiveTargetCount > 0 ? TARGETS : null);
}
}
primitives[i] = primitive;
Expand All @@ -66,11 +67,10 @@ class Mesh extends GltfChildOfRootProperty {
context.path.removeLast();

if (context.validate &&
targetsCount != null &&
weights != null &&
targetsCount != weights.length) {
targetCount != weights.length) {
context.addIssue(SemanticError.meshInvalidWeightsCount,
name: WEIGHTS, args: [weights.length, targetsCount]);
name: WEIGHTS, args: [weights.length, targetCount]);
}
}

Expand Down
26 changes: 26 additions & 0 deletions lib/src/errors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,32 @@ class SemanticError extends IssueType {
'that allows light to transmit through the surface.',
Severity.Warning);

static final SemanticError khrMaterialsVolumeDoubleSided = SemanticError._(
'KHR_MATERIALS_VOLUME_DOUBLE_SIDED',
(args) => 'The volume extension should not be used '
'with double-sided materials.',
Severity.Warning);

static final SemanticError
khrMaterialsIridescenceThicknessRangeWithoutTexture = SemanticError._(
'KHR_MATERIALS_IRIDESCENCE_THICKNESS_RANGE_WITHOUT_TEXTURE',
(args) => 'Thickness minimum has no effect '
'when a thickness texture is not defined.',
Severity.Information);

static final SemanticError khrMaterialsIridescenceThicknessRangeInvalid =
SemanticError._(
'KHR_MATERIALS_IRIDESCENCE_THICKNESS_RANGE_INVALID',
(args) => 'Thickness maximum must be greater than or '
'equal to the thickness minimum.');

static final SemanticError khrMaterialsIridescenceThicknessTextureUnused =
SemanticError._(
'KHR_MATERIALS_IRIDESCENCE_THICKNESS_TEXTURE_UNUSED',
(args) => 'Thickness texture has no effect when the thickness '
'minimum is equal to the thickness maximum.',
Severity.Information);

SemanticError._(String type, ErrorFunction message,
[Severity severity = Severity.Error])
: super(type, message, severity);
Expand Down
5 changes: 1 addition & 4 deletions lib/src/ext/KHR_lights_punctual/khr_lights_punctual.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,7 @@ class KhrLightsPunctualLightSpot extends GltfProperty {
final outerConeAngle = getFloat(map, OUTER_CONE_ANGLE, context,
def: 0.7853981633974483, exclMin: 0, max: 1.5707963267948966);

if (context.validate &&
!outerConeAngle.isNaN &&
!innerConeAngle.isNaN &&
outerConeAngle <= innerConeAngle) {
if (context.validate && outerConeAngle <= innerConeAngle) {
context.addIssue(SemanticError.khrLightsPunctualLightSpotAngles,
name: OUTER_CONE_ANGLE, args: [innerConeAngle, outerConeAngle]);
}
Expand Down
Loading

0 comments on commit ae85e07

Please sign in to comment.