(function fake3DCube() {
var SCRIPT_NAME = "Fake 3D Cube";
var comp = app.project.activeItem;
if (!(comp && comp instanceof CompItem)) {
alert("Open a composition (or select one in the Project panel) and run the script again.", SCRIPT_NAME);
return;
}
// Unit cube corners. x right, y down, z away from the viewer.
var V = [
[-1, -1, -1], [1, -1, -1], [1, 1, -1], [-1, 1, -1], // front ring (z = -1, closest)
[-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1] // back ring
];
// Corners are listed clockwise as seen from outside the cube, so a face
// whose projected polygon has a positive area is facing the viewer.
var FACES = [