jungle fern

This commit is contained in:
darkrose 2016-01-07 15:50:38 +10:00
parent e093eefb05
commit 0ad4b06a1b
9 changed files with 109 additions and 136 deletions

BIN
data/textures/leaf_big.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -2128,7 +2128,7 @@ void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &se
} }
} }
void meshgen_plantlike_custom(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected) void meshgen_plantlike_fern(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected)
{ {
if (data->mesh_detail < 3) { if (data->mesh_detail < 3) {
meshgen_plantlike(data,p,n,selected); meshgen_plantlike(data,p,n,selected);
@ -2175,134 +2175,86 @@ void meshgen_plantlike_custom(MeshMakeData *data, v3s16 p, MapNode &n, SelectedN
v3f pos = offset+intToFloat(p,BS)+pos_inner; v3f pos = offset+intToFloat(p,BS)+pos_inner;
std::vector<video::S3DVertex> vertices; std::vector<video::S3DVertex> vertices;
video::S3DVertex vb[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, 1.0*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
video::S3DVertex(-0.5*BS, 1.0*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0())
};
video::S3DVertex vl[8] = {
// stalk
video::S3DVertex( 0.5*data->m_BS, 0. *data->m_BS,0.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 1.,1.),
video::S3DVertex(-0.5*data->m_BS, 0. *data->m_BS,0.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 0.,1.),
video::S3DVertex(-0.5*data->m_BS, 0.5 *data->m_BS,1.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 0.,0.3),
video::S3DVertex( 0.5*data->m_BS, 0.5 *data->m_BS,1.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 1.,0.3),
// end
video::S3DVertex( 0.5*data->m_BS, 0.5*data->m_BS, 1.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 1.,0.3),
video::S3DVertex(-0.5*data->m_BS, 0.5*data->m_BS, 1.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 0.,0.3),
video::S3DVertex(-0.5*data->m_BS, 0.25*data->m_BS,1.5*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 0.,0.),
video::S3DVertex( 0.5*data->m_BS, 0.25*data->m_BS,1.5*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 1.,0.)
};
s16 angle[4] = {
45,
-45,
135,
-135
};
float xo = 0;
if (selected.is_coloured || selected.has_crack)
xo = 0.005;
for (u32 j=0; j<2; j++) {
video::S3DVertex v1[4];
switch (n.getContent()) { for (u16 i=0; i<4; i++) {
case CONTENT_JUNGLEGRASS: v1[i] = vb[i];
{ v1[i].Pos.rotateXZBy(angle[j]);
video::S3DVertex vb[4] = { v1[i].Pos.X += xo;
video::S3DVertex(-0.5*BS,-0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y1()), vertices.push_back(v1[i]);
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, 1.0*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
video::S3DVertex(-0.5*BS, 1.0*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0())
};
video::S3DVertex vl[8] = {
// stalk
video::S3DVertex( 0.5*data->m_BS, 0. *data->m_BS,0.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 1.,1.),
video::S3DVertex(-0.5*data->m_BS, 0. *data->m_BS,0.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 0.,1.),
video::S3DVertex(-0.5*data->m_BS, 0.5 *data->m_BS,1.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 0.,0.3),
video::S3DVertex( 0.5*data->m_BS, 0.5 *data->m_BS,1.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 1.,0.3),
// end
video::S3DVertex( 0.5*data->m_BS, 0.5*data->m_BS, 1.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 1.,0.3),
video::S3DVertex(-0.5*data->m_BS, 0.5*data->m_BS, 1.*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 0.,0.3),
video::S3DVertex(-0.5*data->m_BS, 0.25*data->m_BS,1.5*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 0.,0.),
video::S3DVertex( 0.5*data->m_BS, 0.25*data->m_BS,1.5*data->m_BS, 0,0,0, video::SColor(255,255,255,255), 1.,0.)
};
s16 angle[4] = {
45,
-45,
135,
-135
};
float xo = 0;
if (selected.is_coloured || selected.has_crack)
xo = 0.005;
for (u32 j=0; j<2; j++) {
video::S3DVertex v1[4];
for (u16 i=0; i<4; i++) {
v1[i] = vb[i];
v1[i].Pos.rotateXZBy(angle[j]);
v1[i].Pos.X += xo;
vertices.push_back(v1[i]);
}
if (!selected.is_coloured && !selected.has_crack)
continue;
for (u16 i=0; i<4; i++) {
v1[i].Pos.X -= 0.01;
vertices.push_back(v1[i]);
}
} }
for (u32 j=0; j<4; j++) {
video::S3DVertex v1[8];
for (u16 i=0; i<8; i++) { if (!selected.is_coloured && !selected.has_crack)
v1[i] = vl[i]; continue;
v1[i].Pos.rotateXZBy(angle[j]); for (u16 i=0; i<4; i++) {
v1[i].Pos.Y += xo; v1[i].Pos.X -= 0.01;
v1[i].TCoords *= tile.texture.size; vertices.push_back(v1[i]);
v1[i].TCoords += tile.texture.pos;
vertices.push_back(v1[i]);
}
if (!selected.is_coloured && !selected.has_crack)
continue;
for (u16 i=0; i<8; i++) {
v1[i].Pos.Y -= 0.01;
vertices.push_back(v1[i]);
}
}
for (u32 j=0; j<4; j++) {
video::S3DVertex v1[8];
for (u16 i=0; i<8; i++) {
v1[i] = vl[i];
v1[i].Pos.rotateXZBy(angle[j]+45);
v1[i].Pos.Y += xo-(0.25*BS);
v1[i].TCoords *= tile.texture.size;
v1[i].TCoords += tile.texture.pos;
vertices.push_back(v1[i]);
}
if (!selected.is_coloured && !selected.has_crack)
continue;
for (u16 i=0; i<8; i++) {
v1[i].Pos.Y -= 0.01;
vertices.push_back(v1[i]);
}
} }
} }
break; for (u32 j=0; j<4; j++) {
default: video::S3DVertex v1[8];
if (selected.is_coloured || selected.has_crack) {
for (u32 j=0; j<2; j++) {
video::S3DVertex v[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, 0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
video::S3DVertex(-0.5*BS, 0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0())
};
s16 angle = 45; for (u16 i=0; i<8; i++) {
if (j == 1) v1[i] = vl[i];
angle = -45; v1[i].Pos.rotateXZBy(angle[j]);
v1[i].Pos.Y += xo;
v1[i].TCoords *= tile.texture.size;
v1[i].TCoords += tile.texture.pos;
vertices.push_back(v1[i]);
}
for (u16 i=0; i<4; i++) { if (!selected.is_coloured && !selected.has_crack)
v[i].Pos.rotateXZBy(angle); continue;
v[i].Pos.X += 0.005; for (u16 i=0; i<8; i++) {
vertices.push_back(v[i]); v1[i].Pos.Y -= 0.01;
v[i].Pos.X -= 0.01; vertices.push_back(v1[i]);
vertices.push_back(v[i]); }
} }
} for (u32 j=0; j<4; j++) {
}else{ video::S3DVertex v1[8];
for (u32 j=0; j<2; j++) {
video::S3DVertex v[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, 0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x1(), tile.texture.y0()),
video::S3DVertex(-0.5*BS, 0.5*BS,0., 0,0,0, video::SColor(255,255,255,255), tile.texture.x0(), tile.texture.y0())
};
s16 angle = 45; for (u16 i=0; i<8; i++) {
if (j == 1) v1[i] = vl[i];
angle = -45; v1[i].Pos.rotateXZBy(angle[j]+45);
v1[i].Pos.Y += xo-(0.25*BS);
v1[i].TCoords *= tile.texture.size;
v1[i].TCoords += tile.texture.pos;
vertices.push_back(v1[i]);
}
for (u16 i=0; i<4; i++) { if (!selected.is_coloured && !selected.has_crack)
v[i].Pos.rotateXZBy(angle); continue;
vertices.push_back(v[i]); for (u16 i=0; i<8; i++) {
} v1[i].Pos.Y -= 0.01;
} vertices.push_back(v1[i]);
} }
} }

View File

@ -36,7 +36,7 @@ void meshgen_cubelike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &sel
void meshgen_dirtlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected); void meshgen_dirtlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected);
void meshgen_raillike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected); void meshgen_raillike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected);
void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected); void meshgen_plantlike(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected);
void meshgen_plantlike_custom(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected); void meshgen_plantlike_fern(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected);
void meshgen_liquid(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected); void meshgen_liquid(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected);
void meshgen_liquid_source(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected); void meshgen_liquid_source(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected);
void meshgen_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected, bool meta); void meshgen_nodebox(MeshMakeData *data, v3s16 p, MapNode &n, SelectedNode &selected, bool meta);

View File

@ -101,7 +101,8 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
#define CONTENT_CHAIR_ENDR 0x082 #define CONTENT_CHAIR_ENDR 0x082
#define CONTENT_CHAIR_INNER 0x083 #define CONTENT_CHAIR_INNER 0x083
#define CONTENT_CHAIR_OUTER 0x084 #define CONTENT_CHAIR_OUTER 0x084
// FREE 0x085-0x7F6 #define CONTENT_JUNGLEFERN 0x085
// FREE 0x086-0x7F6
#define CONTENT_LEAVES_SNOWY 0x7F7 #define CONTENT_LEAVES_SNOWY 0x7F7
#define CONTENT_TRIMMED_LEAVES_AUTUMN 0x7F8 #define CONTENT_TRIMMED_LEAVES_AUTUMN 0x7F8
#define CONTENT_TRIMMED_LEAVES_WINTER 0x7F9 #define CONTENT_TRIMMED_LEAVES_WINTER 0x7F9

View File

@ -213,7 +213,29 @@ void content_mapnode_plants(bool repeat)
f->setAllTextureFlags(0); f->setAllTextureFlags(0);
f->light_propagates = true; f->light_propagates = true;
f->param_type = CPT_LIGHT; f->param_type = CPT_LIGHT;
f->draw_type = CDT_PLANTLIKE_CUSTOM; f->draw_type = CDT_PLANTLIKE_FERN;
f->air_equivalent = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->solidness = 0; // drawn separately, makes no faces
f->walkable = false;
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->type = CMT_PLANT;
f->hardness = 0.20;
f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0;
lists::add("creative",i);
i = CONTENT_JUNGLEFERN;
f = &content_features(i);
f->description = wgettext("Jungle Fern");
f->setInventoryTexture("junglegrass.png");
f->setAllTextures("junglegrass.png");
f->setTexture(1,"leaf_big.png");
f->setAllTextureFlags(0);
f->light_propagates = true;
f->param_type = CPT_LIGHT;
f->draw_type = CDT_PLANTLIKE_FERN;
f->air_equivalent = true; f->air_equivalent = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->solidness = 0; // drawn separately, makes no faces f->solidness = 0; // drawn separately, makes no faces

View File

@ -527,8 +527,8 @@ void MapBlockMesh::generate(MeshMakeData *data, v3s16 camera_offset, JMutex *mut
case CDT_PLANTLIKE: case CDT_PLANTLIKE:
meshgen_plantlike(data,p,n,selected); meshgen_plantlike(data,p,n,selected);
break; break;
case CDT_PLANTLIKE_CUSTOM: case CDT_PLANTLIKE_FERN:
meshgen_plantlike_custom(data,p,n,selected); meshgen_plantlike_fern(data,p,n,selected);
break; break;
case CDT_LIQUID: case CDT_LIQUID:
meshgen_liquid(data,p,n,selected); meshgen_liquid(data,p,n,selected);

View File

@ -2011,16 +2011,14 @@ void make_block(BlockMakeData *data)
if (vmanip.m_data[vmanip.m_area.index(p)].getContent() != CONTENT_AIR) if (vmanip.m_data[vmanip.m_area.index(p)].getContent() != CONTENT_AIR)
continue; continue;
if (vmanip.m_area.contains(p)) { if (vmanip.m_area.contains(p)) {
if (y > 20 || y < 10) { if ((y > 20 || y < 10) && myrand_range(0,20) == 0) {
if (myrand_range(0,20) == 0) { if (y > 20) {
if (y > 20) { vmanip.m_data[vmanip.m_area.index(p)] = CONTENT_TEA;
vmanip.m_data[vmanip.m_area.index(p)] = CONTENT_TEA;
}else{
vmanip.m_data[vmanip.m_area.index(p)] = CONTENT_COFFEE;
}
}else{ }else{
vmanip.m_data[vmanip.m_area.index(p)] = CONTENT_JUNGLEGRASS; vmanip.m_data[vmanip.m_area.index(p)] = CONTENT_COFFEE;
} }
}else if (myrand_range(0,3) == 0) {
vmanip.m_data[vmanip.m_area.index(p)] = CONTENT_JUNGLEFERN;
}else{ }else{
vmanip.m_data[vmanip.m_area.index(p)] = CONTENT_JUNGLEGRASS; vmanip.m_data[vmanip.m_area.index(p)] = CONTENT_JUNGLEGRASS;
} }

View File

@ -101,7 +101,7 @@ enum ContentDrawType
CDT_CUBELIKE, CDT_CUBELIKE,
CDT_RAILLIKE, CDT_RAILLIKE,
CDT_PLANTLIKE, CDT_PLANTLIKE,
CDT_PLANTLIKE_CUSTOM, CDT_PLANTLIKE_FERN,
CDT_MELONLIKE, CDT_MELONLIKE,
CDT_LIQUID, CDT_LIQUID,
CDT_LIQUID_SOURCE, CDT_LIQUID_SOURCE,

View File

@ -195,8 +195,8 @@ void SelectionMesh::generate(MeshMakeData *data)
case CDT_PLANTLIKE: case CDT_PLANTLIKE:
meshgen_plantlike(data,p,n,selected); meshgen_plantlike(data,p,n,selected);
break; break;
case CDT_PLANTLIKE_CUSTOM: case CDT_PLANTLIKE_FERN:
meshgen_plantlike_custom(data,p,n,selected); meshgen_plantlike_fern(data,p,n,selected);
break; break;
case CDT_LIQUID: case CDT_LIQUID:
meshgen_liquid(data,p,n,selected); meshgen_liquid(data,p,n,selected);