Dec 062017
 
C Source for 3D rendering.
File 3DVIEW.ZIP from The Programmer’s Corner in
Category C Source Code
C Source for 3D rendering.
File Name File Size Zip Size Zip Type
3DVIEW.C 8138 2008 deflated
3DVIEW.H 391 198 deflated
3DVIEW.O 5596 1804 deflated
CUBOID 2979 796 deflated
CUBOIDOP 30 27 deflated
DRAW.C 2867 934 deflated
DRAW.O 1992 800 deflated
FREE.C 439 266 deflated
FREE.O 292 228 deflated
LOAD.C 3933 1049 deflated
LOAD.O 2572 1174 deflated
LOTUSOPT 35 30 deflated
MAKEFILE 117 72 deflated
MATH.C 5486 1741 deflated
MATH.O 4920 1667 deflated
README 2245 985 deflated
README.INF 348 164 deflated
TORUS 5087 1162 deflated
TORUSOPT 31 28 deflated

Download File 3DVIEW.ZIP Here

Contents of the README file


Using 3DView


3DView can be run from any CLI or SHELL. It must be passed certain
arguments to function properly:

3DView objectfile viewoptsfile screenmode

The object file and viewopts file are detailed below. The screen mode is a
value between 1 and 4. Each value corresponds to one of the following four
screen resolutions:

1 = 320x200
2 = 320x400
3 = 640x200
4 = 640x400

In addition, if the screen mode number is negative, the object will be drawn
with a wire-frame display. Otherwise, positive screen mode values will
result in a solid, shaded object display.

The ViewOpts File

This file contains the necessary information to view an object. The
contents of an example follows:

0 0 50
0 0 0
1.0
-50 50 50

The first three numbers define a position in 3-D space for the camera. The
next three numbers are the position of the point at which the camera is
looking. The next value is a scaling value which controls the size of the
object when drawn. If the object appears too small, try increasing this
value. And, if the object appears too large (or doesn't appear at all), try
lowering this value. The last three values are the location of the light
source.

The GEO Object File

A sample GEO file follows:

3DG1
4
10 10 0
10 -10 0
-10 -10 0
-10 10 0
3 0 1 2 13
3 2 3 0 13

The first line of the file is used to indentify the file as a GEO object.
This line should be "3DG1" for 3DView to recognize it. The next number is
the number of vertices contained in the object. However many vertices there
are in the object defines how many of the following lines are vertex
positions in 3-D space. In this example, there are four vertices, hence
the four lines following the "4" are vertex locations. The remaining lines
in the file are polygon descriptions. The first # of the polygon description
is the number of vertices contained in the polygon. The remaining numbers,
except for the last, are vertex numbers which indicate which vertices in the
preceeding list are used for the polygon description. The last number is a
color code:

0 = black
1 = blue
2 = green
3 = unused
4 = red
5 = unused
6 = brown
7 = grey
8 = black
9 = blue
10 = green
11 = unused
12 = red
13 = unused
14 = yellow
15 = white



 December 6, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)