Skip to content

Commit

Permalink
Adapt to THREE changes
Browse files Browse the repository at this point in the history
  • Loading branch information
firtoz committed Oct 4, 2022
1 parent f7d8ce9 commit 1fb9d79
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-books-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-three/rapier": patch
---

Adapt to changes in THREE - rename [X]BufferGeometry to [X]Geometry
2 changes: 1 addition & 1 deletion demo/src/cluster/ClusterExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Cluster: Demo = () => {
linearDamping={5}
>
<instancedMesh args={[undefined, undefined, BALLS]} castShadow>
<sphereBufferGeometry args={[0.2]} />
<sphereGeometry args={[0.2]} />
<meshPhysicalMaterial
roughness={0}
metalness={0.5}
Expand Down
2 changes: 1 addition & 1 deletion demo/src/shapes/ShapesExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const RigidCylinder = memo(() => {
return (
<RigidBody colliders={false} position={[-4 + Math.random() * 8, 10, 0]}>
<mesh castShadow receiveShadow scale={1}>
<cylinderBufferGeometry args={[0.4, 0.4, 0.4, 16]} />
<cylinderGeometry args={[0.4, 0.4, 0.4, 16]} />
<meshPhysicalMaterial color={color} />
</mesh>
<CylinderCollider args={[0.2, 0.4]} />
Expand Down
2 changes: 1 addition & 1 deletion packages/react-three-rapier/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const Scene = () => {
colliders="ball"
>
<instancedMesh args={[undefined, undefined, COUNT]}>
<sphereBufferGeometry args={[0.2]} />
<sphereGeometry args={[0.2]} />
<meshPhysicalGeometry color="blue" />

<CuboidCollider args={[0.1, 0.2, 0.1]} />
Expand Down
22 changes: 11 additions & 11 deletions packages/react-three-rapier/src/Debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ import {
TriMesh
} from "@dimforge/rapier3d-compat";
import {
BoxBufferGeometry,
BoxGeometry,
BufferAttribute,
BufferGeometry,
CapsuleBufferGeometry,
CapsuleGeometry,
Color,
ConeBufferGeometry,
CylinderBufferGeometry,
ConeGeometry,
CylinderGeometry,
Mesh,
MeshBasicMaterial,
PlaneGeometry,
Quaternion,
SphereBufferGeometry
SphereGeometry
} from "three";
import { RoundedBoxGeometry } from "three-stdlib";

const geometryFromCollider = (collider: Collider) => {
switch (collider.shape.type) {
case ShapeType.Cuboid: {
const { x, y, z } = (collider.shape as Cuboid).halfExtents;
return new BoxBufferGeometry(x * 2 + 0.01, y * 2 + 0.01, z * 2 + 0.01);
return new BoxGeometry(x * 2 + 0.01, y * 2 + 0.01, z * 2 + 0.01);

break;
}
Expand All @@ -63,7 +63,7 @@ const geometryFromCollider = (collider: Collider) => {

case ShapeType.Ball: {
const r = (collider.shape as Ball).radius;
return new SphereBufferGeometry(r + +0.01, 8, 8);
return new SphereGeometry(r + +0.01, 8, 8);

break;
}
Expand Down Expand Up @@ -101,7 +101,7 @@ const geometryFromCollider = (collider: Collider) => {
const r = (collider.shape as Cylinder).radius;
const h = (collider.shape as Cylinder).halfHeight;

const g = new CylinderBufferGeometry(r, r, h * 2);
const g = new CylinderGeometry(r, r, h * 2);

return g;

Expand All @@ -112,7 +112,7 @@ const geometryFromCollider = (collider: Collider) => {
const r = (collider.shape as Cylinder).radius;
const h = (collider.shape as Cylinder).halfHeight;

const g = new CapsuleBufferGeometry(r, h * 2, 4, 8);
const g = new CapsuleGeometry(r, h * 2, 4, 8);

return g;

Expand All @@ -123,7 +123,7 @@ const geometryFromCollider = (collider: Collider) => {
const r = (collider.shape as Cone).radius;
const h = (collider.shape as Cone).halfHeight;

const g = new ConeBufferGeometry(r, h * 2, 16);
const g = new ConeGeometry(r, h * 2, 16);

return g;

Expand Down Expand Up @@ -153,7 +153,7 @@ const geometryFromCollider = (collider: Collider) => {
}
}

return new BoxBufferGeometry(1, 1, 1);
return new BoxGeometry(1, 1, 1);
};

interface DebugShapeProps extends DebugProps {
Expand Down

0 comments on commit 1fb9d79

Please sign in to comment.