mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 19:13:49 +01:00
Fix holes on reversed paths
This commit is contained in:
parent
a43cbfcc2f
commit
03e3780a6f
14
src/d3/ShapeMesh.js
vendored
14
src/d3/ShapeMesh.js
vendored
@ -245,10 +245,20 @@ class ShapeMesh extends THREE.Object3D {
|
|||||||
|
|
||||||
return { x: point.x, y: y + this._z, z: point.y };
|
return { x: point.x, y: y + this._z, z: point.y };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_reversePath() {
|
||||||
|
const sx = this._transform.sx > 0;
|
||||||
|
const sy = this._transform.sy > 0;
|
||||||
|
|
||||||
|
return sx !== sy;
|
||||||
|
}
|
||||||
|
|
||||||
_updateVerticesHorizontal(heightStep, paths, center, indexCounter) {
|
_updateVerticesHorizontal(heightStep, paths, center, indexCounter) {
|
||||||
for (let pathindex = 0; pathindex < paths.length; pathindex ++) {
|
for (let pathindex = 0; pathindex < paths.length; pathindex ++) {
|
||||||
const path = applyMatrixOnPath(paths[pathindex], this._transform);
|
const path = applyMatrixOnPath(paths[pathindex], this._transform);
|
||||||
|
|
||||||
|
if (this._reversePath()) path.reverse();
|
||||||
|
|
||||||
for (let pathIndex = 0; pathIndex < path.length; pathIndex ++) {
|
for (let pathIndex = 0; pathIndex < path.length; pathIndex ++) {
|
||||||
let point = path[pathIndex];
|
let point = path[pathIndex];
|
||||||
|
|
||||||
@ -281,8 +291,10 @@ class ShapeMesh extends THREE.Object3D {
|
|||||||
for (let pathsIndex = 0; pathsIndex < paths.length; pathsIndex ++) {
|
for (let pathsIndex = 0; pathsIndex < paths.length; pathsIndex ++) {
|
||||||
const path = applyMatrixOnPath(paths[pathsIndex], this._transform);
|
const path = applyMatrixOnPath(paths[pathsIndex], this._transform);
|
||||||
|
|
||||||
|
if (this._reversePath()) path.reverse();
|
||||||
|
|
||||||
for (let pathIndex = 0; pathIndex < path.length; pathIndex ++) {
|
for (let pathIndex = 0; pathIndex < path.length; pathIndex ++) {
|
||||||
let point = path[pathIndex];
|
const point = path[pathIndex];
|
||||||
|
|
||||||
for (let heightStep = 0; heightStep < numHeightSteps; heightStep ++) {
|
for (let heightStep = 0; heightStep < numHeightSteps; heightStep ++) {
|
||||||
const { x, y, z } = this._getPoint(point, heightStep, center);
|
const { x, y, z } = this._getPoint(point, heightStep, center);
|
||||||
|
Loading…
Reference in New Issue
Block a user