aboutsummaryrefslogtreecommitdiff
path: root/data/mods/default/textures/default_rail_t_junction.png
blob: 9985f63cd49ce29f636e72fe3b168fe1b6bad236 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 10 00 00 00 10 08 06 00 00 00 1f f3 ff .PNG........IHDR................
0020 61 00 00 00 01 73 52 47 42 00 ae ce 1c e9 00 00 00 09 70 48 59 73 00 00 0b 13 00 00 0b 13 01 00 a....sRGB.........pHYs..........
0040 9a 9c 18 00 00 01 c3 49 44 41 54 38 cb 95 93 4d 48 54 71 14 c5 7f ff 79 7f 5e a3 7d 40 1b 37 d1 .......IDAT8...MHTq....y.^.}@.7.
0060 07 15 81 04 0d 15 61 0b 37 11 b6 88 36 32 c8 20 b4 09 d1 c0 36 19 41 8b 62 40 68 21 a1 a9 18 31 ......a.7...62......6.A.b@h!...1
0080 cc 30 eb 88 c9 0c 02 83 01 5b b4 8b 88 20 5a b5 7b 7e 90 81 92 8a ef cd 7b 6f 7c ef b6 98 e6 f9 .0.......[....Z.{~......{o|.....
00a0 f5 d4 bc cb 73 ef 39 9c 73 b9 17 fe 55 79 6a 52 3a 32 69 61 8f ea c8 a4 a5 3c 35 19 cd 69 80 57 ....s.9.s...UyjR:2ia.....<5..i.W
00c0 4f 5a 22 20 77 ff a2 98 3a 81 ed 05 28 20 14 d0 86 a2 ba 16 62 ea 04 1f e7 6b 73 c3 bd 17 a4 ef OZ".w...:...(.......b....ks.....
00e0 e5 77 a5 01 3e 7d 9b a3 fd 5a ad f1 d3 5a e4 70 a3 66 71 d9 e7 50 83 a6 e2 05 34 26 0d 5c 3f c4 .w..>}...Z...Z.p.fq..P....4&.\?.
0100 f1 02 38 72 1a 80 f3 e9 01 ca 69 44 6d 8c 50 c8 17 29 bd 1e 57 71 d6 eb b6 0b f9 e2 26 5c ef 95 ..8r......iDm.P..)..Wq......&\..
0120 39 8e d8 dd d3 c5 8d eb 37 d5 8e 02 8f 3b cf 4a f3 c9 a3 34 b5 f5 47 c4 ba b3 ad 8b 8e 15 f0 7d 9.......7....;.J...4..G........}
0140 3f 22 ef 14 a9 5e 89 38 b0 ad 37 47 21 5f 24 d5 f0 83 37 d9 ab b2 2f 81 8d cb 5c 58 aa 60 fd 5e ?"...^.8..7G!_$...7.../...\X.`.^
0160 66 f4 5e 4a f6 e5 a0 5e 23 ef a6 d5 af 05 87 95 55 97 e2 c3 cb f2 5f 02 5b 73 0f 8e 5b ca 76 5c f.^J...^#.......U....._.[s..[.v\
0180 ac f9 15 72 7d 97 24 56 20 7b fb dc ae 39 07 4a 96 b2 1d 1f db a9 6c eb 69 00 d7 f5 22 20 d3 3c ...r}.$V.{...9.J......l.i..."..<
01a0 c7 ad 47 57 24 94 90 3b cf be 46 4e 86 de 5a ea 41 fb 09 c1 5c ff 09 80 6d 97 78 dc ff c2 c1 a4 ..GW$..;..FN..Z.A...\...m.x.....
01c0 c1 9f d5 2a ad a9 63 54 bc 80 e4 01 83 ce a7 9f 37 dd 41 77 4f 57 fc 1d 3c 9f 98 8e 44 15 48 35 ...*..cT........7.AwOW..<...D.H5
01e0 00 53 2b 4a d9 16 59 b2 d7 28 cf d6 c8 1f 5e dc 65 78 62 46 ed 7a ca 63 ef 67 d7 c5 14 62 24 14 .S+J..Y..(....^.exbF.z.c.g...b$.
0200 98 a7 6a cf 74 a6 09 98 e1 2f 74 17 c4 e1 39 93 08 72 00 00 00 00 49 45 4e 44 ae 42 60 82 ..j.t..../t...9..r....IEND.B`.
>148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef TILE_HEADER
#define TILE_HEADER

#include "irrlichttypes.h"
#include "irr_v2d.h"
#include "irr_v3d.h"
#include <ITexture.h>
#include <IrrlichtDevice.h>
#include "threads.h"
#include <string>

class IGameDef;

/*
	tile.{h,cpp}: Texture handling stuff.
*/

/*
	Find out the full path of an image by trying different filename
	extensions.

	If failed, return "".

	TODO: Should probably be moved out from here, because things needing
	      this function do not need anything else from this header
*/
std::string getImagePath(std::string path);

/*
	Gets the path to a texture by first checking if the texture exists
	in texture_path and if not, using the data path.

	Checks all supported extensions by replacing the original extension.

	If not found, returns "".

	Utilizes a thread-safe cache.
*/
std::string getTexturePath(const std::string &filename);

void clearTextureNameCache();

/*
	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.
*/

class ISimpleTextureSource
{
public:
	ISimpleTextureSource(){}
	virtual ~ISimpleTextureSource(){}
	virtual video::ITexture* getTexture(
			const std::string &name, u32 *id = NULL) = 0;
};

class ITextureSource : public ISimpleTextureSource
{
public:
	ITextureSource(){}
	virtual ~ITextureSource(){}
	virtual u32 getTextureId(const std::string &name)=0;
	virtual u32 getTextureIdDirect(const std::string &name)=0;
	virtual std::string getTextureName(u32 id)=0;
	virtual video::ITexture* getTexture(u32 id)=0;
	virtual video::ITexture* getTexture(
			const std::string &name, u32 *id = NULL)=0;
	virtual IrrlichtDevice* getDevice()=0;
	virtual bool isKnownSourceImage(const std::string &name)=0;
	virtual video::ITexture* generateTextureFromMesh(
			const TextureFromMeshParams &params)=0;
};

class IWritableTextureSource : public ITextureSource
{
public:
	IWritableTextureSource(){}
	virtual ~IWritableTextureSource(){}
	virtual u32 getTextureId(const std::string &name)=0;
	virtual u32 getTextureIdDirect(const std::string &name)=0;
	virtual std::string getTextureName(u32 id)=0;
	virtual video::ITexture* getTexture(u32 id)=0;
	virtual video::ITexture* getTexture(
			const std::string &name, u32 *id = NULL)=0;
	virtual IrrlichtDevice* getDevice()=0;
	virtual bool isKnownSourceImage(const std::string &name)=0;
	virtual video::ITexture* generateTextureFromMesh(
			const TextureFromMeshParams &params)=0;

	virtual void processQueue()=0;
	virtual void insertSourceImage(const std::string &name, video::IImage *img)=0;
	virtual void rebuildImagesAndTextures()=0;
};

IWritableTextureSource* createTextureSource(IrrlichtDevice *device);

enum MaterialType{
	TILE_MATERIAL_BASIC,
	TILE_MATERIAL_ALPHA,
	TILE_MATERIAL_LIQUID_TRANSPARENT,
	TILE_MATERIAL_LIQUID_OPAQUE,
};

// Material flags
// Should backface culling be enabled?
#define MATERIAL_FLAG_BACKFACE_CULLING 0x01
// Should a crack be drawn?
#define MATERIAL_FLAG_CRACK 0x02
// Should the crack be drawn on transparent pixels (unset) or not (set)?
// Ignored if MATERIAL_FLAG_CRACK is not set.
#define MATERIAL_FLAG_CRACK_OVERLAY 0x04
// Animation made up by splitting the texture to vertical frames, as
// defined by extra parameters
#define MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES 0x08

/*
	This fully defines the looks of a tile.
	The SMaterial of a tile is constructed according to this.
*/
struct TileSpec
{
	TileSpec():
		texture_id(0),
		texture(NULL),
		alpha(255),
		material_type(TILE_MATERIAL_BASIC),
		material_flags(
			//0 // <- DEBUG, Use the one below
			MATERIAL_FLAG_BACKFACE_CULLING
		),
		animation_frame_count(1),
		animation_frame_length_ms(0),
		rotation(0)
	{
	}

	bool operator==(const TileSpec &other) const
	{
		return (
			texture_id == other.texture_id &&
			/* texture == other.texture && */
			alpha == other.alpha &&
			material_type == other.material_type &&
			material_flags == other.material_flags &&
			rotation == other.rotation
		);
	}

	bool operator!=(const TileSpec &other) const
	{
		return !(*this == other);
	}
	
	// Sets everything else except the texture in the material
	void applyMaterialOptions(video::SMaterial &material) const
	{
		switch(material_type){
		case TILE_MATERIAL_BASIC:
			material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
			break;
		case TILE_MATERIAL_ALPHA:
			material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
			break;
		case TILE_MATERIAL_LIQUID_TRANSPARENT:
			material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;