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