HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_PolyRibbonVK.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_PolyRibbonVK (GR Library, C++)
7  *
8  * COMMENTS:
9  * Ribbon (curve with per-point thickness) renderer.
10  */
11 #ifndef GR_PolyRibbonVK_h
12 #define GR_PolyRibbonVK_h
13 
14 #include "GR_API.h"
15 #include "GR_GeoRenderVK.h"
16 
17 #include <GT/GT_DANumeric.h>
18 #include <RV/RV_ShaderBlock.h>
19 #include <UT/UT_Map.h>
20 
21 class GT_PrimCurveMesh;
22 
24 public:
25  static bool initShaders(RV_Instance* inst);
26  static void cleanupShaders();
27 
29  ~GR_PolyRibbonVK() override = default;
30 
31  const char *className() const override { return "GR_PolyRibbonVK"; }
32 
33  void update(RE_RenderContext rc,
34  const GT_PrimitiveHandle &primh,
35  const GR_UpdateParms &parms,
36  const char *cache_name) override;
37 
38  void draw(RE_RenderContext rc,
41  GR_DrawParms dp) override;
42 
43  void getPickConnectGroup(unsigned int pick_mode,
44  GR_PickGeometry pick_geo,
45  int &out_connect_start,
46  int &out_connect_num) override;
47 
49  PrimitiveType prim_type,
50  RV_PrimType render_prim,
51  RV_Geometry &geo,
52  int &out_connect_start,
53  int &out_connect_num) override;
54 
55  exint getNumGLPrimitives() const override;
56 
57  // handle transparently internally, not part of the transparency pass
58  bool hasTransparency() const override
59  { return false; }
60 
61  void setSubdivisionCurve(bool is_subdiv);
62 
63  struct FeatherBlockSet {
64  // these buffers exist iff the corresponding attributes exist
69  int64 myPosDataId = -1;
70  int64 myUVDataId = -1;
71  };
74  };
75 private:
77  // with only vertex attribs
78  GT_PrimitiveHandle myModifiedMesh;
79  UT_Int32Array myConnectGroupMats;
80  // combine these into 1 struct so that in the case where this object does
81  // *not* represent a collection of feathers, only 1 pointer is wasted.
82  UT_UniquePtr<FeatherBlockSets> myFeatherBlocks;
83  bool myIsSubdivisionCurve : 1;
84  unsigned myBarbMode : 2;
85  bool myHasWidth;
86  bool myObjectSelected;
87  RV_VKDescriptorBinding const *getBarbShaderBinding(const char *binding_name);
88  RV_ShaderProgram *getShader(exint shader_bits, const char *for_what);
89  void setupFeatherShaderBlock(
91  const char *const binding_name,
92  const exint element_count,
93  RV_Render &r);
94  void updateBarbPosBlock(UT_UniquePtr<RV_ShaderBlock> &block,
95  RV_Render &r,
96  GT_DataArrayHandle barb_attr);
97  void updateBarbUVBlock(UT_UniquePtr<RV_ShaderBlock> &block,
98  RV_Render &r,
99  GT_DataArrayHandle barb_attr);
100  void buildConnectivity(const GT_PrimCurveMesh &mesh,
101  ConnectsMap &connects_map,
102  UT_Int32Array &out_curve_order,
103  GT_DataArrayHandle attr_mat_id);
104  void drawBarbsOnOneSide(RV_Render &r,
105  RV_ShaderProgram &feather_shader,
106  FeatherBlockSet &block_set,
107  GR_DrawParms dp,
108  uint32_t connect_i);
109  void updateBarbBlocks(RV_Render &r,
110  const GT_PrimitiveHandle &primh,
111  const UT_String &pos_attrib_name,
112  const UT_String &uv_attrib_name,
113  FeatherBlockSet FeatherBlockSets::*blocks_ptr,
114  bool has_barb_orient);
115  GT_DataArrayHandle genUAttr(const GT_PrimCurveMesh &mesh);
116 };
117 #endif
GLbitfield flags
Definition: glcorearb.h:1596
UT_UniquePtr< RV_ShaderVariableSet > mySet
virtual void draw(RE_RenderContext r, GR_RenderMode mode, GR_RenderFlags flags, GR_DrawParms draw_parms)=0
Normal drawing method. Only issue rendering commands.
Unsorted map container.
Definition: UT_Map.h:107
GLint left
Definition: glcorearb.h:2005
UT_UniquePtr< RV_ShaderBlock > myPosBlock
virtual void getVkDecorGeometry(GR_DecorationRender::PrimitiveType prim_type, RV_PrimType render_prim, RV_Geometry &geo, int &out_connect_start, int &out_connect_num)
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.
A mesh of curves.
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
const char * className() const override
#define GR_API
Definition: GR_API.h:10
long long int64
Definition: SYS_Types.h:116
bool hasTransparency() const override
returns true if this drawable renders some transparent elements
UT_UniquePtr< RV_ShaderBlock > myInfoBlock
GR_RenderFlags
Definition: GR_Defines.h:85
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:36
GLenum mode
Definition: glcorearb.h:99
virtual void getPickConnectGroup(unsigned int pick_mode, GR_PickGeometry pick_geo, int &out_connect_start, int &out_connect_num)
Definition: GR_GeoRender.h:100
GR_PickGeometry
Definition: GR_PickRecord.h:60
RV_PrimType
Definition: RV_Type.h:345
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
UT_UniquePtr< RV_ShaderBlock > myUVBlock