@aura3d/assets 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/AdvancedAssetCorpus.d.ts +124 -0
- package/dist/AdvancedAssetCorpus.d.ts.map +1 -0
- package/dist/AdvancedAssetCorpus.js +266 -0
- package/dist/AdvancedAssetCorpus.js.map +1 -0
- package/dist/AssetBundleCacheFixtures.d.ts +62 -0
- package/dist/AssetBundleCacheFixtures.d.ts.map +1 -0
- package/dist/AssetBundleCacheFixtures.js +222 -0
- package/dist/AssetBundleCacheFixtures.js.map +1 -0
- package/dist/AssetCache.d.ts +21 -0
- package/dist/AssetCache.d.ts.map +1 -0
- package/dist/AssetCache.js +54 -0
- package/dist/AssetCache.js.map +1 -0
- package/dist/AssetCompatibility.d.ts +54 -0
- package/dist/AssetCompatibility.d.ts.map +1 -0
- package/dist/AssetCompatibility.js +122 -0
- package/dist/AssetCompatibility.js.map +1 -0
- package/dist/AssetCorpus.d.ts +88 -0
- package/dist/AssetCorpus.d.ts.map +1 -0
- package/dist/AssetCorpus.js +215 -0
- package/dist/AssetCorpus.js.map +1 -0
- package/dist/AssetDependencyGraph.d.ts +12 -0
- package/dist/AssetDependencyGraph.d.ts.map +1 -0
- package/dist/AssetDependencyGraph.js +66 -0
- package/dist/AssetDependencyGraph.js.map +1 -0
- package/dist/AssetHandle.d.ts +26 -0
- package/dist/AssetHandle.d.ts.map +1 -0
- package/dist/AssetHandle.js +53 -0
- package/dist/AssetHandle.js.map +1 -0
- package/dist/AssetImportPreflight.d.ts +43 -0
- package/dist/AssetImportPreflight.d.ts.map +1 -0
- package/dist/AssetImportPreflight.js +117 -0
- package/dist/AssetImportPreflight.js.map +1 -0
- package/dist/AssetInspection.d.ts +183 -0
- package/dist/AssetInspection.d.ts.map +1 -0
- package/dist/AssetInspection.js +397 -0
- package/dist/AssetInspection.js.map +1 -0
- package/dist/AssetLoader.d.ts +26 -0
- package/dist/AssetLoader.d.ts.map +1 -0
- package/dist/AssetLoader.js +12 -0
- package/dist/AssetLoader.js.map +1 -0
- package/dist/AssetManager.d.ts +37 -0
- package/dist/AssetManager.d.ts.map +1 -0
- package/dist/AssetManager.js +161 -0
- package/dist/AssetManager.js.map +1 -0
- package/dist/AssetRegistry.d.ts +10 -0
- package/dist/AssetRegistry.d.ts.map +1 -0
- package/dist/AssetRegistry.js +34 -0
- package/dist/AssetRegistry.js.map +1 -0
- package/dist/AssetRenderDefaults.d.ts +13 -0
- package/dist/AssetRenderDefaults.d.ts.map +1 -0
- package/dist/AssetRenderDefaults.js +23 -0
- package/dist/AssetRenderDefaults.js.map +1 -0
- package/dist/AudioLoader.d.ts +17 -0
- package/dist/AudioLoader.d.ts.map +1 -0
- package/dist/AudioLoader.js +23 -0
- package/dist/AudioLoader.js.map +1 -0
- package/dist/BlenderExportValidation.d.ts +64 -0
- package/dist/BlenderExportValidation.d.ts.map +1 -0
- package/dist/BlenderExportValidation.js +143 -0
- package/dist/BlenderExportValidation.js.map +1 -0
- package/dist/CarConceptMaterialStability.d.ts +28 -0
- package/dist/CarConceptMaterialStability.d.ts.map +1 -0
- package/dist/CarConceptMaterialStability.js +1308 -0
- package/dist/CarConceptMaterialStability.js.map +1 -0
- package/dist/EXRLoader.d.ts +2 -0
- package/dist/EXRLoader.d.ts.map +1 -0
- package/dist/EXRLoader.js +2 -0
- package/dist/EXRLoader.js.map +1 -0
- package/dist/ExternalParityGLTFCorpus.d.ts +39 -0
- package/dist/ExternalParityGLTFCorpus.d.ts.map +1 -0
- package/dist/ExternalParityGLTFCorpus.js +32 -0
- package/dist/ExternalParityGLTFCorpus.js.map +1 -0
- package/dist/GLTFAnimationRuntime.d.ts +243 -0
- package/dist/GLTFAnimationRuntime.d.ts.map +1 -0
- package/dist/GLTFAnimationRuntime.js +954 -0
- package/dist/GLTFAnimationRuntime.js.map +1 -0
- package/dist/GLTFCompressionDecoders.d.ts +42 -0
- package/dist/GLTFCompressionDecoders.d.ts.map +1 -0
- package/dist/GLTFCompressionDecoders.js +99 -0
- package/dist/GLTFCompressionDecoders.js.map +1 -0
- package/dist/GLTFExtensionSupport.d.ts +33 -0
- package/dist/GLTFExtensionSupport.d.ts.map +1 -0
- package/dist/GLTFExtensionSupport.js +85 -0
- package/dist/GLTFExtensionSupport.js.map +1 -0
- package/dist/GLTFLoader.d.ts +361 -0
- package/dist/GLTFLoader.d.ts.map +1 -0
- package/dist/GLTFLoader.js +2735 -0
- package/dist/GLTFLoader.js.map +1 -0
- package/dist/GLTFRenderResources.d.ts +162 -0
- package/dist/GLTFRenderResources.d.ts.map +1 -0
- package/dist/GLTFRenderResources.js +1684 -0
- package/dist/GLTFRenderResources.js.map +1 -0
- package/dist/HDRLoader.d.ts +2 -0
- package/dist/HDRLoader.d.ts.map +1 -0
- package/dist/HDRLoader.js +2 -0
- package/dist/HDRLoader.js.map +1 -0
- package/dist/ImageLoader.d.ts +15 -0
- package/dist/ImageLoader.d.ts.map +1 -0
- package/dist/ImageLoader.js +36 -0
- package/dist/ImageLoader.js.map +1 -0
- package/dist/ImportPipeline.d.ts +39 -0
- package/dist/ImportPipeline.d.ts.map +1 -0
- package/dist/ImportPipeline.js +105 -0
- package/dist/ImportPipeline.js.map +1 -0
- package/dist/KTX2BasisTextureTranscoder.d.ts +9 -0
- package/dist/KTX2BasisTextureTranscoder.d.ts.map +1 -0
- package/dist/KTX2BasisTextureTranscoder.js +178 -0
- package/dist/KTX2BasisTextureTranscoder.js.map +1 -0
- package/dist/LoadContext.d.ts +20 -0
- package/dist/LoadContext.d.ts.map +1 -0
- package/dist/LoadContext.js +42 -0
- package/dist/LoadContext.js.map +1 -0
- package/dist/MaterialLoader.d.ts +17 -0
- package/dist/MaterialLoader.d.ts.map +1 -0
- package/dist/MaterialLoader.js +138 -0
- package/dist/MaterialLoader.js.map +1 -0
- package/dist/MeshOptimization.d.ts +20 -0
- package/dist/MeshOptimization.d.ts.map +1 -0
- package/dist/MeshOptimization.js +65 -0
- package/dist/MeshOptimization.js.map +1 -0
- package/dist/OBJLoader.d.ts +13 -0
- package/dist/OBJLoader.d.ts.map +1 -0
- package/dist/OBJLoader.js +492 -0
- package/dist/OBJLoader.js.map +1 -0
- package/dist/SceneAnalysisFixtures.d.ts +100 -0
- package/dist/SceneAnalysisFixtures.d.ts.map +1 -0
- package/dist/SceneAnalysisFixtures.js +331 -0
- package/dist/SceneAnalysisFixtures.js.map +1 -0
- package/dist/SceneLoader.d.ts +27 -0
- package/dist/SceneLoader.d.ts.map +1 -0
- package/dist/SceneLoader.js +40 -0
- package/dist/SceneLoader.js.map +1 -0
- package/dist/ShaderLoader.d.ts +12 -0
- package/dist/ShaderLoader.d.ts.map +1 -0
- package/dist/ShaderLoader.js +18 -0
- package/dist/ShaderLoader.js.map +1 -0
- package/dist/TextureLoader.d.ts +16 -0
- package/dist/TextureLoader.d.ts.map +1 -0
- package/dist/TextureLoader.js +17 -0
- package/dist/TextureLoader.js.map +1 -0
- package/dist/TexturePipeline.d.ts +24 -0
- package/dist/TexturePipeline.d.ts.map +1 -0
- package/dist/TexturePipeline.js +64 -0
- package/dist/TexturePipeline.js.map +1 -0
- package/dist/TextureStreaming.d.ts +10 -0
- package/dist/TextureStreaming.d.ts.map +1 -0
- package/dist/TextureStreaming.js +11 -0
- package/dist/TextureStreaming.js.map +1 -0
- package/dist/WorkerAssetJobs.d.ts +18 -0
- package/dist/WorkerAssetJobs.d.ts.map +1 -0
- package/dist/WorkerAssetJobs.js +37 -0
- package/dist/WorkerAssetJobs.js.map +1 -0
- package/dist/advanced-gallery/index.d.ts +3 -0
- package/dist/advanced-gallery/index.d.ts.map +1 -0
- package/dist/advanced-gallery/index.js +2 -0
- package/dist/advanced-gallery/index.js.map +1 -0
- package/dist/asset-corpus/GLTFSceneLoader.d.ts +3 -0
- package/dist/asset-corpus/GLTFSceneLoader.d.ts.map +1 -0
- package/dist/asset-corpus/GLTFSceneLoader.js +2 -0
- package/dist/asset-corpus/GLTFSceneLoader.js.map +1 -0
- package/dist/asset-corpus/ProductionAssetCorpus.d.ts +89 -0
- package/dist/asset-corpus/ProductionAssetCorpus.d.ts.map +1 -0
- package/dist/asset-corpus/ProductionAssetCorpus.js +116 -0
- package/dist/asset-corpus/ProductionAssetCorpus.js.map +1 -0
- package/dist/asset-corpus/ProductionAssetPipeline.d.ts +3 -0
- package/dist/asset-corpus/ProductionAssetPipeline.d.ts.map +1 -0
- package/dist/asset-corpus/ProductionAssetPipeline.js +3 -0
- package/dist/asset-corpus/ProductionAssetPipeline.js.map +1 -0
- package/dist/asset-corpus/ProductionGLTFRenderPipeline.d.ts +65 -0
- package/dist/asset-corpus/ProductionGLTFRenderPipeline.d.ts.map +1 -0
- package/dist/asset-corpus/ProductionGLTFRenderPipeline.js +110 -0
- package/dist/asset-corpus/ProductionGLTFRenderPipeline.js.map +1 -0
- package/dist/asset-corpus/ProductionHDRTextureLoader.d.ts +8 -0
- package/dist/asset-corpus/ProductionHDRTextureLoader.d.ts.map +1 -0
- package/dist/asset-corpus/ProductionHDRTextureLoader.js +2 -0
- package/dist/asset-corpus/ProductionHDRTextureLoader.js.map +1 -0
- package/dist/asset-corpus/ProductionKTX2TextureLoader.d.ts +7 -0
- package/dist/asset-corpus/ProductionKTX2TextureLoader.d.ts.map +1 -0
- package/dist/asset-corpus/ProductionKTX2TextureLoader.js +2 -0
- package/dist/asset-corpus/ProductionKTX2TextureLoader.js.map +1 -0
- package/dist/asset-corpus/ProductionTextureLoader.d.ts +7 -0
- package/dist/asset-corpus/ProductionTextureLoader.d.ts.map +1 -0
- package/dist/asset-corpus/ProductionTextureLoader.js +2 -0
- package/dist/asset-corpus/ProductionTextureLoader.js.map +1 -0
- package/dist/asset-corpus/index.d.ts +10 -0
- package/dist/asset-corpus/index.d.ts.map +1 -0
- package/dist/asset-corpus/index.js +8 -0
- package/dist/asset-corpus/index.js.map +1 -0
- package/dist/browser-index.d.ts +48 -0
- package/dist/browser-index.d.ts.map +1 -0
- package/dist/browser-index.js +26 -0
- package/dist/browser-index.js.map +1 -0
- package/dist/createRenderableScene.d.ts +23 -0
- package/dist/createRenderableScene.d.ts.map +1 -0
- package/dist/createRenderableScene.js +94 -0
- package/dist/createRenderableScene.js.map +1 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/loadRenderableAsset.d.ts +16 -0
- package/dist/loadRenderableAsset.d.ts.map +1 -0
- package/dist/loadRenderableAsset.js +50 -0
- package/dist/loadRenderableAsset.js.map +1 -0
- package/dist/loaders/CubeTextureLoader.d.ts +4 -0
- package/dist/loaders/CubeTextureLoader.d.ts.map +1 -0
- package/dist/loaders/CubeTextureLoader.js +9 -0
- package/dist/loaders/CubeTextureLoader.js.map +1 -0
- package/dist/loaders/EXRLoader.d.ts +4 -0
- package/dist/loaders/EXRLoader.d.ts.map +1 -0
- package/dist/loaders/EXRLoader.js +10 -0
- package/dist/loaders/EXRLoader.js.map +1 -0
- package/dist/loaders/HDRLoader.d.ts +4 -0
- package/dist/loaders/HDRLoader.d.ts.map +1 -0
- package/dist/loaders/HDRLoader.js +7 -0
- package/dist/loaders/HDRLoader.js.map +1 -0
- package/dist/loaders/KTX2Loader.d.ts +4 -0
- package/dist/loaders/KTX2Loader.d.ts.map +1 -0
- package/dist/loaders/KTX2Loader.js +7 -0
- package/dist/loaders/KTX2Loader.js.map +1 -0
- package/dist/loaders/LoaderDiagnostics.d.ts +18 -0
- package/dist/loaders/LoaderDiagnostics.d.ts.map +1 -0
- package/dist/loaders/LoaderDiagnostics.js +18 -0
- package/dist/loaders/LoaderDiagnostics.js.map +1 -0
- package/dist/loaders/MTLLoader.d.ts +10 -0
- package/dist/loaders/MTLLoader.d.ts.map +1 -0
- package/dist/loaders/MTLLoader.js +14 -0
- package/dist/loaders/MTLLoader.js.map +1 -0
- package/dist/loaders/OBJLoader.d.ts +12 -0
- package/dist/loaders/OBJLoader.d.ts.map +1 -0
- package/dist/loaders/OBJLoader.js +16 -0
- package/dist/loaders/OBJLoader.js.map +1 -0
- package/dist/loaders/TextureLoader.d.ts +6 -0
- package/dist/loaders/TextureLoader.d.ts.map +1 -0
- package/dist/loaders/TextureLoader.js +11 -0
- package/dist/loaders/TextureLoader.js.map +1 -0
- package/dist/loaders/ThreeCompatGLTFLoader.d.ts +10 -0
- package/dist/loaders/ThreeCompatGLTFLoader.d.ts.map +1 -0
- package/dist/loaders/ThreeCompatGLTFLoader.js +13 -0
- package/dist/loaders/ThreeCompatGLTFLoader.js.map +1 -0
- package/dist/loaders/index.d.ts +15 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +10 -0
- package/dist/loaders/index.js.map +1 -0
- package/dist/threejs-compatibility/ThreeCompatAssetProvenance.d.ts +34 -0
- package/dist/threejs-compatibility/ThreeCompatAssetProvenance.d.ts.map +1 -0
- package/dist/threejs-compatibility/ThreeCompatAssetProvenance.js +16 -0
- package/dist/threejs-compatibility/ThreeCompatAssetProvenance.js.map +1 -0
- package/dist/threejs-compatibility/ThreeCompatAssetRegistry.d.ts +29 -0
- package/dist/threejs-compatibility/ThreeCompatAssetRegistry.d.ts.map +1 -0
- package/dist/threejs-compatibility/ThreeCompatAssetRegistry.js +33 -0
- package/dist/threejs-compatibility/ThreeCompatAssetRegistry.js.map +1 -0
- package/dist/threejs-example-parity/index.d.ts +20 -0
- package/dist/threejs-example-parity/index.d.ts.map +1 -0
- package/dist/threejs-example-parity/index.js +218 -0
- package/dist/threejs-example-parity/index.js.map +1 -0
- package/package.json +23 -0
- package/src/AdvancedAssetCorpus.ts +454 -0
- package/src/AssetBundleCacheFixtures.ts +290 -0
- package/src/AssetCache.ts +76 -0
- package/src/AssetCompatibility.ts +224 -0
- package/src/AssetCorpus.ts +329 -0
- package/src/AssetDependencyGraph.ts +83 -0
- package/src/AssetHandle.ts +74 -0
- package/src/AssetImportPreflight.ts +179 -0
- package/src/AssetInspection.ts +706 -0
- package/src/AssetLoader.ts +36 -0
- package/src/AssetManager.ts +211 -0
- package/src/AssetRegistry.ts +44 -0
- package/src/AssetRenderDefaults.ts +36 -0
- package/src/AudioLoader.ts +41 -0
- package/src/BlenderExportValidation.ts +227 -0
- package/src/CarConceptMaterialStability.ts +1405 -0
- package/src/EXRLoader.ts +1 -0
- package/src/ExternalParityGLTFCorpus.ts +65 -0
- package/src/GLTFAnimationRuntime.ts +1221 -0
- package/src/GLTFCompressionDecoders.ts +190 -0
- package/src/GLTFExtensionSupport.ts +138 -0
- package/src/GLTFLoader.ts +4001 -0
- package/src/GLTFRenderResources.ts +2105 -0
- package/src/HDRLoader.ts +1 -0
- package/src/ImageLoader.ts +52 -0
- package/src/ImportPipeline.ts +148 -0
- package/src/KTX2BasisTextureTranscoder.ts +224 -0
- package/src/LoadContext.ts +60 -0
- package/src/MaterialLoader.ts +166 -0
- package/src/MeshOptimization.ts +93 -0
- package/src/OBJLoader.ts +551 -0
- package/src/SceneAnalysisFixtures.ts +438 -0
- package/src/SceneLoader.ts +62 -0
- package/src/ShaderLoader.ts +30 -0
- package/src/TextureLoader.ts +30 -0
- package/src/TexturePipeline.ts +96 -0
- package/src/TextureStreaming.ts +20 -0
- package/src/WorkerAssetJobs.ts +56 -0
- package/src/advanced-gallery/index.ts +18 -0
- package/src/asset-corpus/GLTFSceneLoader.ts +9 -0
- package/src/asset-corpus/ProductionAssetCorpus.ts +230 -0
- package/src/asset-corpus/ProductionAssetPipeline.ts +5 -0
- package/src/asset-corpus/ProductionGLTFRenderPipeline.ts +182 -0
- package/src/asset-corpus/ProductionHDRTextureLoader.ts +2 -0
- package/src/asset-corpus/ProductionKTX2TextureLoader.ts +2 -0
- package/src/asset-corpus/ProductionTextureLoader.ts +2 -0
- package/src/asset-corpus/index.ts +29 -0
- package/src/browser-index.ts +224 -0
- package/src/createRenderableScene.ts +128 -0
- package/src/index.ts +317 -0
- package/src/loadRenderableAsset.ts +67 -0
- package/src/loaders/CubeTextureLoader.ts +8 -0
- package/src/loaders/EXRLoader.ts +10 -0
- package/src/loaders/HDRLoader.ts +7 -0
- package/src/loaders/KTX2Loader.ts +7 -0
- package/src/loaders/LoaderDiagnostics.ts +36 -0
- package/src/loaders/MTLLoader.ts +20 -0
- package/src/loaders/OBJLoader.ts +24 -0
- package/src/loaders/TextureLoader.ts +14 -0
- package/src/loaders/ThreeCompatGLTFLoader.ts +19 -0
- package/src/loaders/index.ts +14 -0
- package/src/threejs-compatibility/ThreeCompatAssetProvenance.ts +51 -0
- package/src/threejs-compatibility/ThreeCompatAssetRegistry.ts +61 -0
- package/src/threejs-example-parity/index.ts +262 -0
- package/tests/assets.test.ts +311 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
GLTFDracoDecodeDescriptor,
|
|
3
|
+
GLTFDracoDecodedPrimitive,
|
|
4
|
+
GLTFDracoDecoder,
|
|
5
|
+
GLTFMeshoptDecodeDescriptor,
|
|
6
|
+
GLTFMeshoptDecoder
|
|
7
|
+
} from "./GLTFLoader";
|
|
8
|
+
|
|
9
|
+
export interface GLTFMeshoptDecoderModule {
|
|
10
|
+
readonly ready?: PromiseLike<void>;
|
|
11
|
+
decodeGltfBuffer(
|
|
12
|
+
target: Uint8Array,
|
|
13
|
+
count: number,
|
|
14
|
+
size: number,
|
|
15
|
+
source: Uint8Array,
|
|
16
|
+
mode: GLTFMeshoptDecodeDescriptor["mode"],
|
|
17
|
+
filter?: GLTFMeshoptDecodeDescriptor["filter"]
|
|
18
|
+
): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GLTFDracoStatus {
|
|
22
|
+
ok(): boolean;
|
|
23
|
+
error_msg(): string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GLTFDracoDecoderBuffer {
|
|
27
|
+
Init(data: Uint8Array, byteLength: number): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface GLTFDracoMesh {
|
|
31
|
+
num_points(): number;
|
|
32
|
+
num_faces(): number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface GLTFDracoAttribute {
|
|
36
|
+
num_components(): number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface GLTFDracoNumericArray {
|
|
40
|
+
size(): number;
|
|
41
|
+
GetValue(index: number): number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface GLTFDracoDecoderInstance {
|
|
45
|
+
GetEncodedGeometryType(buffer: GLTFDracoDecoderBuffer): number;
|
|
46
|
+
DecodeBufferToMesh(buffer: GLTFDracoDecoderBuffer, mesh: GLTFDracoMesh): GLTFDracoStatus;
|
|
47
|
+
GetAttributeByUniqueId(mesh: GLTFDracoMesh, uniqueId: number): GLTFDracoAttribute | null;
|
|
48
|
+
GetAttributeFloatForAllPoints(mesh: GLTFDracoMesh, attribute: GLTFDracoAttribute, out: GLTFDracoNumericArray): boolean;
|
|
49
|
+
GetFaceFromMesh(mesh: GLTFDracoMesh, faceIndex: number, out: GLTFDracoNumericArray): boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface GLTFDracoDecoderModule {
|
|
53
|
+
readonly TRIANGULAR_MESH: number;
|
|
54
|
+
readonly Decoder: new () => GLTFDracoDecoderInstance;
|
|
55
|
+
readonly DecoderBuffer: new () => GLTFDracoDecoderBuffer;
|
|
56
|
+
readonly Mesh: new () => GLTFDracoMesh;
|
|
57
|
+
readonly DracoFloat32Array: new () => GLTFDracoNumericArray;
|
|
58
|
+
readonly DracoInt32Array: new () => GLTFDracoNumericArray;
|
|
59
|
+
destroy?(object: unknown): void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function createMeshoptDecoder(module: GLTFMeshoptDecoderModule): GLTFMeshoptDecoder {
|
|
63
|
+
return async (source, descriptor) => {
|
|
64
|
+
if (module.ready) {
|
|
65
|
+
await module.ready;
|
|
66
|
+
}
|
|
67
|
+
const target = new Uint8Array(descriptor.count * descriptor.byteStride);
|
|
68
|
+
module.decodeGltfBuffer(
|
|
69
|
+
target,
|
|
70
|
+
descriptor.count,
|
|
71
|
+
descriptor.byteStride,
|
|
72
|
+
source,
|
|
73
|
+
descriptor.mode,
|
|
74
|
+
descriptor.filter
|
|
75
|
+
);
|
|
76
|
+
return target;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function createDracoDecoder(module: GLTFDracoDecoderModule): GLTFDracoDecoder {
|
|
81
|
+
return (source, descriptor) => {
|
|
82
|
+
const allocated: unknown[] = [];
|
|
83
|
+
const decoder = track(new module.Decoder(), allocated);
|
|
84
|
+
const buffer = track(new module.DecoderBuffer(), allocated);
|
|
85
|
+
const mesh = track(new module.Mesh(), allocated);
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
buffer.Init(source, source.byteLength);
|
|
89
|
+
const geometryType = decoder.GetEncodedGeometryType(buffer);
|
|
90
|
+
if (geometryType !== module.TRIANGULAR_MESH) {
|
|
91
|
+
throw new Error(`glTF Draco primitive ${descriptorLabel(descriptor)} must decode to a triangular mesh`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const status = decoder.DecodeBufferToMesh(buffer, mesh);
|
|
95
|
+
if (!status.ok()) {
|
|
96
|
+
throw new Error(`glTF Draco primitive ${descriptorLabel(descriptor)} decode failed: ${status.error_msg()}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
attributes: decodeDracoAttributes(module, decoder, mesh, descriptor, allocated),
|
|
101
|
+
indices: decodeDracoIndices(module, decoder, mesh, descriptor, allocated)
|
|
102
|
+
};
|
|
103
|
+
} finally {
|
|
104
|
+
destroyAllocated(module, allocated);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function decodeDracoAttributes(
|
|
110
|
+
module: GLTFDracoDecoderModule,
|
|
111
|
+
decoder: GLTFDracoDecoderInstance,
|
|
112
|
+
mesh: GLTFDracoMesh,
|
|
113
|
+
descriptor: GLTFDracoDecodeDescriptor,
|
|
114
|
+
allocated: unknown[]
|
|
115
|
+
): GLTFDracoDecodedPrimitive["attributes"] {
|
|
116
|
+
const pointCount = mesh.num_points();
|
|
117
|
+
const attributes: Record<string, number[][]> = {};
|
|
118
|
+
|
|
119
|
+
for (const [semantic, uniqueId] of Object.entries(descriptor.attributes)) {
|
|
120
|
+
const attribute = decoder.GetAttributeByUniqueId(mesh, uniqueId);
|
|
121
|
+
if (!attribute) {
|
|
122
|
+
throw new Error(`glTF Draco primitive ${descriptorLabel(descriptor)} is missing decoded attribute ${semantic} unique id ${uniqueId}`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const componentCount = attribute.num_components();
|
|
126
|
+
if (!Number.isInteger(componentCount) || componentCount <= 0) {
|
|
127
|
+
throw new Error(`glTF Draco primitive ${descriptorLabel(descriptor)} decoded attribute ${semantic} has invalid component count ${componentCount}`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const values = track(new module.DracoFloat32Array(), allocated);
|
|
131
|
+
if (!decoder.GetAttributeFloatForAllPoints(mesh, attribute, values)) {
|
|
132
|
+
throw new Error(`glTF Draco primitive ${descriptorLabel(descriptor)} failed to read decoded attribute ${semantic}`);
|
|
133
|
+
}
|
|
134
|
+
if (values.size() !== pointCount * componentCount) {
|
|
135
|
+
throw new Error(`glTF Draco primitive ${descriptorLabel(descriptor)} decoded attribute ${semantic} has ${values.size()} values but expected ${pointCount * componentCount}`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const rows: number[][] = [];
|
|
139
|
+
for (let pointIndex = 0; pointIndex < pointCount; pointIndex += 1) {
|
|
140
|
+
const row: number[] = [];
|
|
141
|
+
for (let componentIndex = 0; componentIndex < componentCount; componentIndex += 1) {
|
|
142
|
+
row.push(values.GetValue(pointIndex * componentCount + componentIndex));
|
|
143
|
+
}
|
|
144
|
+
rows.push(row);
|
|
145
|
+
}
|
|
146
|
+
attributes[semantic] = rows;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return attributes;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function decodeDracoIndices(
|
|
153
|
+
module: GLTFDracoDecoderModule,
|
|
154
|
+
decoder: GLTFDracoDecoderInstance,
|
|
155
|
+
mesh: GLTFDracoMesh,
|
|
156
|
+
descriptor: GLTFDracoDecodeDescriptor,
|
|
157
|
+
allocated: unknown[]
|
|
158
|
+
): number[] | undefined {
|
|
159
|
+
const faceCount = mesh.num_faces();
|
|
160
|
+
if (faceCount === 0) return undefined;
|
|
161
|
+
|
|
162
|
+
const face = track(new module.DracoInt32Array(), allocated);
|
|
163
|
+
const indices: number[] = [];
|
|
164
|
+
for (let faceIndex = 0; faceIndex < faceCount; faceIndex += 1) {
|
|
165
|
+
if (!decoder.GetFaceFromMesh(mesh, faceIndex, face)) {
|
|
166
|
+
throw new Error(`glTF Draco primitive ${descriptorLabel(descriptor)} failed to read decoded face ${faceIndex}`);
|
|
167
|
+
}
|
|
168
|
+
if (face.size() !== 3) {
|
|
169
|
+
throw new Error(`glTF Draco primitive ${descriptorLabel(descriptor)} decoded face ${faceIndex} has ${face.size()} indices but expected 3`);
|
|
170
|
+
}
|
|
171
|
+
indices.push(face.GetValue(0), face.GetValue(1), face.GetValue(2));
|
|
172
|
+
}
|
|
173
|
+
return indices;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function track<T>(value: T, allocated: unknown[]): T {
|
|
177
|
+
allocated.push(value);
|
|
178
|
+
return value;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function destroyAllocated(module: GLTFDracoDecoderModule, allocated: unknown[]): void {
|
|
182
|
+
if (!module.destroy) return;
|
|
183
|
+
for (let index = allocated.length - 1; index >= 0; index -= 1) {
|
|
184
|
+
module.destroy(allocated[index]);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function descriptorLabel(descriptor: GLTFDracoDecodeDescriptor): string {
|
|
189
|
+
return `${descriptor.meshIndex}/${descriptor.primitiveIndex}`;
|
|
190
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export type GLTFExtensionSupportFamily =
|
|
2
|
+
| "texture"
|
|
3
|
+
| "geometry"
|
|
4
|
+
| "material"
|
|
5
|
+
| "animation"
|
|
6
|
+
| "scene"
|
|
7
|
+
| "compression";
|
|
8
|
+
|
|
9
|
+
export type GLTFExtensionSupportStatus =
|
|
10
|
+
| "runtime-supported"
|
|
11
|
+
| "decoder-required"
|
|
12
|
+
| "parsed-with-limits"
|
|
13
|
+
| "diagnostic-only"
|
|
14
|
+
| "unsupported";
|
|
15
|
+
|
|
16
|
+
export interface GLTFExtensionSupportEntry {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly family: GLTFExtensionSupportFamily;
|
|
19
|
+
readonly status: GLTFExtensionSupportStatus;
|
|
20
|
+
readonly requiredAccepted: boolean;
|
|
21
|
+
readonly publicApi: readonly string[];
|
|
22
|
+
readonly decoder?: "draco" | "meshopt" | "ktx2-basis";
|
|
23
|
+
readonly knownLimits: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GLTFExtensionSupportEvaluation {
|
|
27
|
+
readonly schemaVersion: "gltf-extension-support";
|
|
28
|
+
readonly requested: readonly GLTFExtensionSupportEntry[];
|
|
29
|
+
readonly supported: readonly GLTFExtensionSupportEntry[];
|
|
30
|
+
readonly runtimeSupported: readonly GLTFExtensionSupportEntry[];
|
|
31
|
+
readonly parsedWithLimits: readonly GLTFExtensionSupportEntry[];
|
|
32
|
+
readonly diagnosticOnly: readonly GLTFExtensionSupportEntry[];
|
|
33
|
+
readonly unsupportedUsed: readonly string[];
|
|
34
|
+
readonly unsupportedRequired: readonly string[];
|
|
35
|
+
readonly notAcceptedUsed: readonly string[];
|
|
36
|
+
readonly decoderRequired: readonly GLTFExtensionSupportEntry[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const GLTF_EXTENSION_SUPPORT_MATRIX: readonly GLTFExtensionSupportEntry[] = [
|
|
40
|
+
entry("EXT_texture_avif", "texture", "runtime-supported", ["GLTFLoader"], []),
|
|
41
|
+
entry("EXT_texture_webp", "texture", "runtime-supported", ["GLTFLoader"], []),
|
|
42
|
+
entry("KHR_texture_basisu", "compression", "decoder-required", ["GLTFLoader", "createGLTFRenderResources", "transcodeKTX2BasisTexture"], ["Requires loaders.gl Basis/KTX2 transcoder modules at render-resource creation time."], "ktx2-basis"),
|
|
43
|
+
entry("KHR_texture_transform", "texture", "runtime-supported", ["GLTFLoader", "TexturedPBRMaterial"], []),
|
|
44
|
+
entry("KHR_mesh_quantization", "geometry", "runtime-supported", ["GLTFLoader"], []),
|
|
45
|
+
entry("KHR_draco_mesh_compression", "compression", "decoder-required", ["GLTFLoader", "createDracoDecoder"], ["Requires an injected Draco decoder module."], "draco"),
|
|
46
|
+
entry("EXT_meshopt_compression", "compression", "decoder-required", ["GLTFLoader", "createMeshoptDecoder"], ["Requires an injected meshoptimizer decoder module."], "meshopt"),
|
|
47
|
+
entry("KHR_meshopt_compression", "compression", "decoder-required", ["GLTFLoader", "createMeshoptDecoder"], ["Requires an injected meshoptimizer decoder module."], "meshopt"),
|
|
48
|
+
entry("EXT_mesh_gpu_instancing", "geometry", "runtime-supported", ["GLTFLoader", "Renderable.instanceTransforms", "ProductionWebGL2Renderer"], ["Supports TRS instance attributes; custom per-instance material attributes remain out of scope."]),
|
|
49
|
+
entry("KHR_lights_punctual", "scene", "runtime-supported", ["GLTFLoader", "Scene", "ProductionWebGL2Renderer"], []),
|
|
50
|
+
entry("KHR_materials_unlit", "material", "runtime-supported", ["GLTFLoader", "UnlitMaterial"], []),
|
|
51
|
+
entry("KHR_materials_emissive_strength", "material", "runtime-supported", ["GLTFLoader", "TexturedPBRMaterial"], []),
|
|
52
|
+
entry("KHR_materials_clearcoat", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Clearcoat factors/textures are mapped; full reference BRDF parity still requires visual corpus acceptance."]),
|
|
53
|
+
entry("KHR_materials_transmission", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Transmission is mapped to the current WebGL2 fallback path; screen-space/refraction parity remains blocked."]),
|
|
54
|
+
entry("KHR_materials_diffuse_transmission", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Diffuse transmission factors/textures are mapped; full reference energy parity remains blocked."]),
|
|
55
|
+
entry("KHR_materials_volume", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Volume attenuation/thickness are mapped for fallback rendering, not full volumetric path tracing."]),
|
|
56
|
+
entry("KHR_materials_ior", "material", "runtime-supported", ["GLTFLoader", "TexturedPBRMaterial"], []),
|
|
57
|
+
entry("KHR_materials_specular", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Specular factors/textures are mapped; full reference BRDF parity still requires visual corpus acceptance."]),
|
|
58
|
+
entry("KHR_materials_sheen", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Sheen factors/textures are mapped; cloth reference parity remains blocked."]),
|
|
59
|
+
entry("KHR_materials_anisotropy", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Anisotropy factors/textures are mapped; tangent-space visual parity remains under review."]),
|
|
60
|
+
entry("KHR_materials_iridescence", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Iridescence factors/textures are mapped; thin-film reference parity remains under review."]),
|
|
61
|
+
entry("KHR_materials_dispersion", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Dispersion factor is preserved for material fallback; spectral dispersion rendering remains blocked."]),
|
|
62
|
+
entry("KHR_materials_pbrSpecularGlossiness", "material", "parsed-with-limits", ["GLTFLoader", "TexturedPBRMaterial"], ["Spec/gloss assets are converted into the current metallic-roughness runtime contract."]),
|
|
63
|
+
entry("KHR_materials_variants", "material", "parsed-with-limits", ["GLTFLoader"], ["Variant mappings are loaded; authoring/persistence workflow parity remains blocked."]),
|
|
64
|
+
entry("KHR_animation_pointer", "animation", "diagnostic-only", ["GLTFLoader"], ["Optional animation pointer channels are reported as unsupported tracks unless promoted into runtime targets."])
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
export const GLTF_SUPPORTED_EXTENSION_NAMES = GLTF_EXTENSION_SUPPORT_MATRIX
|
|
68
|
+
.filter((extension) => extension.status !== "diagnostic-only" && extension.status !== "unsupported")
|
|
69
|
+
.map((extension) => extension.name);
|
|
70
|
+
|
|
71
|
+
export const GLTF_RUNTIME_SUPPORTED_EXTENSION_NAMES = extensionNamesByStatus("runtime-supported");
|
|
72
|
+
export const GLTF_DECODER_REQUIRED_EXTENSION_NAMES = extensionNamesByStatus("decoder-required");
|
|
73
|
+
export const GLTF_PARSED_WITH_LIMITS_EXTENSION_NAMES = extensionNamesByStatus("parsed-with-limits");
|
|
74
|
+
export const GLTF_DIAGNOSTIC_ONLY_EXTENSION_NAMES = extensionNamesByStatus("diagnostic-only");
|
|
75
|
+
export const GLTF_REQUIRED_ACCEPTED_EXTENSION_NAMES = GLTF_EXTENSION_SUPPORT_MATRIX
|
|
76
|
+
.filter((extension) => extension.requiredAccepted)
|
|
77
|
+
.map((extension) => extension.name);
|
|
78
|
+
|
|
79
|
+
export function getGLTFExtensionSupport(name: string): GLTFExtensionSupportEntry {
|
|
80
|
+
return GLTF_EXTENSION_SUPPORT_MATRIX.find((entry) => entry.name === name)
|
|
81
|
+
?? {
|
|
82
|
+
name,
|
|
83
|
+
family: "scene",
|
|
84
|
+
status: "unsupported",
|
|
85
|
+
requiredAccepted: false,
|
|
86
|
+
publicApi: [],
|
|
87
|
+
knownLimits: ["No A3D loader/runtime support is registered for this extension."]
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function evaluateGLTFExtensionSupport(
|
|
92
|
+
extensionsUsed: readonly string[] = [],
|
|
93
|
+
extensionsRequired: readonly string[] = []
|
|
94
|
+
): GLTFExtensionSupportEvaluation {
|
|
95
|
+
const requested = [...new Set([...extensionsUsed, ...extensionsRequired])].sort();
|
|
96
|
+
const requestedEntries = requested.map((name) => getGLTFExtensionSupport(name));
|
|
97
|
+
const supported = requestedEntries.filter((entry) => entry.status !== "unsupported");
|
|
98
|
+
const unsupportedUsed = extensionsUsed.filter((name) => getGLTFExtensionSupport(name).status === "unsupported").sort();
|
|
99
|
+
const unsupportedRequired = extensionsRequired.filter((name) => !getGLTFExtensionSupport(name).requiredAccepted).sort();
|
|
100
|
+
const notAcceptedUsed = extensionsUsed.filter((name) => !getGLTFExtensionSupport(name).requiredAccepted).sort();
|
|
101
|
+
return {
|
|
102
|
+
schemaVersion: "gltf-extension-support",
|
|
103
|
+
requested: requestedEntries,
|
|
104
|
+
supported,
|
|
105
|
+
runtimeSupported: supported.filter((entry) => entry.status === "runtime-supported"),
|
|
106
|
+
parsedWithLimits: supported.filter((entry) => entry.status === "parsed-with-limits"),
|
|
107
|
+
diagnosticOnly: supported.filter((entry) => entry.status === "diagnostic-only"),
|
|
108
|
+
unsupportedUsed,
|
|
109
|
+
unsupportedRequired,
|
|
110
|
+
notAcceptedUsed,
|
|
111
|
+
decoderRequired: supported.filter((entry) => entry.status === "decoder-required")
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function extensionNamesByStatus(status: GLTFExtensionSupportStatus): readonly string[] {
|
|
116
|
+
return GLTF_EXTENSION_SUPPORT_MATRIX
|
|
117
|
+
.filter((extension) => extension.status === status)
|
|
118
|
+
.map((extension) => extension.name);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function entry(
|
|
122
|
+
name: string,
|
|
123
|
+
family: GLTFExtensionSupportFamily,
|
|
124
|
+
status: Exclude<GLTFExtensionSupportStatus, "unsupported">,
|
|
125
|
+
publicApi: readonly string[],
|
|
126
|
+
knownLimits: readonly string[],
|
|
127
|
+
decoder?: GLTFExtensionSupportEntry["decoder"]
|
|
128
|
+
): GLTFExtensionSupportEntry {
|
|
129
|
+
return {
|
|
130
|
+
name,
|
|
131
|
+
family,
|
|
132
|
+
status,
|
|
133
|
+
requiredAccepted: status !== "diagnostic-only",
|
|
134
|
+
publicApi,
|
|
135
|
+
...(decoder === undefined ? {} : { decoder }),
|
|
136
|
+
knownLimits
|
|
137
|
+
};
|
|
138
|
+
}
|