瀏覽代碼

Octree and ignore certain meshes (#28116)

* Octree and ignore certain meshes

* Octree with Layers
Remus M 1 年之前
父節點
當前提交
fa03a0180c
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      examples/jsm/math/Octree.js

+ 7 - 1
examples/jsm/math/Octree.js

@@ -4,7 +4,8 @@ import {
 	Plane,
 	Sphere,
 	Triangle,
-	Vector3
+	Vector3,
+	Layers
 } from 'three';
 import { Capsule } from '../math/Capsule.js';
 
@@ -89,6 +90,7 @@ class Octree {
 
 		this.subTrees = [];
 		this.triangles = [];
+		this.layers = new Layers();
 
 	}
 
@@ -478,6 +480,8 @@ class Octree {
 
 			if ( obj.isMesh === true ) {
 
+			    if ( this.layers.test( obj.layers ) ) {
+
 				let geometry, isTemp = false;
 
 				if ( obj.geometry.index !== null ) {
@@ -513,6 +517,8 @@ class Octree {
 
 				}
 
+			    }
+
 			}
 
 		} );