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;
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;
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);
// Boost light level for light sources
u8 light_source = MYMAX(ndef->get(n).light_source,
ndef->get(n2).light_source);
- //if(light_source >= light)
- //return decode_light(undiminish_light(light_source));
if(light_source > light)
- //return decode_light(light_source);
light = light_source;
return decode_light(light);
if(ambient_occlusion > 4)
{
- //ambient_occlusion -= 4;
- //light = (float)light / ((float)ambient_occlusion * 0.5 + 1.0);
- float light_amount = (8 - ambient_occlusion) / 4.0;
- float light_f = (float)light / 255.0;
- light_f = pow(light_f, 2.2f); // gamma -> linear space
- light_f = light_f * light_amount;
- light_f = pow(light_f, 1.0f/2.2f); // linear -> gamma space
- if(light_f > 1.0)
- light_f = 1.0;
- light = 255.0 * light_f + 0.5;
+ //calculate table index for gamma space multiplier
+ ambient_occlusion -= 5;
+ //table of precalculated gamma space multiply factors
+ //light^2.2 * factor (0.75, 0.5, 0.25, 0.0), so table holds factor ^ (1 / 2.2)
+ const float light_amount[4] = {0.877424315, 0.729740053, 0.532520545, 0.0};
+ light = core::clamp(core::round32(light*light_amount[ambient_occlusion]), 0, 255);
}
return light;
// Floating point conversion of the position vector
v3f pf(p_corrected.X, p_corrected.Y, p_corrected.Z);
// Center point of face (kind of)
- v3f sp = pf - ((f32)continuous_tiles_count / 2. - 0.5) * translate_dir_f;
+ v3f sp = pf - ((f32)continuous_tiles_count / 2.0 - 0.5) * translate_dir_f;
if(continuous_tiles_count != 1)
sp += translate_dir_f;
v3f scale(1,1,1);
- if(translate_dir.X != 0)
- {
+ if(translate_dir.X != 0) {
scale.X = continuous_tiles_count;
}
- if(translate_dir.Y != 0)
- {
+ if(translate_dir.Y != 0) {
scale.Y = continuous_tiles_count;
}
- if(translate_dir.Z != 0)
- {
+ if(translate_dir.Z != 0) {
scale.Z = continuous_tiles_count;
}
dest);
g_profiler->avg("Meshgen: faces drawn by tiling", 0);
- for(int i=1; i<continuous_tiles_count; i++){
+ for(int i = 1; i < continuous_tiles_count; i++){
g_profiler->avg("Meshgen: faces drawn by tiling", 1);
}
}
/*
Go through every y,z and get top(y+) faces in rows of x+
*/
- for(s16 y=0; y<MAP_BLOCKSIZE; y++){
- for(s16 z=0; z<MAP_BLOCKSIZE; z++){
+ for(s16 y = 0; y < MAP_BLOCKSIZE; y++) {
+ for(s16 z = 0; z < MAP_BLOCKSIZE; z++) {
updateFastFaceRow(data,
v3s16(0,y,z),
v3s16(1,0,0), //dir
/*
Go through every x,y and get right(x+) faces in rows of z+
*/
- for(s16 x=0; x<MAP_BLOCKSIZE; x++){
- for(s16 y=0; y<MAP_BLOCKSIZE; y++){
+ for(s16 x = 0; x < MAP_BLOCKSIZE; x++) {
+ for(s16 y = 0; y < MAP_BLOCKSIZE; y++) {
updateFastFaceRow(data,
v3s16(x,y,0),
v3s16(0,0,1), //dir
/*
Go through every y,z and get back(z+) faces in rows of x+
*/
- for(s16 z=0; z<MAP_BLOCKSIZE; z++){
- for(s16 y=0; y<MAP_BLOCKSIZE; y++){
+ for(s16 z = 0; z < MAP_BLOCKSIZE; z++) {
+ for(s16 y = 0; y < MAP_BLOCKSIZE; y++) {
updateFastFaceRow(data,
v3s16(0,y,z),
v3s16(1,0,0), //dir