+--------------------------------------------------+
|                                                  |
| Program name:   3dtest                           |
| Last revised:   March 29th, 2003                 |
| Version:        1.4b                             |
| Author:         Christian Roervik, BiTwhise      |
| Author e-mail:  chroervi@online.no               |
|                                                  |
+--------------------------------------------------+
|                                                  |
| History:                                         |
|    1.4b:                                         |
|    - keybar toggle                               |
|    - screendump                                  |
|    - new rendering procedures                    |
|      * connecting points on the fly              |
|        +-> variable resolution                   |
|    - dynamic memory allocation                   |
|      * allocates through CMM                     |
|    - loading graphs from list files              |
|    1.3b:                                         |
|    - speed and F-Key indicators                  |
|    - new interaction routine                     |
|    - new rotation routines                       |
|      * F-Keys -> relative to graph axis          |
|      * Arrowpad -> relative to world axis        |
|    - added realtime fps                          |
|    - rewrote Calc_DrawVars procedure             |
|      * corrected some bugs                       |
|      * made it more general                      |
|      * added some comments                       |
|    - changed perspective calculation routine     |
|      * z = 0 at eye, not screen                  |
|        +-> rewrote z-clipping routine            |
|    - fixed some misc bugs                        |
|    - optimized clipping                          |
|    - "smart" clipping                            |
|      * 2 drawing procedures                      |
|    - selective operation                         |
|      * perform only necessary manipulations      |
|    1.2b:                                         |
|    - added prototype clipping                    |
|    - restructured code                           |
|    1.1b:                                         |
|    - small optmizations                          |
|       * inline lineprocedure                     |
|       * extensive use of stringfunctions         |
|         in rotation algorithm                    |
|    - partly commented                            |
|    - keybar togle function                       |
|    1.0b:                                         |
|    - first release                               |
|    - included keybar                             | 
|    0.9b:                                         |
|    - rotation and drawing routines optimized     |
|    0.8b:                                         |
|    - line algorithm optimized                    |
|    0.7b:                                         |
|    - included fps counter                        |
|    0.6b:                                         |
|    - added animation                             |
|    - fixed line bug                              |
|    - history start                               |
|                                                  |
+--------------------------------------------------+


Controls:
	- Functionkeys:	Rotation and general control
	- CTRL:		Additional functions
	- OPTN:		Take screen shot
	- MENU:		Toggle keybar on/off
	- ArrowKeys:	Rotation (hold)
	- + / - :	Rotation speed (ArrowKeys)
	- ESC:		Exit


The program:
The program displays a predefined 3D-graph, which can be rotated and zoomed. On program termination, the avarage fps is displayed. This is just a beta release of the "3d-engine" which will be used for my upcoming 3D-grapher, so many functions are yet to be implemented.
If data is present in List1, the program will load this as a graph. You can generate graphs with 3d-GRAPH Basic program.
Important Note: DO NOT LEAVE ANY MISC DATA IN LIST1 BEFORE RUNNING THE PROGRAM. THERE IS NO VALIDATION OF THE DATA YET, SO THIs MIGHT CRASH THE PROGRAM, AND MAYBE EVEN CORRUPT MEMORY.

Technical:
The graph is stored using 12:4 fixed point math. If the cpu had 32 bit registers I would have used 24:8, or maybe 16:16. But it's too old, and implementing this using 16 bit registers would cause a dramatic hit on performance.
I use a 512 word sintable, with sin values multiplied by 16384. Multiplying them by 256 would be easier to implement, and faster, but will cause errors much sooner. Multiplying by 65536 would also be more convenient, but then I would need double words to store them, and double word multiplication, causing a performance hit on this old 16 bit machine.
The program switches between two drawing procedures, one with and one without clipping. I might include a third one with z-sorted lines, for displaying when much of the graph is hidden (could just jump out of the loop on the first exclusion)
The line algorithm use strictly integer math, and might therefor not seem "correct" at all times, since a line might not start or end exactly mid-pixel... I might write a new one using 12:4, and see how it affects performance. I was thinking of including a supersample line / polyfill procedure for prerendering, but using only 2-layer grayscale I don't know if its worth it.
Keyboard handling is rather crappy and needs an overhaul. All delays are frame-based, which is not good, but that will be sorted out later.



New functions (since first release):
	- Keybar toggle (v1.4b)
	- Screen Dump (v1.4b)
	- Loading graphs from list (v1.4b)
	- F-Key and speed indicators (v1.3b)
	- real rotation, relative to world, and graph (v1.3b)
	- framerate display (v1.3b)
	- clipping (v1.2b)
	- keybar togle (1.1b)

Planed functions:
	- Hidden surface removal
	- Prerendering:
		-shading (grayscale)
	- More precise notation
	- Tracing

The graph (if no data is present in List1):
	- 15 * 15 squares:
		- (16 * 16) points	= 256 points
		- (15 * 16 * 2) lines	= 480 lines

Performance:
The program now only only performes the necessary operations for each frame, thus measuring actual performance may be difficulte. Anyway, I have performed tests, and at the with the predefined graph at current zoomlevel (which require no clipping) the fps should not drop below 14. Zooming in will cause the fps to drop about 40% at first, but then climb as more and more lines can be excluded.


//MIGHT NOT BE INCLUDED
Source:
TASM source is included. It's porely commented, still here for anyone interested.
Comments and sugestions are most welcome :-)

Please let me know if you:
	- find any bugs in my code
	- improve my code
	- use my code
	- like my work
	- have good documents or knowlegde on dynamic memory management in asm
	- have a TASM manual in English or any Scandinavian languge, French would be OK too :-)