RenderManAPI  24.0
RixDeepTexture.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 2020 Pixar. All rights reserved.
5 #
6 # The information in this file (the "Software") is provided for the exclusive
7 # use of the software licensees of Pixar ("Licensees"). Licensees have the
8 # right to incorporate the Software into other products for use by other
9 # authorized software licensees of Pixar, without fee. Except as expressly
10 # permitted herein, the Software may not be disclosed to third parties, copied
11 # or duplicated in any form, in whole or in part, without the prior written
12 # permission of Pixar.
13 #
14 # The copyright notices in the Software and this entire statement, including the
15 # above license grant, this restriction and the following disclaimer, must be
16 # included in all copies of the Software, in whole or in part, and all permitted
17 # derivative works of the Software, unless such copies or derivative works are
18 # solely in the form of machine-executable object code generated by a source
19 # language processor.
20 #
21 # PIXAR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL PIXAR BE
23 # LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
25 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
26 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. IN NO CASE WILL
27 # PIXAR'S TOTAL LIABILITY FOR ALL DAMAGES ARISING OUT OF OR IN CONNECTION WITH
28 # THE USE OR PERFORMANCE OF THIS SOFTWARE EXCEED $50.
29 #
30 # Pixar
31 # 1200 Park Ave
32 # Emeryville CA 94608
33 #
34 # ------------------------------------------------------------------------------
35 */
36 
37 #ifndef RixDeepTexture_H
38 #define RixDeepTexture_H
39 
40 #include "RixInterfaces.h" // for RixInterface
41 
63 class [[deprecated]] RixDeepTexture : public RixInterface
64 {
65 protected:
68 
69 public:
70  // clang-format off
72  {
73  k_CmpNone = 0,
74  k_CmpRLE = 2,
75  k_CmpLZW = 3,
76  k_CmpHUFFMAN = 5,
77  k_CmpZIP = 6
78  };
79 
80  enum DataType
81  {
82  k_TypeBYTE = 1,
83  k_TypeSHORT = 2,
84  k_TypeWORD = 3,
85  k_TypeFLOAT = 4,
86  k_TypeHALF = 5
87  };
88 
90  {
91  k_ErrNOMETADATA = -14,
92  k_ErrBADCHANNEL = -13,
93  k_ErrREADONLY = -12,
95  k_ErrCAPACITY = -11,
97  k_ErrTILECOMPRESSION = -10,
99  k_ErrUNFINISHED = -9,
100  k_ErrRANGE = -8,
102  k_ErrNOMEM = -7,
103  k_ErrEMPTY = -6,
104  k_ErrNOIMAGE = -5,
106  k_ErrUNSUPPORTED = -4,
107  k_ErrBADFILE = -3,
109  k_ErrNOFILE = -2,
110  k_ErrERR = -1,
111  k_ErrNOERR = 0
112  };
113  // clang-format on
114 
115  // forward declaration of our types...
116  class DeepCache;
117  class DeepFile;
118  class DeepImage;
119  class DeepMetadata;
120  class DeepPixel;
121 
124  virtual DeepCache* CreateCache(int numTiles) = 0;
125 
128  virtual int DestroyCache(DeepCache*) = 0;
129 
132  virtual int CreateFile(const char* name, DeepCache*, DeepFile** result) = 0;
133 
137  virtual int IsDeepFile(const char* name, DeepCache*, int* version) = 0;
138 
141  virtual int OpenFile(const char* name, const char* mode, DeepCache*, DeepFile** result) = 0;
142 
144  virtual int DestroyFile(DeepFile*) = 0;
145 
147  virtual DeepPixel* CreatePixel(int numChan) = 0;
148 
150  virtual void DestroyPixel(DeepPixel*) = 0;
151 
152  class DeepCache
153  {
154  public:
155  virtual int Sync() = 0;
156 
157  protected:
159  virtual ~DeepCache() {}
160  };
161 
168  class DeepFile
169  {
170  protected:
172  virtual ~DeepFile() {}
173 
174  public:
176  virtual int FileVersion() = 0;
177 
180  virtual DeepMetadata* GetMetadata() = 0;
181 
183  virtual int CountImages() = 0;
184 
186  virtual int AddImage(
187  const char* name,
188  int numChan,
189  int w,
190  int h,
191  int tileW,
192  int tileH,
193  float* NP,
194  float* Nl,
195  Compression,
196  DataType,
197  DeepImage** result) = 0;
198 
201  virtual int AddImage(
202  const char* name,
203  int numChan,
204  int w,
205  int h,
206  int tileW,
207  int tileH,
208  float* NP,
209  float* Nl,
210  Compression,
211  DataType,
212  const char* formatType,
213  int formatVersion,
214  DeepImage** result) = 0;
215 
220  virtual int GetImageByName(const char*, DeepImage** result) = 0;
221 
226  virtual int GetImageByIndex(int, DeepImage** result) = 0;
227 
229  virtual int Close() = 0;
230 
233  virtual int Sync() = 0;
234  };
235 
242  class DeepImage
243  {
244  protected:
246  virtual ~DeepImage() {}
247 
248  public:
252  virtual const char* GetName() = 0;
254  virtual int GetNumChan() = 0;
256  virtual int GetWidth() = 0;
258  virtual int GetHeight() = 0;
260  virtual int GetTileWidth() = 0;
262  virtual int GetTileHeight() = 0;
264  virtual int GetNP(float* NP) = 0;
266  virtual int GetNl(float* Nl) = 0;
268  virtual Compression GetCompression() = 0;
270  virtual DataType GetDataType() = 0;
273  virtual DeepMetadata* GetMetadata() = 0;
274 
278  virtual int SetPixelData(int x, int y, int numPoints, float* data) = 0;
279 
285  virtual int SetPixel(int x, int y, DeepPixel* pix) = 0;
286 
294  virtual int GetPixel(int x, int y, DeepPixel* pix) = 0;
295 
299  virtual int Eval(int x, int y, float z, float* data) = 0;
300 
305  virtual int GetZRange(int x, int y, float* min, float* max) = 0;
306 
309  virtual int GetMeanDepth(int x, int y, float* mean, float* alpha) = 0;
310  };
311 
328  {
329  protected:
331  virtual ~DeepMetadata() {}
332 
333  public:
336  virtual int Set(char const* token, void const* value) = 0;
337 
339  virtual int Count() = 0;
340 
347  virtual int GetByIndex(int index, char const** token, void const** value) = 0;
348 
350  virtual int GetByName(char const* name, char const** token, void const** value) = 0;
351  };
352 
370  class DeepPixel
371  {
372  protected:
374  virtual ~DeepPixel() {}
375 
376  public:
377  virtual int Clear(int numChan) = 0;
378  virtual int Empty() = 0;
379 
381  virtual int SpecifyPixel(int numChan, int numPoints, float* data) = 0;
382 
385  virtual int IsMonochrome() = 0;
386 
388  virtual int GetNumChan() = 0;
389 
393  virtual int GetNumPoints() = 0;
394 
401  virtual int GetPoint(int i, float* z, float* data) = 0;
402 
408  virtual int SetPoint(int i, float z, float* data) = 0;
409 
412  virtual int Copy(DeepPixel* src) = 0;
413 
419  virtual int Merge(DeepPixel* src) = 0;
420 
434  virtual int Merge(DeepPixel* src, int rgbChannel, int alphaChannel) = 0;
435 
441  virtual int Finish() = 0;
442 
447  virtual int Append(float z, float* data, float tolerance) = 0;
448 
452  virtual int Eval(float z, float* data) = 0;
453 
464  virtual int Composite(int rgbChannel, int alphaChannel, float* data) = 0;
465 
472  virtual int GetZRange(float* zmin, float* zmax) = 0;
473 
476  virtual int Average(int n, DeepPixel* pixels[], float weights[], float tolerance) = 0;
477 
480  virtual int Compress(DeepPixel* src, float tolerance) = 0;
481 
482  }; /* end of DeepPixel */
483 
484 }; /* end of RixDeepTexture */
485 
486 #endif
Definition: RixDeepTexture.h:152
Base class for all Rix interfaces.
Definition: RixInterfaces.h:133
DeepMetadata.
Definition: RixDeepTexture.h:327
DeepFile.
Definition: RixDeepTexture.h:168
DeepPixel.
Definition: RixDeepTexture.h:370
RixDeepTexture.
Definition: RixDeepTexture.h:63
virtual ~DeepFile()
Internal only. Use RixDeepTexture::DestroyFile.
Definition: RixDeepTexture.h:172
DataType
Definition: RixDeepTexture.h:80
virtual ~DeepCache()
Internal only. Use RixDeepTexture::DestroyCache.
Definition: RixDeepTexture.h:159
ErrorCodes
Definition: RixDeepTexture.h:89
virtual ~DeepPixel()
Internal only. Use RixDeepTexture::DestroyPixel.
Definition: RixDeepTexture.h:374
DeepImage.
Definition: RixDeepTexture.h:242
virtual ~DeepMetadata()
Internal only.
Definition: RixDeepTexture.h:331
Compression
Definition: RixDeepTexture.h:71
virtual ~DeepImage()
Internal only.
Definition: RixDeepTexture.h:246
RixDeepTexture()
Constructor is for internal use only.
Definition: RixDeepTexture.h:67