ThreeDTest.cm
Last Edited by: Crow, February 6, 1987 11:40:16 am PST
Use these command lines as input to the interpreter for greater possibilities
Don't try to use this mode of control while demo button commands are still running!
&sgf[ThreeDDemoImpl] -- first, set the global frame
Panic Stops - In case your cursor is locked or something like that
StopEverything[]
Render Modes and Viewports
ChangeRenderMode[$Dithered] --this mode uses the imager where possible
ChangeRenderMode[$PseudoClr]
ChangeRenderMode[$Grey]
Reset[] -- clear scene of objects
SetDepthBuffer[] -- get depth buffer, use in jaggy mode
NoDepthBuffer[] -- undo SetDepthBuffer
SetAntiAliased[] -- get alpha buffer, make antialised images
SetAliased[] -- undo SetAntiAliased
SetViewPort[ [0.0, 0.0, 640.0, 453.0] ] -- defaults
ThreeDScenes.SetWindow[ context3d, [-1.0, -.7078125, 2.0, 1.415625] ]
ThreeDScenes.SetView[context3d, [2.0, -10.0, 3.0], [0.0, 0.0, 0.0] ]
SetViewPort[ [120.0, 90.0, 400.0, 300.0] ] -- for 640 x 480
SetViewPort[ [311.0, 228.0, 400.0, 300.0] ] -- for 1024 x 768
ThreeDScenes.SetWindow[ context3d, [-.2, -.15, 0.4, 0.3] ] -- zoom in on middle (25x area)
ThreeDScenes.SetView[context3d, [0.0, -20.0, 4.0], [0.0, 0.0, 0.0] ] -- longer range view
ThreeDScenes.FillViewPort[context3d, [0.1, 0.1, 0.6] ] -- clear viewport to dark blue
MakeFrame[] -- display current scene
ThreeDMisc.MakeInterpressPage[context3d, "PageFile.interpress"] -- interpress from scene
Lighting and Background
ThreeDMisc.SetBackground[ context3d, "Light Blue" ]
context3d.props ← Atom.PutPropOnList[context3d.props, $BackGround, NIL] -- kill background
ThreeDMisc.SetAmbientLight[ context3d, "Dark Grey" ]
ThreeDScenes.SetLight[context: context3d, name: "Initial", position: [500.0, -200.0, 10.0], color: [1.0, 1.0, 0.7] ]
ColorMap Fiddling -- set color display to 8-bits
ThreeDMisc.Show8BitClrMap[context3d] -- display color map
ThreeDMisc.LoadStd8BitClrMap[Terminal.Current[]]
ThreeDMisc.LoadColorRamp[Terminal.Current[], [.0,.0,.0], [.7,.0,1.0], [.4,.4,.4]] -- purple ramp
ThreeDMisc.LoadMultiRamps[Terminal.Current[], LIST[ [1.0, .0, .0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [1.0, .0, .0] ] ] -- red, green, blue, red
ThreeDMisc.Rotate8BitClrMap[Terminal.Current[], 1, 254, 10] -- psychedelia!
ThreeDMisc.AdjustValueRamp[context3d, [.43, .43, .43]] -- apply TRC to image pixels
Text
ThreeDMisc.SetNamedColor[context3d, "vivid green"] -- colors not guaranteed on 8-bit display
ThreeDMisc.ShowRope[context3d, 60.0, 60.0, "Look at the pretty picture!!.", "Xerox/Pressfonts/TimesRoman-MRR", 20.0]
Use Your Own Objects
Reset[]
ThreeDMisc.AddShapeAt[ context: context3d, shapeName: "YourShape", fileName: "/User/You/Shapes/YourShape.shape", position: [0.0, 0.0, 0.0]]
ThreeDMisc.SetFacetedColor[ context3d, "YourShape", [.4, .8, .4] ] -- pea green
MakeFrame[]
Saving and Restoring scenes
ThreeDMisc.SaveOnFile[context3d, "YourScene.scene" ]
ThreeDMisc.RestoreFromFile[context3d, "YourScene.scene" ]
AIS Files: Writing and Reading
AISAnimation.GetAIS[context: context3d, fileRoot: "Temp.ais", xOffset: 20, yOffset: 100, center: FALSE ]
AISAnimation.PutAIS[context3d, "Temp.ais" ]
AISAnimation.GetAIS[context3d, "Temp.ais" ] -- will be automatically centered
Gallery - Interesting images 24-bit
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/Glasses.ais" ]
AISAnimation.GetAIS[context3d, "/Pixel/Crow/PlasticWare.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/TwistedEgg.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/WurlitzerEgg.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/PerlinEggs.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/Spoon.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/BowlAndSpoon.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/ClrdMarbleEgg.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/SphereWithPage.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/SphereWithPages.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/PagedTeaPot.ais" ]
AISAnimation.GetAIS[context3d, "/cyan/AIS/Crow/ClrdMarbleTeaPot1.ais" ]
Animations -- set color display to 8-bits
Reset[]
SetUpMovie[ fileRoot: "/Cyan/AIS/Animation/LakeSceneTest.ais", viewPort: [196.0, 144.0, 256.0, 192.0], numFiles: 64, start: 0];
ThreeDMisc.SetUpTerrainColors[Terminal.Current[]]
Reset[]
SetUpMovie[ fileRoot: "/Saratoga/Cedar/Users/Crow.pa/AIS/Animation/Paper2Web.ais", viewPort: [120.0, 90.0, 400.0, 300.0], numFiles: 40, start: 0]
ChangeRenderMode[$Grey]
Reset[]
SetUpMovie[ fileRoot: "/Saratoga/Cedar/Users/Crow.pa/AIS/Animation/Paper3Web.ais", viewPort: [120.0, 90.0, 400.0, 300.0], numFiles: 40, start: 0]
ChangeRenderMode[$Grey]
Reset[]
SetUpMovie[ fileRoot: "/Saratoga/Cedar/Users/Crow.pa/AIS/Animation/PaperWeb.ais", viewPort: [120.0, 90.0, 400.0, 300.0], numFiles: 40, start: 0]
ChangeRenderMode[$Grey]
Reset[] -- built-in animation in ThreeDDemo
SetUpMovie[ fileRoot: "/Pixel/Crow/Animation/StillCloser.ais", viewPort: [120.0, 90.0, 400.0, 300.0], numFiles: 30, start: 1];
ChangeRenderMode[$PseudoClr];
Texture Generation -- set color display to 8-bits
Reset[]
ChangeRenderMode[$Grey]
SetViewPort[ [220.0, 140.0, 200.0, 200.0] ]
ThreeDMisc.MakeStripes[context: context3d, numStripes: 12, min: 0.2, max: 0.8, power: 1.0]
AISAnimation.PutAIS[context3d, "Texture.ais" ]
ThreeDMisc.MakeStretchedSpots[context: context3d, spotsAcross: 16, min: 0.0, max: 1.0, power: 1.0, stretched: FALSE]
AISAnimation.PutAIS[context3d, "Texture.ais" ]
Texture Mapped Glasses -- set color display to 24-bits
Reset[]
SetAntiAliased[] -- same as pushing the "NoJaggy" button
ThreeDMisc.AddShapeAt[ context3d, "ChampagneGlass", "ChampagneGlass.shape", [-2.0, .0, .0] ]
TextureMaps.SetTexture[ ThreeDScenes.FindShape[ context3d.shapes, "ChampagneGlass" ], TextureMaps.TextureFromAIS[context3d, "/Cedar/CedarChest6.0/ThreeDWorld/Texture.ais", NIL] ]
ThreeDMisc.SetSmoothColor[ context3d, "ChampagneGlass", [0.0, 1.0, 0.2] ]
TextureMaps.MakeTxtrCoordsFromVtxNos[ ThreeDScenes.FindShape[ context3d.shapes, "ChampagneGlass" ], 19, 20, [0.0, 0.0], [1.0, 3.0], [3.0, 3.0], [2.0, 0.0] ]
ThreeDScenes.SetLight[context3d, "Initial", [100.0, 0.0, 100.0], [1.0, 1.0, 0.7] ]
TextureMaps.SumTexture[ ThreeDScenes.FindShape[ context3d.shapes, "ChampagneGlass" ] ]
ThreeDMisc.AddShapeAt[ context3d, "ChampagneGlass2", "ChampagneGlass.shape", [2.0, .0, .0] ]
TextureMaps.SetTexture[ ThreeDScenes.FindShape[ context3d.shapes, "ChampagneGlass2" ], TextureMaps.TextureFromAIS[context3d, "/Cedar/CedarChest6.0/ThreeDWorld/Texture.ais", $Bump] ]
ThreeDMisc.SetSmoothColor[ context3d, "ChampagneGlass2", [0.0, 0.2, 1.0] ]
TextureMaps.MakeTxtrCoordsFromVtxNos[ ThreeDScenes.FindShape[ context3d.shapes, "ChampagneGlass2" ], 19, 20, [0.0, 0.0], [1.0, 3.0], [3.0, 3.0], [2.0, 0.0] ]
TextureMaps.SumTexture[ ThreeDScenes.FindShape[ context3d.shapes, "ChampagneGlass2" ] ]
ThreeDScenes.SetView[context3d, [0.0, -12.0, 3.0], [0.0, 0.0, 0.0] ]
MakeFrame[] -- this will take a while
Eggs with Space-Filling texture -- set color display to 24-bits
Reset[]
SetAntiAliased[]
ThreeDMisc.AddShapeAt[ context3d, "Egg", Rope.Cat[wDir, "UtahEgg.shape"], [0.0, 0.0, 0.0]]
ThreeDMisc.SetSmoothColor[ context3d, "Egg", [1.0, 1.0, .0] ]
ThreeDScenes.SetView[context3d, [0.0, -12.0, 0.0], [0.0, 0.0, 0.0] ]
ThreeDMisc.GetShadingProcs[context3d, "Egg", ShadingProcs.GetLerpedVals, ShadingProcs.TwistedStripes ]
MakeFrame[]
ThreeDMisc.SetSmoothColor[ context3d, "Egg", [1.0, 1.0, 1.0] ]
ThreeDScenes.SetView[context: context3d, eyePoint: [6.0, -6.0, 3.0], ptOfInterest: [0.0, 0.0, 0.0], rollAngle: 90.0 ]
ThreeDMisc.GetShadingProcs[context3d, "Egg", ShadingProcs.GetLerpedVals, ShadingProcs.Wurlitzer ]
MakeFrame[]
ThreeDMisc.GetShadingProcs[context3d, "Egg", ShadingProcs.GetLerpedVals, ShadingProcs.Marble ]
MakeFrame[]
ThreeDMisc.GetShadingProcs[context3d, "Egg", ShadingProcs.GetLerpedVals, ShadingProcs.Marble ]
MakeFrame[]
Bezier Patch Objects
Reset[]
ThreeDMisc.AddShapeAt[ context3d, "Sphere", "DoughNut.shape", [0.0, 0.0, 0.0]]
ThreeDSurfaces.ShapeSubdivide[ context3d, ThreeDScenes.FindShape[ context3d.shapes, "DoughNut" ] ] -- subdivide to 4 times as many patches
ThreeDSurfaces.ShapeExpand[ context3d, ThreeDScenes.FindShape[ context3d.shapes, "DoughNut" ], NIL, 10.0 ] -- expand to 100 polygons per patch
Shape editing example, extract lid from teapot
ThreeDMisc.AddShapeAt[ context3d, "TeaPot", "TeaPotWithBot.shape", [0.0, 0.0, -1.25]]
ThreeDScenes.AddShape[ context3d.shapes, ShapeTwiddle.DeletePatches[context3d, "TeaPotLid", "TeaPotWithBot", LIST[ [0, 19], [28, 31] ] ] ]
ShapeTwiddle.CleanUp[ context: context3d, name: "TeaPotLid", deSeam: TRUE, tolerance: 0.00001 ]
ShapeTwiddle.WriteOutShape[context3d, "TeaPotLid", "bezier"]