#include <SMaterial.h>
#include <memory>
#include "util/numeric.h"
+#include "config.h"
+
+#if ENABLE_GLES
+#include <IVideoDriver.h>
+#endif
class IGameDef;
struct TileSpec;
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<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.
*/
*/
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;
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;
IWritableTextureSource *createTextureSource();
-#ifdef __ANDROID__
-video::IImage * Align2Npot2(video::IImage * image, video::IVideoDriver* driver);
+#if ENABLE_GLES
+bool hasNPotSupport();
+video::IImage * Align2Npot2(video::IImage * image, irr::video::IVideoDriver* driver);
#endif
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
texture_id == other.texture_id &&
material_type == other.material_type &&
material_flags == other.material_flags &&
- color == other.color;
+ color == other.color &&
+ scale == other.scale;
}
/*!
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:
* a color then the color of the node owning this tile.
*/
video::SColor color;
+
+ u8 scale;
};
/*!
*/
struct TileSpec
{
- TileSpec() {
- for (auto &layer : layers)
- layer = TileLayer();
- }
+ TileSpec() = default;
/*!
* Returns true if this tile can be merged with the other tile.
&& emissive_light == other.emissive_light;
}
+ //! If true, the tile rotation is ignored.
+ bool world_aligned = false;
+ //! Tile rotation.
u8 rotation = 0;
//! This much light does the tile emit.
u8 emissive_light = 0;
//! The first is base texture, the second is overlay.
TileLayer layers[MAX_TILE_LAYERS];
};
+
+std::vector<std::string> getTextureDirs();