Radium Engine  1.5.20
Loading...
Searching...
No Matches
MaterialTextureSet.hpp
1#pragma once
2
3#include <Engine/Data/TextureManager.hpp>
4#include <Engine/RadiumEngine.hpp>
5
6namespace Ra {
7namespace Engine {
8namespace Data {
9
12template <typename TextureSemantic>
14{
15 public:
16 virtual ~MaterialTextureSet() = default;
17
18 void addTexture( const TextureSemantic& semantic,
19 const TextureManager::TextureHandle& texture ) {
20 m_textures[semantic] = texture;
21 }
22
25 void addTexture( const TextureSemantic& semantic, const TextureParameters& texture ) {
26 auto texManager = RadiumEngine::getInstance()->getTextureManager();
27 addTexture( semantic, texManager->addTexture( texture ) );
28 }
29
34 Texture* getTexture( const TextureSemantic& semantic ) const {
35 Texture* tex = nullptr;
36 auto texManager = RadiumEngine::getInstance()->getTextureManager();
37 auto it = m_textures.find( semantic );
38 if ( it != m_textures.end() ) { tex = texManager->getTexture( it->second ); }
39 return tex;
40 }
41
42 private:
44};
45} // namespace Data
46} // namespace Engine
47} // namespace Ra
Base class to manage a set of textures indexed by semantic (enum).
Texture * getTexture(const TextureSemantic &semantic) const
Texture getter from semantic.
void addTexture(const TextureSemantic &semantic, const TextureParameters &texture)
Add texture to TextureManager fisrt, then to the texture set.
Represent a Texture of the engine.
Definition Texture.hpp:120
T end(T... args)
T find(T... args)
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3
Describes the sampler and image of a texture.
Definition Texture.hpp:99