PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
Loading...
Searching...
No Matches
PureVertexTransfer Class Reference

VertexTransfer class extends Mesh3D by providing ways to transfer vertices of the mesh over the vertex pipeline. More...

Detailed Description

VertexTransfer class extends Mesh3D by providing ways to transfer vertices of the mesh over the vertex pipeline.

Similar to Mesh3D, VertexTransfer objects are 2-level entities:

  • first level (parent) derives from a level-1 VertexTransfer object, and owns properties such as vertex transfer mode;
  • second level objects derive from level-2 VertexTransfer objects, particularly the submeshes of the level-1 mesh from where the level-1 VertexTransfer is also derived.

The biggest addition of VertexTransfer to Mesh3D is the wide selection of vertex transfer modes and management of the related OpenGL resources such as vertex buffer objects.

Definition at line 173 of file PureVertexTransferMode.h.

#include <PureVertexTransferMode.h>

+ Inheritance diagram for PureVertexTransfer:

Classes

class  PureVertexTransferImpl
 

Public Member Functions

virtual ~PureVertexTransfer ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
virtual TPURE_VERTEX_MODIFYING_HABIT getVertexModifyingHabit () const
 Gets vertex modifying habit.
 
virtual TPureBool setVertexModifyingHabit (TPURE_VERTEX_MODIFYING_HABIT vmod)
 Sets vertex modifying habit.
 
virtual TPURE_VERTEX_REFERENCING_MODE getVertexReferencingMode () const
 Gets vertex referencing mode.
 
virtual TPureBool setVertexReferencingMode (TPURE_VERTEX_REFERENCING_MODE vref)
 Sets vertex referencing mode.
 
virtual TPURE_VERTEX_TRANSFER_MODE getVertexTransferMode () const
 Gets vertex transfer mode.
 
virtual TPureBool setVertexTransferMode (TPURE_VERTEX_TRANSFER_MODE vtrans)
 Sets vertex transfer mode.
 
virtual TPureUInt getLastTransferredVertexCount () const
 Gets the number of vertices sent to graphics pipeline by the last transferVertices() call.
 
virtual TPureUInt getLastTransferredTriangleCount () const
 Gets the number of triangles sent to graphics pipeline by the last transferVertices() call.
 
virtual TPureUInt getUsedSystemMemory () const
 Gets the amount of allocated system memory.
 
virtual TPureUInt getUsedVideoMemory () const
 Gets the amount of allocated video memory.
 
- Public Member Functions inherited from PureMesh3D
virtual ~PureMesh3D ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
virtual TPureBool isLevel1 () const
 Tells if the mesh is a level-1 parent mesh.
 
virtual TPureBool isLevel2 () const
 Tells if the mesh is a level-2 submesh.
 
virtual TPURE_PRIMITIVE_FORMAT getPrimitiveFormat () const
 Gets the primitives' format.
 
virtual TPureUInt getVerticesCount () const
 Gets the number of total vertices.
 
virtual const TXYZgetVertices (TPureBool implicitAccessSubobject=true) const
 Gets the pointer to vertices.
 
virtual TXYZgetVertices (TPureBool implicitAccessSubobject=true)
 Gets the pointer to vertices.
 
virtual TPureUInt getVertexIndicesCount () const
 Gets the number of total vertex indices.
 
virtual const void * getVertexIndices (TPureBool implicitAccessSubobject=true) const
 Gets the pointer to vertex indices.
 
virtual unsigned int getVertexIndicesType (TPureBool implicitAccessSubobject=true) const
 Gets the type of the indices.
 
virtual TPureUInt getMinVertexIndex (TPureBool implicitAccessSubobject=true) const
 Gets the smallest index in the vertex indices array.
 
virtual TPureUInt getMaxVertexIndex (TPureBool implicitAccessSubobject=true) const
 Gets the greatest index in the vertex indices array.
 
virtual TPureUInt getVertexIndex (TPureUInt index, TPureBool implicitAccessSubobject=true) const
 Gets an index value from the vertex indices array.
 
virtual const TXYZgetNormals (TPureBool implicitAccessSubobject=true) const
 Gets the pointer to normals.
 
virtual TPureUInt getFaceCount () const
 Gets the number of faces/polygons formed by the vertices.
 
virtual TPureUInt getTriangleCount () const
 Gets the number of triangles formed by the vertices.
 
PureVectorgetPosVec ()
 Gets the position.
 
const PureVectorgetPosVec () const
 Gets the position.
 
virtual const PureVectorgetRelPosVec () const
 Gets the mesh-local relative position.
 
virtual const PureVectorgetSizeVec () const
 Gets the base sizes.
 
void RecalculateSize ()
 Recalculates the sizes.
 
const PureMaterialgetMaterial (TPureBool implicitAccessSubobject=true) const
 Gets the material.
 
PureMaterialgetMaterial (TPureBool implicitAccessSubobject=true)
 Gets the material.
 
- Public Member Functions inherited from PureFiledManaged
 PureFiledManaged ()
 
virtual ~PureFiledManaged ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
const std::string & getFilename () const
 Gets the filename.
 
- Public Member Functions inherited from PureManaged
 PureManaged ()
 
virtual ~PureManaged ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
const PureManagedgetUtiliser () const
 Returns the managed that utilizes this managed.
 
PureManagedgetUtiliser ()
 Returns the managed that utilizes this managed.
 
void SetUtiliser (PureManaged *pUtiliser)
 Sets the managed that utilizes this managed.
 
void DetachFrom ()
 Removes the managed from its manager.
 
PureManagergetManager () const
 Gets the manager of the managed.
 
const std::string & getName () const
 Gets the name.
 
void SetName (const std::string &name)
 Sets the name.
 
virtual void FlushResources ()
 This can be used if the specialized managed object has some resources that may be released from memory when not needed anymore.
 
- Public Member Functions inherited from PureFiledManager
 PureFiledManager ()
 
virtual ~PureFiledManager ()
 
CConsole & getConsole () const
 Returns access to console preset with logger module name as this class.
 
PureFiledManagedgetByFilename (const char *filename) const
 Gets the FiledManaged by the specified filename.
 
virtual PureFiledManagedcreateFromFile (const char *filename)
 Should create a new managed from the given file.
 
void WriteList () const
 From PureManager, adding logging file names.
 
- Public Member Functions inherited from PureManager
 PureManager ()
 
virtual ~PureManager ()
 
CConsole & getConsole () const
 Returns access to console preset with logger module name as this class.
 
TPureInt getCount () const
 Gets the number of managed objects.
 
TPureBool isEmpty () const
 Is the number of manageds 0?
 
TPureInt getSize () const
 Gets the number of allocated slots for managed objects; getSize() >= getCount().
 
PureManagedgetAttachedAt (TPureInt ind) const
 Gets the pointer to the managed at the given index.
 
TPureInt getAttachedIndex (const PureManaged &m) const
 Gets the index of the given managed.
 
void PreAlloc (TPureInt count)
 Allocates count free slots for manageds.
 
TPureBool hasAttached (const PureManaged &m) const
 Gets whether the given managed is managed by this manager.
 
virtual void Attach (PureManaged &m)
 Adds the given managed to the manager, if the managed has no manager yet.
 
virtual void Detach (PureManaged &m)
 Removes the given managed from the manager, so the managed will have no manager.
 
void DeleteAttachedInstance (PureManaged &m)
 Removes the given managed from the manager and destructs it.
 
void DeleteAll ()
 Removes and destructs every managed element in the manager.
 
virtual void HandleManagedPropertyChanged (PureManaged &m)
 Should be invoked when a managed's property got changed from a different kind of manager or managed.
 

Static Public Member Functions

static TPureBool isVertexTransferModeSelectable (TPURE_VERTEX_TRANSFER_MODE vtrans)
 Tells whether the given Vertex Transfer Mode is available on the current hardware.
 
static TPureBool isVertexReferencingIndexed (TPURE_VERTEX_TRANSFER_MODE vtrans)
 Tells whether the given Vertex Transfer Mode references vertices by indexing.
 
static TPureBool isVertexModifyingDynamic (TPURE_VERTEX_TRANSFER_MODE vtrans)
 Tells whether the given Vertex Transfer Mode means dynamic modifying habit.
 
static TPureBool isVideoMemoryUsed (TPURE_VERTEX_TRANSFER_MODE vtrans)
 Tells whether the given Vertex Transfer Mode uses VRAM.
 
static TPURE_VERTEX_TRANSFER_MODE selectVertexTransferMode (TPURE_VERTEX_MODIFYING_HABIT vmod, TPURE_VERTEX_REFERENCING_MODE vref, TPureBool bForceUseClientMemory)
 Selects a suitable vertex transfer mode.
 
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureMesh3D
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureFiledManaged
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureManaged
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureFiledManager
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureManager
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 

Protected Member Functions

 PureVertexTransfer (PureMaterialManager &matMgr, const TPURE_VERTEX_MODIFYING_HABIT &vmod=PURE_VMOD_STATIC, const TPURE_VERTEX_REFERENCING_MODE &vref=PURE_VREF_DIRECT, TPureBool bForceUseClientMemory=false)
 Only PureObject3D or PureObject3DManager creates it.
 
 PureVertexTransfer ()
 
 PureVertexTransfer (const PureVertexTransfer &)
 
PureVertexTransferoperator= (const PureVertexTransfer &)
 
TPureUInt transferVertices ()
 Sends vertices to the graphics pipeline.
 
virtual void ResetLastTransferredCounts ()
 Reset counters used for measuring number of vertices, triangles, etc.
 
- Protected Member Functions inherited from PureMesh3D
 PureMesh3D (TPURE_PRIMITIVE_FORMAT prfmt=PURE_PM_TRIANGLES)
 Only PureMesh3DManager creates it.
 
 PureMesh3D (const PureMesh3D &)
 
PureMesh3Doperator= (const PureMesh3D &)
 
- Protected Member Functions inherited from PureFiledManaged
 PureFiledManaged (const PureFiledManaged &other)
 
PureFiledManagedoperator= (const PureFiledManaged &other)
 
void SetFilename (const std::string &filename)
 Sets the filename.
 
- Protected Member Functions inherited from PureManaged
 PureManaged (const PureManaged &other)
 
PureManagedoperator= (const PureManaged &other)
 
- Protected Member Functions inherited from PureFiledManager
 PureFiledManager (const PureFiledManager &)
 
PureFiledManageroperator= (const PureFiledManager &)
 
virtual void WriteListCallback (const PureManaged &mngd) const
 From PureManager, printing filename.
 
- Protected Member Functions inherited from PureManager
 PureManager (const PureManager &other)
 
PureManageroperator= (const PureManager &)
 

Private Attributes

PureVertexTransferImplpImpl
 

Friends

class SampleManagerForDescendantFromVertexTransfer
 

Constructor & Destructor Documentation

◆ ~PureVertexTransfer()

PureVertexTransfer::~PureVertexTransfer ( )
virtual

Definition at line 1054 of file PureVertexTransferMode.cpp.

◆ PureVertexTransfer() [1/3]

PureVertexTransfer::PureVertexTransfer ( PureMaterialManager & matMgr,
const TPURE_VERTEX_MODIFYING_HABIT & vmod = PURE_VMOD_STATIC,
const TPURE_VERTEX_REFERENCING_MODE & vref = PURE_VREF_DIRECT,
TPureBool bForceUseClientMemory = false )
protected

Only PureObject3D or PureObject3DManager creates it.

Parameters
matMgrA MaterialManager instance to be used for constructing of ancestor class.
vmodWhat vertex modifying habit to be set for the new Mesh3D instance.
vrefWhat vertex referencing mode to be set for the new Mesh3D instance.
bForceUseClientMemoryForce-select a vertex transfer mode storing geometry in client memory instead of server memory. Please note that this is considered only if dynamic modifying habit is specified. Specifying static modifying habit will always select a mode which places geometry data into server memory.
Exceptions
std::bad_alloc- This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller.

Definition at line 1281 of file PureVertexTransferMode.cpp.

◆ PureVertexTransfer() [2/3]

PureVertexTransfer::PureVertexTransfer ( )
protected
Exceptions
std::bad_alloc- This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller.

Definition at line 1296 of file PureVertexTransferMode.cpp.

◆ PureVertexTransfer() [3/3]

PureVertexTransfer::PureVertexTransfer ( const PureVertexTransfer & other)
protected

Definition at line 1304 of file PureVertexTransferMode.cpp.

Member Function Documentation

◆ getLastTransferredTriangleCount()

TPureUInt PureVertexTransfer::getLastTransferredTriangleCount ( ) const
virtual

Gets the number of triangles sent to graphics pipeline by the last transferVertices() call.

Reimplemented in PureObject3D.

Definition at line 1179 of file PureVertexTransferMode.cpp.

◆ getLastTransferredVertexCount()

TPureUInt PureVertexTransfer::getLastTransferredVertexCount ( ) const
virtual

Gets the number of vertices sent to graphics pipeline by the last transferVertices() call.

Reimplemented in PureObject3D.

Definition at line 1170 of file PureVertexTransferMode.cpp.

◆ getLoggerModuleName()

const char * PureVertexTransfer::getLoggerModuleName ( )
static

Returns the logger module name of this class.

Intentionally not virtual, so derived class should hide this instead of overriding. Not even private, so user can also access this from outside, for any reason like controlling log filtering per logger module name.

Returns
The logger module name of this class.

Definition at line 1080 of file PureVertexTransferMode.cpp.

◆ getManagedConsole()

CConsole & PureVertexTransfer::getManagedConsole ( ) const

Returns access to console preset with logger module name as this class.

Intentionally not virtual, so the getConsole() in derived class should hide this instead of overriding.

Returns
Console instance used by this class.

Definition at line 1067 of file PureVertexTransferMode.cpp.

◆ getUsedSystemMemory()

TPureUInt PureVertexTransfer::getUsedSystemMemory ( ) const
virtual

Gets the amount of allocated system memory.

Level-1 (parent) objects summarize the memory usage of their level-2 subobjects and include it in the returned value.

Returns
Amount of allocated system memory in Bytes.

Reimplemented from PureMesh3D.

Reimplemented in PureObject3D.

Definition at line 1191 of file PureVertexTransferMode.cpp.

◆ getUsedVideoMemory()

TPureUInt PureVertexTransfer::getUsedVideoMemory ( ) const
virtual

Gets the amount of allocated video memory.

This function considers only the rough required video memory for storing the geometry of its underlying mesh. This function doesn't consider any related textures in video memory that might be associated with the Material of this object or its subobjects. Level-1 (parent) objects summarize the video memory usage of their level-2 subobjects and include it in the returned value.

Returns
Amount of allocated video memory in Bytes for storing geometry of the underlying mesh, including all subobjects.

Reimplemented in PureObject3D.

Definition at line 1215 of file PureVertexTransferMode.cpp.

◆ getVertexModifyingHabit()

TPURE_VERTEX_MODIFYING_HABIT PureVertexTransfer::getVertexModifyingHabit ( ) const
virtual

Gets vertex modifying habit.

It applies to the entire geometry of the mesh, including all of its submeshes. Level-2 objects use the property of their parent mesh.

Reimplemented in PureObject3D.

Definition at line 1091 of file PureVertexTransferMode.cpp.

◆ getVertexReferencingMode()

TPURE_VERTEX_REFERENCING_MODE PureVertexTransfer::getVertexReferencingMode ( ) const
virtual

Gets vertex referencing mode.

It applies to the entire geometry of the mesh, including all of its submeshes. Level-2 objects use the property of their level-1 parent mesh.

Reimplemented in PureObject3D.

Definition at line 1115 of file PureVertexTransferMode.cpp.

◆ getVertexTransferMode()

TPURE_VERTEX_TRANSFER_MODE PureVertexTransfer::getVertexTransferMode ( ) const
virtual

Gets vertex transfer mode.

It applies to the entire geometry of the mesh, including all of its submeshes. Level-2 objects use the property of their level-1 parent mesh.

Reimplemented in PureObject3D.

Definition at line 1139 of file PureVertexTransferMode.cpp.

◆ isVertexModifyingDynamic()

TPureBool PureVertexTransfer::isVertexModifyingDynamic ( TPURE_VERTEX_TRANSFER_MODE vtrans)
static

Tells whether the given Vertex Transfer Mode means dynamic modifying habit.

Returns
True if the given mode means dynamic modifying habit.

Definition at line 965 of file PureVertexTransferMode.cpp.

◆ isVertexReferencingIndexed()

TPureBool PureVertexTransfer::isVertexReferencingIndexed ( TPURE_VERTEX_TRANSFER_MODE vtrans)
static

Tells whether the given Vertex Transfer Mode references vertices by indexing.

Returns
True if the given mode references vertices by indexing.

Definition at line 955 of file PureVertexTransferMode.cpp.

◆ isVertexTransferModeSelectable()

TPureBool PureVertexTransfer::isVertexTransferModeSelectable ( TPURE_VERTEX_TRANSFER_MODE vtrans)
static

Tells whether the given Vertex Transfer Mode is available on the current hardware.

The following modes are always available with accelerated renderer:

  • dynamic modifying:
    • direct referencing: PURE_VT_DYN_DIR_1_BY_1, PURE_VT_DYN_DIR_RVA
    • indexed referencing: PURE_VT_DYN_IND_1_BY_1, PURE_VT_DYN_IND_RVA
  • static modifying:
    • direct referencing: PURE_VT_STA_DIR_DL
    • indexed referencing: PURE_VT_STA_IND_DL

The following modes are always available with non-accelerated renderer:

  • dynamic modifying:
    • direct referencing: PURE_VT_DYN_DIR_1_BY_1
    • indexed referencing: PURE_VT_DYN_IND_1_BY_1
  • static modifying:
    • direct referencing: same as for dynamic modifying above
    • indexed referencing: same as for dynamic modifying above
Returns
True if the given transfer mode is available on the current hardware, false otherwise.

Definition at line 919 of file PureVertexTransferMode.cpp.

◆ isVideoMemoryUsed()

TPureBool PureVertexTransfer::isVideoMemoryUsed ( TPURE_VERTEX_TRANSFER_MODE vtrans)
static

Tells whether the given Vertex Transfer Mode uses VRAM.

Note that the result does not always tell the truth. For example, we can expect that geometry draw calls stored in an OpenGL display list are cached somehow in video memory or implicitly stored as a static VBO in video memory, but this might not be the case with nowadays old/rare driver-GPU/VPU combo which might not even have enough video memory to store OpenGL display list, or the driver is not prepared for that.

Returns
True if the given mode means video memory is utilized instead of system memory to store mesh geometry.

Definition at line 979 of file PureVertexTransferMode.cpp.

◆ operator=()

PureVertexTransfer & PureVertexTransfer::operator= ( const PureVertexTransfer & )
protected

Definition at line 1309 of file PureVertexTransferMode.cpp.

◆ ResetLastTransferredCounts()

void PureVertexTransfer::ResetLastTransferredCounts ( )
protectedvirtual

Reset counters used for measuring number of vertices, triangles, etc.

sent to the graphics pipeline by the last transferVertices().

sent to the graphics pipeline by the last transferVertices(). Derived class can reset the counters when needed. Useful before iterating over its level-2 managed PureVertexTransfer-derived instances, because they implicitly increase counters in their level-1 parent.

Reimplemented in PureObject3D.

Definition at line 1332 of file PureVertexTransferMode.cpp.

◆ selectVertexTransferMode()

TPURE_VERTEX_TRANSFER_MODE PureVertexTransfer::selectVertexTransferMode ( TPURE_VERTEX_MODIFYING_HABIT vmod,
TPURE_VERTEX_REFERENCING_MODE vref,
TPureBool bForceUseClientMemory )
static

Selects a suitable vertex transfer mode.

The selected mode is compatible with the current hardware and complies with the given arguments. Please note that bForceUseClientMemory = true is considered only if dynamic modifying habit is specified. Specifying static modifying habit will always select a mode which places geometry data into server memory.

Returns
A suitable vertex transfer mode selected by PPP based on the given arguments and the current hardware capabilities.

Definition at line 996 of file PureVertexTransferMode.cpp.

◆ setVertexModifyingHabit()

TPureBool PureVertexTransfer::setVertexModifyingHabit ( TPURE_VERTEX_MODIFYING_HABIT vmod)
virtual

Sets vertex modifying habit.

It applies to the entire geometry of the mesh, including all of its submeshes. The setting is ignored for level-2 objects as it is applied to them by their level-1 parent mesh.

Parameters
vmodVertex modifying habit to be set.
Returns
True on success, false otherwise.

Definition at line 1104 of file PureVertexTransferMode.cpp.

◆ setVertexReferencingMode()

TPureBool PureVertexTransfer::setVertexReferencingMode ( TPURE_VERTEX_REFERENCING_MODE vref)
virtual

Sets vertex referencing mode.

It applies to the entire geometry of the mesh, including all of its submeshes. The setting is ignored for level-2 objects as it is applied to them by their level-1 parent mesh.

Parameters
vrefVertex referencing mode to be set.
Returns
True on success, false otherwise.

Definition at line 1128 of file PureVertexTransferMode.cpp.

◆ setVertexTransferMode()

TPureBool PureVertexTransfer::setVertexTransferMode ( TPURE_VERTEX_TRANSFER_MODE vtrans)
virtual

Sets vertex transfer mode.

Vertex transfer mode gets selected automatically by PPP. However, it can be also set manually for custom reasons. The setting does not happen if the selected transfer mode is not available for some reason, for example, if the selected mode is not supported on the current hardware. In such case, the existing vertex transfer mode and HW resources are kept unchanged. If the function encounters issue during allocating needed resources, vertex transfer mode is reset to 0 and HW resources are freed up. It applies to the entire geometry of the mesh, including all of its submeshes. The setting is ignored for level-2 meshes as it is applied to them by their level-1 parent mesh.

Parameters
vtransVertex referencing mode to be set.
Returns
True on success, false otherwise.

Reimplemented in PureObject3D.

Definition at line 1161 of file PureVertexTransferMode.cpp.

◆ transferVertices()

TPureUInt PureVertexTransfer::transferVertices ( )
protected

Sends vertices to the graphics pipeline.

Should be invoked for level-2 submesh, i.e. a PureVertexTransfer instance having geometry, and having another PureVertexTransfer as parent.

Returns
The number of vertices sent to the graphics pipeline.

Definition at line 1321 of file PureVertexTransferMode.cpp.

Friends And Related Symbol Documentation

◆ SampleManagerForDescendantFromVertexTransfer

friend class SampleManagerForDescendantFromVertexTransfer
friend

Definition at line 241 of file PureVertexTransferMode.h.

Member Data Documentation

◆ pImpl

PureVertexTransferImpl* PureVertexTransfer::pImpl
private

Definition at line 239 of file PureVertexTransferMode.h.


The documentation for this class was generated from the following files: