add ability to switch between flat/fast and shiny/slow slice render methods
This commit is contained in:
parent
5005bc9a0e
commit
a8bbedf435
5 changed files with 19 additions and 2 deletions
|
|
@ -7,12 +7,13 @@ gapp.register("kiri.stack", [], (root, exports) => {
|
|||
const { kiri } = root;
|
||||
|
||||
class Stack {
|
||||
constructor(view, freeMem) {
|
||||
constructor(view, freeMem, shiny) {
|
||||
this._view = view;
|
||||
this.view = view.newGroup();
|
||||
this.slices = [];
|
||||
this.meshes = [];
|
||||
this.freeMem = freeMem;
|
||||
newMat = shiny ? createPhongMaterial : createLambertMaterial;
|
||||
}
|
||||
|
||||
size() {
|
||||
|
|
@ -259,4 +260,15 @@ function createPhongMaterial(color, flat) {
|
|||
});
|
||||
}
|
||||
|
||||
function createLambertMaterial(color, flat) {
|
||||
return new THREE.MeshLambertMaterial({
|
||||
// shininess,
|
||||
// specular,
|
||||
transparent: color.opacity != 1,
|
||||
opacity: color.opacity || 1,
|
||||
color: color.face,
|
||||
side: flat ? THREE.DoubleSide : THREE.FrontSide
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue