00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __COP2_CookAreaInfo_h__
00021 #define __COP2_CookAreaInfo_h__
00022
00023 #include "COP2_API.h"
00024 #include <iostream.h>
00025 #include <UT/UT_SmallObject.h>
00026 #include <UT/UT_Assert.h>
00027 #include <UT/UT_Math.h>
00028 #include <UT/UT_PtrArray.h>
00029
00030 class COP2_Node;
00031 class COP2_Context;
00032 class TIL_Plane;
00033
00034 class COP2_API COP2_CookAreaInfo
00035 : public UT_SmallObject<COP2_CookAreaInfo,
00036 UT_SMALLOBJECT_CLEANPAGES_OFF, 250,
00037 UT_SMALLOBJECT_THREADSAFE_ON>
00038 {
00039 public:
00040
00041 COP2_CookAreaInfo(COP2_Node &node,
00042 const TIL_Plane &plane,
00043 int array_index,
00044 int bounds_xstart, int bounds_ystart,
00045 int bounds_xend, int bounds_yend,
00046 int frame_xres, int frame_yres,
00047 float time);
00048
00049
00050
00051 COP2_CookAreaInfo(COP2_Node &node,
00052 const TIL_Plane &ref_plane,
00053 int array_index,
00054 float time);
00055
00056
00057 COP2_CookAreaInfo(COP2_Node &node,
00058 const TIL_Plane &plane,
00059 int array_index,
00060 int bounds_xstart, int bounds_ystart,
00061 int bounds_xend, int bounds_yend,
00062 int frame_xres, int frame_yres,
00063 float time,
00064 int needed_xstart, int needed_ystart,
00065 int needed_xend, int needed_yend);
00066
00067
00068 COP2_CookAreaInfo *clone(int array_index) const;
00069
00070
00071
00072 bool enlargeNeededArea(int xstart, int ystart, int xend, int yend);
00073 bool enlargeNeededArea(COP2_CookAreaInfo &area,
00074 int pixels_left = 0,
00075 int pixels_down = 0,
00076 int pixels_right = 0,
00077 int pixels_up = 0);
00078 bool enlargeNeededAreaToBounds();
00079
00080
00081
00082
00083
00084 bool expandNeededArea(int pixels_left, int pixels_down,
00085 int pixels_right, int pixels_up);
00086
00087
00088
00089 COP2_Context *getNodeContextData();
00090
00091
00092
00093
00094 bool matchPlaneInfo(const COP2_CookAreaInfo &match,
00095 bool node_too = true) const;
00096
00097
00098 const COP2_Node &getNode() const { return myNode; }
00099 COP2_Node &getNode() { return myNode; }
00100
00101 const TIL_Plane &getPlane() const { return *myPlane; }
00102
00103 int getArrayIndex() const { return myArrayIndex; }
00104
00105
00106 int getBoundsXStart() const { return myBoundsXStart; }
00107 int getBoundsYStart() const { return myBoundsYStart; }
00108 int getBoundsXEnd() const { return myBoundsXEnd; }
00109 int getBoundsYEnd() const { return myBoundsYEnd; }
00110
00111
00112 int getFrameXRes() const { return myFrameXRes; }
00113 int getFrameYRes() const { return myFrameYRes; }
00114
00115
00116 void setTime(float t) { myTime = t; }
00117 float getTime() const { return myTime; }
00118
00119
00120 bool isNeeded() const { return myIsNeeded; }
00121
00122
00123 int getNeededXStart() const { return myNeededXStart; }
00124 int getNeededYStart() const { return myNeededYStart; }
00125 int getNeededXEnd() const { return myNeededXEnd; }
00126 int getNeededYEnd() const { return myNeededYEnd; }
00127
00128 void print(ostream &os) const;
00129
00130 private:
00131 void alignNeededAreaToTileBoundaries();
00132
00133
00134
00135 COP2_Node &myNode;
00136 const TIL_Plane *myPlane;
00137
00138 int myArrayIndex;
00139
00140
00141 int myBoundsXStart;
00142 int myBoundsYStart;
00143 int myBoundsXEnd;
00144 int myBoundsYEnd;
00145
00146
00147 int myFrameXRes;
00148 int myFrameYRes;
00149
00150
00151 float myTime;
00152
00153
00154 bool myIsNeeded;
00155
00156
00157 int myNeededXStart;
00158 int myNeededYStart;
00159 int myNeededXEnd;
00160 int myNeededYEnd;
00161 };
00162
00163 inline ostream &
00164 operator<<(ostream &os, const COP2_CookAreaInfo &area)
00165 {
00166 area.print(os);
00167 return os;
00168 }
00169
00170
00171
00172
00173
00174 class COP2_API COP2_CookAreaList
00175 {
00176 public:
00177 explicit COP2_CookAreaList(unsigned int sz = 0) : myList(sz) { }
00178 ~COP2_CookAreaList() { }
00179
00180 COP2_CookAreaList(const COP2_CookAreaList &tocopy)
00181 : myList(tocopy.myList) { }
00182
00183
00184 unsigned int append(COP2_CookAreaInfo *&area);
00185 unsigned int entries() const { return myList.entries(); }
00186 void remove(int index) { myList.remove(index); }
00187
00188 void resize(int entries) { myList.resize(entries); }
00189 void entries(int entries) { myList.entries(entries); }
00190
00191
00192 COP2_CookAreaInfo *operator()(unsigned int i) const { return myList(i); }
00193
00194 private:
00195 UT_PtrArray<COP2_CookAreaInfo *> myList;
00196 };
00197
00198 #endif