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;
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 
48  void getVkDecorConnectGroup(RV_PrimType render_prim,
49  bool is_uv_view,
50  int &out_connect_start,
51  int &out_connect_num) override;
52 
53  exint getNumGLPrimitives() const override;
54 
55  bool hasTransparency() const override;
56  void retireGeometry() override;
57 
58  void setSubdivisionCurve(bool is_subdiv);
59 
60  static void getLODParms(const GR_DisplayOption *opt,
61  UT_Vector2F &lod_parms);
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 myForceWireframe = false;
89  bool setupFeatherShaderBlock(
91  const char *const binding_name,
92  const exint element_count,
93  RV_Render &r);
94  bool updateBarbVectorBlock(UT_UniquePtr<RV_ShaderBlock> &block,
95  RV_Render &r,
96  GT_DataArrayHandle barb_attr,
97  const char *binding_name);
98  bool updateBarbUVBlock(UT_UniquePtr<RV_ShaderBlock> &block,
99  RV_Render &r,
100  GT_DataArrayHandle barb_attr);
101  void buildSimpleConnectivity(const GT_PrimCurveMesh &mesh,
102  UT_Int32Array &out_connect);
103  void buildConnectivity(const GT_PrimCurveMesh &mesh,
104  ConnectsMap &connects_map,
105  UT_Int32Array &out_curve_order,
106  GT_DataArrayHandle attr_mat_id);
107  void drawBarbsOnOneSide(RV_Render &r,
108  RV_ShaderProgram &feather_shader,
109  FeatherBlockSet &block_set,
110  GR_DrawParms dp,
111  uint32_t connect_i);
112  void updateBarbBlocks(RV_Render &r,
113  const GT_PrimitiveHandle &primh,
114  const UT_String &pos_attrib_name,
115  const UT_String &uv_attrib_name,
116  const UT_String &colour_attrib_name,
117  const UT_String &width_attrib_name,
118  FeatherBlockSet FeatherBlockSets::*blocks_ptr,
119  bool has_barb_orient);
120  GT_DataArrayHandle genUAttr(const GT_PrimCurveMesh &mesh);
121 };
122 #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:114
static bool initShaders(RV_Instance *inst)
GLint left
Definition: glcorearb.h:2005
int64 exint
Definition: SYS_Types.h:125
GT_API const UT_StringHolder cache_name
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
virtual bool hasTransparency() const
returns true if this drawable renders some transparent elements
Definition: GR_GeoRender.h:89
const char * className() const override
virtual void getVkDecorConnectGroup(RV_PrimType render_prim, bool is_uv_view, int &out_connect_start, int &out_connect_num)
#define GR_API
Definition: GR_API.h:10
long long int64
Definition: SYS_Types.h:116
UT_UniquePtr< RV_ShaderBlock > myInfoBlock
GR_RenderFlags
Definition: GR_Defines.h:88
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:48
GLenum mode
Definition: glcorearb.h:99
virtual void retireGeometry()
Definition: GR_GeoRender.h:86
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:356
GA_API const UT_StringHolder parms
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
static void cleanupShaders()