← BásicoObjeto 3Dfogon/reflector
Reflector
Arrastrá para girarlo// «Reflector» · gpt-6-sol (medium)
// Spotlight («Reflector»).
// Industrial spotlight: gold barrel, warm reflector, black barn doors and stand.
const black = "#151c22";
const edge = "#202a32";
const steel = "#303b43";
const litSteel = "#46515a";
const gold = "#bd8429";
const goldLight = "#edbc49";
function diskY(cx, y, cz, r, color) {
for (let x = Math.floor(cx-r); x <= Math.ceil(cx+r); x++)
for (let z = Math.floor(cz-r); z <= Math.ceil(cz+r); z++)
if ((x-cx)**2 + (z-cz)**2 <= r*r) set(x,y,z,color);
}
// Deep, round lamp housing.
for (let y=18; y<=35; y++) {
for (let x=15; x<=33; x++) for (let z=19; z<=37; z++) {
const d = Math.hypot(x-24,z-28);
if (d>9.2) continue;
let c = z>31 ? goldLight : z<24 ? "#92601f" : gold;
if (d>8.15 || y>=34) c = black;
else if (y%5===0) c = "#80591f";
else if (rand()<0.075) c = z>29 ? "#dba43a" : "#a97523";
set(x,y,z,c);
}
}
// Long dark ribs across the curved gold shell.
for (const x of [17,21,27,31]) {
for (let y=20; y<=34; y++) {
for (let z=29; z<=38; z++) {
const d=Math.hypot(x-24,z-28);
if (d>7.75 && d<=9.25) set(x,y,z,z>=35 ? steel : edge);
}
}
}
diskY(24,36,28,8.2,black);
diskY(24,37,28,6.7,steel);
// Side pivot and the U-shaped cradle under the lamp.
box(11,25,24,16,30,29,black);
box(10,25,26,13,29,28,litSteel);
box(11,24,27,12,30,28,steel);
box(14,20,15,17,32,17,edge);
box(32,20,15,35,32,17,edge);
box(15,29,15,34,32,17,steel);
box(16,19,14,34,28,15,black);
box(19,22,15,30,28,17,steel);
// Front square cage, with thick beveled-looking rails.
box(14,15,17,16,18,37,black);
box(34,15,17,36,18,37,black);
box(15,15,37,36,18,39,edge);
box(15,15,17,36,18,19,edge);
box(16,14,39,35,17,40,steel);
box(17,14,40,33,16,40,litSteel);
for (const x of [15,35]) {
box(x,14,20,x,14,36,litSteel);
for (const z of [22,27,32,36]) {
box(x,13,z,x+1,14,z+1,"#7c8581");
set(x,12,z,"#abb0a0");
}
}
// Dark circular bezel, then a golden reflector with a faceted inner face.
for (let y=13; y<=17; y++) diskY(24,y,28,9.2,y===13 ? steel : black);
for (let x=15; x<=33; x++) for (let z=19; z<=37; z++) {
const d=Math.hypot(x-24,z-28);
if (d>8.25) continue;
let c;
if (d>7.2) c = z>28 ? "#e1af46" : "#9d6925";
else if (d>5.8) c = z>28 ? "#f1cb72" : "#d29940";
else if (d>3.5) c = z>28 ? "#f5d68d" : "#dcb268";
else c = "#f6e5b2";
if (rand()<0.19) c = d<5.7 ? "#fff0c1" : "#b98431";
set(x,12,z,c);
if (d<=6.3 && rand()<0.16) set(x,11,z,z>27?"#f9e5ad":"#e6c37b");
}
// Blocky glints and concentric highlights in the glass.
for (const [x,z] of [[22,31],[25,33],[27,30],[20,28],[23,25],[26,26],[24,29]]) {
box(x,11,z,x+1,11,z+1,"#fff0bb");
}
box(23,10,27,25,10,29,"#ffedb2");
set(24,10,30,"#fff7d3");
// Right-hand barn door, folded outward: ribbed black metal panel.
box(35,10,22,42,14,37,black);
box(37,9,23,42,10,36,edge);
for (const x of [37,39,41]) {
box(x,9,23,x,9,36,steel);
box(x,10,24,x,10,35,black);
}
box(42,9,22,43,13,37,edge);
box(42,9,36,43,11,37,litSteel);
box(34,11,23,36,16,35,steel);
for (const z of [24,29,34]) box(35,10,z,36,11,z,"#697278");
// Lower barn door tilted down below the lens.
box(18,10,15,37,15,19,black);
box(19,9,18,37,11,20,steel);
for (const z of [16,18,20]) box(19,9,z,36,10,z,edge);
box(19,9,20,35,10,20,litSteel);
box(35,11,15,38,14,17,edge);
// Splayed support legs, ribbed along their length.
line(16,19,16,13,14,3,2,black);
line(34,22,16,39,27,3,2,black);
line(16,18,16,13,14,3,1,steel);
line(34,21,16,39,27,3,1,steel);
for (let i=0;i<11;i++) {
const t=i/10;
const z=Math.round(15-12*t);
box(Math.round(16-3*t)-1,Math.round(19-5*t)-1,z,
Math.round(16-3*t)+1,Math.round(19-5*t)+1,z,litSteel);
box(Math.round(34+5*t)-1,Math.round(22+5*t)-1,z,
Math.round(34+5*t)+1,Math.round(22+5*t)+1,z,steel);
}
box(10,10,0,17,17,2,black);
box(11,11,2,16,16,2,steel);
box(36,23,0,43,30,2,black);
box(37,24,2,42,29,2,steel);
// Small rear stabilizing foot.
line(21,31,15,20,37,5,1,black);
box(16,34,3,24,40,4,black);
box(17,35,4,23,39,4,steel);import { draw } from "./assets/voxel";
import { reflector } from "./assets/reflector";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, reflector, x, y, { size: 64, angle: 0, t: performance.now() / 1000 });
// size: lo que mide en px su lado más largo
// angle: giro sobre el piso, en radianes
// t: segundos; si se mueve, se anima solo con eso# En una terminal, en la carpeta del juego
fogon assets add reflector
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["reflector"] })
# Queda en client/assets/reflector.ts
# https://fogon.page/object/reflector