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 * 00008 * Cristin Barghiel 00009 * Side Effects Software Inc. 00010 * 20 Maud St. 00011 * Toronto, Ontario, M5V 2M5 00012 * Canada 00013 * 416-366-4607 00014 * 00015 * NAME: GU_Skin.C (C++) 00016 * 00017 * COMMENTS: 00018 * This is the filter used to create skinned patches. 00019 */ 00020 00021 #ifndef __GU_Skin_h__ 00022 #define __GU_Skin_h__ 00023 00024 #include "GU_API.h" 00025 #include <GEO/GEO_Primitive.h> 00026 #include <GEO/GEO_SurfaceType.h> 00027 00028 class GB_PrimitiveGroup; 00029 class GU_Detail; 00030 00031 enum GU_SkinClosureType { 00032 GU_SKIN_CLOSE_NONE = 0, 00033 GU_SKIN_CLOSE = 1, 00034 GU_SKIN_CLOSE_AUTO = 2 00035 }; 00036 00037 typedef UT_PtrArray<GEO_Primitive*> TGEOPrimsArray; 00038 00039 /// This class can be used to queue up all primitives that are 00040 /// to be deleted, with actual deletion being done once the operation 00041 /// is complete. 00042 /// 00043 /// This is particularly useful when an operation is performed on 00044 /// multiple groups within one detail, since each deletion opeartion 00045 /// itself is O(n) where n is the number of primitives in the detail. 00046 /// Thus, accumulating primitives that are to be deleted and deleting them 00047 /// once instead of every time for every group can lead to signficantly 00048 /// faster code. 00049 class GU_API GU_SkinCache 00050 { 00051 public: 00052 GU_SkinCache(GEO_Detail& parent_detail); 00053 virtual ~GU_SkinCache(); 00054 00055 /// Queues up an array of primitives to delete. If delete_points is true, 00056 /// will delete primitives' points as well. All queued primitives are 00057 /// deleted either by calling cleanup() or in the destructor. 00058 void addCleanupPrimitives(TGEOPrimsArray* prims_array, bool delete_points); 00059 00060 /// Queues up a single primitive to delete. If delete_points is true, 00061 /// will delete primitives' points as well. All queued primitives are 00062 /// deleted either by calling cleanup() or in the destructor. 00063 void addCleanupPrimitive(GEO_Primitive* prim, bool delete_points); 00064 00065 /// Deletes all queued up primitives. 00066 virtual void cleanup(void); 00067 00068 private: 00069 /// Disable the assignment operator. We don't need to copy the arrays 00070 /// entirely (slow) and at the same time we don't want pointers being 00071 /// shared between multiple objects. 00072 GU_SkinCache& operator=(const GU_SkinCache &source) { return *this; } 00073 00074 private: 00075 00076 /// Holds pointers to primitives whose points also have to be deleted 00077 TGEOPrimsArray *myCleanupPrimsDeletePoints; 00078 00079 /// Holds pointers to primitives whose points are to be left alone 00080 TGEOPrimsArray *myCleanupPrimsLeavePoints; 00081 00082 /// Parent detail of the above primitives. For now we only support deleting 00083 /// primitives from one detail, but this can easily be extended to support 00084 /// multiple ones without changing external functions. 00085 GEO_Detail* myParentDetail; 00086 }; 00087 00088 class GU_API GU_SkinParms 00089 { 00090 public: 00091 GU_SkinParms(); 00092 virtual ~GU_SkinParms(); 00093 00094 void ConvertGroupToPrimsArray(GEO_Detail* parent_detail, const GB_PrimitiveGroup& group, TGEOPrimsArray& prims_array); 00095 virtual void InitializePrimArrays(GEO_Detail* parent_detail); 00096 00097 GEO_SurfaceType surfType; 00098 int vOrder; 00099 GU_SkinClosureType vWrap; 00100 int keepShape; // ruled or truly skinned 00101 const GB_PrimitiveGroup *uFaces; 00102 00103 TGEOPrimsArray *myUPrimsToProcess; 00104 }; 00105 00106 #endif
1.5.9