chunk-T47XOAZJ.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import {
  2. c,
  3. u
  4. } from "./chunk-7NPG47AN.js";
  5. import {
  6. s as s2
  7. } from "./chunk-GCDJLKH4.js";
  8. import {
  9. d,
  10. e,
  11. l3 as l,
  12. n2 as n
  13. } from "./chunk-Y3WMVFTW.js";
  14. import {
  15. v
  16. } from "./chunk-IHXECKQQ.js";
  17. import {
  18. s
  19. } from "./chunk-EMJ4ZSM2.js";
  20. import {
  21. m
  22. } from "./chunk-IKP3YN53.js";
  23. // node_modules/@arcgis/core/geometry/support/MeshVertexAttributes.js
  24. var i;
  25. var l2 = s.getLogger("esri.geometry.support.MeshVertexAttributes");
  26. var p = i = class extends l {
  27. constructor(r) {
  28. super(r), this.color = null, this.position = new Float64Array(0), this.uv = null, this.normal = null, this.tangent = null;
  29. }
  30. castColor(r) {
  31. return u2(r, Uint8Array, [Uint8ClampedArray], { loggerTag: ".color=", stride: 4 }, l2);
  32. }
  33. castPosition(r) {
  34. r && r instanceof Float32Array && l2.warn(".position=", "Setting position attribute from a Float32Array may cause precision problems. Consider storing data in a Float64Array or a regular number array");
  35. return u2(r, Float64Array, [Float32Array], { loggerTag: ".position=", stride: 3 }, l2);
  36. }
  37. castUv(r) {
  38. return u2(r, Float32Array, [Float64Array], { loggerTag: ".uv=", stride: 2 }, l2);
  39. }
  40. castNormal(r) {
  41. return u2(r, Float32Array, [Float64Array], { loggerTag: ".normal=", stride: 3 }, l2);
  42. }
  43. castTangent(r) {
  44. return u2(r, Float32Array, [Float64Array], { loggerTag: ".tangent=", stride: 4 }, l2);
  45. }
  46. clone() {
  47. const r = { position: m(this.position), uv: m(this.uv), normal: m(this.normal), tangent: m(this.tangent), color: m(this.color) };
  48. return new i(r);
  49. }
  50. clonePositional() {
  51. const r = { position: m(this.position), normal: m(this.normal), tangent: m(this.tangent), uv: this.uv, color: this.color };
  52. return new i(r);
  53. }
  54. };
  55. function c2(r, t, o, e2) {
  56. const { loggerTag: n2, stride: s3 } = t;
  57. return r.length % s3 != 0 ? (e2.error(n2, `Invalid array length, expected a multiple of ${s3}`), new o([])) : r;
  58. }
  59. function u2(r, t, o, e2, n2) {
  60. if (!r)
  61. return r;
  62. if (r instanceof t)
  63. return c2(r, e2, t, n2);
  64. for (const s3 of o)
  65. if (r instanceof s3)
  66. return c2(new t(r), e2, t, n2);
  67. if (Array.isArray(r))
  68. return c2(new t(r), e2, t, n2);
  69. {
  70. const e3 = o.map((r2) => `'${r2.name}'`);
  71. return n2.error(`Failed to set property, expected one of ${e3}, but got ${r.constructor.name}`), new t([]);
  72. }
  73. }
  74. function g(r, t, o) {
  75. t[o] = m2(r);
  76. }
  77. function m2(r) {
  78. const t = new Array(r.length);
  79. for (let o = 0; o < r.length; o++)
  80. t[o] = r[o];
  81. return t;
  82. }
  83. e([d({ json: { write: g } })], p.prototype, "color", void 0), e([s2("color")], p.prototype, "castColor", null), e([d({ nonNullable: true, json: { write: g } })], p.prototype, "position", void 0), e([s2("position")], p.prototype, "castPosition", null), e([d({ json: { write: g } })], p.prototype, "uv", void 0), e([s2("uv")], p.prototype, "castUv", null), e([d({ json: { write: g } })], p.prototype, "normal", void 0), e([s2("normal")], p.prototype, "castNormal", null), e([d({ json: { write: g } })], p.prototype, "tangent", void 0), e([s2("tangent")], p.prototype, "castTangent", null), p = i = e([n("esri.geometry.support.MeshVertexAttributes")], p);
  84. // node_modules/@arcgis/core/geometry/support/MeshComponent.js
  85. var m3;
  86. var u3 = s.getLogger("esri.geometry.support.MeshComponent");
  87. var h = m3 = class extends l {
  88. constructor(r) {
  89. super(r), this.faces = null, this.material = null, this.shading = "source", this.trustSourceNormals = false;
  90. }
  91. static from(r) {
  92. return v(m3, r);
  93. }
  94. castFaces(r) {
  95. return u2(r, Uint32Array, [Uint16Array], { loggerTag: ".faces=", stride: 3 }, u3);
  96. }
  97. castMaterial(r) {
  98. return v(r && typeof r == "object" && ("metallic" in r || "roughness" in r || "metallicRoughnessTexture" in r) ? c : u, r);
  99. }
  100. clone() {
  101. return new m3({ faces: m(this.faces), shading: this.shading, material: m(this.material), trustSourceNormals: this.trustSourceNormals });
  102. }
  103. cloneWithDeduplication(r, t) {
  104. const o = { faces: m(this.faces), shading: this.shading, material: this.material ? this.material.cloneWithDeduplication(r, t) : null, trustSourceNormals: this.trustSourceNormals };
  105. return new m3(o);
  106. }
  107. };
  108. e([d({ json: { write: true } })], h.prototype, "faces", void 0), e([s2("faces")], h.prototype, "castFaces", null), e([d({ type: u, json: { write: true } })], h.prototype, "material", void 0), e([s2("material")], h.prototype, "castMaterial", null), e([d({ type: String, json: { write: true } })], h.prototype, "shading", void 0), e([d({ type: Boolean })], h.prototype, "trustSourceNormals", void 0), h = m3 = e([n("esri.geometry.support.MeshComponent")], h);
  109. var f = h;
  110. export {
  111. p,
  112. f
  113. };
  114. //# sourceMappingURL=chunk-T47XOAZJ.js.map