From dd9e82f5bc2982abab436afdd68df799c6fdd857 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 8 Feb 2011 01:12:55 +0200 Subject: bug-fixin' --- src/tile.h | 76 ++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 29 deletions(-) (limited to 'src/tile.h') diff --git a/src/tile.h b/src/tile.h index ff495abc4..a68731f55 100644 --- a/src/tile.h +++ b/src/tile.h @@ -25,51 +25,69 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "texture.h" #include +enum MaterialType{ + MATERIAL_ALPHA_NONE, + MATERIAL_ALPHA_VERTEX, + MATERIAL_ALPHA_SIMPLE, // >127 = opaque + MATERIAL_ALPHA_BLEND, +}; + +// Material flags +#define MATERIAL_FLAG_BACKFACE_CULLING 0x01 + +/* + This fully defines the looks of a tile. + The SMaterial of a tile is constructed according to this. +*/ struct TileSpec { TileSpec(): - alpha(255) + alpha(255), + material_type(MATERIAL_ALPHA_NONE), + material_flags( + MATERIAL_FLAG_BACKFACE_CULLING + ) { } bool operator==(TileSpec &other) { - return (spec == other.spec && alpha == other.alpha); + return ( + spec == other.spec && + alpha == other.alpha && + material_type == other.material_type && + material_flags == other.material_flags + ); } - TextureSpec spec; - u8 alpha; -}; - -#if 0 -struct TileSpec -{ - TileSpec(): - alpha(255) + // Sets everything else except the texture in the material + void applyMaterialOptions(video::SMaterial &material) { - } + if(alpha != 255 && material_type != MATERIAL_ALPHA_VERTEX) + dstream<<"WARNING: TileSpec: alpha != 255 " + "but not MATERIAL_ALPHA_VERTEX" + <