Panda3D
Public Types | Public Member Functions | Static Public Member Functions

GeomVertexArrayFormat Class Reference

This describes the structure of a single array within a Geom data. More...

Inheritance diagram for GeomVertexArrayFormat:
TypedWritableReferenceCount GeomEnums TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

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

 GeomVertexArrayFormat ()
 GeomVertexArrayFormat (GeomVertexArrayFormat const copy)
 GeomVertexArrayFormat (InternalName name0, int num_components0, NumericType numeric_type0, Contents contents0, InternalName name1, int num_components1, NumericType numeric_type1, Contents contents1)
 GeomVertexArrayFormat (InternalName name0, int num_components0, NumericType numeric_type0, Contents contents0, InternalName name1, int num_components1, NumericType numeric_type1, Contents contents1, InternalName name2, int num_components2, NumericType numeric_type2, Contents contents2)
 GeomVertexArrayFormat (InternalName name0, int num_components0, NumericType numeric_type0, Contents contents0)
 GeomVertexArrayFormat (InternalName name0, int num_components0, NumericType numeric_type0, Contents contents0, InternalName name1, int num_components1, NumericType numeric_type1, Contents contents1, InternalName name2, int num_components2, NumericType numeric_type2, Contents contents2, InternalName name3, int num_components3, NumericType numeric_type3, Contents contents3)
int addColumn (InternalName name, int num_components, NumericType numeric_type, Contents contents)
 Adds a new column to the specification.
int addColumn (GeomVertexColumn const column)
 Adds a new column to the specification.
int addColumn (InternalName name, int num_components, NumericType numeric_type, Contents contents, int start)
 Adds a new column to the specification.
 clearColumns ()
 Removes all columns previously added, sets the stride to zero, and prepares to start over.
int countUnusedSpace ()
 Returns the number of bytes per row that are not assigned to any column.
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.
UpdateSeq getBamModified ()
 Returns the current bam_modified counter.
GeomVertexColumn const getColumn (InternalName const name)
 Returns the specification with the indicated name, or NULL if the name is not used.
GeomVertexColumn const getColumn (int i)
 Returns the ith column of the array.
GeomVertexColumn const getColumn (int start_byte, int num_bytes)
 Returns the first specification that overlaps with any of the indicated bytes in the range, or NULL if none do.
list getColumns ()
int getNumColumns ()
 Returns the number of different columns in the array.
int getPadTo ()
 Returns the byte divisor to which the data record must be padded to meet hardware limitations.
int getRefCount ()
 Returns the current reference count.
int getStride ()
 Returns the total number of bytes reserved in the array for each vertex.
int getTotalBytes ()
 Returns the total number of bytes used by the data types within the format, including gaps between elements.
TypeHandle getType ()
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
bool hasColumn (InternalName const name)
 Returns true if the array has the named column, false otherwise.
bool isDataSubsetOf (GeomVertexArrayFormat const other)
 Returns true if all of the fields in this array format are also present and equivalent in the other array format, and in the same byte positions, and the stride is the same.
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 isRegistered ()
 Returns true if this format has been registered, false if it has not.
 markBamModified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
GeomVertexArrayFormat operator= (GeomVertexArrayFormat const copy)
 output (ostream out)
 packColumns ()
 Removes wasted space between columns.
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.
 removeColumn (InternalName const name)
 Removes the column with the indicated name, if any.
 setStride (int stride)
 Changes the total number of bytes reserved in the array for each vertex.
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 unref ()
 This method overrides ReferenceCount.unref() to unregister the object when its reference count goes to zero.
 write (ostream out, int indent_level)
 write (ostream out)
 writeWithData (ostream out, int indent_level, GeomVertexArrayData const array_data)

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 TypeHandle getClassType ()
static GeomVertexArrayFormat const registerFormat (GeomVertexArrayFormat const format)
 Adds the indicated format to the registry, if there is not an equivalent format already there; in either case, returns the pointer to the equivalent format now in the registry.

Detailed Description

This describes the structure of a single array within a Geom data.

See GeomVertexFormat for the parent class which collects together all of the individual GeomVertexArrayFormat objects.

A particular array may include any number of standard or user-defined columns. All columns consist of a sequence of one or more numeric values, packed in any of a variety of formats; the semantic meaning of each column is defined in general with its contents member, and in particular by its name. The standard array types used most often are named "vertex", "normal", "texcoord", and "color"; other kinds of data may be piggybacked into the data record simply by choosing a unique name.


Member Enumeration Documentation

enum AnimationType [inherited]
Enumerator:
ATNone 
ATPanda 
ATHardware 
enum Contents [inherited]
Enumerator:
COther 
CPoint 
CClipPoint 
CVector 
CTexcoord 
CColor 
CIndex 
CMorphDelta 
enum GeomRendering [inherited]
Enumerator:
GRIndexedPoint 
GRIndexedOther 
GRIndexedBits 
GRPoint 
GRPointUniformSize 
GRPerPointSize 
GRPointPerspective 
GRPointAspectRatio 
GRPointScale 
GRPointRotate 
GRPointSprite 
GRPointSpriteTexMatrix 
GRPointBits 
GRTriangleStrip 
GRTriangleFan 
GRLineStrip 
GRCompositeBits 
GRFlatFirstVertex 
GRFlatLastVertex 
GRShadeModelBits 
GRTexcoordLightVector 
enum NumericType [inherited]
Enumerator:
NTUint8 
NTUint16 
NTUint32 
NTPackedDcba 
NTPackedDabc 
NTFloat32 
enum PrimitiveType [inherited]
Enumerator:
PTNone 
PTPolygons 
PTLines 
PTPoints 
enum ShadeModel [inherited]
Enumerator:
SMUniform 
SMSmooth 
SMFlatFirstVertex 
SMFlatLastVertex 
enum UsageHint [inherited]
Enumerator:
UHClient 
UHStream 
UHDynamic 
UHStatic 
UHUnspecified 

Constructor & Destructor Documentation

GeomVertexArrayFormat ( InternalName  name0,
int  num_components0,
NumericType  numeric_type0,
Contents  contents0 
)
GeomVertexArrayFormat ( InternalName  name0,
int  num_components0,
NumericType  numeric_type0,
Contents  contents0,
InternalName  name1,
int  num_components1,
NumericType  numeric_type1,
Contents  contents1 
)
GeomVertexArrayFormat ( InternalName  name0,
int  num_components0,
NumericType  numeric_type0,
Contents  contents0,
InternalName  name1,
int  num_components1,
NumericType  numeric_type1,
Contents  contents1,
InternalName  name2,
int  num_components2,
NumericType  numeric_type2,
Contents  contents2 
)
GeomVertexArrayFormat ( InternalName  name0,
int  num_components0,
NumericType  numeric_type0,
Contents  contents0,
InternalName  name1,
int  num_components1,
NumericType  numeric_type1,
Contents  contents1,
InternalName  name2,
int  num_components2,
NumericType  numeric_type2,
Contents  contents2,
InternalName  name3,
int  num_components3,
NumericType  numeric_type3,
Contents  contents3 
)

Member Function Documentation

int addColumn ( GeomVertexColumn const  column)

Adds a new column to the specification.

This is a table of per-vertex floating-point numbers such as "vertex" or "normal"; you must specify where in each record the table starts, and how many components (dimensions) exist per vertex.

Adding a column with the same name as a previous type, or that overlaps with one or more previous types, quietly removes the previous type(s).

The return value is the index number of the new data type.

int addColumn ( InternalName  name,
int  num_components,
NumericType  numeric_type,
Contents  contents,
int  start 
)

Adds a new column to the specification.

This is a table of per-vertex floating-point numbers such as "vertex" or "normal"; you must specify where in each record the table starts, and how many components (dimensions) exist per vertex.

The return value is the index number of the new data type.

int addColumn ( InternalName  name,
int  num_components,
NumericType  numeric_type,
Contents  contents 
)

Adds a new column to the specification.

This is a table of per-vertex floating-point numbers such as "vertex" or "normal"; you must specify where in each record the table starts, and how many components (dimensions) exist per vertex.

The return value is the index number of the new data type.

clearColumns ( )

Removes all columns previously added, sets the stride to zero, and prepares to start over.

int countUnusedSpace ( )

Returns the number of bytes per row that are not assigned to any column.

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.

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.

UpdateSeq getBamModified ( ) [inherited]

Returns the current bam_modified counter.

This counter is normally incremented automatically whenever the object is modified.

static TypeHandle getClassType ( ) [static]

Reimplemented from TypedWritableReferenceCount.

GeomVertexColumn const getColumn ( InternalName const  name)

Returns the specification with the indicated name, or NULL if the name is not used.

GeomVertexColumn const getColumn ( int  i)

Returns the ith column of the array.

GeomVertexColumn const getColumn ( int  start_byte,
int  num_bytes 
)

Returns the first specification that overlaps with any of the indicated bytes in the range, or NULL if none do.

list getColumns ( )
int getNumColumns ( )

Returns the number of different columns in the array.

int getPadTo ( )

Returns the byte divisor to which the data record must be padded to meet hardware limitations.

For instance, if this is 4, the stride will be automatically rounded up to the next multiple of 4 bytes.

int getRefCount ( ) [inherited]

Returns the current reference count.

int getStride ( )

Returns the total number of bytes reserved in the array for each vertex.

int getTotalBytes ( )

Returns the total number of bytes used by the data types within the format, including gaps between elements.

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

bool hasColumn ( InternalName const  name)

Returns true if the array has the named column, false otherwise.

bool isDataSubsetOf ( GeomVertexArrayFormat const  other)

Returns true if all of the fields in this array format are also present and equivalent in the other array format, and in the same byte positions, and the stride is the same.

That is, true if this format can share the same data pointer as the other format (with possibly some unused gaps).

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 isRegistered ( )

Returns true if this format has been registered, false if it has not.

It may not be used for a Geom until it has been registered, but once registered, it may no longer be modified.

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.

GeomVertexArrayFormat operator= ( GeomVertexArrayFormat const  copy)
output ( ostream  out)
packColumns ( )

Removes wasted space between columns.

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.

static GeomVertexArrayFormat const registerFormat ( GeomVertexArrayFormat const  format) [static]

Adds the indicated format to the registry, if there is not an equivalent format already there; in either case, returns the pointer to the equivalent format now in the registry.

This is similar to GeomVertexFormat.register_format(), except that you generally need not call it explicitly. Calling GeomVertexFormat.register_format() automatically registers all of the nested array formats.

removeColumn ( InternalName const  name)

Removes the column with the indicated name, if any.

This leaves a gap in the byte structure.

setStride ( int  stride)

Changes the total number of bytes reserved in the array for each vertex.

bool testRefCountIntegrity ( ) [inherited]

Does some easy checks to make sure that the reference count isn't completely bogus.

Returns true if ok, false otherwise.

Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and 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 unref ( )

This method overrides ReferenceCount.unref() to unregister the object when its reference count goes to zero.

Reimplemented from ReferenceCount.

write ( ostream  out,
int  indent_level 
)
write ( ostream  out)
writeWithData ( ostream  out,
int  indent_level,
GeomVertexArrayData const  array_data 
)
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties