Garrett Johnson 5 lat temu
rodzic
commit
df51ebd43a

+ 3 - 2
example/bundle/customMaterial.dd39ecee.js

@@ -39502,8 +39502,9 @@ function raycastTraverseFirstHit(root, group, activeTiles, raycaster) {
         _hitArray.sort(distanceSort);
       }
 
+      const res = _hitArray[0];
       _hitArray.length = 0;
-      return _hitArray[0];
+      return res;
     } else {
       return null;
     }
@@ -44863,7 +44864,7 @@ var parent = module.bundle.parent;
 if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
   var hostname = "" || location.hostname;
   var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
-  var ws = new WebSocket(protocol + '://' + hostname + ':' + "65167" + '/');
+  var ws = new WebSocket(protocol + '://' + hostname + ':' + "55097" + '/');
 
   ws.onmessage = function (event) {
     checkedAssets = {};

Plik diff jest za duży
+ 1 - 1
example/bundle/customMaterial.dd39ecee.js.map


+ 1 - 1
example/bundle/customMaterial.js

@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
 if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
   var hostname = "" || location.hostname;
   var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
-  var ws = new WebSocket(protocol + '://' + hostname + ':' + "65167" + '/');
+  var ws = new WebSocket(protocol + '://' + hostname + ':' + "55097" + '/');
 
   ws.onmessage = function (event) {
     checkedAssets = {};

Plik diff jest za duży
+ 1 - 1
example/bundle/customMaterial.js.map


Plik diff jest za duży
+ 13 - 6
example/bundle/example.e31bb0bc.js


Plik diff jest za duży
+ 1 - 1
example/bundle/example.e31bb0bc.js.map


+ 1 - 1
example/bundle/index.js

@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
 if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
   var hostname = "" || location.hostname;
   var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
-  var ws = new WebSocket(protocol + '://' + hostname + ':' + "65167" + '/');
+  var ws = new WebSocket(protocol + '://' + hostname + ':' + "55097" + '/');
 
   ws.onmessage = function (event) {
     checkedAssets = {};

Plik diff jest za duży
+ 1 - 1
example/bundle/index.js.map


+ 8 - 4
example/index.js

@@ -32,6 +32,9 @@ import { BufferGeometryUtils } from 'three/examples/jsm/utils/BufferGeometryUtil
 import * as dat from 'three/examples/jsm/libs/dat.gui.module.js';
 import Stats from 'three/examples/jsm/libs/stats.module.js';
 
+const ALL_HITS = 1;
+const FIRST_HIT_ONLY = 2;
+
 let camera, controls, scene, renderer, tiles, cameraHelper;
 let thirdPersonCamera, thirdPersonRenderer, thirdPersonControls;
 let secondRenderer, secondCameraHelper, secondControls, secondCamera;
@@ -44,7 +47,7 @@ let statsContainer, stats;
 let params = {
 
 	'enableUpdate': true,
-	'enableRaycast': false,
+	'raycast': NONE,
 	'enableCacheDisplay': false,
 	'orthographic': false,
 
@@ -248,7 +251,7 @@ function init() {
 		}
 
 	} );
-	exampleOptions.add( params, 'enableRaycast' );
+	exampleOptions.add( params, 'raycast', { NONE, ALL_HITS, FIRST_HIT_ONLY } );
 	exampleOptions.add( params, 'enableCacheDisplay' );
 	exampleOptions.open();
 
@@ -463,7 +466,7 @@ function animate() {
 
 	}
 
-	if ( params.enableRaycast && lastHoveredElement !== null ) {
+	if ( parseFloat( params.raycast ) !== NONE && lastHoveredElement !== null ) {
 
 		if ( lastHoveredElement === renderer.domElement ) {
 
@@ -475,7 +478,8 @@ function animate() {
 
 		}
 
-		raycaster.firstHitOnly = true;
+		raycaster.firstHitOnly = parseFloat( params.raycast ) === FIRST_HIT_ONLY;
+
 		const results = raycaster.intersectObject( tiles.group, true );
 		if ( results.length ) {
 

+ 3 - 1
src/three/raycastTraverse.js

@@ -35,6 +35,7 @@ export function raycastTraverseFirstHit( root, group, activeTiles, raycaster ) {
 	if ( activeTiles.has( root ) ) {
 
 		intersectTileScene( root.cached.scene, raycaster, _hitArray );
+
 		if ( _hitArray.length > 0 ) {
 
 			if ( _hitArray.length > 1 ) {
@@ -43,8 +44,9 @@ export function raycastTraverseFirstHit( root, group, activeTiles, raycaster ) {
 
 			}
 
+			const res = _hitArray[ 0 ];
 			_hitArray.length = 0;
-			return _hitArray[ 0 ];
+			return res;
 
 		} else {