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 #include <PXL/PXL_Common.h>
21 
22 class UT_Filter;
23 class UT_FilterWindow;
24 
26 {
27  IMG_DEEP_DISCRETE = 0, // Step interpolation of z samples
28  IMG_DEEP_LINEAR = 1 // Linear interpolation of z samples
29 };
30 
31 /// Modes for how to translate colors in images for texture lookups
33 {
34  IMG_COLORSPACE_AUTO, // Determine automatically
35  IMG_COLORSPACE_LINEAR, // Direct linear translation
38  IMG_COLORSPACE_GAMMA22, // Gamma 2.2
39 };
40 
41 IMG_API extern const char *IMGcolorSpace(IMG_ColorSpace cs);
42 IMG_API extern IMG_ColorSpace IMGcolorSpace(const char *cs);
45 
46 /// Modes for filtering
48 {
49 public:
51  {
52  IMG_UTFILTER, // Use UT_Filter for evaluation
53  IMG_BILINEAR, // Bilinear interpolation
54  IMG_BIQUADRATIC, // Biquadratic interpolation
55  IMG_BICUBIC, // Bicubic interpolation
56  };
57 
61 
62  IMG_TextureFilter &operator=(const IMG_TextureFilter &rhs);
63 
64  /// Get the channel name (i.e. the plane name)
65  const char *getChannelName() const { return myChannelName; }
66  /// Get the channel index (i.e. the plane index). The index is considered
67  /// uninitialized if its value is < 0.
68  int getChannelIndex() const { return myChannelIndex; }
69  /// Set the channel name. If this is different than the previous value,
70  /// the channel index will be reset to -1.
71  void setChannelName(const char *channel);
72  /// Once the channel index has be resolved, stash the value here.
73  void setChannelIndex(int i) { myChannelIndex = i; }
74 
75  // Returns true if the filter or widths changed
76  bool setFilter(UT_FilterType ftype,
77  float x, float y);
78  bool setXFilter(UT_FilterType ftype);
79  bool setYFilter(UT_FilterType ftype);
80  bool setFilterWidths(float x, float y);
81  bool setFilterBlurs(float x, float y);
82  bool setMipInterpolate(int onoff);
83  bool setWrap(UT_FilterWrap uwrap, UT_FilterWrap vwrap,
84  const UT_Vector4 &border);
85  bool setDeepInterp(IMG_DeepInterp interp);
86  bool setSourceColorSpace(IMG_ColorSpace convert);
87  bool setZSkew(float zskew);
88  bool setZWidth(float z);
89  void swapBorder(UT_Vector4 &b, int ncomponents=4);
90 
91  FilterMode filterMode() const { return myFilterMode; }
92  bool setFilterMode(FilterMode m);
93  const UT_Filter *getXFilter() const { return myXFilter; }
94  const UT_Filter *getYFilter() const { return myYFilter; }
95 
96  int getMipInterpolate() const { return myInterp; }
97  float getXWidth() const { return myXWidth; }
98  float getYWidth() const { return myYWidth; }
99  float getXBlur() const { return myXBlur; }
100  float getYBlur() const { return myYBlur; }
101 
102  UT_FilterWrap getXWrap() const { return myXWrap; }
103  UT_FilterWrap getYWrap() const { return myYWrap; }
104  const UT_Vector4 &getBorder() const { return myBorder; }
105 
106  float getXsupport() const { return myXFilter->getSupport(); }
107  float getYsupport() const { return myYFilter->getSupport(); }
108  float zskew() const { return myZSkew; }
109  float zwidth() const { return myZWidth; }
110 
111  bool setBeerLambert(bool b);
112  bool beerLambert() const { return myBeerLambert; }
113 
114  void dump() const;
115 
116 public:
118  UT_Filter *myXFilter, *myYFilter;
119  float myXWidth, myYWidth;
122  int myInterp;
127  float myXBlur, myYBlur;
129  float myZSkew;
130  float myZWidth;
133 };
134 
135 #endif
IMG_API PXL_ColorSpace PXLcolorSpaceFromIMG(IMG_ColorSpace cs)
IMG_API const char * IMGcolorSpace(IMG_ColorSpace cs)
FilterMode filterMode() const
UT_FilterWrap myYWrap
int getChannelIndex() const
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:848
const UT_Filter * getXFilter() const
UT_FilterWrap
Definition: UT_FilterType.h:40
GLint y
Definition: glcorearb.h:103
Tto convert(const Tfrom &source)
void setChannelIndex(int i)
Once the channel index has be resolved, stash the value here.
UT_FilterType
Definition: UT_FilterType.h:16
IMG_DeepInterp
#define IMG_API
Definition: IMG_API.h:10
IMG_DeepInterp myDeepInterp
float zskew() const
IMG_API IMG_ColorSpace IMGcolorSpaceFromPXL(PXL_ColorSpace cs)
bool beerLambert() const
const UT_Vector4 & getBorder() const
float getYWidth() const
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
float getXWidth() const
GLint GLenum GLint x
Definition: glcorearb.h:409
Modes for filtering.
GLint GLint GLsizei GLint border
Definition: glcorearb.h:108
float zwidth() const
float getYsupport() const
IMG_ColorSpace mySourceColorSpace
const UT_Filter * getYFilter() const
PXL_ColorSpace
Definition: PXL_Common.h:72
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