Browse Source

Update batch example

Garrett Johnson 4 years ago
parent
commit
099d9072df

+ 10 - 0
example/b3dmExample.html

@@ -22,9 +22,19 @@
                 image-rendering: pixelated;
                 outline: none;
             }
+
+			#info {
+				color: white;
+				font-family: monospace;
+				position: absolute;
+				white-space: pre;
+				line-height: 1.5em;
+				padding: 10px;;
+			}
         </style>
     </head>
     <body>
+		<div id="info"></div>
         <script src="./b3dmExample.js"></script>
     </body>
 </html>

+ 13 - 4
example/b3dmExample.js

@@ -21,6 +21,7 @@ let camera, controls, scene, renderer;
 let box, dirLight;
 let raycaster, mouse;
 let model;
+let infoEl;
 
 init();
 animate();
@@ -72,6 +73,8 @@ function batchIdHighlightShaderMixin( shader ) {
 
 function init() {
 
+	infoEl = document.getElementById( 'info' );
+
 	scene = new Scene();
 
 	// primary camera view
@@ -178,13 +181,19 @@ function onMouseMove( e ) {
 			// Log the batch data
 			const batchTable = batchTableObject.batchTable;
 			hoveredBatchid = batchidAttr.getX( face.a );
-			console.log( '_batchid', hoveredBatchid );
-			console.log( 'Latitude', batchTable.getData( 'Latitude' )[ hoveredBatchid ] );
-			console.log( 'Longitude', batchTable.getData( 'Longitude' )[ hoveredBatchid ] );
-			console.log( 'Height', batchTable.getData( 'Height' )[ hoveredBatchid ] );
+
+			infoEl.innerText =
+				`_batchid   : ${ hoveredBatchid }\n` +
+				`Latitude   : ${ batchTable.getData( 'Latitude' )[ hoveredBatchid ].toFixed( 3 ) }\n` +
+				`Longitude  : ${ batchTable.getData( 'Longitude' )[ hoveredBatchid ].toFixed( 3 ) }\n` +
+				`Height     : ${ batchTable.getData( 'Height' )[ hoveredBatchid ].toFixed( 3 ) }\n`;
 
 		}
 
+	} else {
+
+		infoEl.innerText = '';
+
 	}
 
 	if ( model ) {

+ 5 - 4
example/bundle/b3dmExample.d88db709.js

@@ -42859,6 +42859,7 @@ var camera, controls, scene, renderer;
 var box, dirLight;
 var raycaster, mouse;
 var model;
+var infoEl;
 init();
 animate(); // Adjusts the three.js standard shader to include batchid highlight
 
@@ -42883,6 +42884,7 @@ function batchIdHighlightShaderMixin(shader) {
 }
 
 function init() {
+  infoEl = document.getElementById('info');
   scene = new _three.Scene(); // primary camera view
 
   renderer = new _three.WebGLRenderer({
@@ -42966,11 +42968,10 @@ function onMouseMove(e) {
 
       var batchTable = batchTableObject.batchTable;
       hoveredBatchid = batchidAttr.getX(face.a);
-      console.log('_batchid', hoveredBatchid);
-      console.log('Latitude', batchTable.getData('Latitude')[hoveredBatchid]);
-      console.log('Longitude', batchTable.getData('Longitude')[hoveredBatchid]);
-      console.log('Height', batchTable.getData('Height')[hoveredBatchid]);
+      infoEl.innerText = "_batchid   : ".concat(hoveredBatchid, "\n") + "Latitude   : ".concat(batchTable.getData('Latitude')[hoveredBatchid].toFixed(3), "\n") + "Longitude  : ".concat(batchTable.getData('Longitude')[hoveredBatchid].toFixed(3), "\n") + "Height     : ".concat(batchTable.getData('Height')[hoveredBatchid].toFixed(3), "\n");
     }
+  } else {
+    infoEl.innerText = '';
   }
 
   if (model) {

File diff suppressed because it is too large
+ 1 - 1
example/bundle/b3dmExample.d88db709.js.map


+ 11 - 1
example/bundle/b3dmExample.html

@@ -20,9 +20,19 @@
             canvas {
                 image-rendering: pixelated;
                 outline: none;
-            }</style>
+            }
+
+			#info {
+				color: white;
+				font-family: monospace;
+				position: absolute;
+				white-space: pre;
+				line-height: 1.5em;
+				padding: 10px;;
+			}</style>
     </head>
     <body>
+		<div id="info"></div>
         <script src="b3dmExample.d88db709.js"></script>
     </body>
 </html>