Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::Mesh Class Reference
Inheritance diagram for inviwo::Mesh:

Classes

struct  BufferInfo
struct  MeshInfo

Public Types

using BufferVector = std::vector<std::pair<BufferInfo, std::shared_ptr<BufferBase>>>
using IndexVector = std::vector<std::pair<MeshInfo, std::shared_ptr<IndexBuffer>>>
Public Types inherited from inviwo::DataGroup< Mesh, MeshRepresentation >
using repr
using self

Public Member Functions

void addBuffer (BufferInfo info, std::shared_ptr< BufferBase > buffer)
void addBuffer (BufferType type, std::shared_ptr< BufferBase > buffer)
void addBuffers (const BufferVector &buffers)
std::shared_ptr< IndexBufferRAM > addIndexBuffer (DrawType dt, ConnectivityType ct)
void addIndices (const IndexVector &indices)
void addIndices (MeshInfo info, std::shared_ptr< IndexBuffer > ind)
void addIndicies (MeshInfo info, std::shared_ptr< IndexBuffer > ind)
void append (const Mesh &mesh)
 Append another mesh to this mesh.
virtual Mesh * clone () const override
std::pair< BufferBase *, int > findBuffer (BufferType type)
std::pair< const BufferBase *, int > findBuffer (BufferType type) const
virtual const AxisgetAxis (size_t index) const override
BufferBasegetBuffer (BufferType type)
BufferBasegetBuffer (size_t idx)
const BufferBasegetBuffer (size_t idx) const
BufferInfo getBufferInfo (BufferBase *buffer) const
BufferInfo getBufferInfo (size_t idx) const
const BufferVector & getBuffers () const
MeshInfo getDefaultMeshInfo () const
const IndexVector & getIndexBuffers () const
MeshInfo getIndexMeshInfo (size_t idx) const
IndexBuffer * getIndices (size_t idx)
const IndexBuffer * getIndices (size_t idx) const
virtual Document getInfo () const
size_t getNumberOfBuffers () const
size_t getNumberOfIndices () const
size_t getNumberOfIndicies () const
bool hasBuffer (BufferType type) const
 Mesh (const BufferVector &buffers, const IndexVector &indices)
 Mesh (const Mesh &rhs)
 Mesh (const Mesh &rhs, NoData)
 Mesh (DrawType dt, ConnectivityType ct)
 Mesh (Mesh::MeshInfo meshInfo)
Mesh & operator= (const Mesh &that)
std::pair< BufferInfo, std::shared_ptr< BufferBase > > removeBuffer (BufferBase *buffer)
std::pair< BufferInfo, std::shared_ptr< BufferBase > > removeBuffer (size_t idx)
void removeIndexBuffer (size_t idx)
std::pair< BufferInfo, std::shared_ptr< BufferBase > > replaceBuffer (BufferBase *old, BufferInfo info, std::shared_ptr< BufferBase > buffer)
std::pair< BufferInfo, std::shared_ptr< BufferBase > > replaceBuffer (size_t idx, BufferInfo info, std::shared_ptr< BufferBase > buffer)
void reserveIndexBuffers (size_t size)
void reserveSizeInVertexBuffer (size_t size)
void setBuffer (size_t idx, BufferInfo info, std::shared_ptr< BufferBase > buffer)
void setBufferInfo (BufferBase *buffer, BufferInfo info)
void setBufferInfo (size_t idx, BufferInfo info)
void setDefaultMeshInfo (MeshInfo)
Public Member Functions inherited from inviwo::DataGroup< Mesh, MeshRepresentation >
void clearRepresentations ()
T * getEditableRepresentation ()
const T * getRepresentation () const
bool hasRepresentation () const
bool hasRepresentations () const
Public Member Functions inherited from inviwo::SpatialEntity
glm::mat3 getBasis () const
virtual const SpatialCoordinateTransformergetCoordinateTransformer () const
virtual const SpatialCameraCoordinateTransformergetCoordinateTransformer (const Camera &camera) const
glm::mat4 getModelMatrix () const
glm::vec3 getOffset () const
glm::mat4 getWorldMatrix () const
SpatialEntity & operator= (const SpatialEntity &that)
void setBasis (const glm::mat3 &basis)
void setModelMatrix (const glm::mat4 &modelMatrix)
void setOffset (const glm::vec3 &offset)
void setWorldMatrix (const glm::mat4 &worldMatrix)
 SpatialEntity (const glm::mat4 &modelMatrix)
 SpatialEntity (const glm::mat4 &modelMatrix, const glm::mat4 &worldMatrix)
 SpatialEntity (const SpatialEntity &rhs)
Public Member Functions inherited from inviwo::MetaDataOwner
void copyMetaDataFrom (const MetaDataOwner &src)
void copyMetaDataTo (MetaDataOwner &dst)
template<typename T>
requires std::derived_from<T, MetaData>
T * createMetaData (std::string_view key)
void deserialize (Deserializer &d)
template<typename T>
requires std::derived_from<T, MetaData>
T * getMetaData (std::string_view key)
template<typename T>
requires std::derived_from<T, MetaData>
const T * getMetaData (std::string_view key) const
template<typename T, typename U>
requires std::derived_from<T, MetaData> && Gettable<T, U>
getMetaData (std::string_view key, U val) const
MetaDataMapgetMetaDataMap ()
const MetaDataMapgetMetaDataMap () const
template<typename T>
requires std::derived_from<T, MetaData>
bool hasMetaData (std::string_view key) const
bool hasMetaData (std::string_view key) const
 MetaDataOwner (const MetaDataOwner &rhs)=default
 MetaDataOwner (MetaDataOwner &rhs)=default
MetaDataOwner & operator= (const MetaDataOwner &rhs)=default
MetaDataOwner & operator= (MetaDataOwner &)=default
void serialize (Serializer &s) const
template<typename T, typename U>
requires std::derived_from<T, MetaData> && Settable<T, U>
void setMetaData (std::string_view key, U value)
template<typename T>
requires std::derived_from<T, MetaData>
bool unsetMetaData (std::string_view key)
 unset, i.e. remove the metadata entry matching the given key and type

Public Attributes

std::array< Axis, 3 > axes

Static Public Attributes

static constexpr std::string_view classIdentifier {"org.inviwo.Mesh"}
static constexpr uvec3 colorCode {188, 188, 101}
static constexpr std::string_view dataName {"Mesh"}

Protected Attributes

BufferVector buffers_
IndexVector indices_
MeshInfo meshInfo_
Protected Attributes inherited from inviwo::DataGroup< Mesh, MeshRepresentation >
std::mutex mutex_
std::unordered_map< std::type_index, std::shared_ptr< MeshRepresentation > > representations_
Protected Attributes inherited from inviwo::SpatialEntity
std::unique_ptr< SpatialCameraCoordinateTransformercameraTransformer_
glm::mat4 modelMatrix_
std::unique_ptr< SpatialCoordinateTransformertransformer_
glm::mat4 worldMatrix_
Protected Attributes inherited from inviwo::MetaDataOwner
MetaDataMap metaData_

Additional Inherited Members

Protected Member Functions inherited from inviwo::DataGroup< Mesh, MeshRepresentation >
DataGroup< Mesh, MeshRepresentation > & operator= (const DataGroup< Mesh, MeshRepresentation > &rhs)

Member Function Documentation

◆ addBuffer() [1/2]

void inviwo::Mesh::addBuffer ( BufferInfo info,
std::shared_ptr< BufferBase > buffer )

Add a buffer with rendering data, such as positions/colors/normals.

Parameters
infoinformation about the buffer contents (e.g. buffer type and attrib location)
bufferbuffer data used during rendering

◆ addBuffer() [2/2]

void inviwo::Mesh::addBuffer ( BufferType type,
std::shared_ptr< BufferBase > buffer )

Add a buffer with rendering data, such as positions/colors/normals, and associate it with its default attrib location.

Parameters
typebuffer type (Position, Color, Normal, etc.)
bufferbuffer data used during rendering

◆ addBuffers()

void inviwo::Mesh::addBuffers ( const BufferVector & buffers)

Add multiple buffers with rendering data, such as positions/colors/normals.

Parameters
buffersbuffer data and their associated buffer infos

◆ addIndexBuffer()

std::shared_ptr< IndexBufferRAM > inviwo::Mesh::addIndexBuffer ( DrawType dt,
ConnectivityType ct )

Creates and add a new index buffer to the mesh

See also
addIndicies
Parameters
dtDrawType of the new buffer
ctConnectivityType of the new buffer
Returns
returns the RAM Representation of the new buffer.

◆ addIndices() [1/2]

void inviwo::Mesh::addIndices ( const IndexVector & indices)

Add multiple index buffers indices to the mesh.

See also
addIndices
Parameters
indicesindex buffers and their associated mesh infos

◆ addIndices() [2/2]

void inviwo::Mesh::addIndices ( MeshInfo info,
std::shared_ptr< IndexBuffer > ind )

Add index buffer. The indices will be used as look up values into the buffers during rendering. The Mesh will take ownership of the added buffer.

Parameters
infoRendering type and connectivity.
indIndex buffer, will be owned by mesh.

◆ append()

void inviwo::Mesh::append ( const Mesh & mesh)

Append another mesh to this mesh.

Requires that both meshes has the same type and number of vertex buffers. Will append the contents of each vertex buffer in mesh to each vertex in this. Index buffers are copied and each index is incremented with an offset.

Parameters
meshThe mesh to copy values from

◆ clone()

virtual Mesh * inviwo::Mesh::clone ( ) const
overridevirtual

◆ findBuffer() [1/2]

std::pair< BufferBase *, int > inviwo::Mesh::findBuffer ( BufferType type)

Try and find a buffer of the given BufferType. Returns the buffer and its location. If no buffer is found the buffer will be a nullptr.

◆ findBuffer() [2/2]

std::pair< const BufferBase *, int > inviwo::Mesh::findBuffer ( BufferType type) const

Try and find a buffer of the given BufferType. Returns the buffer and its location. If no buffer is found the buffer will be a nullptr.

◆ getAxis()

virtual const Axis * inviwo::Mesh::getAxis ( size_t index) const
overridevirtual

returns the axis information corresponding to index

Returns
nullptr if there is no axis for index

Implements inviwo::SpatialEntity.

◆ getBuffer()

BufferBase * inviwo::Mesh::getBuffer ( BufferType type)
Returns
The first buffer matching BufferType type or nullptr;

◆ hasBuffer()

bool inviwo::Mesh::hasBuffer ( BufferType type) const

Check if there exits a buffer of BufferType type in the mesh.

◆ removeBuffer() [1/2]

std::pair< BufferInfo, std::shared_ptr< BufferBase > > inviwo::Mesh::removeBuffer ( BufferBase * buffer)

Removes the given buffer.

Parameters
bufferposition of buffer to be removed
Returns
the removed buffer

◆ removeBuffer() [2/2]

std::pair< BufferInfo, std::shared_ptr< BufferBase > > inviwo::Mesh::removeBuffer ( size_t idx)

Removes buffer at given position, all subsequent buffers will be moved. Does nothing if index is out of range.

Parameters
idxposition of buffer to be removed
Returns
the removed buffer

◆ removeIndexBuffer()

void inviwo::Mesh::removeIndexBuffer ( size_t idx)

Removes index buffer at given position, all subsequent index buffers will be moved. Does nothing if index is out of range.

Parameters
idxposition of index buffer to be removed

◆ replaceBuffer() [1/2]

std::pair< BufferInfo, std::shared_ptr< BufferBase > > inviwo::Mesh::replaceBuffer ( BufferBase * old,
BufferInfo info,
std::shared_ptr< BufferBase > buffer )

Replaces the old buffer old with the new buffer buffer

Parameters
oldOld buffer to replace. If old is not found the buffer is appended.
infoinformation about the buffer contents (e.g. buffer type and shader location)
buffernew buffer data used during rendering
Returns
the removed buffer

◆ replaceBuffer() [2/2]

std::pair< BufferInfo, std::shared_ptr< BufferBase > > inviwo::Mesh::replaceBuffer ( size_t idx,
BufferInfo info,
std::shared_ptr< BufferBase > buffer )

Replaces buffer at index with new buffer Does nothing if index out of range.

Parameters
idxIndex of buffer to replace, if the index is not found the new one is appended.
infoinformation about the buffer contents (e.g. buffer type and shader location)
buffernew buffer data used during rendering
Returns
the removed buffer

◆ reserveIndexBuffers()

void inviwo::Mesh::reserveIndexBuffers ( size_t size)

Reserve memory for a given number of index buffers. Useful when having a mesh on which we will add a lot of index buffers

Parameters
sizethe new reserved size of the vector containing index buffers

◆ reserveSizeInVertexBuffer()

void inviwo::Mesh::reserveSizeInVertexBuffer ( size_t size)

Reserve memory for a given number of vertices in each buffer.

Parameters
sizenumber of elements that will be reserved in each buffer

◆ setBuffer()

void inviwo::Mesh::setBuffer ( size_t idx,
BufferInfo info,
std::shared_ptr< BufferBase > buffer )

Deprecated: Mesh::setBuffer() has been renamed to Mesh::replaceBuffer()

Parameters
idxIndex of buffer to replace
infoinformation about the buffer contents (e.g. buffer type and shader location)
buffernew buffer data used during rendering
See also
replaceBuffer

The documentation for this class was generated from the following file:
  • include/inviwo/core/datastructures/geometry/mesh.h