Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to THREE changes #123

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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