mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 15:09:19 +02:00
higher quality map
This commit is contained in:
15
Segment.cpp
15
Segment.cpp
@@ -521,3 +521,18 @@ bool TSegment::RenderLoft( gfx::vertex_array &Output, Math3D::vector3 const &Ori
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void TSegment::render_lines(std::vector<gfx::basic_vertex> &out, float quality) const
|
||||||
|
{
|
||||||
|
float step = 1.0f / iSegCount / quality;
|
||||||
|
|
||||||
|
float x;
|
||||||
|
|
||||||
|
glm::vec3 previous = FastGetPoint(0.0);
|
||||||
|
|
||||||
|
for (x = step; x <= 1.0f; x += step) {
|
||||||
|
out.push_back(gfx::basic_vertex(previous, glm::vec3(0.0f), glm::vec2(0.0f)));
|
||||||
|
|
||||||
|
previous = glm::vec3(FastGetPoint(x));
|
||||||
|
out.push_back(gfx::basic_vertex(previous, glm::vec3(0.0f), glm::vec2(0.0f)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -129,6 +129,9 @@ public:
|
|||||||
int
|
int
|
||||||
RaSegCount() const {
|
RaSegCount() const {
|
||||||
return ( fTsBuffer.empty() ? 1 : iSegCount ); };
|
return ( fTsBuffer.empty() ? 1 : iSegCount ); };
|
||||||
|
|
||||||
|
void
|
||||||
|
render_lines(std::vector<gfx::basic_vertex> &out, float quality) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
16
Track.cpp
16
Track.cpp
@@ -1133,8 +1133,20 @@ void TTrack::create_map_geometry(std::vector<gfx::basic_vertex> &Bank)
|
|||||||
if (iCategoryFlag != 1)
|
if (iCategoryFlag != 1)
|
||||||
return; // only tracks for now
|
return; // only tracks for now
|
||||||
|
|
||||||
for (auto &v : endpoints())
|
switch (eType)
|
||||||
Bank.push_back(gfx::basic_vertex(glm::vec3(v), glm::vec3(0.0f), glm::vec2(0.0f)));
|
{
|
||||||
|
case tt_Normal:
|
||||||
|
case tt_Table:
|
||||||
|
Segment->render_lines(Bank, 1.0f);
|
||||||
|
break;
|
||||||
|
case tt_Switch:
|
||||||
|
case tt_Cross:
|
||||||
|
SwitchExtension->Segments[0]->render_lines(Bank, 1.0f);
|
||||||
|
SwitchExtension->Segments[1]->render_lines(Bank, 1.0f);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// wypełnianie tablic VBO
|
// wypełnianie tablic VBO
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ void ui::map_panel::render_contents()
|
|||||||
glm::vec2 ndc_pos = surface_pos / surface_size * 2.0f - 1.0f;
|
glm::vec2 ndc_pos = surface_pos / surface_size * 2.0f - 1.0f;
|
||||||
glm::vec3 world_pos = glm::inverse(transform) * glm::vec4(ndc_pos.x, 0.0f, -ndc_pos.y, 1.0f);
|
glm::vec3 world_pos = glm::inverse(transform) * glm::vec4(ndc_pos.x, 0.0f, -ndc_pos.y, 1.0f);
|
||||||
|
|
||||||
std::vector<TEventLauncher *> launchers = simulation::Events.find_eventlaunchers(glm::vec2(world_pos.x, world_pos.z), 10.0f);
|
std::vector<TEventLauncher *> launchers = simulation::Events.find_eventlaunchers(glm::vec2(world_pos.x, world_pos.z), 0.01f / zoom);
|
||||||
|
|
||||||
for (auto launcher : launchers) {
|
for (auto launcher : launchers) {
|
||||||
command_relay relay;
|
command_relay relay;
|
||||||
|
|||||||
Reference in New Issue
Block a user