HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_TextureFilter.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: IMG_TextureFilter.h ( IMG Library, C++)
7  *
8  * COMMENTS: This class holds filter information required for texture
9  * evaluation.
10  */
11 
12 #ifndef __IMG_TextureFilter__
13 #define __IMG_TextureFilter__
14 
15 #include "IMG_API.h"
16 #include <UT/UT_Vector4.h>
17 #include <UT/UT_String.h>
18 #include <UT/UT_FilterType.h>
19 #include <UT/UT_Filter.h>
20 
21 class UT_Filter;
22 class UT_FilterWindow;
23 
25 {
26  IMG_DEEP_DISCRETE = 0, // Step interpolation of z samples
27  IMG_DEEP_LINEAR = 1 // Linear interpolation of z samples
28 };
29 
30 /// Modes for how to translate colors in images for texture lookups
32 {
33  IMG_COLORSPACE_AUTO, // Determine automatically
34  IMG_COLORSPACE_LINEAR // Direct linear translation
35 };
36 
37 /// Modes for filtering
39 {
40 public:
42  {
43  IMG_UTFILTER, // Use UT_Filter for evaluation
44  IMG_BILINEAR, // Bilinear interpolation
45  IMG_BIQUADRATIC, // Biquadratic interpolation
46  IMG_BICUBIC, // Bicubic interpolation
47  };
48 
52 
53  IMG_TextureFilter &operator=(const IMG_TextureFilter &rhs);
54 
55  /// Get the channel name (i.e. the plane name)
56  const char *getChannelName() const { return myChannelName; }
57  /// Get the channel index (i.e. the plane index). The index is considered
58  /// uninitialized if its value is < 0.
59  int getChannelIndex() const { return myChannelIndex; }
60  /// Set the channel name. If this is different than the previous value,
61  /// the channel index will be reset to -1.
62  void setChannelName(const char *channel);
63  /// Once the channel index has be resolved, stash the value here.
64  void setChannelIndex(int i) { myChannelIndex = i; }
65 
66  // Returns true if the filter or widths changed
67  bool setFilter(UT_FilterType ftype,
68  float x, float y);
69  bool setXFilter(UT_FilterType ftype);
70  bool setYFilter(UT_FilterType ftype);
71  bool setFilterWidths(float x, float y);
72  bool setFilterBlurs(float x, float y);
73  bool setMipInterpolate(int onoff);
74  bool setWrap(UT_FilterWrap uwrap, UT_FilterWrap vwrap,
75  const UT_Vector4 &border);
76  bool setDeepInterp(IMG_DeepInterp interp);
77  bool setSourceColorSpace(IMG_ColorSpace convert);
78  bool setZSkew(float zskew);
79  bool setZWidth(float z);
80  void swapBorder(UT_Vector4 &b, int ncomponents=4);
81 
82  FilterMode filterMode() const { return myFilterMode; }
83  bool setFilterMode(FilterMode m);
84  const UT_Filter *getXFilter() const { return myXFilter; }
85  const UT_Filter *getYFilter() const { return myYFilter; }
86 
87  int getMipInterpolate() const { return myInterp; }
88  float getXWidth() const { return myXWidth; }
89  float getYWidth() const { return myYWidth; }
90  float getXBlur() const { return myXBlur; }
91  float getYBlur() const { return myYBlur; }
92 
93  UT_FilterWrap getXWrap() const { return myXWrap; }
94  UT_FilterWrap getYWrap() const { return myYWrap; }
95  const UT_Vector4 &getBorder() const { return myBorder; }
96 
97  float getXsupport() const { return myXFilter->getSupport(); }
98  float getYsupport() const { return myYFilter->getSupport(); }
99  float zskew() const { return myZSkew; }
100  float zwidth() const { return myZWidth; }
101 
102  bool setBeerLambert(bool b);
103  bool beerLambert() const { return myBeerLambert; }
104 
105  void dump() const;
106 
107 public:
109  UT_Filter *myXFilter, *myYFilter;
110  float myXWidth, myYWidth;
113  int myInterp;
118  float myXBlur, myYBlur;
120  float myZSkew;
121  float myZWidth;
124 };
125 
126 #endif
FilterMode filterMode() const
UT_FilterWrap myYWrap
int getChannelIndex() const
const UT_Filter * getXFilter() const
UT_FilterWrap
Definition: UT_FilterType.h:40
const GLdouble * m
Definition: glew.h:9124
Tto convert(const Tfrom &source)
void setChannelIndex(int i)
Once the channel index has be resolved, stash the value here.
4D Vector class.
Definition: UT_Vector4.h:166
UT_FilterType
Definition: UT_FilterType.h:16
GLdouble GLdouble z
Definition: glew.h:1559
GLuint interp
Definition: glew.h:8277
IMG_DeepInterp
#define IMG_API
Definition: IMG_API.h:10
IMG_DeepInterp myDeepInterp
float zskew() const
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: glew.h:1254
bool beerLambert() const
const UT_Vector4 & getBorder() const
float getYWidth() const
float getXWidth() const
Modes for filtering.
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
float zwidth() const
float getYsupport() const
IMG_ColorSpace mySourceColorSpace
const UT_Filter * getYFilter() const
float getXBlur() const
UT_FilterWrap getYWrap() const
int getMipInterpolate() const
IMG_ColorSpace
Modes for how to translate colors in images for texture lookups.
UT_FilterWrap getXWrap() const
const char * getChannelName() const
Get the channel name (i.e. the plane name)
float getYBlur() const
float getXsupport() const