Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
G3D::UniversalSurface::GPUGeom Class Reference

A GPU mesh utility class that works with G3D::UniversalSurface. More...

Inherits G3D::ReferenceCountedObject.

Public Member Functions

 ~GPUGeom ()
 
bool hasBones () const
 
bool hasGeometry () const
 True if this part has some geometry. More...
 
void setShaderArgs (Args &args) const
 Sets. More...
 

Static Public Member Functions

static shared_ptr< TextureallocateBoneTexture (int width, int height)
 Bone textures are reused between frames to minimize allocation costs. More...
 
static shared_ptr< GPUGeomcreate (const shared_ptr< GPUGeom > &other)
 
static shared_ptr< GPUGeomcreate (PrimitiveType p=PrimitiveType::TRIANGLES)
 
static void operator delete (void *p)
 
static void * operator new (size_t size)
 

Public Attributes

AttributeArray boneIndices
 
shared_ptr< TextureboneTexture
 
AttributeArray boneWeights
 
AABox boxBounds
 Object space bounds. More...
 
IndexStream index
 Indices into the VARs. More...
 
AttributeArray normal
 
AttributeArray packedTangent
 
shared_ptr< TextureprevBoneTexture
 
PrimitiveType primitive
 
Sphere sphereBounds
 Object space bounds. More...
 
AttributeArray texCoord0
 
AttributeArray texCoord1
 
bool twoSided
 When true, this primitive should be rendered with two-sided lighting and texturing and not cull back faces. More...
 
AttributeArray vertex
 
AttributeArray vertexColor
 

Protected Member Functions

 GPUGeom (const shared_ptr< GPUGeom > &other)
 
 GPUGeom (PrimitiveType p, bool t)
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Static Protected Attributes

static Array< shared_ptr< Texture > > s_boneTextureBufferPool
 

Detailed Description

A GPU mesh utility class that works with G3D::UniversalSurface.

A set of lines, points, quads, or triangles that have a single UniversalMaterial and can be rendered as a single OpenGL primitive using RenderDevice::sendIndices inside a RenderDevice::beginIndexedPrimitives() block.

See also
G3D::MeshAlg, G3D::ArticulatedModel, G3D::Surface, G3D::CPUVertexArray

Constructor & Destructor Documentation

◆ GPUGeom() [1/2]

G3D::UniversalSurface::GPUGeom::GPUGeom ( const shared_ptr< GPUGeom > &  other)
protected

◆ GPUGeom() [2/2]

G3D::UniversalSurface::GPUGeom::GPUGeom ( PrimitiveType  p,
bool  t 
)
inlineprotected

◆ ~GPUGeom()

G3D::UniversalSurface::GPUGeom::~GPUGeom ( )

Member Function Documentation

◆ allocateBoneTexture()

static shared_ptr<Texture> G3D::UniversalSurface::GPUGeom::allocateBoneTexture ( int  width,
int  height 
)
static

Bone textures are reused between frames to minimize allocation costs.

◆ create() [1/2]

static shared_ptr<GPUGeom> G3D::UniversalSurface::GPUGeom::create ( const shared_ptr< GPUGeom > &  other)
inlinestatic

◆ create() [2/2]

static shared_ptr<GPUGeom> G3D::UniversalSurface::GPUGeom::create ( PrimitiveType  p = PrimitiveType::TRIANGLES)
inlinestatic

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ hasBones()

bool G3D::UniversalSurface::GPUGeom::hasBones ( ) const
inline

◆ hasGeometry()

bool G3D::UniversalSurface::GPUGeom::hasGeometry ( ) const
inline

True if this part has some geometry.

◆ operator delete()

static void G3D::UniversalSurface::GPUGeom::operator delete ( void *  p)
inlinestatic

◆ operator new()

static void* G3D::UniversalSurface::GPUGeom::operator new ( size_t  size)
inlinestatic

◆ setShaderArgs()

void G3D::UniversalSurface::GPUGeom::setShaderArgs ( Args args) const

Sets.

Parameters
argsindex array, and the following vertex attributes: vec4 g3d_Vertex; vec3 g3d_Normal; [vec2 g3d_TexCoord0;] [vec2 g3d_TexCoord1;] [vec4 g3d_PackedTangent;] [vec4 g3d_VertexColor;] [ivec4 g3d_BoneIndices;] [vec4 g3d_BoneWeights;]

and uniform: [sampler2D boneMatrixTexture]

and macros: [HAS_BONES]

where square brackets denotes optional attributes, dependent on whether the geom contains valid values for them.

This binds attribute arrays, so it cannot accept a UniformTable argument.

Member Data Documentation

◆ boneIndices

AttributeArray G3D::UniversalSurface::GPUGeom::boneIndices

Referenced by hasBones().

◆ boneTexture

shared_ptr<Texture> G3D::UniversalSurface::GPUGeom::boneTexture

Referenced by hasBones().

◆ boneWeights

AttributeArray G3D::UniversalSurface::GPUGeom::boneWeights

Referenced by hasBones().

◆ boxBounds

AABox G3D::UniversalSurface::GPUGeom::boxBounds

Object space bounds.

◆ index

IndexStream G3D::UniversalSurface::GPUGeom::index

Indices into the VARs.

Referenced by hasGeometry().

◆ normal

AttributeArray G3D::UniversalSurface::GPUGeom::normal

◆ packedTangent

AttributeArray G3D::UniversalSurface::GPUGeom::packedTangent

◆ prevBoneTexture

shared_ptr<Texture> G3D::UniversalSurface::GPUGeom::prevBoneTexture

◆ primitive

PrimitiveType G3D::UniversalSurface::GPUGeom::primitive

◆ s_boneTextureBufferPool

Array<shared_ptr<Texture> > G3D::UniversalSurface::GPUGeom::s_boneTextureBufferPool
staticprotected

◆ sphereBounds

Sphere G3D::UniversalSurface::GPUGeom::sphereBounds

Object space bounds.

◆ texCoord0

AttributeArray G3D::UniversalSurface::GPUGeom::texCoord0

◆ texCoord1

AttributeArray G3D::UniversalSurface::GPUGeom::texCoord1

◆ twoSided

bool G3D::UniversalSurface::GPUGeom::twoSided

When true, this primitive should be rendered with two-sided lighting and texturing and not cull back faces.

◆ vertex

AttributeArray G3D::UniversalSurface::GPUGeom::vertex

◆ vertexColor

AttributeArray G3D::UniversalSurface::GPUGeom::vertexColor

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