DIRECTORY Random, Real, RealFns; WedgeImpl: CEDAR PROGRAM IMPORTS Random, Real, RealFns ~ BEGIN a, b, c, d: REAL _ 0; nlevels: INT _ 256; noiseAmp: REAL _ 1.0; Noise: PROC RETURNS [REAL] ~ { RETURN [Random.ChooseInt[min: -9999, max: 9999]*noiseAmp/(10000.0*nlevels)] }; LinearX: PROC [x, y: REAL] RETURNS [REAL] ~ {RETURN [a*x+b*(1-x)+Noise[]]}; LinearY: PROC [x, y: REAL] RETURNS [REAL] ~ { RETURN [a*y+b*(1-y)+Noise[]] }; Constant: PROC [x, y: REAL] RETURNS [REAL] ~ {RETURN [a]}; QuadY: PROC [x, y: REAL] RETURNS [REAL] ~ { w: REAL ~ a*y+b*(1-y)+c*y*(1-y); RETURN [w+Noise[]] }; CosY: PROC [x, y: REAL] RETURNS [REAL] ~ { nRep: REAL _ a; RETURN [RealFns.Cos[(y*2-1)*3.14159*nRep]/2+0.5+Noise[]] }; Vignette: PROC [x, y: REAL] RETURNS [REAL] ~ { innerRadius: REAL _ a; outerRadius: REAL _ b; vinvert: BOOLEAN _ c < 0; r, phase, level: REAL; x _ x*2-1; y _ y*2-1; r _ Real.SqRt[x*x + y*y]; SELECT r FROM <= innerRadius => level _ 1; >= outerRadius => level _ 0; ENDCASE => { phase _ 3.14159*(r-innerRadius)/(outerRadius-innerRadius); level _ RealFns.Cos[phase]/2+0.5+Noise[]; }; IF vinvert THEN level _ 1.0-level; RETURN [level] }; END. ’WedgeImpl.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Michael Plass, February 3, 1986 12:24:59 pm PST a = intensity at top. b = intensity at bottom. a = intensity at top. b = intensity at bottom. c proportial to extra intensity at middle. Run AISImpl Run Texture2DImpl Alias SetWedgeParam (foo bar) _ WedgeImpl.foo _ bar Alias ComputeWedge (fileName functionID dots lines) _ Texture2D.FunctionAIS[outputName: "fileName", width: dots, height: lines, f: WedgeImpl.functionID] Alias Wedge (fileName functionID dots lines aVal bVal cVal) SetWedgeParam a aVal; SetWedgeParam b bVal; SetWedgeParam c cVal; ComputeWedge fileName functionID lines dots ΚΡ˜™Icodešœ Οmœ1™