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 * Side Effects Software Inc. 00008 * 123 Front Street West, Suite 1401 00009 * Toronto, Ontario 00010 * Canada M5J 2M2 00011 * 416-504-9876 00012 */ 00013 00014 #ifndef __SIM_RayIntersect_h__ 00015 #define __SIM_RayIntersect_h__ 00016 00017 #include "SIM_API.h" 00018 #include <GU/GU_RayIntersect.h> 00019 #include "SIM_DataUtils.h" 00020 00021 class SIM_Geometry; 00022 00023 /// This class hold a GU_RayIntersect structure. This is a data structure 00024 /// that can be built from any GU_Detail. As such, this data should be 00025 /// used by attaching it as subdata to a SIM_Geometry, and calling 00026 /// createRayIntersect(). Because this data can be recreated on demand, 00027 /// it returns true from the getIsAlternateRepresentationSubclass() function 00028 /// and is never saved to or loaded from disk. It also gets deleted 00029 /// automatically if the parent SIM_Geomtry data changes. 00030 class SIM_API SIM_RayIntersect : public SIM_Data 00031 { 00032 public: 00033 /// Get the ray intersection structure. Note that the ray intersect 00034 /// information is always stored for the geometry without applying the 00035 /// geometry transform. This is unlike the SIM_SDF class, but is 00036 /// required by the nature of the ray intersection data structure, 00037 /// which holdson to primitive pointers. 00038 GU_RayIntersect &getRayIntersect() const; 00039 00040 protected: 00041 explicit SIM_RayIntersect(const SIM_DataFactory *factory); 00042 virtual ~SIM_RayIntersect(); 00043 00044 /// Clears the ray intersection data. 00045 virtual void initializeSubclass(); 00046 /// Returns the information that this data type is built on demand. 00047 /// It can be rebuilt at any time from any SIM_Geometry data. 00048 virtual int64 getMemorySizeSubclass() const; 00049 virtual bool getIsAlternateRepresentationSubclass() const; 00050 virtual void initAlternateRepresentationSubclass(const SIM_Data &); 00051 00052 private: 00053 /// Build the ray intersection structure from some geometry. 00054 void createRayIntersect(const SIM_Geometry *geo); 00055 00056 mutable GU_RayIntersect myRayIntersect; 00057 00058 DECLARE_STANDARD_GETCASTTOTYPE(); 00059 DECLARE_DATAFACTORY(SIM_RayIntersect, 00060 SIM_Data, 00061 "Geometry Ray Intersector", 00062 getEmptyDopDescription()); 00063 }; 00064 00065 #endif 00066
1.5.9