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

List of all members.

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.
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.
const GeomVertexArrayFormatget_array_format () const
Threadget_current_thread () const
string get_data () const
 Returns the entire raw data of the GeomVertexArrayData object, formatted as a string.
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.
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.
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.
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 string &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 string &data)
 Replaces a portion of the data array from the indicated string.
bool unclean_set_num_rows (int n)

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Friends

class GeomVertexArrayData

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 248 of file geomVertexArrayData.h.


Member Function Documentation

Copies the entire data array from the other object.

Definition at line 840 of file geomVertexArrayData.cxx.

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

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

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

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

References mark_used().

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 mark_used().

Referenced by copy_subdata_from(), DXGraphicsStateGuardian8::draw_lines(), DXGraphicsStateGuardian9::draw_lines(), DXGraphicsStateGuardian8::draw_points(), DXGraphicsStateGuardian9::draw_points(), DXGraphicsStateGuardian8::draw_triangles(), DXGraphicsStateGuardian9::draw_triangles(), DXGraphicsStateGuardian8::draw_trifans(), DXGraphicsStateGuardian9::draw_trifans(), DXGraphicsStateGuardian8::draw_tristrips(), DXGraphicsStateGuardian9::draw_tristrips(), request_resident(), and DXVertexBufferContext8::upload_data().

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

References mark_used().

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

Definition at line 697 of file geomVertexArrayData.cxx.

References Geom::get_next_modified().

void GeomVertexArrayDataHandle::mark_used ( ) const [inline]

Marks the array data recently-used.

Definition at line 531 of file geomVertexArrayData.I.

Referenced by copy_data_from(), copy_subdata_from(), get_data(), get_read_pointer(), get_subdata(), set_data(), and set_subdata().

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

References get_read_pointer().

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

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

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

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


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations