Download from
http://www.nyangau.org/mr/mr.zip
.
You may also need the
Generalised Bitmap Module.
The Modular Renderer is a set of C++ classes and functions, which provide a superset of the functionality previously found in the RT raytracer.
This means that now the full C++ language can be at your disposal to help build models for tracing and also for automating the generation of animations. It also opens the door to procedural textures and other advanced features.
Furthermore, MR provides other forms of rendering, such as wire-frame and polygon rendering, in order to provide fast previews etc..
It has the disadvantage that in order to perform raytracing, you have to write a program and compile it. Accordingly MR has a raytracer called RTMR, which is backwardly compatible with RT (my earlier raytracer) and implemented using MR.
It provides ray-tracer functionality based on information given in "Computer Graphics, Principles and Practice", by Foley, vanDam, Feiner and Hughes, and Byte magazine. It provides :-
Supporting (convex) polygon rendering, there are :-
Supporting wire-frame rendering, there are :-
To support the real-time display of generated bitmap data are viewer classes which display a bitmap in a Windows window or XWindows window. There are limitations as to the quality of the display on non-24bpp displays. Error-diffusion to a small fixed palette may be employed.
Viewers have a refresh
method, that when called make the
screen match the contents of the bitmap data.
To help platforms which which a real-time display viewer does not exist,
a viewer exists which is given a GBM filename template and an initial value.
It will write a bitmap under that name and increment the value.
eg: if passed frame%03d.tif,lzw
and an initial value of 20,
the refresh
method will cause
frame020.tif
,
frame021.tif
,
frame022.tif
, .. etc. to be written (with LZW compression).
The classes representing (x,y,z) vector, colours, surfaces, shapes, viewpoints, polygon and wire-frame operations lists, all have methods allowing them to be translated, scaled and rotated in 3D space.
When compiling MR itself :-
makefile
to the main MR directory.
XOPTS
may
need to be changed on UNIX platforms other than Linux or MacOSX,
to reflect where the XWindows libraries are installed).
When writing a program using MR :-
#include "mr.h"
mr.h
("use the source Luke").
Look at samples such as RTMR, CUBE and LADYBIRD,
available from the same place where MR is obtained.
-Isomedir
to ensure the C++ compiler can find
mr.h
and any nested headers it uses.
mr.a
or mr.lib
.
makefile
uses C++ flags which #define
one or
more of :-
NO_CINCLUDES
- if the C++ compiler doesn't provide the
newer headers (such as cmath
), and we have to fall back
on the older headers (such as math.h
).
NO_STDNS
if the C++ compiler doesn't define standard
library classes and objects (such as cout
)
in the std
namespace
.
eg: IBM Visual Age C++.
STRSTREA
if the C++ compiler provides
strstrea.h
(probably due to 8.3 filename limitations),
when it should really be providing strstream.h
.
eg: IBM Visual Age C++.
-Isomedir
to ensure the C++ compiler can find
gbm.h
and any nested headers it uses.
gbm.a
or gbm.lib
.
gbmerr.a
or gbmerr.lib
.
user32.lib
and
gdi32.lib
.
-L/usr/X11R6/lib -lX11
.
MR has recently been enhanced to handle quartics, such as torii.
As a result it has to solve quartic equations and it currently uses an
analytical approach, using complex numbers.
The source is dependant on the standard <complex> header providing
a full implementation of template complex<base_type>
.
MR should compile fine any any modern ANSI / ISO standard C++ compiler.
On Linux I currently use Fedora 14, and g++.
On MacOSX, currently use Yosemite, XCode (which is clang based) and XQuartz.
On AIX, I use IBM xlC++ (aka Visual Age).
On SunOS, I expect I'd either use the SUNWspro CC, or g++.
On Windows, I use Visual Studio 2013, but with some tweaking of compiler versions, 2008 and 2005 should work.
I've compiled on Windows using mingw-w64 successfully also.
On OS/2, I use to use IBM VisualAge C/C++ 3.0, with CTC306, CTD302 and CTU304 fixes.
The UNIX makefile
relys on GNU make
.
I wrote all this code in my own time on my own equiptment. I hereby place all this code into the public domain. Feel free to do whatever you like with it. No copyright / no royalties / no guarantees / no problem. Caveat Emptor.