11 #ifndef __GU_UVPack_h__
12 #define __GU_UVPack_h__
24 int padding = 10,
bool pad_boundary =
false,
25 bool correct_area_proprtions =
false,
26 bool axis_align_islands =
false,
27 bool repack_wasted =
false);
32 { myPadding = padding; }
37 int tile_u = 0,
int tile_v = 0);
43 void udimPack(
bool guess_udim_from_uvs =
false);
52 {
if (y < myOrigLow(x)) myOrigLow(x) =
y; }
55 {
if (y > myOrigHigh(x)) myOrigHigh(x) =
y; }
58 {
return myTrivialRaster ? 0 : myLow(x); }
61 {
return myTrivialRaster ? 0 :
62 myHeight - 1 - myHigh(myWidth - 1 - x); }
65 {
return myTrivialRaster ?
66 myHeight - 1: myHigh(x); }
69 {
return myTrivialRaster ? myHeight - 1:
70 myHeight - 1 - myLow(myWidth - 1 - x); }
81 void dumpOrig(
int xstep,
int ystep);
82 void dump(
int xstep,
int ystep);
100 bool myTrivialRaster;
112 {
if (h > myHeight(i)) myHeight(i) =
h; }
114 {
if (h > myMaxHeight) myMaxHeight =
h; }
124 return myRasters(myNumInstances * island + inst);
129 {
return myPrimIsland(myGdp->vertexPrimitive(v)); }
133 void translateIslandsToOrigin();
136 void computeIslandAreas(
bool correct_area_proportions);
139 Raster *rasterizeIsland(
int island,
int inst,
int resolution,
146 bool isIslandTooLarge(
int island,
int resolutino);
148 void axisAlignIslands();
150 enum IslandPackStatus
161 myBaseU(0.0), myBaseV(0.0), myInstance(0), myInverted(false) {}
163 inline void setBaseU(
fpreal u) { myBaseU = u; }
164 inline void setBaseV(
fpreal v) { myBaseV =
v; }
165 inline void setInverted(
bool b) { myInverted =
b; }
166 inline void setInstance(
int i) { myInstance = i; }
168 inline fpreal getBaseU() {
return myBaseU; }
169 inline fpreal getBaseV() {
return myBaseV; }
170 inline bool isInverted() {
return myInverted; }
171 inline int getInstance() {
return myInstance; }
183 WastedSpace(
int w,
int x,
int y) :
184 myMinHeight(std::numeric_limits<
int>::
max()),
185 myMaxHeight(std::numeric_limits<
int>::
min()),
186 myWidth(w), myPosX(x), myPosY(y)
188 mySpaceLower.entries(w);
189 mySpaceUpper.entries(w);
192 inline void updateBounds(
int x,
int lower,
int upper)
194 mySpaceLower(x) =
lower;
195 mySpaceUpper(x) =
upper;
199 if (height < myMinHeight)
202 if (height > myMaxHeight)
208 inline int getMinHeight()
const
213 inline int getMaxHeight()
const
218 inline int getWidth()
const
223 inline int getPosX()
const
228 inline int getPosY()
const
233 inline int getLower(
int i)
const
235 return mySpaceLower(i);
238 inline int getUpper(
int i)
const
240 return mySpaceUpper(i);
246 int myMinHeight, myMaxHeight;
251 IslandPackStatus packIsland(
int i, Horizon &horizon,
253 int padding, Placement &placement);
255 void updateUVs(
bool all_tiles,
int tile_u,
int tile_v,
263 IslandPackStatus findBestWastedPacking(
int island,
265 int &x,
int &y,
bool &inverted,
int padding);
269 bool findBestPacking(Raster &
raster,
270 Horizon &horizon,
int &x,
int &y);
272 IslandPackStatus findBestPacking(
int island, Horizon &hor,
int &inst,
273 int &x,
int &y,
bool &inverted);
275 bool verifyWastedSpaceHorizonPacking(
const WastedSpace &wasted_space,
276 int horizon_value,
int shift,
int padding,
int pos)
const;
278 void setRaster(
int island,
int inst, Raster *
raster)
280 int idx = myNumInstances * island + inst;
282 delete myRasters(idx);
293 bool myAxisAlignIslands;
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
std::string upper(string_view a)
Return an all-upper case version of a (locale-independent).
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
Raster * getRaster(int island, int inst)
GA_API const UT_StringHolder scale
GLint GLsizei GLsizei height
void updateHigh(int x, int y)
HUSD_API const char * raster()
const UT_IntArray & getHeightData() const
HUSD_API const char * resolution()
int getInvertedHigh(int x)
void updateHeight(int i, int h)
GLboolean GLboolean GLboolean b
int getInvertedLow(int x)
GLfloat GLfloat GLfloat GLfloat h
std::string lower(string_view a)
Return an all-upper case version of a (locale-independent).
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLubyte GLubyte GLubyte GLubyte w
void setPadding(int padding)
void updateLow(int x, int y)
void updateMaxHeight(int h)