Browse Source

Add example options for hiding and showing lines

Garrett Johnson 6 years ago
parent
commit
3e745a8acc
1 changed files with 17 additions and 1 deletions
  1. 17 1
      examples/webgl_loader_ldraw.html

+ 17 - 1
examples/webgl_loader_ldraw.html

@@ -109,7 +109,9 @@
 				guiData = {
 				guiData = {
 					modelFileName: modelFileList[ 'Car' ],
 					modelFileName: modelFileList[ 'Car' ],
 					envMapActivated: false,
 					envMapActivated: false,
-					separateObjects: false
+					separateObjects: false,
+					displayLines: true,
+					optionalLines: false
 				};
 				};
 
 
 				gui = new dat.GUI();
 				gui = new dat.GUI();
@@ -134,6 +136,17 @@
 
 
 				} );
 				} );
 
 
+				gui.add( guiData, 'displayLines' ).name( 'Display Lines' ).onChange( function ( value ) {
+
+					model.children[ 1 ].visible = value;
+
+				} );
+
+				gui.add( guiData, 'optionalLines' ).name( 'Optional Lines' ).onChange( function ( value ) {
+
+					model.children[ 2 ].visible = value;
+
+				} );
 				window.addEventListener( 'resize', onWindowResize, false );
 				window.addEventListener( 'resize', onWindowResize, false );
 
 
 				progressBarDiv = document.createElement( 'div' );
 				progressBarDiv = document.createElement( 'div' );
@@ -218,6 +231,9 @@
 
 
 						}
 						}
 
 
+						model.children[ 1 ].visible = guiData.displayLines;
+						model.children[ 2 ].visible = guiData.optionalLines;
+
 						// Adjust camera and light
 						// Adjust camera and light
 
 
 						var bbox = new THREE.Box3().setFromObject( model );
 						var bbox = new THREE.Box3().setFromObject( model );