@gltf-transform/extensions
Advanced tools
Comparing version 0.7.3 to 0.7.4
@@ -0,1 +1,2 @@ | ||
export declare const EXT_TEXTURE_WEBP = "EXT_texture_webp"; | ||
export declare const KHR_DRACO_MESH_COMPRESSION = "KHR_draco_mesh_compression"; | ||
@@ -6,2 +7,3 @@ export declare const KHR_LIGHTS_PUNCTUAL = "KHR_lights_punctual"; | ||
export declare const KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS = "KHR_materials_pbrSpecularGlossiness"; | ||
export declare const KHR_MATERIALS_SHEEN = "KHR_materials_sheen"; | ||
export declare const KHR_MATERIALS_SPECULAR = "KHR_materials_specular"; | ||
@@ -8,0 +10,0 @@ export declare const KHR_MATERIALS_TRANSMISSION = "KHR_materials_transmission"; |
@@ -0,1 +1,2 @@ | ||
import { TextureWebP } from './ext-texture-webp'; | ||
import { DracoMeshCompression } from './khr-draco-mesh-compression'; | ||
@@ -6,2 +7,3 @@ import { LightsPunctual } from './khr-lights-punctual'; | ||
import { MaterialsPBRSpecularGlossiness } from './khr-materials-pbr-specular-glossiness'; | ||
import { MaterialsSheen } from './khr-materials-sheen'; | ||
import { MaterialsSpecular } from './khr-materials-specular'; | ||
@@ -13,2 +15,5 @@ import { MaterialsTransmission } from './khr-materials-transmission'; | ||
import { TextureTransform } from './khr-texture-transform'; | ||
export declare const KHRONOS_EXTENSIONS: (typeof DracoMeshCompression | typeof LightsPunctual | typeof MaterialsClearcoat | typeof MaterialsIOR | typeof MaterialsPBRSpecularGlossiness | typeof MaterialsSpecular | typeof MaterialsSheen | typeof MaterialsTransmission | typeof MaterialsUnlit | typeof MeshQuantization | typeof TextureBasisu | typeof TextureTransform)[]; | ||
export declare const ALL_EXTENSIONS: (typeof DracoMeshCompression | typeof LightsPunctual | typeof MaterialsClearcoat | typeof MaterialsIOR | typeof MaterialsPBRSpecularGlossiness | typeof MaterialsSpecular | typeof MaterialsSheen | typeof MaterialsTransmission | typeof MaterialsUnlit | typeof MeshQuantization | typeof TextureBasisu | typeof TextureTransform | typeof TextureWebP)[]; | ||
export * from './ext-texture-webp'; | ||
export * from './khr-draco-mesh-compression'; | ||
@@ -18,2 +23,3 @@ export * from './khr-lights-punctual'; | ||
export * from './khr-materials-ior'; | ||
export * from './khr-materials-sheen'; | ||
export * from './khr-materials-specular'; | ||
@@ -26,2 +32,1 @@ export * from './khr-materials-pbr-specular-glossiness'; | ||
export * from './khr-texture-transform'; | ||
export declare const KHRONOS_EXTENSIONS: (typeof DracoMeshCompression | typeof LightsPunctual | typeof MaterialsClearcoat | typeof MaterialsIOR | typeof MaterialsPBRSpecularGlossiness | typeof MaterialsSpecular | typeof MaterialsTransmission | typeof MaterialsUnlit | typeof MeshQuantization | typeof TextureBasisu | typeof TextureTransform)[]; |
@@ -1,2 +0,2 @@ | ||
var e,t,r,o=require("@gltf-transform/core");function s(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function a(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}function u(t,r){var o;try{if((o=new e.DecoderBuffer).Init(new Int8Array(r),r.byteLength),t.GetEncodedGeometryType(o)!==e.TRIANGULAR_MESH)throw new Error("Unknown geometry type.");var s=new e.Mesh;if(!t.DecodeBufferToMesh(o,s).ok()||0===s.ptr)throw new Error("Decoding failure.");return s}finally{e.destroy(o)}}function c(t,r){var o=3*r.num_faces(),s=o*Uint32Array.BYTES_PER_ELEMENT,n=e._malloc(s);t.GetTrianglesUInt32Array(r,s,n);var i=new Uint32Array(e.HEAP32.buffer,n,o).slice();return e._free(n),i}function l(o,s,n,i){var a=r[i.componentType],u=t[i.componentType],c=n.num_components(),l=s.num_points()*c,f=l*u.BYTES_PER_ELEMENT,h=e._malloc(f);o.GetAttributeDataArrayForAllPoints(s,n,a,f,h);var p=new u(e.HEAPF32.buffer,h,l).slice();return e._free(h),p}var f,h="KHR_draco_mesh_compression",p=function(n){function i(){var e;return(e=n.apply(this,arguments)||this).extensionName=h,e.provideTypes=[o.PropertyType.PRIMITIVE],e.dependencies=["draco3d.decoder"],e}s(i,n);var f=i.prototype;return f.install=function(o,s){var n,i;return"draco3d.decoder"===o&&(this._decoderModule=s,e=this._decoderModule,(n={})[5126]=Float32Array,n[5125]=Uint32Array,n[5123]=Uint16Array,n[5121]=Uint8Array,n[5122]=Int16Array,n[5120]=Int8Array,t=n,(i={})[5126]=e.DT_FLOAT32,i[5125]=e.DT_UINT32,i[5123]=e.DT_UINT16,i[5121]=e.DT_UINT8,i[5122]=e.DT_INT16,i[5120]=e.DT_INT8,r=i),this},f.provide=function(e){if(!this._decoderModule)throw new Error('Please install extension dependency, "draco3d.decoder".');for(var t,r=this.doc.getLogger(),s=e.jsonDoc,n=new this._decoderModule.Decoder,i=new Map,f=a(s.json.meshes);!(t=f()).done;){for(var p,x=a(t.value.primitives);!(p=x()).done;){var T=p.value;if(T.extensions&&T.extensions[h]){var g=T.extensions[h],d=i.get(g.bufferView);if(!d){var y=s.json.bufferViews[g.bufferView],_=s.json.buffers[y.buffer],v=new Uint8Array(_.uri?s.resources[_.uri]:s.resources[o.GLB_BUFFER],y.byteOffset||0,y.byteLength);d=u(n,v),i.set(g.bufferView,d),r.debug("Decompressed "+v.byteLength+" bytes.")}for(var m in T.attributes){var I=e.jsonDoc.json.accessors[T.attributes[m]],C=n.GetAttributeByUniqueId(d,g.attributes[m]),E=l(n,d,C,I);e.accessors[T.attributes[m]].setArray(E)}var N=c(n,d);e.accessors[T.indices].setArray(N)}}this._decoderModule.destroy(n);for(var R=0,F=Array.from(i.values());R<F.length;R++)this._decoderModule.destroy(F[R])}return this},f.read=function(e){return this.dispose(),this},f.write=function(e){return this.doc.getLogger().warn("Writing "+this.extensionName+" not yet implemented."),this},i}(o.Extension);p.EXTENSION_NAME=h,(f=exports.LightType||(exports.LightType={})).POINT="point",f.SPOT="spot",f.DIRECTIONAL="directional";var x=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).propertyType="Light",t.parentTypes=[o.PropertyType.NODE],t.extensionName="KHR_lights_punctual",t._color=[1,1,1],t._intensity=1,t._range=void 0,t._innerConeAngle=0,t._outerConeAngle=Math.PI/4,t}s(t,e);var r=t.prototype;return r.copy=function(t,r){return void 0===r&&(r=o.COPY_IDENTITY),e.prototype.copy.call(this,t,r),this._color=[].concat(t._color),this._intensity=t._intensity,this._type=t._type,this._range=t._range,this._innerConeAngle=t._innerConeAngle,this._outerConeAngle=t._outerConeAngle,this},r.getColor=function(){return this._color},r.setColor=function(e){return this._color=e,this},r.getColorHex=function(){return o.ColorUtils.factorToHex(this._color)},r.setColorHex=function(e){return o.ColorUtils.hexToFactor(e,this._color),this},r.getIntensity=function(){return this._intensity},r.setIntensity=function(e){return this._intensity=e,this},r.getType=function(){return this._type},r.setType=function(e){return this._type=e,this},r.getRange=function(){return this._range},r.setRange=function(e){return this._range=e,this},r.getInnerConeAngle=function(){return this._innerConeAngle},r.setInnerConeAngle=function(e){return this._innerConeAngle=e,this},r.getOuterConeAngle=function(){return this._outerConeAngle},r.setOuterConeAngle=function(e){return this._outerConeAngle=e,this},t}(o.ExtensionProperty);x.EXTENSION_NAME="KHR_lights_punctual";var T="KHR_lights_punctual",g=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=T,t}s(t,e);var r=t.prototype;return r.createLight=function(){return new x(this.doc.getGraph(),this)},r.read=function(e){var t=this,r=e.jsonDoc;if(!r.json.extensions||!r.json.extensions[T])return this;var o=(r.json.extensions[T].lights||[]).map(function(e){var r=t.createLight().setName(e.name||"").setType(e.type);return void 0!==e.color&&r.setColor(e.color),void 0!==e.intensity&&r.setIntensity(e.intensity),void 0!==e.range&&r.setRange(e.range),void 0!==e.innerConeAngle&&r.setInnerConeAngle(e.innerConeAngle),void 0!==e.outerConeAngle&&r.setOuterConeAngle(e.outerConeAngle),r});return r.json.nodes.forEach(function(t,r){t.extensions&&t.extensions[T]&&e.nodes[r].setExtension(T,o[t.extensions[T].light])}),this},r.write=function(e){var t=e.jsonDoc;if(0===this.properties.size)return this;for(var r,o=[],s=new Map,n=a(this.properties);!(r=n()).done;){var i=r.value,u={type:i.getType(),color:i.getColor(),intensity:i.getIntensity(),range:i.getRange()};i.getName()&&(u.name=i.getName()),i.getType()===exports.LightType.SPOT&&(u.innerConeAngle=i.getInnerConeAngle(),u.outerConeAngle=i.getOuterConeAngle()),o.push(u),s.set(i,o.length-1)}return this.doc.getRoot().listNodes().forEach(function(r){var o=r.getExtension(T);if(o){var n=e.nodeIndexMap.get(r),i=t.json.nodes[n];i.extensions=i.extensions||{},i.extensions[T]={light:s.get(o)}}}),t.json.extensions=t.json.extensions||{},t.json.extensions[T]={lights:o},this},t}(o.Extension);function d(e,t,r,o){var s,n=arguments.length,i=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(i=(n<3?s(i):n>3?s(t,r,i):s(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i}g.EXTENSION_NAME=T;var y=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).propertyType="Clearcoat",t.parentTypes=[o.PropertyType.MATERIAL],t.extensionName="KHR_materials_clearcoat",t._clearcoatFactor=0,t._clearcoatRoughnessFactor=0,t._clearcoatNormalScale=1,t.clearcoatTexture=null,t.clearcoatTextureInfo=t.graph.link("clearcoatTextureInfo",n(t),new o.TextureInfo(t.graph)),t.clearcoatRoughnessTexture=null,t.clearcoatRoughnessTextureInfo=t.graph.link("clearcoatRoughnessTextureInfo",n(t),new o.TextureInfo(t.graph)),t.clearcoatNormalTexture=null,t.clearcoatNormalTextureInfo=t.graph.link("clearcoatNormalTextureInfo",n(t),new o.TextureInfo(t.graph)),t}s(t,e);var r=t.prototype;return r.copy=function(t,r){return void 0===r&&(r=o.COPY_IDENTITY),e.prototype.copy.call(this,t,r),this._clearcoatFactor=t._clearcoatFactor,this._clearcoatRoughnessFactor=t._clearcoatRoughnessFactor,this._clearcoatNormalScale=t._clearcoatNormalScale,t.clearcoatTexture&&(this.setClearcoatTexture(r(t.clearcoatTexture.getChild())),this.getClearcoatTextureInfo().copy(r(t.clearcoatTextureInfo.getChild()),r)),t.clearcoatRoughnessTexture&&(this.setClearcoatRoughnessTexture(r(t.clearcoatRoughnessTexture.getChild())),this.getClearcoatRoughnessTextureInfo().copy(r(t.clearcoatRoughnessTextureInfo.getChild()),r)),t.clearcoatNormalTexture&&(this.setClearcoatNormalTexture(r(t.clearcoatNormalTexture.getChild())),this.getClearcoatNormalTextureInfo().copy(r(t.clearcoatNormalTextureInfo.getChild()),r)),this},r.dispose=function(){this.clearcoatTextureInfo.getChild().dispose(),this.clearcoatRoughnessTextureInfo.getChild().dispose(),this.clearcoatNormalTextureInfo.getChild().dispose(),e.prototype.dispose.call(this)},r.getClearcoatFactor=function(){return this._clearcoatFactor},r.setClearcoatFactor=function(e){return this._clearcoatFactor=e,this},r.getClearcoatTexture=function(){return this.clearcoatTexture?this.clearcoatTexture.getChild():null},r.getClearcoatTextureInfo=function(){return this.clearcoatTexture?this.clearcoatTextureInfo.getChild():null},r.setClearcoatTexture=function(e){return this.clearcoatTexture=this.graph.link("clearcoatTexture",this,e),this},r.getClearcoatRoughnessFactor=function(){return this._clearcoatRoughnessFactor},r.setClearcoatRoughnessFactor=function(e){return this._clearcoatRoughnessFactor=e,this},r.getClearcoatRoughnessTexture=function(){return this.clearcoatRoughnessTexture?this.clearcoatRoughnessTexture.getChild():null},r.getClearcoatRoughnessTextureInfo=function(){return this.clearcoatRoughnessTexture?this.clearcoatRoughnessTextureInfo.getChild():null},r.setClearcoatRoughnessTexture=function(e){return this.clearcoatRoughnessTexture=this.graph.link("clearcoatRoughnessTexture",this,e),this},r.getClearcoatNormalScale=function(){return this._clearcoatNormalScale},r.setClearcoatNormalScale=function(e){return this._clearcoatNormalScale=e,this},r.getClearcoatNormalTexture=function(){return this.clearcoatNormalTexture?this.clearcoatNormalTexture.getChild():null},r.getClearcoatNormalTextureInfo=function(){return this.clearcoatNormalTexture?this.clearcoatNormalTextureInfo.getChild():null},r.setClearcoatNormalTexture=function(e){return this.clearcoatNormalTexture=this.graph.link("clearcoatNormalTexture",this,e),this},t}(o.ExtensionProperty);y.EXTENSION_NAME="KHR_materials_clearcoat",d([o.GraphChild],y.prototype,"clearcoatTexture",void 0),d([o.GraphChild],y.prototype,"clearcoatTextureInfo",void 0),d([o.GraphChild],y.prototype,"clearcoatRoughnessTexture",void 0),d([o.GraphChild],y.prototype,"clearcoatRoughnessTextureInfo",void 0),d([o.GraphChild],y.prototype,"clearcoatNormalTexture",void 0),d([o.GraphChild],y.prototype,"clearcoatNormalTextureInfo",void 0);var _="KHR_materials_clearcoat",v=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=_,t}s(t,e);var r=t.prototype;return r.createClearcoat=function(){return new y(this.doc.getGraph(),this)},r.read=function(e){var t=this,r=e.jsonDoc,o=r.json.textures||[];return(r.json.materials||[]).forEach(function(r,s){if(r.extensions&&r.extensions[_]){var n=t.createClearcoat();if(e.materials[s].setExtension(_,n),void 0!==r.extensions[_].clearcoatFactor&&n.setClearcoatFactor(r.extensions[_].clearcoatFactor),void 0!==r.extensions[_].clearcoatRoughnessFactor&&n.setClearcoatRoughnessFactor(r.extensions[_].clearcoatRoughnessFactor),void 0!==r.extensions[_].clearcoatTexture){var i=r.extensions[_].clearcoatTexture;n.setClearcoatTexture(e.textures[o[i.index].source]),e.setTextureInfo(n.getClearcoatTextureInfo(),i)}if(void 0!==r.extensions[_].clearcoatRoughnessTexture){var a=r.extensions[_].clearcoatRoughnessTexture;n.setClearcoatRoughnessTexture(e.textures[o[a.index].source]),e.setTextureInfo(n.getClearcoatRoughnessTextureInfo(),a)}if(void 0!==r.extensions[_].clearcoatNormalTexture){var u=r.extensions[_].clearcoatNormalTexture;n.setClearcoatNormalTexture(e.textures[o[u.index].source]),e.setTextureInfo(n.getClearcoatNormalTextureInfo(),u),void 0!==u.scale&&n.setClearcoatNormalScale(u.scale)}}}),this},r.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(_);if(o){var s=e.materialIndexMap.get(r),n=t.json.materials[s];if(n.extensions=n.extensions||{},n.extensions[_]={clearcoatFactor:o.getClearcoatFactor(),clearcoatRoughnessFactor:o.getClearcoatRoughnessFactor()},o.getClearcoatTexture()){var i=o.getClearcoatTexture(),a=o.getClearcoatTextureInfo();n.extensions[_].clearcoatTexture=e.createTextureInfoDef(i,a)}if(o.getClearcoatRoughnessTexture()){var u=o.getClearcoatRoughnessTexture(),c=o.getClearcoatRoughnessTextureInfo();n.extensions[_].clearcoatRoughnessTexture=e.createTextureInfoDef(u,c)}if(o.getClearcoatNormalTexture()){var l=o.getClearcoatNormalTexture(),f=o.getClearcoatNormalTextureInfo();n.extensions[_].clearcoatNormalTexture=e.createTextureInfoDef(l,f),1!==o.getClearcoatNormalScale()&&(n.extensions[_].clearcoatNormalTexture.scale=o.getClearcoatNormalScale())}}}),this},t}(o.Extension);v.EXTENSION_NAME=_;var m=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).propertyType="IOR",t.parentTypes=[o.PropertyType.MATERIAL],t.extensionName="KHR_materials_ior",t._ior=0,t}s(t,e);var r=t.prototype;return r.copy=function(t,r){return void 0===r&&(r=o.COPY_IDENTITY),e.prototype.copy.call(this,t,r),this._ior=t._ior,this},r.getIOR=function(){return this._ior},r.setIOR=function(e){return this._ior=e,this},t}(o.ExtensionProperty);m.EXTENSION_NAME="KHR_materials_ior";var I="KHR_materials_ior",C=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=I,t}s(t,e);var r=t.prototype;return r.createIOR=function(){return new m(this.doc.getGraph(),this)},r.read=function(e){var t=this;return(e.jsonDoc.json.materials||[]).forEach(function(r,o){if(r.extensions&&r.extensions[I]){var s=t.createIOR();e.materials[o].setExtension(I,s),void 0!==r.extensions[I].ior&&s.setIOR(r.extensions[I].ior)}}),this},r.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(I);if(o){var s=e.materialIndexMap.get(r),n=t.json.materials[s];n.extensions=n.extensions||{},n.extensions[I]={ior:o.getIOR()}}}),this},t}(o.Extension);C.EXTENSION_NAME=I;var E=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).propertyType="PBRSpecularGlossiness",t.parentTypes=[o.PropertyType.MATERIAL],t.extensionName="KHR_materials_pbrSpecularGlossiness",t._diffuseFactor=[1,1,1,1],t._specularFactor=[1,1,1],t._glossinessFactor=1,t.diffuseTexture=null,t.diffuseTextureInfo=t.graph.link("diffuseTextureInfo",n(t),new o.TextureInfo(t.graph)),t.specularGlossinessTexture=null,t.specularGlossinessTextureInfo=t.graph.link("specularGlossinessTextureInfo",n(t),new o.TextureInfo(t.graph)),t}s(t,e);var r=t.prototype;return r.copy=function(t,r){return void 0===r&&(r=o.COPY_IDENTITY),e.prototype.copy.call(this,t,r),this._diffuseFactor=t._diffuseFactor,this._specularFactor=t._specularFactor,this._glossinessFactor=t._glossinessFactor,t.diffuseTexture&&(this.setDiffuseTexture(r(t.diffuseTexture.getChild())),this.getDiffuseTextureInfo().copy(r(t.diffuseTextureInfo.getChild()),r)),t.specularGlossinessTexture&&(this.setSpecularGlossinessTexture(r(t.specularGlossinessTexture.getChild())),this.getSpecularGlossinessTextureInfo().copy(r(t.specularGlossinessTextureInfo.getChild()),r)),this},r.dispose=function(){this.diffuseTextureInfo.getChild().dispose(),this.specularGlossinessTextureInfo.getChild().dispose(),e.prototype.dispose.call(this)},r.getDiffuseFactor=function(){return this._diffuseFactor},r.setDiffuseFactor=function(e){return this._diffuseFactor=e,this},r.getDiffuseHex=function(){return o.ColorUtils.factorToHex(this._diffuseFactor)},r.setDiffuseHex=function(e){return o.ColorUtils.hexToFactor(e,this._diffuseFactor),this},r.getDiffuseTexture=function(){return this.diffuseTexture?this.diffuseTexture.getChild():null},r.getDiffuseTextureInfo=function(){return this.diffuseTexture?this.diffuseTextureInfo.getChild():null},r.setDiffuseTexture=function(e){return this.diffuseTexture=this.graph.link("diffuseTexture",this,e),this},r.getSpecularFactor=function(){return this._specularFactor},r.setSpecularFactor=function(e){return this._specularFactor=e,this},r.getGlossinessFactor=function(){return this._glossinessFactor},r.setGlossinessFactor=function(e){return this._glossinessFactor=e,this},r.getSpecularGlossinessTexture=function(){return this.specularGlossinessTexture?this.specularGlossinessTexture.getChild():null},r.getSpecularGlossinessTextureInfo=function(){return this.specularGlossinessTexture?this.specularGlossinessTextureInfo.getChild():null},r.setSpecularGlossinessTexture=function(e){return this.specularGlossinessTexture=this.graph.link("specularGlossinessTexture",this,e),this},t}(o.ExtensionProperty);E.EXTENSION_NAME="KHR_materials_pbrSpecularGlossiness",d([o.GraphChild],E.prototype,"diffuseTexture",void 0),d([o.GraphChild],E.prototype,"diffuseTextureInfo",void 0),d([o.GraphChild],E.prototype,"specularGlossinessTexture",void 0),d([o.GraphChild],E.prototype,"specularGlossinessTextureInfo",void 0);var N="KHR_materials_pbrSpecularGlossiness",R=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=N,t}s(t,e);var r=t.prototype;return r.createPBRSpecularGlossiness=function(){return new E(this.doc.getGraph(),this)},r.read=function(e){var t=this,r=e.jsonDoc,o=r.json.textures||[];return(r.json.materials||[]).forEach(function(r,s){if(r.extensions&&r.extensions[N]){var n=t.createPBRSpecularGlossiness();if(e.materials[s].setExtension(N,n),void 0!==r.extensions[N].diffuseFactor&&n.setDiffuseFactor(r.extensions[N].diffuseFactor),void 0!==r.extensions[N].specularFactor&&n.setSpecularFactor(r.extensions[N].specularFactor),void 0!==r.extensions[N].glossinessFactor&&n.setGlossinessFactor(r.extensions[N].glossinessFactor),void 0!==r.extensions[N].diffuseTexture){var i=r.extensions[N].diffuseTexture;n.setDiffuseTexture(e.textures[o[i.index].source]),e.setTextureInfo(n.getDiffuseTextureInfo(),i)}if(void 0!==r.extensions[N].specularGlossinessTexture){var a=r.extensions[N].specularGlossinessTexture;n.setSpecularGlossinessTexture(e.textures[o[a.index].source]),e.setTextureInfo(n.getSpecularGlossinessTextureInfo(),a)}}}),this},r.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(N);if(o){var s=e.materialIndexMap.get(r),n=t.json.materials[s];if(n.extensions=n.extensions||{},n.extensions[N]={diffuseFactor:o.getDiffuseFactor(),specularFactor:o.getSpecularFactor(),glossinessFactor:o.getGlossinessFactor()},o.getDiffuseTexture()){var i=o.getDiffuseTexture(),a=o.getDiffuseTextureInfo();n.extensions[N].diffuseTexture=e.createTextureInfoDef(i,a)}if(o.getSpecularGlossinessTexture()){var u=o.getSpecularGlossinessTexture(),c=o.getSpecularGlossinessTextureInfo();n.extensions[N].specularGlossinessTexture=e.createTextureInfoDef(u,c)}}}),this},t}(o.Extension);R.EXTENSION_NAME=N;var F=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).propertyType="Specular",t.parentTypes=[o.PropertyType.MATERIAL],t.extensionName="KHR_materials_specular",t._specularFactor=1,t._specularColorFactor=[1,1,1],t.specularTexture=null,t.specularTextureInfo=t.graph.link("specularTextureInfo",n(t),new o.TextureInfo(t.graph)),t}s(t,e);var r=t.prototype;return r.copy=function(t,r){return void 0===r&&(r=o.COPY_IDENTITY),e.prototype.copy.call(this,t,r),this._specularFactor=t._specularFactor,t.specularTexture&&(this.setSpecularTexture(r(t.specularTexture.getChild())),this.getSpecularTextureInfo().copy(r(t.specularTextureInfo.getChild()),r)),this},r.dispose=function(){this.specularTextureInfo.getChild().dispose(),e.prototype.dispose.call(this)},r.getSpecularFactor=function(){return this._specularFactor},r.setSpecularFactor=function(e){return this._specularFactor=e,this},r.getSpecularColorFactor=function(){return this._specularColorFactor},r.setSpecularColorFactor=function(e){return this._specularColorFactor=e,this},r.getSpecularColorHex=function(){return o.ColorUtils.factorToHex(this._specularColorFactor)},r.setSpecularColorHex=function(e){return o.ColorUtils.hexToFactor(e,this._specularColorFactor),this},r.getSpecularTexture=function(){return this.specularTexture?this.specularTexture.getChild():null},r.getSpecularTextureInfo=function(){return this.specularTexture?this.specularTextureInfo.getChild():null},r.setSpecularTexture=function(e){return this.specularTexture=this.graph.link("specularTexture",this,e),this},t}(o.ExtensionProperty);F.EXTENSION_NAME="KHR_materials_specular",d([o.GraphChild],F.prototype,"specularTexture",void 0),d([o.GraphChild],F.prototype,"specularTextureInfo",void 0);var S="KHR_materials_specular",A=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=S,t}s(t,e);var r=t.prototype;return r.createSpecular=function(){return new F(this.doc.getGraph(),this)},r.read=function(e){var t=this,r=e.jsonDoc,o=r.json.textures||[];return(r.json.materials||[]).forEach(function(r,s){if(r.extensions&&r.extensions[S]){var n=t.createSpecular();if(e.materials[s].setExtension(S,n),void 0!==r.extensions[S].specularFactor&&n.setSpecularFactor(r.extensions[S].specularFactor),void 0!==r.extensions[S].specularColorFactor&&n.setSpecularColorFactor(r.extensions[S].specularColorFactor),void 0!==r.extensions[S].specularTexture){var i=r.extensions[S].specularTexture;n.setSpecularTexture(e.textures[o[i.index].source]),e.setTextureInfo(n.getSpecularTextureInfo(),i)}}}),this},r.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(S);if(o){var s=e.materialIndexMap.get(r),n=t.json.materials[s];if(n.extensions=n.extensions||{},n.extensions[S]={specularFactor:o.getSpecularFactor(),specularColorFactor:o.getSpecularColorFactor()},o.getSpecularTexture()){var i=o.getSpecularTexture(),a=o.getSpecularTextureInfo();n.extensions[S].specularTexture=e.createTextureInfoDef(i,a)}}}),this},t}(o.Extension);A.EXTENSION_NAME=S;var G=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).propertyType="Transmission",t.parentTypes=[o.PropertyType.MATERIAL],t.extensionName="KHR_materials_transmission",t._transmissionFactor=0,t.transmissionTexture=null,t.transmissionTextureInfo=t.graph.link("transmissionTextureInfo",n(t),new o.TextureInfo(t.graph)),t}s(t,e);var r=t.prototype;return r.copy=function(t,r){return void 0===r&&(r=o.COPY_IDENTITY),e.prototype.copy.call(this,t,r),this._transmissionFactor=t._transmissionFactor,t.transmissionTexture&&(this.setTransmissionTexture(r(t.transmissionTexture.getChild())),this.getTransmissionTextureInfo().copy(r(t.transmissionTextureInfo.getChild()),r)),this},r.dispose=function(){this.transmissionTextureInfo.getChild().dispose(),e.prototype.dispose.call(this)},r.getTransmissionFactor=function(){return this._transmissionFactor},r.setTransmissionFactor=function(e){return this._transmissionFactor=e,this},r.getTransmissionTexture=function(){return this.transmissionTexture?this.transmissionTexture.getChild():null},r.getTransmissionTextureInfo=function(){return this.transmissionTexture?this.transmissionTextureInfo.getChild():null},r.setTransmissionTexture=function(e){return this.transmissionTexture=this.graph.link("transmissionTexture",this,e),this},t}(o.ExtensionProperty);G.EXTENSION_NAME="KHR_materials_transmission",d([o.GraphChild],G.prototype,"transmissionTexture",void 0),d([o.GraphChild],G.prototype,"transmissionTextureInfo",void 0);var D="KHR_materials_transmission",M=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=D,t}s(t,e);var r=t.prototype;return r.createTransmission=function(){return new G(this.doc.getGraph(),this)},r.read=function(e){var t=this,r=e.jsonDoc,o=r.json.textures||[];return(r.json.materials||[]).forEach(function(r,s){if(r.extensions&&r.extensions[D]){var n=t.createTransmission();if(e.materials[s].setExtension(D,n),void 0!==r.extensions[D].transmissionFactor&&n.setTransmissionFactor(r.extensions[D].transmissionFactor),void 0!==r.extensions[D].transmissionTexture){var i=r.extensions[D].transmissionTexture;n.setTransmissionTexture(e.textures[o[i.index].source]),e.setTextureInfo(n.getTransmissionTextureInfo(),i)}}}),this},r.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(D);if(o){var s=e.materialIndexMap.get(r),n=t.json.materials[s];if(n.extensions=n.extensions||{},n.extensions[D]={transmissionFactor:o.getTransmissionFactor()},o.getTransmissionTexture()){var i=o.getTransmissionTexture(),a=o.getTransmissionTextureInfo();n.extensions[D].transmissionTexture=e.createTextureInfoDef(i,a)}}}),this},t}(o.Extension);M.EXTENSION_NAME=D;var O=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).propertyType="Unlit",t.parentTypes=[o.PropertyType.MATERIAL],t.extensionName="KHR_materials_unlit",t}return s(t,e),t}(o.ExtensionProperty);O.EXTENSION_NAME="KHR_materials_unlit";var j="KHR_materials_unlit",w=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=j,t}s(t,e);var r=t.prototype;return r.createUnlit=function(){return new O(this.doc.getGraph(),this)},r.read=function(e){var t=this;return(e.jsonDoc.json.materials||[]).forEach(function(r,o){r.extensions&&r.extensions[j]&&e.materials[o].setExtension(j,t.createUnlit())}),this},r.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){if(r.getExtension(j)){var o=e.materialIndexMap.get(r),s=t.json.materials[o];s.extensions=s.extensions||{},s.extensions[j]={}}}),this},t}(o.Extension);w.EXTENSION_NAME=j;var P="KHR_mesh_quantization",b=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=P,t}s(t,e);var r=t.prototype;return r.read=function(e){return this},r.write=function(e){return this},t}(o.Extension);b.EXTENSION_NAME=P;var H="KHR_texture_basisu",K=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=H,t.provideTypes=[o.PropertyType.TEXTURE],t}s(t,e);var r=t.prototype;return r.provide=function(e){return e.jsonDoc.json.textures.forEach(function(e){e.extensions&&e.extensions[H]&&(e.source=e.extensions[H].source)}),this},r.read=function(e){return this},r.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listTextures().forEach(function(r){if("image/ktx2"===r.getMimeType()){var o=e.imageIndexMap.get(r);t.json.textures.forEach(function(e){e.source===o&&(e.extensions=e.extensions||{},e.extensions[H]={source:e.source},delete e.source)})}}),this},t}(o.Extension);K.EXTENSION_NAME=H;var U=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).propertyType="Transform",t.parentTypes=[o.PropertyType.TEXTURE_INFO],t.extensionName="KHR_texture_transform",t._offset=[0,0],t._rotation=0,t._scale=[1,1],t._texCoord=void 0,t}s(t,e);var r=t.prototype;return r.copy=function(t,r){return void 0===r&&(r=o.COPY_IDENTITY),e.prototype.copy.call(this,t,r),this._offset=t._offset,this._rotation=t._rotation,this._scale=t._scale,this._texCoord=t._texCoord,this},r.getOffset=function(){return this._offset},r.setOffset=function(e){return this._offset=e,this},r.getRotation=function(){return this._rotation},r.setRotation=function(e){return this._rotation=e,this},r.getScale=function(){return this._scale},r.setScale=function(e){return this._scale=e,this},r.getTexCoord=function(){return this._texCoord},r.setTexCoord=function(e){return this._texCoord=e,this},t}(o.ExtensionProperty);U.EXTENSION_NAME="KHR_texture_transform";var L="KHR_texture_transform",X=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).extensionName=L,t}s(t,e);var r=t.prototype;return r.createTransform=function(){return new U(this.doc.getGraph(),this)},r.read=function(e){for(var t=0,r=Array.from(e.textureInfos.entries());t<r.length;t++){var o=r[t],s=o[0],n=o[1];if(n.extensions&&n.extensions[L]){var i=this.createTransform(),a=n.extensions[L];void 0!==a.offset&&i.setOffset(a.offset),void 0!==a.rotation&&i.setRotation(a.rotation),void 0!==a.scale&&i.setScale(a.scale),void 0!==a.texCoord&&i.setTexCoord(a.texCoord),s.setExtension(L,i)}}return this},r.write=function(e){for(var t=0,r=Array.from(e.textureInfoDefMap.entries());t<r.length;t++){var o=r[t],s=o[1],n=o[0].getExtension(L);n&&(s.extensions=s.extensions||{},s.extensions[L]={offset:n.getOffset(),rotation:n.getRotation(),scale:n.getScale(),texCoord:n.getTexCoord()})}return this},t}(o.Extension);X.EXTENSION_NAME=L;var k=[p,g,v,C,R,A,M,w,b,K,X];exports.Clearcoat=y,exports.DracoMeshCompression=p,exports.IOR=m,exports.KHRONOS_EXTENSIONS=k,exports.Light=x,exports.LightsPunctual=g,exports.MaterialsClearcoat=v,exports.MaterialsIOR=C,exports.MaterialsPBRSpecularGlossiness=R,exports.MaterialsSpecular=A,exports.MaterialsTransmission=M,exports.MaterialsUnlit=w,exports.MeshQuantization=b,exports.PBRSpecularGlossiness=E,exports.Specular=F,exports.TextureBasisu=K,exports.TextureTransform=X,exports.Transform=U,exports.Transmission=G,exports.Unlit=O; | ||
var e=require("@gltf-transform/core");function t(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function n(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return o(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var s,i,a,u="EXT_texture_webp",c=function(r){function o(){var t;return(t=r.apply(this,arguments)||this).extensionName=u,t.provideTypes=[e.PropertyType.TEXTURE],t}t(o,r);var n=o.prototype;return n.provide=function(e){return e.jsonDoc.json.textures.forEach(function(e){e.extensions&&e.extensions[u]&&(e.source=e.extensions[u].source)}),this},n.read=function(e){return this},n.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listTextures().forEach(function(r){if("image/webp"===r.getMimeType()){var o=e.imageIndexMap.get(r);t.json.textures.forEach(function(e){e.source===o&&(e.extensions=e.extensions||{},e.extensions[u]={source:e.source},delete e.source)})}}),this},o}(e.Extension);function l(e,t){var r;try{if((r=new s.DecoderBuffer).Init(new Int8Array(t),t.byteLength),e.GetEncodedGeometryType(r)!==s.TRIANGULAR_MESH)throw new Error("Unknown geometry type.");var o=new s.Mesh;if(!e.DecodeBufferToMesh(r,o).ok()||0===o.ptr)throw new Error("Decoding failure.");return o}finally{s.destroy(r)}}function h(e,t){var r=3*t.num_faces(),o=r*Uint32Array.BYTES_PER_ELEMENT,n=s._malloc(o);e.GetTrianglesUInt32Array(t,o,n);var i=new Uint32Array(s.HEAP32.buffer,n,r).slice();return s._free(n),i}function f(e,t,r,o){var n=a[o.componentType],u=i[o.componentType],c=r.num_components(),l=t.num_points()*c,h=l*u.BYTES_PER_ELEMENT,f=s._malloc(h);e.GetAttributeDataArrayForAllPoints(t,r,n,h,f);var x=new u(s.HEAPF32.buffer,f,l).slice();return s._free(f),x}c.EXTENSION_NAME=u;var x,p="KHR_draco_mesh_compression",T=function(r){function o(){var t;return(t=r.apply(this,arguments)||this).extensionName=p,t.provideTypes=[e.PropertyType.PRIMITIVE],t.dependencies=["draco3d.decoder"],t}t(o,r);var u=o.prototype;return u.install=function(e,t){var r,o;return"draco3d.decoder"===e&&(this._decoderModule=t,s=this._decoderModule,(r={})[5126]=Float32Array,r[5125]=Uint32Array,r[5123]=Uint16Array,r[5121]=Uint8Array,r[5122]=Int16Array,r[5120]=Int8Array,i=r,(o={})[5126]=s.DT_FLOAT32,o[5125]=s.DT_UINT32,o[5123]=s.DT_UINT16,o[5121]=s.DT_UINT8,o[5122]=s.DT_INT16,o[5120]=s.DT_INT8,a=o),this},u.provide=function(t){if(!this._decoderModule)throw new Error('Please install extension dependency, "draco3d.decoder".');for(var r,o=this.doc.getLogger(),s=t.jsonDoc,i=new this._decoderModule.Decoder,a=new Map,u=n(s.json.meshes);!(r=u()).done;){for(var c,x=n(r.value.primitives);!(c=x()).done;){var T=c.value;if(T.extensions&&T.extensions[p]){var g=T.extensions[p],d=a.get(g.bufferView);if(!d){var y=s.json.bufferViews[g.bufferView],_=s.json.buffers[y.buffer],v=new Uint8Array(_.uri?s.resources[_.uri]:s.resources[e.GLB_BUFFER],y.byteOffset||0,y.byteLength);d=l(i,v),a.set(g.bufferView,d),o.debug("Decompressed "+v.byteLength+" bytes.")}for(var C in T.attributes){var I=t.jsonDoc.json.accessors[T.attributes[C]],m=i.GetAttributeByUniqueId(d,g.attributes[C]),E=f(i,d,m,I);t.accessors[T.attributes[C]].setArray(E)}var R=h(i,d);t.accessors[T.indices].setArray(R)}}this._decoderModule.destroy(i);for(var N=0,F=Array.from(a.values());N<F.length;N++)this._decoderModule.destroy(F[N])}return this},u.read=function(e){return this.dispose(),this},u.write=function(e){return this.doc.getLogger().warn("Writing "+this.extensionName+" not yet implemented."),this},o}(e.Extension);T.EXTENSION_NAME=p,(x=exports.LightType||(exports.LightType={})).POINT="point",x.SPOT="spot",x.DIRECTIONAL="directional";var g=function(r){function o(){var t;return(t=r.apply(this,arguments)||this).propertyType="Light",t.parentTypes=[e.PropertyType.NODE],t.extensionName="KHR_lights_punctual",t._color=[1,1,1],t._intensity=1,t._range=void 0,t._innerConeAngle=0,t._outerConeAngle=Math.PI/4,t}t(o,r);var n=o.prototype;return n.copy=function(t,o){return void 0===o&&(o=e.COPY_IDENTITY),r.prototype.copy.call(this,t,o),this._color=[].concat(t._color),this._intensity=t._intensity,this._type=t._type,this._range=t._range,this._innerConeAngle=t._innerConeAngle,this._outerConeAngle=t._outerConeAngle,this},n.getColor=function(){return this._color},n.setColor=function(e){return this._color=e,this},n.getColorHex=function(){return e.ColorUtils.factorToHex(this._color)},n.setColorHex=function(t){return e.ColorUtils.hexToFactor(t,this._color),this},n.getIntensity=function(){return this._intensity},n.setIntensity=function(e){return this._intensity=e,this},n.getType=function(){return this._type},n.setType=function(e){return this._type=e,this},n.getRange=function(){return this._range},n.setRange=function(e){return this._range=e,this},n.getInnerConeAngle=function(){return this._innerConeAngle},n.setInnerConeAngle=function(e){return this._innerConeAngle=e,this},n.getOuterConeAngle=function(){return this._outerConeAngle},n.setOuterConeAngle=function(e){return this._outerConeAngle=e,this},o}(e.ExtensionProperty);g.EXTENSION_NAME="KHR_lights_punctual";var d="KHR_lights_punctual",y=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=d,t}t(r,e);var o=r.prototype;return o.createLight=function(){return new g(this.doc.getGraph(),this)},o.read=function(e){var t=this,r=e.jsonDoc;if(!r.json.extensions||!r.json.extensions[d])return this;var o=(r.json.extensions[d].lights||[]).map(function(e){var r=t.createLight().setName(e.name||"").setType(e.type);return void 0!==e.color&&r.setColor(e.color),void 0!==e.intensity&&r.setIntensity(e.intensity),void 0!==e.range&&r.setRange(e.range),void 0!==e.innerConeAngle&&r.setInnerConeAngle(e.innerConeAngle),void 0!==e.outerConeAngle&&r.setOuterConeAngle(e.outerConeAngle),r});return r.json.nodes.forEach(function(t,r){t.extensions&&t.extensions[d]&&e.nodes[r].setExtension(d,o[t.extensions[d].light])}),this},o.write=function(e){var t=e.jsonDoc;if(0===this.properties.size)return this;for(var r,o=[],s=new Map,i=n(this.properties);!(r=i()).done;){var a=r.value,u={type:a.getType(),color:a.getColor(),intensity:a.getIntensity(),range:a.getRange()};a.getName()&&(u.name=a.getName()),a.getType()===exports.LightType.SPOT&&(u.innerConeAngle=a.getInnerConeAngle(),u.outerConeAngle=a.getOuterConeAngle()),o.push(u),s.set(a,o.length-1)}return this.doc.getRoot().listNodes().forEach(function(r){var o=r.getExtension(d);if(o){var n=e.nodeIndexMap.get(r),i=t.json.nodes[n];i.extensions=i.extensions||{},i.extensions[d]={light:s.get(o)}}}),t.json.extensions=t.json.extensions||{},t.json.extensions[d]={lights:o},this},r}(e.Extension);function _(e,t,r,o){var n,s=arguments.length,i=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(i=(s<3?n(i):s>3?n(t,r,i):n(t,r))||i);return s>3&&i&&Object.defineProperty(t,r,i),i}y.EXTENSION_NAME=d;var v=function(o){function n(){var t;return(t=o.apply(this,arguments)||this).propertyType="Clearcoat",t.parentTypes=[e.PropertyType.MATERIAL],t.extensionName="KHR_materials_clearcoat",t._clearcoatFactor=0,t._clearcoatRoughnessFactor=0,t._clearcoatNormalScale=1,t.clearcoatTexture=null,t.clearcoatTextureInfo=t.graph.link("clearcoatTextureInfo",r(t),new e.TextureInfo(t.graph)),t.clearcoatRoughnessTexture=null,t.clearcoatRoughnessTextureInfo=t.graph.link("clearcoatRoughnessTextureInfo",r(t),new e.TextureInfo(t.graph)),t.clearcoatNormalTexture=null,t.clearcoatNormalTextureInfo=t.graph.link("clearcoatNormalTextureInfo",r(t),new e.TextureInfo(t.graph)),t}t(n,o);var s=n.prototype;return s.copy=function(t,r){return void 0===r&&(r=e.COPY_IDENTITY),o.prototype.copy.call(this,t,r),this._clearcoatFactor=t._clearcoatFactor,this._clearcoatRoughnessFactor=t._clearcoatRoughnessFactor,this._clearcoatNormalScale=t._clearcoatNormalScale,t.clearcoatTexture&&(this.setClearcoatTexture(r(t.clearcoatTexture.getChild())),this.getClearcoatTextureInfo().copy(r(t.clearcoatTextureInfo.getChild()),r)),t.clearcoatRoughnessTexture&&(this.setClearcoatRoughnessTexture(r(t.clearcoatRoughnessTexture.getChild())),this.getClearcoatRoughnessTextureInfo().copy(r(t.clearcoatRoughnessTextureInfo.getChild()),r)),t.clearcoatNormalTexture&&(this.setClearcoatNormalTexture(r(t.clearcoatNormalTexture.getChild())),this.getClearcoatNormalTextureInfo().copy(r(t.clearcoatNormalTextureInfo.getChild()),r)),this},s.dispose=function(){this.clearcoatTextureInfo.getChild().dispose(),this.clearcoatRoughnessTextureInfo.getChild().dispose(),this.clearcoatNormalTextureInfo.getChild().dispose(),o.prototype.dispose.call(this)},s.getClearcoatFactor=function(){return this._clearcoatFactor},s.setClearcoatFactor=function(e){return this._clearcoatFactor=e,this},s.getClearcoatTexture=function(){return this.clearcoatTexture?this.clearcoatTexture.getChild():null},s.getClearcoatTextureInfo=function(){return this.clearcoatTexture?this.clearcoatTextureInfo.getChild():null},s.setClearcoatTexture=function(e){return this.clearcoatTexture=this.graph.link("clearcoatTexture",this,e),this},s.getClearcoatRoughnessFactor=function(){return this._clearcoatRoughnessFactor},s.setClearcoatRoughnessFactor=function(e){return this._clearcoatRoughnessFactor=e,this},s.getClearcoatRoughnessTexture=function(){return this.clearcoatRoughnessTexture?this.clearcoatRoughnessTexture.getChild():null},s.getClearcoatRoughnessTextureInfo=function(){return this.clearcoatRoughnessTexture?this.clearcoatRoughnessTextureInfo.getChild():null},s.setClearcoatRoughnessTexture=function(e){return this.clearcoatRoughnessTexture=this.graph.link("clearcoatRoughnessTexture",this,e),this},s.getClearcoatNormalScale=function(){return this._clearcoatNormalScale},s.setClearcoatNormalScale=function(e){return this._clearcoatNormalScale=e,this},s.getClearcoatNormalTexture=function(){return this.clearcoatNormalTexture?this.clearcoatNormalTexture.getChild():null},s.getClearcoatNormalTextureInfo=function(){return this.clearcoatNormalTexture?this.clearcoatNormalTextureInfo.getChild():null},s.setClearcoatNormalTexture=function(e){return this.clearcoatNormalTexture=this.graph.link("clearcoatNormalTexture",this,e),this},n}(e.ExtensionProperty);v.EXTENSION_NAME="KHR_materials_clearcoat",_([e.GraphChild],v.prototype,"clearcoatTexture",void 0),_([e.GraphChild],v.prototype,"clearcoatTextureInfo",void 0),_([e.GraphChild],v.prototype,"clearcoatRoughnessTexture",void 0),_([e.GraphChild],v.prototype,"clearcoatRoughnessTextureInfo",void 0),_([e.GraphChild],v.prototype,"clearcoatNormalTexture",void 0),_([e.GraphChild],v.prototype,"clearcoatNormalTextureInfo",void 0);var C="KHR_materials_clearcoat",I=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=C,t}t(r,e);var o=r.prototype;return o.createClearcoat=function(){return new v(this.doc.getGraph(),this)},o.read=function(e){var t=this,r=e.jsonDoc,o=r.json.textures||[];return(r.json.materials||[]).forEach(function(r,n){if(r.extensions&&r.extensions[C]){var s=t.createClearcoat();if(e.materials[n].setExtension(C,s),void 0!==r.extensions[C].clearcoatFactor&&s.setClearcoatFactor(r.extensions[C].clearcoatFactor),void 0!==r.extensions[C].clearcoatRoughnessFactor&&s.setClearcoatRoughnessFactor(r.extensions[C].clearcoatRoughnessFactor),void 0!==r.extensions[C].clearcoatTexture){var i=r.extensions[C].clearcoatTexture;s.setClearcoatTexture(e.textures[o[i.index].source]),e.setTextureInfo(s.getClearcoatTextureInfo(),i)}if(void 0!==r.extensions[C].clearcoatRoughnessTexture){var a=r.extensions[C].clearcoatRoughnessTexture;s.setClearcoatRoughnessTexture(e.textures[o[a.index].source]),e.setTextureInfo(s.getClearcoatRoughnessTextureInfo(),a)}if(void 0!==r.extensions[C].clearcoatNormalTexture){var u=r.extensions[C].clearcoatNormalTexture;s.setClearcoatNormalTexture(e.textures[o[u.index].source]),e.setTextureInfo(s.getClearcoatNormalTextureInfo(),u),void 0!==u.scale&&s.setClearcoatNormalScale(u.scale)}}}),this},o.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(C);if(o){var n=e.materialIndexMap.get(r),s=t.json.materials[n];if(s.extensions=s.extensions||{},s.extensions[C]={clearcoatFactor:o.getClearcoatFactor(),clearcoatRoughnessFactor:o.getClearcoatRoughnessFactor()},o.getClearcoatTexture()){var i=o.getClearcoatTexture(),a=o.getClearcoatTextureInfo();s.extensions[C].clearcoatTexture=e.createTextureInfoDef(i,a)}if(o.getClearcoatRoughnessTexture()){var u=o.getClearcoatRoughnessTexture(),c=o.getClearcoatRoughnessTextureInfo();s.extensions[C].clearcoatRoughnessTexture=e.createTextureInfoDef(u,c)}if(o.getClearcoatNormalTexture()){var l=o.getClearcoatNormalTexture(),h=o.getClearcoatNormalTextureInfo();s.extensions[C].clearcoatNormalTexture=e.createTextureInfoDef(l,h),1!==o.getClearcoatNormalScale()&&(s.extensions[C].clearcoatNormalTexture.scale=o.getClearcoatNormalScale())}}}),this},r}(e.Extension);I.EXTENSION_NAME=C;var m=function(r){function o(){var t;return(t=r.apply(this,arguments)||this).propertyType="IOR",t.parentTypes=[e.PropertyType.MATERIAL],t.extensionName="KHR_materials_ior",t._ior=0,t}t(o,r);var n=o.prototype;return n.copy=function(t,o){return void 0===o&&(o=e.COPY_IDENTITY),r.prototype.copy.call(this,t,o),this._ior=t._ior,this},n.getIOR=function(){return this._ior},n.setIOR=function(e){return this._ior=e,this},o}(e.ExtensionProperty);m.EXTENSION_NAME="KHR_materials_ior";var E="KHR_materials_ior",R=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=E,t}t(r,e);var o=r.prototype;return o.createIOR=function(){return new m(this.doc.getGraph(),this)},o.read=function(e){var t=this;return(e.jsonDoc.json.materials||[]).forEach(function(r,o){if(r.extensions&&r.extensions[E]){var n=t.createIOR();e.materials[o].setExtension(E,n),void 0!==r.extensions[E].ior&&n.setIOR(r.extensions[E].ior)}}),this},o.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(E);if(o){var n=e.materialIndexMap.get(r),s=t.json.materials[n];s.extensions=s.extensions||{},s.extensions[E]={ior:o.getIOR()}}}),this},r}(e.Extension);R.EXTENSION_NAME=E;var N=function(o){function n(){var t;return(t=o.apply(this,arguments)||this).propertyType="PBRSpecularGlossiness",t.parentTypes=[e.PropertyType.MATERIAL],t.extensionName="KHR_materials_pbrSpecularGlossiness",t._diffuseFactor=[1,1,1,1],t._specularFactor=[1,1,1],t._glossinessFactor=1,t.diffuseTexture=null,t.diffuseTextureInfo=t.graph.link("diffuseTextureInfo",r(t),new e.TextureInfo(t.graph)),t.specularGlossinessTexture=null,t.specularGlossinessTextureInfo=t.graph.link("specularGlossinessTextureInfo",r(t),new e.TextureInfo(t.graph)),t}t(n,o);var s=n.prototype;return s.copy=function(t,r){return void 0===r&&(r=e.COPY_IDENTITY),o.prototype.copy.call(this,t,r),this._diffuseFactor=t._diffuseFactor,this._specularFactor=t._specularFactor,this._glossinessFactor=t._glossinessFactor,t.diffuseTexture&&(this.setDiffuseTexture(r(t.diffuseTexture.getChild())),this.getDiffuseTextureInfo().copy(r(t.diffuseTextureInfo.getChild()),r)),t.specularGlossinessTexture&&(this.setSpecularGlossinessTexture(r(t.specularGlossinessTexture.getChild())),this.getSpecularGlossinessTextureInfo().copy(r(t.specularGlossinessTextureInfo.getChild()),r)),this},s.dispose=function(){this.diffuseTextureInfo.getChild().dispose(),this.specularGlossinessTextureInfo.getChild().dispose(),o.prototype.dispose.call(this)},s.getDiffuseFactor=function(){return this._diffuseFactor},s.setDiffuseFactor=function(e){return this._diffuseFactor=e,this},s.getDiffuseHex=function(){return e.ColorUtils.factorToHex(this._diffuseFactor)},s.setDiffuseHex=function(t){return e.ColorUtils.hexToFactor(t,this._diffuseFactor),this},s.getDiffuseTexture=function(){return this.diffuseTexture?this.diffuseTexture.getChild():null},s.getDiffuseTextureInfo=function(){return this.diffuseTexture?this.diffuseTextureInfo.getChild():null},s.setDiffuseTexture=function(e){return this.diffuseTexture=this.graph.link("diffuseTexture",this,e),this},s.getSpecularFactor=function(){return this._specularFactor},s.setSpecularFactor=function(e){return this._specularFactor=e,this},s.getGlossinessFactor=function(){return this._glossinessFactor},s.setGlossinessFactor=function(e){return this._glossinessFactor=e,this},s.getSpecularGlossinessTexture=function(){return this.specularGlossinessTexture?this.specularGlossinessTexture.getChild():null},s.getSpecularGlossinessTextureInfo=function(){return this.specularGlossinessTexture?this.specularGlossinessTextureInfo.getChild():null},s.setSpecularGlossinessTexture=function(e){return this.specularGlossinessTexture=this.graph.link("specularGlossinessTexture",this,e),this},n}(e.ExtensionProperty);N.EXTENSION_NAME="KHR_materials_pbrSpecularGlossiness",_([e.GraphChild],N.prototype,"diffuseTexture",void 0),_([e.GraphChild],N.prototype,"diffuseTextureInfo",void 0),_([e.GraphChild],N.prototype,"specularGlossinessTexture",void 0),_([e.GraphChild],N.prototype,"specularGlossinessTextureInfo",void 0);var F="KHR_materials_pbrSpecularGlossiness",S=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=F,t}t(r,e);var o=r.prototype;return o.createPBRSpecularGlossiness=function(){return new N(this.doc.getGraph(),this)},o.read=function(e){var t=this,r=e.jsonDoc,o=r.json.textures||[];return(r.json.materials||[]).forEach(function(r,n){if(r.extensions&&r.extensions[F]){var s=t.createPBRSpecularGlossiness();if(e.materials[n].setExtension(F,s),void 0!==r.extensions[F].diffuseFactor&&s.setDiffuseFactor(r.extensions[F].diffuseFactor),void 0!==r.extensions[F].specularFactor&&s.setSpecularFactor(r.extensions[F].specularFactor),void 0!==r.extensions[F].glossinessFactor&&s.setGlossinessFactor(r.extensions[F].glossinessFactor),void 0!==r.extensions[F].diffuseTexture){var i=r.extensions[F].diffuseTexture;s.setDiffuseTexture(e.textures[o[i.index].source]),e.setTextureInfo(s.getDiffuseTextureInfo(),i)}if(void 0!==r.extensions[F].specularGlossinessTexture){var a=r.extensions[F].specularGlossinessTexture;s.setSpecularGlossinessTexture(e.textures[o[a.index].source]),e.setTextureInfo(s.getSpecularGlossinessTextureInfo(),a)}}}),this},o.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(F);if(o){var n=e.materialIndexMap.get(r),s=t.json.materials[n];if(s.extensions=s.extensions||{},s.extensions[F]={diffuseFactor:o.getDiffuseFactor(),specularFactor:o.getSpecularFactor(),glossinessFactor:o.getGlossinessFactor()},o.getDiffuseTexture()){var i=o.getDiffuseTexture(),a=o.getDiffuseTextureInfo();s.extensions[F].diffuseTexture=e.createTextureInfoDef(i,a)}if(o.getSpecularGlossinessTexture()){var u=o.getSpecularGlossinessTexture(),c=o.getSpecularGlossinessTextureInfo();s.extensions[F].specularGlossinessTexture=e.createTextureInfoDef(u,c)}}}),this},r}(e.Extension);S.EXTENSION_NAME=F;var A=function(o){function n(){var t;return(t=o.apply(this,arguments)||this).propertyType="Sheen",t.parentTypes=[e.PropertyType.MATERIAL],t.extensionName="KHR_materials_sheen",t._sheenColorFactor=[0,0,0],t._sheenRoughnessFactor=0,t.sheenColorTexture=null,t.sheenColorTextureInfo=t.graph.link("sheenColorTextureInfo",r(t),new e.TextureInfo(t.graph)),t.sheenRoughnessTexture=null,t.sheenRoughnessTextureInfo=t.graph.link("sheenRoughnessTextureInfo",r(t),new e.TextureInfo(t.graph)),t}t(n,o);var s=n.prototype;return s.copy=function(t,r){return void 0===r&&(r=e.COPY_IDENTITY),o.prototype.copy.call(this,t,r),this._sheenColorFactor=t._sheenColorFactor,this._sheenRoughnessFactor=t._sheenRoughnessFactor,t.sheenColorTexture&&(this.setSheenColorTexture(r(t.sheenColorTexture.getChild())),this.getSheenColorTextureInfo().copy(r(t.sheenColorTextureInfo.getChild()),r)),t.sheenRoughnessTexture&&(this.setSheenRoughnessTexture(r(t.sheenRoughnessTexture.getChild())),this.getSheenRoughnessTextureInfo().copy(r(t.sheenRoughnessTextureInfo.getChild()),r)),this},s.dispose=function(){this.sheenColorTextureInfo.getChild().dispose(),this.sheenRoughnessTextureInfo.getChild().dispose(),o.prototype.dispose.call(this)},s.getSheenColorFactor=function(){return this._sheenColorFactor},s.getSheenColorHex=function(){return e.ColorUtils.factorToHex(this._sheenColorFactor)},s.setSheenColorFactor=function(e){return this._sheenColorFactor=e,this},s.setSheenColorHex=function(t){return e.ColorUtils.hexToFactor(t,this._sheenColorFactor),this},s.getSheenColorTexture=function(){return this.sheenColorTexture?this.sheenColorTexture.getChild():null},s.getSheenColorTextureInfo=function(){return this.sheenColorTexture?this.sheenColorTextureInfo.getChild():null},s.setSheenColorTexture=function(e){return this.sheenColorTexture=this.graph.link("sheenColorTexture",this,e),this},s.getSheenRoughnessFactor=function(){return this._sheenRoughnessFactor},s.setSheenRoughnessFactor=function(e){return this._sheenRoughnessFactor=e,this},s.getSheenRoughnessTexture=function(){return this.sheenRoughnessTexture?this.sheenRoughnessTexture.getChild():null},s.getSheenRoughnessTextureInfo=function(){return this.sheenRoughnessTexture?this.sheenRoughnessTextureInfo.getChild():null},s.setSheenRoughnessTexture=function(e){return this.sheenRoughnessTexture=this.graph.link("sheenRoughnessTexture",this,e),this},n}(e.ExtensionProperty);A.EXTENSION_NAME="KHR_materials_sheen",_([e.GraphChild],A.prototype,"sheenColorTexture",void 0),_([e.GraphChild],A.prototype,"sheenColorTextureInfo",void 0),_([e.GraphChild],A.prototype,"sheenRoughnessTexture",void 0),_([e.GraphChild],A.prototype,"sheenRoughnessTextureInfo",void 0);var G="KHR_materials_sheen",M=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=G,t}t(r,e);var o=r.prototype;return o.createSheen=function(){return new A(this.doc.getGraph(),this)},o.read=function(e){var t=this,r=e.jsonDoc,o=r.json.textures||[];return(r.json.materials||[]).forEach(function(r,n){if(r.extensions&&r.extensions[G]){var s=t.createSheen();if(e.materials[n].setExtension(G,s),void 0!==r.extensions[G].sheenColorFactor&&s.setSheenColorFactor(r.extensions[G].sheenColorFactor),void 0!==r.extensions[G].sheenRoughnessFactor&&s.setSheenRoughnessFactor(r.extensions[G].sheenRoughnessFactor),void 0!==r.extensions[G].sheenColorTexture){var i=r.extensions[G].sheenColorTexture;s.setSheenColorTexture(e.textures[o[i.index].source]),e.setTextureInfo(s.getSheenColorTextureInfo(),i)}if(void 0!==r.extensions[G].sheenRoughnessTexture){var a=r.extensions[G].sheenRoughnessTexture;s.setSheenRoughnessTexture(e.textures[o[a.index].source]),e.setTextureInfo(s.getSheenRoughnessTextureInfo(),a)}}}),this},o.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(G);if(o){var n=e.materialIndexMap.get(r),s=t.json.materials[n];if(s.extensions=s.extensions||{},s.extensions[G]={sheenColorFactor:o.getSheenColorFactor(),sheenRoughnessFactor:o.getSheenRoughnessFactor()},o.getSheenColorTexture()){var i=o.getSheenColorTexture(),a=o.getSheenColorTextureInfo();s.extensions[G].sheenColorTexture=e.createTextureInfoDef(i,a)}if(o.getSheenRoughnessTexture()){var u=o.getSheenRoughnessTexture(),c=o.getSheenRoughnessTextureInfo();s.extensions[G].sheenRoughnessTexture=e.createTextureInfoDef(u,c)}}}),this},r}(e.Extension);M.EXTENSION_NAME=G;var D=function(o){function n(){var t;return(t=o.apply(this,arguments)||this).propertyType="Specular",t.parentTypes=[e.PropertyType.MATERIAL],t.extensionName="KHR_materials_specular",t._specularFactor=1,t._specularColorFactor=[1,1,1],t.specularTexture=null,t.specularTextureInfo=t.graph.link("specularTextureInfo",r(t),new e.TextureInfo(t.graph)),t}t(n,o);var s=n.prototype;return s.copy=function(t,r){return void 0===r&&(r=e.COPY_IDENTITY),o.prototype.copy.call(this,t,r),this._specularFactor=t._specularFactor,t.specularTexture&&(this.setSpecularTexture(r(t.specularTexture.getChild())),this.getSpecularTextureInfo().copy(r(t.specularTextureInfo.getChild()),r)),this},s.dispose=function(){this.specularTextureInfo.getChild().dispose(),o.prototype.dispose.call(this)},s.getSpecularFactor=function(){return this._specularFactor},s.setSpecularFactor=function(e){return this._specularFactor=e,this},s.getSpecularColorFactor=function(){return this._specularColorFactor},s.setSpecularColorFactor=function(e){return this._specularColorFactor=e,this},s.getSpecularColorHex=function(){return e.ColorUtils.factorToHex(this._specularColorFactor)},s.setSpecularColorHex=function(t){return e.ColorUtils.hexToFactor(t,this._specularColorFactor),this},s.getSpecularTexture=function(){return this.specularTexture?this.specularTexture.getChild():null},s.getSpecularTextureInfo=function(){return this.specularTexture?this.specularTextureInfo.getChild():null},s.setSpecularTexture=function(e){return this.specularTexture=this.graph.link("specularTexture",this,e),this},n}(e.ExtensionProperty);D.EXTENSION_NAME="KHR_materials_specular",_([e.GraphChild],D.prototype,"specularTexture",void 0),_([e.GraphChild],D.prototype,"specularTextureInfo",void 0);var O="KHR_materials_specular",j=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=O,t}t(r,e);var o=r.prototype;return o.createSpecular=function(){return new D(this.doc.getGraph(),this)},o.read=function(e){var t=this,r=e.jsonDoc,o=r.json.textures||[];return(r.json.materials||[]).forEach(function(r,n){if(r.extensions&&r.extensions[O]){var s=t.createSpecular();if(e.materials[n].setExtension(O,s),void 0!==r.extensions[O].specularFactor&&s.setSpecularFactor(r.extensions[O].specularFactor),void 0!==r.extensions[O].specularColorFactor&&s.setSpecularColorFactor(r.extensions[O].specularColorFactor),void 0!==r.extensions[O].specularTexture){var i=r.extensions[O].specularTexture;s.setSpecularTexture(e.textures[o[i.index].source]),e.setTextureInfo(s.getSpecularTextureInfo(),i)}}}),this},o.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(O);if(o){var n=e.materialIndexMap.get(r),s=t.json.materials[n];if(s.extensions=s.extensions||{},s.extensions[O]={specularFactor:o.getSpecularFactor(),specularColorFactor:o.getSpecularColorFactor()},o.getSpecularTexture()){var i=o.getSpecularTexture(),a=o.getSpecularTextureInfo();s.extensions[O].specularTexture=e.createTextureInfoDef(i,a)}}}),this},r}(e.Extension);j.EXTENSION_NAME=O;var w=function(o){function n(){var t;return(t=o.apply(this,arguments)||this).propertyType="Transmission",t.parentTypes=[e.PropertyType.MATERIAL],t.extensionName="KHR_materials_transmission",t._transmissionFactor=0,t.transmissionTexture=null,t.transmissionTextureInfo=t.graph.link("transmissionTextureInfo",r(t),new e.TextureInfo(t.graph)),t}t(n,o);var s=n.prototype;return s.copy=function(t,r){return void 0===r&&(r=e.COPY_IDENTITY),o.prototype.copy.call(this,t,r),this._transmissionFactor=t._transmissionFactor,t.transmissionTexture&&(this.setTransmissionTexture(r(t.transmissionTexture.getChild())),this.getTransmissionTextureInfo().copy(r(t.transmissionTextureInfo.getChild()),r)),this},s.dispose=function(){this.transmissionTextureInfo.getChild().dispose(),o.prototype.dispose.call(this)},s.getTransmissionFactor=function(){return this._transmissionFactor},s.setTransmissionFactor=function(e){return this._transmissionFactor=e,this},s.getTransmissionTexture=function(){return this.transmissionTexture?this.transmissionTexture.getChild():null},s.getTransmissionTextureInfo=function(){return this.transmissionTexture?this.transmissionTextureInfo.getChild():null},s.setTransmissionTexture=function(e){return this.transmissionTexture=this.graph.link("transmissionTexture",this,e),this},n}(e.ExtensionProperty);w.EXTENSION_NAME="KHR_materials_transmission",_([e.GraphChild],w.prototype,"transmissionTexture",void 0),_([e.GraphChild],w.prototype,"transmissionTextureInfo",void 0);var P="KHR_materials_transmission",H=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=P,t}t(r,e);var o=r.prototype;return o.createTransmission=function(){return new w(this.doc.getGraph(),this)},o.read=function(e){var t=this,r=e.jsonDoc,o=r.json.textures||[];return(r.json.materials||[]).forEach(function(r,n){if(r.extensions&&r.extensions[P]){var s=t.createTransmission();if(e.materials[n].setExtension(P,s),void 0!==r.extensions[P].transmissionFactor&&s.setTransmissionFactor(r.extensions[P].transmissionFactor),void 0!==r.extensions[P].transmissionTexture){var i=r.extensions[P].transmissionTexture;s.setTransmissionTexture(e.textures[o[i.index].source]),e.setTextureInfo(s.getTransmissionTextureInfo(),i)}}}),this},o.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){var o=r.getExtension(P);if(o){var n=e.materialIndexMap.get(r),s=t.json.materials[n];if(s.extensions=s.extensions||{},s.extensions[P]={transmissionFactor:o.getTransmissionFactor()},o.getTransmissionTexture()){var i=o.getTransmissionTexture(),a=o.getTransmissionTextureInfo();s.extensions[P].transmissionTexture=e.createTextureInfoDef(i,a)}}}),this},r}(e.Extension);H.EXTENSION_NAME=P;var b=function(r){function o(){var t;return(t=r.apply(this,arguments)||this).propertyType="Unlit",t.parentTypes=[e.PropertyType.MATERIAL],t.extensionName="KHR_materials_unlit",t}return t(o,r),o}(e.ExtensionProperty);b.EXTENSION_NAME="KHR_materials_unlit";var K="KHR_materials_unlit",U=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=K,t}t(r,e);var o=r.prototype;return o.createUnlit=function(){return new b(this.doc.getGraph(),this)},o.read=function(e){var t=this;return(e.jsonDoc.json.materials||[]).forEach(function(r,o){r.extensions&&r.extensions[K]&&e.materials[o].setExtension(K,t.createUnlit())}),this},o.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(function(r){if(r.getExtension(K)){var o=e.materialIndexMap.get(r),n=t.json.materials[o];n.extensions=n.extensions||{},n.extensions[K]={}}}),this},r}(e.Extension);U.EXTENSION_NAME=K;var L="KHR_mesh_quantization",X=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=L,t}t(r,e);var o=r.prototype;return o.read=function(e){return this},o.write=function(e){return this},r}(e.Extension);X.EXTENSION_NAME=L;var k="KHR_texture_basisu",Y=function(r){function o(){var t;return(t=r.apply(this,arguments)||this).extensionName=k,t.provideTypes=[e.PropertyType.TEXTURE],t}t(o,r);var n=o.prototype;return n.provide=function(e){return e.jsonDoc.json.textures.forEach(function(e){e.extensions&&e.extensions[k]&&(e.source=e.extensions[k].source)}),this},n.read=function(e){return this},n.write=function(e){var t=e.jsonDoc;return this.doc.getRoot().listTextures().forEach(function(r){if("image/ktx2"===r.getMimeType()){var o=e.imageIndexMap.get(r);t.json.textures.forEach(function(e){e.source===o&&(e.extensions=e.extensions||{},e.extensions[k]={source:e.source},delete e.source)})}}),this},o}(e.Extension);Y.EXTENSION_NAME=k;var B=function(r){function o(){var t;return(t=r.apply(this,arguments)||this).propertyType="Transform",t.parentTypes=[e.PropertyType.TEXTURE_INFO],t.extensionName="KHR_texture_transform",t._offset=[0,0],t._rotation=0,t._scale=[1,1],t._texCoord=void 0,t}t(o,r);var n=o.prototype;return n.copy=function(t,o){return void 0===o&&(o=e.COPY_IDENTITY),r.prototype.copy.call(this,t,o),this._offset=t._offset,this._rotation=t._rotation,this._scale=t._scale,this._texCoord=t._texCoord,this},n.getOffset=function(){return this._offset},n.setOffset=function(e){return this._offset=e,this},n.getRotation=function(){return this._rotation},n.setRotation=function(e){return this._rotation=e,this},n.getScale=function(){return this._scale},n.setScale=function(e){return this._scale=e,this},n.getTexCoord=function(){return this._texCoord},n.setTexCoord=function(e){return this._texCoord=e,this},o}(e.ExtensionProperty);B.EXTENSION_NAME="KHR_texture_transform";var V="KHR_texture_transform",q=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).extensionName=V,t}t(r,e);var o=r.prototype;return o.createTransform=function(){return new B(this.doc.getGraph(),this)},o.read=function(e){for(var t=0,r=Array.from(e.textureInfos.entries());t<r.length;t++){var o=r[t],n=o[0],s=o[1];if(s.extensions&&s.extensions[V]){var i=this.createTransform(),a=s.extensions[V];void 0!==a.offset&&i.setOffset(a.offset),void 0!==a.rotation&&i.setRotation(a.rotation),void 0!==a.scale&&i.setScale(a.scale),void 0!==a.texCoord&&i.setTexCoord(a.texCoord),n.setExtension(V,i)}}return this},o.write=function(e){for(var t=0,r=Array.from(e.textureInfoDefMap.entries());t<r.length;t++){var o=r[t],n=o[1],s=o[0].getExtension(V);s&&(n.extensions=n.extensions||{},n.extensions[V]={offset:s.getOffset(),rotation:s.getRotation(),scale:s.getScale(),texCoord:s.getTexCoord()})}return this},r}(e.Extension);q.EXTENSION_NAME=V;var z=[T,y,I,R,S,j,M,H,U,X,Y,q],W=[c].concat(z);exports.ALL_EXTENSIONS=W,exports.Clearcoat=v,exports.DracoMeshCompression=T,exports.IOR=m,exports.KHRONOS_EXTENSIONS=z,exports.Light=g,exports.LightsPunctual=y,exports.MaterialsClearcoat=I,exports.MaterialsIOR=R,exports.MaterialsPBRSpecularGlossiness=S,exports.MaterialsSheen=M,exports.MaterialsSpecular=j,exports.MaterialsTransmission=H,exports.MaterialsUnlit=U,exports.MeshQuantization=X,exports.PBRSpecularGlossiness=N,exports.Sheen=A,exports.Specular=D,exports.TextureBasisu=Y,exports.TextureTransform=q,exports.TextureWebP=c,exports.Transform=B,exports.Transmission=w,exports.Unlit=b; | ||
//# sourceMappingURL=extensions.js.map |
@@ -1,2 +0,2 @@ | ||
import{Extension as e,PropertyType as t,GLB_BUFFER as s,ExtensionProperty as r,COPY_IDENTITY as o,ColorUtils as n,TextureInfo as i,GraphChild as a}from"@gltf-transform/core";let c,u,l;function h(e,t){let s;try{if(s=new c.DecoderBuffer,s.Init(new Int8Array(t),t.byteLength),e.GetEncodedGeometryType(s)!==c.TRIANGULAR_MESH)throw new Error("Unknown geometry type.");const r=new c.Mesh;if(!e.DecodeBufferToMesh(s,r).ok()||0===r.ptr)throw new Error("Decoding failure.");return r}finally{c.destroy(s)}}function x(e,t){const s=3*t.num_faces(),r=s*Uint32Array.BYTES_PER_ELEMENT,o=c._malloc(r);e.GetTrianglesUInt32Array(t,r,o);const n=new Uint32Array(c.HEAP32.buffer,o,s).slice();return c._free(o),n}function p(e,t,s,r){const o=l[r.componentType],n=u[r.componentType],i=s.num_components(),a=t.num_points()*i,h=a*n.BYTES_PER_ELEMENT,x=c._malloc(h);e.GetAttributeDataArrayForAllPoints(t,s,o,h,x);const p=new n(c.HEAPF32.buffer,x,a).slice();return c._free(x),p}const f="KHR_draco_mesh_compression";class T extends e{constructor(){super(...arguments),this.extensionName=f,this.provideTypes=[t.PRIMITIVE],this.dependencies=["draco3d.decoder"]}install(e,t){return"draco3d.decoder"===e&&(this._decoderModule=t,c=this._decoderModule,u={5126:Float32Array,5125:Uint32Array,5123:Uint16Array,5121:Uint8Array,5122:Int16Array,5120:Int8Array},l={5126:c.DT_FLOAT32,5125:c.DT_UINT32,5123:c.DT_UINT16,5121:c.DT_UINT8,5122:c.DT_INT16,5120:c.DT_INT8}),this}provide(e){if(!this._decoderModule)throw new Error('Please install extension dependency, "draco3d.decoder".');const t=this.doc.getLogger(),r=e.jsonDoc,o=new this._decoderModule.Decoder,n=new Map;for(const i of r.json.meshes){for(const a of i.primitives){if(!a.extensions||!a.extensions[f])continue;const i=a.extensions[f];let c=n.get(i.bufferView);if(!c){const e=r.json.bufferViews[i.bufferView],a=r.json.buffers[e.buffer],u=new Uint8Array(a.uri?r.resources[a.uri]:r.resources[s],e.byteOffset||0,e.byteLength);c=h(o,u),n.set(i.bufferView,c),t.debug(`Decompressed ${u.byteLength} bytes.`)}for(const t in a.attributes){const s=e.jsonDoc.json.accessors[a.attributes[t]],r=o.GetAttributeByUniqueId(c,i.attributes[t]),n=p(o,c,r,s);e.accessors[a.attributes[t]].setArray(n)}const u=x(o,c);e.accessors[a.indices].setArray(u)}this._decoderModule.destroy(o);for(const e of Array.from(n.values()))this._decoderModule.destroy(e)}return this}read(e){return this.dispose(),this}write(e){return this.doc.getLogger().warn(`Writing ${this.extensionName} not yet implemented.`),this}}var g;T.EXTENSION_NAME=f,function(e){e.POINT="point",e.SPOT="spot",e.DIRECTIONAL="directional"}(g||(g={}));class d extends r{constructor(){super(...arguments),this.propertyType="Light",this.parentTypes=[t.NODE],this.extensionName="KHR_lights_punctual",this._color=[1,1,1],this._intensity=1,this._range=void 0,this._innerConeAngle=0,this._outerConeAngle=Math.PI/4}copy(e,t=o){return super.copy(e,t),this._color=[...e._color],this._intensity=e._intensity,this._type=e._type,this._range=e._range,this._innerConeAngle=e._innerConeAngle,this._outerConeAngle=e._outerConeAngle,this}getColor(){return this._color}setColor(e){return this._color=e,this}getColorHex(){return n.factorToHex(this._color)}setColorHex(e){return n.hexToFactor(e,this._color),this}getIntensity(){return this._intensity}setIntensity(e){return this._intensity=e,this}getType(){return this._type}setType(e){return this._type=e,this}getRange(){return this._range}setRange(e){return this._range=e,this}getInnerConeAngle(){return this._innerConeAngle}setInnerConeAngle(e){return this._innerConeAngle=e,this}getOuterConeAngle(){return this._outerConeAngle}setOuterConeAngle(e){return this._outerConeAngle=e,this}}d.EXTENSION_NAME="KHR_lights_punctual";const _="KHR_lights_punctual";class m extends e{constructor(){super(...arguments),this.extensionName=_}createLight(){return new d(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc;if(!t.json.extensions||!t.json.extensions[_])return this;const s=(t.json.extensions[_].lights||[]).map(e=>{const t=this.createLight().setName(e.name||"").setType(e.type);return void 0!==e.color&&t.setColor(e.color),void 0!==e.intensity&&t.setIntensity(e.intensity),void 0!==e.range&&t.setRange(e.range),void 0!==e.innerConeAngle&&t.setInnerConeAngle(e.innerConeAngle),void 0!==e.outerConeAngle&&t.setOuterConeAngle(e.outerConeAngle),t});return t.json.nodes.forEach((t,r)=>{t.extensions&&t.extensions[_]&&e.nodes[r].setExtension(_,s[t.extensions[_].light])}),this}write(e){const t=e.jsonDoc;if(0===this.properties.size)return this;const s=[],r=new Map;for(const e of this.properties){const t=e,o={type:t.getType(),color:t.getColor(),intensity:t.getIntensity(),range:t.getRange()};t.getName()&&(o.name=t.getName()),t.getType()===g.SPOT&&(o.innerConeAngle=t.getInnerConeAngle(),o.outerConeAngle=t.getOuterConeAngle()),s.push(o),r.set(t,s.length-1)}return this.doc.getRoot().listNodes().forEach(s=>{const o=s.getExtension(_);if(o){const n=e.nodeIndexMap.get(s),i=t.json.nodes[n];i.extensions=i.extensions||{},i.extensions[_]={light:r.get(o)}}}),t.json.extensions=t.json.extensions||{},t.json.extensions[_]={lights:s},this}}function I(e,t,s,r){var o,n=arguments.length,i=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,s,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(n<3?o(i):n>3?o(t,s,i):o(t,s))||i);return n>3&&i&&Object.defineProperty(t,s,i),i}m.EXTENSION_NAME=_;class C extends r{constructor(){super(...arguments),this.propertyType="Clearcoat",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_clearcoat",this._clearcoatFactor=0,this._clearcoatRoughnessFactor=0,this._clearcoatNormalScale=1,this.clearcoatTexture=null,this.clearcoatTextureInfo=this.graph.link("clearcoatTextureInfo",this,new i(this.graph)),this.clearcoatRoughnessTexture=null,this.clearcoatRoughnessTextureInfo=this.graph.link("clearcoatRoughnessTextureInfo",this,new i(this.graph)),this.clearcoatNormalTexture=null,this.clearcoatNormalTextureInfo=this.graph.link("clearcoatNormalTextureInfo",this,new i(this.graph))}copy(e,t=o){return super.copy(e,t),this._clearcoatFactor=e._clearcoatFactor,this._clearcoatRoughnessFactor=e._clearcoatRoughnessFactor,this._clearcoatNormalScale=e._clearcoatNormalScale,e.clearcoatTexture&&(this.setClearcoatTexture(t(e.clearcoatTexture.getChild())),this.getClearcoatTextureInfo().copy(t(e.clearcoatTextureInfo.getChild()),t)),e.clearcoatRoughnessTexture&&(this.setClearcoatRoughnessTexture(t(e.clearcoatRoughnessTexture.getChild())),this.getClearcoatRoughnessTextureInfo().copy(t(e.clearcoatRoughnessTextureInfo.getChild()),t)),e.clearcoatNormalTexture&&(this.setClearcoatNormalTexture(t(e.clearcoatNormalTexture.getChild())),this.getClearcoatNormalTextureInfo().copy(t(e.clearcoatNormalTextureInfo.getChild()),t)),this}dispose(){this.clearcoatTextureInfo.getChild().dispose(),this.clearcoatRoughnessTextureInfo.getChild().dispose(),this.clearcoatNormalTextureInfo.getChild().dispose(),super.dispose()}getClearcoatFactor(){return this._clearcoatFactor}setClearcoatFactor(e){return this._clearcoatFactor=e,this}getClearcoatTexture(){return this.clearcoatTexture?this.clearcoatTexture.getChild():null}getClearcoatTextureInfo(){return this.clearcoatTexture?this.clearcoatTextureInfo.getChild():null}setClearcoatTexture(e){return this.clearcoatTexture=this.graph.link("clearcoatTexture",this,e),this}getClearcoatRoughnessFactor(){return this._clearcoatRoughnessFactor}setClearcoatRoughnessFactor(e){return this._clearcoatRoughnessFactor=e,this}getClearcoatRoughnessTexture(){return this.clearcoatRoughnessTexture?this.clearcoatRoughnessTexture.getChild():null}getClearcoatRoughnessTextureInfo(){return this.clearcoatRoughnessTexture?this.clearcoatRoughnessTextureInfo.getChild():null}setClearcoatRoughnessTexture(e){return this.clearcoatRoughnessTexture=this.graph.link("clearcoatRoughnessTexture",this,e),this}getClearcoatNormalScale(){return this._clearcoatNormalScale}setClearcoatNormalScale(e){return this._clearcoatNormalScale=e,this}getClearcoatNormalTexture(){return this.clearcoatNormalTexture?this.clearcoatNormalTexture.getChild():null}getClearcoatNormalTextureInfo(){return this.clearcoatNormalTexture?this.clearcoatNormalTextureInfo.getChild():null}setClearcoatNormalTexture(e){return this.clearcoatNormalTexture=this.graph.link("clearcoatNormalTexture",this,e),this}}C.EXTENSION_NAME="KHR_materials_clearcoat",I([a],C.prototype,"clearcoatTexture",void 0),I([a],C.prototype,"clearcoatTextureInfo",void 0),I([a],C.prototype,"clearcoatRoughnessTexture",void 0),I([a],C.prototype,"clearcoatRoughnessTextureInfo",void 0),I([a],C.prototype,"clearcoatNormalTexture",void 0),I([a],C.prototype,"clearcoatNormalTextureInfo",void 0);const N="KHR_materials_clearcoat";class y extends e{constructor(){super(...arguments),this.extensionName=N}createClearcoat(){return new C(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc,s=t.json.textures||[];return(t.json.materials||[]).forEach((t,r)=>{if(t.extensions&&t.extensions[N]){const o=this.createClearcoat();if(e.materials[r].setExtension(N,o),void 0!==t.extensions[N].clearcoatFactor&&o.setClearcoatFactor(t.extensions[N].clearcoatFactor),void 0!==t.extensions[N].clearcoatRoughnessFactor&&o.setClearcoatRoughnessFactor(t.extensions[N].clearcoatRoughnessFactor),void 0!==t.extensions[N].clearcoatTexture){const r=t.extensions[N].clearcoatTexture;o.setClearcoatTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getClearcoatTextureInfo(),r)}if(void 0!==t.extensions[N].clearcoatRoughnessTexture){const r=t.extensions[N].clearcoatRoughnessTexture;o.setClearcoatRoughnessTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getClearcoatRoughnessTextureInfo(),r)}if(void 0!==t.extensions[N].clearcoatNormalTexture){const r=t.extensions[N].clearcoatNormalTexture;o.setClearcoatNormalTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getClearcoatNormalTextureInfo(),r),void 0!==r.scale&&o.setClearcoatNormalScale(r.scale)}}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(N);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];if(n.extensions=n.extensions||{},n.extensions[N]={clearcoatFactor:r.getClearcoatFactor(),clearcoatRoughnessFactor:r.getClearcoatRoughnessFactor()},r.getClearcoatTexture()){const t=r.getClearcoatTexture(),s=r.getClearcoatTextureInfo();n.extensions[N].clearcoatTexture=e.createTextureInfoDef(t,s)}if(r.getClearcoatRoughnessTexture()){const t=r.getClearcoatRoughnessTexture(),s=r.getClearcoatRoughnessTextureInfo();n.extensions[N].clearcoatRoughnessTexture=e.createTextureInfoDef(t,s)}if(r.getClearcoatNormalTexture()){const t=r.getClearcoatNormalTexture(),s=r.getClearcoatNormalTextureInfo();n.extensions[N].clearcoatNormalTexture=e.createTextureInfoDef(t,s),1!==r.getClearcoatNormalScale()&&(n.extensions[N].clearcoatNormalTexture.scale=r.getClearcoatNormalScale())}}}),this}}y.EXTENSION_NAME=N;class E extends r{constructor(){super(...arguments),this.propertyType="IOR",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_ior",this._ior=0}copy(e,t=o){return super.copy(e,t),this._ior=e._ior,this}getIOR(){return this._ior}setIOR(e){return this._ior=e,this}}E.EXTENSION_NAME="KHR_materials_ior";const R="KHR_materials_ior";class F extends e{constructor(){super(...arguments),this.extensionName=R}createIOR(){return new E(this.doc.getGraph(),this)}read(e){return(e.jsonDoc.json.materials||[]).forEach((t,s)=>{if(t.extensions&&t.extensions[R]){const r=this.createIOR();e.materials[s].setExtension(R,r),void 0!==t.extensions[R].ior&&r.setIOR(t.extensions[R].ior)}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(R);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];n.extensions=n.extensions||{},n.extensions[R]={ior:r.getIOR()}}}),this}}F.EXTENSION_NAME=R;class A extends r{constructor(){super(...arguments),this.propertyType="PBRSpecularGlossiness",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_pbrSpecularGlossiness",this._diffuseFactor=[1,1,1,1],this._specularFactor=[1,1,1],this._glossinessFactor=1,this.diffuseTexture=null,this.diffuseTextureInfo=this.graph.link("diffuseTextureInfo",this,new i(this.graph)),this.specularGlossinessTexture=null,this.specularGlossinessTextureInfo=this.graph.link("specularGlossinessTextureInfo",this,new i(this.graph))}copy(e,t=o){return super.copy(e,t),this._diffuseFactor=e._diffuseFactor,this._specularFactor=e._specularFactor,this._glossinessFactor=e._glossinessFactor,e.diffuseTexture&&(this.setDiffuseTexture(t(e.diffuseTexture.getChild())),this.getDiffuseTextureInfo().copy(t(e.diffuseTextureInfo.getChild()),t)),e.specularGlossinessTexture&&(this.setSpecularGlossinessTexture(t(e.specularGlossinessTexture.getChild())),this.getSpecularGlossinessTextureInfo().copy(t(e.specularGlossinessTextureInfo.getChild()),t)),this}dispose(){this.diffuseTextureInfo.getChild().dispose(),this.specularGlossinessTextureInfo.getChild().dispose(),super.dispose()}getDiffuseFactor(){return this._diffuseFactor}setDiffuseFactor(e){return this._diffuseFactor=e,this}getDiffuseHex(){return n.factorToHex(this._diffuseFactor)}setDiffuseHex(e){return n.hexToFactor(e,this._diffuseFactor),this}getDiffuseTexture(){return this.diffuseTexture?this.diffuseTexture.getChild():null}getDiffuseTextureInfo(){return this.diffuseTexture?this.diffuseTextureInfo.getChild():null}setDiffuseTexture(e){return this.diffuseTexture=this.graph.link("diffuseTexture",this,e),this}getSpecularFactor(){return this._specularFactor}setSpecularFactor(e){return this._specularFactor=e,this}getGlossinessFactor(){return this._glossinessFactor}setGlossinessFactor(e){return this._glossinessFactor=e,this}getSpecularGlossinessTexture(){return this.specularGlossinessTexture?this.specularGlossinessTexture.getChild():null}getSpecularGlossinessTextureInfo(){return this.specularGlossinessTexture?this.specularGlossinessTextureInfo.getChild():null}setSpecularGlossinessTexture(e){return this.specularGlossinessTexture=this.graph.link("specularGlossinessTexture",this,e),this}}A.EXTENSION_NAME="KHR_materials_pbrSpecularGlossiness",I([a],A.prototype,"diffuseTexture",void 0),I([a],A.prototype,"diffuseTextureInfo",void 0),I([a],A.prototype,"specularGlossinessTexture",void 0),I([a],A.prototype,"specularGlossinessTextureInfo",void 0);const S="KHR_materials_pbrSpecularGlossiness";class D extends e{constructor(){super(...arguments),this.extensionName=S}createPBRSpecularGlossiness(){return new A(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc,s=t.json.textures||[];return(t.json.materials||[]).forEach((t,r)=>{if(t.extensions&&t.extensions[S]){const o=this.createPBRSpecularGlossiness();if(e.materials[r].setExtension(S,o),void 0!==t.extensions[S].diffuseFactor&&o.setDiffuseFactor(t.extensions[S].diffuseFactor),void 0!==t.extensions[S].specularFactor&&o.setSpecularFactor(t.extensions[S].specularFactor),void 0!==t.extensions[S].glossinessFactor&&o.setGlossinessFactor(t.extensions[S].glossinessFactor),void 0!==t.extensions[S].diffuseTexture){const r=t.extensions[S].diffuseTexture;o.setDiffuseTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getDiffuseTextureInfo(),r)}if(void 0!==t.extensions[S].specularGlossinessTexture){const r=t.extensions[S].specularGlossinessTexture;o.setSpecularGlossinessTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getSpecularGlossinessTextureInfo(),r)}}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(S);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];if(n.extensions=n.extensions||{},n.extensions[S]={diffuseFactor:r.getDiffuseFactor(),specularFactor:r.getSpecularFactor(),glossinessFactor:r.getGlossinessFactor()},r.getDiffuseTexture()){const t=r.getDiffuseTexture(),s=r.getDiffuseTextureInfo();n.extensions[S].diffuseTexture=e.createTextureInfoDef(t,s)}if(r.getSpecularGlossinessTexture()){const t=r.getSpecularGlossinessTexture(),s=r.getSpecularGlossinessTextureInfo();n.extensions[S].specularGlossinessTexture=e.createTextureInfoDef(t,s)}}}),this}}D.EXTENSION_NAME=S;class M extends r{constructor(){super(...arguments),this.propertyType="Specular",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_specular",this._specularFactor=1,this._specularColorFactor=[1,1,1],this.specularTexture=null,this.specularTextureInfo=this.graph.link("specularTextureInfo",this,new i(this.graph))}copy(e,t=o){return super.copy(e,t),this._specularFactor=e._specularFactor,e.specularTexture&&(this.setSpecularTexture(t(e.specularTexture.getChild())),this.getSpecularTextureInfo().copy(t(e.specularTextureInfo.getChild()),t)),this}dispose(){this.specularTextureInfo.getChild().dispose(),super.dispose()}getSpecularFactor(){return this._specularFactor}setSpecularFactor(e){return this._specularFactor=e,this}getSpecularColorFactor(){return this._specularColorFactor}setSpecularColorFactor(e){return this._specularColorFactor=e,this}getSpecularColorHex(){return n.factorToHex(this._specularColorFactor)}setSpecularColorHex(e){return n.hexToFactor(e,this._specularColorFactor),this}getSpecularTexture(){return this.specularTexture?this.specularTexture.getChild():null}getSpecularTextureInfo(){return this.specularTexture?this.specularTextureInfo.getChild():null}setSpecularTexture(e){return this.specularTexture=this.graph.link("specularTexture",this,e),this}}M.EXTENSION_NAME="KHR_materials_specular",I([a],M.prototype,"specularTexture",void 0),I([a],M.prototype,"specularTextureInfo",void 0);const G="KHR_materials_specular";class j extends e{constructor(){super(...arguments),this.extensionName=G}createSpecular(){return new M(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc,s=t.json.textures||[];return(t.json.materials||[]).forEach((t,r)=>{if(t.extensions&&t.extensions[G]){const o=this.createSpecular();if(e.materials[r].setExtension(G,o),void 0!==t.extensions[G].specularFactor&&o.setSpecularFactor(t.extensions[G].specularFactor),void 0!==t.extensions[G].specularColorFactor&&o.setSpecularColorFactor(t.extensions[G].specularColorFactor),void 0!==t.extensions[G].specularTexture){const r=t.extensions[G].specularTexture;o.setSpecularTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getSpecularTextureInfo(),r)}}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(G);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];if(n.extensions=n.extensions||{},n.extensions[G]={specularFactor:r.getSpecularFactor(),specularColorFactor:r.getSpecularColorFactor()},r.getSpecularTexture()){const t=r.getSpecularTexture(),s=r.getSpecularTextureInfo();n.extensions[G].specularTexture=e.createTextureInfoDef(t,s)}}}),this}}j.EXTENSION_NAME=G;class v extends r{constructor(){super(...arguments),this.propertyType="Transmission",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_transmission",this._transmissionFactor=0,this.transmissionTexture=null,this.transmissionTextureInfo=this.graph.link("transmissionTextureInfo",this,new i(this.graph))}copy(e,t=o){return super.copy(e,t),this._transmissionFactor=e._transmissionFactor,e.transmissionTexture&&(this.setTransmissionTexture(t(e.transmissionTexture.getChild())),this.getTransmissionTextureInfo().copy(t(e.transmissionTextureInfo.getChild()),t)),this}dispose(){this.transmissionTextureInfo.getChild().dispose(),super.dispose()}getTransmissionFactor(){return this._transmissionFactor}setTransmissionFactor(e){return this._transmissionFactor=e,this}getTransmissionTexture(){return this.transmissionTexture?this.transmissionTexture.getChild():null}getTransmissionTextureInfo(){return this.transmissionTexture?this.transmissionTextureInfo.getChild():null}setTransmissionTexture(e){return this.transmissionTexture=this.graph.link("transmissionTexture",this,e),this}}v.EXTENSION_NAME="KHR_materials_transmission",I([a],v.prototype,"transmissionTexture",void 0),I([a],v.prototype,"transmissionTextureInfo",void 0);const w="KHR_materials_transmission";class O extends e{constructor(){super(...arguments),this.extensionName=w}createTransmission(){return new v(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc,s=t.json.textures||[];return(t.json.materials||[]).forEach((t,r)=>{if(t.extensions&&t.extensions[w]){const o=this.createTransmission();if(e.materials[r].setExtension(w,o),void 0!==t.extensions[w].transmissionFactor&&o.setTransmissionFactor(t.extensions[w].transmissionFactor),void 0!==t.extensions[w].transmissionTexture){const r=t.extensions[w].transmissionTexture;o.setTransmissionTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getTransmissionTextureInfo(),r)}}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(w);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];if(n.extensions=n.extensions||{},n.extensions[w]={transmissionFactor:r.getTransmissionFactor()},r.getTransmissionTexture()){const t=r.getTransmissionTexture(),s=r.getTransmissionTextureInfo();n.extensions[w].transmissionTexture=e.createTextureInfoDef(t,s)}}}),this}}O.EXTENSION_NAME=w;class H extends r{constructor(){super(...arguments),this.propertyType="Unlit",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_unlit"}}H.EXTENSION_NAME="KHR_materials_unlit";const b="KHR_materials_unlit";class K extends e{constructor(){super(...arguments),this.extensionName=b}createUnlit(){return new H(this.doc.getGraph(),this)}read(e){return(e.jsonDoc.json.materials||[]).forEach((t,s)=>{t.extensions&&t.extensions[b]&&e.materials[s].setExtension(b,this.createUnlit())}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{if(s.getExtension(b)){const r=e.materialIndexMap.get(s),o=t.json.materials[r];o.extensions=o.extensions||{},o.extensions[b]={}}}),this}}K.EXTENSION_NAME=b;const X="KHR_mesh_quantization";class L extends e{constructor(){super(...arguments),this.extensionName=X}read(e){return this}write(e){return this}}L.EXTENSION_NAME=X;const U="KHR_texture_basisu";class k extends e{constructor(){super(...arguments),this.extensionName=U,this.provideTypes=[t.TEXTURE]}provide(e){return e.jsonDoc.json.textures.forEach(e=>{e.extensions&&e.extensions[U]&&(e.source=e.extensions[U].source)}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listTextures().forEach(s=>{if("image/ktx2"===s.getMimeType()){const r=e.imageIndexMap.get(s);t.json.textures.forEach(e=>{e.source===r&&(e.extensions=e.extensions||{},e.extensions[U]={source:e.source},delete e.source)})}}),this}}k.EXTENSION_NAME=U;class P extends r{constructor(){super(...arguments),this.propertyType="Transform",this.parentTypes=[t.TEXTURE_INFO],this.extensionName="KHR_texture_transform",this._offset=[0,0],this._rotation=0,this._scale=[1,1],this._texCoord=void 0}copy(e,t=o){return super.copy(e,t),this._offset=e._offset,this._rotation=e._rotation,this._scale=e._scale,this._texCoord=e._texCoord,this}getOffset(){return this._offset}setOffset(e){return this._offset=e,this}getRotation(){return this._rotation}setRotation(e){return this._rotation=e,this}getScale(){return this._scale}setScale(e){return this._scale=e,this}getTexCoord(){return this._texCoord}setTexCoord(e){return this._texCoord=e,this}}P.EXTENSION_NAME="KHR_texture_transform";const B="KHR_texture_transform";class V extends e{constructor(){super(...arguments),this.extensionName=B}createTransform(){return new P(this.doc.getGraph(),this)}read(e){for(const[t,s]of Array.from(e.textureInfos.entries())){if(!s.extensions||!s.extensions[B])continue;const e=this.createTransform(),r=s.extensions[B];void 0!==r.offset&&e.setOffset(r.offset),void 0!==r.rotation&&e.setRotation(r.rotation),void 0!==r.scale&&e.setScale(r.scale),void 0!==r.texCoord&&e.setTexCoord(r.texCoord),t.setExtension(B,e)}return this}write(e){const t=Array.from(e.textureInfoDefMap.entries());for(const[e,s]of t){const t=e.getExtension(B);t&&(s.extensions=s.extensions||{},s.extensions[B]={offset:t.getOffset(),rotation:t.getRotation(),scale:t.getScale(),texCoord:t.getTexCoord()})}return this}}V.EXTENSION_NAME=B;const q=[T,m,y,F,D,j,O,K,L,k,V];export{C as Clearcoat,T as DracoMeshCompression,E as IOR,q as KHRONOS_EXTENSIONS,d as Light,g as LightType,m as LightsPunctual,y as MaterialsClearcoat,F as MaterialsIOR,D as MaterialsPBRSpecularGlossiness,j as MaterialsSpecular,O as MaterialsTransmission,K as MaterialsUnlit,L as MeshQuantization,A as PBRSpecularGlossiness,M as Specular,k as TextureBasisu,V as TextureTransform,P as Transform,v as Transmission,H as Unlit}; | ||
import{Extension as e,PropertyType as t,GLB_BUFFER as s,ExtensionProperty as r,COPY_IDENTITY as o,ColorUtils as n,TextureInfo as i,GraphChild as a}from"@gltf-transform/core";const c="EXT_texture_webp";class u extends e{constructor(){super(...arguments),this.extensionName=c,this.provideTypes=[t.TEXTURE]}provide(e){return e.jsonDoc.json.textures.forEach(e=>{e.extensions&&e.extensions[c]&&(e.source=e.extensions[c].source)}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listTextures().forEach(s=>{if("image/webp"===s.getMimeType()){const r=e.imageIndexMap.get(s);t.json.textures.forEach(e=>{e.source===r&&(e.extensions=e.extensions||{},e.extensions[c]={source:e.source},delete e.source)})}}),this}}let l,h,x;function T(e,t){let s;try{if(s=new l.DecoderBuffer,s.Init(new Int8Array(t),t.byteLength),e.GetEncodedGeometryType(s)!==l.TRIANGULAR_MESH)throw new Error("Unknown geometry type.");const r=new l.Mesh;if(!e.DecodeBufferToMesh(s,r).ok()||0===r.ptr)throw new Error("Decoding failure.");return r}finally{l.destroy(s)}}function g(e,t){const s=3*t.num_faces(),r=s*Uint32Array.BYTES_PER_ELEMENT,o=l._malloc(r);e.GetTrianglesUInt32Array(t,r,o);const n=new Uint32Array(l.HEAP32.buffer,o,s).slice();return l._free(o),n}function p(e,t,s,r){const o=x[r.componentType],n=h[r.componentType],i=s.num_components(),a=t.num_points()*i,c=a*n.BYTES_PER_ELEMENT,u=l._malloc(c);e.GetAttributeDataArrayForAllPoints(t,s,o,c,u);const T=new n(l.HEAPF32.buffer,u,a).slice();return l._free(u),T}u.EXTENSION_NAME=c;const f="KHR_draco_mesh_compression";class d extends e{constructor(){super(...arguments),this.extensionName=f,this.provideTypes=[t.PRIMITIVE],this.dependencies=["draco3d.decoder"]}install(e,t){return"draco3d.decoder"===e&&(this._decoderModule=t,l=this._decoderModule,h={5126:Float32Array,5125:Uint32Array,5123:Uint16Array,5121:Uint8Array,5122:Int16Array,5120:Int8Array},x={5126:l.DT_FLOAT32,5125:l.DT_UINT32,5123:l.DT_UINT16,5121:l.DT_UINT8,5122:l.DT_INT16,5120:l.DT_INT8}),this}provide(e){if(!this._decoderModule)throw new Error('Please install extension dependency, "draco3d.decoder".');const t=this.doc.getLogger(),r=e.jsonDoc,o=new this._decoderModule.Decoder,n=new Map;for(const i of r.json.meshes){for(const a of i.primitives){if(!a.extensions||!a.extensions[f])continue;const i=a.extensions[f];let c=n.get(i.bufferView);if(!c){const e=r.json.bufferViews[i.bufferView],a=r.json.buffers[e.buffer],u=new Uint8Array(a.uri?r.resources[a.uri]:r.resources[s],e.byteOffset||0,e.byteLength);c=T(o,u),n.set(i.bufferView,c),t.debug(`Decompressed ${u.byteLength} bytes.`)}for(const t in a.attributes){const s=e.jsonDoc.json.accessors[a.attributes[t]],r=o.GetAttributeByUniqueId(c,i.attributes[t]),n=p(o,c,r,s);e.accessors[a.attributes[t]].setArray(n)}const u=g(o,c);e.accessors[a.indices].setArray(u)}this._decoderModule.destroy(o);for(const e of Array.from(n.values()))this._decoderModule.destroy(e)}return this}read(e){return this.dispose(),this}write(e){return this.doc.getLogger().warn(`Writing ${this.extensionName} not yet implemented.`),this}}var _;d.EXTENSION_NAME=f,function(e){e.POINT="point",e.SPOT="spot",e.DIRECTIONAL="directional"}(_||(_={}));class m extends r{constructor(){super(...arguments),this.propertyType="Light",this.parentTypes=[t.NODE],this.extensionName="KHR_lights_punctual",this._color=[1,1,1],this._intensity=1,this._range=void 0,this._innerConeAngle=0,this._outerConeAngle=Math.PI/4}copy(e,t=o){return super.copy(e,t),this._color=[...e._color],this._intensity=e._intensity,this._type=e._type,this._range=e._range,this._innerConeAngle=e._innerConeAngle,this._outerConeAngle=e._outerConeAngle,this}getColor(){return this._color}setColor(e){return this._color=e,this}getColorHex(){return n.factorToHex(this._color)}setColorHex(e){return n.hexToFactor(e,this._color),this}getIntensity(){return this._intensity}setIntensity(e){return this._intensity=e,this}getType(){return this._type}setType(e){return this._type=e,this}getRange(){return this._range}setRange(e){return this._range=e,this}getInnerConeAngle(){return this._innerConeAngle}setInnerConeAngle(e){return this._innerConeAngle=e,this}getOuterConeAngle(){return this._outerConeAngle}setOuterConeAngle(e){return this._outerConeAngle=e,this}}m.EXTENSION_NAME="KHR_lights_punctual";const C="KHR_lights_punctual";class I extends e{constructor(){super(...arguments),this.extensionName=C}createLight(){return new m(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc;if(!t.json.extensions||!t.json.extensions[C])return this;const s=(t.json.extensions[C].lights||[]).map(e=>{const t=this.createLight().setName(e.name||"").setType(e.type);return void 0!==e.color&&t.setColor(e.color),void 0!==e.intensity&&t.setIntensity(e.intensity),void 0!==e.range&&t.setRange(e.range),void 0!==e.innerConeAngle&&t.setInnerConeAngle(e.innerConeAngle),void 0!==e.outerConeAngle&&t.setOuterConeAngle(e.outerConeAngle),t});return t.json.nodes.forEach((t,r)=>{t.extensions&&t.extensions[C]&&e.nodes[r].setExtension(C,s[t.extensions[C].light])}),this}write(e){const t=e.jsonDoc;if(0===this.properties.size)return this;const s=[],r=new Map;for(const e of this.properties){const t=e,o={type:t.getType(),color:t.getColor(),intensity:t.getIntensity(),range:t.getRange()};t.getName()&&(o.name=t.getName()),t.getType()===_.SPOT&&(o.innerConeAngle=t.getInnerConeAngle(),o.outerConeAngle=t.getOuterConeAngle()),s.push(o),r.set(t,s.length-1)}return this.doc.getRoot().listNodes().forEach(s=>{const o=s.getExtension(C);if(o){const n=e.nodeIndexMap.get(s),i=t.json.nodes[n];i.extensions=i.extensions||{},i.extensions[C]={light:r.get(o)}}}),t.json.extensions=t.json.extensions||{},t.json.extensions[C]={lights:s},this}}function R(e,t,s,r){var o,n=arguments.length,i=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,s,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(n<3?o(i):n>3?o(t,s,i):o(t,s))||i);return n>3&&i&&Object.defineProperty(t,s,i),i}I.EXTENSION_NAME=C;class N extends r{constructor(){super(...arguments),this.propertyType="Clearcoat",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_clearcoat",this._clearcoatFactor=0,this._clearcoatRoughnessFactor=0,this._clearcoatNormalScale=1,this.clearcoatTexture=null,this.clearcoatTextureInfo=this.graph.link("clearcoatTextureInfo",this,new i(this.graph)),this.clearcoatRoughnessTexture=null,this.clearcoatRoughnessTextureInfo=this.graph.link("clearcoatRoughnessTextureInfo",this,new i(this.graph)),this.clearcoatNormalTexture=null,this.clearcoatNormalTextureInfo=this.graph.link("clearcoatNormalTextureInfo",this,new i(this.graph))}copy(e,t=o){return super.copy(e,t),this._clearcoatFactor=e._clearcoatFactor,this._clearcoatRoughnessFactor=e._clearcoatRoughnessFactor,this._clearcoatNormalScale=e._clearcoatNormalScale,e.clearcoatTexture&&(this.setClearcoatTexture(t(e.clearcoatTexture.getChild())),this.getClearcoatTextureInfo().copy(t(e.clearcoatTextureInfo.getChild()),t)),e.clearcoatRoughnessTexture&&(this.setClearcoatRoughnessTexture(t(e.clearcoatRoughnessTexture.getChild())),this.getClearcoatRoughnessTextureInfo().copy(t(e.clearcoatRoughnessTextureInfo.getChild()),t)),e.clearcoatNormalTexture&&(this.setClearcoatNormalTexture(t(e.clearcoatNormalTexture.getChild())),this.getClearcoatNormalTextureInfo().copy(t(e.clearcoatNormalTextureInfo.getChild()),t)),this}dispose(){this.clearcoatTextureInfo.getChild().dispose(),this.clearcoatRoughnessTextureInfo.getChild().dispose(),this.clearcoatNormalTextureInfo.getChild().dispose(),super.dispose()}getClearcoatFactor(){return this._clearcoatFactor}setClearcoatFactor(e){return this._clearcoatFactor=e,this}getClearcoatTexture(){return this.clearcoatTexture?this.clearcoatTexture.getChild():null}getClearcoatTextureInfo(){return this.clearcoatTexture?this.clearcoatTextureInfo.getChild():null}setClearcoatTexture(e){return this.clearcoatTexture=this.graph.link("clearcoatTexture",this,e),this}getClearcoatRoughnessFactor(){return this._clearcoatRoughnessFactor}setClearcoatRoughnessFactor(e){return this._clearcoatRoughnessFactor=e,this}getClearcoatRoughnessTexture(){return this.clearcoatRoughnessTexture?this.clearcoatRoughnessTexture.getChild():null}getClearcoatRoughnessTextureInfo(){return this.clearcoatRoughnessTexture?this.clearcoatRoughnessTextureInfo.getChild():null}setClearcoatRoughnessTexture(e){return this.clearcoatRoughnessTexture=this.graph.link("clearcoatRoughnessTexture",this,e),this}getClearcoatNormalScale(){return this._clearcoatNormalScale}setClearcoatNormalScale(e){return this._clearcoatNormalScale=e,this}getClearcoatNormalTexture(){return this.clearcoatNormalTexture?this.clearcoatNormalTexture.getChild():null}getClearcoatNormalTextureInfo(){return this.clearcoatNormalTexture?this.clearcoatNormalTextureInfo.getChild():null}setClearcoatNormalTexture(e){return this.clearcoatNormalTexture=this.graph.link("clearcoatNormalTexture",this,e),this}}N.EXTENSION_NAME="KHR_materials_clearcoat",R([a],N.prototype,"clearcoatTexture",void 0),R([a],N.prototype,"clearcoatTextureInfo",void 0),R([a],N.prototype,"clearcoatRoughnessTexture",void 0),R([a],N.prototype,"clearcoatRoughnessTextureInfo",void 0),R([a],N.prototype,"clearcoatNormalTexture",void 0),R([a],N.prototype,"clearcoatNormalTextureInfo",void 0);const E="KHR_materials_clearcoat";class y extends e{constructor(){super(...arguments),this.extensionName=E}createClearcoat(){return new N(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc,s=t.json.textures||[];return(t.json.materials||[]).forEach((t,r)=>{if(t.extensions&&t.extensions[E]){const o=this.createClearcoat();if(e.materials[r].setExtension(E,o),void 0!==t.extensions[E].clearcoatFactor&&o.setClearcoatFactor(t.extensions[E].clearcoatFactor),void 0!==t.extensions[E].clearcoatRoughnessFactor&&o.setClearcoatRoughnessFactor(t.extensions[E].clearcoatRoughnessFactor),void 0!==t.extensions[E].clearcoatTexture){const r=t.extensions[E].clearcoatTexture;o.setClearcoatTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getClearcoatTextureInfo(),r)}if(void 0!==t.extensions[E].clearcoatRoughnessTexture){const r=t.extensions[E].clearcoatRoughnessTexture;o.setClearcoatRoughnessTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getClearcoatRoughnessTextureInfo(),r)}if(void 0!==t.extensions[E].clearcoatNormalTexture){const r=t.extensions[E].clearcoatNormalTexture;o.setClearcoatNormalTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getClearcoatNormalTextureInfo(),r),void 0!==r.scale&&o.setClearcoatNormalScale(r.scale)}}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(E);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];if(n.extensions=n.extensions||{},n.extensions[E]={clearcoatFactor:r.getClearcoatFactor(),clearcoatRoughnessFactor:r.getClearcoatRoughnessFactor()},r.getClearcoatTexture()){const t=r.getClearcoatTexture(),s=r.getClearcoatTextureInfo();n.extensions[E].clearcoatTexture=e.createTextureInfoDef(t,s)}if(r.getClearcoatRoughnessTexture()){const t=r.getClearcoatRoughnessTexture(),s=r.getClearcoatRoughnessTextureInfo();n.extensions[E].clearcoatRoughnessTexture=e.createTextureInfoDef(t,s)}if(r.getClearcoatNormalTexture()){const t=r.getClearcoatNormalTexture(),s=r.getClearcoatNormalTextureInfo();n.extensions[E].clearcoatNormalTexture=e.createTextureInfoDef(t,s),1!==r.getClearcoatNormalScale()&&(n.extensions[E].clearcoatNormalTexture.scale=r.getClearcoatNormalScale())}}}),this}}y.EXTENSION_NAME=E;class F extends r{constructor(){super(...arguments),this.propertyType="IOR",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_ior",this._ior=0}copy(e,t=o){return super.copy(e,t),this._ior=e._ior,this}getIOR(){return this._ior}setIOR(e){return this._ior=e,this}}F.EXTENSION_NAME="KHR_materials_ior";const S="KHR_materials_ior";class A extends e{constructor(){super(...arguments),this.extensionName=S}createIOR(){return new F(this.doc.getGraph(),this)}read(e){return(e.jsonDoc.json.materials||[]).forEach((t,s)=>{if(t.extensions&&t.extensions[S]){const r=this.createIOR();e.materials[s].setExtension(S,r),void 0!==t.extensions[S].ior&&r.setIOR(t.extensions[S].ior)}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(S);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];n.extensions=n.extensions||{},n.extensions[S]={ior:r.getIOR()}}}),this}}A.EXTENSION_NAME=S;class M extends r{constructor(){super(...arguments),this.propertyType="PBRSpecularGlossiness",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_pbrSpecularGlossiness",this._diffuseFactor=[1,1,1,1],this._specularFactor=[1,1,1],this._glossinessFactor=1,this.diffuseTexture=null,this.diffuseTextureInfo=this.graph.link("diffuseTextureInfo",this,new i(this.graph)),this.specularGlossinessTexture=null,this.specularGlossinessTextureInfo=this.graph.link("specularGlossinessTextureInfo",this,new i(this.graph))}copy(e,t=o){return super.copy(e,t),this._diffuseFactor=e._diffuseFactor,this._specularFactor=e._specularFactor,this._glossinessFactor=e._glossinessFactor,e.diffuseTexture&&(this.setDiffuseTexture(t(e.diffuseTexture.getChild())),this.getDiffuseTextureInfo().copy(t(e.diffuseTextureInfo.getChild()),t)),e.specularGlossinessTexture&&(this.setSpecularGlossinessTexture(t(e.specularGlossinessTexture.getChild())),this.getSpecularGlossinessTextureInfo().copy(t(e.specularGlossinessTextureInfo.getChild()),t)),this}dispose(){this.diffuseTextureInfo.getChild().dispose(),this.specularGlossinessTextureInfo.getChild().dispose(),super.dispose()}getDiffuseFactor(){return this._diffuseFactor}setDiffuseFactor(e){return this._diffuseFactor=e,this}getDiffuseHex(){return n.factorToHex(this._diffuseFactor)}setDiffuseHex(e){return n.hexToFactor(e,this._diffuseFactor),this}getDiffuseTexture(){return this.diffuseTexture?this.diffuseTexture.getChild():null}getDiffuseTextureInfo(){return this.diffuseTexture?this.diffuseTextureInfo.getChild():null}setDiffuseTexture(e){return this.diffuseTexture=this.graph.link("diffuseTexture",this,e),this}getSpecularFactor(){return this._specularFactor}setSpecularFactor(e){return this._specularFactor=e,this}getGlossinessFactor(){return this._glossinessFactor}setGlossinessFactor(e){return this._glossinessFactor=e,this}getSpecularGlossinessTexture(){return this.specularGlossinessTexture?this.specularGlossinessTexture.getChild():null}getSpecularGlossinessTextureInfo(){return this.specularGlossinessTexture?this.specularGlossinessTextureInfo.getChild():null}setSpecularGlossinessTexture(e){return this.specularGlossinessTexture=this.graph.link("specularGlossinessTexture",this,e),this}}M.EXTENSION_NAME="KHR_materials_pbrSpecularGlossiness",R([a],M.prototype,"diffuseTexture",void 0),R([a],M.prototype,"diffuseTextureInfo",void 0),R([a],M.prototype,"specularGlossinessTexture",void 0),R([a],M.prototype,"specularGlossinessTextureInfo",void 0);const D="KHR_materials_pbrSpecularGlossiness";class v extends e{constructor(){super(...arguments),this.extensionName=D}createPBRSpecularGlossiness(){return new M(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc,s=t.json.textures||[];return(t.json.materials||[]).forEach((t,r)=>{if(t.extensions&&t.extensions[D]){const o=this.createPBRSpecularGlossiness();if(e.materials[r].setExtension(D,o),void 0!==t.extensions[D].diffuseFactor&&o.setDiffuseFactor(t.extensions[D].diffuseFactor),void 0!==t.extensions[D].specularFactor&&o.setSpecularFactor(t.extensions[D].specularFactor),void 0!==t.extensions[D].glossinessFactor&&o.setGlossinessFactor(t.extensions[D].glossinessFactor),void 0!==t.extensions[D].diffuseTexture){const r=t.extensions[D].diffuseTexture;o.setDiffuseTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getDiffuseTextureInfo(),r)}if(void 0!==t.extensions[D].specularGlossinessTexture){const r=t.extensions[D].specularGlossinessTexture;o.setSpecularGlossinessTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getSpecularGlossinessTextureInfo(),r)}}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(D);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];if(n.extensions=n.extensions||{},n.extensions[D]={diffuseFactor:r.getDiffuseFactor(),specularFactor:r.getSpecularFactor(),glossinessFactor:r.getGlossinessFactor()},r.getDiffuseTexture()){const t=r.getDiffuseTexture(),s=r.getDiffuseTextureInfo();n.extensions[D].diffuseTexture=e.createTextureInfoDef(t,s)}if(r.getSpecularGlossinessTexture()){const t=r.getSpecularGlossinessTexture(),s=r.getSpecularGlossinessTextureInfo();n.extensions[D].specularGlossinessTexture=e.createTextureInfoDef(t,s)}}}),this}}v.EXTENSION_NAME=D;class j extends r{constructor(){super(...arguments),this.propertyType="Sheen",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_sheen",this._sheenColorFactor=[0,0,0],this._sheenRoughnessFactor=0,this.sheenColorTexture=null,this.sheenColorTextureInfo=this.graph.link("sheenColorTextureInfo",this,new i(this.graph)),this.sheenRoughnessTexture=null,this.sheenRoughnessTextureInfo=this.graph.link("sheenRoughnessTextureInfo",this,new i(this.graph))}copy(e,t=o){return super.copy(e,t),this._sheenColorFactor=e._sheenColorFactor,this._sheenRoughnessFactor=e._sheenRoughnessFactor,e.sheenColorTexture&&(this.setSheenColorTexture(t(e.sheenColorTexture.getChild())),this.getSheenColorTextureInfo().copy(t(e.sheenColorTextureInfo.getChild()),t)),e.sheenRoughnessTexture&&(this.setSheenRoughnessTexture(t(e.sheenRoughnessTexture.getChild())),this.getSheenRoughnessTextureInfo().copy(t(e.sheenRoughnessTextureInfo.getChild()),t)),this}dispose(){this.sheenColorTextureInfo.getChild().dispose(),this.sheenRoughnessTextureInfo.getChild().dispose(),super.dispose()}getSheenColorFactor(){return this._sheenColorFactor}getSheenColorHex(){return n.factorToHex(this._sheenColorFactor)}setSheenColorFactor(e){return this._sheenColorFactor=e,this}setSheenColorHex(e){return n.hexToFactor(e,this._sheenColorFactor),this}getSheenColorTexture(){return this.sheenColorTexture?this.sheenColorTexture.getChild():null}getSheenColorTextureInfo(){return this.sheenColorTexture?this.sheenColorTextureInfo.getChild():null}setSheenColorTexture(e){return this.sheenColorTexture=this.graph.link("sheenColorTexture",this,e),this}getSheenRoughnessFactor(){return this._sheenRoughnessFactor}setSheenRoughnessFactor(e){return this._sheenRoughnessFactor=e,this}getSheenRoughnessTexture(){return this.sheenRoughnessTexture?this.sheenRoughnessTexture.getChild():null}getSheenRoughnessTextureInfo(){return this.sheenRoughnessTexture?this.sheenRoughnessTextureInfo.getChild():null}setSheenRoughnessTexture(e){return this.sheenRoughnessTexture=this.graph.link("sheenRoughnessTexture",this,e),this}}j.EXTENSION_NAME="KHR_materials_sheen",R([a],j.prototype,"sheenColorTexture",void 0),R([a],j.prototype,"sheenColorTextureInfo",void 0),R([a],j.prototype,"sheenRoughnessTexture",void 0),R([a],j.prototype,"sheenRoughnessTextureInfo",void 0);const w="KHR_materials_sheen";class G extends e{constructor(){super(...arguments),this.extensionName=w}createSheen(){return new j(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc,s=t.json.textures||[];return(t.json.materials||[]).forEach((t,r)=>{if(t.extensions&&t.extensions[w]){const o=this.createSheen();if(e.materials[r].setExtension(w,o),void 0!==t.extensions[w].sheenColorFactor&&o.setSheenColorFactor(t.extensions[w].sheenColorFactor),void 0!==t.extensions[w].sheenRoughnessFactor&&o.setSheenRoughnessFactor(t.extensions[w].sheenRoughnessFactor),void 0!==t.extensions[w].sheenColorTexture){const r=t.extensions[w].sheenColorTexture;o.setSheenColorTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getSheenColorTextureInfo(),r)}if(void 0!==t.extensions[w].sheenRoughnessTexture){const r=t.extensions[w].sheenRoughnessTexture;o.setSheenRoughnessTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getSheenRoughnessTextureInfo(),r)}}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(w);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];if(n.extensions=n.extensions||{},n.extensions[w]={sheenColorFactor:r.getSheenColorFactor(),sheenRoughnessFactor:r.getSheenRoughnessFactor()},r.getSheenColorTexture()){const t=r.getSheenColorTexture(),s=r.getSheenColorTextureInfo();n.extensions[w].sheenColorTexture=e.createTextureInfoDef(t,s)}if(r.getSheenRoughnessTexture()){const t=r.getSheenRoughnessTexture(),s=r.getSheenRoughnessTextureInfo();n.extensions[w].sheenRoughnessTexture=e.createTextureInfoDef(t,s)}}}),this}}G.EXTENSION_NAME=w;class O extends r{constructor(){super(...arguments),this.propertyType="Specular",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_specular",this._specularFactor=1,this._specularColorFactor=[1,1,1],this.specularTexture=null,this.specularTextureInfo=this.graph.link("specularTextureInfo",this,new i(this.graph))}copy(e,t=o){return super.copy(e,t),this._specularFactor=e._specularFactor,e.specularTexture&&(this.setSpecularTexture(t(e.specularTexture.getChild())),this.getSpecularTextureInfo().copy(t(e.specularTextureInfo.getChild()),t)),this}dispose(){this.specularTextureInfo.getChild().dispose(),super.dispose()}getSpecularFactor(){return this._specularFactor}setSpecularFactor(e){return this._specularFactor=e,this}getSpecularColorFactor(){return this._specularColorFactor}setSpecularColorFactor(e){return this._specularColorFactor=e,this}getSpecularColorHex(){return n.factorToHex(this._specularColorFactor)}setSpecularColorHex(e){return n.hexToFactor(e,this._specularColorFactor),this}getSpecularTexture(){return this.specularTexture?this.specularTexture.getChild():null}getSpecularTextureInfo(){return this.specularTexture?this.specularTextureInfo.getChild():null}setSpecularTexture(e){return this.specularTexture=this.graph.link("specularTexture",this,e),this}}O.EXTENSION_NAME="KHR_materials_specular",R([a],O.prototype,"specularTexture",void 0),R([a],O.prototype,"specularTextureInfo",void 0);const H="KHR_materials_specular";class K extends e{constructor(){super(...arguments),this.extensionName=H}createSpecular(){return new O(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc,s=t.json.textures||[];return(t.json.materials||[]).forEach((t,r)=>{if(t.extensions&&t.extensions[H]){const o=this.createSpecular();if(e.materials[r].setExtension(H,o),void 0!==t.extensions[H].specularFactor&&o.setSpecularFactor(t.extensions[H].specularFactor),void 0!==t.extensions[H].specularColorFactor&&o.setSpecularColorFactor(t.extensions[H].specularColorFactor),void 0!==t.extensions[H].specularTexture){const r=t.extensions[H].specularTexture;o.setSpecularTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getSpecularTextureInfo(),r)}}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(H);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];if(n.extensions=n.extensions||{},n.extensions[H]={specularFactor:r.getSpecularFactor(),specularColorFactor:r.getSpecularColorFactor()},r.getSpecularTexture()){const t=r.getSpecularTexture(),s=r.getSpecularTextureInfo();n.extensions[H].specularTexture=e.createTextureInfoDef(t,s)}}}),this}}K.EXTENSION_NAME=H;class b extends r{constructor(){super(...arguments),this.propertyType="Transmission",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_transmission",this._transmissionFactor=0,this.transmissionTexture=null,this.transmissionTextureInfo=this.graph.link("transmissionTextureInfo",this,new i(this.graph))}copy(e,t=o){return super.copy(e,t),this._transmissionFactor=e._transmissionFactor,e.transmissionTexture&&(this.setTransmissionTexture(t(e.transmissionTexture.getChild())),this.getTransmissionTextureInfo().copy(t(e.transmissionTextureInfo.getChild()),t)),this}dispose(){this.transmissionTextureInfo.getChild().dispose(),super.dispose()}getTransmissionFactor(){return this._transmissionFactor}setTransmissionFactor(e){return this._transmissionFactor=e,this}getTransmissionTexture(){return this.transmissionTexture?this.transmissionTexture.getChild():null}getTransmissionTextureInfo(){return this.transmissionTexture?this.transmissionTextureInfo.getChild():null}setTransmissionTexture(e){return this.transmissionTexture=this.graph.link("transmissionTexture",this,e),this}}b.EXTENSION_NAME="KHR_materials_transmission",R([a],b.prototype,"transmissionTexture",void 0),R([a],b.prototype,"transmissionTextureInfo",void 0);const X="KHR_materials_transmission";class k extends e{constructor(){super(...arguments),this.extensionName=X}createTransmission(){return new b(this.doc.getGraph(),this)}read(e){const t=e.jsonDoc,s=t.json.textures||[];return(t.json.materials||[]).forEach((t,r)=>{if(t.extensions&&t.extensions[X]){const o=this.createTransmission();if(e.materials[r].setExtension(X,o),void 0!==t.extensions[X].transmissionFactor&&o.setTransmissionFactor(t.extensions[X].transmissionFactor),void 0!==t.extensions[X].transmissionTexture){const r=t.extensions[X].transmissionTexture;o.setTransmissionTexture(e.textures[s[r.index].source]),e.setTextureInfo(o.getTransmissionTextureInfo(),r)}}}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{const r=s.getExtension(X);if(r){const o=e.materialIndexMap.get(s),n=t.json.materials[o];if(n.extensions=n.extensions||{},n.extensions[X]={transmissionFactor:r.getTransmissionFactor()},r.getTransmissionTexture()){const t=r.getTransmissionTexture(),s=r.getTransmissionTextureInfo();n.extensions[X].transmissionTexture=e.createTextureInfoDef(t,s)}}}),this}}k.EXTENSION_NAME=X;class L extends r{constructor(){super(...arguments),this.propertyType="Unlit",this.parentTypes=[t.MATERIAL],this.extensionName="KHR_materials_unlit"}}L.EXTENSION_NAME="KHR_materials_unlit";const U="KHR_materials_unlit";class P extends e{constructor(){super(...arguments),this.extensionName=U}createUnlit(){return new L(this.doc.getGraph(),this)}read(e){return(e.jsonDoc.json.materials||[]).forEach((t,s)=>{t.extensions&&t.extensions[U]&&e.materials[s].setExtension(U,this.createUnlit())}),this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listMaterials().forEach(s=>{if(s.getExtension(U)){const r=e.materialIndexMap.get(s),o=t.json.materials[r];o.extensions=o.extensions||{},o.extensions[U]={}}}),this}}P.EXTENSION_NAME=U;const B="KHR_mesh_quantization";class V extends e{constructor(){super(...arguments),this.extensionName=B}read(e){return this}write(e){return this}}V.EXTENSION_NAME=B;const q="KHR_texture_basisu";class z extends e{constructor(){super(...arguments),this.extensionName=q,this.provideTypes=[t.TEXTURE]}provide(e){return e.jsonDoc.json.textures.forEach(e=>{e.extensions&&e.extensions[q]&&(e.source=e.extensions[q].source)}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.doc.getRoot().listTextures().forEach(s=>{if("image/ktx2"===s.getMimeType()){const r=e.imageIndexMap.get(s);t.json.textures.forEach(e=>{e.source===r&&(e.extensions=e.extensions||{},e.extensions[q]={source:e.source},delete e.source)})}}),this}}z.EXTENSION_NAME=q;class Y extends r{constructor(){super(...arguments),this.propertyType="Transform",this.parentTypes=[t.TEXTURE_INFO],this.extensionName="KHR_texture_transform",this._offset=[0,0],this._rotation=0,this._scale=[1,1],this._texCoord=void 0}copy(e,t=o){return super.copy(e,t),this._offset=e._offset,this._rotation=e._rotation,this._scale=e._scale,this._texCoord=e._texCoord,this}getOffset(){return this._offset}setOffset(e){return this._offset=e,this}getRotation(){return this._rotation}setRotation(e){return this._rotation=e,this}getScale(){return this._scale}setScale(e){return this._scale=e,this}getTexCoord(){return this._texCoord}setTexCoord(e){return this._texCoord=e,this}}Y.EXTENSION_NAME="KHR_texture_transform";const $="KHR_texture_transform";class W extends e{constructor(){super(...arguments),this.extensionName=$}createTransform(){return new Y(this.doc.getGraph(),this)}read(e){for(const[t,s]of Array.from(e.textureInfos.entries())){if(!s.extensions||!s.extensions[$])continue;const e=this.createTransform(),r=s.extensions[$];void 0!==r.offset&&e.setOffset(r.offset),void 0!==r.rotation&&e.setRotation(r.rotation),void 0!==r.scale&&e.setScale(r.scale),void 0!==r.texCoord&&e.setTexCoord(r.texCoord),t.setExtension($,e)}return this}write(e){const t=Array.from(e.textureInfoDefMap.entries());for(const[e,s]of t){const t=e.getExtension($);t&&(s.extensions=s.extensions||{},s.extensions[$]={offset:t.getOffset(),rotation:t.getRotation(),scale:t.getScale(),texCoord:t.getTexCoord()})}return this}}W.EXTENSION_NAME=$;const J=[d,I,y,A,v,K,G,k,P,V,z,W],Q=[u,...J];export{Q as ALL_EXTENSIONS,N as Clearcoat,d as DracoMeshCompression,F as IOR,J as KHRONOS_EXTENSIONS,m as Light,_ as LightType,I as LightsPunctual,y as MaterialsClearcoat,A as MaterialsIOR,v as MaterialsPBRSpecularGlossiness,G as MaterialsSheen,K as MaterialsSpecular,k as MaterialsTransmission,P as MaterialsUnlit,V as MeshQuantization,M as PBRSpecularGlossiness,j as Sheen,O as Specular,z as TextureBasisu,W as TextureTransform,u as TextureWebP,Y as Transform,b as Transmission,L as Unlit}; | ||
//# sourceMappingURL=extensions.modern.js.map |
{ | ||
"name": "@gltf-transform/extensions", | ||
"version": "0.7.3", | ||
"version": "0.7.4", | ||
"repository": "github:donmccurdy/glTF-Transform", | ||
@@ -24,3 +24,3 @@ "description": "Adds extension support to @gltf-transform/core", | ||
"dependencies": { | ||
"@gltf-transform/core": "^0.7.3" | ||
"@gltf-transform/core": "^0.7.4" | ||
}, | ||
@@ -33,3 +33,3 @@ "files": [ | ||
], | ||
"gitHead": "4320ec99813721c975857fa9d25b13eaf3fb981f" | ||
"gitHead": "391176e94c8a5e617e4b210920a9a936a45daaf0" | ||
} |
@@ -0,1 +1,2 @@ | ||
export const EXT_TEXTURE_WEBP = 'EXT_texture_webp'; | ||
export const KHR_DRACO_MESH_COMPRESSION = 'KHR_draco_mesh_compression'; | ||
@@ -6,2 +7,3 @@ export const KHR_LIGHTS_PUNCTUAL = 'KHR_lights_punctual'; | ||
export const KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS = 'KHR_materials_pbrSpecularGlossiness'; | ||
export const KHR_MATERIALS_SHEEN = 'KHR_materials_sheen'; | ||
export const KHR_MATERIALS_SPECULAR = 'KHR_materials_specular'; | ||
@@ -8,0 +10,0 @@ export const KHR_MATERIALS_TRANSMISSION = 'KHR_materials_transmission'; |
@@ -0,1 +1,2 @@ | ||
import { TextureWebP } from './ext-texture-webp'; | ||
import { DracoMeshCompression } from './khr-draco-mesh-compression'; | ||
@@ -6,2 +7,3 @@ import { LightsPunctual } from './khr-lights-punctual'; | ||
import { MaterialsPBRSpecularGlossiness } from './khr-materials-pbr-specular-glossiness'; | ||
import { MaterialsSheen } from './khr-materials-sheen'; | ||
import { MaterialsSpecular } from './khr-materials-specular'; | ||
@@ -14,14 +16,2 @@ import { MaterialsTransmission } from './khr-materials-transmission'; | ||
export * from './khr-draco-mesh-compression'; | ||
export * from './khr-lights-punctual'; | ||
export * from './khr-materials-clearcoat'; | ||
export * from './khr-materials-ior'; | ||
export * from './khr-materials-specular'; | ||
export * from './khr-materials-pbr-specular-glossiness'; | ||
export * from './khr-materials-transmission'; | ||
export * from './khr-materials-unlit'; | ||
export * from './khr-mesh-quantization'; | ||
export * from './khr-texture-basisu'; | ||
export * from './khr-texture-transform'; | ||
export const KHRONOS_EXTENSIONS = [ | ||
@@ -34,2 +24,3 @@ DracoMeshCompression, | ||
MaterialsSpecular, | ||
MaterialsSheen, | ||
MaterialsTransmission, | ||
@@ -41,1 +32,20 @@ MaterialsUnlit, | ||
]; | ||
export const ALL_EXTENSIONS = [ | ||
TextureWebP, | ||
...KHRONOS_EXTENSIONS, | ||
]; | ||
export * from './ext-texture-webp'; | ||
export * from './khr-draco-mesh-compression'; | ||
export * from './khr-lights-punctual'; | ||
export * from './khr-materials-clearcoat'; | ||
export * from './khr-materials-ior'; | ||
export * from './khr-materials-sheen'; | ||
export * from './khr-materials-specular'; | ||
export * from './khr-materials-pbr-specular-glossiness'; | ||
export * from './khr-materials-transmission'; | ||
export * from './khr-materials-unlit'; | ||
export * from './khr-mesh-quantization'; | ||
export * from './khr-texture-basisu'; | ||
export * from './khr-texture-transform'; |
Sorry, the diff of this file is not supported yet
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
545373
188
6197
Updated@gltf-transform/core@^0.7.4