Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
GeomVertexArrayDataHandle Class Reference

This data object is returned by GeomVertexArrayData::get_handle() or modify_handle(). More...

#include "geomVertexArrayData.h"

Inheritance diagram for GeomVertexArrayDataHandle:
ReferenceCount GeomEnums MemoryBase

Public Member Functions

 GeomVertexArrayDataHandle (const GeomVertexArrayDataHandle &)=delete
 
 ALLOC_DELETED_CHAIN_DECL (GeomVertexArrayDataHandle)
 
void clear_rows ()
 
void copy_data_from (const GeomVertexArrayDataHandle *other)
 Copies the entire data array from the other object. More...
 
void copy_data_from (const unsigned char *source, size_t size)
 Copies the entire data array from the buffer. More...
 
void copy_subdata_from (size_t to_start, size_t to_size, const GeomVertexArrayDataHandle *other, size_t from_start, size_t from_size)
 Copies a portion of the data array from the other object into a portion of the data array of this object. More...
 
void copy_subdata_from (size_t to_start, size_t to_size, const unsigned char *source, size_t from_start, size_t from_size)
 Copies a portion of the data array from the buffer into a portion of the data array of this object. More...
 
const GeomVertexArrayFormatget_array_format () const
 
Threadget_current_thread () const
 
vector_uchar get_data () const
 Returns the entire raw data of the GeomVertexArrayData object, formatted as a string. More...
 
size_t get_data_size_bytes () const
 
UpdateSeq get_modified () const
 
int get_num_rows () const
 
const GeomVertexArrayDataget_object () const
 
GeomVertexArrayDataget_object ()
 
const unsigned char * get_read_pointer (bool force) const
 Returns a readable pointer to the beginning of the actual data stream, or NULL if the data is not currently resident. More...
 
vector_uchar get_subdata (size_t start, size_t size) const
 Returns a subset of the raw data of the GeomVertexArrayData object, formatted as a string. More...
 
UsageHint get_usage_hint () const
 
unsigned char * get_write_pointer ()
 Returns a writable pointer to the beginning of the actual data stream. More...
 
void mark_used () const
 Marks the array data recently-used. More...
 
GeomVertexArrayDataHandleoperator= (const GeomVertexArrayDataHandle &)=delete
 
VertexBufferContextprepare_now (PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg) const
 Creates a context for the data on the particular GSG, if it does not already exist. More...
 
bool request_resident () const
 Returns true if the vertex data is currently resident in memory. More...
 
bool reserve_num_rows (int n)
 
void set_data (const vector_uchar &data)
 Replaces the entire raw data array with the contents of the indicated string. More...
 
bool set_num_rows (int n)
 
void set_subdata (size_t start, size_t size, const vector_uchar &data)
 Replaces a portion of the data array from the indicated string. More...
 
bool unclean_set_num_rows (int n)
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Public Attributes

 get_array_format
 
 get_data_size_bytes
 
 get_modified
 
 get_object
 
 get_usage_hint
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Friends

class Geom
 
class GeomPrimitive
 
class GeomVertexArrayData
 
class GeomVertexData
 
class GeomVertexDataPipelineReader
 
class GeomVertexDataPipelineWriter
 

Additional Inherited Members

- Public Types inherited from GeomEnums
enum  AnimationType { AT_none, AT_panda, AT_hardware }
 
enum  Contents {
  C_other, C_point, C_clip_point, C_vector,
  C_texcoord, C_color, C_index, C_morph_delta,
  C_matrix, C_normal
}
 
enum  GeomRendering {
  GR_indexed_point = 0x00001, GR_indexed_other = 0x10000, GR_indexed_bits = 0x10001, GR_point = 0x00002,
  GR_point_uniform_size = 0x00004, GR_per_point_size = 0x00008, GR_point_perspective = 0x00010, GR_point_aspect_ratio = 0x00020,
  GR_point_scale = 0x00040, GR_point_rotate = 0x00080, GR_point_sprite = 0x00100, GR_point_sprite_tex_matrix = 0x00200,
  GR_point_bits = 0x003fe, GR_triangle_strip = 0x00400, GR_triangle_fan = 0x00800, GR_line_strip = 0x01000,
  GR_composite_bits = 0x01c00, GR_strip_cut_index = 0x20000, GR_flat_first_vertex = 0x02000, GR_flat_last_vertex = 0x04000,
  GR_shade_model_bits = 0x06000, GR_render_mode_wireframe = 0x40000, GR_render_mode_point = 0x80000, GR_adjacency = 0x100000
}
 
enum  NumericType {
  NT_uint8, NT_uint16, NT_uint32, NT_packed_dcba,
  NT_packed_dabc, NT_float32, NT_float64, NT_stdfloat,
  NT_int8, NT_int16, NT_int32, NT_packed_ufloat
}
 
enum  PrimitiveType {
  PT_none, PT_polygons, PT_lines, PT_points,
  PT_patches
}
 
enum  ShadeModel { SM_uniform, SM_smooth, SM_flat_first_vertex, SM_flat_last_vertex }
 
enum  UsageHint {
  UH_client, UH_stream, UH_dynamic, UH_static,
  UH_unspecified
}
 

Detailed Description

This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().

As long as it exists, the data is locked; when the last of these destructs, the data is unlocked.

Only one thread at a time may lock the data; other threads attempting to lock the data will block. A given thread may simultaneously lock the data multiple times.

This class serves in lieu of a pair of GeomVertexArrayDataPipelineReader and GeomVertexArrayDataPipelineWriter classes

Definition at line 250 of file geomVertexArrayData.h.

Member Function Documentation

◆ copy_data_from() [1/2]

void GeomVertexArrayDataHandle::copy_data_from ( const GeomVertexArrayDataHandle other)

Copies the entire data array from the other object.

Definition at line 739 of file geomVertexArrayData.cxx.

◆ copy_data_from() [2/2]

void GeomVertexArrayDataHandle::copy_data_from ( const unsigned char *  source,
size_t  size 
)

Copies the entire data array from the buffer.

Definition at line 774 of file geomVertexArrayData.cxx.

◆ copy_subdata_from() [1/2]

void GeomVertexArrayDataHandle::copy_subdata_from ( size_t  to_start,
size_t  to_size,
const GeomVertexArrayDataHandle other,
size_t  from_start,
size_t  from_size 
)

Copies a portion of the data array from the other object into a portion of the data array of this object.

If to_size != from_size, the size of this data array is adjusted accordingly.

Definition at line 755 of file geomVertexArrayData.cxx.

References get_read_pointer(), VertexDataBuffer::get_size(), and mark_used().

◆ copy_subdata_from() [2/2]

void GeomVertexArrayDataHandle::copy_subdata_from ( size_t  to_start,
size_t  to_size,
const unsigned char *  source,
size_t  from_start,
size_t  from_size 
)

Copies a portion of the data array from the buffer into a portion of the data array of this object.

If to_size != from_size, the size of this data array is adjusted accordingly.

Definition at line 797 of file geomVertexArrayData.cxx.

◆ get_data()

vector_uchar GeomVertexArrayDataHandle::get_data ( ) const
inline

Returns the entire raw data of the GeomVertexArrayData object, formatted as a string.

This is primarily for the benefit of high-level languages such as Python.

Definition at line 524 of file geomVertexArrayData.I.

References mark_used().

◆ get_read_pointer()

const unsigned char * GeomVertexArrayDataHandle::get_read_pointer ( bool  force) const
inline

Returns a readable pointer to the beginning of the actual data stream, or NULL if the data is not currently resident.

If the data is not currently resident, this will implicitly request it to become resident soon.

If force is true, this method will never return NULL, but may block until the data is available.

Definition at line 420 of file geomVertexArrayData.I.

References mark_used().

Referenced by copy_subdata_from(), and request_resident().

◆ get_subdata()

vector_uchar GeomVertexArrayDataHandle::get_subdata ( size_t  start,
size_t  size 
) const
inline

Returns a subset of the raw data of the GeomVertexArrayData object, formatted as a string.

This is primarily for the benefit of high-level languages such as Python.

Definition at line 536 of file geomVertexArrayData.I.

References mark_used().

◆ get_write_pointer()

unsigned char * GeomVertexArrayDataHandle::get_write_pointer ( )

Returns a writable pointer to the beginning of the actual data stream.

Definition at line 605 of file geomVertexArrayData.cxx.

◆ mark_used()

void GeomVertexArrayDataHandle::mark_used ( ) const
inline

Marks the array data recently-used.

Definition at line 548 of file geomVertexArrayData.I.

Referenced by copy_subdata_from(), get_data(), get_read_pointer(), and get_subdata().

◆ prepare_now()

VertexBufferContext * GeomVertexArrayDataHandle::prepare_now ( PreparedGraphicsObjects prepared_objects,
GraphicsStateGuardianBase gsg 
) const
inline

Creates a context for the data on the particular GSG, if it does not already exist.

Returns the new (or old) VertexBufferContext. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new datas. If this is not necessarily the case, you should use prepare() instead.

Normally, this is not called directly except by the GraphicsStateGuardian; a data does not need to be explicitly prepared by the user before it may be rendered.

Definition at line 513 of file geomVertexArrayData.I.

◆ request_resident()

bool GeomVertexArrayDataHandle::request_resident ( ) const
inline

Returns true if the vertex data is currently resident in memory.

If this returns true, the next call to get_handle()->get_read_pointer() will probably not block. If this returns false, the vertex data will be brought back into memory shortly; try again later.

Definition at line 497 of file geomVertexArrayData.I.

References get_read_pointer().

◆ set_data()

void GeomVertexArrayDataHandle::set_data ( const vector_uchar &  data)

Replaces the entire raw data array with the contents of the indicated string.

This is primarily for the benefit of high-level languages like Python.

Definition at line 848 of file geomVertexArrayData.cxx.

◆ set_subdata()

void GeomVertexArrayDataHandle::set_subdata ( size_t  start,
size_t  size,
const vector_uchar &  data 
)

Replaces a portion of the data array from the indicated string.

If size != data.size(), the size of this data array is adjusted accordingly.

This is primarily for the benefit of high-level languages like Python.

Definition at line 870 of file geomVertexArrayData.cxx.


The documentation for this class was generated from the following files: