1 ////////////////////////////////////////////////////////////////////// 2 // 3 // Pixie 4 // 5 // Copyright � 1999 - 2003, Okan Arikan 6 // 7 // Contact: okan@cs.utexas.edu 8 // 9 // This library is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU Lesser General Public 11 // License as published by the Free Software Foundation; either 12 // version 2.1 of the License, or (at your option) any later version. 13 // 14 // This library is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 // Lesser General Public License for more details. 18 // 19 // You should have received a copy of the GNU Lesser General Public 20 // License along with this library; if not, write to the Free Software 21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 // 23 /////////////////////////////////////////////////////////////////////// 24 /////////////////////////////////////////////////////////////////////// 25 // 26 // File : options.h 27 // Classes : COptions 28 // Description : 29 // 30 //////////////////////////////////////////////////////////////////////// 31 #ifndef OPTIONS_H 32 #define OPTIONS_H 33 34 #include "common/global.h" 35 #include "common/containers.h" 36 #include "common/algebra.h" 37 #include "rendererc.h" 38 #include "xform.h" 39 #include "ri.h" 40 #include "shader.h" 41 #include "dsply.h" 42 #include "userAttributes.h" 43 44 // Possible projections 45 typedef enum { 46 OPTIONS_PROJECTION_PERSPECTIVE, // Perspective projection 47 OPTIONS_PROJECTION_ORTHOGRAPHIC // Orthographic projection 48 } EProjectionType; 49 50 // The search paths are kept as a linked list of the following items 51 typedef struct TSearchpath { 52 char *directory; 53 TSearchpath *next; 54 } TSearchpath; 55 56 // This is the depth filter type 57 typedef enum { 58 DEPTH_MIN, 59 DEPTH_MAX, 60 DEPTH_AVG, 61 DEPTH_MID 62 } EDepthFilter; 63 64 // Options flags 65 const unsigned int OPTIONS_FLAGS_CUSTOM_SCREENWINDOW = 1<<0; // The screenwindow is fixed 66 const unsigned int OPTIONS_FLAGS_CUSTOM_FRAMEAR = 1<<1; // The frame aspect ratio is fixed 67 const unsigned int OPTIONS_FLAGS_CUSTOM_RESOLUTION = 1<<2; // The resolution is fixed 68 const unsigned int OPTIONS_FLAGS_CUSTOM_CLIPPING = 1<<3; // The near/far clipping planes have been set by user 69 const unsigned int OPTIONS_FLAGS_FALSECOLOR_RAYTRACES = 1<<4; // Create a false color image of the effort being spent on the image 70 const unsigned int OPTIONS_FLAGS_INHERIT_ATTRIBUTES = 1<<12; // The object instance inherit attributes from the parent 71 const unsigned int OPTIONS_FLAGS_MOTIONBLUR = 1<<13; // We have motion blur in the scene (shutter open != shutter close) 72 const unsigned int OPTIONS_FLAGS_FOCALBLUR = 1<<14; // We have depth of field in the scene 73 const unsigned int OPTIONS_FLAGS_DEEP_SHADOW_RENDERING = 1<<16; // We're rendering a deep shadow map 74 const unsigned int OPTIONS_FLAGS_USE_RADIANCE_CACHE = 1<<17; // Use the new radiance cache 75 const unsigned int OPTIONS_FLAGS_PROGRESS = 1<<18; // Display the progress 76 const unsigned int OPTIONS_FLAGS_SAMPLESPECTRUM = 1<<19; // Sample the spectrum in photon hider 77 const unsigned int OPTIONS_FLAGS_SAMPLEMOTION = 1<<20; // We want the hider to sample motion blur (perform motion blur) 78 79 80 /////////////////////////////////////////////////////////////////////// 81 // Class : COptions 82 // Description : This class settings that are constant accross a frame 83 // Comments : 84 class COptions { 85 public: 86 87 88 /////////////////////////////////////////////////////////////////////// 89 // Class : CDisplay 90 // Description : Holds a display setting 91 // Comments : 92 class CDisplay { 93 public: 94 /////////////////////////////////////////////////////////////////////// 95 // Class : TDisplayParameter 96 // Description : Holds a display parameter 97 // Comments : 98 typedef struct { 99 char *name; 100 ParameterType type; 101 int numItems; 102 void *data; 103 } TDisplayParameter; 104 105 106 CDisplay(); 107 CDisplay(const CDisplay *); 108 ~CDisplay(); 109 110 char *outDevice; // The name of the out device 111 char *outName; // The name of the image 112 char *outSamples; // The samples to go into the display 113 CDisplay *next; 114 float quantizer[5]; // The quantization data 115 116 RtDisplayStartFunction startFunction; // For custom displays 117 RtDisplayDataFunction dataFunction; 118 RtDisplayFinishFunction finishFunction; 119 120 int numParameters; 121 TDisplayParameter *parameters; 122 }; 123 124 /////////////////////////////////////////////////////////////////////// 125 // Class : CClipPlane 126 // Description : Holds a user defined clip plane description 127 // Comments : 128 class CClipPlane { 129 public: 130 CClipPlane(); 131 CClipPlane(const CClipPlane *); 132 133 vector normal; // Normal vector in camera space 134 float d; // normal.P+d=0; 135 CClipPlane *next; // Next clipping plane 136 }; 137 138 139 COptions(); 140 COptions(const COptions *); 141 virtual ~COptions(); 142 143 // The following method is used to convert from a custom color space to RGB if- entered 144 void convertColor(vector &c,const float *f) const; 145 146 // Guess where to search by looking into the extension 147 TSearchpath *pickSearchpath(const char *name); 148 149 // Find a particular option 150 int find(const char *name,const char *category,EVariableType &type,const void *&value,int &intValue,float &floatValue) const; 151 152 153 154 155 156 157 158 159 160 //////////////////////////////////////////////////////////////////// 161 // options start here 162 //////////////////////////////////////////////////////////////////// 163 int xres,yres; // Output resolution 164 165 int frame; // The frame number given by frameBegin 166 167 float pixelAR; // Pixel aspect ratio 168 float frameAR; // Frame aspect ratio 169 170 float cropLeft,cropRight,cropTop,cropBottom; // The crop window 171 float screenLeft,screenRight,screenTop,screenBottom; // The screen window 172 173 float clipMin,clipMax; // Clipping bounds 174 175 float pixelVariance; // The maximum tolerable pixel color variation 176 177 float jitter; // Amount of jitter in samples 178 179 char *hider; // Hider name 180 181 TSearchpath *archivePath; // RIB search path 182 TSearchpath *proceduralPath; // Procedural primitive search path 183 TSearchpath *texturePath; // Texture search path 184 TSearchpath *shaderPath; // Shader search path 185 TSearchpath *displayPath; // Display search path 186 TSearchpath *modulePath; // Search path for Pixie modules 187 188 int pixelXsamples,pixelYsamples; // Number of samples to take in X and Y 189 190 float gamma,gain; // Gamma correction stuff 191 192 float pixelFilterWidth,pixelFilterHeight; // Pixel filter data 193 RtFilterFunc pixelFilter; 194 195 float colorQuantizer[5]; // The quantization data 196 float depthQuantizer[5]; 197 198 vector opacityThreshold; // The opacity threshold 199 vector zvisibilityThreshold; // The visibility threshold for z files and noncomp aovs 200 201 CDisplay *displays; // List of displays to send the output 202 203 CClipPlane *clipPlanes; // List of used defined clipping planes 204 205 float relativeDetail; // The relative detail multiplier 206 207 EProjectionType projection; // Projection type 208 float fov; // Field of view for perspective projection 209 210 int nColorComps; // Custom color space stuff 211 float *fromRGB,*toRGB; 212 213 float fstop,focallength,focaldistance; // Depth of field stuff 214 215 float shutterOpen,shutterClose; // Motion blur stuff 216 float shutterOffset; // Shutter offset 217 218 unsigned int flags; // Flags 219 220 //////////////////////////////////////////////////////////////////// 221 // Pixie dependent options 222 //////////////////////////////////////////////////////////////////// 223 224 int endofframe; // The end of frame statstics number 225 char *filelog; // The name of the log file 226 227 int numThreads; // The number of threads working 228 229 int maxTextureSize; // Maximum amount of texture data to keep in memory (in bytes) 230 231 int maxBrickSize; // Maximum amount of brick data to keep in memory (in bytes) 232 233 int maxGridSize; // Maximum number of points to shade at a time 234 235 int maxRayDepth; // Maximum raytracing recursion depth 236 237 int maxPhotonDepth; // The maximum number of photon bounces 238 239 int bucketWidth,bucketHeight; // Bucket dimentions in samples 240 241 int netXBuckets,netYBuckets; // The meta bucket size 242 243 int threadStride; // The number of buckets to distribute to threads at a time 244 245 int geoCacheMemory; // The ammount of memory to dedicate to tesselation caches 246 247 int maxEyeSplits; // Maximum number of eye splits 248 // The number of times the bucket will be rendered 249 250 float tsmThreshold; // Transparency shadow map threshold 251 252 char *causticIn,*causticOut; // The caustics in/out file name 253 char *globalIn,*globalOut; // The global photon map 254 255 int numEmitPhotons; // The number of photons to emit for the scene 256 257 int shootStep; // The number of rays to shoot at a time 258 259 EDepthFilter depthFilter; // Holds the depth filter type 260 261 CUserAttributeDictionary userOptions; // User options 262 }; 263 264 265 TSearchpath *optionsGetSearchPath(const char *,TSearchpath *); // Compute the search path 266 267 #endif 268 269