/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import e from"../../Color.js";import{clone as r}from"../../core/lang.js";import{normalize as t,cross as o,subtract as s}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import n from"../../geometry/Mesh.js";import p from"../../geometry/support/MeshComponent.js";import a from"../../geometry/support/MeshGeoreferencedVertexSpace.js";import c from"../../geometry/support/MeshLocalVertexSpace.js";import l from"../../geometry/support/MeshMaterialMetallicRoughness.js";import f from"../../geometry/support/MeshTransform.js";import u from"../../geometry/support/MeshVertexAttributes.js";import{addMeshCloneContext as g}from"../../geometry/support/meshUtils/meshCloneUtils.js";import{convertVertexSpace as v}from"../../geometry/support/meshUtils/vertexSpaceConversion.js";function x(r,a){const g=i(0,0,1),v=i(1,0,1),x=i(1,1,0),j=t(m(),o(m(),s(m(),v,g),s(m(),x,g)));return new n({components:[new p({faces:[0,1,2],material:new l({color:new e("red")})})],vertexAttributes:new u({normal:[...j,...j,...j],position:[...g,...v,...x],uv:[0,.375,.25,.375,.25,.125]}),spatialReference:r.spatialReference,vertexSpace:new c({origin:i(r.x,r.y,r.z??0)}),transform:new f({scale:a?.scale??[1,1,1],rotationAngle:a?.rotationAngle??0})})}function j(e){if(!e.vertexSpace.origin)return e;const t=new a;return e.clone(g(void 0,{vertexAttributes:new u({...v(e,t),uv:r(e.vertexAttributes.uv),color:r(e.vertexAttributes.color)}),vertexSpace:t,transform:null}))}export{x as createTriangle,j as meshMakeAbsolute};
