Info-Mac Archive Downloads: dev/src/ SourceCode

Back to dev/src/ SourceCode

flight_thru_clouds - simple virtual reality w/ source and expl (flight-thru-clouds-cpp.hqx)

Download flight-thru-clouds-cpp.hqx (428,317 KB)

Date: Sat, 9 Jul 94 12:42:15 -0500
From: (Kiselyov Oleg)
Subject: flight_thru_clouds - simple virtual reality w/ source and expl

What: "virtual" flying through the clouds
Hot points:
- simple virtual reality "thing"
- with the source
- *very* detailed explanation as to how to generate clouds and
render maps in 3D.
- includes the source for a small class library to handle color
Mac windows and draw images in off-screen GrafWorlds
Readme - this file
Venus - Application itself
Venus.pi - project and resource files to build it
Venus.pi.rsrc - 'clut' resource - generate a fractal map (clouds) - display a 3D moving projection of the map of clouds - display an image in a Mac window
window.h \ my own private *very* simple MacApp: classlib for / handling color Mac windows and offscreen GrafWorlds
The source code contains (too) many comments to show what
a particular piece of code does, as well as some tricks involved
Language: Symantec C++ 7.0.3 (previous versions might work, too)
System: System 7.x; tested on IIci, Quadras and Centres.
Note: the source code uses a "standard" environment, see myenv-notify.cpt,
which can be found at various archive sites under the name
'myenv-notify'. The source also uses graylib class library to
handle images, recently posted on comp.source.misc. However,
the library is not *very* used; one can easily get around without
it with only small modification of the code.
Many-Thanks-To: Tim Clarke, (for inspiration)


Just fire it up, sit back and enjoy. Hope you'll get some
feeling that you're hovering over or flying through the clouds. If you
quit the program and start it over again, you'll get different clouds
(which might be much better and more interesting to fly around).

If you want to take on a more active role, hold the mouse
button down and move the mouse. Then your flight is in your own hand
(which holds the mouse). You have to keep the mouse button down all
the time you want to control the situation: when mouse button is up,
the system flies by itself. You can also use the keyboard: arrows
left/right/up/down move you around, PgUp/PgDn changes your altitude
(or height of the horizon if pressed with "Option"); all other keys
quietly kill the program (you can also quit by clicking the close box
of the window).

This program is inspired by "MARS.EXE" and its description
posted in There, the author of Mars, Tim Clarke,
explained its guts, though he didn't give detailed equations and there
were a few typos in his post. Source file '' in the
present submission contains the fullest description (I could come up
with) of the 3D rendering technique: with background, equations,
pseudocode and the actual code (and tricks with the fixed-point
arithmetics: hey, no floating-point numbers are in here).

If you need further information or details, mail me.

Enclosers: Venus.cpt.hqx