forked from oerkki/voxelands
new papyrus
This commit is contained in:
parent
bcb31e4316
commit
be099db744
Binary file not shown.
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 4.0 KiB |
|
@ -2049,25 +2049,37 @@ void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
|
|||
}
|
||||
}
|
||||
|
||||
f32 v = tile.texture.y0();
|
||||
f32 v0 = 0.;
|
||||
f32 v1 = 1.;
|
||||
f32 h = 0.5;
|
||||
if (f->param2_type == CPT_PLANTGROWTH) {
|
||||
if (n.param2 != 0 && !f->plantgrowth_on_trellis) {
|
||||
h = (0.0625*(float)n.param2);
|
||||
v = ((1.0-h)*tile.texture.size.Y)+tile.texture.y0();
|
||||
v0 = (1.0-h);
|
||||
h -= 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
if (f->plantlike_tiled) {
|
||||
if (data->m_vmanip.getNodeRO(data->m_blockpos_nodes + p + v3s16(0,-1,0)).getContent() != n.getContent()) {
|
||||
v0 = (1.0-(h/2.));
|
||||
}else if (data->m_vmanip.getNodeRO(data->m_blockpos_nodes + p + v3s16(0,1,0)).getContent() != n.getContent()) {
|
||||
v1 = 0.5;
|
||||
}else{
|
||||
v0 = (0.75-(h/2.));
|
||||
v1 = 0.75;
|
||||
}
|
||||
}
|
||||
|
||||
v3f pos = offset+intToFloat(p,BS)+pos_inner;
|
||||
|
||||
if (selected.is_coloured || selected.has_crack) {
|
||||
for (u32 j=0; j<2; j++) {
|
||||
video::S3DVertex vertices[4] = {
|
||||
video::S3DVertex(-0.5*BS,-0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
||||
video::S3DVertex( 0.5*BS,-0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
||||
video::S3DVertex( 0.5*BS, h*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), v),
|
||||
video::S3DVertex(-0.5*BS, h*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), v)
|
||||
video::S3DVertex(-0.5*BS,-0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), 0.,v1),
|
||||
video::S3DVertex( 0.5*BS,-0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), 1.,v1),
|
||||
video::S3DVertex( 0.5*BS, h*BS,0., 0,0,0, video::SColor(255,255,255,255), 1.,v0),
|
||||
video::S3DVertex(-0.5*BS, h*BS,0., 0,0,0, video::SColor(255,255,255,255), 0.,v0)
|
||||
};
|
||||
|
||||
s16 angle = 45;
|
||||
|
@ -2076,6 +2088,8 @@ void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
|
|||
|
||||
for (u16 i=0; i<4; i++) {
|
||||
vertices[i].Pos.rotateXZBy(angle);
|
||||
vertices[i].TCoords *= tile.texture.size;
|
||||
vertices[i].TCoords += tile.texture.pos;
|
||||
}
|
||||
|
||||
u16 indices[] = {0,1,2,2,3,0};
|
||||
|
@ -2102,10 +2116,10 @@ void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
|
|||
}else{
|
||||
for (u32 j=0; j<2; j++) {
|
||||
video::S3DVertex vertices[4] = {
|
||||
video::S3DVertex(-0.5*BS,-0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()),
|
||||
video::S3DVertex( 0.5*BS,-0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y1()),
|
||||
video::S3DVertex( 0.5*BS, h*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), v),
|
||||
video::S3DVertex(-0.5*BS, h*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), v)
|
||||
video::S3DVertex(-0.5*BS,-0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), 0.,v1),
|
||||
video::S3DVertex( 0.5*BS,-0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), 1.,v1),
|
||||
video::S3DVertex( 0.5*BS, h*BS,0., 0,0,0, video::SColor(255,255,255,255), 1.,v0),
|
||||
video::S3DVertex(-0.5*BS, h*BS,0., 0,0,0, video::SColor(255,255,255,255), 0.,v0)
|
||||
};
|
||||
|
||||
s16 angle = 45;
|
||||
|
@ -2114,6 +2128,8 @@ void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
|
|||
|
||||
for (u16 i=0; i<4; i++) {
|
||||
vertices[i].Pos.rotateXZBy(angle);
|
||||
vertices[i].TCoords *= tile.texture.size;
|
||||
vertices[i].TCoords += tile.texture.pos;
|
||||
}
|
||||
|
||||
u16 indices[] = {0,1,2,2,3,0};
|
||||
|
|
|
@ -897,6 +897,7 @@ void content_mapnode_plants(bool repeat)
|
|||
f->param_type = CPT_LIGHT;
|
||||
f->param2_type = CPT_PLANTGROWTH;
|
||||
f->draw_type = CDT_PLANTLIKE;
|
||||
f->plantlike_tiled = true;
|
||||
f->plantgrowth_large_dug_node = CONTENT_PAPYRUS;
|
||||
f->plantgrowth_large_count = 1;
|
||||
f->plantgrowth_max_height = 5;
|
||||
|
|
|
@ -1802,6 +1802,13 @@ void make_block(BlockMakeData *data)
|
|||
*/
|
||||
|
||||
if (minimum_ground_depth < 5 && maximum_ground_depth > -5) {
|
||||
|
||||
/*
|
||||
Calculate some stuff
|
||||
*/
|
||||
|
||||
float surface_humidity = surface_humidity_2d(data->seed, p2d_center);
|
||||
bool is_jungle = surface_humidity > 0.75;
|
||||
/*
|
||||
Add grass and mud
|
||||
*/
|
||||
|
@ -1838,7 +1845,7 @@ void make_block(BlockMakeData *data)
|
|||
air_detected || water_detected
|
||||
)
|
||||
) {
|
||||
if (current_depth == 0 && y <= WATER_LEVEL+2 && possibly_have_sand)
|
||||
if (current_depth == 0 && y <= WATER_LEVEL+2 && possibly_have_sand && !is_jungle)
|
||||
have_sand = true;
|
||||
|
||||
if (current_depth < 4) {
|
||||
|
@ -1872,13 +1879,6 @@ void make_block(BlockMakeData *data)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Calculate some stuff
|
||||
*/
|
||||
|
||||
float surface_humidity = surface_humidity_2d(data->seed, p2d_center);
|
||||
bool is_jungle = surface_humidity > 0.75;
|
||||
// Amount of trees
|
||||
u32 tree_count = block_area_nodes * tree_amount_2d(data->seed, p2d_center);
|
||||
if (is_jungle)
|
||||
|
@ -1921,57 +1921,48 @@ void make_block(BlockMakeData *data)
|
|||
u32 i = data->vmanip->m_area.index(p);
|
||||
MapNode *n = &data->vmanip->m_data[i];
|
||||
|
||||
if (
|
||||
n->getContent() != CONTENT_MUD
|
||||
&& n->getContent() != CONTENT_SAND
|
||||
)
|
||||
continue;
|
||||
|
||||
// Papyrus grows only on mud and in water
|
||||
if (n->getContent() == CONTENT_MUD && y <= WATER_LEVEL) {
|
||||
p.Y++;
|
||||
make_papyrus(vmanip, p);
|
||||
}
|
||||
// Trees grow only on mud and grass, on land
|
||||
else if (n->getContent() == CONTENT_MUD && y > WATER_LEVEL + 2) {
|
||||
p.Y++;
|
||||
if (is_jungle == false || y > 30) {
|
||||
// connifers
|
||||
if (y > 45) {
|
||||
make_conifertree(vmanip, p);
|
||||
// regular trees
|
||||
}else{
|
||||
if (myrand_range(0,10) != 0) {
|
||||
if (
|
||||
noise2d_perlin(
|
||||
0.5+(float)p.X/100,
|
||||
0.5+(float)p.Z/100,
|
||||
data->seed+342902,
|
||||
3,
|
||||
0.45
|
||||
) > 0.2
|
||||
) {
|
||||
make_appletree(vmanip, p);
|
||||
}else{
|
||||
make_tree(vmanip, p);
|
||||
}
|
||||
if (n->getContent() == CONTENT_MUD) {
|
||||
// Papyrus grows only on mud and in water
|
||||
if (y <= WATER_LEVEL) {
|
||||
p.Y++;
|
||||
make_papyrus(vmanip, p);
|
||||
// Trees grow only on mud and grass, on land
|
||||
}else if (y > (WATER_LEVEL+2)) {
|
||||
p.Y++;
|
||||
if (is_jungle == false || y > 30) {
|
||||
// connifers
|
||||
if (y > 45) {
|
||||
make_conifertree(vmanip, p);
|
||||
// regular trees
|
||||
}else{
|
||||
make_largetree(vmanip, p);
|
||||
if (myrand_range(0,10) != 0) {
|
||||
if (
|
||||
noise2d_perlin(
|
||||
0.5+(float)p.X/100,
|
||||
0.5+(float)p.Z/100,
|
||||
data->seed+342902,
|
||||
3,
|
||||
0.45
|
||||
) > 0.2
|
||||
) {
|
||||
make_appletree(vmanip, p);
|
||||
}else{
|
||||
make_tree(vmanip, p);
|
||||
}
|
||||
}else{
|
||||
make_largetree(vmanip, p);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
make_jungletree(vmanip, p);
|
||||
}
|
||||
}else{
|
||||
make_jungletree(vmanip, p);
|
||||
}
|
||||
}
|
||||
// connifers
|
||||
else if (n->getContent() == CONTENT_MUDSNOW) {
|
||||
p.Y++;
|
||||
make_conifertree(vmanip, p);
|
||||
}
|
||||
// Cactii grow only on sand, on land
|
||||
else if (n->getContent() == CONTENT_SAND && y > WATER_LEVEL + 2) {
|
||||
p.Y++;
|
||||
make_cactus(vmanip, p);
|
||||
}else if (n->getContent() == CONTENT_SAND) {
|
||||
if (y > (WATER_LEVEL+2)) {
|
||||
p.Y++;
|
||||
make_cactus(vmanip, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,6 +309,7 @@ struct ContentFeatures
|
|||
#endif
|
||||
|
||||
bool rotate_tile_with_nodebox;
|
||||
bool plantlike_tiled;
|
||||
bool wield_nodebox;
|
||||
std::wstring description;
|
||||
std::vector<NodeBox> nodeboxes;
|
||||
|
@ -507,6 +508,7 @@ struct ContentFeatures
|
|||
post_effect_color = video::SColor(0, 0, 0, 0);
|
||||
#endif
|
||||
rotate_tile_with_nodebox = false;
|
||||
plantlike_tiled = false;
|
||||
wield_nodebox = true;
|
||||
description = std::wstring(L"");
|
||||
nodeboxes.clear();
|
||||
|
|
Loading…
Reference in New Issue