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 * Dale Ducharme 00008 * Side Effects Software Inc. 00009 * 20 Maud St. 00010 * Toronto, Ontario, M5V 2M5 00011 * Canada 00012 * 416-366-4607 00013 * 00014 * NAME: GU_Prim.h (C++) 00015 * 00016 * COMMENTS: The GU_Prim class is a the base class for which all 00017 * the primitive classes are subclassed off of. Common 00018 * utility operations are done here like conversion from one 00019 * primitive to another. 00020 * 00021 */ 00022 00023 #ifndef __GU_ConvertParms_h__ 00024 #define __GU_ConvertParms_h__ 00025 00026 #include "GU_API.h" 00027 #include <GEO/GEO_Detail.h> 00028 #include <GEO/GEO_SurfaceType.h> 00029 00030 class UT_Vector3; 00031 class GB_PrimitiveGroup; 00032 class GB_PointGroup; 00033 class GU_Detail; 00034 00035 enum GU_ConvertStyle 00036 { 00037 GU_CONVERT_LOD = 0, // use float level of detail 00038 GU_CONVERT_DIV = 1 // use integer divisions 00039 }; 00040 00041 typedef union 00042 { 00043 float lod; 00044 int div; 00045 } GU_ConvertUnion; 00046 00047 class GU_API GU_ConvertMethod 00048 { 00049 public: 00050 GU_ConvertMethod(GU_ConvertStyle s = GU_CONVERT_LOD) : style(s) {} 00051 00052 int isLOD() const { return style == GU_CONVERT_LOD; } 00053 int isDiv() const { return style == GU_CONVERT_DIV; } 00054 00055 void doLOD() { style = GU_CONVERT_LOD; } 00056 void doDiv() { style = GU_CONVERT_DIV; } 00057 00058 float getULOD() const { return isLOD() ? u.lod : u.div; } 00059 float getVLOD() const { return isLOD() ? v.lod : v.div; } 00060 float getTrimLOD() const { return isLOD() ? trim.lod : trim.div; } 00061 00062 void setULOD(float lod) { doLOD(); u.lod = lod; } 00063 void setVLOD(float lod) { doLOD(); v.lod = lod; } 00064 void setTrimLOD(float lod) { doLOD(); trim.lod = lod; } 00065 00066 int validULOD() const 00067 { return !isLOD() || (isLOD() && (u.lod > 0)); } 00068 int validVLOD() const 00069 { return !isLOD() || (isLOD() && (v.lod > 0)); } 00070 int validTrimLOD() const 00071 { return !isLOD() || (isLOD() && (trim.lod > 0)); } 00072 00073 int getUDiv() const { return u.div; } 00074 int getVDiv() const { return v.div; } 00075 int getTrimDiv() const { return trim.div; } 00076 00077 void setUDiv(int div) { doDiv(); u.div = div; } 00078 void setVDiv(int div) { doDiv(); v.div = div; } 00079 void setTrimDiv(int div) { doDiv(); trim.div = div; } 00080 00081 int validUDiv() const { return isDiv() && (u.div >= 0); } 00082 int validVDiv() const { return isDiv() && (v.div >= 0); } 00083 int validTrimDiv() const { return isDiv() && (trim.div >= 0); } 00084 00085 private: 00086 GU_ConvertUnion u; 00087 GU_ConvertUnion v; 00088 GU_ConvertUnion trim; 00089 GU_ConvertStyle style; 00090 }; 00091 00092 00093 class GU_API GU_ConvertParms 00094 { 00095 public: 00096 00097 GU_ConvertParms(); 00098 ~GU_ConvertParms(); 00099 00100 unsigned fromType; 00101 unsigned toType; 00102 00103 int orderu; 00104 int orderv; 00105 GEO_SurfaceType surface; 00106 00107 GU_ConvertMethod method; 00108 int interpHull; 00109 int trimmed; // trimmed spline surface 00110 00111 int featureCoord; // 1 feature, 0 base (for pasting) 00112 int featureAttrib; // 1 feature, 0 base (for pasting) 00113 int myMetaClusterFlag; 00114 00115 float myOffset; // Used for biasing isosurfaces. 00116 00117 int preserveGroups; 00118 00119 // Warning: This primGroup is potentially modified by the conversion 00120 GB_PrimitiveGroup *primGroup; 00121 00122 // If the gdp passed in is null, then no group will be created, the 00123 // existing group (if any) will be returned. 00124 // The user of the convert parms is required to blow these groups away 00125 GB_PointGroup *getDeletePoints(GU_Detail *gdp = 0); 00126 GB_PrimitiveGroup *getDeletePrimitives(GU_Detail *gdp = 0); 00127 void clearGroups() 00128 { 00129 myDeletePoints = 0; 00130 myDeletePrimitives = 0; 00131 } 00132 00133 private: 00134 GB_PointGroup *myDeletePoints; // Extra points to delete 00135 GB_PrimitiveGroup *myDeletePrimitives; // Extra primitives to delete 00136 }; 00137 00138 #endif
1.5.9