preserve doubleside on flats, frontside on solids
This commit is contained in:
parent
b383ba7ace
commit
83f814d42b
3 changed files with 10 additions and 10 deletions
|
|
@ -170,7 +170,7 @@
|
|||
Object.values(COLOR).forEach(color => {
|
||||
color.flat = true;
|
||||
color.line = 1
|
||||
color.opacity = 0.5;
|
||||
color.opacity = 1;
|
||||
});
|
||||
} else {
|
||||
Object.keys(COLOR).forEach(key => {
|
||||
|
|
|
|||
|
|
@ -232,14 +232,14 @@
|
|||
slice.unioned.forEach(poly => {
|
||||
poly = poly.clone(true);//.move(widget.track.pos);
|
||||
render
|
||||
.setLayer("layers", { line: 0x010101, face: 0x0099cc, opacity: 0.2 })
|
||||
.setLayer("layers", { line: 0x010101, face: 0x0099cc, opacity: 0.4 })
|
||||
.addAreas([poly], { outline: true });
|
||||
});
|
||||
} else if (slice.tops) {
|
||||
slice.tops.forEach(top => {
|
||||
let poly = top.poly;//.clone(true).move(widget.track.pos);
|
||||
render
|
||||
.setLayer("layers", { line: 0x010101, face: 0xfcba03, opacity: 0.2 })
|
||||
.setLayer("layers", { line: 0x010101, face: 0xfcba03, opacity: 0.4 })
|
||||
.addAreas([poly], { outline: true });
|
||||
});
|
||||
}
|
||||
|
|
@ -247,7 +247,7 @@
|
|||
if (slice.supports) {
|
||||
slice.supports.forEach(poly => {
|
||||
render
|
||||
.setLayer("support", { line: 0x010101, face: 0xfcba03, opacity: 0.2 })
|
||||
.setLayer("support", { line: 0x010101, face: 0xfcba03, opacity: 0.4 })
|
||||
.addAreas([poly], { outline: true });
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,9 +151,9 @@
|
|||
if (faces.length) {
|
||||
const mat = [];
|
||||
if (cface) {
|
||||
cface.forEach(c => { mat.push(newMat(c)) });
|
||||
cface.forEach(c => { mat.push(newMat(c, true)) });
|
||||
} else {
|
||||
mat.push(newMat(color));
|
||||
mat.push(newMat(color, true));
|
||||
}
|
||||
mat.forEach(m => m.visible = defstate);
|
||||
const geo = new THREE.BufferGeometry();
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
return mat;
|
||||
}
|
||||
|
||||
function createStandardMaterial(color) {
|
||||
function createStandardMaterial(color, flat) {
|
||||
return new THREE.MeshStandardMaterial({
|
||||
emissive,
|
||||
roughness,
|
||||
|
|
@ -244,18 +244,18 @@
|
|||
transparent: color.opacity != 1,
|
||||
opacity: color.opacity || 1,
|
||||
color: color.face,
|
||||
side: THREE.FrontSide
|
||||
side: flat ? THREE.DoubleSide : THREE.FrontSide
|
||||
});
|
||||
}
|
||||
|
||||
function createPhongMaterial(color) {
|
||||
function createPhongMaterial(color, flat) {
|
||||
return new THREE.MeshPhongMaterial({
|
||||
shininess,
|
||||
specular,
|
||||
transparent: color.opacity != 1,
|
||||
opacity: color.opacity || 1,
|
||||
color: color.face,
|
||||
side: THREE.FrontSide
|
||||
side: flat ? THREE.DoubleSide : THREE.FrontSide
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue