HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GR_UpdateParms.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_UpdateParms.h ( GR Library, C++)
7  *
8  * COMMENTS:
9  * Parameter class containing all parameters for GR_Primitive::update()
10  * and GR_GeoRender::update().
11  * GR_ViewUpdateParms is a subset of these parameters sent to viewUpdate().
12  * Don't cache these structures.
13  */
14 #ifndef GR_UpdateParms_h
15 #define GR_UpdateParms_h
16 
17 #include "GR_API.h"
18 #include "GR_Defines.h"
19 #include "GR_DisplayOption.h"
20 #include "GR_Material.h"
21 
22 #include <GU/GU_SelectType.h>
23 #include <GT/GT_RefineParms.h>
24 #include <GU/GU_DetailHandle.h>
25 #include <RE/RE_Material.h>
26 #include <RE/RE_CachedObject.h>
27 
28 #include <UT/UT_Matrix4.h>
29 #include <UT/UT_StringHolder.h>
30 #include <UT/UT_Map.h>
31 
32 class OP_Node;
33 class UT_BitArray;
34 class GR_MaterialGroups;
35 
36 /// set of parameters sent to GR_Primitive::update()
38 {
39 public:
40  GR_UpdateReason reason; // reason(s) for update
41  OP_Node *op_node; // node detail belongs to
42  GU_ConstDetailHandle geometry; // detail prim is processed for
43  const UT_IntArray &geo_indices; // DOP geometry indices selection
44  const GT_RefineParms &refine_parms; // GT refinement parms
45  const GR_DisplayOption &dopts; // current display options
46  const RE_MaterialAtlas &material_atlas; // old material list
47  const GR_MaterialAtlas &vk_mat_atlas; // Vulkan material list
48  const char *view_name; // full pathname of the viewer
49  int poly_mesh_limit; // max #polys in poly mesh
50  GU_SelectionHandle sel_override; // override selection
51  int vk_default_mat_id; // Default vulkan material
52 
53  GR_RenderVersion gl_version; // GL Renderer version (GL1,2,3,VK)
54  RE_CacheVersion geo_version; // geometry serial version
55  RE_CacheVersion select_version; // selection serial version
56  RE_CacheVersion instance_version; // instanced geo serial verison
57  RE_CacheVersion view_version; // view frustum serial version
58  RE_CacheVersion inst_select_version; // Instance selection version
59  int instance_group; // Instancing group
60  const UT_Matrix4DArray *instances; // per-point instance transforms
61  // May be NULL if no instancing
62  const UT_IntArray *instance_levels; // Nested instancing level counts
63  const UT_BitArray *inst_select; // instance selection
64  const GR_MaterialGroups*extra_mat_groups; // materials from instances
65  const GR_FrustumList &visible_frustums; // frustums for visible viewports
66  bool object_selected; // true if selected at object lvl
67  GR_DecorationOverride required_dec; // decor required above user
68  // dispopt setting
69  unsigned force_wire:1, // must be wireframe
70  force_shaded:1, // must be smooth shaded
71  force_smooth:1, // ignore flat shading
72  force_unlit:1, // unlit geometry
73  refine_for_lops:1,// LOPs viewport
74  build_selection:1,// allow selection to be built
75  build_prim_selection:1, // finer control of
76  build_point_selection:1, // selections to build
77  build_vertex_selection:1,// by type; build_selection
78  build_edge_selection:1, // must be true as well
79  build_bpoint_selection:1,
80  build_ids:1; // allow prim/vert ids to be built
81 
83  OP_Node *node,
84  const GU_ConstDetailHandle &dtl,
85  const UT_IntArray &geoi,
86  const RE_MaterialAtlas &material_atlas,
87  const GR_MaterialAtlas &vk_material_atlas,
88  UT_Map<UT_StringRef,int> *attribs,
89  const char *view_name,
90  int max_poly_mesh_size,
91  const GT_RefineParms &ref,
92  const GR_DisplayOption &d,
94  bool objselect,
95  GR_DecorationOverride req_dec,
96  RE_CacheVersion viewv,
97  const GR_FrustumList &view_frustums,
98  const UT_Matrix4DArray *insts,
99  int inst_grp,
100  RE_CacheVersion instv,
101  const UT_BitArray *inst_select,
102  RE_CacheVersion ints_select_version);
103 
104  GR_UpdateParms(const GR_UpdateParms &u);
105 
107  const GU_ConstDetailHandle &dtl);
108 
110  const RE_MaterialAtlas &atlas);
111 
113  const GR_MaterialAtlas &atlas);
114 
115  ~GR_UpdateParms();
116 
118  { return myNeededAttribs; }
120  {
121  UT_ASSERT(myAttribsCopied);
122  return myAttribsCopied ? myNeededAttribs : nullptr;
123  }
124  void copyNeededAttribs(bool only_if_shallow_ref);
125 
126  // NOTE: The attrib name must exist for the lifetime of the GR_UpdateParms
127  // object. This only keeps a reference to the string data.
128  void addNeededAttrib(const UT_StringRef &attrib);
129  void removeNeededAttrib(const UT_StringRef &attrib);
130  void clearNeededAttribs();
131 
132  void printNeededAttribs(std::ostream *os = nullptr) const;
133 private:
134  bool myAttribsCopied;
135  UT_Map<UT_StringRef,int> *myNeededAttribs;// Pointer to an attrib map needed for all shaders
136  UT_Map<UT_StringRef,int> myNeededAttribsData;// Local attrib map
137 };
138 
139 /// Set of parameters sent to GR_Primitive::viewUpdate().
141 {
142 public:
144  const GU_ConstDetailHandle &geo,
145  RE_CacheVersion geov,
146  RE_CacheVersion selv,
147  RE_CacheVersion viewv,
148  const GR_FrustumList &frustums)
149  : dopts(opt),
150  geometry(geo),
151  geo_version(geov),
152  select_version(selv),
153  view_version(viewv),
154  visible_frustums(frustums) {}
155 
156 
157  const GR_DisplayOption &dopts; // current display options
158  GU_ConstDetailHandle geometry; // detail prim is processed for
159  RE_CacheVersion geo_version; // geometry serial version
160  RE_CacheVersion select_version; // selection serial version
161  RE_CacheVersion view_version; // view frustum serial version
162  const GR_FrustumList &visible_frustums; // frustums of all open viewports
163  // stereo cams have 2/viewport
164 };
165 
166 #endif
GR_ViewUpdateParms(const GR_DisplayOption &opt, const GU_ConstDetailHandle &geo, RE_CacheVersion geov, RE_CacheVersion selv, RE_CacheVersion viewv, const GR_FrustumList &frustums)
const GR_FrustumList & visible_frustums
GR_DecorationOverride
Definition: GR_Defines.h:219
Set of parameters sent to GR_Primitive::viewUpdate().
UT_Map< UT_StringRef, int > * getNeededAttribs()
GU_ConstDetailHandle geometry
RE_CacheVersion geo_version
OP_Node * op_node
const RE_MaterialAtlas & material_atlas
const GT_RefineParms & refine_parms
RE_CacheVersion select_version
const GR_DisplayOption & dopts
RE_CacheVersion view_version
RE_CacheVersion instance_version
A class that manages material assignments to different groups of primitives.
GR_UpdateReason reason
const GR_MaterialAtlas & vk_mat_atlas
set of parameters sent to GR_Primitive::update()
GR_RenderVersion gl_version
const GR_DisplayOption & dopts
RE_CacheVersion geo_version
const char * view_name
GLint ref
Definition: glcorearb.h:124
const UT_BitArray * inst_select
const UT_Map< UT_StringRef, int > * getConstNeededAttribs() const
#define GR_API
Definition: GR_API.h:10
GR_UpdateReason
Definition: GR_Defines.h:312
RE_CacheVersion view_version
GR_RenderVersion
Definition: GR_Defines.h:22
UT_SharedPtr< GU_Selection > GU_SelectionHandle
RE_CacheVersion select_version
const GR_FrustumList & visible_frustums
GU_ConstDetailHandle geometry
const UT_IntArray & geo_indices
GR_DecorationOverride required_dec
Simple class for a mutli-integer cache tag.
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
const UT_IntArray * instance_levels
const GR_MaterialGroups * extra_mat_groups
RE_CacheVersion inst_select_version
GU_SelectionHandle sel_override
const UT_Matrix4DArray * instances