Panda3D
Public Types | Public Member Functions

GeomVertexRewriter Class Reference

This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter, combined together into one convenient package. More...

Inheritance diagram for GeomVertexRewriter:
GeomVertexWriter GeomVertexReader GeomEnums GeomEnums

List of all members.

Public Types

enum  AnimationType { ATNone = 0, ATPanda = 1, ATHardware = 2 }
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  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  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  NumericType {
  NTUint8 = 0, NTUint16 = 1, NTUint32 = 2, NTPackedDcba = 3,
  NTPackedDabc = 4, NTFloat32 = 5
}
enum  PrimitiveType { PTNone = 0, PTPolygons = 1, PTLines = 2, PTPoints = 3 }
enum  PrimitiveType { PTNone = 0, PTPolygons = 1, PTLines = 2, PTPoints = 3 }
enum  ShadeModel { SMUniform = 0, SMSmooth = 1, SMFlatFirstVertex = 2, SMFlatLastVertex = 3 }
enum  ShadeModel { SMUniform = 0, SMSmooth = 1, SMFlatFirstVertex = 2, SMFlatLastVertex = 3 }
enum  UsageHint {
  UHClient = 0, UHStream = 1, UHDynamic = 2, UHStatic = 3,
  UHUnspecified = 4
}
enum  UsageHint {
  UHClient = 0, UHStream = 1, UHDynamic = 2, UHStatic = 3,
  UHUnspecified = 4
}

Public Member Functions

 GeomVertexRewriter (GeomVertexArrayData array_data, Thread current_thread)
 Constructs a new rewriter to process the vertices of the indicated array only.
 GeomVertexRewriter (GeomVertexArrayData array_data)
 Constructs a new rewriter to process the vertices of the indicated array only.
 GeomVertexRewriter (GeomVertexArrayData array_data, int column)
 Constructs a new rewriter to process the vertices of the indicated array only.
 GeomVertexRewriter (GeomVertexData vertex_data)
 Constructs a new rewriter to process the vertices of the indicated data object.
 GeomVertexRewriter (GeomVertexData vertex_data, string name, Thread current_thread)
 Constructs a new rewriter to process the vertices of the indicated data object.
 GeomVertexRewriter (GeomVertexData vertex_data, InternalName const name, Thread current_thread)
 Constructs a new rewriter to process the vertices of the indicated data object.
 GeomVertexRewriter (GeomVertexData vertex_data, string name)
 Constructs a new rewriter to process the vertices of the indicated data object.
 GeomVertexRewriter (GeomVertexRewriter const copy)
 GeomVertexRewriter (GeomVertexArrayData array_data, int column, Thread current_thread)
 Constructs a new rewriter to process the vertices of the indicated array only.
 GeomVertexRewriter (GeomVertexData vertex_data, InternalName const name)
 Constructs a new rewriter to process the vertices of the indicated data object.
 GeomVertexRewriter (Thread current_thread)
 Constructs an invalid GeomVertexRewriter.
 GeomVertexRewriter ()
 Constructs an invalid GeomVertexRewriter.
 GeomVertexRewriter (GeomVertexData vertex_data, Thread current_thread)
 Constructs a new rewriter to process the vertices of the indicated data object.
 addData1f (float data)
 Sets the write row to a particular 1-component value, and advances the write row.
 addData1i (int data)
 Sets the write row to a particular 1-component value, and advances the write row.
 addData2f (VBase2 const data)
 Sets the write row to a particular 2-component value, and advances the write row.
 addData2f (float x, float y)
 Sets the write row to a particular 2-component value, and advances the write row.
 addData2i (int a, int b)
 Sets the write row to a particular 2-component value, and advances the write row.
 addData3f (VBase3 const data)
 Sets the write row to a particular 3-component value, and advances the write row.
 addData3f (float x, float y, float z)
 Sets the write row to a particular 3-component value, and advances the write row.
 addData3i (int a, int b, int c)
 Sets the write row to a particular 3-component value, and advances the write row.
 addData4f (VBase4 const data)
 Sets the write row to a particular 4-component value, and advances the write row.
 addData4f (float x, float y, float z, float w)
 Sets the write row to a particular 4-component value, and advances the write row.
 addData4i (int a, int b, int c, int d)
 Sets the write row to a particular 4-component value, and advances the write row.
 clear ()
 Resets the GeomVertexRewriter to the initial state.
int getArray ()
 Returns the array index containing the data type that the rewriter is working on.
GeomVertexArrayData getArrayData ()
 Returns the particular array object that the rewriter is currently processing.
GeomVertexColumn const getColumn ()
 Returns the description of the data type that the rewriter is working on.
Thread getCurrentThread ()
 Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this object.
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 rewriter started.
GeomVertexData getVertexData ()
 Returns the vertex data object that the rewriter is processing.
int getWriteRow ()
 Returns the row index to which the data will be written at the next call to set_data*() or add_data*().
bool hasColumn ()
 Returns true if a valid data type has been successfully set, or false if the data type does not exist.
bool isAtEnd ()
 Returns true if the reader or writer is currently at the end of the list of vertices, false otherwise.
GeomVertexRewriter operator= (GeomVertexRewriter const copy)
 output (ostream out)
bool setColumn (InternalName const name)
 Sets up the rewriter to use the data type with the indicated name.
bool setColumn (string name)
 Sets up the rewriter to use the data type with the indicated name.
bool setColumn (int column)
 Sets up the rewriter to use the nth data type of the GeomVertexFormat, numbering from 0.
bool setColumn (int array, GeomVertexColumn const column)
 Sets up the rewriter to use the indicated column description on the given array.
 setData1f (float data)
 Sets the write row to a particular 1-component value, and advances the write row.
 setData1i (int data)
 Sets the write row to a particular 1-component value, and advances the write row.
 setData2f (VBase2 const data)
 Sets the write row to a particular 2-component value, and advances the write row.
 setData2f (float x, float y)
 Sets the write row to a particular 2-component value, and advances the write row.
 setData2i (int a, int b)
 Sets the write row to a particular 2-component value, and advances the write row.
 setData3f (VBase3 const data)
 Sets the write row to a particular 3-component value, and advances the write row.
 setData3f (float x, float y, float z)
 Sets the write row to a particular 3-component value, and advances the write row.
 setData3i (int a, int b, int c)
 Sets the write row to a particular 3-component value, and advances the write row.
 setData4f (VBase4 const data)
 Sets the write row to a particular 4-component value, and advances the write row.
 setData4f (float x, float y, float z, float w)
 Sets the write row to a particular 4-component value, and advances the write row.
 setData4i (int a, int b, int c, int d)
 Sets the write row to a particular 4-component value, and advances the write row.
 setForce (bool force)
 Sets the value of the force flag.
 setRow (int row)
 Sets the start, write, and write index to the indicated value.

Detailed Description

This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter, combined together into one convenient package.

It is designed for making a single pass over a GeomVertexData object, modifying rows as it goes.

Although it doesn't provide any real performance benefit over using a separate reader and writer on the same data, it should probably be used in preference to a separate reader and writer, because it makes an effort to manage the reference counts properly between the reader and the writer to avoid accidentally dereferencing either array while recopying.


Member Enumeration Documentation

enum AnimationType [inherited]
Enumerator:
ATNone 
ATPanda 
ATHardware 
enum AnimationType [inherited]
Enumerator:
ATNone 
ATPanda 
ATHardware 
enum Contents [inherited]
Enumerator:
COther 
CPoint 
CClipPoint 
CVector 
CTexcoord 
CColor 
CIndex 
CMorphDelta 
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 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 NumericType [inherited]
Enumerator:
NTUint8 
NTUint16 
NTUint32 
NTPackedDcba 
NTPackedDabc 
NTFloat32 
enum PrimitiveType [inherited]
Enumerator:
PTNone 
PTPolygons 
PTLines 
PTPoints 
enum PrimitiveType [inherited]
Enumerator:
PTNone 
PTPolygons 
PTLines 
PTPoints 
enum ShadeModel [inherited]
Enumerator:
SMUniform 
SMSmooth 
SMFlatFirstVertex 
SMFlatLastVertex 
enum ShadeModel [inherited]
Enumerator:
SMUniform 
SMSmooth 
SMFlatFirstVertex 
SMFlatLastVertex 
enum UsageHint [inherited]
Enumerator:
UHClient 
UHStream 
UHDynamic 
UHStatic 
UHUnspecified 
enum UsageHint [inherited]
Enumerator:
UHClient 
UHStream 
UHDynamic 
UHStatic 
UHUnspecified 

Constructor & Destructor Documentation

GeomVertexRewriter ( GeomVertexArrayData  array_data,
Thread  current_thread 
)

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

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

GeomVertexRewriter ( GeomVertexArrayData  array_data,
int  column,
Thread  current_thread 
)

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

GeomVertexRewriter ( GeomVertexArrayData  array_data,
int  column 
)

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

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

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

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

GeomVertexRewriter ( GeomVertexData  vertex_data,
InternalName const  name 
)

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

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

GeomVertexRewriter ( GeomVertexData  vertex_data,
Thread  current_thread 
)

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

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

GeomVertexRewriter ( GeomVertexData  vertex_data,
string  name,
Thread  current_thread 
)

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

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

GeomVertexRewriter ( GeomVertexData  vertex_data,
string  name 
)

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

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

GeomVertexRewriter ( Thread  current_thread)

Constructs an invalid GeomVertexRewriter.

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

Constructs an invalid GeomVertexRewriter.

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


Member Function Documentation

addData1f ( float  data) [inherited]

Sets the write row to a particular 1-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData1i ( int  data) [inherited]

Sets the write row to a particular 1-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData2f ( VBase2 const  data) [inherited]

Sets the write row to a particular 2-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData2f ( float  x,
float  y 
) [inherited]

Sets the write row to a particular 2-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData2i ( int  a,
int  b 
) [inherited]

Sets the write row to a particular 2-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData3f ( VBase3 const  data) [inherited]

Sets the write row to a particular 3-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData3f ( float  x,
float  y,
float  z 
) [inherited]

Sets the write row to a particular 3-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData3i ( int  a,
int  b,
int  c 
) [inherited]

Sets the write row to a particular 3-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData4f ( VBase4 const  data) [inherited]

Sets the write row to a particular 4-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData4f ( float  x,
float  y,
float  z,
float  w 
) [inherited]

Sets the write row to a particular 4-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

addData4i ( int  a,
int  b,
int  c,
int  d 
) [inherited]

Sets the write row to a particular 4-component value, and advances the write row.

If the write row advances past the end of data, implicitly adds a new row to the data.

clear ( )

Resets the GeomVertexRewriter to the initial state.

Reimplemented from GeomVertexReader.

int getArray ( )

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

Reimplemented from GeomVertexReader.

GeomVertexArrayData getArrayData ( )

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

Reimplemented from GeomVertexReader.

GeomVertexColumn const getColumn ( )

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

Reimplemented from GeomVertexReader.

Thread getCurrentThread ( ) [inherited]

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

Thread getCurrentThread ( ) [inherited]

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

float getData1f ( ) [inherited]

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

int getData1i ( ) [inherited]

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

VBase2 const getData2f ( ) [inherited]

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

getData2i ( ) [inherited]

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

VBase3 const getData3f ( ) [inherited]

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

getData3i ( ) [inherited]

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

VBase4 const getData4f ( ) [inherited]

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

getData4i ( ) [inherited]

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

bool getForce ( ) [inherited]

Returns the value of the force flag.

See set_force().

int getReadRow ( ) [inherited]

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 rewriter started.

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

Reimplemented from GeomVertexReader.

GeomVertexData getVertexData ( )

Returns the vertex data object that the rewriter is processing.

Reimplemented from GeomVertexReader.

int getWriteRow ( ) [inherited]

Returns the row index to which the data will be written at the next call to set_data*() or add_data*().

bool hasColumn ( )

Returns true if a valid data type has been successfully set, or false if the data type does not exist.

Reimplemented from GeomVertexReader.

bool isAtEnd ( )

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

Reimplemented from GeomVertexReader.

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

Reimplemented from GeomVertexReader.

bool setColumn ( string  name)

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

This also resets both the read and write row numbers 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 from GeomVertexReader.

bool setColumn ( InternalName const  name)

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

This also resets both the read and write row numbers 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 from GeomVertexReader.

bool setColumn ( int  column)

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

This also resets both the read and write row numbers 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 from GeomVertexReader.

bool setColumn ( int  array,
GeomVertexColumn const  column 
)

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

This also resets both the read and write row numbers 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 from GeomVertexReader.

setData1f ( float  data) [inherited]

Sets the write row to a particular 1-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData1i ( int  data) [inherited]

Sets the write row to a particular 1-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData2f ( VBase2 const  data) [inherited]

Sets the write row to a particular 2-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData2f ( float  x,
float  y 
) [inherited]

Sets the write row to a particular 2-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData2i ( int  a,
int  b 
) [inherited]

Sets the write row to a particular 2-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData3f ( float  x,
float  y,
float  z 
) [inherited]

Sets the write row to a particular 3-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData3f ( VBase3 const  data) [inherited]

Sets the write row to a particular 3-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData3i ( int  a,
int  b,
int  c 
) [inherited]

Sets the write row to a particular 3-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData4f ( float  x,
float  y,
float  z,
float  w 
) [inherited]

Sets the write row to a particular 4-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData4f ( VBase4 const  data) [inherited]

Sets the write row to a particular 4-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setData4i ( int  a,
int  b,
int  c,
int  d 
) [inherited]

Sets the write row to a particular 4-component value, and advances the write row.

It is an error for the write row to advance past the end of data.

setForce ( bool  force) [inherited]

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, write, and write index to the indicated value.

The rewriter will begin traversing from the given row.

Reimplemented from GeomVertexReader.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties