/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../chunks/_rollupPluginBabelHelpers","../../../../core/maybe","../../../../core/uid","../../../../chunks/mat4","../../../../chunks/mat4f64","../../../../chunks/vec3","../../../../chunks/vec4f64","../../support/mathUtils","./basicInterfaces","./geometryDataUtils","./InstanceParameters","./Object3DStateID","./VertexAttribute","../materials/renderers/utils"],(function(t,e,r,i,n,a,s,o,h,u,c,m,d,f,l){"use strict";let g=function(){function t(t,e,n={}){this.data=t,this.material=e,this.boundingSphere=o.create(),this.instanceParameters=new m.InstanceParameters,this._transformation=a.create(),this._shaderTransformationDirty=!0,this.layerUid=r.unwrapOr(n.layerUid,null),this.graphicUid=r.unwrapOr(n.graphicUid,null),this.id=n.id?n.id:i.generateUID(),this.boundingInfo=r.unwrapOr(n.boundingInfo,null),this.calculateShaderTransformation=r.unwrapOr(n.calculateShaderTransformation,null),this.castShadow=!!n.castShadow&&n.castShadow}var g=t.prototype;return g.updateTransformation=function(t){t(this._transformation),this._shaderTransformationDirty=!0,this.computeBoundingSphere(this._transformation,this.boundingSphere)},g.shaderTransformationChanged=function(){this._shaderTransformationDirty=!0},g.computeBoundingSphere=function(t,e,i=h.maxScale(t)){r.isNone(this.boundingInfo)||(s.transformMat4(e,this.boundingInfo.getCenter(),t),e[3]=this.boundingInfo.getBSRadius()*i)},g.getShaderTransformation=function(){return r.isNone(this.calculateShaderTransformation)?r.unwrapOr(this.transformation,a.IDENTITY):(this._shaderTransformationDirty&&(this._shaderTransformation||(this._shaderTransformation=a.create()),n.copy(this._shaderTransformation,this.calculateShaderTransformation(r.unwrapOr(this.transformation,a.IDENTITY))),this._shaderTransformationDirty=!1),this._shaderTransformation)},g.computeAttachmentOrigin=function(t){if(this.material.computeAttachmentOrigin)return!!this.material.computeAttachmentOrigin(this,t)&&(r.isSome(this._transformation)&&s.transformMat4(t,t,this._transformation),!0);const e=this.indices.get(f.VertexAttribute.POSITION),i=this.vertexAttributes.get(f.VertexAttribute.POSITION);return!!c.computeAttachmentOriginTriangles(i,e,t)&&(r.isSome(this._transformation)&&s.transformMat4(t,t,this._transformation),!0)},g.addHighlight=function(){const t=new d.Object3DStateID(u.Object3DState.Highlight),e=this.instanceParameters;return e.highlights=l.addObject3DStateID(e.highlights,t),t},g.removeHighlight=function(t){const e=this.instanceParameters;e.highlights=l.removeObject3DStateID(e.highlights,t)},e._createClass(t,[{key:"transformation",get:function(){return this._transformation}},{key:"hasShaderTransformation",get:function(){return r.isSome(this.calculateShaderTransformation)}},{key:"primitiveType",get:function(){return this.data.primitiveType}},{key:"indices",get:function(){return this.data.indices}},{key:"vertexAttributes",get:function(){return this.data.vertexAttributes}}]),t}(),p=function(t){function r(){return t.apply(this,arguments)||this}return e._inheritsLoose(r,t),r}(g);t.RenderGeometry=g,t.ValidatedRenderGeometry=p,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
