{
const { Camera, Vector3, Color, Box, Red, Sphere, render } = skewed;
const container = document.createElement("div");
let lightingScenario = ["reference", "moonlit"][1];
let ambientLightColor, directionalLightColor;
if (lightingScenario === "moonlit") {
ambientLightColor = {
r: 64,
g: 64,
b: 120
};
directionalLightColor = {
r: 255,
g: 252,
b: 181
};
} else {
ambientLightColor = {
r: 64,
g: 64,
b: 64
};
directionalLightColor = {
r: 255,
g: 252,
b: 255
};
}
const boxStrokeWidth = 3;
const scene = {
directionalLight: {
type: "directional light",
direction: Vector3(1, 0.75, 0).normalize(),
color: Color(
directionalLightColor.r - ambientLightColor.r,
directionalLightColor.g - ambientLightColor.g,
directionalLightColor.b - ambientLightColor.b
)
},
ambientLightColor,
shapes: [
Box({
position: Vector3(0, 50, 150),
rotation: Vector3(0, 0, 0),
scale: 1.0,
width: 100,
height: 100,
depth: 100,
fill: Red,
stroke: Color(0, 0, 0),
strokeWidth: boxStrokeWidth
}),
Box({
position: Vector3(0, 200, -350),
rotation: Vector3(0, 0, 0),
scale: 1.0,
width: 100,
height: 400,
depth: 100,
fill: Color(255, 255, 255),
stroke: Color(0, 0, 0),
strokeWidth: boxStrokeWidth
}),
Sphere({
position: Vector3(200, 70, 0),
rotation: Vector3(0, 0, 0),
scale: 1.0,
radius: 70,
fill: Color(255, 128, 0),
stroke: Color(0, 0, 0, 0),
strokeWidth: 4
})
]
};
const camera = skewed.Camera();
const viewport = {
left: 0,
top: 0,
width: 400,
height: 400
};
render(container, scene, viewport, camera);
return container;
}