commit 3dbf6253d07b1433f727e0ee62974c08398cd9d8
parent 340ab998fa94c4377013279a0cb987ae25c920de
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Thu, 7 Sep 2023 10:16:51 +0200
Fix obj output (was output in internal format)
Diffstat:
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/scpr_polygon.c b/src/scpr_polygon.c
@@ -21,6 +21,7 @@
#include <rsys/ref_count.h>
#include <rsys/mem_allocator.h>
#include <rsys/rsys.h>
+#include <rsys/float2.h>
#undef PI
#include <clipper2/clipper.h>
@@ -554,8 +555,15 @@ scpr_polygon_dump_to_obj
/* Vertice */
for(i = 0; i < polygon->paths.size(); i++) {
for(j = 0; j < polygon->paths[i].size(); j++) {
+ double tmpd[2];
+ float tmpf[2];
+ int64_t tmp64[2];
Clipper2Lib::Point64& pt = polygon->paths[i][j];
- fprintf(stream, "v %zu %zu 0\n", pt.x, pt.y);
+ tmp64[0] = pt.x;
+ tmp64[1] = pt.y;
+ ERR(scpr_device_unscale(polygon->device, tmp64, 2, tmpd));
+ f2_set_d2(tmpf, tmpd);
+ fprintf(stream, "v %f %f 0\n", tmpf[0], tmpf[1]);
}
}
@@ -591,8 +599,15 @@ scpr_polygon_dump_component_to_obj
/* Vertice */
for(i = 0; i < polygon->paths[icomponent].size(); i++) {
+ double tmpd[2];
+ float tmpf[2];
+ int64_t tmp64[2];
Clipper2Lib::Point64& pt = polygon->paths[icomponent][i];
- fprintf(stream, "v %zu %zu 0\n", pt.x, pt.y);
+ tmp64[0] = pt.x;
+ tmp64[1] = pt.y;
+ ERR(scpr_device_unscale(polygon->device, tmp64, 2, tmpd));
+ f2_set_d2(tmpf, tmpd);
+ fprintf(stream, "v %f %f 0\n", tmpf[0], tmpf[1]);
}
/* Line */