UNPKG

lingo3d-vue

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

92 lines (91 loc) 4.2 kB
var h = Object.defineProperty; var m = (t, o, e) => o in t ? h(t, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[o] = e; var S = (t, o, e) => (m(t, typeof o != "symbol" ? o + "" : o, e), e); import { aq as x, ar as a, as as p, at as I, au as P, av as w, aw as M, ax as b, B as v } from "./index-ee50be32.mjs"; const i = (t, o, e, s) => { if (e == null || p(e, s, o)) return; const n = t[o]; if (n != e) { if (n && typeof n == "object" && "set" in n) { if ("x" in n) { n.set(e.x ?? e, e.y ?? e); return; } n.set(e); return; } t[o] = e; } }, [r, l, R] = x((t, { referenceMaterial: o, defaults: e, MyTextureManager: s }) => { const n = o.clone(); return n.userData.TextureManager = s, i(n, "color", t[0], e), i(n, "opacity", t[1], e), i(n, "transparent", o.transparent || t[1] !== void 0 && t[1] < 1, e), i(n, "map", a(t[2], t[4], t[5], t[6]), e), i(n, "alphaMap", a(t[3], t[4], t[5], t[6]), e), i(n, "wireframe", t[7], e), i(n, "envMap", a(t[8], t[4], t[5], t[6]), e), i(n, "envMapIntensity", t[9], e), i(n, "aoMap", a(t[10], t[4], t[5], t[6]), e), i(n, "aoMapIntensity", t[11], e), i(n, "bumpMap", a(t[12], t[4], t[5], t[6]), e), i(n, "bumpScale", t[13], e), i(n, "displacementMap", a(t[14], t[4], t[5], t[6]), e), i(n, "displacementScale", t[15], e), i(n, "displacementBias", t[16], e), i(n, "emissive", t[17] ? t[0] : void 0, e), i(n, "emissiveIntensity", t[18], e), i(n, "lightMap", a(t[19], t[4], t[5], t[6]), e), i(n, "lightMapIntensity", t[20], e), i(n, "metalnessMap", a(t[21], t[4], t[5], t[6]), e), i(n, "metalness", t[22], e), i(n, "roughnessMap", a(t[23], t[4], t[5], t[6]), e), i(n, "roughness", t[24], e), i(n, "normalMap", a(t[25], t[4], t[5], t[6]), e), i(n, "normalScale", t[26], e), i(n, "depthTest", t[27], e), n; }, (t) => t.dispose()), D = (t) => { var s, n, c, u, y; const o = { color: "#" + (((s = t.color) == null ? void 0 : s.getHexString()) ?? "ffffff"), opacity: t.opacity, texture: "", alphaMap: "", textureRepeat: ((n = t.map) == null ? void 0 : n.repeat) ?? { x: 1, y: 1 }, textureFlipY: ((c = t.map) == null ? void 0 : c.flipY) ?? !1, textureRotation: (((u = t.map) == null ? void 0 : u.rotation) ?? 0) * w, wireframe: t.wireframe, envMap: "", envMapIntensity: t.envMapIntensity, aoMap: "", aoMapIntensity: t.aoMapIntensity, bumpMap: "", bumpScale: t.bumpScale, displacementMap: "", displacementScale: t.displacementScale, displacementBias: t.displacementBias, emissive: t.emissive ? !t.emissive.equals(M) : !1, emissiveIntensity: t.emissiveIntensity, lightMap: "", lightMapIntensity: t.lightMapIntensity, metalnessMap: "", metalness: t.metalness, roughnessMap: "", roughness: t.roughness, normalMap: "", normalScale: ((y = t.normalScale) == null ? void 0 : y.x) ?? 1, depthTest: t.depthTest }, e = Object.values(o); return [o, e]; }, d = (t) => { const [o, e] = D(t); R(e, t); const [s] = I((c) => { c.materialParamString ? l(c.materialParamString) : c.owner.then(() => l(c.materialParamString)); const u = JSON.stringify(c.materialParams); c.material = r(c.materialParams, u, { referenceMaterial: t, defaults: o, MyTextureManager: n }), c.materialParamString = u; }); class n extends P { constructor(y, g) { super(); S(this, "object3d"); S(this, "owner"); S(this, "defaults", o); S(this, "defaultParams", e); S(this, "addRefreshParamsSystem", s); this.object3d = y, this.owner = g; } } return S(n, "defaults", o), S(n, "defaultParams", e), S(n, "addRefreshParamsSystem", s), n; }, j = (t, o) => { var s; const e = []; t.traverse((n) => { if (n instanceof b ? e.push(n) : o[0] && n instanceof v && (o[0] = !1), "material" in n) { Array.isArray(n.material) && (n.material = n.material[0]), n.material.opacity === 1 && (n.castShadow = !0, n.receiveShadow = !0), n.material.userData.TextureManager = d(n.material); return; } n.castShadow = !0, n.receiveShadow = !0; }); for (const n of e) (s = n.parent) == null || s.remove(n); }; export { j as p };