DIRECTORY Atom USING [ PropList ], Rope USING [ ROPE ], G3dRender, ThreeDBasics USING [ ShapeInstance, VertexInfoProc ]; MappedAndSolidTexture: CEDAR DEFINITIONS ~ BEGIN Context: TYPE ~ G3dRender.Context; Pair: TYPE ~ G3dRender.Pair; Patch: TYPE ~ G3dRender.Patch; SpotProc: TYPE ~ G3dRender.SpotProc; VertexInfoProc: TYPE ~ ThreeDBasics.VertexInfoProc; ShapeInstance: TYPE ~ ThreeDBasics.ShapeInstance; TextureMap: TYPE ~ G3dRender.TextureMap; TextureFunction: TYPE ~ G3dRender.TextureFunction; LORA: TYPE ~ LIST OF REF ANY; AddSolidTexture: PROC[context: Context, shapeName: Rope.ROPE, name: ATOM ]; AddMappedTexture: PROC[context: Context, shapeName: Rope.ROPE, texture: REF TextureMap]; SumAllMappedTextures: PROC[context: Context, shapeName: Rope.ROPE]; RemoveAllTexture: PROC[context: Context, shapeName: Rope.ROPE]; LoadVtxAux: VertexInfoProc; LerpVtxAux: VertexInfoProc; ShadeVtx: VertexInfoProc; AdjustTexture: PROC[poly: REF Patch, texture: LORA, halfXRange, halfYRange: REAL _ .5]; GetTxtrAt: SpotProc; RegisterTextureFunction: PROC[ name: ATOM, proc: SpotProc, props: Atom.PropList _ NIL ]; GetRegisteredTextureFunction: PROC[name: ATOM] RETURNS[ txtrFn: TextureFunction ]; Chaos: PROC[x, y, z: REAL] RETURNS [REAL]; Noise: PROC[vx, vy, vz: REAL] RETURNS [REAL]; ScaleTxtrCoords: PROC [ context: Context, shapeName: Rope.ROPE, scale, xRatio, yRatio: REAL _1.0 ]; MakeTxtrCoordsFromVtxNos: PROC[ context: Context, shapeName: Rope.ROPE, vtcesInRow, numberOfRows: NAT, row0col0, rowNcol0, rowNcolM, row0ColM: Pair ]; MakeTxtrCoordsFromNormals: PROC[ context: Context, shapeName: Rope.ROPE, botLeft: Pair _ [0.0, 0.0], topLeft: Pair _ [0.0, 1.0], topRight: Pair _ [1.0, 1.0], botRight: Pair _ [1.0, 0.0], sw: Pair _ [180.0, -90.0], nw: Pair _ [180.0, 90.0], ne: Pair _ [-180.0, 90.0], se: Pair _ [-180.0, -90.0] ]; TextureFromAIS: PROC[context: Context, fileName: Rope.ROPE, type: ATOM _ $Intensity, factor: REAL _ 1.0] RETURNS[texture: REF TextureMap]; SumTexture: PROC[texture: REF TextureMap]; END. ŽMappedAndSolidTexture.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Last Edited by: Crow, February 14, 1989 5:40:59 pm PST Perlin, August 5, 1985 0:23:18 am PDT Basic Types Procedures for Controlling Texture Allows client to pass name of solid texturing procedure for shape as an ATOM Sets up supplied texture map Converts texture maps to summed area table form for antialiasing Deletes all texture references for object Procedures for Auxiliary Clipping and Shading Loads data into vtx.aux, where it can be interpolated and clipped with other patch data Interpolates data in vtx.aux, called back from clipper, etc. Custom shading code for texturing (defaults to standard shader in this version) Support Procedures for setting up texture for tiler Adjusts mapped texture coordinates to avoid coordinate wraparound Procedures for Evaluating Texture at a Spot Layers textures from a list to onto a pixel Procedures for solid texture calculation Registers a procedure for computing on a spot (usually for solid textures) Returns a previously registered procedure A function built on noise, used in some solid texture functions Perlin's noise function. Fills space with random blobs Procedures for Computing Texture Coordinates Scales texture coordinates of vertices. xRatio, etc. can be used to set scale assymetrically. eg. texture.x _ texture.x * scale * xRatio. Accumulated scale factor is stored on shape shadingProps list ($TextureScale). For objects which are rectangular polygon grids pulled into a surface shape, eg. surfaces of revolution, this maps a texture onto the rectangular grid. This takes the surface normals and maps from spherical coordinates into a rectangular texture. botLeft, topLeft, etc. allow mapping multiple, or skewed, instances of the texture onto the rectangle. longMin, longMax, etc. allow the area affected to be limited to a certain range of sperical coordinates. Procedures for Reading and Preparing Texture Files Reads AIS file and converts it to texture map form. Factor is for scaling, (height of bump map - default 1, other uses may come) Turn texture map into Summed Table form for anti-aliased texture ΚI˜headšœ™Jšœ Οmœ1™