X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fclient%2Ftile.h;h=fcdc46460ccfe542e1c9d0b830d7317e1ad2b4e1;hb=a049e8267fabd101cb5c6528b3270214cb0647f0;hp=e69dbe0c7bb3d6d7352dd74f28f907a53662ee13;hpb=75320e7e88ab5088a46c9e42c1e789cbdacb13b0;p=dragonfireclient.git diff --git a/src/client/tile.h b/src/client/tile.h index e69dbe0c7..fcdc46460 100644 --- a/src/client/tile.h +++ b/src/client/tile.h @@ -25,8 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include -#include #include "util/numeric.h" +#include "config.h" + +#if ENABLE_GLES +#include +#endif class IGameDef; struct TileSpec; @@ -59,29 +63,10 @@ std::string getImagePath(std::string path); Utilizes a thread-safe cache. */ -std::string getTexturePath(const std::string &filename); +std::string getTexturePath(const std::string &filename, bool *is_base_pack = nullptr); void clearTextureNameCache(); -/* - ITextureSource::generateTextureFromMesh parameters -*/ -namespace irr {namespace scene {class IMesh;}} -struct TextureFromMeshParams -{ - scene::IMesh *mesh = nullptr; - core::dimension2d dim; - std::string rtt_texture_name; - bool delete_texture_on_shutdown; - v3f camera_position; - v3f camera_lookat; - core::CMatrix4 camera_projection_matrix; - video::SColorf ambient_light; - v3f light_position; - video::SColorf light_color; - f32 light_radius; -}; - /* TextureSource creates and caches textures. */ @@ -119,8 +104,6 @@ class ITextureSource : public ISimpleTextureSource */ virtual Palette* getPalette(const std::string &name) = 0; virtual bool isKnownSourceImage(const std::string &name)=0; - virtual video::ITexture* generateTextureFromMesh( - const TextureFromMeshParams ¶ms)=0; virtual video::ITexture* getNormalTexture(const std::string &name)=0; virtual video::SColor getTextureAverageColor(const std::string &name)=0; virtual video::ITexture *getShaderFlagsTexture(bool normalmap_present)=0; @@ -139,8 +122,6 @@ class IWritableTextureSource : public ITextureSource virtual video::ITexture* getTexture( const std::string &name, u32 *id = nullptr)=0; virtual bool isKnownSourceImage(const std::string &name)=0; - virtual video::ITexture* generateTextureFromMesh( - const TextureFromMeshParams ¶ms)=0; virtual void processQueue()=0; virtual void insertSourceImage(const std::string &name, video::IImage *img)=0; @@ -152,8 +133,8 @@ class IWritableTextureSource : public ITextureSource IWritableTextureSource *createTextureSource(); -#ifdef __ANDROID__ -video::IImage * Align2Npot2(video::IImage * image, video::IVideoDriver* driver); +#if ENABLE_GLES +video::IImage *Align2Npot2(video::IImage *image, video::IVideoDriver *driver); #endif enum MaterialType{ @@ -163,7 +144,12 @@ enum MaterialType{ TILE_MATERIAL_LIQUID_OPAQUE, TILE_MATERIAL_WAVING_LEAVES, TILE_MATERIAL_WAVING_PLANTS, - TILE_MATERIAL_OPAQUE + TILE_MATERIAL_OPAQUE, + TILE_MATERIAL_WAVING_LIQUID_BASIC, + TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT, + TILE_MATERIAL_WAVING_LIQUID_OPAQUE, + TILE_MATERIAL_PLAIN, + TILE_MATERIAL_PLAIN_ALPHA }; // Material flags @@ -227,15 +213,19 @@ struct TileLayer switch (material_type) { case TILE_MATERIAL_OPAQUE: case TILE_MATERIAL_LIQUID_OPAQUE: + case TILE_MATERIAL_WAVING_LIQUID_OPAQUE: material.MaterialType = video::EMT_SOLID; break; case TILE_MATERIAL_BASIC: case TILE_MATERIAL_WAVING_LEAVES: case TILE_MATERIAL_WAVING_PLANTS: + case TILE_MATERIAL_WAVING_LIQUID_BASIC: + material.MaterialTypeParam = 0.5; material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; break; case TILE_MATERIAL_ALPHA: case TILE_MATERIAL_LIQUID_TRANSPARENT: + case TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT: material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; break; default: @@ -280,7 +270,7 @@ struct TileLayer u32 texture_id = 0; u16 animation_frame_length_ms = 0; - u8 animation_frame_count = 1; + u16 animation_frame_count = 1; u8 material_type = TILE_MATERIAL_BASIC; u8 material_flags = @@ -292,7 +282,7 @@ struct TileLayer //! If true, the tile has its own color. bool has_color = false; - std::shared_ptr> frames = nullptr; + std::vector *frames = nullptr; /*! * The color of the tile, or if the tile does not own @@ -308,10 +298,7 @@ struct TileLayer */ struct TileSpec { - TileSpec() { - for (auto &layer : layers) - layer = TileLayer(); - } + TileSpec() = default; /*! * Returns true if this tile can be merged with the other tile. @@ -337,3 +324,5 @@ struct TileSpec //! The first is base texture, the second is overlay. TileLayer layers[MAX_TILE_LAYERS]; }; + +std::vector getTextureDirs();