/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{invert as e,transpose as t}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as r}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{ones as s,clone as o}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{TwoVectorPosition as i}from"../../core/util/TwoVectorPosition.js";import{NoParameters as a}from"../../../../webgl/NoParameters.js";class n extends a{constructor(s,o){super(),this._componentParameters=m;const{transform:a,toMapSpace:n}=s;this.toMapSpace=n;const u=r(a.rotationScale);e(u,u),t(u,u),this.transformNormalGlobalFromModel=u;const l=new i(a.position);this.transformWorldFromModelTL=l.low,this.transformWorldFromModelTH=l.high,this.transformWorldFromModelRS=a.rotationScale,this.useENUForGlobalOverlayUV=s.obb.radius<h,this.baseColor=o.baseColor,this.opacity=o.opacity,this.textureAlphaCutoff=o.textureAlphaCutoff,this.mrrFactors=o.mrrFactors,this.emissiveBaseColor=o.emissiveBaseColor,this.baseColorTexture=o.baseColorTexture,this.metallicRoughnessTexture=o.metallicRoughnessTexture,this.normalTexture=o.normalTexture,this.occlusionTexture=o.occlusionTexture,this.emissionTexture=o.emissionTexture}destroy(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}get texture(){return this.baseColorTexture?.texture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.texture}get textureEmissive(){return this.emissionTexture?.texture}get textureOcclusion(){return this.occlusionTexture?.texture}get textureNormal(){return this.normalTexture?.texture}get componentParameters(){return this._componentParameters}updateComponentParameters(e,t){this._componentParameters=e,this.textureBackedBuffer=t}get castAnyShadows(){return 2!==this.componentParameters.castShadows}}class u{constructor(e,t,r,s,i){this.castShadows=i,this.componentDataType=0,this.externalColor=o(e),this.externalColorMixMode=t,this.emissiveStrength=r,this.emissiveSource=s}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}}class l{constructor(e,t,r,s,o){this.transparent=e,this.opaqueOverride=t,this.emissiveOverride=r,this.emissiveSourceOverride=s,this.castShadows=o,this.componentDataType=1}}const m=new u(s(),1,0,0,0),h=5e4;export{n as ComponentDrawParametersImplementation,u as ComponentParametersUniform,l as ComponentParametersVarying,m as defaultComponentParameters};
