ZSystem
ZSystem, a design for generating a whole universe from seeds, has its own article now, with its test programs ZSystem t2 and zterrain running live: ZSystem.
Lewpen's pattern generator and ZGo
Lewpen's pattern generator, a family of programs that each compute an animated pattern every frame, and ZGo, the networks of functions that grew out of it, have their own article now, with live versions: Lewpen's pattern generator.
Triangle rendering in Windows
A Win32 program for drawing texture-mapped triangles; its About box reads “Copyright (C) 2000”. The work is in the Heffer library, with two text files of triangle fillers for 16-bit screens. triangle.cpp opens with a hand-scheduled inner loop:
VERSION 1 - 8 clocks
;AGI
mov eax, ebx
add edx, 0x00000000 // SM
START:
rol eax, width
and eax, mask
adc ebx, 0x00000000 // SM
add esi, 0x00000000 // SM
mov ax, [eax+0x00000000] // SM
mov [edi+ebp], ax
mov eax, ecx
rol eax, width
and eax, mask
adc ecx, 0x00000000 // SM
add edx, 0x00000000 // SM
mov ax, [eax+0x00000000] // SM
mov [edi+ebp+1], ax
mov eax, ebx
add ebp, 2
jnc start
Source
- triangle.cpp C++ · 1820 lines
- Heffer.cpp C++ · 2643 lines
- Heffer.h C++ header · 203 lines
- texture mapped triangle.txt Text · 133 lines
- texture mapped triangles.txt Text · 1302 lines
- triangle.h · triangle.rc · resource.h · StdAfx.cpp · StdAfx.h
PixelText
PixelText 001
-------------
. Basic render framework
The font is drawn in a text file, one letter beside the next:
aaa aaaa aaa aaaa aaaaa aaaaa aaa a a aaaaa aaaaa a a a a a a a aaa aaaa aaa aaaa aaa aaaaa a a a a a a a a a a aaaaa
a a a a a a a a a a a a a a a a a a aa aa aa a a a a a a a a a a a a a a a a a a a a a a
aaaaa aaaa a a a aaaa aaaa a aa aaaaa a a aaa a a a a a a a a a aaaa a a aaaa aaa a a a a a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a aa a a a a a a a a a a a a a aa aa a a a a
a a aaaa aaa aaaa aaaaa a aaa a a aaaaa aa a a aaaaa a a a a aaa a aa a a a aaa a aaa a a a a a a aaaaa
Source
- 001/PixelText.cpp C++ · 278 lines
- font.txt Text · 5 lines
PolyCSG: boolean operations on polygons August 2002
Constructive solid geometry for 2D polygons: XOR, AND, subtract and OR of polygons, rendered a scanline at a time. There are eleven versions. The changelog at the top of PolyCSG.cpp covers the first nine and then a list of TODOs, and versions 010 and 011 carry the same changelog without adding to it. Version 007 is dated 26 August 2002:
PolyCSG 001
-----------
. Basic render framework up and running
PolyCSG 002
-----------
. Added Image class
. Converted buffer to Image class
> First draft of polygon class
. Polygon edge rendering (scanline based)
. Not yet tested
PolyCSG 003
-----------
. Solid rendering
. Added scanline class
. Use scanline class for polygon rendering
. Moved classes to seperate cpp & h files
. Pass polygon into buffer to render
PolyCSG 004
-----------
. Removed Poly.render - have to use Image.drawPolygon
. Added first CSG option - XOR
. XORPoly.render used to render
PolyCSG 005
-----------
. Get poly subclass rendering working ( Image.drawPolygon )
. Add ANDPoly class
. Polygon intersection (AND) up and running!
PolyCSG 006
-----------
. Fix in ANDPoly class ( oka && okb -> oka || okb )
. Added SUBPoly
. Added ORPoly
PolyCSG 007
-----------
2002/08/26 01:00 (while smackdown was on after playing cards at the house - Steve won)
. Added getVScanline function to all polys
. Added or,and,sub class declarations to main file
. Renamed Image.drawPolygon to Image.fillPolygon
. Renamed Image.drawScanline to Image.fillScanline + made private
. Added Image.drawPolygon, Image.drawScanline, Image.drawVScanline
. Removed Poly.render (use Image.fillPolygon instead)
NOW SUPPORTS RENDERING FILLED AND UNFILLED POLYS
PolyCSG 008
-----------
~ Antialiased poly functions
. Added Image.blendCol
. Initial AA tests.. need edge gradients stored in scanline points
. RotatePoly class added
. Poly.firstPoint, nextPoint & peekPoint added
POLYGON ROTATION WORKING
. Added pixel text functions to Image
PolyCSG 009
-----------
. Added TranslatePoly class
. Fixed memory leak in Redraw() - was not deleting all Poly's
> Interesting poly shapes
TODOs
-----
. Poly.recalc function instead of re-making tree each time
- starts off manual (must be called from main code)
- change to automatic (use frame counter to avoid re-recalc-ing)
. TranslatePoly class
. Predefined polygon classes
. Regular
. Star
. Cog
. Demo showing different effects
. Get translation and rotation working for boolean op polygons
. Optimisation: know v & h bounds of polygon to make render loop quicker
The same class library went on into the RTRay raytracer and the animations below.
Source
- 001: PolyCSG.cpp
- 002: PolyCSG.cpp
- 003: PolyCSG.cpp · Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h
- 004: PolyCSG.cpp · Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h · XORPoly.cpp · XORPoly.h
- 005: PolyCSG.cpp · Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h · XORPoly.cpp · XORPoly.h · ANDPoly.cpp · ANDPoly.h
- 006: PolyCSG.cpp · Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h · XORPoly.cpp · XORPoly.h · ANDPoly.cpp · ANDPoly.h · SUBPoly.cpp · SUBPoly.h · ORPoly.cpp · ORPoly.h
- 007: PolyCSG.cpp · Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h · XORPoly.cpp · XORPoly.h · ANDPoly.cpp · ANDPoly.h · SUBPoly.cpp · SUBPoly.h · ORPoly.cpp · ORPoly.h
- 008: PolyCSG.cpp · Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h · XORPoly.cpp · XORPoly.h · ANDPoly.cpp · ANDPoly.h · SUBPoly.cpp · SUBPoly.h · ORPoly.cpp · ORPoly.h · RotatePoly.cpp · RotatePoly.h
- 009: PolyCSG.cpp · Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h · Polygon Boolean Ops/ANDPoly.cpp · ANDPoly.h · ORPoly.cpp · ORPoly.h · SUBPoly.cpp · SUBPoly.h · XORPoly.cpp · XORPoly.h · Polygon Geometric Ops/RotatePoly.cpp · RotatePoly.h · TranslatePoly.cpp · TranslatePoly.h · Polygon Shapes/RegularPoly.cpp · RegularPoly.h · StarPoly.cpp · StarPoly.h
- 010: PolyCSG.cpp · Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h · Polygon Boolean Ops/ANDPoly.cpp · ANDPoly.h · ORPoly.cpp · ORPoly.h · SUBPoly.cpp · SUBPoly.h · XORPoly.cpp · XORPoly.h · Polygon Geometric Ops/RotatePoly.cpp · RotatePoly.h · TranslatePoly.cpp · TranslatePoly.h · Polygon Shapes/RegularPoly.cpp · RegularPoly.h · StarPoly.cpp · StarPoly.h
- 011 (clean): PolyCSG.cpp · Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h · Polygon Boolean Ops/ANDPoly.cpp · ANDPoly.h · ORPoly.cpp · ORPoly.h · SUBPoly.cpp · SUBPoly.h · XORPoly.cpp · XORPoly.h · Polygon Geometric Ops/RotatePoly.cpp · RotatePoly.h · TranslatePoly.cpp · TranslatePoly.h · Polygon Shapes/RegularPoly.cpp · RegularPoly.h · StarPoly.cpp · StarPoly.h
- Motion 010: Main.cpp · Classes/Image.cpp · Image.h · Poly.cpp · Poly.h · Scanline.cpp · Scanline.h · Polygon Boolean Ops/ANDPoly.cpp · ANDPoly.h · ORPoly.cpp · ORPoly.h · SUBPoly.cpp · SUBPoly.h · XORPoly.cpp · XORPoly.h · Polygon Geometric Ops/RotatePoly.cpp · RotatePoly.h · TranslatePoly.cpp · TranslatePoly.h · Polygon Shapes/RegularPoly.cpp · RegularPoly.h · StarPoly.cpp · StarPoly.h
Circle animation, Oil and Waves
Three small animations on the same Classes library (image, scanline, polygon and raytrace classes), each starting from the PolyCSG / Motion / RTRay changelog. Circle animation adds:
Animation 001
-------------
. Renders scrolling array of circles with pulsing wave
Oil is the “basic image template”, with version 001 dated 5 August 2004; Waves is built from the same template.
Source
- Circle animation 001: Main.cpp · Classes/Image.cpp · Image.h · Poly.cpp · Poly.h · Raytrace.cpp · Raytrace.h · Scanline.cpp · Scanline.h · Classes/Poly/ANDPoly.cpp · ANDPoly.h · ORPoly.cpp · ORPoly.h · RegularPoly.cpp · RegularPoly.h · RotatePoly.cpp · RotatePoly.h · StarPoly.cpp · StarPoly.h · SUBPoly.cpp · SUBPoly.h · TranslatePoly.cpp · TranslatePoly.h · XORPoly.cpp · XORPoly.h
- Oil 001, 5 August 2004: Main.cpp · Classes/Image.cpp · Image.h · Poly.cpp · Poly.h · Raytrace.cpp · Raytrace.h · Scanline.cpp · Scanline.h · Classes/Poly/ANDPoly.cpp · ANDPoly.h · ORPoly.cpp · ORPoly.h · RegularPoly.cpp · RegularPoly.h · RotatePoly.cpp · RotatePoly.h · StarPoly.cpp · StarPoly.h · SUBPoly.cpp · SUBPoly.h · TranslatePoly.cpp · TranslatePoly.h · XORPoly.cpp · XORPoly.h
- Oil 002: Main.cpp · Classes/Image.cpp · Image.h · Poly.cpp · Poly.h · Raytrace.cpp · Raytrace.h · Scanline.cpp · Scanline.h · Classes/Poly/ANDPoly.cpp · ANDPoly.h · ORPoly.cpp · ORPoly.h · RegularPoly.cpp · RegularPoly.h · RotatePoly.cpp · RotatePoly.h · StarPoly.cpp · StarPoly.h · SUBPoly.cpp · SUBPoly.h · TranslatePoly.cpp · TranslatePoly.h · XORPoly.cpp · XORPoly.h
- Waves 001: Main.cpp · Classes/Image.cpp · Image.h · Poly.cpp · Poly.h · Raytrace.cpp · Raytrace.h · Scanline.cpp · Scanline.h · Classes/Poly/ANDPoly.cpp · ANDPoly.h · ORPoly.cpp · ORPoly.h · RegularPoly.cpp · RegularPoly.h · RotatePoly.cpp · RotatePoly.h · StarPoly.cpp · StarPoly.h · SUBPoly.cpp · SUBPoly.h · TranslatePoly.cpp · TranslatePoly.h · XORPoly.cpp · XORPoly.h