diff options
author | RealBadAngel <maciej.kasatkin@o2.pl> | 2016-02-11 04:57:01 +0100 |
---|---|---|
committer | Kahrl <kahrl@gmx.net> | 2016-02-11 13:11:25 +0100 |
commit | 9357294cfc4c73aa5ccc56a34aae8834a4766378 (patch) | |
tree | 61c754637ffeac391ffa6d9c2e5d5a37f4c808d4 /src/mesh.cpp | |
parent | c1044b9a4a2eb45a0b71566bee59e5961708bebf (diff) | |
download | minetest-9357294cfc4c73aa5ccc56a34aae8834a4766378.tar.gz minetest-9357294cfc4c73aa5ccc56a34aae8834a4766378.tar.bz2 minetest-9357294cfc4c73aa5ccc56a34aae8834a4766378.zip |
Use single box for halo mesh
Diffstat (limited to 'src/mesh.cpp')
-rw-r--r-- | src/mesh.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/src/mesh.cpp b/src/mesh.cpp index d79f545f3..3c3932204 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -406,7 +406,7 @@ scene::IMesh* cloneMesh(scene::IMesh *src_mesh) } scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes, - const f32 *uv_coords) + const f32 *uv_coords, float expand) { scene::SMesh* dst_mesh = new scene::SMesh(); @@ -421,31 +421,19 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes, video::SColor c(255,255,255,255); - for(std::vector<aabb3f>::const_iterator + for (std::vector<aabb3f>::const_iterator i = boxes.begin(); i != boxes.end(); ++i) { aabb3f box = *i; - - f32 temp; - if (box.MinEdge.X > box.MaxEdge.X) - { - temp=box.MinEdge.X; - box.MinEdge.X=box.MaxEdge.X; - box.MaxEdge.X=temp; - } - if (box.MinEdge.Y > box.MaxEdge.Y) - { - temp=box.MinEdge.Y; - box.MinEdge.Y=box.MaxEdge.Y; - box.MaxEdge.Y=temp; - } - if (box.MinEdge.Z > box.MaxEdge.Z) - { - temp=box.MinEdge.Z; - box.MinEdge.Z=box.MaxEdge.Z; - box.MaxEdge.Z=temp; - } + box.repair(); + + box.MinEdge.X -= expand; + box.MinEdge.Y -= expand; + box.MinEdge.Z -= expand; + box.MaxEdge.X += expand; + box.MaxEdge.Y += expand; + box.MaxEdge.Z += expand; // Compute texture UV coords f32 tx1 = (box.MinEdge.X / BS) + 0.5; |