HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TIL_DeepRasterReader.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: TIL_DeepRasterReader.h ( TIL Library, C++)
7  *
8  * COMMENTS: A deep reader is in an interface to writing a deep raster.
9  */
10 
11 #ifndef __TIL_DeepRasterReader__
12 #define __TIL_DeepRasterReader__
13 
14 #include "TIL_DeepReader.h"
15 #include "TIL_Defines.h"
16 #include "TIL_Sequence.h"
17 #include <UT/UT_StringHolder.h>
18 
19 class TIL_DeepRaster;
20 class UT_NetSocket;
21 
22 template<typename T>
24 
26 {
27 public:
29  ~TIL_DeepRasterReader() override;
30 
31  int64 getMemoryUsage(bool inclusive) const override;
32 
33  /// Initialize sequence information from the net socket.
34  bool loadSequenceInfo(UT_NetSocket *sock,
35  int &pid, bool &new_sequence);
36 
37  /// addPlane() returns the plane index (which can be used to set additional
38  /// attributes at a later time). It's possible to create planes which are
39  /// NOT renderable (i.e. vector size 5 etc.) These planes are still
40  /// created, but may not have data written to them.
41  void setResolution(int xres, int yres);
42  int addPlane(const char *name, // Name of the plane
43  TIL_DataFormat storage, // TIL_DataFormat
44  int vector_size,
45  TIL_TypeInfo type_info = TIL_TI_UNDEFINED);
46  void createDeepRaster(bool change_vector2_to_vector3=true);
47 
48  void setDeepRaster(TIL_DeepRaster *raster);
49  TIL_DeepRaster *stealDeepRaster();
50 
51  TIL_DeepRaster *getRaster() { return myRaster; }
52  TIL_Sequence &getSequence() { return mySequence; }
53 
54  // Returns the percentage of tiles received relative to the total
55  // number of tiles expected for a given render.
56  fpreal getPercentComplete() const;
57 
58  // Return the progress message
60  { return myProgressMessage; }
62  { return myProgressAction; }
64  { return myElapsedTime; }
66  { return myRenderTime; }
68  { return myPeakMemUsage; }
69 
70  // The raster version will uniquely identify a raster so that when the
71  // raster changes, the version number will also change.
72  int getVersion() const { return myVersion; }
73 
74 protected:
75  void setSequence( const TIL_Sequence & src )
76  { mySequence = src; }
77 
78  virtual TIL_DeepRaster *allocRaster() const;
79 
80  int getXres() const override;
81  int getYres() const override;
82  int getNumPlanes() const
83  { return mySequence.getNumPlanes(); }
84  int getPlaneDataFormat(int plane_index) const override;
85 
86  bool complete() override;
87  bool writeTile(int plane_index,
88  int x0, int x1, int y0, int y1,
89  void *data) override;
90  bool writeSamples(
91  int nsamples,
92  int floats_per_sample,
94  const float *data) override;
95  bool setTag(int plane, int tag,
96  const char *val) override = 0;
97  bool setTag(int plane, int tag,
98  const UT_StringArray &values) override = 0;
99  bool setTag(int plane, int tag,
100  const int *values, int nvalues=1) override;
101  bool setTag(int plane, int tag,
102  const float *values, int nvalues=1) override;
103 
104 private:
105  TIL_Sequence mySequence;
106  TIL_DeepRaster *myRaster;
107  UT_StringHolder myProgressMessage;
108  UT_StringHolder myProgressAction;
109  fpreal myElapsedTime;
110  fpreal myRenderTime;
111  int64 myPeakMemUsage;
112  fpreal myProgress;
113  int myPixelsRead;
114  int myVersion;
115  bool myOwnRaster;
116 };
117 
118 #endif
virtual bool writeSamples(int nsamples, int floats_per_sample, const UT_Vector3T< int > *samples, const float *data)=0
virtual int getYres() const =0
fpreal getRenderTime() const
virtual bool complete()
When no more data will be written to the reader, this method is called.
virtual bool setTag(int plane, int tag, const char *val)
virtual int64 getMemoryUsage(bool inclusive) const =0
GLuint const GLchar * name
Definition: glcorearb.h:786
GLenum src
Definition: glcorearb.h:1793
3D Vector class.
GLsizei samples
Definition: glcorearb.h:1298
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
void setSequence(const TIL_Sequence &src)
#define TIL_DataFormat
Definition: TIL_Defines.h:64
GLuint GLfloat GLfloat GLfloat x1
Definition: glew.h:12900
int64 getPeakMemUsage() const
fpreal getElapsedTime() const
virtual bool writeTile(int plane_index, int x0, int x1, int y0, int y1, void *data)=0
GLuint GLfloat GLfloat y0
Definition: glew.h:12900
HUSD_API const char * raster()
long long int64
Definition: SYS_Types.h:116
virtual int getPlaneDataFormat(int plane_index) const =0
const UT_StringHolder & getProgressAction() const
GLuint GLfloat GLfloat GLfloat GLfloat y1
Definition: glew.h:12900
const UT_StringHolder & getProgressMessage() const
GLuint GLfloat * val
Definition: glcorearb.h:1608
virtual int getXres() const =0
GLuint GLfloat x0
Definition: glew.h:12900
fpreal64 fpreal
Definition: SYS_Types.h:277
TIL_DeepRaster * getRaster()
TIL_TypeInfo
Definition: TIL_Defines.h:74
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
#define TIL_API
Definition: TIL_API.h:10
TIL_Sequence & getSequence()
Definition: format.h:895