=================
  T G O  32 Bit
  Version  1.00
   03/may/1999
=================


Contents:

  1: Intro to TGO 32 Bit.
  2: Capabilities.
  3: Files.
  4: Phong Demo.
  5: Disclamer.
  6: My EMail.


======================================================================
1: Intro to TGO 32 Bit
======================================================================

	What is TGO32B?  (You ask...)  Well TGO32B is my new 3D engine
and it's still in it's infancy.  I started working on TGO32B because
right now (correct me if i'm wrong) there is no high end 3D engine
available for Delphi.  Now I know that those of you who jumped ahead
and looked at the source code are saying right now: "High end?!?!?!?".
Well folks I know it ain't much but it will be.

	If you see some code that looks familiar that's because you have
deja vu,  or because some of it is borrowed from different sources too
numerous to list here.  All those who's code have my gratitude and the
offer to use my code.

	This project is intended both as a tutorial for those who don't
know and an experimentation platform for those who know.  I'm releasing
the source code because I don't intend to make money off of this.  All
I want is to create a good 3D engine for Delphi and I wold appreciate
any help that you might have to offer.

	P.S. Sorry for the messy programming and the thinly remarked code,
I will improve on that also.

======================================================================
2: Capabilities
======================================================================

	TGO32B was, as I was saying, started in order to create a high
end 3D engine for Delphi.
Right now TGO32B has the following capabilities:
  - Perspective coreccted Texture Mapped rendering.
  - Envoirment Mapped rendering.
  - Phong Shading.
  - Works in 32 bit per pixel format only
  - Uses Object pascal Code.

TGO32B will have the following capabilities:
  - Bump Mapped rendering.
  - Mirror rendering.
  - fog rendering.
  - Shadows.
  - Z - clipping.
  - Ability to work with various 3D accelerators.
  - Ability to display scenary and objects in that scenary.
  - Ability to work with 8 bit 16 bit and 32 bit color formats.
  - Ability to work with standard Bitmaps as textures.
  - Ability to read 3ds (3D Studio) file format.
  - DLL format.
  - and anything else that I or you can think of.

Objects, Methods and types:
  - TextureMap: the texture object that holds the tex map 
                 (right now just a DIB but later will be able to handle 
		      a real bitmap and read from BMP)

    Data // pointer to he DIB (made it public for speed)

    width,height // as the name suggests

    procedure Load(Tex,Pal :String) //  Loads a tex file (64*64*256c dib)

    procedure Clear; // clears the texture 

    procedure PhongBall(BallSize:Single; maxcol,mincol,rgb:integer); // creates a ball for phong mapping

    constructor create(w,h,bpx:Integer) // width,height,bits per pixel



  - TGO32Bit: the main object which includes the following:
    procedure ShowDrawPage(DeviceContext:HDC; DestWidth,DestHeight:Integer); // shows the current draw page (at pBits^)

    procedure SetPixel(X,Y:Integer; Color:Integer);

    procedure SetPageColor(Color:Integer); // fills the entire screen

    function GetpBits:Pointer; // Returns the Bitmap handle of the DIB}

    function GetHDIB:HBitmap; // Get handle for the Draw area

    procedure DTexPolygon(p,t:array of T2D; z:array of Single;
                          texp:pointer; Count,ttx,tty:Integer);
                          // Draw a perspective corrected poly in the draw area
                          // p:screen coords, t:texture mapping coords,  z: zvalues for each point (for perspective correction)
                          // texp: pointer to the DIB of the texture map,  count: number of vrtx, ttx,tty: tex x size and tex y size

    constructor Create(Width,Height,BitPPixel:Integer); 
    destructor Destroy;  // these two need no introduction

    // 3d engine procedures
    procedure InitShape(NumV,NumF:Integer); // allocate and clear memory for shape
    procedure DeInitShape; // free memory of shape
    procedure Project(M:TMatrix); // transform and project all the points according to 'M'
    procedure UpdateMapping(M:TMatrix); // update mapping coords for envoirment mapping
    procedure UpdateZList; // fill z-locations for sorting
    procedure SortZList(l,r:Integer); // sort polys
    function LoadTSH(TName:string):integer; // load tsh file (will be replaced with load3ds in the future
    procedure CalcNormals; // calculate normal vectors
    function SetShowPolyBack:boolean; // set the ShowPolyBack variable
    function SetNoWrapping:boolean; // if TRUE checks bounds for mapping coords
    procedure SetRotation(x,y,z:Integer); // rotates the shape
    procedure SetPos(x,y,z:Single); // sets the position for the shape
    procedure SetLightSource(lx,ly,mag:Single); // sets light source position
    procedure ShowFace(F:TFace); // shows a textured face
    procedure ShowObject; virtual; abstract; // shows the object


======================================================================
3: Files in this package
======================================================================

Files:
  - pd32bu.dcu \\
  - pd32bu.dfm  == main form for PhongDemo32
  - pd32bu.pas //
  - pd32u1.dcu \\
  - pd32u1.pas  == PhongDemo thread which runs the drawing program
  - pd32u2.dcu //
  - pd32u2.dcu \\
  - pd32u2.dfm  == Set Light intensities Dialog
  - pd32u2.pas //
  - pd32u3.dcu \\
  - pd32u3.pas  == Set LightSource Dialog
  - pd32u3.dfm //
  - PhongD32.dof \\
  - PhongD32.dpr  == Phong Demo project file
  - PhongD32.res //
  - PhongD32.exe == Phong Demo executable

  - _math.dcu \\
  - _math.pas  == mathematics unit
  - TGO32.dcu \\
  - TGO32.pas  == TGO32Bit 3D graphics engine

======================================================================
4: Phong Demo
======================================================================

	I have included some TSH files (a temporary format until I'll
start using the 3ds format),  and a program called PhongDemo to view
them.

Here are some tips on using the program:
  - Not all the shapes have normals calculated, so if you don't see
    anything try activating Shape|CalculateNormals.  Even if you do
    see a shape tye Calculate Normals to see the diffrence.
  - The shapes start at twice the minimum distance in order not to
    generate an error (until I'll develop Z - clipping).  For some
    shapes that's much less then the minimum value,  and for some
    that's much more than the maximum available at the menu.
    The Program is designed so that you can't set the distance at
    less han twice the minimum value.
  - Try resizing the window.

Features:
  - Movable LightSource.
  - Selection of distance.
  - Selection of light intensities and hues.
  - Ability to load different TSH files
  - Swichable from not showing poly backs to shoing poly backs
  - Calculate normals
  - FPS counter on window title

Limitations:
  - Works only in 32bit graphics mode (won't draw anything if not in mode)
  - will need a strong machine (pentium II 350) to reach 30 FPS in 400*400
    Source mode.  (but the effect is awsome - try showing JFace.tsh and
                   recalculating normals).
  - Do not try to move the object past z=0 (no z - clipping yet)

	The program is quite bug free and works splendidly on my computer
please tell me if you encounterd any problems.


======================================================================
5: Disclamer
======================================================================

	This Unit/Component/Library is freeware.  The author will not
be held liable for any damage to software/hardware directly or indirectly
connected to the package, nor will he be held liable for any damage incured
either directly or indirectly from the use of this software or from
development that stem from this package.  Use of this software is strictly
the responsibility of the user.

======================================================================
6: My EMail
======================================================================

my email is: erezraviv@hotmail.com

please send me all you can think of:
 - new ideas
 - bug fixes
 - improvments
 - what ever comes to your mind

I promise to try to incorperate the ideas you send me into TGO32B.
Feel free to use the source code in your programs that's why it's there.

have fun
EREZ RAVIV