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);
434 void copyConstInstanceGroupTransform(
int instance_group,
435 int src_instance_group);
457 const char *view_name
467 bool clearInstanceGroupAttrib(
int instance_group,
480 int getInstanceGroupCount(
int instance_group)
const;
484 const char *base_name,
513 int vertices_per_patch = 0);
524 int vertices_per_patch = 0);
534 const unsigned int *prims,
537 int vertices_per_patch = 0);
546 int vertices_per_patch = 0);
557 int getConnectNumElementArrays(
int connect_group);
563 bool hasConnectGroup(
int connect_group)
const;
565 bool hasNonEmptyConnectGroup(
int connect_group)
const;
569 int getMaxConnectGroup()
const;
573 bool removeConnectedPrims(
int connect_group);
576 void resetConnectedPrims();
582 bool assignMaterialToConnectivty(
RE_Render *
r,
600 void useAttribute(
int connect_group,
601 const char *
name,
bool enable);
605 void useAttribute(
int connect_group,
611 void useMaterialTextures(
bool enable =
true);
614 void setNumMaterialLayers(
int num);
636 drawPrivate(r, getConnect(connect_idx,
false),0,
637 prim_type, attrib_overrides, 0);
655 int connect_group_start,
int num_connect_groups,
658 const int *material_offset =
nullptr);
678 int connect_start,
int num_connect,
682 const int *material_offset =
nullptr);
698 const int *material_offset =
nullptr);
711 void enableArrays(
RE_Render *
r,
int connect_group,
713 void disableArrays(
RE_Render *
r,
int connect_group);
734 void print(std::ostream *out =
nullptr)
const;
737 void setDebugDraw(
bool dump_uniforms,
746 re_Connectivity *getConnect(
int group_idx,
747 bool create_if_none);
751 void clearBuffers(
bool connectivity_too =
true);
757 const char *attrib_name);
762 const char *attrib_name);
767 const char *attrib_name,
773 const char *cache_prefix);
780 bool privAttachAttribute(
RE_VertexArray *attrib,
bool show_errors);
785 const char *attrib_name,
793 const char *cache_prefix =
nullptr,
794 bool create_const_attrib =
false,
795 int array_capacity = -1);
798 const char *attrib_name,
803 bool create_if_missing,
807 const char *cache_prefix =
nullptr,
810 re_Connectivity *connect,
821 void privEnableArrays(
823 re_Connectivity *connect,
826 int instance_group = 0);
827 void privDisableArrays(
829 re_Connectivity *connect,
832 re_Connectivity *connect,
833 const char *attrib_name,
845 mutable int myAttribPIndex;
846 bool myUseVertexState;
847 bool myPurgeOnDelete;
848 int myVertexStateSerial;
851 int myNumMaterialLayers;
866 int myDebugDrawFlags;
868 friend class re_InstanceGroup;
874 myUseTextures = enable;
880 myNumMaterialLayers =
SYSclamp(num, 1, 32);
885 const char *attrib_name,
889 bool create_if_missing,
893 const char *cache_prefix,
896 return fetchCachedAttrib(r, attrib_name, data_format, vectorsize,
897 array_type, 0, create_if_missing,
898 array_size, cache_version, usage,
899 cache_prefix, capacity);
904 const char *attrib_name,
909 bool create_if_missing,
912 const char *cache_prefix,
915 return fetchCachedAttrib(r, attrib_name, data_format, vectorsize,
917 create_if_missing, array_size,
918 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...