Fix exported obj scale

This commit is contained in:
luboslenco
2019-06-25 13:21:26 +02:00
parent 0f188739ea
commit 1373aa874d
+9 -8
View File
@@ -11,25 +11,26 @@ class ExportObj {
var off = 0;
for (p in Project.paintObjects) {
var mesh = p.data.raw;
var sc = p.data.scalePos;
var inv = 1 / 32767;
var sc = p.data.scalePos * inv;
var posa = mesh.vertex_arrays[0].values;
var nora = mesh.vertex_arrays[1].values;
var texa = mesh.vertex_arrays[2].values;
var len = Std.int(posa.length / 4);
s += "o " + p.name + "\n";
for (i in 0...len) {
s += "v " + posa[i * 4 ] * sc + " " +
posa[i * 4 + 2] * sc + " " +
s += "v " + posa[i * 4 ] * sc + " " +
posa[i * 4 + 2] * sc + " " +
(-posa[i * 4 + 1] * sc) + "\n";
}
for (i in 0...len) {
s += "vn " + nora[i * 2 ] + " " +
posa[i * 4 + 3] + " " +
(-nora[i * 2 + 1]) + "\n";
s += "vn " + nora[i * 2 ] * inv + " " +
posa[i * 4 + 3] * inv + " " +
(-nora[i * 2 + 1] * inv) + "\n";
}
for (i in 0...len) {
s += "vt " + texa[i * 2 ] + " " +
(1.0 - texa[i * 2 + 1]) + "\n";
s += "vt " + texa[i * 2 ] * inv + " " +
(1.0 - texa[i * 2 + 1] * inv) + "\n";
}
var inda = mesh.index_arrays[0].values;
for (i in 0...Std.int(inda.length / 3)) {