HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_VolumeVK.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: GR_VolumeVK.h ( GR Library, C++)
7  *
8  * COMMENTS:
9  * Volume rendering in VK.
10  */
11 #ifndef GR_VolumeVK_h
12 #define GR_VolumeVK_h
13 
14 #include "GR_API.h"
15 #include "GR_GeoRenderVK.h"
16 #include "GR_VolumeRender.h"
17 
18 #include <RE/RE_ShaderHandle.h>
19 
20 #include <RV/RV_Geometry.h>
21 #include <UT/UT_BoundingBox.h>
22 #include <UT/UT_Lock.h>
23 #include <UT/UT_Array.h>
24 #include <UT/UT_UniquePtr.h>
25 #include <UT/UT_Vector3.h>
26 #include <GU/GU_Detail.h>
27 #include <GEO/GEO_PrimVolume.h>
28 
29 struct gr_VolumeAngleVector;
30 
31 
32 class GR_VolumeSlice;
33 class GR_VolumeBase;
34 class GU_PrimVolume;
35 class RE_OGLTexture;
36 class RV_Geometry;
37 class RV_Render;
39 class RV_ShaderBlock;
40 class UT_Color;
41 
43 {
44 public:
46  ~GR_VolumeVK() override;
47 
48  const char *className() const override { return "GR_VolumeVK"; }
49 
50  void update(RE_RenderContext rc,
51  const GT_PrimitiveHandle &primh,
52  const GR_UpdateParms &parms,
53  const char *cache_name) override;
54 
56  const GR_DisplayOption &opts,
57  const char *cache_name,
58  RE_CacheVersion geo_version,
59  RE_CacheVersion select_version) override;
60 
61  void draw(RE_RenderContext rc,
64  GR_DrawParms dp) override;
65 
66  exint getNumGLPrimitives() const override;
67 
68  static bool initShaders(RV_Instance* inst);
69  static void initResources(RV_Render* r);
70  static void cleanupShaders();
71  static void cleanupResources();
72 
73  // Expose Shaders so `GR_VolumeRender` can use them
74  static RV_ShaderProgram* getVolumeSliceShader(RV_Render *r, bool bspline);
75  static RV_ShaderProgram* getVolumeSliceShaderHQ(RV_Render *r, bool bspline);
76  static RV_ShaderProgram* getVolumeMaterialShader(RV_Render *r, bool bspline);
77  static RV_ShaderProgram* getVolumeNormalShader(RV_Render *r, bool bspline);
78  static RV_ShaderProgram* getVolumeMotionShader(RV_Render *r, bool bspline);
79 
80  static RV_VKImage* get3DNoise(RV_Render* r);
81  static RV_VKImage* get2DNoise(RV_Render* r);
82  static RV_VKImage* getBSplineWeights(RV_Render* r);
83 private:
84 
85  /// draw setup down outside Render Pass
86  void drawSlices(RV_Render *r,
87  GR_Uniforms* uniforms,
89  bool draw_normals,
90  GR_RenderMode render_mode,
91  const GR_DisplayOption *opt);
92 
93  // draw commands executed inside a Render Pass
94  void renderSlices(RV_Render *r,
96  const UT_IntArray &selected,
98  const UT_IntArray &draw_count,
99  const UT_FloatArray &zincs,
100  const UT_FloatArray &depth,
101  float astep,
102  bool show_selection,
103  bool use_transparent,
104  bool draw_normals);
105 
106  static RV_ShaderProgram* theVolumeSliceShader;
107  static RV_ShaderProgram* theVolumeSliceShaderMaterial;
108  static RV_ShaderProgram* theVolumeSliceNormalShader;
109  static RV_ShaderProgram* theVolumeSliceMVShader;
110 
111  GR_VolumeBase* myVolume;
112 
113  UT_UniquePtr<RV_ShaderBlock> myVolumeUniforms;
115 
116  friend struct gr_SliceDrawTask;
117  friend class GR_VolumeRender;
118 };
119 
120 #endif
A collection of Vulkan UBO, SSBO, and Image shader bindings (descriptor set)
GLbitfield flags
Definition: glcorearb.h:1596
virtual void draw(RE_RenderContext r, GR_RenderMode mode, GR_RenderFlags flags, GR_DrawParms draw_parms)=0
Normal drawing method. Only issue rendering commands.
int64 exint
Definition: SYS_Types.h:125
GT_API const UT_StringHolder cache_name
Object that represents drawable geometry. This object holds vertex, instancing and index buffers for ...
Definition: RV_Geometry.h:164
Temporary container for either a RV_Render and an RE_Render.
virtual exint getNumGLPrimitives() const =0
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
set of parameters sent to GR_Primitive::update()
GR_RenderMode
Definition: GR_Defines.h:47
#define GR_API
Definition: GR_API.h:10
GR_RenderFlags
Definition: GR_Defines.h:85
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:36
const char * className() const override
Definition: GR_VolumeVK.h:48
GLenum mode
Definition: glcorearb.h:99
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:476
Simple class for a mutli-integer cache tag.
virtual void update(RE_RenderContext r, const GT_PrimitiveHandle &primh, const GR_UpdateParms &p, const char *cache_name)=0
GLboolean r
Definition: glcorearb.h:1222
const GLuint * textures
Definition: glcorearb.h:416
virtual void viewUpdate(RE_RenderContext r, const GR_DisplayOption &opts, const char *cache_name, RE_CacheVersion geo_version, RE_CacheVersion select_version)
Definition: GR_GeoRender.h:64