Panda3D
Loading...
Searching...
No Matches
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.
 
void copy_data_from (const unsigned char *source, size_t size)
 Copies the entire data array from the buffer.
 
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.
 
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.
 
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.
 
size_t get_data_size_bytes () const
 
UpdateSeq get_modified () const
 
int get_num_rows () const
 
GeomVertexArrayDataget_object ()
 
const GeomVertexArrayDataget_object () const
 
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.
 
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.
 
UsageHint get_usage_hint () const
 
unsigned char * get_write_pointer ()
 Returns a writable pointer to the beginning of the actual data stream.
 
void mark_used () const
 Marks the array data recently-used.
 
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.
 
bool request_resident () const
 Returns true if the vertex data is currently resident in memory.
 
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.
 
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.
 
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.
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
 
void ref () const
 Explicitly increments the reference count.
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero.
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
 
virtual bool unref () const
 Explicitly decrements the reference count.
 
bool unref_if_one () const
 Atomically decreases the reference count of this object if it is one.
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object.
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object.
 
- Public Member Functions inherited from MemoryBase
void operator delete (void *, void *)
 
void operator delete (void *ptr)
 
void operator delete[] (void *, void *)
 
void operator delete[] (void *ptr)
 
void * operator new (size_t size)
 
void * operator new (size_t size, void *ptr)
 
void * operator new[] (size_t size)
 
void * operator new[] (size_t size, void *ptr)
 

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.
 

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.

Constructor & Destructor Documentation

◆ ~GeomVertexArrayDataHandle()

GeomVertexArrayDataHandle::~GeomVertexArrayDataHandle ( )
inline

Definition at line 379 of file geomVertexArrayData.I.

Member Function Documentation

◆ clear_rows()

void GeomVertexArrayDataHandle::clear_rows ( )
inline

Definition at line 469 of file geomVertexArrayData.I.

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

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

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

References 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 763 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 805 of file geomVertexArrayData.cxx.

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

◆ get_class_type()

static TypeHandle GeomVertexArrayDataHandle::get_class_type ( )
inlinestatic

Definition at line 333 of file geomVertexArrayData.h.

◆ get_current_thread()

Thread * GeomVertexArrayDataHandle::get_current_thread ( ) const
inline

Definition at line 406 of file geomVertexArrayData.I.

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

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

◆ get_num_rows()

int GeomVertexArrayDataHandle::get_num_rows ( ) const
inline

Definition at line 460 of file geomVertexArrayData.I.

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

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

Referenced by DXGraphicsStateGuardian9::apply_vertex_buffer(), GeomVertexDataPipelineWriter::copy_row_from(), 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 535 of file geomVertexArrayData.I.

References VertexDataBuffer::get_read_pointer(), VertexDataBuffer::get_size(), and 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 613 of file geomVertexArrayData.cxx.

References Geom::get_next_modified().

Referenced by GeomPrimitive::add_vertex(), GeomVertexDataPipelineWriter::copy_row_from(), GeomPrimitive::offset_vertices(), GeomPrimitive::offset_vertices(), and Geom::unify_in_place().

◆ init_type()

static void GeomVertexArrayDataHandle::init_type ( )
inlinestatic

Definition at line 336 of file geomVertexArrayData.h.

◆ mark_used()

void GeomVertexArrayDataHandle::mark_used ( ) const
inline

Marks the array data recently-used.

Definition at line 547 of file geomVertexArrayData.I.

Referenced by copy_data_from(), 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 512 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 496 of file geomVertexArrayData.I.

References get_read_pointer().

◆ reserve_num_rows()

bool GeomVertexArrayDataHandle::reserve_num_rows ( int n)

Definition at line 718 of file geomVertexArrayData.cxx.

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

References Geom::get_next_modified().

◆ set_num_rows()

bool GeomVertexArrayDataHandle::set_num_rows ( int n)

Definition at line 624 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 878 of file geomVertexArrayData.cxx.

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

◆ unclean_set_num_rows()

bool GeomVertexArrayDataHandle::unclean_set_num_rows ( int n)

Definition at line 680 of file geomVertexArrayData.cxx.

Friends And Related Symbol Documentation

◆ Geom

friend class Geom
friend

Definition at line 345 of file geomVertexArrayData.h.

◆ GeomPrimitive

friend class GeomPrimitive
friend

Definition at line 346 of file geomVertexArrayData.h.

◆ GeomVertexArrayData

friend class GeomVertexArrayData
friend

Definition at line 350 of file geomVertexArrayData.h.

◆ GeomVertexData

friend class GeomVertexData
friend

Definition at line 347 of file geomVertexArrayData.h.

◆ GeomVertexDataPipelineReader

friend class GeomVertexDataPipelineReader
friend

Definition at line 348 of file geomVertexArrayData.h.

◆ GeomVertexDataPipelineWriter

friend class GeomVertexDataPipelineWriter
friend

Definition at line 349 of file geomVertexArrayData.h.

Member Data Documentation

◆ get_array_format

const GeomVertexArrayFormat * GeomVertexArrayDataHandle::get_array_format
inline

Definition at line 283 of file geomVertexArrayData.h.

◆ get_data_size_bytes

size_t GeomVertexArrayDataHandle::get_data_size_bytes
inline

Definition at line 294 of file geomVertexArrayData.h.

◆ get_modified

UpdateSeq GeomVertexArrayDataHandle::get_modified
inline

Definition at line 295 of file geomVertexArrayData.h.

◆ get_object

GeomVertexArrayData * GeomVertexArrayDataHandle::get_object
inline

Definition at line 279 of file geomVertexArrayData.h.

◆ get_usage_hint

GeomVertexArrayDataHandle::UsageHint GeomVertexArrayDataHandle::get_usage_hint
inline

Definition at line 284 of file geomVertexArrayData.h.


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