00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Mark Elendt 00008 * Side Effects Software Inc 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: VRAY_ProcIsoBase.h ( VRAY Library, C++) 00015 * 00016 * COMMENTS: Iso-surface procedural baseclass 00017 */ 00018 00019 #ifndef __VRAY_ProcIsoBase__ 00020 #define __VRAY_ProcIsoBase__ 00021 00022 #include "VRAY_API.h" 00023 #include <UT/UT_BoundingBox.h> 00024 #include "VRAY_Procedural.h" 00025 00026 class VRAY_API VRAY_ProcIsoBase : public VRAY_Procedural { 00027 public: 00028 VRAY_ProcIsoBase(); 00029 virtual ~VRAY_ProcIsoBase(); 00030 00031 virtual const char *getClassName() = 0; 00032 00033 // 00034 // The sub-class is responsible for initializing parameters. The 00035 // initialization follows the rules for VRAY_Procedural. 00036 virtual int initialize(const UT_BoundingBox *box) = 0; 00037 // 00038 // The evalDensity method is used to evaluate the density of the iso 00039 // surface. The surface will be generated where the density is 0. 00040 virtual fpreal evaluateDensity(const float pos[3]) const = 0; 00041 00042 // 00043 // The render method may require the full surface to be split into smaller 00044 // procedurals. The box passed in to the createChild() method is the 00045 // bounding box without motion vectors applied. This method is responsible 00046 // for: 00047 // a) Creating a new sub-class instance 00048 // b) Setting the myBox member data. The myBox must be 00049 // totally enclosed in the bounding box passed in. 00050 // c) Setting the myVelBox member data (possibly to the same 00051 // value as myBox if there is no motion blur) 00052 // 00053 virtual VRAY_ProcIsoBase *createChild(const UT_BoundingBox &box) = 0; 00054 00055 // 00056 // Attributes must be created for geometry before it's added to mantra, but 00057 // after the points and polygons have been created. The attributes can be 00058 // arbitrary. However, since velocity is used in generation of motion blur 00059 // data, the index of the velocity attribute in the gdp needs to be 00060 // returned by this method. Thus the return codes are: 00061 // 00062 // <= -2 - An un-recoverable error 00063 // -1 - No velocity attribute 00064 // >= 0 - The offset into the GEO_Point::attribData() of the velocity 00065 // 00066 // By default, -1 is returned and no attributes are added. 00067 // 00068 // If velocity attributes are added to the detail, an arbitrary scale can 00069 // also be applied to the velocity (i.e. shutter). 00070 virtual int addAttributes(GU_Detail *gdp, float &velocityscale); 00071 00072 // 00073 // By default, this will return the bounding box with velocity motion 00074 // vectors applied. This is required since mantra needs to know the entire 00075 // possible range of geometry. 00076 virtual void getBoundingBox(UT_BoundingBox &box); 00077 00078 // 00079 // The render method does not need to be overridden by the sub-class. 00080 virtual void render(); 00081 00082 protected: 00083 // Data which is unique per iso-procedural 00084 // Member data is: 00085 // myBox - The bounding box without velocity motion blur 00086 // information applied. 00087 // myVelBox - The bounding box including motion blur vectors 00088 // myLodScale - An level of detail scale independent of the shading 00089 // quality of the instance. This allows larger polygons 00090 // to be generated without sacrificing shading. 00091 UT_BoundingBox myBox; 00092 UT_BoundingBox myVelBox; 00093 float myLodScale; 00094 }; 00095 00096 #endif 00097
1.5.9