Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"extensions" : {
"EXT_structural_metadata" : {
"schema" : {
"id": "FeatureIdAttributeAndPropertyTableSchema",
"classes" : {
"exampleMetadataClass" : {
"name" : "Example metadata class",
"description" : "An example metadata class",
"properties" : {
"example_VEC3_FLOAT32" : {
"name" : "Example VEC3 FLOAT32 property",
"description" : "An example property, with type VEC3, with component type FLOAT32",
"type" : "VEC3",
"componentType" : "FLOAT32",
"max": [ 3.0, 3.0, 3.0 ]
}
}
}
}
},
"propertyTables" : [ {
"name" : "Example property table",
"class" : "exampleMetadataClass",
"count" : 4,
"properties" : {
"example_VEC3_FLOAT32" : {
"values" : 4
}
}
} ]
}
},
"extensionsUsed" : [ "EXT_mesh_features", "EXT_structural_metadata" ],
"accessors" : [ {
"bufferView" : 0,
"byteOffset" : 0,
"componentType" : 5123,
"count" : 24,
"type" : "SCALAR",
"max" : [ 15 ],
"min" : [ 0 ]
}, {
"bufferView" : 1,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 16,
"type" : "VEC3",
"max" : [ 1.0, 1.0, 0.0 ],
"min" : [ 0.0, 0.0, 0.0 ]
}, {
"bufferView" : 2,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 16,
"type" : "VEC3",
"max" : [ 0.0, 0.0, 1.0 ],
"min" : [ 0.0, 0.0, 1.0 ]
}, {
"bufferView" : 3,
"byteOffset" : 0,
"componentType" : 5121,
"count" : 16,
"type" : "SCALAR",
"max" : [ 3 ],
"min" : [ 0 ]
} ],
"asset" : {
"generator" : "JglTF from https://github.com/javagl/JglTF",
"version" : "2.0"
},
"buffers" : [ {
"uri" : "data:application/gltf-buffer;base64,AAABAAIAAQADAAIABAAFAAYABQAHAAYACAAJAAoACQALAAoADAANAA4ADQAPAA4AAAAAAAAAAAAAAAAAZmbmPgAAAAAAAAAAAAAAAGZm5j4AAAAAZmbmPmZm5j4AAAAAzcwMPwAAAAAAAAAAAACAPwAAAAAAAAAAzcwMP2Zm5j4AAAAAAACAP2Zm5j4AAAAAAAAAAM3MDD8AAAAAZmbmPs3MDD8AAAAAAAAAAAAAgD8AAAAAZmbmPgAAgD8AAAAAzcwMP83MDD8AAAAAAACAP83MDD8AAAAAzcwMPwAAgD8AAAAAAACAPwAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAEAAAACAAAAAgAAAAIAAAACAAAAAwAAAAMAAAADAAAAAwAAAA==",
"byteLength" : 496
}, {
"uri" : "data:application/gltf-buffer;base64,AAAAAM3MzD3NzEw+AACAP83MjD+amZk/AAAAQGZmBkDNzAxAAABAQGZmRkDNzExA",
"byteLength" : 48
} ],
"bufferViews" : [ {
"buffer" : 0,
"byteOffset" : 0,
"byteLength" : 48,
"target" : 34963
}, {
"buffer" : 0,
"byteOffset" : 48,
"byteLength" : 192,
"target" : 34962
}, {
"buffer" : 0,
"byteOffset" : 240,
"byteLength" : 192,
"target" : 34962
}, {
"buffer" : 0,
"byteOffset" : 432,
"byteLength" : 64,
"byteStride" : 4,
"target" : 34962
}, {
"buffer" : 1,
"byteOffset" : 0,
"byteLength" : 48
} ],
"materials" : [ {
"pbrMetallicRoughness" : {
"baseColorFactor" : [ 0.5, 1.0, 0.5, 1.0 ],
"metallicFactor" : 0.0,
"roughnessFactor" : 1.0
},
"alphaMode" : "OPAQUE",
"doubleSided" : true
} ],
"meshes" : [ {
"primitives" : [ {
"extensions" : {
"EXT_mesh_features" : {
"featureIds" : [ {
"featureCount" : 4,
"attribute" : 0,
"propertyTable" : 0
} ]
}
},
"attributes" : {
"POSITION" : 1,
"NORMAL" : 2,
"_FEATURE_ID_0" : 3
},
"indices" : 0,
"material" : 0,
"mode" : 4
} ]
} ],
"nodes" : [ {
"mesh" : 0
} ],
"scene" : 0,
"scenes" : [ {
"nodes" : [ 0 ]
} ]
}
8 changes: 8 additions & 0 deletions specs/gltfExtensions/ExtValidationSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ describe("combined EXT_structural_metadata and EXT_mesh_features extension valid
expect(result.get(0).type).toEqual("VALUE_NOT_IN_RANGE");
});

it("detects issues in FeatureIdAttributeAndPropertyTableWithValueNotInRange", async function () {
const result = await validateGltf(
"./specs/data/gltfExtensions/FeatureIdAttributeAndPropertyTableWithValueNotInRange.gltf"
);
expect(result.length).toEqual(1);
expect(result.get(0).type).toEqual("METADATA_VALUE_NOT_IN_RANGE");
});

it("detects issues in FeatureIdAttributePropertyTableInvalidValue", async function () {
const result = await validateGltf(
"./specs/data/gltfExtensions/FeatureIdAttributePropertyTableInvalidValue.gltf"
Expand Down
2 changes: 1 addition & 1 deletion src/issues/GltfExtensionValidationIssues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class GltfExtensionValidationIssues {

/**
* Indicates that the extension referred to an element in the
* glTF assset that did not match the requirements of the
* glTF asset that did not match the requirements of the
* extension specification. (For example, a 'texCoord' that
* referred to a VEC3 accessor). Further details should be
* encoded in the 'message'.
Expand Down
4 changes: 2 additions & 2 deletions src/tileFormats/I3dmValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class I3dmValidator implements Validator<Buffer> {
result = false;
}

// If the GLB data was embdedded, validate it directly
// If the GLB data was embedded, validate it directly
if (hasEmbeddedGlb) {
const gltfValidator = new GltfValidator();
const gltfResult = await gltfValidator.validateObject(
Expand All @@ -268,7 +268,7 @@ export class I3dmValidator implements Validator<Buffer> {
} else {
// The GLB data was a URI, as indicated by `gltfFormat === 0`.
// The padding bytes in this case should be 0x20 (space) bytes,
// so issue a warning if the buffer contais 0x00 (zero) bytes.
// so issue a warning if the buffer contains 0x00 (zero) bytes.
if (glbData.includes("\0")) {
const message =
`The field containing the URI of the glTF asset contained ` +
Expand Down
2 changes: 1 addition & 1 deletion src/validation/PropertiesValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Properties } from "3d-tiles-tools";
import { SemanticValidationIssues } from "../issues/SemanticValidationIssues";

/**
* A class for validations related to `tileset.properties` objects. Aplogies
* A class for validations related to `tileset.properties` objects. Apologies
* for the confusing name...
*
* @internal
Expand Down
6 changes: 3 additions & 3 deletions src/validation/StatisticsClassValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ export class StatisticsClassValidator {
) {
result = false;
} else {
for (const statisticsClassPropetyName of Object.keys(
for (const statisticsClassPropertyName of Object.keys(
statisticsClassProperties
)) {
if (
!metadataClassPropertyNames.includes(statisticsClassPropetyName)
!metadataClassPropertyNames.includes(statisticsClassPropertyName)
) {
const message =
`Statistics class '${className}' contains a property name ` +
`'${statisticsClassPropetyName}', but the schema class does ` +
`'${statisticsClassPropertyName}', but the schema class does ` +
`not define this property`;
const issue = StructureValidationIssues.IDENTIFIER_NOT_FOUND(
classPath,
Expand Down
4 changes: 2 additions & 2 deletions src/validation/SubtreeConsistencyValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class SubtreeConsistencyValidator {
* is not given, then the validation of the availability information
* (that requires information about the subtree structure) will be
* skipped
* @param context - The `ValidationCondext`
* @param context - The `ValidationContext`
* @returns Whether the data was consistent
*/
static validateSubtreeConsistency(
Expand Down Expand Up @@ -111,7 +111,7 @@ export class SubtreeConsistencyValidator {
let result = true;

// The implicitTiling has already been validated to have a valid
// subvisionScheme. Therefore, the methods from `ImplicitTilings`
// subdivisionScheme. Therefore, the methods from `ImplicitTilings`
// should never throw an `ImplicitTilingError` here.

// Validate the consistency of the tileAvailability
Expand Down
2 changes: 1 addition & 1 deletion src/validation/SubtreeInfoValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class SubtreeInfoValidator {
result = false;
}

// TOOD The validation of whether the child subtrees that are
// TODO The validation of whether the child subtrees that are
// marked as available are actually available is not done yet
// (Should this really try to resolve the resource?)

Expand Down
6 changes: 3 additions & 3 deletions src/validation/ValidationIssueFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export class ValidationIssueFilters {
* `ValidationIssue` instances where the `ValidationIssue#severity`
* is one of the given severities.
*
* @param includedServerities - The included severities
* @param includedSeverities - The included severities
* @returns The `ValidationIssueFilter`
*/
static byIncludedSeverities(
...includedServerities: ValidationIssueSeverity[]
...includedSeverities: ValidationIssueSeverity[]
): ValidationIssueFilter {
const predicate = (issues: ValidationIssue[]) =>
includedServerities.includes(issues[issues.length - 1].severity);
includedSeverities.includes(issues[issues.length - 1].severity);
return predicate;
}
}
25 changes: 13 additions & 12 deletions src/validation/gltf/meshFeatures/FeatureIdAccessorValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,16 @@ export class FeatureIdAccessorValidator {
// Only if the structures have been valid until now,
// validate the actual data of the accessor
if (result && gltfData.gltfDocument) {
const dataValid = FeatureIdAccessorValidator.validateFeatureIdAcessorData(
path,
accessorIndex,
featureCount,
gltfData,
propertyTableState,
nullFeatureId,
context
);
const dataValid =
FeatureIdAccessorValidator.validateFeatureIdAccessorData(
path,
accessorIndex,
featureCount,
gltfData,
propertyTableState,
nullFeatureId,
context
);
if (!dataValid) {
result = false;
}
Expand All @@ -90,7 +91,7 @@ export class FeatureIdAccessorValidator {
}

/**
* Validate the data of the given feature ID atribute.
* Validate the data of the given feature ID attribute.
*
* This assumes that the glTF data is valid as determined by the
* glTF Validator, **AND** as determined by the validation of
Expand All @@ -110,7 +111,7 @@ export class FeatureIdAccessorValidator {
* @param context - The `ValidationContext` that any issues will be added to
* @returns Whether the object was valid
*/
private static validateFeatureIdAcessorData(
private static validateFeatureIdAccessorData(
path: string,
accessorIndex: number,
featureCount: number,
Expand All @@ -126,7 +127,7 @@ export class FeatureIdAccessorValidator {
if (!accessorValues) {
// This should only happen for invalid glTF assets (e.g. ones that
// use wrong accessor component types), or when the gltfDocument
// could not be read due to another structual error that should
// could not be read due to another structural error that should
// be detected by the extension validation.
const message = `Could not read data for feature ID attribute accessor`;
const issue = ValidationIssues.INTERNAL_ERROR(path, message);
Expand Down
2 changes: 1 addition & 1 deletion src/validation/gltf/meshFeatures/FeatureIdValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class FeatureIdValidator {
* @param path - The path for validation issues
* @param sourceName - The source, 'texture' or 'attribute'
* @param featureIdSet - The feature ID set. Note that This set
* might be modifified by this method!
* might be modified by this method!
* @param featureCount - The `featureCount` value from the feature ID definition
* @param propertyTableState - The validation state of the property table
* definition (i.e. the index into the property tables array)
Expand Down
Loading