HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE_RenderContext.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: RE_RenderContext.h ( RV Library, C++)
7  *
8  * COMMENTS:
9  * Temporary container for either a RV_Render or an RE_Render (not both)
10  */
11 #ifndef RE_RenderContext_h
12 #define RE_RenderContext_h
13 
14 class GR_Uniforms;
15 class RE_Render;
16 class RV_Render;
17 class RE_RenderContext;
18 
19 struct mt_renders;
20 #include <UT/UT_Assert.h>
21 
22 /// Temporary container for either a RV_Render and an RE_Render
24 {
25 public:
26  // GL only - No Vulkan
28  : myGLRender(r),
29  myVkRender(nullptr),
30  myUniforms(nullptr)
31  { }
32  // Both; eventually GL will be phased out and it'll only be vulkan.
33  RE_RenderContext(RE_Render *gl, RV_Render *vk, GR_Uniforms* u)
34  : myGLRender(gl),
35  myVkRender(vk),
36  myUniforms(u)
37  { }
38 
39  void operator=(RE_Render *r) { myGLRender = r; myVkRender=nullptr; }
40  void operator=(RV_Render *r) { myVkRender = r; myGLRender=nullptr; }
41 
42  operator RE_Render *() { UT_ASSERT(myGLRender); return myGLRender; }
43  operator RV_Render *() { UT_ASSERT(myVkRender); return myVkRender; }
44 
45  RE_Render * operator*() { return myGLRender; }
46  RE_Render * operator->() { UT_ASSERT(myGLRender); return myGLRender; }
47 
48  RV_Render *vkRender() { return myVkRender; }
49  GR_Uniforms *uniforms() { return myUniforms; }
50 
51  operator const RV_Render *() const
52  { UT_ASSERT(myVkRender); return myVkRender; }
53  operator const RE_Render *() const
54  { UT_ASSERT(myGLRender); return myGLRender; }
55 
56  const RE_Render * operator*() const { return myGLRender; }
57  const RE_Render * operator->() const
58  { UT_ASSERT(myGLRender); return myGLRender; }
59 
60  const RV_Render *vkRender() const { return myVkRender; }
61  const GR_Uniforms *uniforms() const { return myUniforms; }
62 
63  bool isGL() const { return myGLRender!=nullptr; }
64  bool isVulkan() const { return myVkRender!=nullptr; }
65 private:
66  RE_Render *myGLRender;
67  RV_Render *myVkRender;
68  GR_Uniforms *myUniforms;
69 };
70 #endif
void operator=(RE_Render *r)
RV_Render * vkRender()
void operator=(RV_Render *r)
const RE_Render * operator->() const
RE_RenderContext(RE_Render *gl, RV_Render *vk, GR_Uniforms *u)
bool isGL() const
Temporary container for either a RV_Render and an RE_Render.
const RV_Render * vkRender() const
RE_Render * operator*()
RE_Render * operator->()
RE_RenderContext(RE_Render *r)
GR_Uniforms * uniforms()
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
GLboolean r
Definition: glcorearb.h:1222
const RE_Render * operator*() const
bool isVulkan() const
const GR_Uniforms * uniforms() const