00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef TIL_PLANE_H
00021 #define TIL_PLANE_H
00022
00023 #include "TIL_API.h"
00024 #include <UT/UT_SmallObject.h>
00025 #include <iostream.h>
00026 #include <string.h>
00027
00028 #include "TIL_Defines.h"
00029
00030 class TIL_API TIL_Plane :
00031 public UT_SmallObject<TIL_Plane,
00032 UT_SMALLOBJECT_CLEANPAGES_OFF, 250,
00033 UT_SMALLOBJECT_THREADSAFE_ON>
00034 {
00035 public:
00036 TIL_Plane(const char *name, TIL_DataFormat format,
00037 const char *n1=0,
00038 const char *n2=0,
00039 const char *n3=0,
00040 const char *n4=0);
00041 TIL_Plane(const TIL_Plane &);
00042 TIL_Plane();
00043 virtual ~TIL_Plane();
00044
00045
00046
00047 TIL_Plane & operator=(const TIL_Plane &);
00048
00049
00050
00051 inline int operator==(const TIL_Plane &eq) const
00052 { return (strcmp(eq.getName(), getName()) == 0); }
00053
00054 inline int operator!=(const TIL_Plane &eq) const
00055 { return (strcmp(eq.getName(), getName()) != 0); }
00056
00057 bool matches(const TIL_Plane &) const;
00058 bool isCompatible(const TIL_Plane &) const;
00059
00060
00061
00062 const char * getName() const { return myName; }
00063 void setName(const char *name);
00064
00065 bool isAlphaPlane() const;
00066 bool isColorPlane() const;
00067 bool isPointPlane() const;
00068 bool isNormalPlane() const;
00069 bool isDepthPlane() const;
00070 bool isGeometricPlane() const;
00071
00072
00073 TIL_DataFormat getFormat() const { return (TIL_DataFormat)myFormat; }
00074 void setFormat(TIL_DataFormat format);
00075
00076
00077
00078 int getArraySize() const { return myArraySize; }
00079 void setArraySize(int n);
00080
00081
00082 int getVectorSize() const { return myVectorSize; }
00083 void setVectorSize(int n);
00084
00085
00086 inline const char * getSubName(int i) const
00087 { return (i>=0 && i<myVectorSize) ? mySubName[i] : 0; }
00088
00089 void setSubName(const char *subname, int i);
00090 int hasElement(const char *planename);
00091
00092
00093
00094
00095
00096
00097 inline int getPlaneMask(int i) const
00098 { return (i>=0 && i<myVectorSize) ? myPlaneMask[i]:0; }
00099
00100 void setPlaneMask(int enable, int i);
00101 void copyPlaneMask(const TIL_Plane &plane);
00102 inline void setScoped(int enable)
00103 { for(int i=myVectorSize; i--;) myPlaneMask[i]=(char)enable; }
00104
00105 bool isScoped() const;
00106 bool isPartiallyScoped() const;
00107 bool scopeMatches(const TIL_Plane &plane) const;
00108
00109
00110 int getArrayMask(int i) const;
00111 void setArrayMask(int start, int end, int step);
00112
00113
00114 bool isConstantPlane() const;
00115 bool isConstantComponent(int i) const;
00116 bool isAnyComponentConstant() const;
00117 void setConstantFlag(int i, bool enable);
00118
00119
00120 int usesBlackWhitePoints() const;
00121 void getBlackWhitePoints(unsigned int &b,
00122 unsigned int &w) const
00123 { b = myBlackPoint; w = myWhitePoint; }
00124 void getBlackWhitePoints(float &b, float &w) const;
00125 void setBlackWhitePoints(unsigned int b, unsigned int w);
00126
00127 void debugPrint(ostream &os) const;
00128 int64 getMemSize() const;
00129
00130 unsigned getHash() const;
00131
00132 private:
00133 const char * myName;
00134 unsigned short myArraySize;
00135 unsigned char myFormat;
00136 unsigned char myVectorSize;
00137
00138 const char * mySubName[PLANE_MAX_VECTOR_SIZE];
00139
00140
00141
00142
00143 signed char myPlaneMask[PLANE_MAX_VECTOR_SIZE];
00144 int myArrayMaskStart;
00145 int myArrayMaskEnd;
00146 int myArrayMaskStep;
00147
00148
00149 char myConstantFlag[PLANE_MAX_VECTOR_SIZE];
00150
00151
00152 unsigned int myBlackPoint;
00153 unsigned int myWhitePoint;
00154 unsigned int myNameAlloc :1,
00155 myComp0Alloc :1,
00156 myComp1Alloc :1,
00157 myComp2Alloc :1,
00158 myComp3Alloc :1;
00159 };
00160
00161
00162 #endif