summaryrefslogtreecommitdiff
path: root/src/irrlichtwrapper.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-01-26 00:41:06 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-01-26 00:41:06 +0200
commit9f882bf74d452521cb7fb1806ab453aaa28da343 (patch)
treea5676871bd8f3adf44fade49162ea0342d49ac4d /src/irrlichtwrapper.h
parent035345f13d2da9eced87a426a671d3bc4df392b5 (diff)
downloadminetest-9f882bf74d452521cb7fb1806ab453aaa28da343.tar.gz
minetest-9f882bf74d452521cb7fb1806ab453aaa28da343.tar.bz2
minetest-9f882bf74d452521cb7fb1806ab453aaa28da343.zip
Reworked texture, material, mineral and whatever handling
Diffstat (limited to 'src/irrlichtwrapper.h')
-rw-r--r--src/irrlichtwrapper.h95
1 files changed, 9 insertions, 86 deletions
diff --git a/src/irrlichtwrapper.h b/src/irrlichtwrapper.h
index 97607e579..2506af012 100644
--- a/src/irrlichtwrapper.h
+++ b/src/irrlichtwrapper.h
@@ -56,7 +56,7 @@ public:
m_textures[name] = texture;
}
- video::ITexture* get(std::string name)
+ video::ITexture* get(const std::string &name)
{
JMutexAutoLock lock(m_mutex);
@@ -74,86 +74,6 @@ private:
JMutex m_mutex;
};
-struct TextureMod
-{
- /*
- Returns a new texture which can be based on the original.
- Shall not modify or delete the original texture.
- */
- virtual video::ITexture * make(video::ITexture *original,
- const char *newname, video::IVideoDriver* driver) = 0;
-};
-
-struct CrackTextureMod: public TextureMod
-{
- CrackTextureMod(u16 a_progression)
- {
- progression = a_progression;
- }
-
- virtual video::ITexture * make(video::ITexture *original,
- const char *newname, video::IVideoDriver* driver);
-
- u16 progression;
-};
-
-struct SideGrassTextureMod: public TextureMod
-{
- SideGrassTextureMod()
- {
- }
-
- virtual video::ITexture * make(video::ITexture *original,
- const char *newname, video::IVideoDriver* driver);
-};
-
-struct ProgressBarTextureMod: public TextureMod
-{
- // value is from 0.0 to 1.0
- ProgressBarTextureMod(float a_value)
- {
- value = a_value;
- }
-
- virtual video::ITexture * make(video::ITexture *original,
- const char *newname, video::IVideoDriver* driver);
-
- float value;
-};
-
-/*
- A class for specifying a requested texture
-*/
-struct TextureSpec
-{
- TextureSpec()
- {
- mod = NULL;
- }
- TextureSpec(const std::string &a_name, const std::string &a_path,
- TextureMod *a_mod)
- {
- name = a_name;
- path = a_path;
- mod = a_mod;;
- }
- ~TextureSpec()
- {
- }
- bool operator==(const TextureSpec &other)
- {
- return name == other.name;
- }
- // An unique name for the texture. Usually the same as the path.
- // Note that names and paths reside the same namespace.
- std::string name;
- // This is the path of the base texture
- std::string path;
- // Modification to do to the base texture
- // NOTE: This is deleted by the one who processes the request
- TextureMod *mod;
-};
-
/*
A thread-safe wrapper for irrlicht, to be accessed from
background worker threads.
@@ -183,14 +103,17 @@ public:
return m_device->getTimer()->getRealTime();
}
- video::ITexture* getTexture(TextureSpec spec);
- video::ITexture* getTexture(const std::string &path);
-
+ /*
+ Path can contain stuff like
+ "/usr/share/minetest/stone.png[[mod:mineral0[[mod:crack3"
+ */
+ video::ITexture* getTexture(const std::string &spec);
+
private:
/*
Non-thread-safe variants of stuff, for internal use
*/
- video::ITexture* getTextureDirect(TextureSpec spec);
+ video::ITexture* getTextureDirect(const std::string &spec);
/*
Members
@@ -203,7 +126,7 @@ private:
TextureCache m_texturecache;
- RequestQueue<TextureSpec, video::ITexture*, u8, u8> m_get_texture_queue;
+ RequestQueue<std::string, video::ITexture*, u8, u8> m_get_texture_queue;
};
#endif