Fix Z-fighting in solid view mode

Fix cube hover highlight not working
Fix issue with bbmodel importer
This commit is contained in:
JannisX11 2021-06-24 23:31:07 +02:00
parent 3ff0470489
commit 5fa8dd80c2
3 changed files with 11 additions and 7 deletions

View File

@ -449,7 +449,7 @@ class OutlinerElement extends OutlinerNode {
}
OutlinerElement.prototype.isParent = false;
OutlinerElement.fromSave = function(obj, keep_uuid) {
let Type = OutlinerElement.types[obj.type];
let Type = OutlinerElement.types[obj.type] || Cube;
if (Type) {
return new Type(obj, keep_uuid ? obj.uuid : 0).init()
}

View File

@ -77,8 +77,7 @@ const Canvas = {
vec3 N = vec3( modelViewMatrix * vec4(normal, 0.0) );
float yLight = (1.0+N.z) * 0.5;
light = yLight * (1.0-AMBIENT) + N.x*N.x * XFAC + N.y*N.y * ZFAC + AMBIENT;
light = (0.2 + abs(N.z) * 0.8) * (1.0-AMBIENT) + N.x*N.x * XFAC + N.y*N.y * ZFAC + AMBIENT;
} else {
@ -86,8 +85,8 @@ const Canvas = {
}
if (color.b == 1.25) {
lift = 0.1;
if (color.b > 1.1) {
lift = 0.12;
} else {
lift = 0.0;
}
@ -112,6 +111,11 @@ const Canvas = {
gl_FragColor = vec4(lift + base * light * BRIGHTNESS, 1.0);
if (lift > 0.1) {
gl_FragColor.b = gl_FragColor.b * 1.16;
gl_FragColor.g = gl_FragColor.g * 1.04;
}
}`
return new THREE.ShaderMaterial({
@ -654,7 +658,7 @@ const Canvas = {
}
if (color.b == 1.25) {
if (color.b > 1.1) {
lift = 0.1;
} else {
lift = 0.0;

View File

@ -83,7 +83,7 @@ class Texture {
}
if (color.b == 1.25) {
if (color.b > 1.1) {
lift = 0.1;
} else {
lift = 0.0;