Skip to content

Commit 86a0f56

Browse files
committedSep 18, 2014
Bugfix: don't highlight air nodes.
1 parent 58e6d25 commit 86a0f56

File tree

1 file changed

+36
-34
lines changed

1 file changed

+36
-34
lines changed
 

Diff for: ‎src/content_mapblock.cpp

+36-34
Original file line numberDiff line numberDiff line change
@@ -193,41 +193,43 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
193193
(p.Z >= 0) & (p.Z < MAP_BLOCKSIZE)) {
194194

195195
MapNode n = data->m_vmanip.getNodeNoEx(blockpos_nodes + p);
196-
// Get selection mesh light level
197-
static const v3s16 dirs[7] = {
198-
v3s16( 0, 0, 0),
199-
v3s16( 0, 1, 0),
200-
v3s16( 0,-1, 0),
201-
v3s16( 1, 0, 0),
202-
v3s16(-1, 0, 0),
203-
v3s16( 0, 0, 1),
204-
v3s16( 0, 0,-1)
205-
};
196+
if(n.getContent() != CONTENT_AIR) {
Has a conversation. Original line has a conversation.
197+
// Get selection mesh light level
198+
static const v3s16 dirs[7] = {
199+
v3s16( 0, 0, 0),
200+
v3s16( 0, 1, 0),
201+
v3s16( 0,-1, 0),
202+
v3s16( 1, 0, 0),
203+
v3s16(-1, 0, 0),
204+
v3s16( 0, 0, 1),
205+
v3s16( 0, 0,-1)
206+
};
206207

207-
u16 l = 0;
208-
u16 l1 = 0;
209-
for (u8 i = 0; i < 7; i++) {
210-
MapNode n1 = data->m_vmanip.getNodeNoEx(blockpos_nodes + p + dirs[i]);
211-
l1 = getInteriorLight(n1, -4, nodedef);
212-
if (l1 > l)
213-
l = l1;
214-
}
215-
video::SColor c = MapBlock_LightColor(255, l, 0);
216-
data->m_highlight_mesh_color = c;
217-
std::vector<aabb3f> boxes = n.getSelectionBoxes(nodedef);
218-
TileSpec h_tile;
219-
h_tile.material_flags |= MATERIAL_FLAG_HIGHLIGHTED;
220-
h_tile.texture = tsrc->getTexture("halo.png",&h_tile.texture_id);
221-
v3f pos = intToFloat(p, BS);
222-
f32 d = 0.05 * BS;
223-
for(std::vector<aabb3f>::iterator
224-
i = boxes.begin();
225-
i != boxes.end(); i++)
226-
{
227-
aabb3f box = *i;
228-
box.MinEdge += v3f(-d, -d, -d) + pos;
229-
box.MaxEdge += v3f(d, d, d) + pos;
230-
makeCuboid(&collector, box, &h_tile, 1, c, NULL);
208+
u16 l = 0;
209+
u16 l1 = 0;
210+
for (u8 i = 0; i < 7; i++) {
211+
MapNode n1 = data->m_vmanip.getNodeNoEx(blockpos_nodes + p + dirs[i]);
212+
l1 = getInteriorLight(n1, -4, nodedef);
213+
if (l1 > l)
214+
l = l1;
215+
}
216+
video::SColor c = MapBlock_LightColor(255, l, 0);
217+
data->m_highlight_mesh_color = c;
218+
std::vector<aabb3f> boxes = n.getSelectionBoxes(nodedef);
219+
TileSpec h_tile;
220+
h_tile.material_flags |= MATERIAL_FLAG_HIGHLIGHTED;
221+
h_tile.texture = tsrc->getTexture("halo.png",&h_tile.texture_id);
222+
v3f pos = intToFloat(p, BS);
223+
f32 d = 0.05 * BS;
224+
for(std::vector<aabb3f>::iterator
225+
i = boxes.begin();
226+
i != boxes.end(); i++)
227+
{
228+
aabb3f box = *i;
229+
box.MinEdge += v3f(-d, -d, -d) + pos;
230+
box.MaxEdge += v3f(d, d, d) + pos;
231+
makeCuboid(&collector, box, &h_tile, 1, c, NULL);
232+
}
231233
}
232234
}
233235

1 commit comments

Comments
 (1)

ShadowNinja commented on Sep 19, 2014

@ShadowNinja
Contributor

Nothing that you're not pointing at should be highlighted, that includes pointable = false nodes like air.

Please sign in to comment.