HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IMG_DeepStat.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_DeepStat.h (IMG Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __IMG_DeepStat__
12 #define __IMG_DeepStat__
13 
14 #include "IMG_API.h"
15 
16 #include <PXL/PXL_Forward.h>
17 #include <UT/UT_StringHolder.h>
18 #include <UT/UT_Options.h>
19 #include "IMG_FileTypes.h"
20 
21 class UT_JSONWriter;
22 
24 {
28  IMG_DEPTH_AVERAGE, // Replaces front with (front+back)*.5
31 
33 };
34 
36 {
44 
53 };
54 
55 /// IMG_Stat information used when creating deep images
57 {
58 public:
59  IMG_DeepStat();
60  ~IMG_DeepStat();
61 
62  // Common keywords handled in parseOption()
63  static const char *ofStorageKeyword();
64  static const char *zStorageKeyword();
65  static const char *ofSizeKeyword();
66  static const char *depthInterpKeyword();
67  static const char *compositingKeyword();
68  static const char *depthModeKeyword();
69  static const char *compressionKeyword();
70  static const char *deepcompressionKeyword();
71  static const char *zbiasKeyword();
72 
73  static IMG_DeepPlaneMask deepPlaneMask(const char *token);
74  static UT_StringHolder deepPlaneMask(IMG_DeepPlaneMask mask);
75 
76  // Parse "well known" keyword options and store the result in the stat
77  bool parseOption(const char *option, const UT_StringHolder &value);
78 
79  // Store the options
80  void storeArgs(UT_Options &options) const;
81 
82  // Print options to a work buffer
83  bool save(UT_JSONWriter &j) const;
84  void saveArgs(UT_WorkBuffer &wbuf) const;
85 
86  // Dump options to stdout
87  void dump() const;
88 
89  const UT_Options &options() const { return myOptions; }
90  void setOption(const UT_StringHolder &name, bool v)
91  { myOptions.setOptionB(name, v); }
92  void setOption(const UT_StringHolder &name, int v)
93  { myOptions.setOptionI(name, v); }
95  { myOptions.setOptionF(name, v); }
97  { myOptions.setOptionS(name, v); }
98 
100  { return myCompressorName; }
102  { myCompressorName = v; }
104  { return myMipCompressorName; }
106  { myMipCompressorName = v; }
107 
108  IMG_DeepPlaneMask deepPlaneMask() const { return myDeepPlaneMask; }
110  {
111  myDeepPlaneMask = IMG_DEPTH_FRONT_MASK;
112  }
114  {
115  myDeepPlaneMask = m;
116  }
118  {
119  uint curr = uint(myDeepPlaneMask);
120  myDeepPlaneMask = IMG_DeepPlaneMask((uint)m|curr);
121  }
122 
123  IMG_DepthInterp depthInterp() const { return myDepthInterp; }
124  void setDepthInterp(IMG_DepthInterp v) { myDepthInterp = v; }
125  IMG_DataType zStorage() const { return myZStorage; }
126  void setZStorage(const IMG_DataType v) { myZStorage = v; }
127  IMG_DataType ofStorage() const { return myOfStorage; }
128  void setOfStorage(const IMG_DataType v) { myOfStorage = v; }
129 
130  int deepCoverBits() const { return myDeepCoverBits; }
131  void setDeepCoverBits(int v) { myDeepCoverBits = SYSclamp(v, 1,64); }
132  int deepFlagBits() const { return myDeepFlagBits; }
133  void setDeepFlagBits(int v) { myDeepFlagBits = SYSclamp(v, 1, 64); }
134  int ofSize() const { return myOfSize; }
135  void setOfSize(int v) { myOfSize = v; }
136  int compressionLevel() const { return myCompressionLevel; }
137  void setCompressionLevel(int v) { myCompressionLevel = v; }
138  void setDeepCompressionLevel(int v) { myDeepCompressionLevel = v; }
139  bool samplesComposited() const { return mySamplesComposited; }
140  void setSamplesComposited(bool v) { mySamplesComposited = v; }
141  bool createMipMaps() const { return myCreateMipMaps; }
142  void setCreateMipMaps(bool v) { myCreateMipMaps = v; }
143 
144 private:
145  UT_Options myOptions;
146  UT_StringHolder myCompressorName; // "default"
147  UT_StringHolder myMipCompressorName; // "mip"
148  IMG_DeepPlaneMask myDeepPlaneMask; // front
149  IMG_DepthInterp myDepthInterp; // discrete
150  IMG_DataType myZStorage; // IMG_FLOAT32
151  IMG_DataType myOfStorage; // IMG_FLOAT16
152  int myDeepCoverBits; // 32
153  int myDeepFlagBits; // 8
154  int myOfSize; // 3
155  int myCompressionLevel; // 9
156  int myDeepCompressionLevel; // 5
157  bool mySamplesComposited; // false
158  bool myCreateMipMaps; // true
159 };
160 
161 #endif
void resetDeepPlaneMask()
Definition: IMG_DeepStat.h:109
void setDeepCompressionLevel(int v)
Definition: IMG_DeepStat.h:138
void setDeepCoverBits(int v)
Definition: IMG_DeepStat.h:131
const UT_StringHolder & compressorName() const
Definition: IMG_DeepStat.h:99
bool createMipMaps() const
Definition: IMG_DeepStat.h:141
bool samplesComposited() const
Definition: IMG_DeepStat.h:139
const GLdouble * v
Definition: glcorearb.h:836
void setMipCompressorName(const UT_StringHolder &v)
Definition: IMG_DeepStat.h:105
int compressionLevel() const
Definition: IMG_DeepStat.h:136
GLint GLuint mask
Definition: glcorearb.h:123
void setZStorage(const IMG_DataType v)
Definition: IMG_DeepStat.h:126
const UT_StringHolder & mipCompressorName() const
Definition: IMG_DeepStat.h:103
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
void setOption(const UT_StringHolder &name, bool v)
Definition: IMG_DeepStat.h:90
IMG_DataType ofStorage() const
Definition: IMG_DeepStat.h:127
#define IMG_API
Definition: IMG_API.h:10
void setDeepFlagBits(int v)
Definition: IMG_DeepStat.h:133
void addDeepPlaneMask(IMG_DeepPlaneMask m)
Definition: IMG_DeepStat.h:117
void setCreateMipMaps(bool v)
Definition: IMG_DeepStat.h:142
IMG_DataType
Definition: IMG_FileTypes.h:17
IMG_DeepPlaneMask
Definition: IMG_DeepStat.h:35
void setSamplesComposited(bool v)
Definition: IMG_DeepStat.h:140
int deepCoverBits() const
Definition: IMG_DeepStat.h:130
void setOfStorage(const IMG_DataType v)
Definition: IMG_DeepStat.h:128
GLuint const GLchar * name
Definition: glcorearb.h:785
unsigned int uint
Definition: SYS_Types.h:39
IMG_Stat information used when creating deep images.
Definition: IMG_DeepStat.h:56
void setCompressionLevel(int v)
Definition: IMG_DeepStat.h:137
void setOption(const UT_StringHolder &name, int v)
Definition: IMG_DeepStat.h:92
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:269
A map of string to various well defined value types.
Definition: UT_Options.h:42
IMG_DepthInterp
void setOption(const UT_StringHolder &name, const UT_StringHolder &v)
Definition: IMG_DeepStat.h:96
void setCompressorName(const UT_StringHolder &v)
Definition: IMG_DeepStat.h:101
void setDepthInterp(IMG_DepthInterp v)
Definition: IMG_DeepStat.h:124
IMG_DataType zStorage() const
Definition: IMG_DeepStat.h:125
void setOption(const UT_StringHolder &name, fpreal v)
Definition: IMG_DeepStat.h:94
IMG_DeepPlaneMask deepPlaneMask() const
Definition: IMG_DeepStat.h:108
IMG_DepthInterp depthInterp() const
Definition: IMG_DeepStat.h:123
IMG_DeepPlanes
Definition: IMG_DeepStat.h:23
const UT_Options & options() const
Definition: IMG_DeepStat.h:89
int ofSize() const
Definition: IMG_DeepStat.h:134
void setOfSize(int v)
Definition: IMG_DeepStat.h:135
void setDeepPlaneMask(IMG_DeepPlaneMask m)
Definition: IMG_DeepStat.h:113
int deepFlagBits() const
Definition: IMG_DeepStat.h:132