/*
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","../../chunks/tslib.es6","../../core/JSONSupport","../../core/lang","../../core/Logger","../../core/accessorSupport/decorators/property","../../core/accessorSupport/decorators/cast","../../core/accessorSupport/decorators/subclass"],(function(t,r,e,o,n,s,a,i,c){"use strict";var l;const u=s.getLogger("esri.geometry.support.MeshVertexAttributes");function p(t,r,e,o){const{loggerTag:n,stride:s}=r;return t.length%s!=0?(o.error(n,`Invalid array length, expected a multiple of ${s}`),new e([])):t}function g(t,r,e,o,n){if(!t)return t;if(t instanceof r)return p(t,o,r,n);for(const s of e)if(t instanceof s)return p(new r(t),o,r,n);if(Array.isArray(t))return p(new r(t),o,r,n);{const o=e.map((t=>`'${t.name}'`));return n.error(`Failed to set property, expected one of ${o}, but got ${t.constructor.name}`),new r([])}}function y(t,r,e){r[e]=d(t)}function d(t){const r=new Array(t.length);for(let e=0;e<t.length;e++)r[e]=t[e];return r}t.MeshVertexAttributes=l=function(t){function e(r){var e;return(e=t.call(this,r)||this).color=null,e.position=new Float64Array(0),e.uv=null,e.normal=null,e.tangent=null,e}r._inheritsLoose(e,t);var o=e.prototype;return o.castColor=function(t){return g(t,Uint8Array,[Uint8ClampedArray],{loggerTag:".color=",stride:4},u)},o.castPosition=function(t){t&&t instanceof Float32Array&&u.warn(".position=","Setting position attribute from a Float32Array may cause precision problems. Consider storing data in a Float64Array or a regular number array");return g(t,Float64Array,[Float32Array],{loggerTag:".position=",stride:3},u)},o.castUv=function(t){return g(t,Float32Array,[Float64Array],{loggerTag:".uv=",stride:2},u)},o.castNormal=function(t){return g(t,Float32Array,[Float64Array],{loggerTag:".normal=",stride:3},u)},o.castTangent=function(t){return g(t,Float32Array,[Float64Array],{loggerTag:".tangent=",stride:4},u)},o.clone=function(){const t={position:n.clone(this.position),uv:n.clone(this.uv),normal:n.clone(this.normal),tangent:n.clone(this.tangent),color:n.clone(this.color)};return new l(t)},o.clonePositional=function(){const t={position:n.clone(this.position),normal:n.clone(this.normal),tangent:n.clone(this.tangent),uv:this.uv,color:this.color};return new l(t)},e}(o.JSONSupport),e.__decorate([a.property({json:{write:y}})],t.MeshVertexAttributes.prototype,"color",void 0),e.__decorate([i.cast("color")],t.MeshVertexAttributes.prototype,"castColor",null),e.__decorate([a.property({nonNullable:!0,json:{write:y}})],t.MeshVertexAttributes.prototype,"position",void 0),e.__decorate([i.cast("position")],t.MeshVertexAttributes.prototype,"castPosition",null),e.__decorate([a.property({json:{write:y}})],t.MeshVertexAttributes.prototype,"uv",void 0),e.__decorate([i.cast("uv")],t.MeshVertexAttributes.prototype,"castUv",null),e.__decorate([a.property({json:{write:y}})],t.MeshVertexAttributes.prototype,"normal",void 0),e.__decorate([i.cast("normal")],t.MeshVertexAttributes.prototype,"castNormal",null),e.__decorate([a.property({json:{write:y}})],t.MeshVertexAttributes.prototype,"tangent",void 0),e.__decorate([i.cast("tangent")],t.MeshVertexAttributes.prototype,"castTangent",null),t.MeshVertexAttributes=l=e.__decorate([c.subclass("esri.geometry.support.MeshVertexAttributes")],t.MeshVertexAttributes),t.castArray=g,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
