28 class re_Connectivity;
29 class re_InstanceGroup;
42 #define RE_GEO_POINTS_IDX 0
43 #define RE_GEO_WIRE_IDX 2
44 #define RE_GEO_SHADED_IDX 4
46 #define RE_GEO_ALL_SHADED 0x40000000
57 bool use_buffer_object =
true);
62 int64 getMemoryUsage(
bool inclusive)
const;
69 void useBufferObjects(
bool use_buf =
true);
74 void useVertexState(
bool use_state =
true);
83 bool setNumPoints(
int num);
89 bool setNumVertices(
int num);
95 bool setNumPrimitives(
int num);
111 bool shrink_if_smaller,
133 void stashAttributes();
137 int clearStashedAttributes(
bool purge_from_cache);
143 RE_VertexArray *recallStashedVaryingAttribute(
const char *attrib_name);
146 RE_VertexArray *recallStashedConstAttribute(
const char *attrib_name);
153 bool hasStashedAttribute(
const char *
name);
161 const char *attrib_name,
168 const char *cache_prefix =
nullptr,
177 const char *attrib_name,
183 const char *cache_prefix
190 const char *attrib_name,
200 const char *attrib_name,
203 const void *default_value);
213 bool clearAttribute(
const char *
name,
214 bool purge_cache=
false);
219 bool clearAttributeByIndex(
int i,
220 bool purge_cache=
false);
227 int getAttributeIndex(
const char *
name)
const;
233 int getNumAttributes()
const;
256 const char *attrib_name,
263 const char *cache_prefix
267 const char *attrib_name,
271 RE_VertexArray *getAddressableAttribute(
const char *attrib_name)
const;
274 int getAddressableAttributeIndex(
const char *attrib_name)
278 void clearAddressableAttribute(
const char *attrib_name);
282 {
return myTextureAttributes.entries(); }
286 {
return myBufferTextures(index); }
289 {
return myTextureAttributes(index); }
306 bool cacheBuffers(
const char *
name);
312 bool isCaching()
const {
return myCacheName.isstring(); }
316 { myPurgeOnDelete = purge; }
333 const char *attrib_name,
337 bool create_if_missing =
false,
338 int random_array_size = -1,
341 const char *cache_prefix =
nullptr,
349 const char *attrib_name,
354 bool create_if_missing=
false,
357 const char *cache_prefix =
nullptr,
373 void createInstanceGroup(
int instance_group);
378 void removeInstanceGroup(
int instance_group);
381 bool hasInstanceGroup(
int instance_group)
const;
384 {
return myInstanceGroups.entries(); }
391 void setInstanceGroupNesting(
int instance_group,
393 void clearInstanceGroupNesting(
int instance_group);
402 int max_capacity = -1);
407 int instance_to_draw);
410 void setInstanceGroupDrawEverything(
RE_Render *
r,
413 void setInstanceGroupDrawNothing(
RE_Render *
r,
426 void setConstInstanceGroupTransform(
int instance_group,
428 bool remove_instanced_xform);
429 void setConstInstanceGroupTransform(
int instance_group,
431 bool remove_instanced_xform);
453 const char *view_name
463 bool clearInstanceGroupAttrib(
int instance_group,
476 int getInstanceGroupCount(
int instance_group)
const;
480 const char *base_name,
509 int vertices_per_patch = 0);
520 int vertices_per_patch = 0);
530 const unsigned int *prims,
533 int vertices_per_patch = 0);
542 int vertices_per_patch = 0);
553 int getConnectNumElementArrays(
int connect_group);
559 bool hasConnectGroup(
int connect_group)
const;
561 bool hasNonEmptyConnectGroup(
int connect_group)
const;
565 int getMaxConnectGroup()
const;
569 bool removeConnectedPrims(
int connect_group);
572 void resetConnectedPrims();
578 bool assignMaterialToConnectivty(
RE_Render *
r,
596 void useAttribute(
int connect_group,
597 const char *
name,
bool enable);
601 void useAttribute(
int connect_group,
607 void useMaterialTextures(
bool enable =
true);
610 void setNumMaterialLayers(
int num);
632 drawPrivate(r, getConnect(connect_idx,
false),0,
633 prim_type, attrib_overrides, 0);
651 int connect_group_start,
int num_connect_groups,
654 const int *material_offset =
nullptr);
674 int connect_start,
int num_connect,
678 const int *material_offset =
nullptr);
694 const int *material_offset =
nullptr);
707 void enableArrays(
RE_Render *
r,
int connect_group,
709 void disableArrays(
RE_Render *
r,
int connect_group);
730 void print(std::ostream *out =
nullptr)
const;
733 void setDebugDraw(
bool dump_uniforms,
742 re_Connectivity *getConnect(
int group_idx,
743 bool create_if_none);
747 void clearBuffers(
bool connectivity_too =
true);
753 const char *attrib_name);
758 const char *attrib_name);
763 const char *attrib_name,
769 const char *cache_prefix);
776 bool privAttachAttribute(
RE_VertexArray *attrib,
bool show_errors);
781 const char *attrib_name,
789 const char *cache_prefix =
nullptr,
790 bool create_const_attrib =
false,
791 int array_capacity = -1);
794 const char *attrib_name,
799 bool create_if_missing,
803 const char *cache_prefix =
nullptr,
806 re_Connectivity *connect,
817 void privEnableArrays(
819 re_Connectivity *connect,
822 int instance_group = 0);
823 void privDisableArrays(
825 re_Connectivity *connect,
828 re_Connectivity *connect,
829 const char *attrib_name,
841 mutable int myAttribPIndex;
842 bool myUseVertexState;
843 bool myPurgeOnDelete;
844 int myVertexStateSerial;
847 int myNumMaterialLayers;
862 int myDebugDrawFlags;
864 friend class re_InstanceGroup;
870 myUseTextures = enable;
876 myNumMaterialLayers =
SYSclamp(num, 1, 32);
881 const char *attrib_name,
885 bool create_if_missing,
889 const char *cache_prefix,
892 return fetchCachedAttrib(r, attrib_name, data_format, vectorsize,
893 array_type, 0, create_if_missing,
894 array_size, cache_version, usage,
895 cache_prefix, capacity);
900 const char *attrib_name,
905 bool create_if_missing,
908 const char *cache_prefix,
911 return fetchCachedAttrib(r, attrib_name, data_format, vectorsize,
913 create_if_missing, array_size,
914 cache_version, usage, cache_prefix, capacity);
int getNumInstanceGroups() const
Create a new instance group. instance_group must be a positive int.
void useMaterialTextures(bool enable=true)
Enables or disables textures on materials when drawn.
GLsizei GLenum const void * indices
void purgeOnDelete(bool purge=true)
Remove all buffers from the cache when this geometry object is deleted.
void setNumMaterialLayers(int num)
Clamp the number of layers to draw with a multi-layer material.
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
void draw(RE_Render *r, int connect_idx, RE_PrimType prim_type=RE_PRIM_AS_IS, RE_OverrideList *attrib_overrides=nullptr)
GLboolean GLboolean GLboolean GLboolean a
const RE_VertexMap * getVertexMap() const
Return a vertex map representing the layout locations of the attributes.
GLuint GLsizei GLsizei * length
bool isCaching() const
Check if this geometry object is caching.
RE_Texture * getAddressableAttributeTexture(int index) const
Return the texture buffer object representing addressable attribute 'i'.
std::string OIIO_UTIL_API replace(string_view str, string_view pattern, string_view replacement, bool global=false)
UT_Vector3T< T > SYSclamp(const UT_Vector3T< T > &v, const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
RE_VertexArray * getAddressableAttributeByIndex(int index) const
Return the vertex arrayrepresenting addressable attribute 'i'.
GLint GLenum GLboolean GLsizei stride
RE_VertexArray * findCachedInstancedAttrib(RE_Render *r, const char *attrib_name, RE_GPUType data_format, int vectorsize, int instance_step, int array_size, bool create_if_missing=false, const RE_CacheVersion *v=nullptr, RE_BufferUsageHint h=RE_BUFFER_WRITE_FREQUENT, const char *cache_prefix=nullptr, int capacity=-1)
Find an instanced attribute in the GL cache, possibly creating it. The instance_step parameter define...
GLuint const GLchar * name
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
GLfloat GLfloat GLfloat GLfloat h
GLsizeiptr const void GLenum usage
int getNumVertices() const
Sets the number of elements in arrays declared as RE_ARRAY_VERTEX.
int getNumPoints() const
Number of points in the geometry. Number of points for the arrays declared as RE_ARRAY_POINT. This will clear the data in all point arrays and reset the connectivty.
int getNumAddressableAttributes() const
Return the number of addressable attributes.
const char * getCacheName() const
Return the base cache name.
Simple class for a mutli-integer cache tag.
RE_VertexArray * getAttribute(const char *name) const
Fetch an attribute by name.
FMT_INLINE void print(format_string< T...> fmt, T &&...args)
int getNumPrimitives() const
Sets the number of elements in arrays declared as RE_ARRAY_PRIMITIVE.
RE_VertexArray * findCachedAttrib(RE_Render *r, const char *attrib_name, RE_GPUType data_format, int vectorsize, RE_ArrayType array_type, bool create_if_missing=false, int random_array_size=-1, const RE_CacheVersion *cv=nullptr, RE_BufferUsageHint h=RE_BUFFER_WRITE_FREQUENT, const char *cache_prefix=nullptr, int capacity=-1)
Find an attribute or array in the GL cache, possibly creating it Returns the cached array...