resolve perverse transparency issues with forced renderOrder

This commit is contained in:
Stewart Allen 2020-11-13 23:09:53 -05:00
commit ba13531297
5 changed files with 18 additions and 11 deletions

View file

@ -1,6 +1,6 @@
{
"name": "grid-apps",
"version": "2.3.D8",
"version": "2.3.8D",
"description": "grid.space 3d slice & modeling tools",
"author": "Stewart Allen <sa@grid.space>",
"license": "MIT",
@ -32,7 +32,7 @@
"moment": "^2.24.0",
"pixi.js": "^4.8.9",
"serve-static": "^1.14.1",
"three": "^0.114.0",
"three": "^0.122.0",
"tween.js": "^0.14.0",
"uglify-es": "^3.3.10",
"validator": "^8.2.0",

View file

@ -1287,7 +1287,7 @@
function updateStockVisibility() {
if (camStock) {
camStock.material.visible = settings.mode === 'CAM' && viewMode === VIEWS.ARRANGE;
camStock.material.visible = settings.mode === 'CAM';// && viewMode === VIEWS.ARRANGE;
}
}
@ -1331,10 +1331,16 @@
}
if (!camStock) {
let geo = new THREE.BoxGeometry(1, 1, 1);
let mat = new THREE.MeshBasicMaterial({ color: 0x777777, opacity: 0.2, transparent: true, side:THREE.DoubleSide });
let mat = new THREE.MeshBasicMaterial({
color: 0x777777,
opacity: 0.2,
transparent: true,
side:THREE.DoubleSide
});
let cube = new THREE.Mesh(geo, mat);
SPACE.platform.add(cube);
camStock = cube;
cube.renderOrder = 2;
}
settings.stock = {
x: csx,

View file

@ -252,6 +252,7 @@
opacity: solid_opacity
})
);
mesh.renderOrder = 1;
// fix invalid normals
geometry.computeFaceNormals();
geometry.computeVertexNormals();

View file

@ -34,8 +34,8 @@
const stock = api.conf.get().stock;
const {x, y, z} = stock;
if (x && y && z) {
const render = new KIRI.Render().setLayer('stock', { face: 0xaaaaaa, line: 0xaaaaaa }, true);
const stack = STACKS.create('stock', SPACE.platform.world);
const render = new KIRI.Render().setLayer('bounds', { face: 0xaaaaaa, line: 0xaaaaaa }, true);
const stack = STACKS.create('bounds', SPACE.platform.world);
stack.add(render.addPolys([
newPolygon().centerRectangle({x:0, y:0, z:0}, x, y),
newPolygon().centerRectangle({x:0, y:0, z}, x, y)

View file

@ -31,7 +31,7 @@
skyGridColor = 0xcccccc,
skyMaterial = undefined,
skyGridMaterial = undefined,
showSkyGrid = true,
showSkyGrid = false,
showPlatform = true,
hidePlatformBelow = true,
trackcam = addLight(0, 0, 0, lightIntensity/3),
@ -89,7 +89,7 @@
shininess: 5,
transparent: true,
opacity: 0.6,
side: THREE.DoubleSide
// side: THREE.DoubleSide
}),
hiddenKey,
vizChange,
@ -460,13 +460,13 @@
shininess: 5,
transparent: true,
opacity: 0.5,
side: THREE.DoubleSide
// side: THREE.DoubleSide
});
let rmat = new THREE.MeshPhongMaterial({
color: 0x88aadd,
transparent: true,
opacity: 0.5,
side: THREE.DoubleSide
// side: THREE.DoubleSide
});
let PIP = Math.PI/2;
let pi1, pi2, pi3, pi4;
@ -935,7 +935,7 @@
trackPlane = new THREE.Mesh(
new THREE.PlaneBufferGeometry(100000, 100000, 1, 1),
new THREE.MeshBasicMaterial( { color: 0x777777, opacity: 0, transparent: true, side:THREE.DoubleSide } )
new THREE.MeshBasicMaterial( { color: 0x777777, opacity: 0, transparent: true } )
);
trackPlane.visible = false;
trackPlane.rotation.x = PI2;