Radium Engine  1.5.0
VolumetricMaterial.hpp
1 #pragma once
2 #include <Engine/RaEngine.hpp>
3 
4 #include <map>
5 #include <string>
6 
7 #include <Core/Utils/Color.hpp>
8 #include <Engine/Data/Material.hpp>
9 #include <Engine/Data/Texture.hpp>
10 
11 namespace Ra {
12 namespace Engine {
13 namespace Data {
14 
15 class ShaderProgram;
16 
24 class RA_ENGINE_API VolumetricMaterial final : public Material, public ParameterSetEditingInterface
25 {
26 
27  public:
28  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
33  explicit VolumetricMaterial( const std::string& name );
39  ~VolumetricMaterial() override;
40 
41  void updateGL() override;
42  void updateFromParameters() override;
43  bool isTransparent() const override;
44 
50  inline void setTexture( Texture* texture );
51 
57  inline Texture* getTexture() const;
58 
64  static void registerMaterial();
65 
70  static void unregisterMaterial();
71 
77  inline nlohmann::json getParametersMetadata() const override;
78 
79  public:
81  Core::Utils::Color m_sigma_a { 0.0011_ra, 0.0024_ra, 0.014_ra };
83  Core::Utils::Color m_sigma_s { 2.55_ra, 3.21_ra, 3.77_ra };
85  Scalar m_g { 0_ra };
87  Scalar m_scale { 1_ra };
90  Scalar m_stepsize { -1_ra };
93  Core::Transform m_modelToMedium { Core::Transform::Identity() };
94 
95  private:
96  // The density matrix
97  Texture* m_texture;
98 
102  void updateRenderingParameters();
103 
105  static nlohmann::json s_parametersMetadata;
106 };
107 
108 // Add a texture as material parameter from an already existing Radium Texture
109 inline void VolumetricMaterial::setTexture( Texture* texture ) {
110  m_texture = texture;
111 }
112 
114  return m_texture;
115 }
116 
117 inline nlohmann::json VolumetricMaterial::getParametersMetadata() const {
118  return s_parametersMetadata;
119 }
120 
121 } // namespace Data
122 } // namespace Engine
123 } // namespace Ra
nlohmann::json getParametersMetadata() const override
Definition: Cage.cpp:3