Panda3D
Public Member Functions | Static Public Member Functions | 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

 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 GeomVertexArrayFormat * get_array_format () const
 
Threadget_current_thread () const
 
string get_data () const
 Returns the entire raw data of the GeomVertexArrayData object, formatted as a string. More...
 
int 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...
 
string 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...
 
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 string &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 string &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
 Returns the current reference count. More...
 
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 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...
 
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref (WeakPointerToVoid *ptv)
 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 ()
 

Friends

class GeomVertexArrayData
 

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
}
 
enum  NumericType {
  NT_uint8, NT_uint16, NT_uint32, NT_packed_dcba,
  NT_packed_dabc, NT_float32, NT_float64, NT_stdfloat
}
 
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 254 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 840 of file geomVertexArrayData.cxx.

References copy_subdata_from(), and mark_used().

Referenced by copy_subdata_from(), and get_write_pointer().

◆ 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 880 of file geomVertexArrayData.cxx.

References copy_subdata_from(), and Geom::get_next_modified().

◆ 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 859 of file geomVertexArrayData.cxx.

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

Referenced by copy_data_from(), and GeomTransformer::finish_collect().

◆ 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 906 of file geomVertexArrayData.cxx.

References VertexDataBuffer::clean_realloc(), Geom::get_next_modified(), VertexDataBuffer::get_reserved_size(), VertexDataBuffer::get_size(), VertexDataBuffer::get_write_pointer(), set_data(), VertexDataBuffer::set_size(), and Texture::up_to_power_2().

◆ get_data()

string 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 527 of file geomVertexArrayData.I.

References get_subdata().

Referenced by prepare_now().

◆ 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 396 of file geomVertexArrayData.I.

References GeomVertexArrayData::get_data_size_bytes(), request_resident(), and GeomVertexArrayData::set_num_rows().

Referenced by DXGraphicsStateGuardian9::apply_vertex_buffer(), copy_subdata_from(), and GeomVertexArrayData::get_book().

◆ get_subdata()

string 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 541 of file geomVertexArrayData.I.

References mark_used().

Referenced by get_data().

◆ get_write_pointer()

unsigned char * GeomVertexArrayDataHandle::get_write_pointer ( )

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

Definition at line 697 of file geomVertexArrayData.cxx.

References copy_data_from(), Geom::get_next_modified(), and Texture::up_to_power_2().

Referenced by GeomVertexData::clear_cache_stage(), GeomVertexData::CacheEntry::evict_callback(), and GeomVertexArrayData::finalize().

◆ mark_used()

void GeomVertexArrayDataHandle::mark_used ( ) const
inline

Marks the array data recently-used.

Definition at line 554 of file geomVertexArrayData.I.

Referenced by copy_data_from(), copy_subdata_from(), 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.

References get_data().

Referenced by request_resident().

◆ 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 492 of file geomVertexArrayData.I.

References prepare_now().

Referenced by get_read_pointer().

◆ set_data()

void GeomVertexArrayDataHandle::set_data ( const string &  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 959 of file geomVertexArrayData.cxx.

References Geom::get_next_modified(), and set_subdata().

Referenced by copy_subdata_from().

◆ set_subdata()

void GeomVertexArrayDataHandle::set_subdata ( size_t  start,
size_t  size,
const string &  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 985 of file geomVertexArrayData.cxx.

References VertexDataBuffer::clean_realloc(), Geom::get_next_modified(), VertexDataBuffer::get_reserved_size(), VertexDataBuffer::get_size(), VertexDataBuffer::get_write_pointer(), VertexDataBuffer::set_size(), and Texture::up_to_power_2().

Referenced by set_data().


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