You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -53,8 +53,8 @@ const grid = new OBC.SimpleGrid(components);
53
53
54
54
*/
55
55
56
-
constculler=newOBC.ScreenCuller(components);
57
-
awaitculler.setup();
56
+
constcullers=newOBC.Cullers(components);
57
+
constculler=cullers.create(world);
58
58
59
59
/* MD
60
60
@@ -63,18 +63,18 @@ await culler.setup();
63
63
64
64
*/
65
65
66
-
culler.elements.threshold=200;
66
+
culler.threshold=200;
67
67
68
68
/* MD
69
69
70
-
Additionally, we will activate the `culler.elements.renderDebugFrame`
70
+
Additionally, we will activate the `culler.renderDebugFrame`
71
71
so that we can see the 2D screen of the elements that are not occluded.💻
72
72
Also, we will get the **domElement** and attach it to the body so that we can see this frame in real-time.📊
73
73
74
74
*/
75
75
76
-
culler.elements.renderDebugFrame=true;
77
-
constdebugFrame=culler.elements.get().domElement;
76
+
culler.renderDebugFrame=true;
77
+
constdebugFrame=culler.renderer.domElement;
78
78
document.body.appendChild(debugFrame);
79
79
debugFrame.style.position="fixed";
80
80
debugFrame.style.left="0";
@@ -117,7 +117,7 @@ const material = new THREE.MeshLambertMaterial({ color: "#6528D7" });
117
117
and randomly position them. We'll add the cube to the scene and adjust its position between 0 and 10.
118
118
119
119
Additionally, we will add meshes to the `culler` object, which will help **SimpleCuller** to recognize and
120
-
draw the elements that are visible to the camera. To do this, **`culler.elements.add(cube)`** will be used.
120
+
draw the elements that are visible to the camera. To do this, **`culler.add(cube)`** will be used.
121
121
122
122
Also, now that we can create multiple cubes, we will write a function to remove the cubes from scene on demand.
123
123
`resetCubes()` iteratively removes the **cubes** using [**`cube.removeFromParent`**](https://threejs.org/docs/index.html?q=obje#api/en/core/Object3D.removeFromParent).
@@ -139,8 +139,8 @@ function regenerateCubes() {
139
139
cube.position.y=getRandomNumber(10);
140
140
cube.position.z=getRandomNumber(10);
141
141
cube.updateMatrix();
142
-
scene.add(cube);
143
-
culler.elements.add(cube);
142
+
world.scene.three.add(cube);
143
+
culler.add(cube);
144
144
cubes.push(cube);
145
145
}
146
146
}
@@ -158,16 +158,16 @@ regenerateCubes();
158
158
Here comes the most crucial part! The core aim of **ScreenCuller** is to output just those components that are
159
159
visible to the camera.
160
160
161
-
`culler.elements.needsUpdate = true` instructs the ScreenCuller to render the updated view.
161
+
`culler.needsUpdate = true` instructs the ScreenCuller to render the updated view.
162
162
163
163
** Remember to update culler every time the camera is updated ❕ **
164
164
165
165
In this tutorial we are updating it each time the camera stops moving.
0 commit comments