GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.waspscripts.com — Lit Model Lit Model¶A model prepared for drawing: the geometry of a model definition, plus the per face colours lighting writes and the routines that project and rasterize it. The geometry is shared with the definition rather than copied - nothing here writes to it, and lighting keeps its colours in arrays of its own. LitModel.Create¶function TLitModel.Create(const src: TModelDefinition): TLitModel; static; A decoded model, ready to light and draw. The geometry arrays are shared with LitModel.FaceNormal¶procedure TLitModel.FaceNormal(idx: Integer; out nX, nY, nZ: Integer); The normal of face The cross product is halved until it fits in 13 bits so that the squares below cannot overflow, using an arithmetic shift - a logical one would turn a negative component into a large positive and flip the face’s normal. LitModel.LightIntensity¶function TLitModel.LightIntensity(normalX, normalY, normalZ, mag, atten, ambient: Integer): Integer; static; How brightly the fixed light falls on a surface facing along the normal, unclamped.
LitModel.ApplyLightIntensity¶function TLitModel.ApplyLightIntensity(color, intensity: Integer): Integer; static; Scale a colour’s luminance by a light intensity. Pascal’s LitModel.Light¶procedure TLitModel.Light(ambient, contrast: Integer); Computes vertex/face normals and lights each face from the fixed
LitModel.CalcBoundsCylinder¶procedure TLitModel.CalcBoundsCylinder(); Measures the cylinder the model fits inside: how far it reaches from the vertical axis, and how far it rises above and drops below its origin. The height is what an item icon is centred on, and the radius is what face sorting offsets depths by so that they never go negative. It is computed once and remembered. LitModel.RasterFace¶procedure TLitModel.RasterFace(var graphics: TGraphics3D; faceIdx: Integer); Draws one face, already projected to screen space by TLitModel.ProjectAndDraw. A face with three distinct vertex colours is Gouraud shaded and one with a single colour is filled flat. Clipping is only turned on for faces that actually reach outside the viewport. A textured face is drawn with the texels of LitModel.DrawByPriority¶procedure TLitModel.DrawByPriority(var graphics: TGraphics3D); Draws faces in the order their render priorities ask for, rather than purely by depth. Depth sorting alone gets some models wrong, so faces can carry a priority that pins them in front of or behind others regardless of where they sit. Priorities 0 to 9 are drawn as groups in order, while 10 and 11 stay depth sorted and are woven in between them at the points where their depth passes the average depth of the group being drawn. LitModel.Draw¶procedure TLitModel.Draw(var graphics: TGraphics3D); Draws every visible face of the projected model, furthest first. Back faces are dropped by the sign of their screen-space winding, and what is left is sorted by average depth with an insertion sort - models are small enough that it beats anything cleverer. Models with render priorities are handed to TLitModel.DrawByPriority instead. LitModel.ProjectAndDraw¶procedure TLitModel.ProjectAndDraw(var graphics: TGraphics3D; yzRot, xzRot, xyRot, orientation, xOffset, yOffset, zOffset: Integer); Rotates the model, projects its vertices onto the screen and draws it. The three rotations are applied about each axis in turn, the model is moved by the offsets, and
then the camera pitch given by |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |