Aggiornamento ambiente test live

This commit is contained in:
Riccardo Elitropi
2026-01-27 14:48:17 +01:00
parent d1bab45745
commit 40a7df5520
11 changed files with 20 additions and 14 deletions
@@ -21,8 +21,7 @@
let options ={
_dimX : X,
_dimY: Y,
//_fileName: "ProjectSlice.3dm",
_fileName: "TestFiera.3dm",
_fileName: "ProjectSlice.3dm",
_showGrid: true,
_showInfiniteGrid: false,
_isOrtographic: true,
@@ -398,7 +398,6 @@ function init3dm(){
}
// READING ARROW'S MESH
else if ( child.type == 'Mesh') {
try {
var nLayer = parseInt( child.userData.attributes.layerIndex) - nStartLayer ;
if ( nLayer < 0)
@@ -409,9 +408,9 @@ function init3dm(){
child.material.color = new THREE.Color( child.userData.attributes.objectColor.r/255.0,
child.userData.attributes.objectColor.g/255.0,
child.userData.attributes.objectColor.b/255.0) ;
child.material.flatShading = true;
child.material.needsUpdate = true;
layer_list.push( child) ;
//console.log( child) ;
} catch( e) {
console.log( 'Not a valid Arrow direction') ;
return false ;
@@ -478,25 +477,33 @@ function AdaptSeceneToContest() {
scene.background = new THREE.Color( 0xa0a0a0) ;
// Global Box ----------
if(fileType == "3DM"){
if (fileType == "3DM") {
for ( var i = 0 ; i < layer_list.length ; ++ i) {
const Objbox = new THREE.Box3().setFromObject( layer_list[i]);
GLBox3D.union( Objbox) ;
layer_list[i].material.side = THREE.DoubleSide ;
layer_list[i].castShadow = true
if ( ! layer_list[i].isArrow || m_bShowPrintDir)
if ( ! layer_list[i].isArrow || m_bShowPrintDir) {
if ( typeof layer_list[i].nLayer !== "undefined") {
if ( parseInt( layer_list[i].nLayer) % 2 == 0) {
const mat = layer_list[i].material.clone() ;
mat.color.lerp( new THREE.Color( 0x000000), 0.25) ;
layer_list[i].material = mat ;
}
}
layer_list[i].isArrow = ( layer_list[i].name == 'Arrow')
scene.add( layer_list[i]) ;
}
}
}
else if(fileType == "3MF"){
else if ( fileType == "3MF"){
for ( var i = 0 ; i < layer_list.length ; ++ i) {
if ( layer_list[i].children[0].type == 'Mesh') {
const Objbox = new THREE.Box3().setFromObject( layer_list[i]);
GLBox3D.union( Objbox) ;
layer_list[i].children[0].material.side = THREE.DoubleSide ;
if ( typeof layer_list[i].children[0].nLayer !== "undefined") {
if ( parseInt( layer_list[i].children[0].nLayer)%2 == 0)
if ( parseInt( layer_list[i].children[0].nLayer) % 2 == 0)
layer_list[i].children[0].material.color.lerp( new THREE.Color( 0x000000 ), 0.25) ;
layer_list[i].children[0].isArrow = ( layer_list[i].children[0].name == 'Arrow')
scene.add( layer_list[i]) ;
@@ -527,9 +534,9 @@ function AdaptSeceneToContest() {
scene.add( activeCamera) ;
// Hemisphere light --------
const hemiLight = new THREE.HemisphereLight( 0xffffff, 0x8d8d8d );
hemiLight.position.set( vtCenter.x, vtCenter.y + 2 * vtBoxDim.y, vtCenter.z);
scene.add( hemiLight );
const hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444, 1.8) ;
hemiLight.position.set( vtCenter.x, vtCenter.y + 2 * vtBoxDim.y, vtCenter.z) ;
scene.add( hemiLight) ;
// direction light --------
const dirLight = new THREE.DirectionalLight( 0xffffff );
@@ -542,7 +549,7 @@ function AdaptSeceneToContest() {
dirLight.shadow.camera.near = 0.1;
dirLight.shadow.camera.far = 200;
dirLight.shadow.mapSize.set( 1024, 1024 );
scene.add( dirLight );
scene.add( dirLight) ;
// render settings ---------
renderer = new THREE.WebGLRenderer( { antialias: true });