Support Forum       G3D Web Page     
Classes | Public Member Functions | Public Attributes | List of all members
G3D::CPUVertexArray Class Reference

Array of vertices with interlaced position, normal, texCoord, and tangent attributes. More...

Classes

class  Vertex
 Packed vertex attributes. More...
 

Public Member Functions

 CPUVertexArray ()
 
 CPUVertexArray (const CPUVertexArray &otherArray)
 
void clear ()
 
void copyFrom (const CPUVertexArray &other)
 
void copyTexCoord0ToTexCoord1 ()
 
void copyToGPU (AttributeArray &vertex, AttributeArray &normal, AttributeArray &packedTangent, AttributeArray &texCoord0, AttributeArray &texCoord1, AttributeArray &vertexColors, VertexBuffer::UsageHint hint=VertexBuffer::WRITE_ONCE) const
 
void copyToGPU (AttributeArray &vertex, AttributeArray &normal, AttributeArray &packedTangent, AttributeArray &texCoord0, AttributeArray &texCoord1, AttributeArray &vertexColors, AttributeArray &boneIndices, AttributeArray &boneWeights, VertexBuffer::UsageHint hint=VertexBuffer::WRITE_ONCE) const
 
bool hasPrevPosition () const
 True if prevPosition is nonempty. More...
 
bool hasTexCoord (int coord) const
 
void offsetAndScaleTexCoord1 (const Point2 &offset, const Point2 &scale)
 
int size () const
 
void transformAndAppend (const CPUVertexArray &otherArray, const CoordinateFrame &cframe)
 
void transformAndAppend (const CPUVertexArray &otherArray, const CoordinateFrame &cframe, const CoordinateFrame &prevCFrame)
 Transform otherArray.vertex.position by cframe and append to vertex.position. More...
 

Public Attributes

Array< Vector4int32boneIndices
 4 indices indicating the bones that affect animation for the vertex More...
 
Array< Vector4boneWeights
 4 floats indicating the weighting for the 4 bones that affect animation for the vertex More...
 
bool hasBones
 True if boneIndices and boneWeights contain valid data. More...
 
bool hasTangent
 True if tangent contains valid data. More...
 
bool hasTexCoord0
 True if texCoord0 contains valid data. More...
 
bool hasTexCoord1
 True if texCoord1 contains valid data. More...
 
bool hasVertexColors
 True if vertexColors contains valid data. More...
 
Array< Point3prevPosition
 The position of the vertex in the previous frame, in the same coordinate system as vertex.position. More...
 
Array< Point2unorm16texCoord1
 A second texture coordinate (which is not necessarily stored in texture coordinate attribute 1 on a GPU). More...
 
Array< Vertexvertex
 
Array< Color4vertexColors
 Vertex Colors. More...
 

Detailed Description

Array of vertices with interlaced position, normal, texCoord, and tangent attributes.

See also
G3D::Surface, G3D::UniversalSurface::CPUGeom, G3D::MeshAlg, G3D::Triangle, G3D::TriTree

Constructor & Destructor Documentation

◆ CPUVertexArray() [1/2]

G3D::CPUVertexArray::CPUVertexArray ( )
inline

◆ CPUVertexArray() [2/2]

G3D::CPUVertexArray::CPUVertexArray ( const CPUVertexArray otherArray)
explicit

Member Function Documentation

◆ clear()

void G3D::CPUVertexArray::clear ( )
inline

◆ copyFrom()

void G3D::CPUVertexArray::copyFrom ( const CPUVertexArray other)

◆ copyTexCoord0ToTexCoord1()

void G3D::CPUVertexArray::copyTexCoord0ToTexCoord1 ( )

◆ copyToGPU() [1/2]

void G3D::CPUVertexArray::copyToGPU ( AttributeArray vertex,
AttributeArray normal,
AttributeArray packedTangent,
AttributeArray texCoord0,
AttributeArray texCoord1,
AttributeArray vertexColors,
VertexBuffer::UsageHint  hint = VertexBuffer::WRITE_ONCE 
) const
Parameters
texCoord1This is not interleaved with the other data in GPU memory.
vertexColorsThis is not interleaved with the other data in GPU memory.

◆ copyToGPU() [2/2]

void G3D::CPUVertexArray::copyToGPU ( AttributeArray vertex,
AttributeArray normal,
AttributeArray packedTangent,
AttributeArray texCoord0,
AttributeArray texCoord1,
AttributeArray vertexColors,
AttributeArray boneIndices,
AttributeArray boneWeights,
VertexBuffer::UsageHint  hint = VertexBuffer::WRITE_ONCE 
) const
Parameters
texCoord1This is not interleaved with the other data in GPU memory.
boneIndices,boneWeightsThese are only interleaved with each other in GPU memory
vertexColorsThis is not interleaved with the other data in GPU memory.

◆ hasPrevPosition()

bool G3D::CPUVertexArray::hasPrevPosition ( ) const
inline

True if prevPosition is nonempty.

It is ambiguous if an empty vertex array has a prevPosition array.

◆ hasTexCoord()

bool G3D::CPUVertexArray::hasTexCoord ( int  coord) const
inline

◆ offsetAndScaleTexCoord1()

void G3D::CPUVertexArray::offsetAndScaleTexCoord1 ( const Point2 offset,
const Point2 scale 
)

◆ size()

int G3D::CPUVertexArray::size ( ) const
inline

◆ transformAndAppend() [1/2]

void G3D::CPUVertexArray::transformAndAppend ( const CPUVertexArray otherArray,
const CoordinateFrame cframe 
)

◆ transformAndAppend() [2/2]

void G3D::CPUVertexArray::transformAndAppend ( const CPUVertexArray otherArray,
const CoordinateFrame cframe,
const CoordinateFrame prevCFrame 
)

Transform otherArray.vertex.position by cframe and append to vertex.position.

Transform otherArray.vertex.position by prevCFrame and append to prevPosition. Assumes that otherArray does not contain a prevPosition array of its own.

Member Data Documentation

◆ boneIndices

Array<Vector4int32> G3D::CPUVertexArray::boneIndices

4 indices indicating the bones that affect animation for the vertex

Referenced by clear(), and G3D::ArticulatedModel::Geometry::hasBones().

◆ boneWeights

Array<Vector4> G3D::CPUVertexArray::boneWeights

4 floats indicating the weighting for the 4 bones that affect animation for the vertex

Referenced by clear().

◆ hasBones

bool G3D::CPUVertexArray::hasBones

True if boneIndices and boneWeights contain valid data.

Referenced by clear().

◆ hasTangent

bool G3D::CPUVertexArray::hasTangent

True if tangent contains valid data.

Referenced by clear().

◆ hasTexCoord0

bool G3D::CPUVertexArray::hasTexCoord0

True if texCoord0 contains valid data.

Referenced by clear(), and hasTexCoord().

◆ hasTexCoord1

bool G3D::CPUVertexArray::hasTexCoord1

True if texCoord1 contains valid data.

Referenced by clear(), and hasTexCoord().

◆ hasVertexColors

bool G3D::CPUVertexArray::hasVertexColors

True if vertexColors contains valid data.

Referenced by clear().

◆ prevPosition

Array<Point3> G3D::CPUVertexArray::prevPosition

The position of the vertex in the previous frame, in the same coordinate system as vertex.position.

This is stored outside of the CPUVertexArray::vertex array because it is not used by most models.

Referenced by clear(), and hasPrevPosition().

◆ texCoord1

Array<Point2unorm16> G3D::CPUVertexArray::texCoord1

A second texture coordinate (which is not necessarily stored in texture coordinate attribute 1 on a GPU).

This must be on [0,1]. Typically used for light map coordinates.

This is stored outside of the CPUVertexArray::vertex array because it is not used by most models.

Referenced by clear().

◆ vertex

Array<Vertex> G3D::CPUVertexArray::vertex

◆ vertexColors

Array<Color4> G3D::CPUVertexArray::vertexColors

Vertex Colors.

Referenced by clear().


documentation generated on Wed Nov 24 2021 08:01:54 using doxygen 1.8.15