Revert "bagor 2"

This reverts commit 56177ccaac
This commit is contained in:
Skarn
2021-05-05 19:16:33 +00:00
parent 7384b6fdc3
commit 49da5f4a31
3 changed files with 21 additions and 23 deletions

View File

@@ -657,17 +657,17 @@ void MapChunk::draw ( math::frustum const& frustum
opengl::texture::set_active_texture(5);
shadow.bind();
mcnk_shader.uniform("layer_count", (int)texture_set->num());
mcnk_shader.uniform("cant_paint", (int)cantPaint);
mcnk_shader.uniform_cached("layer_count", (int)texture_set->num());
mcnk_shader.uniform_cached("cant_paint", (int)cantPaint);
if (draw_chunk_flag_overlay)
{
mcnk_shader.uniform ("draw_impassible_flag", (int)header_flags.flags.impass);
mcnk_shader.uniform_cached ("draw_impassible_flag", (int)header_flags.flags.impass);
}
if (draw_areaid_overlay)
{
mcnk_shader.uniform("areaid_color", (math::vector_4d)area_id_colors[areaID]);
mcnk_shader.uniform_cached("areaid_color", (math::vector_4d)area_id_colors[areaID]);
}
gl.bindVertexArray(_vao);

View File

@@ -1011,7 +1011,7 @@ void World::draw ( math::matrix_4x4 const& model_view
m2_shader.uniform("model_view", model_view);
m2_shader.uniform("projection", projection);
m2_shader.uniform("draw_fog", 0);
m2_shader.uniform_cached("draw_fog", 0);
m2_shader.uniform("light_dir", light_dir);
m2_shader.uniform("diffuse_color", diffuse_color);
@@ -1086,31 +1086,31 @@ void World::draw ( math::matrix_4x4 const& model_view
mcnk_shader.uniform("model_view", model_view);
mcnk_shader.uniform("projection", projection);
mcnk_shader.uniform("draw_lines", draw_lines);
mcnk_shader.uniform("draw_hole_lines", draw_hole_lines);
mcnk_shader.uniform("draw_areaid_overlay", draw_areaid_overlay);
mcnk_shader.uniform("draw_terrain_height_contour", draw_contour);
mcnk_shader.uniform_cached("draw_lines", draw_lines);
mcnk_shader.uniform_cached("draw_hole_lines", draw_hole_lines);
mcnk_shader.uniform_cached("draw_areaid_overlay", draw_areaid_overlay);
mcnk_shader.uniform_cached("draw_terrain_height_contour", draw_contour);
// the flag stays on if the last chunk drawn before leaving the editing tool has it
if (!draw_chunk_flag_overlay)
{
mcnk_shader.uniform("draw_impassible_flag", 0);
mcnk_shader.uniform_cached("draw_impassible_flag", 0);
}
mcnk_shader.uniform("draw_wireframe", draw_wireframe);
mcnk_shader.uniform_cached("draw_wireframe", draw_wireframe);
int wireframe_type = _settings->value("wireframe/type", 0).toInt();
mcnk_shader.uniform("wireframe_type", wireframe_type);
mcnk_shader.uniform_cached("wireframe_type", wireframe_type);
float wireframe_radius = _settings->value("wireframe/radius", 1.5f).toFloat();
mcnk_shader.uniform("wireframe_radius", wireframe_radius);
mcnk_shader.uniform_cached("wireframe_radius", wireframe_radius);
float wireframe_width = _settings->value ("wireframe/width", 1.f).toFloat();
mcnk_shader.uniform ("wireframe_width", wireframe_width);
mcnk_shader.uniform_cached ("wireframe_width", wireframe_width);
// !\ todo store the color somewhere ?
@@ -1118,7 +1118,7 @@ void World::draw ( math::matrix_4x4 const& model_view
math::vector_4d wireframe_color(c.redF(), c.greenF(), c.blueF(), c.alphaF());
mcnk_shader.uniform ("wireframe_color", wireframe_color);
mcnk_shader.uniform ("draw_fog", draw_fog);
mcnk_shader.uniform_cached ("draw_fog", draw_fog);
mcnk_shader.uniform ("fog_color", math::vector_4d(skies->color_set[FOG_COLOR], 1));
@@ -1130,16 +1130,16 @@ void World::draw ( math::matrix_4x4 const& model_view
if (cursor_type != CursorType::NONE)
{
mcnk_shader.uniform("draw_cursor_circle", static_cast<int>(cursor_type));
mcnk_shader.uniform_cached("draw_cursor_circle", static_cast<int>(cursor_type));
mcnk_shader.uniform ("cursor_position", cursor_pos);
mcnk_shader.uniform("cursorRotation", cursorRotation);
mcnk_shader.uniform ("outer_cursor_radius", brush_radius);
mcnk_shader.uniform_cached ("outer_cursor_radius", brush_radius);
mcnk_shader.uniform ("inner_cursor_ratio", inner_radius_ratio);
mcnk_shader.uniform ("cursor_color", cursor_color);
}
else
{
mcnk_shader.uniform("draw_cursor_circle", 0);
mcnk_shader.uniform_cached("draw_cursor_circle", 0);
}
std::vector<int> textures_bound = { -1, -1, -1, -1 };
@@ -1151,7 +1151,7 @@ void World::draw ( math::matrix_4x4 const& model_view
&& minimap_render_settings->selected_tiles.at(64 * tile->index.x + tile->index.z);
if (_draw_selection_old != draw_sel)
{
mcnk_shader.uniform("draw_selection", draw_sel);
mcnk_shader.uniform_cached("draw_selection", draw_sel);
_draw_selection_old = draw_sel;
}
@@ -1224,7 +1224,7 @@ void World::draw ( math::matrix_4x4 const& model_view
wmo_program.uniform("model_view", model_view);
wmo_program.uniform("projection", projection);
wmo_program.uniform("draw_fog", draw_fog);
wmo_program.uniform_cached("draw_fog", draw_fog);
if (draw_fog)
{
@@ -1289,7 +1289,7 @@ void World::draw ( math::matrix_4x4 const& model_view
m2_shader.uniform("fog_color", math::vector_4d(skies->color_set[FOG_COLOR], 1));
// !\ todo use light dbcs values
m2_shader.uniform("draw_fog", draw_fog);
m2_shader.uniform_cached("draw_fog", draw_fog);
m2_shader.uniform("light_dir", light_dir);
m2_shader.uniform("diffuse_color", diffuse_color);

View File

@@ -306,8 +306,6 @@ namespace opengl
GLuint use_program::uniform_location (std::string const& name)
{
return _program.uniform_location(name);
auto uniforms = _program.getUniforms();
auto it = uniforms->find(name);
if (it != uniforms->end())