Skip to content

Instantly share code, notes, and snippets.

@skrat
Created April 23, 2015 10:08
Show Gist options
  • Save skrat/cfcfc394ab1906f16fdc to your computer and use it in GitHub Desktop.
Save skrat/cfcfc394ab1906f16fdc to your computer and use it in GitHub Desktop.
$.Pb = function(a, b, c, d) {
return{textures:{}, materials:xf(xg(function(a, b) {
return new ka(null, 2, [Df, Of.b(Qf.b(b)), Lf, 1 - Tf.b(Qf.b(b))], null);
}, Sd.a(Ce, Z.a(Pf, Q.a(qd, bf(a)))))), geometries:xf(Q.a(qd, Z.a(function(a) {
return function g(a) {
return new V(null, function() {
for (;;) {
var b = E(a);
if (b) {
if (R(b)) {
var c = A(b), d = M(c), e = jd(d);
a: {
for (var r = 0;;) {
if (r < d) {
var s = z.a(c, r), t = N.c(s, 0, null), s = N.c(s, 1, null), s = Fc(s) ? Q.a(Dd, s) : s, s = P.a(s, Sf);
e.add(new ka(null, 2, [Nf, t, Uf, s], null));
r += 1;
} else {
c = !0;
break a;
}
}
c = void 0;
}
return c ? W(X(e), g(D(b))) : W(X(e), null);
}
c = F(b);
e = N.c(c, 0, null);
c = N.c(c, 1, null);
c = Fc(c) ? Q.a(Dd, c) : c;
c = P.a(c, Sf);
return L(new ka(null, 2, [Nf, e, Uf, c], null), g(G(b)));
}
return null;
}
}, null, null);
}(a);
}, Z.a(Ef, Q.a(qd, bf($.Xb(a, b, c, d)))))))};
};
ba("mylib.core.export_3D", $.Pb);
"undefined" !== typeof module && (wa = function() {
return null;
}, module.exports = $);
Q.a(wa, Ld.a(2, pg.bc));
})();
(defn ^:export export-3D
[slices w h t]
#js {:geometries (clj->js (->>
(transform-slices slices w h t)
(vals) (apply concat) (map :geometry)
(map #(for [[material {:keys [buffer]}] %]
{:material material
:data buffer}))
(apply concat)))
:materials (clj->js (->> slices vals
(apply concat) (map :materials)
(into {}) (map-vals (fn [k v]
{:color (-> v :effect :diffuse)
:opacity (- 1 (-> v :effect :transparency))}))))
:textures (js-obj)})
(when (exists? js/module)
(set! *main-cli-fn* (fn [] nil))
(aset js/module "exports" mylib.core))
var mylib = require('mylib');
mylib.export_3D(....)
// Possibly unhandled TypeError: mylib.export_3D is not a function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment