-- ImagerObjectsTest.cm
-- Last Edited by: Crow, July 11, 1984 3:27:38 pm PDT

&sgf[ImagerObjectsMain]
LoadGrey8BitMap[]
ClearDisplay[]

NameColor["Purple"]
ShowRope[.025, .11, "The Current Color and Font"]
ShowRope[.025, .07, "The Current Color", "Xerox/Pressfonts/TimesRoman/MRR", .02]

LoadAndRotate8BitMap[0]
Load8BitRampMap[0.0, 0.0, 0.0, 1.0, 1.0, 1.0]
LoadGrey8BitMap[]

GetAISFile[ "/ivy/crow/SummedAreaTables/ChkrbdJg.ais"]
GetAISFile[ "/ivy/crow/SummedAreaTables/ChkrbdSm.ais"]
GetAISFile[ "/ivy/crow/SummedAreaTables/EggsChecked.ais"]
GetAISFile[ "/ivy/crow/SummedAreaTables/EggsStriped.ais"]

Texture Mapping
LoadGrey8BitMap[]
CheckerBoards
TextureFromAIS["/ivy/crow/ais/CheckerBoard.ais", 0, 0, 199, 199]
MakePlane["/ivy/crow/shapes/Square.obj", 32]
ColorFancyObject["/ivy/crow/shapes/Square.obj", [1.0, 1.0, 1.0] ]
SetLight[ [0.0, 0.0, 100.0], [1.0, 1.0, 1.0], .99]
MakeTxtrCoordsFromVtxNum["/ivy/crow/shapes/Square.obj", 32, 32, [0.0, 0.0], [0.0, 16.0], [16.0, 16.0], [16.0, 0.0] ]
SetView[ [.05, -1.0, .05], [0.0, -.7, 0.0], 120, 0, 400, 160 ]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [.05, -1.0, .05], [0.0, -.7, 0.0], 120, 160, 400, 160 ]
ClearDisplay[]
MipMapTexture[1.0]
ShowObjects[objectList]

SetView[ [.05, -1.0, .05], [0.0, -.7, 0.0], 120, 320, 400, 160 ]
ClearDisplay[]
SumTexture[1.0]
ShowObjects[objectList]

SetView[ [.05, -1.0, .05], [0.0, -.7, 0.0], 120, 0, 400, 480 ]
PutAISFile[ "Fig5.ais" ]

ClearTexture[]
TextureFromAIS["/ivy/crow/ais/CheckerBoard.ais", 0, 0, 199, 199]
RotateObject["/ivy/crow/shapes/Square.obj", [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0]
SetView[ [.0, -1.0, .0707], [0.0, -.7, 0.0], 1, 138, 213, 213 ]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [.0, -1.0, .0707], [0.0, -.7, 0.0], 214, 138, 213, 213 ]
ClearDisplay[]
MipMapTexture[1.0]
ShowObjects[objectList]

SetView[ [.0, -1.0, .0707], [0.0, -.7, 0.0], 427, 138, 213, 213 ]
ClearDisplay[]
SumTexture[1.0]
ShowObjects[objectList]

SetView[ [.05, -1.0, .05], [0.0, -.7, 0.0], 0, 138, 640, 213 ]
PutAISFile[ "Fig6.ais" ]

ClearTexture[]
TextureFromAIS["/ivy/crow/ais/CheckerBoard.ais", 0, 0, 199, 199]
RotateObject["/ivy/crow/shapes/Square.obj", [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0]
SetView[ [-.05, -1.0, .05], [0.0, -.7, 0.0], 80, 40, 160, 400 ]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [-.05, -1.0, .05], [0.0, -.7, 0.0], 240, 40, 160, 400 ]
ClearDisplay[]
MipMapTexture[1.0]
ShowObjects[objectList]

SetView[ [-.05, -1.0, .05], [0.0, -.7, 0.0], 400, 40, 160, 400 ]
ClearDisplay[]
SumTexture[1.0]
ShowObjects[objectList]

SetView[ [.05, -1.0, .05], [0.0, -.7, 0.0], 80, 40, 480, 400 ]
PutAISFile[ "Fig7.ais" ]

TextureFromAIS["Stripes32.ais", 0, 0, 199, 199]
MakePlane["/ivy/crow/shapes/Square.obj", 2 ]
ColorFancyObject["/ivy/crow/shapes/Square.obj", [1.0, 1.0, 1.0] ]
SetLight[ [0.0, 0.0, 100.0], [1.0, 1.0, 1.0], .99]
MakeTxtrCoordsFromVtxNum["/ivy/crow/shapes/Square.obj", 2 , 2 , [0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0] ]
SetView[ [-1.0, 0.0, .5], [0.0, 0.0, 0.0], 0, 0, 300, 220 ]
ClearDisplay[]
ShowObjects[objectList]
MipMapTexture[1.0]
ClearDisplay[]
ShowObjects[objectList]

DeleteObject["/ivy/crow/shapes/Square.obj"]
ClearTexture[]
Eggs
DeleteObject["/ivy/crow/shapes/UtahEgg.obj"]
AddObject["/ivy/crow/shapes/UtahEgg.obj"]
Stretched Spots
TextureFromAIS["Crow10Spots.ais", 0, 0, 199, 199]
ColorFancyObject["/ivy/crow/shapes/UtahEgg.obj", [1.0, 1.0, 1.0] ]
MakeTxtrCoordsFromNormals["/ivy/crow/shapes/UtahEgg.obj", [0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0] ]
SetLight[ [100.0, 0.0, 100.0], [1.0, 1.0, 1.0], .3]
RotateObject["/ivy/crow/shapes/UtahEgg.obj", [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], 180.0]
RotateObject["/ivy/crow/shapes/UtahEgg.obj", [0.0, 0.0, 0.0], [0.0, 0.0, 1.0], -20.0]
RotateObject["/ivy/crow/shapes/UtahEgg.obj", [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], -20.0]

SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 0, 0, 213, 280 ]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 7, 280, 199, 199 ]
GetAISFile[ "Crow10Spots.ais" ]

ClearTexture[]
TextureFromAIS["CrowStretchedTxtr.ais", 0, 0, 199, 199]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 427, 0, 213, 280 ]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 434, 280, 199, 199 ]
GetAISFile[ "CrowStretchedTxtr.ais" ]

SetView[ [0, -1.5, 3.0], [0.0, 0.0, 0.0], 0, 0, 640, 480 ]
PutAISFile[ "StretchedEggs.ais" ]

Striped

TextureFromAIS["/ivy/crow/shapes/Stripes32.ais", 0, 0, 199, 199]
ColorFancyObject["/ivy/crow/shapes/UtahEgg.obj", [1.0, 1.0, 1.0] ]
MakeTxtrCoordsFromNormals["/ivy/crow/shapes/UtahEgg.obj", [0.0, 0.0], [2.0, 3.0], [5.0, 3.0], [3.0, 0.0] ]
SetLight[ [100.0, 0.0, 100.0], [1.0, 1.0, 1.0], .3]
RotateObject["/ivy/crow/shapes/UtahEgg.obj", [0.0, 0.0, 0.0], [0.0, 0.0, 1.0], -20.0]
RotateObject["/ivy/crow/shapes/UtahEgg.obj", [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], -20.0]

SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 0, 100, 213, 280 ]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 214, 100, 213, 280 ]
MipMapTexture[4.0]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 427, 100, 213, 280 ]
SumTexture[1.0]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.5, 3.0], [0.0, 0.0, 0.0], 0, 100, 640, 280 ]
PutAISFile[ "Fig3.ais" ]

Mip range comparison
MipMapTexture[.6]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 0, 100, 213, 280 ]
ClearDisplay[]
ShowObjects[objectList]

ClearTexture[]
TextureFromAIS["/ivy/crow/shapes/Stripes32.ais", 0, 0, 199, 199]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 214, 100, 213, 280 ]
MipMapTexture[2.0]
ClearDisplay[]
ShowObjects[objectList]

ClearTexture[]
TextureFromAIS["/ivy/crow/shapes/Stripes32.ais", 0, 0, 199, 199]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 427, 100, 213, 280 ]
MipMapTexture[4.0]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.5, 3.0], [0.0, 0.0, 0.0], 0, 100, 640, 280 ]
PutAISFile[ "MipRange.ais" ]

Sum Range Comparison
SumTexture[1.0, 64.0]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 0, 100, 213, 280 ]
ClearDisplay[]
ShowObjects[objectList]

ClearTexture[]
TextureFromAIS["/ivy/crow/shapes/Stripes32.ais", 0, 0, 199, 199]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 214, 100, 213, 280 ]
SumTexture[1.5, 64.0]
ClearDisplay[]
ShowObjects[objectList]

ClearTexture[]
TextureFromAIS["/ivy/crow/shapes/Stripes32.ais", 0, 0, 199, 199]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 427, 100, 213, 280 ]
SumTexture[2.0, 64.0]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.5, 3.0], [0.0, 0.0, 0.0], 0, 100, 640, 280 ]
PutAISFile[ "SumRange.ais" ]

Interpolation limit Comparison
SumTexture[1.0, 0.0]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 0, 100, 213, 280 ]
ClearDisplay[]
ShowObjects[objectList]

ClearTexture[]
TextureFromAIS["/ivy/crow/shapes/Stripes32.ais", 0, 0, 199, 199]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 214, 100, 213, 280 ]
SumTexture[1.0, 32.0]
ClearDisplay[]
ShowObjects[objectList]

ClearTexture[]
TextureFromAIS["/ivy/crow/shapes/Stripes32.ais", 0, 0, 199, 199]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 427, 100, 213, 280 ]
SumTexture[1.0, 1.0e+10]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.5, 3.0], [0.0, 0.0, 0.0], 0, 100, 640, 280 ]
PutAISFile[ "SumRange.ais" ]

Checkered
ClearTexture[]
TextureFromAIS["/ivy/crow/ais/CheckerBoard.ais", 1, 1, 199, 199]
SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 0, 100, 213, 280 ]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 214, 100, 213, 280 ]
MipMapTexture[]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.1, 2.2], [0.0, 0.0, 0.0], 427, 100, 213, 280 ]
SumTexture[]
ClearDisplay[]
ShowObjects[objectList]

SetView[ [0, -1.5, 3.0], [0.0, 0.0, 0.0], 0, 100, 640, 280 ]
PutAISFile[ "Fig4.ais" ]

AddObject["/ivy/crow/shapes/Square.obj"]
SetView[ [0.0, 0.0, 10.0], [0.0, 0.0, 0.0], 20, 20, 600, 440]
RotateObject["/ivy/crow/shapes/Square.obj", [0.0, 0.0, 0.0], [0.0, 0.0, 1.0], 10.0]
ColorFancyObject["/ivy/crow/shapes/Square.obj", [1.0, 1.0, 1.0] ]
GetTextureCoords["/ivy/crow/shapes/Square.obj", "/ivy/crow/shapes/SquareTexture.obj"]
SetLight[ [0.0, 0.0, 100.0], [1.0, 1.0, 1.0], .3]
ShowObjects[objectList]
ClearDisplay[]
SetView[ [0.0, 0.0, 10.0], [0.0, 0.0, 0.0], 20, 20, 300, 220]
RotateObject["/ivy/crow/shapes/Square.obj", [0.0, 0.0, 0.0], [0.0, 0.0, 1.0], 35.0]
GetTextureCoords["/ivy/crow/shapes/Square.obj", "/ivy/crow/shapes/Square16Texture.obj"]
ShowObjects[objectList]
SetView[ [0.0, 0.0, 10.0], [0.0, 0.0, 0.0], 320, 20, 300, 220]
RotateObject["/ivy/crow/shapes/Square.obj", [0.0, 0.0, 0.0], [0.0, 0.0, 1.0], 45.0]
ShowObjects[objectList]
SetView[ [0.0, 0.0, 20.0], [0.0, 0.0, 0.0], 320, 240, 300, 220]
RotateObject["/ivy/crow/shapes/Square.obj", [0.0, 0.0, 0.0], [0.0, 0.0, 1.0], 45.0]
ShowObjects[objectList]
SetView[ [0.0, 0.0, 30.0], [0.0, 0.0, 0.0], 20, 240, 300, 220]
RotateObject["/ivy/crow/shapes/Square.obj", [0.0, 0.0, 0.0], [0.0, 0.0, 1.0], 45.0]
ShowObjects[objectList]

SumTexture[]
ClearTexture[]
MipMapTexture[]
TextureFromAIS["/ivy/crow/ais/stripes.ais", 1, 1, 200, 200]

Summed-Area Paper Illustrations
LoadGrey8BitMap[]
SetView[ [0, -3.0, 0.0], [0.0, 0.0, 0.0], 0, 0, 1024, 768 ]
ClearDisplay[]
TextureFromAIS["/ivy/crow/ais/Poobs-grn.ais", 1, 1, 340, 260]
AddObject["/ivy/crow/shapes/UtahEgg.obj"]
ColorFancyObject["/ivy/crow/shapes/UtahEgg.obj", [1.0, 1.0, 1.0] ]
MakeTxtrCoordsFromNormals["/ivy/crow/shapes/UtahEgg.obj", [0.0, 0.0], [0.0, 9.0], [6.0, 9.0], [6.0, 0.0] ]
SetLight[ [100.0, 0.0, 100.0], [1.0, 1.0, 1.0], .8]
SetView[ [0, -3.0, 0.0], [0.0, 0.0, 0.0], 0, 96, 512, 576 ]
SumTexture[]
ClearDisplay[]
ShowObjects[objectList]

DeleteObject["/ivy/crow/shapes/UtahEgg.obj"]
MakePlane["/ivy/crow/shapes/Square.obj", 4]
ColorFancyObject["/ivy/crow/shapes/Square.obj", [.8, .8, .8] ]
SetLight[ [0.0, 0.0, 100.0], [1.0, 1.0, 1.0], .8]
MakeTxtrCoordsFromVtxNum["/ivy/crow/shapes/Square.obj", 4, 4, [0.0, 0.0], [0.0, 5.0], [-3.0, 5.0], [-3.0, 0.0] ]
SetView[ [-0.1, 0.0, 2.5], [0.0, 0.0, 0.0], 448, 160, 576, 448 ]
ClearDisplay[]
ShowObjects[objectList]
DeleteObject["/ivy/crow/shapes/Square.obj"]
ClearTexture[]
SetPixelBlending[]

DrawQuad[1.0, 227, 368, 291, 368, 227, 368.8, 291, 368.8]
DrawQuad[1.0, 227, 432, 291, 432, 227, 432.8, 291, 432.8]
DrawQuad[1.0, 227, 432, 227, 368, 227.8, 368, 227.8, 432]
DrawQuad[1.0, 291, 432, 291, 368, 291.8, 368, 291.8, 432]

DrawQuad[1.0, 708, 352, 771, 352, 771, 352.8, 708, 352.8]
DrawQuad[1.0, 708, 408, 771, 408, 771, 408.8, 708, 408.8]
DrawQuad[1.0, 708, 408, 708, 352, 708.8, 352, 708.8, 408]
DrawQuad[1.0, 771, 408, 771, 352, 771.8, 352, 771.8, 408]

DrawQuad[1.0, 304, 400, 696, 379.2, 696, 380, 304, 400.8]

DrawQuad[1.0, 336, 272, 400, 272, 336, 272.8, 400, 272.8]
DrawQuad[1.0, 336, 336, 400, 336, 336, 336.8, 400, 336.8]
DrawQuad[1.0, 336, 336, 336, 272, 336.8, 272, 336.8, 336]
DrawQuad[1.0, 400, 336, 400, 272, 400.8, 272, 400.8, 336]

DrawQuad[1.0, 832, 260, 968, 244, 968, 244.8, 832, 260.8]
DrawQuad[1.0, 824, 320, 928, 312, 928, 312.8, 824, 320.8]
DrawQuad[1.0, 824, 320, 832, 260, 832.8, 260, 824.8, 320]
DrawQuad[1.0, 928, 312, 968, 244, 968.8, 244, 928.8, 312]

DrawQuad[1.0, 416, 304, 816, 289, 816, 289.8, 416, 304.8]

DrawQuad[1.0, 160, 520, 224, 520, 160, 520.8, 224, 520.8]
DrawQuad[1.0, 160, 584, 224, 584, 160, 584.8, 224, 584.8]
DrawQuad[1.0, 160, 584, 160, 520, 160.8, 520, 160.8, 584]
DrawQuad[1.0, 224, 584, 224, 520, 224.8, 520, 224.8, 584]

DrawQuad[1.0, 624, 496, 699, 488, 699, 488.8, 624, 496.8]
DrawQuad[1.0, 576, 600, 688, 600, 688, 600.8, 576, 600.8]
DrawQuad[1.0, 576, 600, 624, 496, 624.8, 496, 576.8, 600]
DrawQuad[1.0, 688, 600, 699, 488, 699.8, 488, 688.8, 600]

DrawQuad[1.0, 240, 552, 584, 547.2, 584, 548, 240, 552.8]
SetPixelBlending[FALSE]

SetView[ [0, -3.0, 0.0], [0.0, 0.0, 0.0], 32, 96, 1024, 576 ]
PutAISFile[ "Fig1g.ais" ]

SetView[ [0, -3.0, 0.0], [0.0, 0.0, 0.0], 0, 96, 1024, 576 ]
GetAISFile[ "Fig1g.ais" ]


Dither Demo, Single Square
AddObject["/ivy/crow/shapes/Square.obj"]
GetVertexColors["/ivy/crow/shapes/Square.obj", "/ivy/crow/shapes/SquareVtxColors.obj"]
SetLight[ [0.0, 0.0, 100.0], [1.0, 1.0, 1.0], .7]
SetView[ [2, -3.0, 2], [0.0, 0.0, 0.0] ]