UNPKG

@animech-public/playcanvas

Version:
2 lines (1 loc) 995 B
import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import{ADDRESS_CLAMP_TO_EDGE as s,ADDRESS_REPEAT as t}from"../../../platform/graphics/constants.js";import{Texture as r}from"../../../platform/graphics/texture.js";import{Asset as a}from"../../asset/asset.js";import{basisTranscode as o}from"../../handlers/basis.js";import{TextureParser as i}from"./texture.js";class l extends i{constructor(e,s){super(),this.device=s,this.maxRetries=0}load(e,s,t){const r=this.device;a.fetchArrayBuffer(e.load,((a,i)=>{var l,m;a?s(a):(l=i,o(r,e.load,l,s,{isGGGR:!!(8&(null==t||null==(m=t.file)||null==(m=m.variants)||null==(m=m.basis)?void 0:m.opt))})||s(`Basis module not found. Asset '${t.name}' basis texture variant will not be loaded.`))}),t,this.maxRetries)}open(a,o,i,l={}){const m=new r(i,e({name:a,addressU:o.cubemap?s:t,addressV:o.cubemap?s:t,width:o.width,height:o.height,format:o.format,cubemap:o.cubemap,levels:o.levels},l));return m.upload(),m}}export{l as BasisParser};