view3ds_src
所属分类:3D图形编程
开发工具:C/C++
文件大小:2098KB
下载次数:33
上传日期:2007-09-12 23:42:37
上 传 者:
proudmoore
说明: 用于方便查看由3DSMax导出的3ds格式,功能比较强大和完善!
(For easy viewing from 3DSMax export 3ds format, features more powerful and perfect!)
文件列表:
blinn-dusty.pdf (877756, 2007-06-28)
D37.pdf (86041, 2007-06-28)
nishitaSiggraph96clouds.pdf (1197432, 2007-06-28)
view3ds (0, 1998-07-25)
view3ds\3dsload.c (21513, 1998-07-25)
view3ds\3dsload.h (3497, 1998-07-25)
view3ds\bmf (0, 1998-07-25)
view3ds\bmf.h (2575, 1998-07-25)
view3ds\bmf\bmf.h (2575, 1998-06-25)
view3ds\bmf\camera.c (2795, 1998-06-25)
view3ds\bmf\camera.h (597, 1998-06-25)
view3ds\bmf\drawbmf.c (1978, 1998-06-25)
view3ds\bmf\hubble.bmf (93508, 1998-07-25)
view3ds\bmf\loadbmf.c (5841, 1998-06-25)
view3ds\bmf\main.c (3039, 1998-07-25)
view3ds\bmf\makefile (434, 1998-06-25)
view3ds\bmf\makefile.win (1538, 1998-06-25)
view3ds\bmf\types.h (300, 1998-06-25)
view3ds\camera.c (2795, 1998-07-25)
view3ds\camera.h (597, 1998-07-25)
view3ds\main.c (8272, 1998-07-25)
view3ds\makefile (1241, 1998-06-25)
view3ds\makefile.win (1642, 1998-06-25)
view3ds\outgl.c (42993, 1998-07-25)
view3ds\outgl.h (2419, 1998-07-25)
view3ds\skeleton (0, 1998-07-25)
view3ds\skeleton\camera.c (2795, 1998-06-25)
view3ds\skeleton\camera.h (597, 1998-06-25)
view3ds\skeleton\hubble.gl (83008, 1998-07-25)
view3ds\skeleton\hubble.h (69924, 1998-07-25)
view3ds\skeleton\main.c (3343, 1998-07-25)
view3ds\skeleton\makefile (939, 1998-06-25)
view3ds\skeleton\makefile.win (1521, 1998-06-25)
view3ds\stars.c (2084, 1998-07-25)
view3ds\stars.h (133, 1998-07-25)
view3ds\stripe.mak (1033, 1998-07-25)
view3ds\types.h (296, 1998-07-25)
view3ds\versions (2145, 1998-07-25)
... ...
3D Studio->OpenGL Converter
by David Farrell
fdavid@cyberramp.net
http://www.cyberramp.net/~fdavid
0. RELEASE NOTES
This is version 1.10 of this program. Contact me at the above email
address to report any problems or bugs. If you find the program
useful, please email me; I enjoy hearing about how it is used.
VIEW3DS is an OpenGL-based 3D Studio model viewer. It accepts .3DS
files as input and renders them in real-time using OpenGL. It can
convert the .3DS file into either OpenGL C code fragments that are easily
includable in any program or a more simple file format that I have devised.
VIEW3DS can also convert the polygon mesh into a set of triangle strips;
this can greatly decrease rendering time.
VIEW3DS was developed using Mesa, the free OpenGL-like API, on a PC
running Linux, the free UNIX operating system. It is very portable;
the same code compiles under Windows 95/NT with just the addition of a few
#include "windows.h". I've made a separate ZIPped distribution with a
Makefile.win that you can compile under Windows 95 and NT. As of version
1.04, it should be endian-safe and run on any processor out there. I think.
Because I don't have access to many machines, I can't personally verify this,
so if you have any succes stories running this on a Sun, SGI, Mac,
Commodore *** :), etc., I'd like to hear about it.
1. INTRODUCTION
This program reads in 3D Studio files ending in .3DS and renders
them using OpenGL. You can then interactively fly around the model
or spin the model. Finally, the program can export the data into
either OpenGL C code or a .BMF file.
Exporting the data as OpenGL C code makes two files. One file is a C .h
include file that can simply be included in your own program; the other
file is raw binary data that you need to have in the same directory as
your executable. It's all very easy and (hopefully!) automated. There's
a sample application in the skeleton/ directory that shows exactly what
you need to do, as well as a more thorough explanation below.
The second option is exporting the data into a .BMF file. This is the
Basic Model Format that I've come up with. It's nothing fancy, just an
easy-to-use file that I can read in. Information on the format and
sample readers are in the bmf/ directory.
VIEW3DS features smooth normal generation with preservation of hard
edges. The number of normals generated can be controlled through
the -T command line option. More information is in later sections.
VIEW3DS can generate triangle strips through the use of STRIPE.
Use this feature through the -S command line option. You will need the
STRIPE executable somewhere in your path or in the same directory as
VIEW3DS. More information is in later sections.
2. STARTING VIEW3DS
To start the parser, type:
view3ds [-t??] [-s] [-r] [-f] [-c] [-x]
* The filename is the exact name of the file to be parsed, such as model.3ds.
Be sure to include the .3ds suffix.
* The -t argument is optional. It turns on the edge preservation when VIEW3DS
generates the normals. This can make a model look better at the expense of
rendering speed. If you just type -t, the default threshold is 90 degrees.
Otherwise, put a number after -t to set the threshold.
* The -s argument is optional. It turns on triangle strip detection. This can
speed up rendering time significantly if your OpenGL implementation takes
advantage of it. It can take a very long time at startup to detect the
strips, so be sure that you want to do it.
* The -r option reverses the polygon winding. If your model looks inside out,
turn this option on. Often, -r and -f are used together.
* The -f option flips the direction of the normals. If your model looks right
but the lighting looks strange, try turning this on. Often, -r and -f are
used together.
* The -c option centers the object around (0,0,0) instead of wherever in space
3D Studio put the model.
* The -x option will export the file as a .BMF file without displaying it
first.
3. KEYBOARD COMMANDS
When you run the parser, an OpenGL window will open. This is approximately
what your model will look like in your own code. It might look different
in your own program depending on your lighting and other parameters.
If you press the left mouse button, you will be presented with a menu
of options that you can click on, or press the keyboard shortcut to invoke.
Here is a listing of the keyboard commands that you can use:
F <- Capital F flips the direction of the normals. If your model looks
strangely inside-out or the lighting is wrong, press shift-F and
see if it helps.
R <- Reverses the winding of the polygons. This is often used with the
F option above.
W <- Render the model in wireframe mode instead of filled polygons.
X <- Exports the display list to your hard drive. It will make two files:
.h and .gl. These are saved in the same directory
that the .3DS file is in, which may not be your current directory.
- <- The minus sign will cause the model to uniformly scale 10% down.
This is useful if your model is too large in comparison to other
things.
+ <- The plus sign will cause the model to uniformly scale 10% up.
If your model is tiny and appears far away, make it larger.
H <- Pops up this README in a separate window.
ESC <- To exit and export the display list.
Movement Controls:
* Camera Movement:
w <- Pitches the camera down, like you are pushing forward on a joystick.
s <- Pitches the camera up, like you are pulling back on a joystick.
a <- Yaws to the left, like you turned the chair you're sitting in
to your left.
d <- Yaws to the right, like you turned your chair to your right.
Cursor Keys <- The up and down arrows move you forward and back.
The left and right arrows roll you left and right.
* Model Rotation:
4,6 <- Rotates the model (not the camera) along the world X axis.
8,2 <- Rotates the model along the world Y axis.
7,9 <- Rotates the model along the world Z axis.
The movement keys may feel awkward at first, but I find them very
convenient. If they bother you too much, edit main.c and change them.
They are the same keys I use to play Descent, a 3D flight game.
3. USING THE OPENGL OUTPUT FILES
Writing your own OpenGL application that uses 3D Studio models is easy
if you follow these steps:
1) Create your model in 3D Studio, and save it as a .3DS file.
2) Run the converter to convert the data from .3DS to OpenGL
display lists.
3) Write your own application, including the display lists with
a #include
近期下载者:
相关文件:
收藏者: