Skip to content

Commit 882be4a

Browse files
committed
🐛 n-body: update app to new API
1 parent 065c1fc commit 882be4a

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

benches/apps/n-body/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ schedule.add(init, { tag: 'init' });
6161
schedule.build();
6262

6363
// Add Three resources to the world
64-
export const Three = trait({ renderer, camera, scene });
64+
export const Three = trait(() => ({ renderer, camera, scene }));
6565
world.add(Three);
6666

6767
// Init stats

benches/apps/n-body/src/systems/cleanupRepulsors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function cleanupBodies({ world }: { world: World }) {
1010
const instanceEntity = world.queryFirst(InstancedMesh);
1111
if (instanceEntity === undefined) return;
1212

13-
const instancedMesh = instanceEntity.get(InstancedMesh)!.object;
13+
const instancedMesh = instanceEntity.get(InstancedMesh)!;
1414

1515
world.query(Removed(Repulse, Position)).forEach((e) => {
1616
instancedMesh.setMatrixAt(e.id(), zeroScaleMatrix);

benches/apps/n-body/src/systems/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function init({ world }: { world: World }) {
2121
for (let i = 0; i < instancedMesh.count; i++) instancedMesh.setMatrixAt(i, zeroScaleMatrix);
2222

2323
scene.add(instancedMesh);
24-
world.spawn(InstancedMesh({ object: instancedMesh }));
24+
world.spawn(InstancedMesh(instancedMesh));
2525

2626
// Compile Three shaders.
2727
renderer.compile(scene, camera);

benches/apps/n-body/src/systems/syncThreeObjects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const syncThreeObjects = ({ world }: { world: World }) => {
1212
const instanceEnt = world.queryFirst(InstancedMesh);
1313
if (instanceEnt === undefined) return;
1414

15-
const instancedMesh = instanceEnt.get(InstancedMesh)!.object;
15+
const instancedMesh = instanceEnt.get(InstancedMesh)!;
1616

1717
world.query(Position, Circle, Color).updateEach(([position, circle, color], entity) => {
1818
dummy.position.set(position.x, position.y, 0);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { trait } from 'koota';
22
import type * as THREE from 'three';
33

4-
export const InstancedMesh = trait({ object: null! as THREE.InstancedMesh });
4+
export const InstancedMesh = trait(() => null! as THREE.InstancedMesh);

0 commit comments

Comments
 (0)