Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

### New Features

* Added full support for `KHR_animation_pointer` extension.
* Added new `KHR_ANIMATION_POINTER_CANNOT_VALIDATE_EXTRAS`, `KHR_ANIMATION_POINTER_INVALID_POINTER`, `KHR_ANIMATION_POINTER_INTEGER_NON_STEP_INTERPOLATION`, `KHR_ANIMATION_POINTER_COMPONENT_TYPE_MISMATCH`, and `KHR_ANIMATION_POINTER_VECTOR_SIZE_MISMATCH` validation errors.
* The `INCOMPLETE_EXTENSION_SUPPORT` validation info will now be reported far less often, only for unknown extensions.
* Extensions can define validation for their own pointer targets by implementing the `validateExtensionPointer` method in their extension class.

* Added support for the `KHR_node_visibility` extension.

* Added new `NODE_SKINNED_MESH_PARENT_TRANSFORMS` validation warning.
Expand Down
5 changes: 5 additions & 0 deletions ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
|INVALID_GL_VALUE|Invalid value `%1` for GL type '`%2`'.|Error|
|KHR_ANIMATION_POINTER_ANIMATION_CHANNEL_TARGET_NODE|This extension requires the animation channel target node to be undefined.|Error|
|KHR_ANIMATION_POINTER_ANIMATION_CHANNEL_TARGET_PATH|This extension requires the animation channel target path to be 'pointer'. Found '`%1`' instead.|Error|
|KHR_ANIMATION_POINTER_INTEGER_NON_STEP_INTERPOLATION|Animation samplers used with int or bool Object Model Data Types MUST use STEP interpolation. Pointer: '`%1`', expected: '`%2`', found: '`%3`'.|Error|
|KHR_ANIMATION_POINTER_CANNOT_VALIDATE_EXTRAS|Cannot validate pointers into non-standardized extras.|Hint|
|KHR_ANIMATION_POINTER_INVALID_POINTER|The pointer '`%1`' does not point to a valid property in the glTF JSON. Animated properties must be defined in the JSON document.|Error|
|KHR_ANIMATION_POINTER_COMPONENT_TYPE_MISMATCH|The output component type of the accessor does not match the required type of the glTF Object Model property being targeted by the pointer '`%1`'. Expected type: '`%2`', found type: '`%3`'.|Error|
|KHR_ANIMATION_POINTER_VECTOR_SIZE_MISMATCH|The output vector size of the accessor does not match the required vector size of the glTF Object Model property being targeted by the pointer '`%1`'. Expected size: `%2`, found size: `%3`.|Error|
|KHR_LIGHTS_PUNCTUAL_LIGHT_SPOT_ANGLES|outerConeAngle (`%2`) is less than or equal to innerConeAngle (`%1`).|Error|
|KHR_MATERIALS_ANISOTROPY_ANISOTROPY_TEXTURE_TEXCOORD|Normal and anisotropy textures should use the same texture coords.|Warning|
|KHR_MATERIALS_CLEARCOAT_CLEARCOAT_NORMAL_TEXTURE_TEXCOORD|Normal and clearcoat normal textures should use the same texture coords.|Warning|
Expand Down
15 changes: 7 additions & 8 deletions lib/src/base/animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,13 @@ class AnimationChannel extends GltfProperty {
if (context.validate) {
checkMembers(map, ANIMATION_CHANNEL_MEMBERS, context);
}

return AnimationChannel._(
getIndex(map, SAMPLER, context),
getObjectFromInnerMap<AnimationChannelTarget>(
map, TARGET, context, AnimationChannelTarget.fromMap,
req: true),
getExtensions(map, AnimationChannel, context),
getExtras(map, context));
final target = getObjectFromInnerMap<AnimationChannelTarget>(
map, TARGET, context, AnimationChannelTarget.fromMap,
req: true);
final channel = AnimationChannel._(getIndex(map, SAMPLER, context), target,
getExtensions(map, AnimationChannel, context), getExtras(map, context));
context.registerObjectsOwner(channel, [target]);
return channel;
}
}

Expand Down
23 changes: 23 additions & 0 deletions lib/src/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@ class Context {
static Iterable<String> get defaultExtensionNames =>
kDefaultExtensions.map((e) => e.name);

static PointerValidity validateExtensionPointer(Context context,
List<String> pointer, GltfProperty prop, int inPropDepth) {
for (final extension in context._userExtensions) {
final func = extension.validateExtensionPointer;
if (func != null) {
final result = func(context, pointer, prop, inPropDepth);
if (result != PointerValidity.unknown) {
return result;
}
}
}
for (final extension in kDefaultExtensions) {
final func = extension.validateExtensionPointer;
if (func != null) {
final result = func(context, pointer, prop, inPropDepth);
if (result != PointerValidity.unknown) {
return result;
}
}
}
return PointerValidity.unknown;
}

Context({this.validate = true, ValidationOptions options})
: options = options ?? ValidationOptions() {
_extensionsLoadedView = UnmodifiableListView(_extensionsLoaded);
Expand Down
37 changes: 37 additions & 0 deletions lib/src/errors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,43 @@ class SemanticError extends IssueType {
(args) => 'This extension requires the animation channel target path '
"to be 'pointer'. Found ${_q(args[0])} instead.");

static final SemanticError khrAnimationPointerCannotValidateExtras =
SemanticError._(
'KHR_ANIMATION_POINTER_CANNOT_VALIDATE_EXTRAS',
(args) => 'Cannot validate pointers into non-standardized extras.',
Severity.Hint);

static final SemanticError khrAnimationPointerInvalidPointer =
SemanticError._(
'KHR_ANIMATION_POINTER_INVALID_POINTER',
(args) => 'The pointer ${_q(args[0])} does not point to a valid '
'property in the glTF JSON. Animated properties must be '
'defined in the JSON document.');

static final SemanticError khrAnimationPointerIntegerNonStepInterpolation =
SemanticError._(
'KHR_ANIMATION_POINTER_INTEGER_NON_STEP_INTERPOLATION',
(args) => 'Animation samplers used with int or bool Object Model '
'Data Types MUST use STEP interpolation. '
'Pointer: ${_q(args[0])}, expected: ${_q(args[1])}, '
'found: ${_q(args[2])}.');

static final SemanticError khrAnimationPointerComponentTypeMismatch =
SemanticError._(
'KHR_ANIMATION_POINTER_COMPONENT_TYPE_MISMATCH',
(args) => 'The output component type of the accessor does not '
'match the required type of the glTF Object Model property '
'being targeted by the pointer ${_q(args[0])}. '
'Expected type: ${_q(args[1])}, found type: ${_q(args[2])}.');

static final SemanticError khrAnimationPointerVectorSizeMismatch =
SemanticError._(
'KHR_ANIMATION_POINTER_VECTOR_SIZE_MISMATCH',
(args) => 'The output vector size of the accessor does not match '
'the required vector size of the glTF Object Model property '
'being targeted by the pointer ${_q(args[0])}. '
'Expected size: ${args[1]}, found size: ${args[2]}.');

static final SemanticError khrLightsPunctualLightSpotAngles = SemanticError._(
'KHR_LIGHTS_PUNCTUAL_LIGHT_SPOT_ANGLES',
(args) => 'outerConeAngle (${args[1]}) is less than or equal to '
Expand Down
Loading