3D Demo ver 2.0 By Toshiaki Tsuji 1. Introduction This is a program to demonstrate my Multi-Platform Graphics Library. This library is designed to be very portable. Currently DOS 32 bit, Windows, Win32, Game SDK and X Windows are supported. OS/2 version will be complete in future. This demo is a DOS version. 2. Files 3DDOS.EXE - Demo program for DOS. DOS4GW.EXE - DOS Extender. WHAZE.TBL - White Hazing lookup table. COLOR.TBL - Shading lookup table. BLEND.TBL - Blending lookup table. *.GIF, *.PCX - Texture file. *.FLI - Animated texture file. *.3DS,*.ASC,*.GEO,*.GEM - 3D Object file. 3. Running the program From DOS prompt, type C:>3DDOS Filename is your config file. (*.cfg) 4. Command during program running Following key commands are available when a program is running. T - Switch to Texture Mapping Mode. S - Switch to Solid Color Mode. W - Switch to Wire Frame Mode. G - Switch to Gouraud Shading Mode. F - Switch to Flat Shading Mode. N - Switch to No Shading Mode. + - Reduce Transparency. - - Increase Transparency. ( Closer to invisible ) UP ARROW - Look Down DOWN ARROW - Look Up Left ARROW - Look Left Right ARROW - Look Right A - Move Forward Z - Move Backward 4. Config file Config file is composed of 7 sections. Screen, Object, Material, Light, Camera, Background and Color Blending. They must appear in exactly this order. 4.1. Screen Section Screen section must appear as follow, SCREEN BEGIN MODE = 640x400x256 DEBUG = NO VIEW DISTANCE = 200.0 NEAR CLIP Z = 10.0 DEPTH CUE = YES DEPTH SCALE = 100.0 HAZE = YES HAZE FILE = ..\data\whaze.tbl HAZE SCALE = 80 END MODE = Video Mode. Posible values are 320x200x256, 640x400x256, 640x480x256, 800x600x256, and 1024x768x256. DEBUG = If this item is YES, drawing will be done directly to Video Memory. (This is for Developer (me)). Always set to NO. VIEW DISTANCE = The distance from your eye to view plane. NEAR CLIP Z = Minimum Z distance that polygons to be visible. DEPTH CUE = Set YES if you want to add depth cueing. Otherwise set to NO. DEPTH SCALE = Scale factor for Depth Cueing. Smaller number makes depth cueing more visible. ( Intensity drops faster. ) HAZE = Set YES if you want to add hazing (Fog). Otherwise set to NO. HAZE FILE = Haze look up table to use. Complete path name. HAZE SCALE = Scale factor for Hazing. Smaller number makes hazing more visible. ( More foggy. ) 4.2. Object Section Object section must appear as follow, OBJECT BEGIN FILE = ..\data\king.gem POSITION = 0 0 500 SCALE = 200 MAX VISIBLE DISTANCE = 3000.0 ROTATE = 2.5 3.1 2.3 LOAD ALL = NO CLOCKWISE = NO END FILE = 3D Object file to load. Currently 3DS, ASC, GEO and GEM files are supported. POSITION = Position to place this object. SCALE = Scaling factor when file is loaded. MAX VISBLE DISTANCE = Maxmum distance for this object to be visible. ROTATE = Rotation speed. ( Degrees ) LOAD ALL = Set to YES if you want to load all the objects in the file. ( If there are more than one.) CLOCKWISE = Set to YES if polygon must appear as clockwised. 4.3. Material Section Material section must appear as follow, MATERIAL BEGIN FILE = ..\data\checker.pcx TYPE = STATIC AMBIENT = 0 0 255 MAP TEXTURE = YES U0 V0 = 0 0 U1 V1 = 0 1.0 U2 V2 = 1.0 1.0 TRANSPARENT = NO END FILE = Texture mapping file. Currently, PCX, GIF, BMP and FLI/FLC files are supported. TYPE = If loading one of PCX,GIF&BMP files, set to STATIC. In case of FLI/FLC, set to FLIC. You will see animated texture. AMBIENT = Ambient color for this material. Red, Green, Blue values. ( 0-255 ) MAP TEXTURE = Set to YES if you want to map texture coord other than the coord loaded from file. Sometimes 3D object file does not have texture coord, so this is required. U0 V0 = Texture map coord for vertex 0 ( First vertex of triangle ). ( 0 - 1.0 ) U1 V1 = Texture map coord for vertex 1 ( Second vertex of triangle ). ( 0 - 1.0 ) U2 V2 = Texture map coord for vertex 2 ( Third vertex of triangle ). ( 0 - 1.0 ) TRANSPARENT = Set to YES, to make this material tramsparent. If transparent is ON, Hazing will not be visible. 3.4 Light Section Light section must appear as follow, LIGHT BEGIN FILE = ..\data\color.tbl POSITION = 0 0 0 FOLLOW CAMERA = NO MAX INTENSITY = 63 MIN INTENSITY = 0 END FILE = Shade loook up table. POSITION = Position to place this light. FOLLOW CAMERA = Set to YES, if light is following camera. MAX INTENSITY = Maximum Intensity. MIN INTENSITY = Minimum Intensity. 4.5. Camera Section Camera section must appear as follow, CAMERA BEGIN POSITION = 0 0 0 ANGLE = 0 0 0 END POSITION = Position to place this camera. ( Your eye. ) ANGLE = Initial angle of this camera. ( Your eye. ) 4.6. Background Section Background section must appear as follow, BACKGROUND BEGIN FILE = NULL COLOR = 255 255 255 END FILE = Background pixture file. If NULL, background is not loaded. Currently PCX, GIF and BMP files are supported. COLOR = RGB values of background color. 0-255 for each Red, Green and Blue. 4.7. Color Blending Section Color blending section must appear as follow, COLOR BLENDING BEGIN FILE = ..\data\blend.tbl END FILE = Color blending lookup table file. 5. Information If you have any comments, request or questions, please feel free to contact me. E-Mail - tsuji@cs.concordia.ca or tsuji@odyssee.net Tel - (514) 694-3681. I am planning to make a Graphics API for programmers. If you are interested, let me know. I hope you enjoy my demo!