summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-12-14 00:29:32 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-12-14 00:29:32 +0200
commit47f76d8a5122767337f0c7b75c5c44a01c418141 (patch)
treefc9600d0b591806c73962c5b99306eb9a4b53426
parent626ed6338aa90eb07038adee29643e692fec6545 (diff)
downloadminetest-47f76d8a5122767337f0c7b75c5c44a01c418141.tar.gz
minetest-47f76d8a5122767337f0c7b75c5c44a01c418141.tar.bz2
minetest-47f76d8a5122767337f0c7b75c5c44a01c418141.zip
grass edges workin'
-rw-r--r--data/mud_with_grass.pngbin0 -> 1597 bytes
-rw-r--r--data/tree_top.pngbin0 -> 1024 bytes
-rw-r--r--src/mapblock.cpp42
-rw-r--r--src/mapblock.h2
4 files changed, 22 insertions, 22 deletions
diff --git a/data/mud_with_grass.png b/data/mud_with_grass.png
new file mode 100644
index 000000000..fe0d0af9b
--- /dev/null
+++ b/data/mud_with_grass.png
Binary files differ
diff --git a/data/tree_top.png b/data/tree_top.png
new file mode 100644
index 000000000..2cdd94f80
--- /dev/null
+++ b/data/tree_top.png
Binary files differ
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index 40af0e397..6dd524edd 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -69,7 +69,7 @@ void MapBlock::setNodeParent(v3s16 p, MapNode & n)
}
FastFace * MapBlock::makeFastFace(u16 tile, u8 light, v3f p,
- v3f dir, v3f scale, v3f posRelative_f)
+ v3s16 dir, v3f scale, v3f posRelative_f)
{
FastFace *f = new FastFace;
@@ -85,14 +85,21 @@ FastFace * MapBlock::makeFastFace(u16 tile, u8 light, v3f p,
vertex_pos[2] = v3f(-BS/2, BS/2,BS/2);
vertex_pos[3] = v3f( BS/2, BS/2,BS/2);
- /*
- TODO: Rotate it the right way (one side comes upside down)
- */
- core::CMatrix4<f32> m;
- m.buildRotateFromTo(v3f(0,0,1), dir);
-
- for(u16 i=0; i<4; i++){
- m.rotateVect(vertex_pos[i]);
+ for(u16 i=0; i<4; i++)
+ {
+ if(dir == v3s16(0,0,1))
+ vertex_pos[i].rotateXZBy(0);
+ else if(dir == v3s16(0,0,-1))
+ vertex_pos[i].rotateXZBy(180);
+ else if(dir == v3s16(1,0,0))
+ vertex_pos[i].rotateXZBy(-90);
+ else if(dir == v3s16(-1,0,0))
+ vertex_pos[i].rotateXZBy(90);
+ else if(dir == v3s16(0,1,0))
+ vertex_pos[i].rotateYZBy(-90);
+ else if(dir == v3s16(0,-1,0))
+ vertex_pos[i].rotateYZBy(90);
+
vertex_pos[i].X *= scale.X;
vertex_pos[i].Y *= scale.Y;
vertex_pos[i].Z *= scale.Z;
@@ -112,22 +119,15 @@ FastFace * MapBlock::makeFastFace(u16 tile, u8 light, v3f p,
u8 alpha = 255;
//if(material == CONTENT_WATER || material == CONTENT_OCEAN)
- if(tile == CONTENT_WATER || tile == CONTENT_OCEAN)
- //if(tile == TILE_WATER)
+ //TODO: Umm?
+ //if(tile == CONTENT_WATER || tile == CONTENT_OCEAN)
+ if(tile == TILE_WATER)
{
alpha = 128;
}
video::SColor c = video::SColor(alpha,li,li,li);
- /*f->vertices[0] = video::S3DVertex(vertex_pos[0], zerovector, c,
- core::vector2d<f32>(0,1));
- f->vertices[1] = video::S3DVertex(vertex_pos[1], zerovector, c,
- core::vector2d<f32>(abs_scale,1));
- f->vertices[2] = video::S3DVertex(vertex_pos[2], zerovector, c,
- core::vector2d<f32>(abs_scale,0));
- f->vertices[3] = video::S3DVertex(vertex_pos[3], zerovector, c,
- core::vector2d<f32>(0,0));*/
f->vertices[0] = video::S3DVertex(vertex_pos[0], zerovector, c,
core::vector2d<f32>(0,1));
f->vertices[1] = video::S3DVertex(vertex_pos[1], zerovector, c,
@@ -308,14 +308,14 @@ void MapBlock::updateFastFaceRow(v3s16 startpos,
if(mf == 1)
{
f = makeFastFace(tile0, light,
- sp, face_dir_f, scale,
+ sp, face_dir, scale,
posRelative_f);
}
// If node at sp is less solid (mf == 2)
else
{
f = makeFastFace(tile1, light,
- sp+face_dir_f, -1*face_dir_f, scale,
+ sp+face_dir_f, -face_dir, scale,
posRelative_f);
}
dest.push_back(f);
diff --git a/src/mapblock.h b/src/mapblock.h
index b9c5ff222..608249383 100644
--- a/src/mapblock.h
+++ b/src/mapblock.h
@@ -284,7 +284,7 @@ public:
}
static FastFace * makeFastFace(u16 tile, u8 light, v3f p,
- v3f dir, v3f scale, v3f posRelative_f);
+ v3s16 dir, v3f scale, v3f posRelative_f);
u8 getFaceLight(v3s16 p, v3s16 face_dir);