Panda3D
|
This is the data for one array of a GeomVertexData structure. More...
Public Types | |
enum | AnimationType { ATNone = 0, ATPanda = 1, ATHardware = 2 } |
enum | Contents { COther = 0, CPoint = 1, CClipPoint = 2, CVector = 3, CTexcoord = 4, CColor = 5, CIndex = 6, CMorphDelta = 7 } |
enum | GeomRendering { GRIndexedPoint = 1, GRIndexedOther = 65536, GRIndexedBits = 65537, GRPoint = 2, GRPointUniformSize = 4, GRPerPointSize = 8, GRPointPerspective = 16, GRPointAspectRatio = 32, GRPointScale = 64, GRPointRotate = 128, GRPointSprite = 256, GRPointSpriteTexMatrix = 512, GRPointBits = 1022, GRTriangleStrip = 1024, GRTriangleFan = 2048, GRLineStrip = 4096, GRCompositeBits = 7168, GRFlatFirstVertex = 8192, GRFlatLastVertex = 16384, GRShadeModelBits = 24576, GRTexcoordLightVector = 32768 } |
enum | NumericType { NTUint8 = 0, NTUint16 = 1, NTUint32 = 2, NTPackedDcba = 3, NTPackedDabc = 4, NTFloat32 = 5 } |
enum | PrimitiveType { PTNone = 0, PTPolygons = 1, PTLines = 2, PTPoints = 3 } |
enum | ShadeModel { SMUniform = 0, SMSmooth = 1, SMFlatFirstVertex = 2, SMFlatLastVertex = 3 } |
enum | UsageHint { UHClient = 0, UHStream = 1, UHDynamic = 2, UHStatic = 3, UHUnspecified = 4 } |
Public Member Functions | |
GeomVertexArrayData (GeomVertexArrayData const copy) | |
GeomVertexArrayData (GeomVertexArrayFormat const array_format, UsageHint usage_hint) | |
cacheRef () | |
See CachedTypedWritableReferenceCount.cache_ref(). | |
bool | cacheUnref () |
Explicitly decrements the cache reference count and the normal reference count simultaneously. | |
clearRows () | |
Removes all of the rows in the array. | |
int | compareTo (GeomVertexArrayData const other) |
Returns 0 if the two arrays are equivalent, even if they are not the same pointer. | |
dequeueLru () | |
Removes the page from its SimpleLru. | |
string | encodeToBamStream () |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. | |
bool | encodeToBamStream (basic_stringchar data, BamWriter writer) |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
bool | encodeToBamStream (basic_stringchar data) |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
enqueueLru (SimpleLru lru) | |
Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added. | |
evictLru () | |
Evicts the page from the LRU. | |
GeomVertexArrayFormat const | getArrayFormat () |
Returns the format object that describes this array. | |
UpdateSeq | getBamModified () |
Returns the current bam_modified counter. | |
int | getCacheRefCount () |
Returns the current reference count. | |
int | getDataSizeBytes () |
Returns the number of bytes stored in the array. | |
GeomVertexArrayDataHandle const | getHandle (Thread current_thread) |
Returns an object that can be used to read the actual data bytes stored in the array. | |
GeomVertexArrayDataHandle const | getHandle () |
Returns an object that can be used to read the actual data bytes stored in the array. | |
SimpleLru | getLru () |
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU. | |
unsigned int | getLruSize () |
Returns the size of this page as reported to the LRU, presumably in bytes. | |
UpdateSeq | getModified () |
Returns a sequence number which is guaranteed to change at least every time the array vertex data is modified. | |
int | getNumRows () |
Returns the number of rows stored in the array, based on the number of bytes and the stride. | |
int | getRefCount () |
Returns the current reference count. | |
TypeHandle | getType () |
int | getTypeIndex () |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
UsageHint | getUsageHint () |
Returns the usage hint that describes to the rendering backend how often the vertex data will be modified and/or rendered. | |
bool | hasColumn (InternalName const name) |
Returns true if the array has the named column, false otherwise. | |
bool | isExactType (TypeHandle handle) |
Returns true if the current object is the indicated type exactly. | |
bool | isOfType (TypeHandle handle) |
Returns true if the current object is or derives from the indicated type. | |
bool | isPrepared (PreparedGraphicsObjects prepared_objects) |
Returns true if the data has already been prepared or enqueued for preparation on the indicated GSG, false otherwise. | |
markBamModified () | |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
markUsedLru () | |
To be called when the page is used; this will move it to the tail of the SimpleLru queue it is already on. | |
markUsedLru (SimpleLru lru) | |
To be called when the page is used; this will move it to the tail of the specified SimpleLru queue. | |
GeomVertexArrayDataHandle | modifyHandle (Thread current_thread) |
Returns an object that can be used to read or write the actual data bytes stored in the array. | |
GeomVertexArrayDataHandle | modifyHandle () |
Returns an object that can be used to read or write the actual data bytes stored in the array. | |
operator new (unsigned int size) | |
GeomVertexArrayData | operator= (GeomVertexArrayData const copy) |
The copy assignment operator is not pipeline-safe. | |
output (ostream out) | |
prepare (PreparedGraphicsObjects prepared_objects) | |
Indicates that the data should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame. | |
VertexBufferContext | prepareNow (PreparedGraphicsObjects prepared_objects, GraphicsStateGuardianBase gsg) |
Creates a context for the data on the particular GSG, if it does not already exist. | |
PyObject | reduce (PyObject self) |
This special Python method is implement to provide support for the pickle module. | |
PyObject | reducePersist (PyObject self, PyObject pickler) |
This special Python method is implement to provide support for the pickle module. | |
ref () | |
Explicitly increments the reference count. | |
bool | release (PreparedGraphicsObjects prepared_objects) |
Frees the data context only on the indicated object, if it exists there. | |
int | releaseAll () |
Frees the context allocated on all objects for which the data has been declared. | |
bool | requestResident () |
Returns true if the vertex data is currently resident in memory. | |
setLruSize (unsigned int lru_size) | |
Specifies the size of this page, presumably in bytes, although any unit is possible. | |
bool | setNumRows (int n) |
Sets the length of the array to n rows. | |
setUsageHint (UsageHint usage_hint) | |
Changes the UsageHint hint for this array. | |
bool | testRefCountIntegrity () |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | testRefCountNonzero () |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
bool | uncleanSetNumRows (int n) |
This method behaves like set_num_rows(), except the new data is not initialized. | |
bool | unref () |
Explicitly decrements the reference count. | |
write (ostream out) | |
write (ostream out, int indent_level) | |
Static Public Member Functions | |
static TypedWritableReferenceCount | decodeFromBamStream (string data, BamReader reader) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string. | |
static TypedWritableReferenceCount | decodeFromBamStream (string data) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string. | |
static VertexDataBook | getBook () |
Returns the global VertexDataBook that will be used to allocate vertex data buffers. | |
static TypeHandle | getClassType () |
static SimpleLru | getIndependentLru () |
Returns a pointer to the global LRU object that manages the GeomVertexArrayData's that have not (yet) been paged out. | |
static SimpleLru | getSmallLru () |
Returns a pointer to the global LRU object that manages the GeomVertexArrayData's that are deemed too small to be paged out. | |
static | lruEpoch () |
Marks that an epoch has passed in each LRU. |
This is the data for one array of a GeomVertexData structure.
Many GeomVertexData structures will only define one array, with all data elements interleaved (DirectX 8.0 and before insisted on this format); some will define multiple arrays.
DirectX calls this concept of one array a "stream". It also closely correlates with the concept of a vertex buffer.
This object is just a block of data. In general, you should not be directly messing with this object from application code. See GeomVertexData for the organizing structure, and see GeomVertexReader/Writer/Rewriter for high-level tools to manipulate the actual vertex data.
enum AnimationType [inherited] |
enum Contents [inherited] |
enum GeomRendering [inherited] |
enum NumericType [inherited] |
enum PrimitiveType [inherited] |
enum ShadeModel [inherited] |
enum UsageHint [inherited] |
GeomVertexArrayData | ( | GeomVertexArrayData const | copy | ) |
GeomVertexArrayData | ( | GeomVertexArrayFormat const | array_format, |
UsageHint | usage_hint | ||
) |
cacheRef | ( | ) | [inherited] |
See CachedTypedWritableReferenceCount.cache_ref().
Reimplemented from CachedTypedWritableReferenceCount.
bool cacheUnref | ( | ) | [inherited] |
Explicitly decrements the cache reference count and the normal reference count simultaneously.
The return value is true if the new reference count is nonzero, false if it is zero.
Reimplemented in TransformState, and RenderState.
clearRows | ( | ) |
Removes all of the rows in the array.
Functionally equivalent to set_num_rows(0).
int compareTo | ( | GeomVertexArrayData const | other | ) |
Returns 0 if the two arrays are equivalent, even if they are not the same pointer.
static TypedWritableReferenceCount decodeFromBamStream | ( | string | data, |
BamReader | reader | ||
) | [static, inherited] |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
Returns NULL on error.
This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.
static TypedWritableReferenceCount decodeFromBamStream | ( | string | data | ) | [static, inherited] |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
Returns NULL on error.
This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.
dequeueLru | ( | ) | [inherited] |
Removes the page from its SimpleLru.
string encodeToBamStream | ( | ) | [inherited] |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.
Returns empty string on failure.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
bool encodeToBamStream | ( | basic_stringchar | data, |
BamWriter | writer | ||
) | [inherited] |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
Returns true on success, false on failure.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
bool encodeToBamStream | ( | basic_stringchar | data | ) | [inherited] |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
Returns true on success, false on failure.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
enqueueLru | ( | SimpleLru | lru | ) | [inherited] |
Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added.
If lru is NULL, it means to remove this page from its LRU.
evictLru | ( | ) | [inherited] |
Evicts the page from the LRU.
Called internally when the LRU determines that it is full. May also be called externally when necessary to explicitly evict the page.
It is legal for this method to either evict the page as requested, do nothing (in which case the eviction will be requested again at the next epoch), or requeue itself on the tail of the queue (in which case the eviction will be requested again much later).
GeomVertexArrayFormat const getArrayFormat | ( | ) |
Returns the format object that describes this array.
UpdateSeq getBamModified | ( | ) | [inherited] |
Returns the current bam_modified counter.
This counter is normally incremented automatically whenever the object is modified.
static VertexDataBook getBook | ( | ) | [static] |
Returns the global VertexDataBook that will be used to allocate vertex data buffers.
int getCacheRefCount | ( | ) | [inherited] |
Returns the current reference count.
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from CopyOnWriteObject.
int getDataSizeBytes | ( | ) |
Returns the number of bytes stored in the array.
GeomVertexArrayDataHandle const getHandle | ( | Thread | current_thread | ) |
Returns an object that can be used to read the actual data bytes stored in the array.
Calling this method locks the data, and will block any other threads attempting to read or write the data, until the returned object destructs.
GeomVertexArrayDataHandle const getHandle | ( | ) |
Returns an object that can be used to read the actual data bytes stored in the array.
Calling this method locks the data, and will block any other threads attempting to read or write the data, until the returned object destructs.
static SimpleLru getIndependentLru | ( | ) | [static] |
Returns a pointer to the global LRU object that manages the GeomVertexArrayData's that have not (yet) been paged out.
SimpleLru getLru | ( | ) | [inherited] |
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU.
unsigned int getLruSize | ( | ) | [inherited] |
Returns the size of this page as reported to the LRU, presumably in bytes.
UpdateSeq getModified | ( | ) |
Returns a sequence number which is guaranteed to change at least every time the array vertex data is modified.
int getNumRows | ( | ) |
Returns the number of rows stored in the array, based on the number of bytes and the stride.
This should be the same for all arrays within a given GeomVertexData object.
int getRefCount | ( | ) | [inherited] |
Returns the current reference count.
static SimpleLru getSmallLru | ( | ) | [static] |
Returns a pointer to the global LRU object that manages the GeomVertexArrayData's that are deemed too small to be paged out.
TypeHandle getType | ( | ) | [inherited] |
Reimplemented in AnimChannelBase.
int getTypeIndex | ( | ) | [inherited] |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
This is equivalent to get_type().get_index().
UsageHint getUsageHint | ( | ) |
Returns the usage hint that describes to the rendering backend how often the vertex data will be modified and/or rendered.
See geomEnums.h.
bool hasColumn | ( | InternalName const | name | ) |
Returns true if the array has the named column, false otherwise.
This is really just a shortcut for asking the same thing from the format.
bool isExactType | ( | TypeHandle | handle | ) | [inherited] |
Returns true if the current object is the indicated type exactly.
bool isOfType | ( | TypeHandle | handle | ) | [inherited] |
Returns true if the current object is or derives from the indicated type.
bool isPrepared | ( | PreparedGraphicsObjects | prepared_objects | ) |
Returns true if the data has already been prepared or enqueued for preparation on the indicated GSG, false otherwise.
static lruEpoch | ( | ) | [static] |
Marks that an epoch has passed in each LRU.
Asks the LRU's to consider whether they should perform evictions.
markBamModified | ( | ) | [inherited] |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
This should normally not need to be called by user code; it should be called internally when the object has been changed in a way that legitimately requires its retransmission to any connected clients.
markUsedLru | ( | SimpleLru | lru | ) | [inherited] |
To be called when the page is used; this will move it to the tail of the specified SimpleLru queue.
markUsedLru | ( | ) | [inherited] |
To be called when the page is used; this will move it to the tail of the SimpleLru queue it is already on.
This method is const because it's not technically modifying the contents of the page itself.
GeomVertexArrayDataHandle modifyHandle | ( | ) |
Returns an object that can be used to read or write the actual data bytes stored in the array.
Calling this method locks the data, and will block any other threads attempting to read or write the data, until the returned object destructs.
GeomVertexArrayDataHandle modifyHandle | ( | Thread | current_thread | ) |
Returns an object that can be used to read or write the actual data bytes stored in the array.
Calling this method locks the data, and will block any other threads attempting to read or write the data, until the returned object destructs.
operator new | ( | unsigned int | size | ) |
GeomVertexArrayData operator= | ( | GeomVertexArrayData const | copy | ) |
The copy assignment operator is not pipeline-safe.
This will completely obliterate all stages of the pipeline, so don't do it for a GeomVertexArrayData that is actively being used for rendering.
output | ( | ostream | out | ) |
Reimplemented from SimpleLruPage.
prepare | ( | PreparedGraphicsObjects | prepared_objects | ) |
Indicates that the data should be enqueued to be prepared in the indicated prepared_objects at the beginning of the next frame.
This will ensure the data is already loaded into the GSG if it is expected to be rendered soon.
Use this function instead of prepare_now() to preload datas from a user interface standpoint.
VertexBufferContext prepareNow | ( | PreparedGraphicsObjects | prepared_objects, |
GraphicsStateGuardianBase | gsg | ||
) |
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.
PyObject reduce | ( | PyObject | self | ) | [inherited] |
This special Python method is implement to provide support for the pickle module.
This hooks into the native pickle and cPickle modules, but it cannot properly handle self-referential BAM objects.
PyObject reducePersist | ( | PyObject | self, |
PyObject | pickler | ||
) | [inherited] |
This special Python method is implement to provide support for the pickle module.
This is similar to __reduce__, but it provides additional support for the missing persistent-state object needed to properly support self-referential BAM objects written to the pickle stream. This hooks into the pickle and cPickle modules implemented in direct/src/stdpy.
ref | ( | ) | [inherited] |
Explicitly increments the reference count.
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
bool release | ( | PreparedGraphicsObjects | prepared_objects | ) |
Frees the data context only on the indicated object, if it exists there.
Returns true if it was released, false if it had not been prepared.
int releaseAll | ( | ) |
Frees the context allocated on all objects for which the data has been declared.
Returns the number of contexts which have been freed.
bool requestResident | ( | ) |
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.
setLruSize | ( | unsigned int | lru_size | ) | [inherited] |
Specifies the size of this page, presumably in bytes, although any unit is possible.
bool setNumRows | ( | int | n | ) |
Sets the length of the array to n rows.
Normally, you would not call this directly, since all of the arrays in a particular GeomVertexData must have the same number of rows; instead, call GeomVertexData.set_num_rows().
The return value is true if the number of rows was changed, false if the object already contained n rows (or if there was some error).
The new vertex data is initialized to 0, including the "color" column (but see GeomVertexData.set_num_rows()).
Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.
setUsageHint | ( | UsageHint | usage_hint | ) |
Changes the UsageHint hint for this array.
See get_usage_hint().
Don't call this in a downstream thread unless you don't mind it blowing away other changes you might have recently made in an upstream thread.
bool testRefCountIntegrity | ( | ) | [inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Reimplemented from ReferenceCount.
Reimplemented in NodeCachedReferenceCount.
bool testRefCountNonzero | ( | ) | [inherited] |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
Returns true if ok, false otherwise.
bool uncleanSetNumRows | ( | int | n | ) |
This method behaves like set_num_rows(), except the new data is not initialized.
Furthermore, after this call, *any* of the data in the GeomVertexArrayData may be uninitialized, including the earlier rows.
Normally, you would not call this directly, since all of the arrays in a particular GeomVertexData must have the same number of rows; instead, call GeomVertexData.unclean_set_num_rows().
bool unref | ( | ) | [inherited] |
Explicitly decrements the reference count.
Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
The return value is true if the new reference count is nonzero, false if it is zero.
Reimplemented in GeomVertexArrayFormat, and GeomVertexFormat.
Reimplemented from SimpleLruPage.
write | ( | ostream | out | ) |