fix cam rendering and lines in fdm
This commit is contained in:
parent
056d281fe2
commit
b075388702
2 changed files with 15 additions and 12 deletions
|
|
@ -909,7 +909,7 @@ function doRender(slice, isSynth, params, devel) {
|
|||
slice.tops.forEach(top => {
|
||||
if (isThin) output
|
||||
.setLayer('part', { line: 0x333333, check: 0x333333 })
|
||||
.addPolys(top.poly);
|
||||
.addPolys([top.poly]);
|
||||
|
||||
output
|
||||
.setLayer(isSynth ? "support" : "shells", isSynth ? COLOR.support : COLOR.shell)
|
||||
|
|
@ -917,7 +917,7 @@ function doRender(slice, isSynth, params, devel) {
|
|||
|
||||
output
|
||||
.setLayer("solid fill", isSynth ? COLOR.support : COLOR.fill)
|
||||
.addLines(top.fill_lines || [], vopt({ offset: offset * solidWidth, height }));
|
||||
.addLines(top.fill_lines || [], vopt({ offset: offset * solidWidth, height, z:slice.z }));
|
||||
|
||||
if (!(slice.belt && slice.belt.anchor)) output
|
||||
.setLayer("sparse fill", COLOR.infill)
|
||||
|
|
|
|||
|
|
@ -88,18 +88,21 @@ class Stack {
|
|||
|
||||
renderLayer(layer, group) {
|
||||
function addPoly(vertices, poly) {
|
||||
// unroll native polys into points
|
||||
if (poly.id) {
|
||||
poly = {
|
||||
open: poly.open,
|
||||
points: poly.points.map(p => [p.x, p.y, p.z]).flat().toFloat32()
|
||||
};
|
||||
}
|
||||
const points = poly.points, len = points.length;
|
||||
for (let i=1; i<len; i++) {
|
||||
const p1 = points[i-1];
|
||||
const p2 = points[i];
|
||||
vertices.push(new THREE.Vector3(p1.x, p1.y, p1.z));
|
||||
vertices.push(new THREE.Vector3(p2.x, p2.y, p2.z));
|
||||
for (let i=3; i<len; i += 3) {
|
||||
vertices.push(new THREE.Vector3(points[i-3], points[i-2], points[i-1]));
|
||||
vertices.push(new THREE.Vector3(points[i+0], points[i+1], points[i+2]));
|
||||
}
|
||||
if (!poly.open) {
|
||||
const p1 = points[points.length-1];
|
||||
const p2 = points[0];
|
||||
vertices.push(new THREE.Vector3(p1.x, p1.y, p1.z));
|
||||
vertices.push(new THREE.Vector3(p2.x, p2.y, p2.z));
|
||||
vertices.push(new THREE.Vector3(points[0], points[1], points[2]));
|
||||
vertices.push(new THREE.Vector3(points[len-3], points[len-2], points[len-1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +140,7 @@ class Stack {
|
|||
}
|
||||
// for now, line segments inherit the last color
|
||||
for (let i=0, il=lines.length; i<il; i += 3) {
|
||||
vert.push(new THREE.Vector3(lines[i], lines[i+1], lines[i+1]));
|
||||
vert.push(new THREE.Vector3(lines[i], lines[i+1], lines[i+2]));
|
||||
}
|
||||
// ensure at least one group using the default color settings
|
||||
if (grp.length === 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue