fogón

← BásicoObjeto 3Dfogon/cofre-del-tesoro-v1

Cofre del tesoro

de fogonCC025356 bloques
Cofre del tesoroArrastrá para girarlo
// «Cofre del tesoro» · gpt-6-sol (medium)
// Treasure chest («Cofre del tesoro»). One of several variations of this object: follow the reference picture closely.

// Open treasure chest: x is its length, and the front faces -y.
const wood = ["#71391f", "#884522", "#a65328", "#bb642f"];
const silver = "#aab5b5";
const bright = "#dce4df";
const darkMetal = "#667477";

// Solid bottom and recessed interior.
box(6, 10, 0, 41, 35, 3, "#493026");
box(7, 11, 3, 40, 34, 7, "#482b1b");
box(8, 12, 7, 39, 33, 14, "#241b17");

// Wooden walls, built in horizontal planks.
for (let z = 4; z <= 17; z++) {
  const c = wood[Math.floor((z - 4) / 4) % wood.length];
  box(6, 10, z, 41, 12, z, c);
  box(6, 33, z, 41, 35, z, c);
  box(6, 13, z, 8, 32, z, c);
  box(39, 13, z, 41, 32, z, c);
}

// Warm highlights on the exposed front and left faces.
for (let z = 5; z <= 16; z += 4) {
  box(9, 9, z, 39, 9, z, "#b0602e");
  box(5, 13, z, 5, 32, z, "#94502a");
}
box(9, 9, 5, 39, 9, 15, "#9a4d28");
for (let z of [8, 12]) box(9, 8, z, 39, 8, z, "#71371f");
for (let x of [12, 22, 33]) box(x, 8, 6, x, 8, 15, "#aa5429");

// Metal foot and heavy rectangular frame.
box(5, 9, 0, 42, 36, 1, darkMetal);
box(6, 8, 1, 41, 9, 2, silver);
box(5, 10, 1, 6, 35, 2, "#899798");
box(41, 10, 1, 42, 35, 2, silver);
box(6, 35, 1, 41, 36, 2, darkMetal);

for (let x of [6, 17, 40]) {
  box(x, 8, 3, x + 1, 9, 18, darkMetal);
  box(x, 8, 5, x, 8, 18, bright);
}
for (let y of [10, 25, 34]) {
  box(4, y, 3, 6, y + 1, 18, darkMetal);
  box(4, y, 6, 4, y, 17, silver);
}
box(6, 8, 16, 41, 9, 18, silver);
box(7, 8, 18, 41, 8, 18, bright);
box(5, 10, 17, 7, 35, 18, silver);
box(40, 10, 17, 42, 35, 18, silver);
box(7, 34, 17, 40, 36, 18, "#929d9c");
box(8, 11, 17, 39, 12, 17, "#47504b");
box(8, 32, 17, 39, 33, 17, "#47504b");

// Small rivets on the iron corner fittings.
for (let x of [7, 18, 41])
  for (let z of [4, 14]) set(x, 7, z, bright);
for (let y of [11, 26, 35])
  for (let z of [4, 14]) set(4, y, z, bright);

// Raised iron lock plate and keyhole.
box(26, 7, 9, 31, 8, 15, darkMetal);
box(27, 6, 11, 30, 7, 15, silver);
box(28, 5, 11, 29, 6, 13, bright);
set(28, 5, 12, "#34403e");
set(28, 5, 11, "#34403e");

// Glittering, uneven heap of gold in the dark opening.
ellipsoid(24, 23, 16, 15, 9, 3, "#b87815");
for (let x = 10; x <= 38; x++) {
  for (let y = 14; y <= 31; y++) {
    const d = ((x - 24) / 15) ** 2 + ((y - 23) / 10) ** 2;
    if (d < 1 && rand() > 0.17) {
      const z = 18 + Math.floor((1 - d) * 3 + rand() * 2);
      set(x, y, z, ["#d49919", "#f4c536", "#ffe167", "#b77b12"][Math.floor(rand() * 4)]);
      if (rand() > 0.76) set(x, y, z + 1, "#ffe87b");
    }
  }
}
for (let i = 0; i < 22; i++) {
  const x = 11 + Math.floor(rand() * 26);
  const y = 15 + Math.floor(rand() * 15);
  const z = 19 + Math.floor(rand() * 3);
  box(x, y, z, x + 2, y + 1, z, rand() > 0.4 ? "#f5ca38" : "#ffe16a");
}

// A ruby and a blue-green jewel nestled among the coins.
box(18, 19, 21, 21, 22, 23, "#ac2946");
box(19, 18, 22, 20, 21, 24, "#e34465");
set(19, 18, 24, "#ff8191");
box(29, 23, 21, 32, 25, 22, "#167b82");
box(30, 22, 22, 31, 24, 24, "#40d6bd");
set(30, 22, 24, "#a3f2cf");

// The lid is tipped open behind the gold.
const roof = [27, 29, 31, 32, 33, 34, 34, 35, 35, 36, 36,
              36, 36, 36, 36, 35, 35, 35, 34, 34, 33];
function underside(y) {
  return 25 + Math.floor((y - 19) * 0.25);
}
for (let y = 19; y <= 39; y++) {
  const top = roof[y - 19];
  const bottom = underside(y);
  for (let x = 6; x <= 41; x++) {
    for (let z = bottom; z <= top; z++) {
      let c = z <= bottom + 1 ? "#492718" : "#8a421f";
      if (z >= top - 1) {
        c = y < 23 ? "#a34e25" : y < 31 ? "#b45a29" : "#a45025";
        if (y === 24 || y === 30 || y === 35) c = "#713819";
        if (z === top && rand() > 0.93) c = "#ca7135";
      }
      set(x, y, z, c);
    }
  }
  // Dark, rounded wooden end grain on the left.
  for (let z = bottom + 1; z < top; z++)
    set(5, y, z, z % 3 ? "#76391e" : "#994b25");
}

// Bright iron lip, curved end edging, and straps crossing the lid.
for (let x = 5; x <= 42; x++) {
  box(x, 18, 25, x, 19, 26, darkMetal);
  set(x, 18, 27, bright);
  set(x, 19, 28, silver);
}
for (let y = 20; y <= 39; y++) {
  const t = roof[y - 19];
  set(5, y, t, silver);
  set(6, y, t + 1, bright);
  for (let x of [12, 13, 35, 36]) {
    set(x, y, t + 1, x === 12 || x === 35 ? bright : silver);
    if (y === 20 || y === 39) set(x, y, t, darkMetal);
  }
}
box(6, 38, 32, 41, 39, 33, silver);

// Rear hinge arms join the open lid to the chest.
for (let x of [12, 36]) {
  line(x, 35, 17, x, 38, 29, 1, darkMetal);
  line(x, 35, 19, x, 38, 29, 0, bright);
}