]> git.lizzy.rs Git - dragonfireclient.git/blob - src/tile.cpp
before adding day/night lighting
[dragonfireclient.git] / src / tile.cpp
1 /*
2 Minetest-c55
3 Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "tile.h"
21
22 const char * g_tile_texture_names[TILES_COUNT] =
23 {
24         NULL,
25         "stone",
26         "water",
27         "grass",
28         "tree",
29         "leaves",
30         "grass_footsteps",
31         "mese",
32         "mud",
33         "tree_top",
34         "mud_with_grass",
35         "cloud",
36 };
37
38 video::SMaterial g_tile_materials[TILES_COUNT];
39
40 void tile_materials_preload(TextureCache &cache)
41 {
42         for(s32 i=0; i<TILES_COUNT; i++)
43         {
44                 const char *name = g_tile_texture_names[i];
45
46                 video::ITexture *t = NULL;
47
48                 if(name != NULL)
49                 {
50                         t = cache.get(name);
51                         assert(t != NULL);
52                 }
53
54                 g_tile_materials[i].Lighting = false;
55                 g_tile_materials[i].BackfaceCulling = false;
56                 g_tile_materials[i].setFlag(video::EMF_BILINEAR_FILTER, false);
57                 g_tile_materials[i].setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF);
58                 //if(i != TILE_WATER)
59                 //g_tile_materials[i].setFlag(video::EMF_FOG_ENABLE, true);
60                 
61                 //g_tile_materials[i].setFlag(video::EMF_TEXTURE_WRAP, video::ETC_REPEAT);
62                 //g_tile_materials[i].setFlag(video::EMF_ANISOTROPIC_FILTER, false);
63
64                 g_tile_materials[i].setTexture(0, t);
65         }
66         
67         g_tile_materials[TILE_WATER].MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
68         //g_tile_materials[TILE_WATER].MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
69 }
70