PLG Models Real time Renderer with environment mapping.
Coded by Thanassis Tsiodras.

Requirements:

  386DX-33MHz and above
  VGA video card, preferably a Local Bus or PCI.
  4 MB RAM (may work with 2MB - not tested, though)
  32 bit Windows environment
    (Windows 3.1 with Win32s installed / Windows 95)
  WinG library installed

This software is in the public domain.
The code in this software is Copyright (c) 1995 by Thanassis Tsiodras.

Contents.
=========

0. Disclaimer
1. Installing
2. What is this program? How is it used?
3. What does PLG stand for?
4. Can I create my own objects?
5. Speed of the renderer
6. DOS version
7. Removing WinG and Win32s

0. Disclaimer
=============

I will not be held responsible for any kind of damage this software causes
to your machine. You are using it at your own risk. Having said that, I must
admit that as a computer engineer I believe there is no way this software
can harm your system. I have tested it in more than 6 computers, and even
in crash situations, it doesn't cause lost clusters (all the disk activity
is done at the beginning - and it is reading, not writing).


1. Installing
=============

It is advisable to create a directory for wing_map, say "3dgrfx"

md c:\3dgrfx
cd c:\3dgrfx

and unzip the archive in it:

pkunzip a:wing_map

Wing_map is a 32-bit executable, so it needs a 32 bit platform to work.
If you don't have Windows 95 you need to install the Win32s extensions
over Windows 3.1 or 3.11. These can be found at ftp.microsoft.com.
A search I did gave also the following sites:
  
  nic.switch.ch:/mirror/python/wpy/win32s12.exe
  ftp.sunet.se:/pub/lang/python/wpy/win32s12.exe
  ftp.ibp.fr:/pub11/python/wpy/win32s12.exe
  n.ruf.uni-freiburg.de:/pub/pc/msdos/windows/system/win32s12.zip
  scss3.cl.msu.edu:/pub/pc/win/win32s120.exe
  scss3.cl.msu.edu:/pub/pc/win/win32s125a.zip

In both Windows 95 and Windows 3.1(1)/32s you will have to install WinG. 
WinG is a library used to accelerate the displaying of bitmaps to the screen. 
It is currently available at

  ftp.microsoft.com:/developr/drg/multimedia/jumpstart/WinG/WinG10.ZIP

If you start wing_map (or any other program using WinG) for the first time, a
performance test window appears which adapts and optimizes WinG for the VGA
in your PC. This may take several minutes.


2. What is this program? How is it used?
========================================

This program is a real time renderer. What this means, is that it
takes a mathematical specification of a scene, and creates a computer
generated world in which you can move at FAST speed. The mathematical
specification is actually a set of polygons, defined by the
coordinates of their bounding points (in x,y,z - Cartesian coords).
The specification is included in a .plg file, which is loaded at 
runtime.
  When run, WinG_map displays a menu of available actions.
  From the File submenu, you can open a PLG file, or exit.
  From the Options submenu, you can set the steps by which the objects
will move, when you control them. These steps are set to default
values when you load an object. Most of the time, the default values
are just fine. If you need to change them, just fill in the new value
at the dialog box that will be presented. Left/Right step sets the number 
of degrees the object will spin when you press left-right.
Up/Down Step is the number of degrees the object will spin when you press up-down.
ZoomIn/ZoomOut is the number of units SPACEBAR/V move you towards/from the object.

  You can move inside the world using these keys:

  Cursor keys : Rotate around the center of the world
  SPACE, V    : Zoom in and out
  W           : Toggle wireframe display

You can also use the mouse to move the object. 

  If you zoom very close to an object, the polygons that intersect with
the view plane, are not displayed. In order to show them, the algorithm
would have to do 3D polygon clipping, which would significantly slow
things down.

3. What does PLG stand for?
===========================

I wish I knew. Three years ago, I stumbled over this format on the
Internet, and found out that it's quite simply the easiest method
of polygon-based world representation. Say for example that you have
just one triangle forming the "scene", with these coordinates:

  Point 1:   10, 10, 10
  Point 2:   -10,10, 60
  Point 3:  110, 0, -10

Then the .plg file representing this "object" would be this:

Line 1:
object_name 3 1
            | |
            | +--- This is the number of polygons in the scene
            +----- This is the number of vertexes (points) in the scene.

Lines 2-4:   The coordinates of all the points in the scene
10 10 10
-10 10 60
110 0 -10

Line 5:            The polygons. The first number is 1 (I don't know what
                   this is used for, but I keet it for compatibility).
                   The next number is the number of points this specific
                   polygon has (in our example, 3, since it's a triangle).
                   This version only allows 3 and 4 point polygons.
                   The following numbers are the indexes in the vertexes
                   already given (i.e. this polygon is formed by vertexes
                   x,y,z,...) The numbers following should be as many
                   as specified (in our example, 3). Note that the first
                   vertex (point) is vertex 0, not vertex 1.
1 3 0 1 2

After defining an object, you can define another one, in the same way:

obj1 3 1
10 10 10
-10 10 60
110 0 -10
1 3 0 1 2
object2 2100 310
...
..
object3 10 20
...

etc.
Don't let any blank lines between data. You can examine the plg's
contained in this archive, if you want.

NOTE: 
  The renderer is truncating the coordinates, taking the integer part. If
they are numbers like 0.00012 0.0021 etc. it will scale them to 0! Make
sure you scale all coordinates up so that the integer part will be a good
representation of the object.

4. Can I create my own objects?
===============================

Why do you think I described the format? Start now! Make simple objects
at first, to get the idea, then let your imagination guide you!
It would be nice if someone could code a 3D world editor, capable of saving
in .plg format! I simply don't have the time to do that anymore. I wish
I knew this algorithm two years ago, when I was still a student. By enabling
.plg as a save format, you have the benefit of being able to spawn my viewer
for tests! (Although if you do that and earn fame/money, I'd really
appreciate some cash, thank you).
  Todd Porter checked my DOS version and informed me that he sells a 
commercial world builder that saves in PLG format. You can contact him at: 
porter@gate.net

5. Speed of the Renderer
========================

Testing with chopper.plg (about 2000 polygons), the renderer produces
about 18-19 frames/sec (at distances where no clipping is needed:clipping
really puzzles the CPU). This means rendering at about 36000 polygons/sec
on a 486DX-100MHz with Local Bus VGA. This is quite fast, considering the 
current status in graphics programming - even 3DR is slower than this!
Note that WinG accelerates the blitting part considerably. 

6. DOS version
==============

If you are not satisfied with the speed of the decoder, check out the
dos version at:

ftp://ftp.coast.net/SimTel/msdos/graphics/3denvmap.zip

Note however, that the DOS version works with a 320x200 window. Wing_map
works at 600x400, which means that it manages almost 3 times more data.


7. Removing WinG and Win32s
===========================

The installation of WinG

  - copies the files wing.dll, wing32.dll, wingde.dll, wingdib.drv,
    and wingpal.wnd to the windows\system directory.

  - copies dva.386 to the windows\system directory and adds a line
    'device=D:\WINDOWS\SYSTEM\dva.386' to the [386Enh] section of
    system.ini (only for Windows 3.1x)

so WinG can be uninstalled if you delete the relevant files and 
remove the line in system.ini. 

To remove Win32s:

(1) exit to DOS.
(2) delete the Win32s directory under windows\system and all its files.
(3) edit the system.ini file in the window directory.
    and remove the line device=C:\WINDOWS\SYSTEM\WIN32S\W32S.386
(4) return to windows
(5) remove the Win32 Applications Progman group

For any comments/suggestions, contact me at:
ttsiod@softlab.ece.ntua.gr       