Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
texturesource.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "irrlichttypes.h"
8#include <SColor.h>
9#include <string>
10#include <vector>
11
12namespace irr::video
13{
14 class IImage;
15 class ITexture;
16}
17
18typedef std::vector<video::SColor> Palette;
19
20/*
21 TextureSource creates and caches textures.
22*/
23
25{
26public:
28
29 virtual ~ISimpleTextureSource() = default;
30
31 virtual video::ITexture* getTexture(
32 const std::string &name, u32 *id = nullptr) = 0;
33};
34
36{
37public:
38 ITextureSource() = default;
39
40 virtual ~ITextureSource() = default;
41
42 virtual u32 getTextureId(const std::string &name)=0;
43 virtual std::string getTextureName(u32 id)=0;
44 virtual video::ITexture* getTexture(u32 id)=0;
45 virtual video::ITexture* getTexture(
46 const std::string &name, u32 *id = nullptr)=0;
47 virtual video::ITexture* getTextureForMesh(
48 const std::string &name, u32 *id = nullptr) = 0;
55 virtual Palette* getPalette(const std::string &name) = 0;
56 virtual bool isKnownSourceImage(const std::string &name)=0;
57 virtual video::ITexture* getNormalTexture(const std::string &name)=0;
58 virtual video::SColor getTextureAverageColor(const std::string &name)=0;
59};
60
62{
63public:
65
66 virtual ~IWritableTextureSource() = default;
67
68 virtual u32 getTextureId(const std::string &name)=0;
69 virtual std::string getTextureName(u32 id)=0;
70 virtual video::ITexture* getTexture(u32 id)=0;
71 virtual video::ITexture* getTexture(
72 const std::string &name, u32 *id = nullptr)=0;
73 virtual bool isKnownSourceImage(const std::string &name)=0;
74
75 virtual void processQueue()=0;
76 virtual void insertSourceImage(const std::string &name, video::IImage *img)=0;
77 virtual void rebuildImagesAndTextures()=0;
78 virtual video::ITexture* getNormalTexture(const std::string &name)=0;
79 virtual video::SColor getTextureAverageColor(const std::string &name)=0;
80};
81
Definition texturesource.h:25
virtual ~ISimpleTextureSource()=default
virtual video::ITexture * getTexture(const std::string &name, u32 *id=nullptr)=0
ISimpleTextureSource()=default
Definition texturesource.h:36
ITextureSource()=default
virtual video::ITexture * getTexture(u32 id)=0
virtual std::string getTextureName(u32 id)=0
virtual u32 getTextureId(const std::string &name)=0
virtual video::ITexture * getTexture(const std::string &name, u32 *id=nullptr)=0
virtual Palette * getPalette(const std::string &name)=0
virtual ~ITextureSource()=default
virtual video::SColor getTextureAverageColor(const std::string &name)=0
virtual video::ITexture * getTextureForMesh(const std::string &name, u32 *id=nullptr)=0
virtual video::ITexture * getNormalTexture(const std::string &name)=0
virtual bool isKnownSourceImage(const std::string &name)=0
Definition texturesource.h:62
virtual video::SColor getTextureAverageColor(const std::string &name)=0
virtual void insertSourceImage(const std::string &name, video::IImage *img)=0
IWritableTextureSource()=default
virtual std::string getTextureName(u32 id)=0
virtual video::ITexture * getTexture(u32 id)=0
virtual u32 getTextureId(const std::string &name)=0
virtual void processQueue()=0
virtual bool isKnownSourceImage(const std::string &name)=0
virtual video::ITexture * getNormalTexture(const std::string &name)=0
virtual video::ITexture * getTexture(const std::string &name, u32 *id=nullptr)=0
virtual ~IWritableTextureSource()=default
virtual void rebuildImagesAndTextures()=0
Definition clientmap.h:35
std::vector< video::SColor > Palette
Definition texturesource.h:18
IWritableTextureSource * createTextureSource()
Definition texturesource.cpp:169