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 00008 * 477 Richmond Street West 00009 * Toronto, Ontario 00010 * Canada M5V 3E7 00011 * 416-504-9876 00012 */ 00013 00014 #ifndef __POP_AttribMap_h__ 00015 #define __POP_AttribMap_h__ 00016 00017 #include "POP_API.h" 00018 #include <UT/UT_LinkList.h> 00019 #include <GB/GB_Attribute.h> 00020 #include <GB/GB_FloatOffsets.h> 00021 #include <GEO/GEO_AttributeHandleList.h> 00022 00023 class POP_AttribMap; 00024 class POP_ContextData; 00025 class GU_Detail; 00026 class GEO_WorkVertexBuffer; 00027 00028 // The POP_AttribMap is a class used to keep track of which attributes 00029 // to inherit when birthing particles. 00030 00031 class POP_API POP_AttribMapping : public UT_LinkNode 00032 { 00033 public: 00034 POP_AttribMapping() 00035 { 00036 indexRemapSize = 0; 00037 myIndexRemap = 0; 00038 } 00039 00040 ~POP_AttribMapping() 00041 { 00042 delete [] myIndexRemap; 00043 } 00044 00045 GB_AttribType getType() const { return myType; } 00046 00047 const int *getIndexRemap() const { return myIndexRemap; } 00048 int getIndexRemap(int idx) 00049 { 00050 return idx>=0 && idx<indexRemapSize ? myIndexRemap[idx]:-1; 00051 } 00052 int getIndexRemapSize() const { return indexRemapSize; } 00053 int getSourceOffset() const { return sourceOffset; } 00054 int getDestOffset() const { return destOffset; } 00055 int getSize() const { return size; } 00056 00057 private: 00058 int sourceOffset; 00059 int destOffset; 00060 int size; 00061 const void* def; 00062 GB_AttribType myType; 00063 00064 int indexRemapSize; 00065 int *myIndexRemap; 00066 00067 friend class POP_AttribMap; 00068 }; 00069 00070 class POP_API POP_AttribMap : public UT_LinkList 00071 { 00072 public: 00073 POP_AttribMap (void); 00074 virtual ~POP_AttribMap (void); 00075 00076 void build (POP_ContextData* map, const GU_Detail* source, 00077 GU_Detail* dest, const UT_String &pattern, 00078 int addLocalVar = 0); 00079 00080 GEO_AttributeHandleList &getHandles() { return myHandles; } 00081 GEO_AttributeHandle *getSrcPositionHandle() { return mySrcPHandle; } 00082 GEO_AttributeHandle *getSrcNormalHandle() { return mySrcNHandle; } 00083 GEO_AttributeHandle *getSrcVelocityHandle() { return mySrcVHandle; } 00084 bool hasSrcVelocity() const { return mySrcVHandle != 0; } 00085 00086 int getSrcNormalOffset (void) { return(mySrcNormalOffset); } 00087 int getSrcVelocityOffset (void) { return(mySrcVelocityOffset); } 00088 int hasSrcVelocity (void) { return(mySrcVelocityOffset != -1); } 00089 00090 UT_Vector3* getSrcNormal (GB_AttributeData* attr); 00091 void setSrcNormal (const UT_Vector3& nml) { mySourceNml = nml; } 00092 00093 GB_FloatOffsets& getFloatOffsets (void) 00094 { return(myFloatOffsets); } 00095 GB_FloatOffsets& getVectorOffsets (void) 00096 { return(myVectorOffsets); } 00097 GB_AttributeData* getAttributeData (void) 00098 { return(&myAttributeData); } 00099 int getAttributeDataSize (void) const 00100 { return(myAttributeDataSize); } 00101 GEO_Vertex *getVertex(int idx=0); 00102 00103 private: 00104 void prepareIndexAttribRemapping( 00105 POP_AttribMapping &mapping, 00106 GB_Attribute *src_attrib, 00107 GB_Attribute *dest_attrib); 00108 00109 GEO_AttributeHandleList myHandles; 00110 GEO_AttributeHandle *mySrcPHandle; 00111 GEO_AttributeHandle *mySrcNHandle; 00112 GEO_AttributeHandle *mySrcVHandle; 00113 00114 int mySrcNormalOffset; 00115 int mySrcVelocityOffset; 00116 00117 GEO_WorkVertexBuffer *myVertexBuffer; 00118 00119 GB_AttributeData myAttributeData; 00120 int myAttributeDataSize; 00121 GB_FloatOffsets myFloatOffsets; 00122 GB_FloatOffsets myVectorOffsets; 00123 UT_Vector3 mySourceNml; 00124 }; 00125 00126 #endif
1.5.9