forked from oerkki/voxelands
wastelands pt1
This commit is contained in:
parent
0c6602bcc0
commit
bf3f2434de
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -1088,6 +1088,7 @@ void meshgen_dirtlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &sel
|
||||||
* 1 - spring grass
|
* 1 - spring grass
|
||||||
* 2 - autumn grass
|
* 2 - autumn grass
|
||||||
* 4 - snow
|
* 4 - snow
|
||||||
|
* 6 - polluted grass
|
||||||
* 8 - jungle grass
|
* 8 - jungle grass
|
||||||
*
|
*
|
||||||
* param2:
|
* param2:
|
||||||
|
@ -1177,6 +1178,15 @@ void meshgen_dirtlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &sel
|
||||||
sidetile.texture = g_texturesource->getTexture("grass_side_jungle.png");
|
sidetile.texture = g_texturesource->getTexture("grass_side_jungle.png");
|
||||||
upstile.texture = g_texturesource->getTexture("grass_corner_jungle.png");
|
upstile.texture = g_texturesource->getTexture("grass_corner_jungle.png");
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
tex = "grass_polluted.png";
|
||||||
|
if (data->mesh_detail > 2) {
|
||||||
|
for (int i=0; i<6; i++) {
|
||||||
|
o_faces[i] = faces[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sidetile.texture = g_texturesource->getTexture("grass_side_polluted.png");
|
||||||
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
tex = "snow.png";
|
tex = "snow.png";
|
||||||
if (data->mesh_detail > 2) {
|
if (data->mesh_detail > 2) {
|
||||||
|
|
13
src/game.cpp
13
src/game.cpp
|
@ -1865,8 +1865,15 @@ void the_game(
|
||||||
float time_brightness = (float)decode_light((daynight_ratio * LIGHT_SUN) / 1000) / 255.0;
|
float time_brightness = (float)decode_light((daynight_ratio * LIGHT_SUN) / 1000) / 255.0;
|
||||||
float direct_brightness = 0;
|
float direct_brightness = 0;
|
||||||
bool sunlight_seen = false;
|
bool sunlight_seen = false;
|
||||||
bool in_space = (client.getLocalPlayer()->getPosition().Y>(1024*BS));
|
uint8_t biome = BIOME_UNKNOWN;
|
||||||
if (in_space || free_move) {
|
{
|
||||||
|
v3f pp = client.getLocalPlayer()->getPosition();
|
||||||
|
v3s16 ppos = floatToInt(pp,BS);
|
||||||
|
MapBlock *block = client.getEnv().getMap().getBlockNoCreateNoEx(getNodeBlockPos(ppos));
|
||||||
|
if (block != NULL)
|
||||||
|
biome = block->getBiome();
|
||||||
|
}
|
||||||
|
if (biome == BIOME_SPACE || free_move) {
|
||||||
direct_brightness = time_brightness;
|
direct_brightness = time_brightness;
|
||||||
sunlight_seen = true;
|
sunlight_seen = true;
|
||||||
}else{
|
}else{
|
||||||
|
@ -1898,7 +1905,7 @@ void the_game(
|
||||||
|
|
||||||
float moon_phase = client.getEnv().getMoonPhase();
|
float moon_phase = client.getEnv().getMoonPhase();
|
||||||
|
|
||||||
sky->update(time_of_day_smooth, moon_phase, time_brightness, direct_brightness, sunlight_seen, in_space);
|
sky->update(time_of_day_smooth, moon_phase, time_brightness, direct_brightness, sunlight_seen, biome);
|
||||||
|
|
||||||
video::SColor bgcolor = sky->getBgColor();
|
video::SColor bgcolor = sky->getBgColor();
|
||||||
video::SColor skycolor = sky->getSkyColor();
|
video::SColor skycolor = sky->getSkyColor();
|
||||||
|
|
|
@ -879,6 +879,9 @@ void hud_draw(
|
||||||
case BIOME_SKY:
|
case BIOME_SKY:
|
||||||
txt += L"Sky";
|
txt += L"Sky";
|
||||||
break;
|
break;
|
||||||
|
case BIOME_WASTELANDS:
|
||||||
|
txt += L"Wastelands";
|
||||||
|
break;
|
||||||
case BIOME_UNKNOWN:
|
case BIOME_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
txt += L"Unknown";
|
txt += L"Unknown";
|
||||||
|
|
|
@ -72,8 +72,9 @@ class ServerEnvironment;
|
||||||
#define BIOME_SPACE 10
|
#define BIOME_SPACE 10
|
||||||
#define BIOME_THEDEEP 11
|
#define BIOME_THEDEEP 11
|
||||||
#define BIOME_SKY 12
|
#define BIOME_SKY 12
|
||||||
|
#define BIOME_WASTELANDS 13
|
||||||
|
|
||||||
#define BIOME_COUNT 13
|
#define BIOME_COUNT 14
|
||||||
|
|
||||||
enum MapEditEventType{
|
enum MapEditEventType{
|
||||||
// Node added (changed from air or something else to something)
|
// Node added (changed from air or something else to something)
|
||||||
|
|
|
@ -148,7 +148,7 @@ void make_block(BlockMakeData *data)
|
||||||
|
|
||||||
bool limestone = (noisebuf_ground_wetness.get(node_min.X+8,node_min.Y+8,node_min.Z+8) > 0.5);
|
bool limestone = (noisebuf_ground_wetness.get(node_min.X+8,node_min.Y+8,node_min.Z+8) > 0.5);
|
||||||
content_t base_content = CONTENT_STONE;
|
content_t base_content = CONTENT_STONE;
|
||||||
if (limestone)
|
if (limestone && data->biome != BIOME_WASTELANDS)
|
||||||
base_content = CONTENT_LIMESTONE;
|
base_content = CONTENT_LIMESTONE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -496,6 +496,8 @@ void make_block(BlockMakeData *data)
|
||||||
}else if (current_depth==0 && !water_detected && y >= WATER_LEVEL && air_detected) {
|
}else if (current_depth==0 && !water_detected && y >= WATER_LEVEL && air_detected) {
|
||||||
if (biome == BIOME_SNOWCAP) {
|
if (biome == BIOME_SNOWCAP) {
|
||||||
vmanip.m_data[i] = MapNode(CONTENT_MUD,0x04);
|
vmanip.m_data[i] = MapNode(CONTENT_MUD,0x04);
|
||||||
|
}else if (biome == BIOME_WASTELANDS) {
|
||||||
|
vmanip.m_data[i] = MapNode(CONTENT_MUD,0x06);
|
||||||
}else if (biome == BIOME_JUNGLE) {
|
}else if (biome == BIOME_JUNGLE) {
|
||||||
if (noisebuf_ground_wetness.get(x,y,z) > 1.0) {
|
if (noisebuf_ground_wetness.get(x,y,z) > 1.0) {
|
||||||
vmanip.m_data[i] = MapNode(CONTENT_CLAY,0x08);
|
vmanip.m_data[i] = MapNode(CONTENT_CLAY,0x08);
|
||||||
|
@ -566,8 +568,15 @@ void make_block(BlockMakeData *data)
|
||||||
MapNode *n = &data->vmanip->m_data[i];
|
MapNode *n = &data->vmanip->m_data[i];
|
||||||
|
|
||||||
if (n->getContent() == CONTENT_MUD) {
|
if (n->getContent() == CONTENT_MUD) {
|
||||||
|
// just stumps in wastelands
|
||||||
|
if (data->biome == BIOME_WASTELANDS) {
|
||||||
|
p.Y++;
|
||||||
|
if (data->vmanip->m_area.contains(p)) {
|
||||||
|
u32 ip = data->vmanip->m_area.index(p);
|
||||||
|
vmanip.m_data[ip] = MapNode(CONTENT_TREE,0xE0);
|
||||||
|
}
|
||||||
// Papyrus grows only on mud and in water
|
// Papyrus grows only on mud and in water
|
||||||
if (y <= WATER_LEVEL) {
|
}else if (y <= WATER_LEVEL) {
|
||||||
p.Y++;
|
p.Y++;
|
||||||
make_papyrus(vmanip, p);
|
make_papyrus(vmanip, p);
|
||||||
// Trees grow only on mud and grass, on land
|
// Trees grow only on mud and grass, on land
|
||||||
|
@ -662,6 +671,10 @@ void make_block(BlockMakeData *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data->biome == BIOME_WASTELANDS) {
|
||||||
|
/* fallen meteor */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ uint32_t get_tree_density(BlockMakeData *data, v2s16 p)
|
||||||
}else if (data->biome == BIOME_LAKE || data->biome == BIOME_SNOWCAP || data->biome == BIOME_WOODLANDS) {
|
}else if (data->biome == BIOME_LAKE || data->biome == BIOME_SNOWCAP || data->biome == BIOME_WOODLANDS) {
|
||||||
if (r < 1)
|
if (r < 1)
|
||||||
r = 5;
|
r = 5;
|
||||||
}else if (data->biome == BIOME_PLAINS) {
|
}else if (data->biome == BIOME_PLAINS|| data->biome == BIOME_WASTELANDS) {
|
||||||
if (r)
|
if (r)
|
||||||
r /= 5;
|
r /= 5;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ uint32_t get_grass_density(BlockMakeData *data, v2s16 p)
|
||||||
double noise = 0.0;
|
double noise = 0.0;
|
||||||
uint32_t r = 0;
|
uint32_t r = 0;
|
||||||
|
|
||||||
if (data->biome == BIOME_DESERT || data->biome == BIOME_SNOWCAP || data->biome == BIOME_OCEAN)
|
if (data->biome == BIOME_DESERT || data->biome == BIOME_SNOWCAP || data->biome == BIOME_OCEAN || data->biome == BIOME_WASTELANDS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
noise = noise2d_perlin(
|
noise = noise2d_perlin(
|
||||||
|
@ -381,6 +381,9 @@ uint8_t get_chunk_biome(uint64_t seed, v3s16 blockpos)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (average_ground_height > 10) {
|
if (average_ground_height > 10) {
|
||||||
|
if (surface_humidity < 0.05) {
|
||||||
|
return BIOME_WASTELANDS;
|
||||||
|
}
|
||||||
if (surface_humidity < 0.25) {
|
if (surface_humidity < 0.25) {
|
||||||
return BIOME_DESERT;
|
return BIOME_DESERT;
|
||||||
}
|
}
|
||||||
|
|
44
src/sky.cpp
44
src/sky.cpp
|
@ -33,6 +33,7 @@
|
||||||
#include "noise.h" // easeCurve
|
#include "noise.h" // easeCurve
|
||||||
#include "main.h" // g_profiler
|
#include "main.h" // g_profiler
|
||||||
#include "profiler.h"
|
#include "profiler.h"
|
||||||
|
#include "map.h"
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id):
|
Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id):
|
||||||
|
@ -42,7 +43,7 @@ Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id):
|
||||||
m_cloud_brightness(0.5),
|
m_cloud_brightness(0.5),
|
||||||
m_moon_phase(0.0),
|
m_moon_phase(0.0),
|
||||||
m_moon_phase_pending(0.0),
|
m_moon_phase_pending(0.0),
|
||||||
m_space(false),
|
m_biome(BIOME_UNKNOWN),
|
||||||
m_bgcolor_bright_f(1,1,1,1),
|
m_bgcolor_bright_f(1,1,1,1),
|
||||||
m_skycolor_bright_f(1,0,0,0),
|
m_skycolor_bright_f(1,0,0,0),
|
||||||
m_cloudcolor_bright_f(1,1,1,1)
|
m_cloudcolor_bright_f(1,1,1,1)
|
||||||
|
@ -200,7 +201,7 @@ void Sky::render()
|
||||||
|
|
||||||
float f = 0.0;
|
float f = 0.0;
|
||||||
// Stars
|
// Stars
|
||||||
if (m_space) {
|
if (m_biome == BIOME_SPACE) {
|
||||||
f = 120.0;
|
f = 120.0;
|
||||||
}else{
|
}else{
|
||||||
float starbrightness = MYMAX(
|
float starbrightness = MYMAX(
|
||||||
|
@ -245,7 +246,7 @@ void Sky::update(
|
||||||
float time_brightness,
|
float time_brightness,
|
||||||
float direct_brightness,
|
float direct_brightness,
|
||||||
bool sunlight_seen,
|
bool sunlight_seen,
|
||||||
bool in_space
|
uint8_t biome
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Stabilize initial brightness and color values by flooding updates
|
// Stabilize initial brightness and color values by flooding updates
|
||||||
|
@ -253,7 +254,7 @@ void Sky::update(
|
||||||
m_first_update = false;
|
m_first_update = false;
|
||||||
m_moon_phase = moon_phase;
|
m_moon_phase = moon_phase;
|
||||||
for (u32 i=0; i<100; i++) {
|
for (u32 i=0; i<100; i++) {
|
||||||
update(time_of_day, moon_phase, time_brightness, direct_brightness, sunlight_seen, in_space);
|
update(time_of_day, moon_phase, time_brightness, direct_brightness, sunlight_seen, biome);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -263,22 +264,44 @@ void Sky::update(
|
||||||
m_time_brightness = time_brightness;
|
m_time_brightness = time_brightness;
|
||||||
m_sunlight_seen = sunlight_seen;
|
m_sunlight_seen = sunlight_seen;
|
||||||
|
|
||||||
m_space = in_space;
|
bool is_dull = false;
|
||||||
|
bool is_dawn = false;
|
||||||
|
|
||||||
bool is_dawn = (!in_space && time_brightness >= 0.20 && time_brightness < 0.50);
|
m_biome = biome;
|
||||||
|
|
||||||
|
if (biome != BIOME_SPACE && biome != BIOME_THEDEEP) {
|
||||||
|
if (biome == BIOME_WASTELANDS) {
|
||||||
|
is_dull = true;
|
||||||
|
}else if (time_brightness >= 0.20 && time_brightness < 0.50) {
|
||||||
|
is_dawn = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
video::SColorf bgcolor_bright_normal_f(170./255,200./255,230./255, 1.0);
|
video::SColorf bgcolor_bright_normal_f(170./255,200./255,230./255, 1.0);
|
||||||
video::SColorf bgcolor_bright_indoor_f(100./255,100./255,100./255, 1.0);
|
video::SColorf bgcolor_bright_indoor_f(100./255,100./255,100./255, 1.0);
|
||||||
video::SColorf bgcolor_bright_dawn_f(0.666*1.2,0.549*1.0,0.220*1.2,1.0);
|
video::SColorf bgcolor_bright_dawn_f(0.666*1.2,0.549*1.0,0.220*1.2,1.0);
|
||||||
|
|
||||||
|
video::SColorf skycolor_dull_f = video::SColor(255, 170,170,170);
|
||||||
video::SColorf skycolor_bright_normal_f = video::SColor(255, 121, 141, 232);
|
video::SColorf skycolor_bright_normal_f = video::SColor(255, 121, 141, 232);
|
||||||
video::SColorf skycolor_bright_dawn_f = video::SColor(255, 46, 60, 132);
|
video::SColorf skycolor_bright_dawn_f = video::SColor(255, 46, 60, 132);
|
||||||
|
|
||||||
|
video::SColorf cloudcolor_dull_f = video::SColor(255, 100,100,100);
|
||||||
video::SColorf cloudcolor_bright_normal_f = video::SColor(255, 240,240,255);
|
video::SColorf cloudcolor_bright_normal_f = video::SColor(255, 240,240,255);
|
||||||
video::SColorf cloudcolor_bright_dawn_f(1.0, 0.7, 0.5, 1.0);
|
video::SColorf cloudcolor_bright_dawn_f(1.0, 0.7, 0.5, 1.0);
|
||||||
|
|
||||||
if (in_space) {
|
m_clouds_visible = true;
|
||||||
|
if (biome == BIOME_SPACE) {
|
||||||
m_brightness = 0.02;
|
m_brightness = 0.02;
|
||||||
|
m_clouds_visible = false;
|
||||||
|
}else if (biome == BIOME_WASTELANDS) {
|
||||||
|
m_sunlight_seen = false;
|
||||||
|
m_brightness = m_brightness * 0.98 + direct_brightness * 0.02;
|
||||||
|
if (m_brightness > 0.25)
|
||||||
|
m_brightness = 0.25;
|
||||||
|
}else if (biome == BIOME_THEDEEP) {
|
||||||
|
m_sunlight_seen = false;
|
||||||
|
m_brightness = 0.02;
|
||||||
|
m_clouds_visible = false;
|
||||||
}else if (sunlight_seen) {
|
}else if (sunlight_seen) {
|
||||||
if (fabs(time_brightness - m_brightness) < 0.2) {
|
if (fabs(time_brightness - m_brightness) < 0.2) {
|
||||||
m_brightness = m_brightness * 0.95 + time_brightness * 0.05;
|
m_brightness = m_brightness * 0.95 + time_brightness * 0.05;
|
||||||
|
@ -291,9 +314,12 @@ void Sky::update(
|
||||||
m_brightness = m_brightness * 0.98 + direct_brightness * 0.02;
|
m_brightness = m_brightness * 0.98 + direct_brightness * 0.02;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_clouds_visible = !in_space;
|
|
||||||
float color_change_fraction = 0.98;
|
float color_change_fraction = 0.98;
|
||||||
if (sunlight_seen) {
|
if (is_dull) {
|
||||||
|
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(bgcolor_bright_indoor_f, color_change_fraction);
|
||||||
|
m_cloudcolor_bright_f = m_cloudcolor_bright_f.getInterpolated(cloudcolor_dull_f, color_change_fraction);
|
||||||
|
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(skycolor_dull_f, color_change_fraction);
|
||||||
|
}else if (sunlight_seen) {
|
||||||
if (is_dawn) {
|
if (is_dawn) {
|
||||||
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(bgcolor_bright_dawn_f, color_change_fraction);
|
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(bgcolor_bright_dawn_f, color_change_fraction);
|
||||||
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(skycolor_bright_dawn_f, color_change_fraction);
|
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(skycolor_bright_dawn_f, color_change_fraction);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
virtual u32 getMaterialCount() const
|
virtual u32 getMaterialCount() const
|
||||||
{ return SKY_MATERIAL_COUNT; }
|
{ return SKY_MATERIAL_COUNT; }
|
||||||
|
|
||||||
void update(float time_of_day, float moon_phase, float time_brightness, float direct_brightness, bool sunlight_seen, bool in_space);
|
void update(float time_of_day, float moon_phase, float time_brightness, float direct_brightness, bool sunlight_seen, uint8_t biome);
|
||||||
|
|
||||||
float getBrightness(){ return m_brightness; }
|
float getBrightness(){ return m_brightness; }
|
||||||
video::SColor getBgColor(){ return m_bgcolor; }
|
video::SColor getBgColor(){ return m_bgcolor; }
|
||||||
|
@ -76,7 +76,7 @@ private:
|
||||||
bool m_clouds_visible;
|
bool m_clouds_visible;
|
||||||
float m_moon_phase;
|
float m_moon_phase;
|
||||||
float m_moon_phase_pending;
|
float m_moon_phase_pending;
|
||||||
bool m_space;
|
uint8_t m_biome;
|
||||||
video::SColorf m_bgcolor_bright_f;
|
video::SColorf m_bgcolor_bright_f;
|
||||||
video::SColorf m_skycolor_bright_f;
|
video::SColorf m_skycolor_bright_f;
|
||||||
video::SColorf m_cloudcolor_bright_f;
|
video::SColorf m_cloudcolor_bright_f;
|
||||||
|
|
Loading…
Reference in New Issue