diff --git a/src/noggit/MapView.cpp b/src/noggit/MapView.cpp index 0bf7f3ae..01815706 100755 --- a/src/noggit/MapView.cpp +++ b/src/noggit/MapView.cpp @@ -1881,6 +1881,13 @@ void MapView::setupViewMenu() _world->renderer()->markTerrainParamsUniformBlockDirty(); }); + ADD_TOGGLE_POST(view_menu, "Vertex Color", Qt::SHIFT | Qt::Key_F6, _draw_vertex_color, + [=] + { + _world->renderer()->getTerrainParamsUniformBlock()->draw_vertex_color = _draw_vertex_color.get(); + _world->renderer()->markTerrainParamsUniformBlockDirty(); + }); + ADD_TOGGLE (view_menu, "Toggle Animation", Qt::Key_F11, _draw_model_animations); ADD_TOGGLE (view_menu, "Draw fog", Qt::Key_F12, _draw_fog); ADD_TOGGLE_NS (view_menu, "Flight Bounds", _draw_mfbo); @@ -2083,6 +2090,7 @@ void MapView::setupHotkeys() alloff_doodads = _draw_wmo_doodads.get(); alloff_contour = _draw_contour.get(); alloff_climb = _draw_climb.get(); + alloff_vertex_color = _draw_vertex_color.get(); alloff_wmo = _draw_wmo.get(); alloff_fog = _draw_fog.get(); alloff_terrain = _draw_terrain.get(); @@ -2091,6 +2099,7 @@ void MapView::setupHotkeys() _draw_wmo_doodads.set (false); _draw_contour.set (true); _draw_climb.set (false); + _draw_vertex_color.set(true); _draw_wmo.set (false); _draw_terrain.set (true); _draw_fog.set (false); @@ -2101,6 +2110,7 @@ void MapView::setupHotkeys() _draw_wmo_doodads.set (alloff_doodads); _draw_contour.set (alloff_contour); _draw_climb.set(alloff_climb); + _draw_vertex_color.set(alloff_vertex_color); _draw_wmo.set (alloff_wmo); _draw_terrain.set (alloff_terrain); _draw_fog.set (alloff_fog); diff --git a/src/noggit/MapView.h b/src/noggit/MapView.h index 9d33eedf..06516a1c 100755 --- a/src/noggit/MapView.h +++ b/src/noggit/MapView.h @@ -136,6 +136,7 @@ private: void checkInputsSettings(); public: + Noggit::BoolToggleProperty _draw_vertex_color = {true}; Noggit::BoolToggleProperty _draw_climb = {false}; Noggit::BoolToggleProperty _draw_contour = {false}; Noggit::BoolToggleProperty _draw_mfbo = {false}; @@ -210,6 +211,7 @@ private: bool alloff_fog = false; bool alloff_terrain = false; bool alloff_climb = false; + bool alloff_vertex_color = false; editing_mode terrainMode = editing_mode::ground; editing_mode saveterrainMode = terrainMode; diff --git a/src/noggit/rendering/glsl/terrain_frag.glsl b/src/noggit/rendering/glsl/terrain_frag.glsl index 207bc6a0..679bcbee 100755 --- a/src/noggit/rendering/glsl/terrain_frag.glsl +++ b/src/noggit/rendering/glsl/terrain_frag.glsl @@ -32,6 +32,8 @@ layout (std140) uniform overlay_params int climb_use_output_angle; int climb_use_smooth_interpolation; float climb_value; + int draw_vertex_color; + int padding[3]; }; struct ChunkInstanceData @@ -253,7 +255,10 @@ void main() out_color.a = 1.0; // apply vertex color - out_color.rgb *= vary_mccv; + if (draw_vertex_color != 0) + { + out_color.rgb *= vary_mccv; + } // apply world lighting out_color.rgb = clamp(out_color.rgb * (currColor + lDiffuse + spc), 0.0, 1.0); diff --git a/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.cpp b/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.cpp index dd50cb52..4e31ed16 100755 --- a/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.cpp +++ b/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.cpp @@ -74,6 +74,7 @@ ViewToolbar::ViewToolbar(MapView *mapView, ViewToolbar *tb) add_tool_icon(mapView, &mapView->_draw_wireframe, tr("Wireframe"), FontNoggit::VISIBILITY_WIREFRAME, tb); add_tool_icon(mapView, &mapView->_draw_contour, tr("Contours"), FontNoggit::VISIBILITY_CONTOURS, tb); add_tool_icon(mapView, &mapView->_draw_climb, tr("Climb"), FontNoggit::FAVORITE, tb, tb->_climb_secondary_tool); + add_tool_icon(mapView, &mapView->_draw_vertex_color, tr("Vertex Color"), FontNoggit::FAVORITE, tb); addSeparator(); diff --git a/src/opengl/types.hpp b/src/opengl/types.hpp index 3bd13a83..3b56f4bd 100755 --- a/src/opengl/types.hpp +++ b/src/opengl/types.hpp @@ -57,6 +57,8 @@ namespace OpenGL int climb_use_output_angle = false; int climb_use_smooth_interpolation = false; float climb_value; + int draw_vertex_color = true; + int padding[3]; }; struct ChunkInstanceDataUniformBlock