Panda3D
Public Types | Public Member Functions

GeomVertexReader Class Reference

This object provides a high-level interface for quickly reading a sequence of numeric values from a vertex table. More...

Inheritance diagram for GeomVertexReader:
GeomEnums GeomVertexRewriter

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

 GeomVertexReader (GeomVertexArrayData const array_data, Thread current_thread)
 Constructs a new reader to process the vertices of the indicated array only.
 GeomVertexReader (GeomVertexArrayData const array_data)
 Constructs a new reader to process the vertices of the indicated array only.
 GeomVertexReader (GeomVertexArrayData const array_data, int column)
 Constructs a new reader to process the vertices of the indicated array only.
 GeomVertexReader (GeomVertexData const vertex_data)
 Constructs a new reader to process the vertices of the indicated data object.
 GeomVertexReader (GeomVertexData const vertex_data, string name, Thread current_thread)
 Constructs a new reader to process the vertices of the indicated data object.
 GeomVertexReader (GeomVertexData const vertex_data, InternalName const name, Thread current_thread)
 Constructs a new reader to process the vertices of the indicated data object.
 GeomVertexReader (GeomVertexData const vertex_data, string name)
 Constructs a new reader to process the vertices of the indicated data object.
 GeomVertexReader (GeomVertexReader const copy)
 GeomVertexReader (GeomVertexArrayData const array_data, int column, Thread current_thread)
 Constructs a new reader to process the vertices of the indicated array only.
 GeomVertexReader (GeomVertexData const vertex_data, InternalName const name)
 Constructs a new reader to process the vertices of the indicated data object.
 GeomVertexReader (Thread current_thread)
 Constructs an invalid GeomVertexReader.
 GeomVertexReader ()
 Constructs an invalid GeomVertexReader.
 GeomVertexReader (GeomVertexData const vertex_data, Thread current_thread)
 Constructs a new reader to process the vertices of the indicated data object.
 clear ()
 Resets the GeomVertexReader to the initial state.
int getArray ()
 Returns the array index containing the data type that the reader is working on.
GeomVertexArrayData const getArrayData ()
 Returns the particular array object that the reader is currently processing.
GeomVertexColumn const getColumn ()
 Returns the description of the data type that the reader is working on.
Thread getCurrentThread ()
 Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this object.
float getData1f ()
 Returns the data associated with the read row, expressed as a 1-component value, and advances the read row.
int getData1i ()
 Returns the data associated with the read row, expressed as a 1-component value, and advances the read row.
VBase2 const getData2f ()
 Returns the data associated with the read row, expressed as a 2-component value, and advances the read row.
 getData2i ()
 Returns the data associated with the read row, expressed as a 2-component value, and advances the read row.
VBase3 const getData3f ()
 Returns the data associated with the read row, expressed as a 3-component value, and advances the read row.
 getData3i ()
 Returns the data associated with the read row, expressed as a 3-component value, and advances the read row.
VBase4 const getData4f ()
 Returns the data associated with the read row, expressed as a 4-component value, and advances the read row.
 getData4i ()
 Returns the data associated with the read row, expressed as a 4-component value, and advances the read row.
bool getForce ()
 Returns the value of the force flag.
int getReadRow ()
 Returns the row index from which the data will be retrieved by the next call to get_data*().
int getStartRow ()
 Returns the row index at which the reader started.
GeomVertexData const getVertexData ()
 Returns the vertex data object that the reader is processing.
bool hasColumn ()
 Returns true if a valid data type has been successfully set, or false if the data type does not exist (or if get_force() is false and the vertex data is nonresident).
bool isAtEnd ()
 Returns true if the reader is currently at the end of the list of vertices, false otherwise.
GeomVertexReader operator= (GeomVertexReader const copy)
 output (ostream out)
bool setColumn (string name)
 Sets up the reader to use the data type with the indicated name.
bool setColumn (InternalName const name)
 Sets up the reader to use the data type with the indicated name.
bool setColumn (int array, GeomVertexColumn const column)
 Sets up the reader to use the indicated column description on the given array.
bool setColumn (int column)
 Sets up the reader to use the nth data type of the GeomVertexFormat, numbering from 0.
 setForce (bool force)
 Sets the value of the force flag.
 setRow (int row)
 Sets the start row to the indicated value.

Detailed Description

This object provides a high-level interface for quickly reading a sequence of numeric values from a vertex table.

It is particularly optimized for reading a single column of data values for a series of vertices, without changing columns between each number. Although you can also use one GeomVertexReader to read across the columns if it is convenient, by calling set_column() repeatedly at each vertex, it is faster to read down the columns, and to use a different GeomVertexReader for each column.

Note that a GeomVertexReader does not keep a reference count to the actual vertex data buffer (it grabs the current data buffer from the GeomVertexData whenever set_column() is called). This means that it is important not to keep a GeomVertexReader object around over a long period of time in which the data buffer is likely to be deallocated; it is intended for making a quick pass over the data in one session.

It also means that you should create any GeomVertexWriters *before* creating GeomVertexReaders on the same data, since the writer itself might cause the vertex buffer to be deallocated. Better yet, use a GeomVertexRewriter if you are going to create both of them anyway.


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

GeomVertexReader ( GeomVertexArrayData const  array_data,
Thread  current_thread 
)

Constructs a new reader to process the vertices of the indicated array only.

GeomVertexReader ( GeomVertexArrayData const  array_data)

Constructs a new reader to process the vertices of the indicated array only.

GeomVertexReader ( GeomVertexArrayData const  array_data,
int  column,
Thread  current_thread 
)

Constructs a new reader to process the vertices of the indicated array only.

GeomVertexReader ( GeomVertexArrayData const  array_data,
int  column 
)

Constructs a new reader to process the vertices of the indicated array only.

GeomVertexReader ( GeomVertexData const  vertex_data,
InternalName const  name,
Thread  current_thread 
)

Constructs a new reader to process the vertices of the indicated data object.

This flavor creates the reader specifically to process the named data type.

GeomVertexReader ( GeomVertexData const  vertex_data,
InternalName const  name 
)

Constructs a new reader to process the vertices of the indicated data object.

This flavor creates the reader specifically to process the named data type.

GeomVertexReader ( GeomVertexData const  vertex_data,
Thread  current_thread 
)

Constructs a new reader to process the vertices of the indicated data object.

GeomVertexReader ( GeomVertexData const  vertex_data)

Constructs a new reader to process the vertices of the indicated data object.

GeomVertexReader ( GeomVertexData const  vertex_data,
string  name,
Thread  current_thread 
)

Constructs a new reader to process the vertices of the indicated data object.

This flavor creates the reader specifically to process the named data type.

GeomVertexReader ( GeomVertexData const  vertex_data,
string  name 
)

Constructs a new reader to process the vertices of the indicated data object.

This flavor creates the reader specifically to process the named data type.

GeomVertexReader ( Thread  current_thread)

Constructs an invalid GeomVertexReader.

You must use the assignment operator to assign a valid GeomVertexReader to this object before you can use it.

Constructs an invalid GeomVertexReader.

You must use the assignment operator to assign a valid GeomVertexReader to this object before you can use it.


Member Function Documentation

clear ( )

Resets the GeomVertexReader to the initial state.

Reimplemented in GeomVertexRewriter.

int getArray ( )

Returns the array index containing the data type that the reader is working on.

Reimplemented in GeomVertexRewriter.

GeomVertexArrayData const getArrayData ( )

Returns the particular array object that the reader is currently processing.

Reimplemented in GeomVertexRewriter.

GeomVertexColumn const getColumn ( )

Returns the description of the data type that the reader is working on.

Reimplemented in GeomVertexRewriter.

Thread getCurrentThread ( )

Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this object.

float getData1f ( )

Returns the data associated with the read row, expressed as a 1-component value, and advances the read row.

int getData1i ( )

Returns the data associated with the read row, expressed as a 1-component value, and advances the read row.

VBase2 const getData2f ( )

Returns the data associated with the read row, expressed as a 2-component value, and advances the read row.

getData2i ( )

Returns the data associated with the read row, expressed as a 2-component value, and advances the read row.

VBase3 const getData3f ( )

Returns the data associated with the read row, expressed as a 3-component value, and advances the read row.

getData3i ( )

Returns the data associated with the read row, expressed as a 3-component value, and advances the read row.

VBase4 const getData4f ( )

Returns the data associated with the read row, expressed as a 4-component value, and advances the read row.

getData4i ( )

Returns the data associated with the read row, expressed as a 4-component value, and advances the read row.

bool getForce ( )

Returns the value of the force flag.

See set_force().

int getReadRow ( )

Returns the row index from which the data will be retrieved by the next call to get_data*().

int getStartRow ( )

Returns the row index at which the reader started.

It will return to this row if you reset the current column.

Reimplemented in GeomVertexRewriter.

GeomVertexData const getVertexData ( )

Returns the vertex data object that the reader is processing.

This may return NULL if the reader was constructed with just an array pointer.

Reimplemented in GeomVertexRewriter.

bool hasColumn ( )

Returns true if a valid data type has been successfully set, or false if the data type does not exist (or if get_force() is false and the vertex data is nonresident).

Reimplemented in GeomVertexRewriter.

bool isAtEnd ( )

Returns true if the reader is currently at the end of the list of vertices, false otherwise.

If this is true, another call to get_data*() will result in a crash.

Reimplemented in GeomVertexRewriter.

GeomVertexReader operator= ( GeomVertexReader const  copy)
output ( ostream  out)

Reimplemented in GeomVertexRewriter.

bool setColumn ( InternalName const  name)

Sets up the reader to use the data type with the indicated name.

This also resets the read row number to the start row (the same value passed to a previous call to set_row(), or 0 if set_row() was never called.)

The return value is true if the data type is valid, false otherwise.

Reimplemented in GeomVertexRewriter.

bool setColumn ( int  column)

Sets up the reader to use the nth data type of the GeomVertexFormat, numbering from 0.

This also resets the read row number to the start row (the same value passed to a previous call to set_row(), or 0 if set_row() was never called.)

The return value is true if the data type is valid, false otherwise.

Reimplemented in GeomVertexRewriter.

bool setColumn ( int  array,
GeomVertexColumn const  column 
)

Sets up the reader to use the indicated column description on the given array.

This also resets the current read row number to the start row (the same value passed to a previous call to set_row(), or 0 if set_row() was never called.)

The return value is true if the data type is valid, false otherwise.

Reimplemented in GeomVertexRewriter.

bool setColumn ( string  name)

Sets up the reader to use the data type with the indicated name.

This also resets the read row number to the start row (the same value passed to a previous call to set_row(), or 0 if set_row() was never called.)

The return value is true if the data type is valid, false otherwise.

Reimplemented in GeomVertexRewriter.

setForce ( bool  force)

Sets the value of the force flag.

When this is true (the default), vertex data will be paged in from disk if necessary. When this is false, the GeomVertexData will simply return a failure code when attempting to read vertex data that is not resident (but will put it on the queue to become resident later).

Normally, vertex data is always resident, so this will not be an issue. It is only possible for vertex data to be nonresident if you have enabled vertex paging via the GeomVertexArrayData and VertexDataPage interfaces.

setRow ( int  row)

Sets the start row to the indicated value.

The reader will begin reading from the indicated row; each subsequent get_data*() call will return the data from the subsequent row. If set_column() is called, the reader will return to this row.

Reimplemented in GeomVertexRewriter.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties