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  void createDeepRaster(bool change_vector2_to_vector3=true);
46 
47  void setDeepRaster(TIL_DeepRaster *raster);
48  TIL_DeepRaster *stealDeepRaster();
49 
50  TIL_DeepRaster *getRaster() { return myRaster; }
51  TIL_Sequence &getSequence() { return mySequence; }
52 
53  // Returns the percentage of tiles received relative to the total
54  // number of tiles expected for a given render.
55  fpreal getPercentComplete() const;
56 
57  // Return the progress message
59  { return myProgressMessage; }
61  { return myProgressAction; }
63  { return myElapsedTime; }
65  { return myRenderTime; }
67  { return myPeakMemUsage; }
68 
69  // The raster version will uniquely identify a raster so that when the
70  // raster changes, the version number will also change.
71  int getVersion() const { return myVersion; }
72 
73 protected:
74  void setSequence( const TIL_Sequence & src )
75  { mySequence = src; }
76 
77  virtual TIL_DeepRaster *allocRaster() const;
78 
79  int getXres() const override;
80  int getYres() const override;
81  int getNumPlanes() const
82  { return mySequence.getNumPlanes(); }
83  int getPlaneDataFormat(int plane_index) const override;
84 
85  bool complete() override;
86  bool writeTile(int plane_index,
87  int x0, int x1, int y0, int y1,
88  void *data) override;
89  bool writeSamples(
90  int nsamples,
91  int floats_per_sample,
93  const float *data) override;
94  bool setTag(int plane, int tag,
95  const char *val) override = 0;
96  bool setTag(int plane, int tag,
97  const UT_StringArray &values) override = 0;
98  bool setTag(int plane, int tag,
99  const int *values, int nvalues=1) override;
100  bool setTag(int plane, int tag,
101  const float *values, int nvalues=1) override;
102 
103 private:
104  TIL_Sequence mySequence;
105  TIL_DeepRaster *myRaster;
106  UT_StringHolder myProgressMessage;
107  UT_StringHolder myProgressAction;
108  fpreal myElapsedTime;
109  fpreal myRenderTime;
110  int64 myPeakMemUsage;
111  fpreal myProgress;
112  int myPixelsRead;
113  int myVersion;
114  bool myOwnRaster;
115 };
116 
117 #endif
virtual bool writeSamples(int nsamples, int floats_per_sample, const UT_Vector3T< int > *samples, const float *data)=0
GLenum src
Definition: glew.h:2410
GLuint const GLchar * name
Definition: glew.h:1814
virtual int getYres() const =0
GLuint const GLfloat * val
Definition: glew.h:2794
fpreal getRenderTime() const
GLint GLsizei const GLuint64 * values
Definition: glew.h:3612
virtual bool complete()
When no more data will be written to the reader, this method is called.
GLuint GLfloat GLfloat GLfloat x1
Definition: glew.h:12681
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:64
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
int64 getPeakMemUsage() const
fpreal getElapsedTime() const
virtual bool writeTile(int plane_index, int x0, int x1, int y0, int y1, void *data)=0
long long int64
Definition: SYS_Types.h:116
GLuint GLfloat GLfloat y0
Definition: glew.h:12681
virtual int getPlaneDataFormat(int plane_index) const =0
const UT_StringHolder & getProgressAction() const
const UT_StringHolder & getProgressMessage() const
GLuint GLfloat x0
Definition: glew.h:12681
virtual int getXres() const =0
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint GLfloat GLfloat GLfloat GLfloat y1
Definition: glew.h:12681
TIL_DeepRaster * getRaster()
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
GLsizei samples
Definition: glew.h:2998
#define TIL_API
Definition: TIL_API.h:10
TIL_Sequence & getSequence()