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 PXL_Raster is an RGB raster (with no alpha), then the alpha will be
44  /// pulled from the alpha_raster. If there's no alpha, all non-black
45  /// pixels will be considered opaque.
47  const PXL_Raster *alpha_raster,
48  Scheme scheme = SCHEME_FLOOD_FILL,
49  int fillPadding = 4);
50 
51  ~TIL_UVEnlarger();
52 
53  /// How many pixels to pad each UV island with, when using the
54  /// flood filling scheme for enlarging.
55  void setFillPadding(int fp)
56  { myFillPadding = fp; }
57 
58  /// Sets the scheme to use when enlarging.
59  void setScheme(Scheme scheme)
60  { myScheme = scheme; }
61 
62  bool enlarge(bool doUnpremult = true) const;
63 private:
64  PXL_Raster &myRaster;
65  const PXL_Raster *myAlphaRaster;
66  int myAttribNum;
67  int myAlphaRasterSize;
68 
69  Scheme myScheme;
70  int myFillPadding;
71 
72  /// The average pixel color of every UV island is computed, then the
73  /// background of the image is filled with that average color.
74  bool fillBackgroundColor() const;
75 
76  /// Return true if a pixel is on an UV island (filled area).
77  bool onIsland(int x, int y) const;
78 };
79 
80 #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