HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  virtual ~TIL_DeepRasterReader();
30 
31  virtual int64 getMemoryUsage(bool inclusive) const;
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  virtual int getXres() const;
80  virtual int getYres() const;
81  int getNumPlanes() const
82  { return mySequence.getNumPlanes(); }
83  virtual int getPlaneDataFormat(int plane_index) const;
84 
85  virtual bool complete();
86  virtual bool writeTile(int plane_index,
87  int x0, int x1, int y0, int y1,
88  void *data);
89  virtual bool writeSamples(
90  int nsamples,
91  int floats_per_sample,
93  const float *data);
94  virtual bool setTag(int plane, int tag, const char *val)=0;
95  virtual bool setTag(int plane, int tag,
96  const UT_StringArray &values) = 0;
97  virtual bool setTag(int plane, int tag,
98  const int *values, int nvalues=1);
99  virtual bool setTag(int plane, int tag,
100  const float *values, int nvalues=1);
101 
102 private:
103  TIL_Sequence mySequence;
104  TIL_DeepRaster *myRaster;
105  UT_StringHolder myProgressMessage;
106  UT_StringHolder myProgressAction;
107  fpreal myElapsedTime;
108  fpreal myRenderTime;
109  int64 myPeakMemUsage;
110  fpreal myProgress;
111  int myPixelsRead;
112  int myVersion;
113  bool myOwnRaster;
114 };
115 
116 #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
3D Vector class.
long long int64
Definition: SYS_Types.h:100
void setSequence(const TIL_Sequence &src)
#define TIL_DataFormat
Definition: TIL_Defines.h:64
int64 getPeakMemUsage() const
fpreal getElapsedTime() const
virtual bool writeTile(int plane_index, int x0, int x1, int y0, int y1, void *data)=0
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
virtual int getPlaneDataFormat(int plane_index) const =0
const UT_StringHolder & getProgressAction() const
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
GLsizei samples
Definition: glcorearb.h:1297
const UT_StringHolder & getProgressMessage() const
double fpreal
Definition: SYS_Types.h:263
virtual int getXres() const =0
GLuint GLfloat * val
Definition: glcorearb.h:1607
TIL_DeepRaster * getRaster()
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
#define TIL_API
Definition: TIL_API.h:10
TIL_Sequence & getSequence()
GLenum src
Definition: glcorearb.h:1792