video::S3DVertex(min.X,min.Y,min.Z, 0,0,-1, c, txc[20],txc[23]),
};
- for(int i = 0; i < tilecount; i++)
+ for(int i = 0; i < 6; i++)
{
- switch (tiles[i].rotation)
+ switch (tiles[MYMIN(i, tilecount-1)].rotation)
{
case 0:
break;
MeshCollector &collector)
{
INodeDefManager *nodedef = data->m_gamedef->ndef();
+ ITextureSource *tsrc = data->m_gamedef->tsrc();
// 0ms
//TimeTaker timer("mapblock_mesh_generate_special()");
Some settings
*/
bool new_style_water = g_settings->getBool("new_style_water");
-
+
float node_liquid_level = 1.0;
- if(new_style_water)
+ if (new_style_water)
node_liquid_level = 0.85;
-
+
v3s16 blockpos_nodes = data->m_blockpos*MAP_BLOCKSIZE;
- for(s16 z=0; z<MAP_BLOCKSIZE; z++)
- for(s16 y=0; y<MAP_BLOCKSIZE; y++)
- for(s16 x=0; x<MAP_BLOCKSIZE; x++)
+ // Create selection mesh
+ v3s16 p = data->m_highlighted_pos_relative;
+ if (data->m_show_hud &
+ (p.X >= 0) & (p.X < MAP_BLOCKSIZE) &
+ (p.Y >= 0) & (p.Y < MAP_BLOCKSIZE) &
+ (p.Z >= 0) & (p.Z < MAP_BLOCKSIZE)) {
+
+ MapNode n = data->m_vmanip.getNodeNoEx(blockpos_nodes + p);
+ // Get selection mesh light level
+ static const v3s16 dirs[7] = {
+ v3s16( 0, 0, 0),
+ v3s16( 0, 1, 0),
+ v3s16( 0,-1, 0),
+ v3s16( 1, 0, 0),
+ v3s16(-1, 0, 0),
+ v3s16( 0, 0, 1),
+ v3s16( 0, 0,-1)
+ };
+
+ u16 l = 0;
+ u16 l1 = 0;
+ for (u8 i = 0; i < 7; i++) {
+ MapNode n1 = data->m_vmanip.getNodeNoEx(blockpos_nodes + p + dirs[i]);
+ l1 = getInteriorLight(n1, -4, nodedef);
+ if (l1 > l)
+ l = l1;
+ }
+ video::SColor c = MapBlock_LightColor(255, l, 0);
+ data->m_highlight_mesh_color = c;
+ std::vector<aabb3f> boxes = n.getSelectionBoxes(nodedef);
+ TileSpec h_tile;
+ h_tile.material_flags |= MATERIAL_FLAG_HIGHLIGHTED;
+ h_tile.texture = tsrc->getTexture("halo.png",&h_tile.texture_id);
+ v3f pos = intToFloat(p, BS);
+ f32 d = 0.05 * BS;
+ for(std::vector<aabb3f>::iterator
+ i = boxes.begin();
+ i != boxes.end(); i++)
+ {
+ aabb3f box = *i;
+ box.MinEdge += v3f(-d, -d, -d) + pos;
+ box.MaxEdge += v3f(d, d, d) + pos;
+ makeCuboid(&collector, box, &h_tile, 1, c, NULL);
+ }
+ }
+
+ for(s16 z = 0; z < MAP_BLOCKSIZE; z++)
+ for(s16 y = 0; y < MAP_BLOCKSIZE; y++)
+ for(s16 x = 0; x < MAP_BLOCKSIZE; x++)
{
v3s16 p(x,y,z);
- MapNode n = data->m_vmanip.getNodeNoEx(blockpos_nodes+p);
+ MapNode n = data->m_vmanip.getNodeNoEx(blockpos_nodes + p);
const ContentFeatures &f = nodedef->get(n);
// Only solidness=0 stuff is drawn here
if(f.solidness != 0)
continue;
-
+
switch(f.drawtype){
default:
infostream<<"Got "<<f.drawtype<<std::endl;
top_is_same_liquid = true;
u16 l = getInteriorLight(n, 0, nodedef);
- video::SColor c = MapBlock_LightColor(f.alpha, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(f.alpha, l, f.light_source);
/*
Generate sides
// it at what it emits, for an increased effect
u8 light_source = nodedef->get(n).light_source;
if(light_source != 0){
- //l = decode_light(undiminish_light(light_source));
l = decode_light(light_source);
l = l | (l<<8);
}
// Otherwise use the light of this node (the liquid)
else
l = getInteriorLight(n, 0, nodedef);
- video::SColor c = MapBlock_LightColor(f.alpha, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(f.alpha, l, f.light_source);
u8 range = rangelim(nodedef->get(c_flowing).liquid_range, 1, 8);
TileSpec tile = getNodeTile(n, p, v3s16(0,0,0), data);
u16 l = getInteriorLight(n, 1, nodedef);
- video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
for(u32 j=0; j<6; j++)
{
param2 = param2 & 63;
u16 l = getInteriorLight(n, 1, nodedef);
- video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
v3f pos = intToFloat(p, BS);
static const float a = BS / 2;
static const float g = a - 0.003;
makeCuboid(&collector, box, &glass_tiles[i], 1, c, txc2);
}
- if (param2 > 0){
+ if (param2 > 0 && f.special_tiles[0].texture) {
// Interior volume level is in range 0 .. 63,
// convert it to -0.5 .. 0.5
float vlev = (((float)param2 / 63.0 ) * 2.0 - 1.0);
v3s16(0,0,0), data);
u16 l = getInteriorLight(n, 1, nodedef);
- video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
v3f pos = intToFloat(p, BS);
aabb3f box(-BS/2,-BS/2,-BS/2,BS/2,BS/2,BS/2);
tile.material_flags |= MATERIAL_FLAG_CRACK_OVERLAY;
u16 l = getInteriorLight(n, 1, nodedef);
- video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
float s = BS/2*f.visual_scale;
// Wall at X+ of node
tile.material_flags |= MATERIAL_FLAG_CRACK_OVERLAY;
u16 l = getInteriorLight(n, 0, nodedef);
- video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
float d = (float)BS/16;
float s = BS/2*f.visual_scale;
tile.material_flags |= MATERIAL_FLAG_CRACK_OVERLAY;
u16 l = getInteriorLight(n, 1, nodedef);
- video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
float s = BS/2*f.visual_scale;
if(j == 0)
{
for(u16 i=0; i<4; i++)
- vertices[i].Pos.rotateXZBy(45);
+ vertices[i].Pos.rotateXZBy(46 + n.param2 * 2);
}
else if(j == 1)
{
for(u16 i=0; i<4; i++)
- vertices[i].Pos.rotateXZBy(-45);
+ vertices[i].Pos.rotateXZBy(-44 + n.param2 * 2);
}
for(u16 i=0; i<4; i++)
TileSpec tile = getNodeTile(n, p, v3s16(0,0,0), data);
TileSpec tile_nocrack = tile;
tile_nocrack.material_flags &= ~MATERIAL_FLAG_CRACK;
-
- // A hack to put wood the right way around in the posts
- ITextureSource *tsrc = data->m_gamedef->tsrc();
- std::string texturestring_rot = tsrc->getTextureName(
- tile.texture_id) + "^[transformR90";
+
+ // Put wood the right way around in the posts
TileSpec tile_rot = tile;
- tile_rot.texture = tsrc->getTexture(
- texturestring_rot,
- &tile_rot.texture_id);
-
+ tile_rot.rotation = 1;
+
u16 l = getInteriorLight(n, 1, nodedef);
- video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
const f32 post_rad=(f32)BS/8;
const f32 bar_rad=(f32)BS/16;
tile.material_flags |= MATERIAL_FLAG_CRACK_OVERLAY;
u16 l = getInteriorLight(n, 0, nodedef);
- video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
float d = (float)BS/64;
};
TileSpec tiles[6];
- u16 l = getInteriorLight(n, 0, nodedef);
- video::SColor c = MapBlock_LightColor(255, l, decode_light(f.light_source));
+ u16 l = getInteriorLight(n, 1, nodedef);
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
v3f pos = intToFloat(p, BS);