unit renderers_3D; {$MODE OBJFPC} {$M+} interface uses framebuffers, colors, images; { TODO: what to use? floating-point math? fixed-point math? integer arithmetic? } { TODO does that stuff still support clipping? No, so don't draw directly upon a I2DGraphics that goes on screen. } type ITexture = interface end; ISimpleTexture = interface(ITexture) property Color : IColor; end; IImageTexture = interface(ITexture) property Image : IImage; end; IMipmappedPixmapTexture = interface(IImageTexture) function GetClosestMatch(aWidth, aHeight : Cardinal) : IImageTexture; end; TVertex = array[0..2] of Integer; { X, Y, Z } TTriangleVertices = array[0..2] of TVertex; //PVertex = ^TVertex; TTexturePoint = array[0..1] of Integer; // point on texture (between the pixels of the texture). I3DRenderer = interface { vertices are counter-clockwise. } procedure DrawTriangle(const aVertices : TTriangleVertices); overload; procedure DrawTriangle(const aVertex0, aVertex1, aVertex2 : TVertex); overload; procedure DrawTriangle(const aVertex0 : TVertex; const aTexturePoint0 : TTexturePoint; const aVertex1 : TVertex; const aTexturePoint1 : TTexturePoint; const aVertex2 : TVertex; const aTexturePoint2 : TTexturePoint); overload; { note that triangles are triangular, so the entire (rectangular) texture is NOT going to be used for one triangle, just the biggest triangle-shaped part of it. } property Texture : ITexture; end; { TODO cache stuff about Triangle in a triangle class (with low footprint) for the viewpoint? } implementation end.