Update app.py
Browse files
app.py
CHANGED
@@ -636,10 +636,50 @@ async(c, o, p, d, n, m)=>{
|
|
636 |
//BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.needDepthPrePass = true;
|
637 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].scaling.z = -1;
|
638 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].alphaIndex = o_.length-j;
|
|
|
639 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.diffuseTexture.hasAlpha = true;
|
640 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.useAlphaFromDiffuseTexture = true;
|
641 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].applyDisplacementMap(m[o_[j]].url, 0, 255, function(m){try{alert(BABYLON.Engine.Version);}catch(e){alert(e);}}, null, null, true, function(e){alert(e);});
|
642 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
643 |
if (document.getElementById("model")) {
|
644 |
document.getElementById("model").appendChild(document.getElementById("model3D"));
|
645 |
toggleDisplay("model");
|
@@ -964,6 +1004,9 @@ with gr.Blocks(css=css, js=js, head=head) as demo:
|
|
964 |
}
|
965 |
}
|
966 |
BABYLON.Engine.LastCreatedScene.activeCamera.radius = 0;
|
|
|
|
|
|
|
967 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.samples = 4;
|
968 |
BABYLON.Engine.LastCreatedScene.activeCamera.fov = document.getElementById(\"zoom\").value;
|
969 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = document.getElementById(\"contrast\").value;
|
|
|
636 |
//BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.needDepthPrePass = true;
|
637 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].scaling.z = -1;
|
638 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].alphaIndex = o_.length-j;
|
639 |
+
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].visibility = 0.9999;
|
640 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.diffuseTexture.hasAlpha = true;
|
641 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.useAlphaFromDiffuseTexture = true;
|
642 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].applyDisplacementMap(m[o_[j]].url, 0, 255, function(m){try{alert(BABYLON.Engine.Version);}catch(e){alert(e);}}, null, null, true, function(e){alert(e);});
|
643 |
}
|
644 |
+
|
645 |
+
window.md = false;
|
646 |
+
window.r_old = 1.0;
|
647 |
+
window.a_old = 0;
|
648 |
+
window.b_old = Math.PI / 2;
|
649 |
+
|
650 |
+
document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointermove', function() {
|
651 |
+
if (md === true) {
|
652 |
+
if (Math.abs(BABYLON.Engine.LastCreatedScene.activeCamera.radius - r_old) > 1/16) {
|
653 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.radius = r_old;
|
654 |
+
} else {
|
655 |
+
r_old = BABYLON.Engine.LastCreatedScene.activeCamera.radius;
|
656 |
+
}
|
657 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.fov = 0.8 * BABYLON.Engine.LastCreatedScene.activeCamera.radius;
|
658 |
+
|
659 |
+
if (BABYLON.Engine.LastCreatedScene.activeCamera.fov < 0.157) {
|
660 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.fov = 0.157;
|
661 |
+
} else if (BABYLON.Engine.LastCreatedScene.activeCamera.fov > 1.57) {
|
662 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.fov = 1.57;
|
663 |
+
}
|
664 |
+
document.getElementById('zoom').value = BABYLON.Engine.LastCreatedScene.activeCamera.fov;
|
665 |
+
document.getElementById('zoom').parentNode.childNodes[2].innerText = document.getElementById('zoom').value;
|
666 |
+
|
667 |
+
try {
|
668 |
+
compass.style.transform = "rotateX(" + (BABYLON.Engine.LastCreatedScene.activeCamera.beta-Math.PI/2) + "rad) rotateZ(" + BABYLON.Engine.LastCreatedScene.activeCamera.alpha + "rad)";
|
669 |
+
document.getElementById("cdata").innerHTML = compass.style.transform + '<br/>radius: ' + BABYLON.Engine.LastCreatedScene.activeCamera.radius + ',<br/> heading: ' + BABYLON.Engine.LastCreatedScene.activeCamera.alpha + ',<br/> pitch: ' + BABYLON.Engine.LastCreatedScene.activeCamera.beta + ',<br/> x: ' + BABYLON.Engine.LastCreatedScene.activeCamera.position.x + ',<br/> y: ' + BABYLON.Engine.LastCreatedScene.activeCamera.position.y + ',<br/> z: ' + BABYLON.Engine.LastCreatedScene.activeCamera.position.z + '<hr/>';
|
670 |
+
} catch(e) {alert(e);}
|
671 |
+
}
|
672 |
+
});
|
673 |
+
document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointerdown', function() {
|
674 |
+
md = true;
|
675 |
+
});
|
676 |
+
document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointerup', function() {
|
677 |
+
md = false;
|
678 |
+
});
|
679 |
+
document.getElementById("model3D").getElementsByTagName("canvas")[0].addEventListener('pointerleave', function() {
|
680 |
+
md = false;
|
681 |
+
});
|
682 |
+
|
683 |
if (document.getElementById("model")) {
|
684 |
document.getElementById("model").appendChild(document.getElementById("model3D"));
|
685 |
toggleDisplay("model");
|
|
|
1004 |
}
|
1005 |
}
|
1006 |
BABYLON.Engine.LastCreatedScene.activeCamera.radius = 0;
|
1007 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.alpha = 0;
|
1008 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.beta = Math.PI / 2;
|
1009 |
+
|
1010 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.samples = 4;
|
1011 |
BABYLON.Engine.LastCreatedScene.activeCamera.fov = document.getElementById(\"zoom\").value;
|
1012 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = document.getElementById(\"contrast\").value;
|