{
  "name": "rug",
  "title": "Rug",
  "type": "registry:component",
  "description": "Procedural striped rug (seeded stripes, no textures).",
  "dependencies": [
    "@runek/core@^0.12.0"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "Rug.tsx",
      "content": "import { rng, useWorld, type Vec3 } from '@runek/core'\nimport { useMemo } from 'react'\n\nexport interface RugProps {\n  position?: Vec3\n  rotation?: Vec3\n  /** `[width, depth]` in units. */\n  size?: [number, number]\n  /** Defaults to the world palette's `fabric` slot. */\n  baseColor?: string\n  /** Defaults to the world palette's `accent` slot. */\n  borderColor?: string\n  accentColor?: string\n  seed?: number\n}\n\ninterface Stripe {\n  x: number\n  width: number\n}\n\n/** Decorative — flat, no collider; walk over it. */\nexport function Rug({\n  position = [0, 0, 0],\n  rotation = [0, 0, 0],\n  size = [3, 2],\n  baseColor,\n  borderColor,\n  accentColor = '#9c5252',\n  seed = 1,\n}: RugProps) {\n  const { unit, palette } = useWorld()\n  const baseCol = baseColor ?? palette.fabric\n  const borderCol = borderColor ?? palette.accent\n  const w = size[0] * unit\n  const d = size[1] * unit\n  const t = 0.02 * unit\n  const border = 0.12 * unit\n\n  const stripes = useMemo<Stripe[]>(() => {\n    const next = rng(seed)\n    const span = w - border * 2\n    const count = 3 + Math.floor(next() * 4)\n    return Array.from({ length: count }, () => ({\n      x: (next() - 0.5) * span,\n      width: (0.04 + next() * 0.08) * unit,\n    }))\n  }, [w, border, seed, unit])\n\n  return (\n    <group position={position} rotation={rotation}>\n      <mesh receiveShadow position={[0, t / 2, 0]}>\n        <boxGeometry args={[w, t, d]} />\n        <meshStandardMaterial color={borderCol} />\n      </mesh>\n      <mesh position={[0, t + 0.001 * unit, 0]} rotation={[-Math.PI / 2, 0, 0]}>\n        <planeGeometry args={[w - border * 2, d - border * 2]} />\n        <meshStandardMaterial color={baseCol} />\n      </mesh>\n      {stripes.map((s) => (\n        <mesh\n          key={`stripe-${s.x.toFixed(3)}`}\n          position={[s.x, t + 0.002 * unit, 0]}\n          rotation={[-Math.PI / 2, 0, 0]}\n        >\n          <planeGeometry args={[s.width, d - border * 2]} />\n          <meshStandardMaterial color={accentColor} />\n        </mesh>\n      ))}\n    </group>\n  )\n}\n",
      "type": "registry:component"
    }
  ]
}
