HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TIL_TileMPlay.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_TileMPlay (C++)
7  *
8  * COMMENTS: This class writes to deep raster tiles to a Net socket.
9  *
10  */
11 
12 #ifndef __TIL_TileMPlay_H__
13 #define __TIL_TileMPlay_H__
14 
15 #include "TIL_API.h"
16 class TIL_Sequence;
17 class TIL_Tile;
18 class UT_NetPacket;
19 class UT_NetSocket;
20 
21 #include <IMG/IMG_TileDevice.h>
22 #include <UT/UT_IntArray.h>
23 #include <UT/UT_Lock.h>
24 #include <UT/UT_SysClone.h>
25 #include <UT/UT_StopWatch.h>
26 
27 template<typename T>
28 class UT_Vector3T;
29 
30 // The size of the UT_NetPacket buffer
31 static const size_t TIL_MPLAY_PACKETSIZE = 65536;
32 // Tile info data structure size, as a number of integers
33 static const int TIL_MPLAY_TILEDATASIZE = 5;
34 
36 {
37 public:
38  TIL_TileMPlay(int middle, bool isflipbook);
39  virtual ~TIL_TileMPlay();
40 
41  // If enabled, this will not start another MPlay session. Instead, the
42  // open will fail. This is generally used for rendering sequences to a
43  // single MPlay session. Interruption to that MPlay (exit, not listening)
44  // will stop the sequence from rendering.
45  void noNewMPlay(bool enable);
46 
47  // If enabled, this class sends the PID to the host, which is
48  // used to terminate this process when rendering is stopped. If disabled,
49  // the PID is not sent and the host does not terminate the client.
50  void setSendPIDFlag(bool flag);
51 
52  virtual const char *className() const;
53  virtual void getDescription(UT_WorkBuffer &wbuf) const;
54 
55  virtual int open(const IMG_TileOptions &finfo,
56  int xres, int yres, int twidth, int theight,
57  fpreal aspect);
58 
59  virtual int openMulti(IMG_TileOptionList &flist,
60  int xres, int yres,
61  int twidth, int theight, fpreal aspect);
62 
63  virtual void setWhitePoint(fpreal w);
64 
65  virtual void writeCustomTag(const char *tagname, int size,
66  const char *const *values);
67 
68  virtual int writeTile(const void *data, unsigned x0, unsigned x1,
69  unsigned y0, unsigned y1);
70  virtual bool writeSamples(
71  int nsamples,
72  int floats_per_sample,
74  const float *data);
75 
76  virtual void flush();
77  virtual int close(bool keep_alive=false);
78 
79  // more convienient functions for COPs.
80  int openDeep(const char *filename,
81  const TIL_Sequence &info,
82  int tilex, int tiley,
83  bool startnew=false,
84  const IMG_TileOptions *finfo=0);
85 
86  int writeDeepTile(int plane_index, const void *data,
87  int x0, int x1, int y0, int y1);
88  void setStatusMsg(const char *msg);
89 
90  bool isOpen() const { return mySocket && myPacket; }
91  bool checkInterrupt() { drainSocket(); return isOpen(); }
92 
93  virtual bool getMouseClickPosition(int &x, int &y) const;
94  virtual float getMouseClickRadius() const;
95 
96  void setMouseClickPosition(int x, int y)
97  { myMouse[0] =x; myMouse[1] =y; }
98 
99  void streakEdges(int x1, int y1, int x2, int y2,
100  int plane = -1);
101 
102  bool wasRemoteQuitRequested() { return myQuitFlag; }
103 
104  // returns the name of the lock file.
105  static void getLockFile(UT_WorkBuffer &buf, bool isflipbook,
106  const char *label);
107 
108  virtual void terminateOnConnectionLost(bool);
109 
110  virtual bool wantsHoudiniPort() const { return true; }
111 
112  virtual bool isInteractive() const { return true; }
113 
114  static void enableColorCorrection(bool enable);
115  static void setColorCorrectionLUT(bool enable, const char *lut);
116  static void setColorCorrectionGamma(bool enable, fpreal gamma);
117 
118  virtual void setStyleSheets(UT_StringArray& style_sheets)
119  { myStyleSheetData = style_sheets; }
120 private:
121  int openSocket(const char *host, int port,
122  const char *label);
123  bool drainSocket(bool keep_alive=false);
124  void clean();
125 
126 private:
127  void sendTileOptions(const IMG_TileOptions &options);
128 
129  TIL_Sequence *mySequence;
130  UT_Lock myWriteLock;
131  bool myIsFlipbook;
132  UT_IntArray myPlaneIndex;
133  UT_IntArray myPlaneSize;
134 
135  UT_NetSocket *mySocket;
136  UT_NetPacket *myPacket;
137  int myBPP, myMiddle;
138  float myMouse[2];
139  float myMouseRadius;
140  bool myQuitFlag;
141  UT_StopWatch myFlushTimer;
142  bool myNoNewMPlayFlag;
143  bool mySendPIDFlag;
144 
145  UT_StringArray myStyleSheetData;
146 };
147 
148 #endif
virtual void setWhitePoint(fpreal white)
bool checkInterrupt()
Definition: TIL_TileMPlay.h:91
GT_API const UT_StringHolder filename
virtual void writeCustomTag(const char *tagname, int size, const char *const *values)
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2544
virtual void getDescription(UT_WorkBuffer &wbuf) const
virtual float getMouseClickRadius() const
virtual int openMulti(IMG_TileOptionList &flist, int xres, int yres, int tile_width, int tile_height, fpreal aspect)
virtual bool isInteractive() const
virtual void setStyleSheets(UT_StringArray &style_sheets)
GLint y
Definition: glcorearb.h:102
3D Vector class.
GLsizeiptr size
Definition: glcorearb.h:663
virtual bool getMouseClickPosition(int &x, int &y) const
void setMouseClickPosition(int x, int y)
Definition: TIL_TileMPlay.h:96
virtual void terminateOnConnectionLost(bool)
virtual bool writeSamples(int nsamples, int floats_per_sample, const UT_Vector3T< int > *samples, const float *data)
virtual const char * className() const =0
virtual int open(const IMG_TileOptions &info, int xres, int yres, int tile_device, int tile_height, fpreal aspect)=0
Open the device.
virtual int close(bool keep_alive=false)=0
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
GLboolean * data
Definition: glcorearb.h:130
GLsizei samples
Definition: glcorearb.h:1297
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2539
virtual int writeTile(const void *data, unsigned x0, unsigned x1, unsigned y0, unsigned y1)=0
double fpreal
Definition: SYS_Types.h:270
GLint GLenum GLint x
Definition: glcorearb.h:408
virtual bool wantsHoudiniPort() const
bool wasRemoteQuitRequested()
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
virtual void flush()
bool isOpen() const
Definition: TIL_TileMPlay.h:90
png_infop png_uint_32 flag
Definition: png.h:2242
#define TIL_API
Definition: TIL_API.h:10