fogón

← EquipamientoObjeto 3Dfogon/casco-de-caballero

Casco de caballero

de fogonCC018053 bloques
Casco de caballeroArrastrá para girarlo
// «Casco de caballero» · gpt-6-sol (medium)
// A closed knight's great helm: a tall barrel-shaped steel helmet with a flat top, a horizontal eye slit and small breathing holes on the front (-y), a vertical brass cross-shaped reinforcement on the face and rivets around the base. It stands upright on the floor (z=0), facing front (-y), centered, chunky and readable.

const steelDark = "#56616a";
const steel = "#78858d";
const steelLight = "#a9b5ba";
const steelEdge = "#d0d7d5";
const brassDark = "#765222";
const brass = "#bd8a38";
const brassLight = "#e5b85e";
const shadow = "#20282d";

const cx = 24, cy = 24;
const power = 3.5;

function inside(x, y, rx, ry) {
  return Math.pow(Math.abs(x - cx) / rx, power) +
         Math.pow(Math.abs(y - cy) / ry, power) <= 1;
}

function radii(z) {
  if (z === 0) return [16.5, 14.5];
  if (z >= 38) return [17, 15];
  return [18, 16];
}

// Hollow barrel, with a sturdy closed, flat crown.
for (let z = 0; z <= 39; z++) {
  const [rx, ry] = radii(z);
  for (let x = 5; x <= 43; x++) {
    for (let y = 7; y <= 41; y++) {
      if (!inside(x, y, rx, ry)) continue;
      const interior = inside(x, y, rx - 3.5, ry - 3.5);
      if (interior && z > 1 && z < 36) continue;

      let color = y < 18 ? steel : steelDark;
      if (z > 22 || y < 11) color = steelLight;
      if (rand() < 0.075) color = steelDark;
      else if (rand() < 0.045) color = steelLight;

      if (z === 0 || z === 1) color = steelDark;
      if (z === 2 || z === 36) color = steelEdge;
      if (z === 37) color = steelDark;
      if (z === 38 || z === 39) color = steelLight;
      set(x, y, z, color);
    }
  }
}

// Find the curved front of the helmet at a particular height.
function front(x, z) {
  for (let y = 6; y <= 24; y++) {
    if (get(x, y, z)) return y;
  }
  return null;
}

// Two deeply recessed eye openings, separated by the nose guard.
for (let z = 27; z <= 29; z++) {
  for (let x = 11; x <= 37; x++) {
    const opening = (x >= 12 && x <= 20) ||
                    (x >= 28 && x <= 36) ||
                    (z === 28 && (x === 11 || x === 37));
    if (!opening) continue;
    const y = front(x, z);
    if (y === null) continue;
    for (let d = 0; d <= 4; d++) set(x, y + d, z, null);
    set(x, y + 5, z, shadow);
    if (z === 29) set(x, y + 4, z, "#343d42");
  }
}

// Thick steel edges make the horizontal slit legible.
for (let x = 11; x <= 37; x++) {
  if (x > 20 && x < 28) continue;
  for (const z of [26, 30]) {
    const y = front(x, z);
    if (y !== null) set(x, y - 1, z, z === 30 ? steelEdge : steelDark);
  }
}

// Paired square ventilation perforations below the eyes.
for (const z0 of [12, 17, 21]) {
  for (const x0 of [15, 19, 29, 33]) {
    for (let dx = 0; dx < 2; dx++) {
      for (let dz = 0; dz < 2; dz++) {
        const x = x0 + dx, z = z0 + dz;
        const y = front(x, z);
        if (y === null) continue;
        set(x, y - 1, z, shadow);
        set(x, y, z, shadow);
        set(x, y + 1, z, "#323b3f");
      }
    }
  }
}

// Broad brass cross: horizontal brow plate and uninterrupted nose strip.
for (let x = 12; x <= 36; x++) {
  for (let z = 23; z <= 25; z++) {
    const y = front(x, z);
    if (y === null) continue;
    set(x, y - 2, z, z === 25 ? brassLight : brass);
    if (z === 23) set(x, y - 2, z, brassDark);
  }
}
for (let z = 5; z <= 35; z++) {
  for (let x = 22; x <= 25; x++) {
    const y = front(x, z);
    if (y === null) continue;
    set(x, y - 2, z, x === 22 ? brassLight : x === 25 ? brassDark : brass);
  }
}

// Riveted lower rim, following the curved circumference.
for (let i = 0; i < 30; i++) {
  const a = 2 * Math.PI * i / 30;
  const x = Math.round(cx + 18 * Math.cos(a));
  const y = Math.round(cy + 16 * Math.sin(a));
  if (!get(x, y, 4)) continue;
  const ox = Math.round(Math.cos(a));
  const oy = Math.round(Math.sin(a));
  set(x + ox, y + oy, 4, brassDark);
  set(x + ox, y + oy, 5, brassLight);
}

// Raised top edge and a few bright forged-metal highlights.
for (let x = 7; x <= 41; x++) {
  const y = front(x, 36);
  if (y !== null && x % 3 !== 0) set(x, y - 1, 36, steelEdge);
}