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: GEO_IORibXlate.h ( GEO Library, C++) 00015 * 00016 * COMMENTS: RIB Attribute translation... 00017 */ 00018 00019 #ifndef __GEO_IORibXlate__ 00020 #define __GEO_IORibXlate__ 00021 00022 #include "GEO_API.h" 00023 class GEO_Detail; 00024 class GB_Attribute; 00025 class UT_String; 00026 00027 typedef enum { 00028 GEO_RIB_FLOAT, 00029 GEO_RIB_STRING 00030 } GEO_RibAttribute; 00031 00032 class GEO_API GEO_IORibXlate { 00033 public: 00034 GEO_IORibXlate(const char *map); 00035 ~GEO_IORibXlate(); 00036 00037 void setOffset(const GEO_Detail *gdp); 00038 int getAttribOffset() const { return myAttribOffset; } 00039 00040 int isValid() const { return myAttrib != 0; } 00041 00042 enum AttribClass { 00043 ATTRIB_INVALID = -1, 00044 ATTRIB_POINT = 0, 00045 ATTRIB_VERTEX, 00046 ATTRIB_PRIMITIVE, 00047 ATTRIB_DETAIL 00048 }; 00049 AttribClass getAttribClass() const { return myHType; } 00050 int isPoint() const { return myHType == ATTRIB_POINT; } 00051 int isVertex() const { return myHType == ATTRIB_VERTEX; } 00052 int isPrimitive() const { return myHType == ATTRIB_PRIMITIVE; } 00053 int isDetail() const { return myHType == ATTRIB_DETAIL; } 00054 00055 00056 float getFloat(const void *data, int idx) const ; 00057 void getString(UT_String &result, const void *data, 00058 int idx) const; 00059 00060 GEO_RibAttribute getRManDataType() const { return myRManData; } 00061 00062 const char *getHName() const { return myHName; } 00063 const char *getRMName() const { return myRManName; } 00064 const char *getRMType() const { return myRManType; } 00065 const char *getRMFaceType() const { return myRManFaceType; } 00066 int getRMSize() const { return myRManSize; } 00067 int getRMOffset() const { return myRManOffset; } 00068 00069 // Here, RenderMan has 2 types of point attribute (vertex/varying) 00070 // as well as two types of primitive attribute (uniform/constant). What 00071 // we do is overload the vertex flag to indicate both vertex and constant 00072 // since the attribute is going to be either point/primitive from the 00073 // Houdini end. 00074 int isRManPerVertex() const { return myRManVertex; } 00075 int isRManConstant() const { return myRManVertex; } 00076 00077 private: 00078 const GB_Attribute *myAttrib; 00079 char *myHName; 00080 char *myRManName; 00081 const char *myRManType; 00082 const char *myRManFaceType; 00083 GEO_RibAttribute myRManData; 00084 int myAttribOffset; 00085 AttribClass myHType; 00086 int myRManOffset; 00087 int myRManSize; 00088 int myRManVertex; 00089 }; 00090 00091 #endif 00092
1.5.9