HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TIL_UVEnlarger.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: TIL_UVEnlarger.h (TIL Library, C++)
7  *
8  * COMMENTS: This class is responsible for post-processing of texture maps
9  * in order to help reduce the effects of seams forming at the
10  * border of UV islands. It's currently being used to post-process
11  * UV rendered images (see VGEO_UVUnwrapper).
12  */
13 #ifndef TIL_UVEnlarger_H
14 #define TIL_UVEnlarger_H
15 
16 #include "TIL_API.h"
17 #include <PXL/PXL_Raster.h>
18 
19 #include "TIL_Defines.h"
20 #include <set>
21 
23 {
24 public:
25  enum Scheme
26  {
27  /// Computes the average value of all the pixels that are a part of
28  /// UV islands, then applies that average value to all empty parts
29  /// of the image.
31 
32  /// Does a flood fill on the image and expands the boundary of each
33  /// UV island found by the amount specified by myFillPadding.
35 
36  /// Does a diffusion fill on empty areas after expanding boundaries
37  /// of UV island specified by myFillPadding.
39 
40  SCHEME_INVALID
41  };
42 
43  /// If craster is NULL, then pixels in raster that has zero value will be
44  /// assumed to have zero alpha.
46  PXL_Raster *craster,
47  Scheme scheme = SCHEME_FLOOD_FILL,
48  int fillPadding = 4);
49 
50  ~TIL_UVEnlarger();
51 
52  /// How many pixels to pad each UV island with, when using the
53  /// flood filling scheme for enlarging.
54  void setFillPadding(int fp)
55  { myFillPadding = fp; }
56 
57  /// Sets the scheme to use when enlarging.
58  void setScheme(Scheme scheme)
59  { myScheme = scheme; }
60 
61  bool enlarge(bool doUnpremult = true);
62 private:
63  PXL_Raster &myRaster;
64  PXL_Raster *myCRaster;
65  int myAttribNum;
66 
67  Scheme myScheme;
68  int myFillPadding;
69 
70  /// The average pixel color of every UV island is computed, then the
71  /// background of the image is filled with that average color.
72  bool fillBackgroundColor();
73 
74  /// Return true if a pixel is on an UV island (filled area).
75  bool onIsland(const int &x,
76  const int &y);
77 };
78 
79 #endif
void setFillPadding(int fp)
GLint y
Definition: glcorearb.h:103
void setScheme(Scheme scheme)
Sets the scheme to use when enlarging.
HUSD_API const char * raster()
GLint GLenum GLint x
Definition: glcorearb.h:409
#define TIL_API
Definition: TIL_API.h:10