Add support for odd shaped coin prisms
This commit is contained in:
@@ -103,16 +103,20 @@ const SafeCoinMaterial = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const BaseCoin = ({ color, edge, obverse, orientation, reverse }: NumistaType) => {
|
||||
export const BaseCoin = ({ color, edge, obverse, orientation, reverse, shape }: NumistaType) => {
|
||||
const sides = useMemo(() => {
|
||||
// Const parsed = Number(/(\d+)/.exec(shape)?.[0]);
|
||||
// return Math.min(32, Math.max(4, isNaN(parsed) ? 32 : parsed));
|
||||
const parsed = shape && Number(/(\d+)/.exec(shape)?.[0]);
|
||||
|
||||
if(parsed && parsed <= 10) {
|
||||
return parsed
|
||||
}
|
||||
|
||||
return 32;
|
||||
}, []);
|
||||
}, [shape]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<cylinderGeometry args={[1, 1, 1, sides]} attach={'geometry'} />
|
||||
<cylinderGeometry args={[1, 1, 1, sides, undefined, undefined, sides%2===0?0:Math.PI/2]} attach={'geometry'} />
|
||||
|
||||
<SafeCoinMaterial color={color} side={'edge'} url={edge?.picture} />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user