3dTest2.anim
Based on AtStripeE.anim by Heckbert, August 13, 1988 5:09:33 pm PDT
Bloomenthal, February 15, 1989 10:03:18 pm PST
t: G3dTool.ImageTool ← G3dInterpret.GetInterpretTool[].imageTool;
nframes: NAT ~ 12;
swid: NAT ← 640;
shei: NAT ← 480;
wid: NAT ← 160;
hei: NAT ← wid;
shape: ROPE ← "3dTest.shape";
model: G3dModel.Model ← G3dModel.ModelFromFile[fileName: shape, polygons: FALSE, faceNormals: FALSE, pts: FALSE, faceCenters: FALSE, edges: FALSE, curves: FALSE, normal: FALSE, center: FALSE, lines: FALSE, accs: FALSE, area: FALSE];
color: Imager.Color ← ImagerColor.ColorFromGray[0.1];
Command["Install ColorTrix"];
G3dInterpret.Op["AntiAliasing: false"];
G3dInterpret.Op["Background: (0.2, 0.2, 0.2)"];
G3dInterpret.Op["LookAt: (.05, 0, .09)"];
G3dInterpret.Op["FieldOfView: 22"];
Command["Ct Clear"];
FOR f: NAT IN [0..1) DO
nx: NAT ← swid/wid;
x0: NAT ← wid*(f MOD nx);
y0: NAT ← hei*(f/nx);
MessageToLog[IO.PutFR["\tRendering frame %g\n", [integer[f]]]];
G3dInterpret.OpInts["DisplayRegion", LIST[x0, y0, wid-1, hei-1]];
G3dTool.AddModel[t, model];
G3dInterpret.Op[Rope.Cat["ShapeName", model.name]];
G3dInterpret.Op["ShapePosition: ([0, -1, 0)"];
G3dInterpret.Op["ShapeBackFaces: False"];
G3dInterpret.OpInts["ShapeShininess", LIST[LAST[NAT]/2]]; -- shiny, smooth for jaggy tex
G3dInterpret.Op["ShapeRenderStyle smooth"];
G3dInterpret.Op["Render"];
CtMisc.PrintRope[IO.PutFR["%g", [integer[f]]], [x0+wid/2, y0+20], color]; -- label
ENDLOOP;