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 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 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, 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.
-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.
I've compiled MR with the IBM xlC++ compiler under AIX, g++ under Linux, and it should compile fine with any ANSI UNIX compiler.
I've also used the IBM VisualAge C/C++ 3.0 compiler for OS/2, with CTC306, CTD302 and CTU304 fixes.
I've used MSVC 6.0 under 32 bit Windows and it works too.
The UNIX makefile relys on GNU make.
If you haven't got this, you can use the mpp script on my
home page to pre-process the ifdefs and produce a file
suitable for your platform.
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.
All the source code is folded using Andys Source Code Folding Editor, which should be available from the same place you obtained this package. The source is all highly portable.
The full source to GBM is hopefully available from the same place you obtained this Ray Tracer. GBM is also highly portable.
MR, the GBM executables, the GBM source, and Andys Source Code Folding Editor are best obtained via my home page :-