HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_Compositor.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef HUSD_Compositor_h
18 #define HUSD_Compositor_h
19 
20 #include <PXL/PXL_Common.h>
21 
22 class PXL_Raster;
23 
25 {
26 public:
28  : myWidth(0), myHeight(0)
29  { }
30  virtual ~HUSD_Compositor()
31  { }
32 
33  void setResolution(int w, int h)
34  { myWidth = w; myHeight = h; }
35  int width() const
36  { return myWidth; }
37  int height() const
38  { return myHeight; }
39 
40  // Update the GL color buffer texture.
41  virtual void updateColorBuffer(void *data,
42  PXL_DataFormat df,
43  int num_components) = 0;
44  virtual void updateColorTexture(int id)
45  { }
46  // Update the GL depth buffer texture.
47  virtual void updateDepthBuffer(void *data,
48  PXL_DataFormat df,
49  int num_components) = 0;
50  virtual void updateDepthTexture(int id)
51  { }
52  // Prim IDs for picking
53  virtual void updatePrimIDBuffer(void *data,
54  PXL_DataFormat df,
55  bool stealdata = false,
56  bool keeptexture = false) = 0;
57  virtual void updatePrimIDTexture(int id)
58  { }
59  virtual void updateInstanceIDBuffer(void *data,
60  PXL_DataFormat df,
61  bool stealdata = false,
62  bool keeptexture = false) = 0;
63  virtual void updateInstIDTexture(int id)
64  { }
65 
66  virtual const PXL_Raster *primID() const = 0;
67  virtual const PXL_Raster *instanceID() const = 0;
68  // Save the buffers to images on disk for debugging. Provide a default
69  // empty implementation because subclasses don't need to implement this.
70  virtual void saveBuffers(const UT_StringHolder &colorfile,
71  const UT_StringHolder &depthfile) const
72  { }
73 
74 protected:
75  int myWidth;
76  int myHeight;
77 };
78 
79 #endif
virtual ~HUSD_Compositor()
virtual void updateInstanceIDBuffer(void *data, PXL_DataFormat df, bool stealdata=false, bool keeptexture=false)=0
virtual void saveBuffers(const UT_StringHolder &colorfile, const UT_StringHolder &depthfile) const
virtual void updatePrimIDBuffer(void *data, PXL_DataFormat df, bool stealdata=false, bool keeptexture=false)=0
int width() const
virtual void updatePrimIDTexture(int id)
virtual void updateDepthTexture(int id)
PXL_DataFormat
Definition: PXL_Common.h:20
int height() const
virtual const PXL_Raster * instanceID() const =0
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
virtual void updateDepthBuffer(void *data, PXL_DataFormat df, int num_components)=0
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
virtual void updateInstIDTexture(int id)
virtual void updateColorBuffer(void *data, PXL_DataFormat df, int num_components)=0
Definition: format.h:895
void setResolution(int w, int h)
virtual void updateColorTexture(int id)
virtual const PXL_Raster * primID() const =0