aboutsummaryrefslogtreecommitdiff
path: root/src/tile.h
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2013-07-03 02:22:39 +0200
committerKahrl <kahrl@gmx.net>2013-07-03 03:24:28 +0200
commit8f1d5d34a6191346d7f8cb5e012053bcd19795c4 (patch)
tree05626dceb2ba4ce97ed79cb3f5d43c2dd5a12513 /src/tile.h
parentb1ef850877278d2af0b35f792e34b39258cf875f (diff)
downloadhax-minetest-server-8f1d5d34a6191346d7f8cb5e012053bcd19795c4.tar.gz
hax-minetest-server-8f1d5d34a6191346d7f8cb5e012053bcd19795c4.zip
Move generateTextureFromMesh to TextureSource to fix a texture leak
TextureSource has a list of textures to delete (m_texture_trash) so this provides a proper, non-hacky way to delete RTT textures. Also, the prior, hacky way of deleting them seems to be broken (see pull request #803). To avoid header file clutter by repeating the same long list of arguments over and over again, store the arguments of generateTextureFromMesh in a struct called TextureFromMeshParams. Also fix issue #782 (Only use bilinear (and others) on item textures when settings allow it).
Diffstat (limited to 'src/tile.h')
-rw-r--r--src/tile.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tile.h b/src/tile.h
index 144cb6475..8008d2127 100644
--- a/src/tile.h
+++ b/src/tile.h
@@ -58,6 +58,25 @@ std::string getImagePath(std::string path);
std::string getTexturePath(const std::string &filename);
/*
+ ITextureSource::generateTextureFromMesh parameters
+*/
+namespace irr {namespace scene {class IMesh;}}
+struct TextureFromMeshParams
+{
+ scene::IMesh *mesh;
+ core::dimension2d<u32> dim;
+ std::string rtt_texture_name;
+ bool delete_texture_on_shutdown;
+ v3f camera_position;
+ v3f camera_lookat;
+ core::CMatrix4<f32> camera_projection_matrix;
+ video::SColorf ambient_light;
+ v3f light_position;
+ video::SColorf light_color;
+ f32 light_radius;
+};
+
+/*
TextureSource creates and caches textures.
*/
@@ -78,6 +97,8 @@ public:
virtual IrrlichtDevice* getDevice()
{return NULL;}
virtual bool isKnownSourceImage(const std::string &name)=0;
+ virtual video::ITexture* generateTextureFromMesh(
+ const TextureFromMeshParams &params)=0;
};
class IWritableTextureSource : public ITextureSource
@@ -100,6 +121,8 @@ public:
virtual void processQueue()=0;
virtual void insertSourceImage(const std::string &name, video::IImage *img)=0;
virtual void rebuildImagesAndTextures()=0;
+ virtual video::ITexture* generateTextureFromMesh(
+ const TextureFromMeshParams &params)=0;
};
IWritableTextureSource* createTextureSource(IrrlichtDevice *device);