16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

semaphore with stop signal marked on minimap, number of icons increased to 5

This commit is contained in:
milek7
2019-09-19 23:13:45 +02:00
parent 3b623c4506
commit 5d193b40ff
5 changed files with 18 additions and 7 deletions

View File

@@ -29,6 +29,7 @@ http://mozilla.org/MPL/2.0/.
#include "Driver.h" #include "Driver.h"
#include "Timer.h" #include "Timer.h"
#include "Logs.h" #include "Logs.h"
#include "widgets/map_objects.h"
void void
basic_event::event_conditions::bind( basic_event::node_sequence *Nodes ) { basic_event::event_conditions::bind( basic_event::node_sequence *Nodes ) {
@@ -453,6 +454,8 @@ updatevalues_event::run_() {
&location ); &location );
} }
} }
map::Objects.poi_dirty = true; // it could potentially change map icons
} }
// export_as_text() subclass details // export_as_text() subclass details

View File

@@ -1713,8 +1713,6 @@ void basic_region::create_map_geometry()
if (s) if (s)
s->create_map_geometry(m_map_geometrybank); s->create_map_geometry(m_map_geometrybank);
} }
update_poi_geometry();
} }
void basic_region::update_poi_geometry() void basic_region::update_poi_geometry()

View File

@@ -71,6 +71,7 @@ node_groups::update_map()
map::Objects.entries.push_back(sem_info); map::Objects.entries.push_back(sem_info);
sem_info->location = node->location(); sem_info->location = node->location();
sem_info->memcell = static_cast<TMemCell*>(node);
sem_info->name = sem_name; sem_info->name = sem_name;
for (basic_event *event : group.events) { for (basic_event *event : group.events) {

View File

@@ -143,6 +143,11 @@ void ui::map_panel::render_map_texture(glm::mat4 transform, glm::vec2 surface_si
scene_ubs.scene_extra = glm::vec3(1.0f / (surface_size / 200.0f), 1.0f); scene_ubs.scene_extra = glm::vec3(1.0f / (surface_size / 200.0f), 1.0f);
} }
if (map::Objects.poi_dirty) {
map::Objects.poi_dirty = false;
simulation::Region->update_poi_geometry();
}
scene_ubo->update(scene_ubs); scene_ubo->update(scene_ubs);
GfxRenderer.Draw_Geometry(simulation::Region->get_map_poi_geometry()); GfxRenderer.Draw_Geometry(simulation::Region->get_map_poi_geometry());
@@ -537,7 +542,7 @@ void ui::obstacle_remove_window::render_content()
} }
} }
simulation::Region->update_poi_geometry(); map::Objects.poi_dirty = true;
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }

View File

@@ -14,7 +14,7 @@ struct map_object
virtual ~map_object() = default; virtual ~map_object() = default;
virtual gfx::basic_vertex vertex() { virtual gfx::basic_vertex vertex() {
return gfx::basic_vertex(location, glm::vec3(), glm::vec2(0.0f, 0.25f)); return gfx::basic_vertex(location, glm::vec3(), glm::vec2(0.0f, 0.20f));
} }
}; };
@@ -26,9 +26,12 @@ struct semaphore : public map_object
{ {
std::vector<TAnimModel *> models; std::vector<TAnimModel *> models;
std::vector<basic_event *> events; std::vector<basic_event *> events;
TMemCell *memcell = nullptr;
virtual gfx::basic_vertex vertex() override { virtual gfx::basic_vertex vertex() override {
return gfx::basic_vertex(location, glm::vec3(), glm::vec2(0.0f, 0.25f)); bool stop_signal = memcell->IsVelocity() && (memcell->Value1() == 0.0);
return gfx::basic_vertex(location, glm::vec3(),
(!stop_signal) ? glm::vec2(0.0f, 0.2f) : glm::vec2(0.2f, 0.4f));
} }
}; };
@@ -45,7 +48,7 @@ struct launcher : public map_object
virtual gfx::basic_vertex vertex() { virtual gfx::basic_vertex vertex() {
return gfx::basic_vertex(location, glm::vec3(), return gfx::basic_vertex(location, glm::vec3(),
type == track_switch ? glm::vec2(0.25f, 0.5f) : glm::vec2(0.5f, 0.75f)); type == track_switch ? glm::vec2(0.4f, 0.6f) : glm::vec2(0.6f, 0.8f));
} }
}; };
@@ -55,7 +58,7 @@ struct obstacle : public map_object
std::string model_name; std::string model_name;
virtual gfx::basic_vertex vertex() { virtual gfx::basic_vertex vertex() {
return gfx::basic_vertex(location, glm::vec3(), glm::vec2(0.75f, 1.0f)); return gfx::basic_vertex(location, glm::vec3(), glm::vec2(0.8f, 1.0f));
} }
}; };
@@ -68,6 +71,7 @@ struct vehicle : public map_object
struct objects struct objects
{ {
std::vector<std::shared_ptr<map_object>> entries; std::vector<std::shared_ptr<map_object>> entries;
bool poi_dirty = true;
// returns objects in range from vec3, NaN in Y ignores it // returns objects in range from vec3, NaN in Y ignores it
sorted_object_list find_in_range(glm::vec3 from, float distance); sorted_object_list find_in_range(glm::vec3 from, float distance);