00001 /*
00002 File: RT_Defs.h
00003
00004 Function: Definitions for hierarchical grid raytracer
00005
00006 Author(s): Andrew Willmott
00007
00008 Copyright: (c) 1997-2000, Andrew Willmott
00009 */
00010
00011 #ifndef __RT_Defs__
00012 #define __RT_Defs__
00013
00014 #include "gcl/Geometry.h"
00015 #include "gcl/Colour.h"
00016 #include <stdlib.h>
00017
00018 /*
00019 Compile options:
00020
00021 RT_GRID_CACHE cache grid hits
00022 RT_TRI_CACHE cache triangle intersections
00023
00024 RT_GRID_SHADE_DEBUG set tri id to intersection level
00025 RT_MEM_DEFRAG allocate small chunks of memory
00026 RT_SUPPORT_GENS support general objects (not just tris)
00027 RT_VIS include visualisation stuff for drawing the grid
00028 USE_ANSI_C use C rather than C++ mem operations
00029 */
00030
00031 #define RT_TRI_CACHE
00032 #define RT_GRID_CACHE
00033
00034 #define RT_VIS
00035 #define USE_ANSI_C
00036
00037 #ifdef USE_ANSI_C
00038 #define RT_Alloc(X) (X*) malloc(sizeof(X))
00039 #define RT_ArrayAlloc(X, n) (X*) malloc(sizeof(X) * n)
00040 #define RT_ArrayAllocClr(X, n) (X*) calloc(n, sizeof(X))
00041 #define RT_Free(X) free(X)
00042 #define RT_ArrayFree(X) free(X)
00043 #else
00044 #define RT_Alloc(X) (new X)
00045 #define RT_ArrayAlloc(X, n) (new X[n])
00046 #define RT_ArrayAllocClr(X, n) (new X[n])
00047 #define RT_Free(X) delete (X)
00048 #define RT_ArrayFree(X) delete[] (X)
00049 #endif
00050
00051 inline ostream &operator<<(ostream &s, Int i[3])
00052 {
00053 cout << '[' << i[0] << ' ' << i[1] << ' ' << i[2] << ']';
00054 return(s);
00055 }
00056
00057 #endif