aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorezhh <owlecho@live.com>2017-05-11 23:18:36 +0100
committerCraig Robbins <kde.psych@gmail.com>2017-05-15 19:51:40 +1000
commit018217f6b2058db44b59a86e170614e1c6925f9f (patch)
tree9a7c4256f8edc44db86c6f787d9abc0a5147e605 /src
parentfebd07fc0dea400db17ab84dd9fcb4d64e3ce9e3 (diff)
downloadminetest-018217f6b2058db44b59a86e170614e1c6925f9f.tar.gz
minetest-018217f6b2058db44b59a86e170614e1c6925f9f.tar.bz2
minetest-018217f6b2058db44b59a86e170614e1c6925f9f.zip
Add option to use neither node highlighting nor outlining
Diffstat (limited to 'src')
-rw-r--r--src/hud.cpp25
-rw-r--r--src/hud.h6
2 files changed, 21 insertions, 10 deletions
diff --git a/src/hud.cpp b/src/hud.cpp
index 9729013ee..3e4162b64 100644
--- a/src/hud.cpp
+++ b/src/hud.cpp
@@ -87,24 +87,31 @@ Hud::Hud(video::IVideoDriver *driver, scene::ISceneManager* smgr,
m_halo_boxes.clear();
m_selection_pos = v3f(0.0, 0.0, 0.0);
- std::string mode = g_settings->get("node_highlighting");
+ std::string mode_setting = g_settings->get("node_highlighting");
+
+ if (mode_setting == "halo") {
+ m_mode = HIGHLIGHT_HALO;
+ } else if (mode_setting == "none") {
+ m_mode = HIGHLIGHT_NONE;
+ } else {
+ m_mode = HIGHLIGHT_BOX;
+ }
+
m_selection_material.Lighting = false;
if (g_settings->getBool("enable_shaders")) {
IShaderSource *shdrsrc = client->getShaderSource();
u16 shader_id = shdrsrc->getShader(
- mode == "halo" ? "selection_shader" : "default_shader", 1, 1);
+ m_mode == HIGHLIGHT_HALO ? "selection_shader" : "default_shader", 1, 1);
m_selection_material.MaterialType = shdrsrc->getShaderInfo(shader_id).material;
} else {
m_selection_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
}
- if (mode == "box") {
- m_use_selection_mesh = false;
+ if (m_mode == HIGHLIGHT_BOX) {
m_selection_material.Thickness =
rangelim(g_settings->getS16("selectionbox_width"), 1, 5);
- } else if (mode == "halo") {
- m_use_selection_mesh = true;
+ } else if (m_mode == HIGHLIGHT_HALO) {
m_selection_material.setTexture(0, tsrc->getTextureForMesh("halo.png"));
m_selection_material.setFlag(video::EMF_BACK_FACE_CULLING, true);
} else {
@@ -518,7 +525,7 @@ void Hud::setSelectionPos(const v3f &pos, const v3s16 &camera_offset)
void Hud::drawSelectionMesh()
{
- if (!m_use_selection_mesh) {
+ if (m_mode == HIGHLIGHT_BOX) {
// Draw 3D selection boxes
video::SMaterial oldmaterial = driver->getMaterial2D();
driver->setMaterial(m_selection_material);
@@ -538,7 +545,7 @@ void Hud::drawSelectionMesh()
driver->draw3DBox(box, video::SColor(255, r, g, b));
}
driver->setMaterial(oldmaterial);
- } else if (m_selection_mesh) {
+ } else if (m_mode == HIGHLIGHT_HALO && m_selection_mesh) {
// Draw selection mesh
video::SMaterial oldmaterial = driver->getMaterial2D();
driver->setMaterial(m_selection_material);
@@ -564,7 +571,7 @@ void Hud::drawSelectionMesh()
void Hud::updateSelectionMesh(const v3s16 &camera_offset)
{
m_camera_offset = camera_offset;
- if (!m_use_selection_mesh)
+ if (m_mode != HIGHLIGHT_HALO)
return;
if (m_selection_mesh) {
diff --git a/src/hud.h b/src/hud.h
index efa0c3648..15c115d89 100644
--- a/src/hud.h
+++ b/src/hud.h
@@ -175,7 +175,11 @@ private:
v3f m_selected_face_normal;
video::SMaterial m_selection_material;
- bool m_use_selection_mesh;
+
+ enum {
+ HIGHLIGHT_BOX,
+ HIGHLIGHT_HALO,
+ HIGHLIGHT_NONE } m_mode;
};
enum ItemRotationKind {