Browse Source

GLTFExporter: Added onlyVisible option

Fernando Serrano 8 years ago
parent
commit
b34e122ca8
2 changed files with 15 additions and 4 deletions
  1. 0 2
      examples/js/exporters/GLTFExporter.js
  2. 15 2
      examples/misc_exporter_gltf.html

+ 0 - 2
examples/js/exporters/GLTFExporter.js

@@ -57,8 +57,6 @@ THREE.GLTFExporter.prototype = {
 	 */
 	parse: function ( input, onDone, options ) {
 
-		options = options || {};
-
 		var outputJSON = {
 
 			asset: {

+ 15 - 2
examples/misc_exporter_gltf.html

@@ -29,7 +29,8 @@
 			<button id="export_objects">Export Sphere and Grid</button>
 			<button id="export_scene_object">Export Scene1 and Sphere</button>
 			<br/>
-			<input id="option_trs" type="checkbox" value="trs"/> TRS
+			<label><input id="option_trs" name="trs" type="checkbox"/>TRS</label>
+			<label><input id="option_visible" name="visible" type="checkbox" checked="checked"/>Only Visible</label>
 		</div>
 
 		<script src="../build/three.js"></script>
@@ -44,7 +45,8 @@
 				var gltfExporter = new THREE.GLTFExporter();
 
 				var options = {
-					trs: document.getElementById('option_trs').checked
+					trs: document.getElementById('option_trs').checked,
+					onlyVisible: document.getElementById('option_visible').checked,
 				}
 				gltfExporter.parse( input, function( result ) {
 
@@ -400,6 +402,17 @@
 				object.position.set( 200, 0, 400 );
 				scene1.add( object );
 
+				// ---------------------------------------------------------------------
+				// Big red box hidden just for testing `onlyVisible` option
+				// ---------------------------------------------------------------------
+				material = new THREE.MeshBasicMaterial( {
+					color: 0xff0000
+				} );
+				object = new THREE.Mesh( new THREE.BoxBufferGeometry( 200, 200, 200 ), material );
+				object.position.set( 0, 0, 0 );
+				object.name = "CubeHidden";
+				object.visible = false;
+				scene1.add( object );
 
 				// ---------------------------------------------------------------------
 				// 2nd Scene