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 
65  int64 myDataId = -1;
66  };
67  struct FeatherBlockSet {
68  // these buffers exist iff the corresponding attributes exist
71  CachedAuxFeatherBarbAttr myPos, myUV, myColour, myWidth;
72  };
75  };
76 private:
78  // with only vertex attribs
79  GT_PrimitiveHandle myModifiedMesh;
80  UT_Int32Array myConnectGroupMats;
81  // combine these into 1 struct so that in the case where this object does
82  // *not* represent a collection of feathers, only 1 pointer is wasted.
83  UT_UniquePtr<FeatherBlockSets> myFeatherBlocks;
84  bool myIsSubdivisionCurve : 1;
85  unsigned myBarbMode : 2;
86  bool myHasWidth;
87  bool myObjectSelected;
88  bool setupFeatherShaderBlock(
90  const char *const binding_name,
91  const exint element_count,
92  RV_Render &r);
93  bool updateBarbVectorBlock(UT_UniquePtr<RV_ShaderBlock> &block,
94  RV_Render &r,
95  GT_DataArrayHandle barb_attr,
96  const char *binding_name);
97  bool 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  const UT_String &colour_attrib_name,
114  const UT_String &width_attrib_name,
115  FeatherBlockSet FeatherBlockSets::*blocks_ptr,
116  bool has_barb_orient);
117  GT_DataArrayHandle genUAttr(const GT_PrimCurveMesh &mesh);
118 };
119 #endif
GLbitfield flags
Definition: glcorearb.h:1596
UT_UniquePtr< RV_ShaderVariableSet > mySet
UT_UniquePtr< RV_ShaderBlock > myBlock
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
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:165
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:48
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:86
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:38
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:367
CachedAuxFeatherBarbAttr myWidth
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