Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Engine::Data::MultiIndexedGeometry< T > Class Template Reference

#include <Engine/Data/Mesh.hpp>

+ Inheritance diagram for Ra::Engine::Data::MultiIndexedGeometry< T >:
+ Collaboration diagram for Ra::Engine::Data::MultiIndexedGeometry< T >:

Public Types

using base = CoreGeometryDisplayable<T>
 
- Public Types inherited from Ra::Engine::Data::CoreGeometryDisplayable< T >
using base = AttribArrayDisplayable
 
using CoreGeometry = T
 
- Public Types inherited from Ra::Engine::Data::AttribArrayDisplayable
enum  MeshRenderMode : uint {
  RM_POINTS = 0x0000 , RM_LINES = 0x0001 , RM_LINE_LOOP = 0x0002 , RM_LINE_STRIP = 0x0003 ,
  RM_TRIANGLES = 0x0004 , RM_TRIANGLE_STRIP = 0x0005 , RM_TRIANGLE_FAN = 0x0006 , RM_QUADS = 0x0007 ,
  RM_QUAD_STRIP = 0x0008 , RM_POLYGON = 0x0009 , RM_LINES_ADJACENCY = 0x000A , RM_LINE_STRIP_ADJACENCY = 0x000B ,
  RM_TRIANGLES_ADJACENCY = 0x000C , RM_TRIANGLE_STRIP_ADJACENCY = 0x000D , RM_PATCHES = 0x000E
}
 
- Public Types inherited from Ra::Engine::Data::Displayable
enum  PickingRenderMode {
  PKM_POINTS = 0 , PKM_LINES = 1 , PKM_LINE_ADJ = 2 , PKM_TRI = 3 ,
  NO_PICKING
}
 

Public Member Functions

 MultiIndexedGeometry (const std::string &name, typename base::CoreGeometry &&geom, typename base::MeshRenderMode renderMode=base::MeshRenderMode::RM_TRIANGLES)
 
void render (const ShaderProgram *prog) override
 
void loadGeometry (T &&mesh) override
 
- Public Member Functions inherited from Ra::Engine::Data::CoreGeometryDisplayable< T >
 CoreGeometryDisplayable (const std::string &name, MeshRenderMode renderMode=RM_TRIANGLES)
 
template<typename A >
Ra::Core::Utils::AttribHandle< A > addAttrib (const std::string &name, const typename Core::VectorArray< A > &data)
 Helper function that calls Ra::Core::CoreGeometry::addAttrib()
 
size_t getNumVertices () const override
 
void updateGL () override
 Update (i.e. send to GPU) the buffers marked as dirty.
 
void setAttribNameCorrespondance (const std::string &meshAttribName, const std::string &shaderAttribName)
 
const Core::Geometry::AbstractGeometrygetAbstractGeometry () const override
 
Core::Geometry::AbstractGeometrygetAbstractGeometry () override
 
const Core::Geometry::AttribArrayGeometrygetAttribArrayGeometry () const override
 
Core::Geometry::AttribArrayGeometrygetAttribArrayGeometry () override
 
const CoreGeometry & getCoreGeometry () const
 
CoreGeometry & getCoreGeometry ()
 
- Public Member Functions inherited from Ra::Engine::Data::AttribArrayDisplayable
 AttribArrayDisplayable (const std::string &name, MeshRenderMode renderMode=RM_TRIANGLES)
 
 AttribArrayDisplayable (const AttribArrayDisplayable &rhs)=delete
 
void operator= (const AttribArrayDisplayable &rhs)=delete
 
void setRenderMode (MeshRenderMode mode)
 Set the render mode.
 
MeshRenderMode getRenderMode () const
 Get the render mode.
 
Ra::Core::Utils::optional< gl::GLuint > getVboHandle (const std::string &name)
 Get opengl's vbo handle (uint) corresponding to attrib name.
 
Ra::Core::Utils::optional< gl::GLuint > getVaoHandle ()
 Get opengl's vao handle (uint).
 
const std::stringgetName () const
 Returns the name of the mesh.
 
void setDirty (const Core::Geometry::MeshAttrib &type)
 
void setDirty (const std::string &name)
 
void setDirty (unsigned int index)
 
- Public Member Functions inherited from Ra::Engine::Data::Displayable
 Displayable (const std::string &name)
 
 Displayable (const Displayable &rhs)=delete
 
void operator= (const Displayable &rhs)=delete
 
PickingRenderMode pickingRenderMode () const
 Returns the picking rendermode advised by the object (default PickingRenderMode::NO_PICKING)
 
const std::stringgetName () const
 Returns the name of the mesh.
 
virtual size_t getNumFaces () const
 

Protected Types

using LayerSemanticCollection = Core::Utils::ObjectWithSemantic::SemanticNameCollection
 
using LayerSemantic = Core::Utils::ObjectWithSemantic::SemanticName
 
using LayerKeyType = std::pair<LayerSemanticCollection, std::string>
 
using EntryType = std::pair<bool, VaoIndices*>
 

Protected Member Functions

void updateGL_specific_impl () override
 
- Protected Member Functions inherited from Ra::Engine::Data::CoreGeometryDisplayable< T >
void loadGeometry_common (CoreGeometry &&mesh)
 
void setupCoreMeshObservers ()
 
void autoVertexAttribPointer (const ShaderProgram *prog)
 assume m_vao is bound.
 
void addAttribObserver (const std::string &name)
 
void addToTranslationTable (const std::string &name)
 
- Protected Member Functions inherited from Ra::Engine::Data::AttribArrayDisplayable
void updatePickingRenderMode ()
 Update the picking render mode according to the object render mode.
 

Protected Attributes

std::unordered_map< LayerKeyType, EntryType, KeyHash > m_indices
 
- Protected Attributes inherited from Ra::Engine::Data::CoreGeometryDisplayable< T >
BijectiveAssociation< std::string, std::stringm_translationTable {}
 
CoreGeometry m_mesh
 
- Protected Attributes inherited from Ra::Engine::Data::AttribArrayDisplayable
std::unique_ptr< globjects::VertexArray > m_vao
 
MeshRenderMode m_renderMode { MeshRenderMode::RM_TRIANGLES }
 
std::vector< std::unique_ptr< globjects::Buffer > > m_vbos
 
std::vector< bool > m_dataDirty
 
std::map< std::string, unsigned int > m_handleToBuffer
 
bool m_isDirty { false }
 General dirty bit of the mesh.
 
- Protected Attributes inherited from Ra::Engine::Data::Displayable
PickingRenderMode m_pickingRenderMode { NO_PICKING }
 

Detailed Description

template<typename T>
class Ra::Engine::Data::MultiIndexedGeometry< T >

An engine mesh owning a MultiIndexedCoreGeometry, with multiple indices layer.

Todo
Work in progress.

Definition at line 355 of file Mesh.hpp.

Member Typedef Documentation

◆ base

template<typename T >
using Ra::Engine::Data::MultiIndexedGeometry< T >::base = CoreGeometryDisplayable<T>

Definition at line 358 of file Mesh.hpp.

◆ EntryType

template<typename T >
using Ra::Engine::Data::MultiIndexedGeometry< T >::EntryType = std::pair<bool, VaoIndices*>
protected

Definition at line 375 of file Mesh.hpp.

◆ LayerKeyType

template<typename T >
using Ra::Engine::Data::MultiIndexedGeometry< T >::LayerKeyType = std::pair<LayerSemanticCollection, std::string>
protected

Definition at line 373 of file Mesh.hpp.

◆ LayerSemantic

template<typename T >
using Ra::Engine::Data::MultiIndexedGeometry< T >::LayerSemantic = Core::Utils::ObjectWithSemantic::SemanticName
protected

Definition at line 372 of file Mesh.hpp.

◆ LayerSemanticCollection

template<typename T >
using Ra::Engine::Data::MultiIndexedGeometry< T >::LayerSemanticCollection = Core::Utils::ObjectWithSemantic::SemanticNameCollection
protected

Definition at line 371 of file Mesh.hpp.

Constructor & Destructor Documentation

◆ MultiIndexedGeometry()

template<typename T >
Ra::Engine::Data::MultiIndexedGeometry< T >::MultiIndexedGeometry ( const std::string & name,
typename base::CoreGeometry && geom,
typename base::MeshRenderMode renderMode = base::MeshRenderMode::RM_TRIANGLES )
explicit

Definition at line 976 of file Mesh.hpp.

Member Function Documentation

◆ loadGeometry()

template<typename T >
void Ra::Engine::Data::MultiIndexedGeometry< T >::loadGeometry ( T && mesh)
overridevirtual

Use the given geometry as base for a display mesh. This will move mesh and *this will take the ownership of the data. The currently owned mesh is deleted, if any. This method should be called to set or replace the CoreGeometry, if you want to update attributes or indices, use getCoreGeometry and Core::Geometry::AttribArrayGeometry setters instead.

Warning
For indices, you must call setIndicesDirty after modification.
Todo
add observer mecanism for indices.
Todo
HERE

Reimplemented from Ra::Engine::Data::CoreGeometryDisplayable< T >.

Definition at line 984 of file Mesh.hpp.

+ Here is the call graph for this function:

◆ render()

template<typename T >
void Ra::Engine::Data::MultiIndexedGeometry< T >::render ( const ShaderProgram * prog)
overridevirtual

Draw the mesh. Prog is used to set VertexAttribBinding, but it has to be already binded

Todo
implement !

Implements Ra::Engine::Data::Displayable.

Definition at line 1026 of file Mesh.hpp.

◆ updateGL_specific_impl()

template<typename T >
void Ra::Engine::Data::MultiIndexedGeometry< T >::updateGL_specific_impl ( )
overrideprotectedvirtual
Todo
implement !

Reimplemented from Ra::Engine::Data::CoreGeometryDisplayable< T >.

Definition at line 996 of file Mesh.hpp.

Member Data Documentation

◆ m_indices

template<typename T >
std::unordered_map<LayerKeyType, EntryType, KeyHash> Ra::Engine::Data::MultiIndexedGeometry< T >::m_indices
protected

Definition at line 387 of file Mesh.hpp.


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