#define TILE_HEADER
#include "irrlichttypes.h"
-#include "irr_v2d.h"
#include "irr_v3d.h"
#include <ITexture.h>
#include <IrrlichtDevice.h>
#include "util/numeric.h"
class IGameDef;
+struct TileSpec;
+struct TileDef;
/*
tile.{h,cpp}: Texture handling stuff.
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;
};
class IWritableTextureSource : public ITextureSource
virtual void rebuildImagesAndTextures()=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;
};
IWritableTextureSource* createTextureSource(IrrlichtDevice *device);
// defined by extra parameters
#define MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES 0x08
#define MATERIAL_FLAG_HIGHLIGHTED 0x10
+#define MATERIAL_FLAG_TILEABLE_HORIZONTAL 0x20
+#define MATERIAL_FLAG_TILEABLE_VERTICAL 0x40
/*
This fully defines the looks of a tile.
FrameSpec():
texture_id(0),
texture(NULL),
- normal_texture(NULL)
+ normal_texture(NULL),
+ flags_texture(NULL)
{
}
u32 texture_id;
video::ITexture *texture;
video::ITexture *normal_texture;
+ video::ITexture *flags_texture;
};
struct TileSpec
texture_id(0),
texture(NULL),
normal_texture(NULL),
+ flags_texture(NULL),
alpha(255),
material_type(TILE_MATERIAL_BASIC),
material_flags(
}
material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING)
? true : false;
+ if (!(material_flags & MATERIAL_FLAG_TILEABLE_HORIZONTAL)) {
+ material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
+ }
+ if (!(material_flags & MATERIAL_FLAG_TILEABLE_VERTICAL)) {
+ material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
+ }
}
void applyMaterialOptionsWithShaders(video::SMaterial &material) const
{
material.BackfaceCulling = (material_flags & MATERIAL_FLAG_BACKFACE_CULLING)
? true : false;
+ if (!(material_flags & MATERIAL_FLAG_TILEABLE_HORIZONTAL)) {
+ material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
+ material.TextureLayer[1].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
+ }
+ if (!(material_flags & MATERIAL_FLAG_TILEABLE_VERTICAL)) {
+ material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
+ material.TextureLayer[1].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
+ }
}
u32 texture_id;
video::ITexture *texture;
video::ITexture *normal_texture;
+ video::ITexture *flags_texture;
// Vertex alpha (when MATERIAL_ALPHA_VERTEX is used)
u8 alpha;
u8 rotation;
};
-
#endif