fogón

← MedievalObjeto 3Dfogon/barriles

Barriles

de fogonCC019535 bloques
BarrilesArrastrá para girarlo
// «Barriles» · gpt-6-sol (medium)
// A group of three wooden barrels: two standing upright side by side and one lying on its side on top of them, each with bulging curved staves in warm brown shades, two black iron hoops near the top and bottom, round lids with plank lines, and a small wooden tap on the lying one.

const wood = ["#704025", "#814b2b", "#925733", "#a9683d"];
const woodLight = ["#8d522f", "#a36339", "#b47545"];
const iron = "#242525";
const ironEdge = "#424343";
const ironLight = "#62615c";

function shade(palette, light = 0) {
  const n = Math.floor(rand() * 12);
  return palette[Math.max(0, Math.min(palette.length - 1, 1 + light + (n === 0 ? -1 : n === 11 ? 1 : 0)))];
}

function upright(cx) {
  const cy = 25, height = 22;

  for (let z = 0; z <= height; z++) {
    const r = 7.5 + 1.6 * Math.sin(Math.PI * z / height);
    for (let x = cx - 10; x <= cx + 10; x++) {
      for (let y = cy - 10; y <= cy + 10; y++) {
        const dx = x - cx, dy = y - cy;
        const d = Math.hypot(dx, dy);
        if (d > r) continue;

        const surface = d > r - 1.5;
        const angle = (Math.atan2(dy, dx) + Math.PI * 2) % (Math.PI * 2);
        const seam = ((angle / (Math.PI * 2)) * 14) % 1;
        let color = shade(wood, z > 11 || y < cy - 2 ? 1 : 0);

        if (surface && (seam < 0.075 || seam > 0.94))
          color = "#60371f";

        if (z === 22) {
          // Flat, planked circular lid.
          color = shade(woodLight, 0);
          if ((x - cx + 12) % 4 === 0) color = "#693d24";
          if (d > r - 1.4) color = "#563421";
        }

        if ((z >= 3 && z <= 4) || (z >= 18 && z <= 19)) {
          if (surface) color = z === 4 || z === 19 ? ironEdge : iron;
        }
        if (z === 20 && surface) color = ironLight;

        set(x, y, z, color);
      }
    }
  }

  // Raised rivets on the visible fronts of both hoops.
  for (const z of [3, 19]) {
    for (const dx of [-4, 0, 4]) {
      const r = 7.5 + 1.6 * Math.sin(Math.PI * z / height);
      const y = cy - Math.floor(Math.sqrt(r * r - dx * dx));
      set(cx + dx, y - 1, z, ironLight);
    }
  }
}

upright(14);
upright(34);

// The third barrel rests across both upright lids.
const cy = 25, cz = 32;
for (let x = 5; x <= 43; x++) {
  const t = (x - 5) / 38;
  const r = 7.5 + 1.7 * Math.sin(Math.PI * t);

  for (let y = cy - 10; y <= cy + 10; y++) {
    for (let z = cz - 10; z <= cz + 10; z++) {
      const dy = y - cy, dz = z - cz;
      const d = Math.hypot(dy, dz);
      if (d > r) continue;

      const surface = d > r - 1.5;
      const angle = (Math.atan2(dz, dy) + Math.PI * 2) % (Math.PI * 2);
      const seam = ((angle / (Math.PI * 2)) * 14) % 1;
      let color = shade(wood, z > cz || y < cy - 2 ? 1 : 0);

      if (surface && (seam < 0.075 || seam > 0.94))
        color = "#60371f";

      // Round, planked lids on both ends.
      if (x === 5 || x === 43) {
        color = shade(woodLight, z > cz ? 1 : 0);
        if ((z - cz + 12) % 4 === 0) color = "#704228";
        if (d > r - 1.5) color = iron;
      } else if (x === 6 || x === 42) {
        if (surface) color = "#563522";
      }

      // Two broad iron hoops wrap around the curved barrel.
      if ((x >= 9 && x <= 11) || (x >= 37 && x <= 39)) {
        if (surface) color = (x === 11 || x === 39) ? ironEdge : iron;
      }
      if ((x === 12 || x === 36) && surface) color = "#65452f";

      set(x, y, z, color);
    }
  }
}

// Hoop rivets along the front of the lying barrel.
for (const x of [10, 38]) {
  for (const dz of [-4, 0, 4]) {
    const r = 7.5 + 1.7 * Math.sin(Math.PI * (x - 5) / 38);
    const y = cy - Math.floor(Math.sqrt(r * r - dz * dz));
    set(x, y - 1, cz + dz, ironLight);
  }
}

// Small wooden tap, projecting toward the viewer.
box(25, 10, 30, 28, 16, 32, "#63391f");
box(26, 9, 30, 27, 15, 31, "#aa6a37");
box(25, 14, 29, 28, 15, 33, "#463021"); // mounting collar
box(25, 8, 28, 28, 11, 30, "#84502a");
box(26, 7, 28, 27, 9, 29, "#ba7941");
box(24, 10, 33, 29, 12, 34, "#a96636"); // turning handle
box(26, 10, 32, 27, 12, 35, "#704223");
set(26, 8, 28, "#4a2e1f");
set(27, 8, 28, "#4a2e1f");