glodrei
Version:
useful add-ons for react-three-fiber
20 lines (17 loc) • 737 B
text/mdx
title: RoundedBox
sourcecode: src/core/RoundedBox.tsx
A box buffer geometry with rounded corners, done with extrusion.
```jsx
<RoundedBox
args={[1, 1, 1]} // Width, height, depth. Default is [1, 1, 1]
radius={0.05} // Radius of the rounded corners. Default is 0.05
smoothness={4} // The number of curve segments. Default is 4
bevelSegments={4} // The number of bevel segments. Default is 4, setting it to 0 removes the bevel, as a result the texture is applied to the whole geometry.
creaseAngle={0.4} // Smooth normals everywhere except faces that meet at an angle greater than the crease angle
{...meshProps} // All THREE.Mesh props are valid
>
<meshPhongMaterial color="#f3f3f3" wireframe />
</RoundedBox>
```