#include "content_mapnode.h"
#include "main.h" // For g_settings and g_texturesource
#include "mineral.h"
+#include "mapblock_mesh.h" // For MapBlock_LightColor()
#ifndef SERVER
// Create a cuboid.
else if(n.d == CONTENT_SIGN_WALL)
{
u8 l = decode_light(n.getLightBlend(data->m_daynight_ratio));
- video::SColor c(255,l,l,l);
+ video::SColor c = MapBlock_LightColor(255, l);
float d = (float)BS/16;
// Wall at X+ of node
// Otherwise use the light of this node (the water)
else
l = decode_light(n.getLightBlend(data->m_daynight_ratio));
- video::SColor c(WATER_ALPHA,l,l,l);
+ video::SColor c = MapBlock_LightColor(WATER_ALPHA, l);
// Neighbor water levels (key = relative position)
// Includes current node
continue;
u8 l = decode_light(n.getLightBlend(data->m_daynight_ratio));
- video::SColor c(WATER_ALPHA,l,l,l);
+ video::SColor c = MapBlock_LightColor(WATER_ALPHA, l);
video::S3DVertex vertices[4] =
{
{
/*u8 l = decode_light(n.getLightBlend(data->m_daynight_ratio));*/
u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio)));
- video::SColor c(255,l,l,l);
+ video::SColor c = MapBlock_LightColor(255, l);
for(u32 j=0; j<6; j++)
{
else if(n.d == CONTENT_GLASS)
{
u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio)));
- video::SColor c(255,l,l,l);
+ video::SColor c = MapBlock_LightColor(255, l);
for(u32 j=0; j<6; j++)
{
else if(n.d == CONTENT_FENCE)
{
u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio)));
- video::SColor c(255,l,l,l);
+ video::SColor c = MapBlock_LightColor(255, l);
const f32 post_rad=(f32)BS/10;
const f32 bar_rad=(f32)BS/20;
else
l = 255;*/
u8 l = 255;
- video::SColor c(255,l,l,l);
+ video::SColor c = MapBlock_LightColor(255, l);
// Get the right texture
TileSpec ts = n.getTile(dir);
else if(n.d == CONTENT_PAPYRUS)
{
u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio)));
- video::SColor c(255,l,l,l);
+ video::SColor c = MapBlock_LightColor(255, l);
for(u32 j=0; j<4; j++)
{
else if(n.d == CONTENT_JUNGLEGRASS)
{
u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio)));
- video::SColor c(255,l,l,l);
+ video::SColor c = MapBlock_LightColor(255, l);
for(u32 j=0; j<4; j++)
{
else if(n.d == CONTENT_RAIL)
{
u8 l = decode_light(n.getLightBlend(data->m_daynight_ratio));
- video::SColor c(255,l,l,l);
+ video::SColor c = MapBlock_LightColor(255, l);
bool is_rail_x [] = { false, false }; /* x-1, x+1 */
bool is_rail_z [] = { false, false }; /* z-1, z+1 */
}
}
-inline video::SColor lightColor(u8 alpha, u8 light)
+video::SColor MapBlock_LightColor(u8 alpha, u8 light)
{
+#if 0
return video::SColor(alpha,light,light,light);
+#endif
+ //return video::SColor(alpha,light,light,MYMAX(0, (s16)light-25)+25);
+ /*return video::SColor(alpha,light,light,MYMAX(0,
+ pow((float)light/255.0, 0.8)*255.0));*/
+#if 1
+ // Emphase blue a bit in darker places
+ float lim = 80;
+ float power = 0.7;
+ if(light > lim)
+ return video::SColor(alpha,light,light,light);
+ else
+ return video::SColor(alpha,light,light,MYMAX(0,
+ pow((float)light/lim, power)*lim));
+#endif
}
struct FastFace
float w = tile.texture.size.X;
float h = tile.texture.size.Y;
- /*video::SColor c = lightColor(alpha, li);
+ /*video::SColor c = MapBlock_LightColor(alpha, li);
face.vertices[0] = video::S3DVertex(vertex_pos[0], v3f(0,1,0), c,
core::vector2d<f32>(x0+w*abs_scale, y0+h));
core::vector2d<f32>(x0+w*abs_scale, y0));*/
face.vertices[0] = video::S3DVertex(vertex_pos[0], v3f(0,1,0),
- lightColor(alpha, li0),
+ MapBlock_LightColor(alpha, li0),
core::vector2d<f32>(x0+w*abs_scale, y0+h));
face.vertices[1] = video::S3DVertex(vertex_pos[1], v3f(0,1,0),
- lightColor(alpha, li1),
+ MapBlock_LightColor(alpha, li1),
core::vector2d<f32>(x0, y0+h));
face.vertices[2] = video::S3DVertex(vertex_pos[2], v3f(0,1,0),
- lightColor(alpha, li2),
+ MapBlock_LightColor(alpha, li2),
core::vector2d<f32>(x0, y0));
face.vertices[3] = video::S3DVertex(vertex_pos[3], v3f(0,1,0),
- lightColor(alpha, li3),
+ MapBlock_LightColor(alpha, li3),
core::vector2d<f32>(x0+w*abs_scale, y0));
face.tile = tile;