@gltf-transform/extensions
Advanced tools
Comparing version 4.0.0-alpha.15 to 4.0.0-alpha.16
@@ -9,2 +9,3 @@ export declare const EXT_MESH_GPU_INSTANCING = "EXT_mesh_gpu_instancing"; | ||
export declare const KHR_MATERIALS_CLEARCOAT = "KHR_materials_clearcoat"; | ||
export declare const KHR_MATERIALS_DIFFUSE_TRANSMISSION = "KHR_materials_diffuse_transmission"; | ||
export declare const KHR_MATERIALS_DISPERSION = "KHR_materials_dispersion"; | ||
@@ -11,0 +12,0 @@ export declare const KHR_MATERIALS_EMISSIVE_STRENGTH = "KHR_materials_emissive_strength"; |
@@ -9,2 +9,3 @@ import { EXTMeshGPUInstancing } from './ext-mesh-gpu-instancing/index.js'; | ||
import { KHRMaterialsClearcoat } from './khr-materials-clearcoat/index.js'; | ||
import { KHRMaterialsDiffuseTransmission } from './khr-materials-diffuse-transmission/materials-diffuse-transmission.js'; | ||
import { KHRMaterialsDispersion } from './khr-materials-dispersion/index.js'; | ||
@@ -25,4 +26,4 @@ import { KHRMaterialsEmissiveStrength } from './khr-materials-emissive-strength/index.js'; | ||
import { KHRXMP } from './khr-xmp-json-ld/index.js'; | ||
export declare const KHRONOS_EXTENSIONS: (typeof KHRDracoMeshCompression | typeof KHRLightsPunctual | typeof KHRMaterialsAnisotropy | typeof KHRMaterialsClearcoat | typeof KHRMaterialsDispersion | typeof KHRMaterialsEmissiveStrength | typeof KHRMaterialsIOR | typeof KHRMaterialsIridescence | typeof KHRMaterialsPBRSpecularGlossiness | typeof KHRMaterialsSpecular | typeof KHRMaterialsSheen | typeof KHRMaterialsTransmission | typeof KHRMaterialsUnlit | typeof KHRMaterialsVariants | typeof KHRMaterialsVolume | typeof KHRMeshQuantization | typeof KHRTextureBasisu | typeof KHRTextureTransform | typeof KHRXMP)[]; | ||
export declare const ALL_EXTENSIONS: (typeof KHRDracoMeshCompression | typeof KHRLightsPunctual | typeof KHRMaterialsAnisotropy | typeof KHRMaterialsClearcoat | typeof KHRMaterialsDispersion | typeof KHRMaterialsEmissiveStrength | typeof KHRMaterialsIOR | typeof KHRMaterialsIridescence | typeof KHRMaterialsPBRSpecularGlossiness | typeof KHRMaterialsSpecular | typeof KHRMaterialsSheen | typeof KHRMaterialsTransmission | typeof KHRMaterialsUnlit | typeof KHRMaterialsVariants | typeof KHRMaterialsVolume | typeof KHRMeshQuantization | typeof KHRTextureBasisu | typeof KHRTextureTransform | typeof KHRXMP | typeof EXTMeshGPUInstancing | typeof EXTMeshoptCompression | typeof EXTTextureAVIF | typeof EXTTextureWebP)[]; | ||
export declare const KHRONOS_EXTENSIONS: (typeof KHRDracoMeshCompression | typeof KHRLightsPunctual | typeof KHRMaterialsAnisotropy | typeof KHRMaterialsClearcoat | typeof KHRMaterialsDiffuseTransmission | typeof KHRMaterialsDispersion | typeof KHRMaterialsEmissiveStrength | typeof KHRMaterialsIOR | typeof KHRMaterialsIridescence | typeof KHRMaterialsPBRSpecularGlossiness | typeof KHRMaterialsSpecular | typeof KHRMaterialsSheen | typeof KHRMaterialsTransmission | typeof KHRMaterialsUnlit | typeof KHRMaterialsVariants | typeof KHRMaterialsVolume | typeof KHRMeshQuantization | typeof KHRTextureBasisu | typeof KHRTextureTransform | typeof KHRXMP)[]; | ||
export declare const ALL_EXTENSIONS: (typeof KHRDracoMeshCompression | typeof KHRLightsPunctual | typeof KHRMaterialsAnisotropy | typeof KHRMaterialsClearcoat | typeof KHRMaterialsDiffuseTransmission | typeof KHRMaterialsDispersion | typeof KHRMaterialsEmissiveStrength | typeof KHRMaterialsIOR | typeof KHRMaterialsIridescence | typeof KHRMaterialsPBRSpecularGlossiness | typeof KHRMaterialsSpecular | typeof KHRMaterialsSheen | typeof KHRMaterialsTransmission | typeof KHRMaterialsUnlit | typeof KHRMaterialsVariants | typeof KHRMaterialsVolume | typeof KHRMeshQuantization | typeof KHRTextureBasisu | typeof KHRTextureTransform | typeof KHRXMP | typeof EXTMeshGPUInstancing | typeof EXTMeshoptCompression | typeof EXTTextureAVIF | typeof EXTTextureWebP)[]; | ||
export * from './ext-mesh-gpu-instancing/index.js'; | ||
@@ -36,2 +37,3 @@ export * from './ext-meshopt-compression/index.js'; | ||
export * from './khr-materials-clearcoat/index.js'; | ||
export * from './khr-materials-diffuse-transmission/index.js'; | ||
export * from './khr-materials-dispersion/index.js'; | ||
@@ -38,0 +40,0 @@ export * from './khr-materials-emissive-strength/index.js'; |
@@ -7,2 +7,9 @@ import { Extension, PropertyType, ReaderContext, WriterContext } from '@gltf-transform/core'; | ||
* | ||
* ![Illustration](/media/extensions/khr-materials-anisotropy.jpg) | ||
* | ||
* > _**Figure:** Effect of each color channel in the anisotropyTexture. Left | ||
* > to right: the full anisotropy texture, filling the red channel with black, | ||
* > filling the green channel with black, filling the blue channel with black. | ||
* > Source: [Khronos Group & Wayfair](https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/AnisotropyBarnLamp)._ | ||
* | ||
* This extension defines the anisotropic property of a material as observable with brushed metals | ||
@@ -9,0 +16,0 @@ * for instance. An asymmetric specular lobe model is introduced to allow for such phenomena. The |
@@ -7,2 +7,9 @@ import { Extension, PropertyType, ReaderContext, WriterContext } from '@gltf-transform/core'; | ||
* | ||
* ![Illustration](/media/extensions/khr-materials-emissive-strength.jpg) | ||
* | ||
* > _**Figure:** Cubes with emissive color #59BCF3 and emissive strength | ||
* > increasing from 1 to 256 nits, left to right. Rendered in [three.js](https://threejs.org/), | ||
* > with independent point lighting and a bloom effect. | ||
* > Source: [Don McCurdy](https://www.donmccurdy.com/2024/04/27/emission-and-bloom/)._ | ||
* | ||
* The core glTF 2.0 material model includes {@link Material.setEmissiveFactor `emissiveFactor`} | ||
@@ -9,0 +16,0 @@ * and {@link Material.setEmissiveTexture `emissiveTexture`} to control the color and intensity |
@@ -7,2 +7,7 @@ import { Extension, PropertyType, ReaderContext, WriterContext } from '@gltf-transform/core'; | ||
* | ||
* ![Illustration](/media/extensions/khr-materials-iridescence.png) | ||
* | ||
* > _**Figure:** Varying levels of iridescence IOR values. | ||
* > Source: [Khronos Group](https://github.com/KhronosGroup/gltf/tree/main/extensions/2.0/Khronos/KHR_materials_iridescence)._ | ||
* | ||
* Iridescence describes an effect where hue varies depending on the viewing | ||
@@ -9,0 +14,0 @@ * angle and illumination angle: A thin-film of a semi-transparent layer |
@@ -8,2 +8,7 @@ import { Extension, PropertyType, ReaderContext, WriterContext } from '@gltf-transform/core'; | ||
* | ||
* ![Illustration](/media/extensions/khr-materials-transmission.png) | ||
* | ||
* > _**Figure:** Sphere using `KHR_materials_transmission` with varying roughness (0.0, 0.2, 0.4). | ||
* > Source: Khronos Group._ | ||
* | ||
* While default PBR materials using alpha blending become invisible as their opacity approaches | ||
@@ -10,0 +15,0 @@ * zero, a transmissive material continues to reflect light in a glass-like manner, even at low |
{ | ||
"name": "@gltf-transform/extensions", | ||
"version": "4.0.0-alpha.15", | ||
"version": "4.0.0-alpha.16", | ||
"repository": "github:donmccurdy/glTF-Transform", | ||
@@ -38,3 +38,3 @@ "homepage": "https://gltf-transform.dev/extensions.html", | ||
"dependencies": { | ||
"@gltf-transform/core": "^4.0.0-alpha.15", | ||
"@gltf-transform/core": "^4.0.0-alpha.16", | ||
"ktx-parse": "^0.7.0" | ||
@@ -48,3 +48,3 @@ }, | ||
], | ||
"gitHead": "10df3bf8ca9f730ebc1fdd25fce9411f32e05e45" | ||
"gitHead": "a5c1a1846a50b7b0df786117c5a6261874161233" | ||
} |
@@ -9,2 +9,3 @@ export const EXT_MESH_GPU_INSTANCING = 'EXT_mesh_gpu_instancing'; | ||
export const KHR_MATERIALS_CLEARCOAT = 'KHR_materials_clearcoat'; | ||
export const KHR_MATERIALS_DIFFUSE_TRANSMISSION = 'KHR_materials_diffuse_transmission'; | ||
export const KHR_MATERIALS_DISPERSION = 'KHR_materials_dispersion'; | ||
@@ -11,0 +12,0 @@ export const KHR_MATERIALS_EMISSIVE_STRENGTH = 'KHR_materials_emissive_strength'; |
@@ -8,2 +8,3 @@ import { | ||
GLTF, | ||
Property, | ||
PropertyType, | ||
@@ -282,2 +283,3 @@ ReaderContext, | ||
const options = this._encoderOptions; | ||
const graph = this.document.getGraph(); | ||
@@ -287,2 +289,14 @@ const fallbackBuffer = this.document.createBuffer(); // Disposed on write. | ||
let nextID = 1; | ||
const parentToID = new Map<Property, number>(); | ||
const getParentID = (property: Property): number => { | ||
for (const parent of graph.listParents(property)) { | ||
if (parent.propertyType === PropertyType.ROOT) continue; | ||
let id = parentToID.get(property); | ||
if (id === undefined) parentToID.set(property, (id = nextID++)); | ||
return id; | ||
} | ||
return -1; | ||
}; | ||
this._encoderFallbackBuffer = fallbackBuffer; | ||
@@ -302,2 +316,3 @@ this._encoderBufferViews = {}; | ||
const usage = context.getAccessorUsage(accessor); | ||
const parentID = context.accessorUsageGroupedByParent.has(usage) ? getParentID(accessor) : null; | ||
const mode = getMeshoptMode(accessor, usage); | ||
@@ -316,3 +331,3 @@ const filter = | ||
// Buffer view grouping key. | ||
const key = [usage, mode, filter.filter, byteStride, bufferIndex].join(':'); | ||
const key = [usage, parentID, mode, filter.filter, byteStride, bufferIndex].join(':'); | ||
@@ -319,0 +334,0 @@ let bufferView = this._encoderBufferViews[key]; |
@@ -9,2 +9,3 @@ import { EXTMeshGPUInstancing } from './ext-mesh-gpu-instancing/index.js'; | ||
import { KHRMaterialsClearcoat } from './khr-materials-clearcoat/index.js'; | ||
import { KHRMaterialsDiffuseTransmission } from './khr-materials-diffuse-transmission/materials-diffuse-transmission.js'; | ||
import { KHRMaterialsDispersion } from './khr-materials-dispersion/index.js'; | ||
@@ -31,2 +32,3 @@ import { KHRMaterialsEmissiveStrength } from './khr-materials-emissive-strength/index.js'; | ||
KHRMaterialsClearcoat, | ||
KHRMaterialsDiffuseTransmission, | ||
KHRMaterialsDispersion, | ||
@@ -65,2 +67,3 @@ KHRMaterialsEmissiveStrength, | ||
export * from './khr-materials-clearcoat/index.js'; | ||
export * from './khr-materials-diffuse-transmission/index.js'; | ||
export * from './khr-materials-dispersion/index.js'; | ||
@@ -67,0 +70,0 @@ export * from './khr-materials-emissive-strength/index.js'; |
@@ -282,2 +282,8 @@ import { | ||
// In rare cases Draco increases vertex count, requiring a larger index component type. | ||
// https://github.com/donmccurdy/glTF-Transform/issues/1370 | ||
if (encodedPrim.numVertices > 65534 && indicesDef.componentType !== Accessor.ComponentType.UNSIGNED_INT) { | ||
indicesDef.componentType = Accessor.ComponentType.UNSIGNED_INT; | ||
} | ||
// Create attribute definitions, update count. | ||
@@ -284,0 +290,0 @@ for (const semantic of prim.listSemantics()) { |
@@ -17,2 +17,9 @@ import { Extension, GLTF, PropertyType, ReaderContext, WriterContext } from '@gltf-transform/core'; | ||
* | ||
* ![Illustration](/media/extensions/khr-materials-anisotropy.jpg) | ||
* | ||
* > _**Figure:** Effect of each color channel in the anisotropyTexture. Left | ||
* > to right: the full anisotropy texture, filling the red channel with black, | ||
* > filling the green channel with black, filling the blue channel with black. | ||
* > Source: [Khronos Group & Wayfair](https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/AnisotropyBarnLamp)._ | ||
* | ||
* This extension defines the anisotropic property of a material as observable with brushed metals | ||
@@ -19,0 +26,0 @@ * for instance. An asymmetric specular lobe model is introduced to allow for such phenomena. The |
@@ -15,2 +15,9 @@ import { Extension, PropertyType, ReaderContext, WriterContext } from '@gltf-transform/core'; | ||
* | ||
* ![Illustration](/media/extensions/khr-materials-emissive-strength.jpg) | ||
* | ||
* > _**Figure:** Cubes with emissive color #59BCF3 and emissive strength | ||
* > increasing from 1 to 256 nits, left to right. Rendered in [three.js](https://threejs.org/), | ||
* > with independent point lighting and a bloom effect. | ||
* > Source: [Don McCurdy](https://www.donmccurdy.com/2024/04/27/emission-and-bloom/)._ | ||
* | ||
* The core glTF 2.0 material model includes {@link Material.setEmissiveFactor `emissiveFactor`} | ||
@@ -17,0 +24,0 @@ * and {@link Material.setEmissiveTexture `emissiveTexture`} to control the color and intensity |
@@ -20,2 +20,7 @@ import { Extension, GLTF, PropertyType, ReaderContext, WriterContext } from '@gltf-transform/core'; | ||
* | ||
* ![Illustration](/media/extensions/khr-materials-iridescence.png) | ||
* | ||
* > _**Figure:** Varying levels of iridescence IOR values. | ||
* > Source: [Khronos Group](https://github.com/KhronosGroup/gltf/tree/main/extensions/2.0/Khronos/KHR_materials_iridescence)._ | ||
* | ||
* Iridescence describes an effect where hue varies depending on the viewing | ||
@@ -22,0 +27,0 @@ * angle and illumination angle: A thin-film of a semi-transparent layer |
@@ -17,2 +17,7 @@ import { Extension, GLTF, PropertyType, ReaderContext, WriterContext } from '@gltf-transform/core'; | ||
* | ||
* ![Illustration](/media/extensions/khr-materials-transmission.png) | ||
* | ||
* > _**Figure:** Sphere using `KHR_materials_transmission` with varying roughness (0.0, 0.2, 0.4). | ||
* > Source: Khronos Group._ | ||
* | ||
* While default PBR materials using alpha blending become invisible as their opacity approaches | ||
@@ -19,0 +24,0 @@ * zero, a transmissive material continues to reflect light in a glass-like manner, even at low |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1783855
158
24076