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  // Update the GL depth buffer texture.
45  virtual void updateDepthBuffer(void *data,
46  PXL_DataFormat df,
47  int num_components) = 0;
48  // Prim IDs for picking
49  virtual void updatePrimIDBuffer(void *data,
50  PXL_DataFormat df) = 0;
51  virtual void updateInstanceIDBuffer(void *data,
52  PXL_DataFormat df) = 0;
53 
54  virtual const PXL_Raster *primID() const = 0;
55  virtual const PXL_Raster *instanceID() const = 0;
56  // Save the buffers to images on disk for debugging. Provide a default
57  // empty implementation because subclasses don't need to implement this.
58  virtual void saveBuffers(const UT_StringHolder &colorfile,
59  const UT_StringHolder &depthfile) const
60  { }
61 
62 protected:
63  int myWidth;
64  int myHeight;
65 };
66 
67 #endif
virtual void updateInstanceIDBuffer(void *data, PXL_DataFormat df)=0
virtual ~HUSD_Compositor()
virtual void updatePrimIDBuffer(void *data, PXL_DataFormat df)=0
virtual void saveBuffers(const UT_StringHolder &colorfile, const UT_StringHolder &depthfile) const
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
int width() const
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
virtual void updateColorBuffer(void *data, PXL_DataFormat df, int num_components)=0
Definition: format.h:895
void setResolution(int w, int h)
virtual const PXL_Raster * primID() const =0