Radium Engine  1.5.20
Loading...
Searching...
No Matches
VolumeObject.hpp
1#pragma once
2
3#include <Engine/Data/DisplayableObject.hpp>
4#include <Engine/Data/Mesh.hpp>
5#include <Engine/Data/Texture.hpp>
6#include <Engine/RaEngine.hpp>
7
8namespace Ra {
9namespace Core {
10namespace Geometry {
11class AbstractVolume;
12} // namespace Geometry
13} // namespace Core
14namespace Engine {
15namespace Data {
22class RA_ENGINE_API VolumeObject : public Displayable
23{
24
25 public:
26 explicit VolumeObject( const std::string& name );
27 VolumeObject( const VolumeObject& rhs ) = delete;
28 void operator=( const VolumeObject& rhs ) = delete;
29
30 ~VolumeObject() override;
31
32 using Displayable::getName;
33
36 inline const Core::Geometry::AbstractGeometry& getAbstractGeometry() const override;
37 inline Core::Geometry::AbstractGeometry& getAbstractGeometry() override;
38
40 inline const Core::Geometry::AbstractVolume& getVolume() const;
41 inline Core::Geometry::AbstractVolume& getVolume();
42
44 void loadGeometry( Core::Geometry::AbstractVolume* volume );
45
48 void loadGeometry( Core::Geometry::AbstractVolume* volume, const Core::Aabb& aabb );
49
51 inline void setDirty() { m_isDirty = true; }
52
54 const Texture& getDataTexture() { return m_tex; }
55
60 void updateGL() override;
61
63 void render( const ShaderProgram* prog ) override;
64
66 size_t getNumFaces() const override { return 12; }
68 inline size_t getNumVertices() const override { return 8; }
69
70 private:
72 Texture m_tex { {} };
74 Mesh m_mesh;
75
77 bool m_isDirty { false };
78};
79
81 CORE_ASSERT( m_volume, "Volume is not initialized" );
82 return *(Core::Geometry::AbstractGeometry*)( m_volume.get() );
83}
84
86 CORE_ASSERT( m_volume, "Volume is not initialized" );
87 return *(Core::Geometry::AbstractGeometry*)( m_volume.get() );
88}
89
92 CORE_ASSERT( m_volume, "Volume is not initialized" );
93 return *m_volume.get();
94}
95
97 CORE_ASSERT( m_volume, "Volume is not initialized" );
98 return *m_volume.get();
99}
100
101} // namespace Data
102} // namespace Engine
103} // namespace Ra
Represent a Texture of the engine.
Definition Texture.hpp:120
const Texture & getDataTexture()
get read access to the 3d texture storing the data
const Core::Geometry::AbstractGeometry & getAbstractGeometry() const override
const Core::Geometry::AbstractVolume & getVolume() const
Returns the underlying AbstractVolume.
void setDirty()
Mark the data types as dirty, forcing an update of the openGL buffer.
size_t getNumFaces() const override
6 quad faces of the cube, thus 12 triangles.
size_t getNumVertices() const override
8 vertices of the cube
@ Geometry
"Geometry" render objects are those loaded using Radium::IO and generated by GeometrySystem
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3