00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __IFD_Scene_h__
00022 #define __IFD_Scene_h__
00023
00024 #include "IFD_API.h"
00025 #include <UT/UT_String.h>
00026 #include <UT/UT_PtrArray.h>
00027 #include <UT/UT_VectorTypes.h>
00028 #include <UT/UT_BoundingBox.h>
00029 #include "IFD_Include.h"
00030
00031 class UT_WorkBuffer;
00032 class GU_Detail;
00033 class GB_AttributeRef;
00034 class GEO_Detail;
00035 class GEO_Point;
00036 class IMG_Raster;
00037 class TIL_Raster;
00038 class IFD_IPRTree;
00039
00040 enum IFD_AUTOGEN_TYPE {
00041 IFD_AUTOGEN_NONE = 0,
00042 IFD_AUTOGEN_NEAR,
00043 IFD_AUTOGEN_MID,
00044 IFD_AUTOGEN_FAR,
00045 IFD_AUTOGEN_AVERAGE
00046 };
00047
00048 enum IFD_AREALIGHT_TYPE {
00049 IFD_AREA_POINT,
00050 IFD_AREA_LINE,
00051 IFD_AREA_GRID,
00052 IFD_AREA_DISK,
00053 IFD_AREA_SPHERE,
00054 IFD_AREA_TUBE
00055 };
00056
00057 class IFD_API IFD_CameraParms {
00058 public:
00059 IFD_CameraParms() { setDefaults(); }
00060 void setDefaults();
00061 float focal;
00062 float aperture;
00063 float aspect;
00064 float focus;
00065 float fstop;
00066 float curvature;
00067 int xres, yres;
00068 float cropx[2];
00069 float cropy[2];
00070 float winx[2];
00071 float winy[2];
00072 float mynear, myfar;
00073 float jitter;
00074 float shutterTime;
00075 float gamma, gain;
00076 float shaderRate;
00077 int samplex, sampley;
00078 IFD_PROJECTION projection;
00079 float orthoZoom;
00080 int field;
00081 UT_String fieldPic;
00082 };
00083
00084 class IFD_API IFD_LightParms {
00085 public:
00086 IFD_LightParms() { setDefaults(); }
00087 void setDefaults();
00088 float r, g, b;
00089 float spread;
00090 float atten;
00091 float angle, delta, roll;
00092 int isAmbient;
00093 int isDiffuseLight;
00094 int isSpecularLight;
00095 int isCone;
00096 int isAtten;
00097 float reflectX, reflectY;
00098 float er, eg, eb;
00099 float exponent;
00100 float myActiveRadius;
00101 int causticStore, causticEmit;
00102 int globillumStore, globillumEmit;
00103 UT_String reflectionMap;
00104 UT_String diffuseMap;
00105 UT_String slideMap;
00106 UT_String zdepthMap;
00107 IFD_AREALIGHT_TYPE myAreaShape;
00108 float myAreaSamples;
00109 float myAreaSize;
00110
00111 int myDepthSamples[2];
00112 IFD_BLUR_TYPE myDepthBlur;
00113 int myDepthDOF;
00114
00115
00116
00117 int myPhotonDirect;
00118 };
00119
00120 class IFD_API IFD_GeometryParms {
00121 public:
00122 IFD_GeometryParms() { setDefaults(); }
00123 void setDefaults()
00124 {
00125 smoothShaded = 1;
00126 backfaceRemove = 0;
00127 validBox = 0;
00128 shutterBlur = 0;
00129 myAutoArchive = 0;
00130 myInterpretation = IFD_GEO_AS_IS;
00131 myFileName = 0;
00132 myProceduralName = 0;
00133 }
00134
00135 IFD_GEO_INTERP myInterpretation;
00136 unsigned int smoothShaded:1,
00137 backfaceRemove:1,
00138 validBox:1,
00139 shutterBlur:1,
00140 myAutoArchive:2;
00141 UT_String myFileName;
00142 UT_String myProceduralName;
00143 UT_BoundingBox myFileBound;
00144 };
00145
00146 class IFD_API IFD_ObjectParms {
00147 public:
00148 IFD_ObjectParms() { setDefaults(); }
00149 void setDefaults();
00150 int isRendered;
00151 int isMatte;
00152 int isPhantom;
00153 int reflectbounce;
00154 int transmitbounce;
00155 float rayclip;
00156 float displaceBounds;
00157 float shaderRate;
00158 float reflectShaderRate;
00159 float shadowShaderRate;
00160 float envShaderRate;
00161 float transmitShaderRate;
00162 float levelOfDetail;
00163 };
00164
00165 class IFD_API IFD_Scene {
00166 public:
00167 IFD_Scene();
00168 virtual ~IFD_Scene();
00169
00170
00171
00172
00173 virtual void initialize(float now);
00174 virtual bool finishFrame(int success, fpreal now);
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 virtual void setShutterTime(float shutter, int nsegments);
00185
00186
00187
00188
00189
00190
00191
00192
00193 virtual void getOutputImage(UT_String &str, float t,
00194 const char *rtype) = 0;
00195 virtual void getOutputDevice(UT_String &str, float t,
00196 const char *rtype);
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206 virtual int getRenderTag(const char *token, UT_String &value,
00207 float now);
00208 virtual bool getLightTag(const char *token, int index,
00209 UT_String &value, float now);
00210 virtual bool getObjectTag(const char *token, int index,
00211 UT_String &value, float now);
00212 virtual bool getGeometryTag(const char *token, int index,
00213 UT_String &value, float now);
00214 virtual bool getAtmosphereTag(const char *token, int index,
00215 UT_String &value, float now);
00216 virtual bool getSpaceTag(const char *token, int index,
00217 UT_String &value, float now);
00218 virtual bool getIPRTag(const char *token, int index,
00219 UT_String &value, float now);
00220
00221
00222
00223 virtual int getNLights(float now);
00224 virtual int getNObjects(float now);
00225 virtual int getNGeometry(float now);
00226 virtual int getNAtmosphere(float now);
00227 virtual int getNSpaces(float now);
00228 virtual int getNIPR(fpreal now);
00229
00230 virtual int doDepthOfField(float now);
00231 virtual float getDither(float now);
00232
00233
00234
00235 virtual int doMotionBlur(float now);
00236 virtual IFD_BLUR_TYPE doCameraBlur(float now);
00237 virtual IFD_BLUR_TYPE doObjectBlur(int idx, float now);
00238 virtual IFD_BLUR_TYPE doGeometryBlur(int idx, float now);
00239 virtual IFD_BLUR_TYPE doLightBlur(int idx, float now);
00240
00241
00242 virtual void getCameraPreInclude(UT_WorkBuffer &str, float now,
00243 const char *rtype);
00244 virtual void getCameraPostInclude(UT_WorkBuffer &str, float now,
00245 const char *rtype);
00246 virtual void getObjectPreInclude(int idx, UT_WorkBuffer &str,
00247 float now, const char *rtype);
00248 virtual void getObjectPostInclude(int idx, UT_WorkBuffer &str,
00249 float now, const char *rtype);
00250 virtual void getLightPreInclude(int idx, UT_WorkBuffer &str,
00251 float now, const char *rtype);
00252 virtual void getLightPostInclude(int idx, UT_WorkBuffer &str,
00253 float now, const char *rtype);
00254 virtual void getAtmospherePreInclude(int idx, UT_WorkBuffer &str,
00255 float now, const char *rtype);
00256 virtual void getAtmospherePostInclude(int idx, UT_WorkBuffer &str,
00257 float now, const char *rtype);
00258 virtual void getSpacePreInclude(int idx, UT_WorkBuffer &str,
00259 float now, const char *rtype);
00260 virtual void getSpacePostInclude(int idx, UT_WorkBuffer &str,
00261 float now, const char *rtype);
00262 virtual void getIPRPreInclude(int idx, UT_WorkBuffer &str,
00263 float now, const char *rtype);
00264 virtual void getIPRPostInclude(int idx, UT_WorkBuffer &str,
00265 float now, const char *rtype);
00266 virtual void getRenderGenericInclude(const char *parm_name,
00267 UT_WorkBuffer &str, float now);
00268
00269
00270
00271 virtual void getCameraParms(IFD_CameraParms &parms, float now,
00272 const char *rtype);
00273 virtual void getCameraTransform(UT_DMatrix4 &xform, float now);
00274
00275 virtual void getLensShader(UT_String &str, float now,
00276 const char *rtype);
00277 virtual void getImagerShader(UT_String &str, float now,
00278 const char *rtype);
00279
00280
00281
00282
00283
00284
00285 virtual int getBackgroundImage(UT_String &filename,
00286 float now);
00287 virtual const IMG_Raster *getBackgroundImage(float now,
00288 int xres=0, int yres=0);
00289
00290
00291
00292 virtual const TIL_Raster *getBackgroundImageRaster(float now,
00293 int xres=0, int yres=0);
00294
00295
00296
00297 virtual bool isObjectMaskMember(float now, int obj_idx,
00298 const char *tag);
00299
00300
00301
00302
00303
00304
00305
00306 virtual void getLightName(int idx, UT_String &str);
00307 virtual int getLightIndex(const char *name);
00308 virtual void getLightShader(int idx, UT_String &str, float now,
00309 const char *rtype);
00310 virtual void getShadowShader(int idx, UT_String &str, float now,
00311 const char *rtype);
00312 virtual void getEmitterShader(int idx, UT_String &str, float now,
00313 const char *rtype);
00314 virtual int getAutogenFlag(int idx, float now);
00315 virtual void getShadowName(int idx, UT_String &str, float now);
00316 virtual void getLightParms(int idx, IFD_CameraParms &parms,
00317 float now, const char *rtype);
00318 virtual void getLightParms(int idx, IFD_LightParms &parms,
00319 float now, const char *rtype);
00320 virtual void getLightTransform(int idx, UT_DMatrix4 &m, float now);
00321 virtual void getShadowMask(int idx, UT_String &str, float t);
00322
00323
00324
00325
00326
00327 virtual void getAtmosphereName(int idx, UT_String &str);
00328 virtual int getAtmosphereIndex(const char *name);
00329 virtual void getAtmosphereShader(int idx, UT_String &str,
00330 float now, const char *rtype);
00331 virtual int getAtmosphereGeometry(int idx);
00332 virtual void getAtmosphereTransform(int idx, UT_DMatrix4 &mat,
00333 float now);
00334 virtual void getAtmosphereParms(int idx, IFD_ObjectParms &parms,
00335 float now, const char *rtyp);
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 virtual void getObjectName(int idx, UT_String &str, int unique);
00350 virtual int getObjectIndex(const char *name);
00351
00352 virtual void getObjectShader(int idx, UT_String &str, float now,
00353 const char *rtype);
00354
00355 #if 0
00356
00357
00358
00359 virtual const void *getObjectShader(int idx, float t, const char *rtype);
00360 #endif
00361
00362 virtual void getObjectShaderTransform(int idx, UT_DMatrix4 &xform,
00363 float now);
00364 virtual void getInteriorShader(int i, UT_String &str, float now,
00365 const char *rtype);
00366 virtual void getInteriorShaderTransform(int idx, UT_DMatrix4 &xform,
00367 float now);
00368 virtual void getDisplacementTransform(int idx, UT_DMatrix4 &xform,
00369 float now);
00370 virtual void getDisplacementShader(int idx, UT_String &str,
00371 float now, const char *rtype);
00372 virtual void getGeometryShader(int idx, UT_String &str, float t,
00373 const char *rtype);
00374 virtual void getSurfaceEnvironmentShader(int idx, UT_String &str,
00375 float t, const char *rtype);
00376 virtual void getSurfaceShadowShader(int idx, UT_String &str,
00377 float t, const char *rtype);
00378 virtual void getPhotonShader(int idx, UT_String &str, float t,
00379 const char *rtype);
00380 virtual void getPhotonVolumeShader(int idx, UT_String &str,
00381 float now, const char *rtype);
00382 virtual void getContourShader(int idx, UT_String &str, float t,
00383 const char *rtype);
00384
00385 virtual int isObjectLit(int objIndex, int lightIndex, float now);
00386 virtual int isObjectShadower(int objIndex, int lightIndex,
00387 float now);
00388
00389 virtual int isObjectReflected(int objIndex, int reflObjIndex,
00390 float now);
00391 virtual void getReflectMask(int objIndex, UT_String &str, float t);
00392 virtual int isAutoReflect(int objIndex, float now,
00393 UT_String &mapname);
00394 virtual int getAutoReflectResolution(int objIndex, float now);
00395 virtual void getObjectParms(int idx, IFD_ObjectParms &parms,
00396 float now, const char *rtype);
00397 virtual void getObjectTransform(int idx, UT_DMatrix4 &xform,
00398 float now);
00399 virtual int getObjectGeometry(int idx);
00400 virtual IFD_PHOTON_MODE getObjectCausticsMode(int idx, float t);
00401 virtual IFD_PHOTON_MODE getObjectGlobalIllumMode(int idx, float t);
00402
00403 virtual void getGeometryName(int idx, UT_String &name);
00404 virtual GU_Detail *getGeometry(int idx, float now);
00405 virtual void releaseGeometry(int idx);
00406 virtual void getGeometryParms(int idx, IFD_GeometryParms &parms,
00407 float now, const char *rtype);
00408
00409 virtual void getSpaceName(int idx, UT_String &name);
00410 virtual void getSpaceTransform(int idx, UT_DMatrix4 &xform,
00411 float now);
00412
00413 virtual void getIPRName(int idx, UT_String &name);
00414
00415 virtual void getObjectParms(int idx, IFD_GeometryParms &parms,
00416 float now, const char *rtype);
00417
00418 virtual void getInstanceGroups(int idx, UT_String &groups);
00419
00420 virtual IFD_IPRTree *getIPRTree(int idx);
00421
00422
00423 virtual int getNumObjectBundles(int obj_idx);
00424
00425
00426 virtual const char *getObjectBundleName(int obj_idx, int bundle_idx);
00427
00428
00429
00430 virtual bool outputBundleNames();
00431
00432
00433
00434
00435
00436
00437 virtual void addWorld(const char *name,
00438 const char *atmosphereShader = 0) = 0;
00439
00440 virtual void addCamera(const char *name,
00441 IFD_CameraParms &cparms,
00442 const UT_DMatrix4 &xform,
00443 const char *parent = 0) = 0;
00444
00445 virtual void addLight(const char *name,
00446 IFD_LightParms &parms,
00447 IFD_CameraParms &cparms,
00448 const UT_DMatrix4 &xform,
00449 const char *parent = 0) = 0;
00450
00451
00452
00453 virtual void addObject(const char *name, GU_Detail *gdp,
00454 IFD_GeometryParms &parms,
00455 const UT_DMatrix4 &xform,
00456 const char *parent = 0,
00457 const char *material = 0,
00458 const char *shader = 0,
00459 const char *displacement = 0,
00460 const char *interior = 0) = 0;
00461
00462
00463
00464
00465
00466
00467
00468
00469 static int dereferenceShopShader(GEO_Detail *gdp,
00470 const char *shopref,
00471 const char *objpath,
00472 const char *shader_attrib,
00473 int shop_type,
00474 const char *rtype, float now);
00475
00476
00477
00478
00479
00480
00481 static int resolveShopString(UT_String &shader,
00482 const char *shop_path,
00483 const char *objpath,
00484 int shop_type,
00485 const char *renderer_name,
00486 float now);
00487
00488
00489
00490
00491
00492
00493 static void getInstanceTransform(UT_DMatrix4 &xform,
00494 const GEO_Point *ppt,
00495 const GB_AttributeRef &v_off,
00496 const GB_AttributeRef &n_off,
00497 const GB_AttributeRef &pscale_off,
00498 const GB_AttributeRef &pscale3_off,
00499 const GB_AttributeRef &up_off,
00500 const GB_AttributeRef &rot_off,
00501 const GB_AttributeRef &trans_off,
00502 const GB_AttributeRef &orient_off,
00503 float tscale);
00504
00505 int myExtraDataType;
00506 void *myExtraData;
00507
00508 protected:
00509
00510 void setDefaultParms(IFD_CameraParms &parms)
00511 { parms.setDefaults(); }
00512 void setDefaultParms(IFD_LightParms &parms)
00513 { parms.setDefaults(); }
00514 void setDefaultParms(IFD_ObjectParms &parms)
00515 { parms.setDefaults(); }
00516 void setDefaultParms(IFD_GeometryParms &parms)
00517 { parms.setDefaults(); }
00518 private:
00519 IMG_Raster *myBackgroundImage;
00520 };
00521
00522 #endif