mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Added Apple Trees
This commit is contained in:
parent
d28ea57083
commit
c0caedc373
6 changed files with 100 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
Minetest-c55
|
||||
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
|
@ -188,6 +188,16 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
AtlasPointer pa_papyrus = g_texturesource->getTexture(
|
||||
g_texturesource->getTextureId("papyrus.png"));
|
||||
material_papyrus.setTexture(0, pa_papyrus.atlas);
|
||||
|
||||
// Apple material
|
||||
video::SMaterial material_apple;
|
||||
material_apple.setFlag(video::EMF_LIGHTING, false);
|
||||
material_apple.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
material_apple.setFlag(video::EMF_FOG_ENABLE, true);
|
||||
material_apple.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
AtlasPointer pa_apple = g_texturesource->getTexture(
|
||||
g_texturesource->getTextureId("apple.png"));
|
||||
material_apple.setTexture(0, pa_apple.atlas);
|
||||
|
||||
// junglegrass material
|
||||
video::SMaterial material_junglegrass;
|
||||
|
@ -1203,6 +1213,56 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||
// Add to mesh collector
|
||||
collector.append(material_ladder, vertices, 4, indices, 6);
|
||||
}
|
||||
else if(n.getContent() == CONTENT_APPLE)
|
||||
{
|
||||
u8 l = decode_light(undiminish_light(n.getLightBlend(data->m_daynight_ratio)));
|
||||
video::SColor c = MapBlock_LightColor(255, l);
|
||||
|
||||
for(u32 j=0; j<4; j++)
|
||||
{
|
||||
video::S3DVertex vertices[4] =
|
||||
{
|
||||
video::S3DVertex(-BS/2,-BS/2,0, 0,0,0, c,
|
||||
pa_apple.x0(), pa_apple.y1()),
|
||||
video::S3DVertex(BS/2,-BS/2,0, 0,0,0, c,
|
||||
pa_apple.x1(), pa_apple.y1()),
|
||||
video::S3DVertex(BS/2,BS/2,0, 0,0,0, c,
|
||||
pa_apple.x1(), pa_apple.y0()),
|
||||
video::S3DVertex(-BS/2,BS/2,0, 0,0,0, c,
|
||||
pa_apple.x0(), pa_apple.y0()),
|
||||
};
|
||||
|
||||
if(j == 0)
|
||||
{
|
||||
for(u16 i=0; i<4; i++)
|
||||
vertices[i].Pos.rotateXZBy(45);
|
||||
}
|
||||
else if(j == 1)
|
||||
{
|
||||
for(u16 i=0; i<4; i++)
|
||||
vertices[i].Pos.rotateXZBy(-45);
|
||||
}
|
||||
else if(j == 2)
|
||||
{
|
||||
for(u16 i=0; i<4; i++)
|
||||
vertices[i].Pos.rotateXZBy(135);
|
||||
}
|
||||
else if(j == 3)
|
||||
{
|
||||
for(u16 i=0; i<4; i++)
|
||||
vertices[i].Pos.rotateXZBy(-135);
|
||||
}
|
||||
|
||||
for(u16 i=0; i<4; i++)
|
||||
{
|
||||
vertices[i].Pos += intToFloat(p + blockpos_nodes, BS);
|
||||
}
|
||||
|
||||
u16 indices[] = {0,1,2,2,3,0};
|
||||
// Add to mesh collector
|
||||
collector.append(material_apple, vertices, 4, indices, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue