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_NonCopyable.h>
18 #include <UT/UT_StringHolder.h>
19 
20 class TIL_DeepRaster;
21 class UT_NetSocket;
22 
23 template<typename T>
25 
27 {
28 public:
30  ~TIL_DeepRasterReader() override;
31 
33 
34  int64 getMemoryUsage(bool inclusive) const override;
35 
36  /// Initialize sequence information from the net socket.
37  bool loadSequenceInfo(UT_NetSocket *sock,
38  int &pid, bool &new_sequence);
39 
40  /// addPlane() returns the plane index (which can be used to set additional
41  /// attributes at a later time). It's possible to create planes which are
42  /// NOT renderable (i.e. vector size 5 etc.) These planes are still
43  /// created, but may not have data written to them.
44  void setResolution(int xres, int yres);
45  int addPlane(const char *name, // Name of the plane
46  TIL_DataFormat storage, // TIL_DataFormat
47  int vector_size,
48  TIL_TypeInfo type_info = TIL_TI_UNDEFINED);
49  void createDeepRaster(bool change_vector2_to_vector3=true);
50 
51  void setDeepRaster(TIL_DeepRaster *raster);
52  TIL_DeepRaster *stealDeepRaster();
53 
54  TIL_DeepRaster *getRaster() { return myRaster; }
55  TIL_Sequence &getSequence() { return mySequence; }
56 
57  // Returns the percentage of tiles received relative to the total
58  // number of tiles expected for a given render.
59  fpreal getPercentComplete() const;
60 
61  // Return the progress message
63  { return myProgressMessage; }
65  { return myProgressAction; }
67  { return myElapsedTime; }
69  { return myRenderTime; }
71  { return myPeakMemUsage; }
72 
73  // The raster version will uniquely identify a raster so that when the
74  // raster changes, the version number will also change.
75  int getVersion() const { return myVersion; }
76 
77 protected:
78  void setSequence( const TIL_Sequence & src )
79  { mySequence = src; }
80 
81  virtual TIL_DeepRaster *allocRaster() const;
82 
83  int getXres() const override;
84  int getYres() const override;
85  int getNumPlanes() const
86  { return mySequence.getNumPlanes(); }
87  int getPlaneDataFormat(int plane_index) const override;
88 
89  bool complete() override;
90  bool writeTile(int plane_index,
91  int x0, int x1, int y0, int y1,
92  void *data) override;
93  bool writeSamples(
94  int nsamples,
95  int floats_per_sample,
97  const float *data) override;
98  bool setTag(int plane, int tag,
99  const char *val) override = 0;
100  bool setTag(int plane, int tag,
101  const UT_StringArray &values) override = 0;
102  bool setTag(int plane, int tag,
103  const int *values, int nvalues=1) override;
104  bool setTag(int plane, int tag,
105  const float *values, int nvalues=1) override;
106 
107 private:
108  TIL_Sequence mySequence;
109  TIL_DeepRaster *myRaster;
110  UT_StringHolder myProgressMessage;
111  UT_StringHolder myProgressAction;
112  fpreal myElapsedTime;
113  fpreal myRenderTime;
114  int64 myPeakMemUsage;
115  fpreal myProgress;
116  int myPixelsRead;
117  int myVersion;
118  bool myOwnRaster;
119 };
120 
121 #endif
virtual bool writeSamples(int nsamples, int floats_per_sample, const UT_Vector3T< int > *samples, const float *data)=0
virtual int getYres() const =0
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
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
3D Vector class.
void setSequence(const TIL_Sequence &src)
#define TIL_DataFormat
Definition: TIL_Defines.h:65
int64 getPeakMemUsage() const
fpreal getElapsedTime() const
virtual bool writeTile(int plane_index, int x0, int x1, int y0, int y1, void *data)=0
GLdouble y1
Definition: glad.h:2349
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
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 const GLchar * name
Definition: glcorearb.h:786
GLsizei samples
Definition: glcorearb.h:1298
const UT_StringHolder & getProgressMessage() const
virtual int getXres() const =0
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint GLfloat * val
Definition: glcorearb.h:1608
TIL_DeepRaster * getRaster()
TIL_TypeInfo
Definition: TIL_Defines.h:75
#define TIL_API
Definition: TIL_API.h:10
TIL_Sequence & getSequence()
Definition: format.h:895
GLenum src
Definition: glcorearb.h:1793