Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot trajectories using meshes in scaled space #3303

Merged
merged 34 commits into from
Jan 26, 2022
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8b288ef
encouraging eggsperiment with meshes
eggrobin Jan 10, 2022
535b15b
different scheduling and now or not
eggrobin Jan 12, 2022
570998e
fix colours
eggrobin Jan 12, 2022
5978f22
don’t leak
eggrobin Jan 12, 2022
63e2cb6
start refactoring
eggrobin Jan 13, 2022
aaa5113
Transform to scaled space in the planetarium
eggrobin Jan 17, 2022
73de9ad
PlotMethod3 versions of everything: C++ side
eggrobin Jan 22, 2022
5cbb127
plotter
eggrobin Jan 22, 2022
f4a3a61
vessels
eggrobin Jan 22, 2022
9e74ad6
more vessel
eggrobin Jan 22, 2022
8ae323d
timing
eggrobin Jan 23, 2022
6ce46fb
wrong origin
eggrobin Jan 23, 2022
d1ba73d
initialize
eggrobin Jan 23, 2022
9259720
last_time
eggrobin Jan 23, 2022
19be087
emit the first point
eggrobin Jan 23, 2022
ef9a72a
naming
eggrobin Jan 23, 2022
2a136d1
fix fading
eggrobin Jan 23, 2022
1306c6a
Merge remote-tracking branch 'la-vache/master' into meshes
eggrobin Jan 23, 2022
0dd6464
forever pinned
eggrobin Jan 23, 2022
4533134
dynamic
eggrobin Jan 23, 2022
d6bfb90
unconditionally
eggrobin Jan 23, 2022
ed1238d
drop the RP2 paths
eggrobin Jan 23, 2022
9a7ac4d
advanced graphics programming
eggrobin Jan 23, 2022
69cf2fb
in place
eggrobin Jan 23, 2022
1344dcf
make the tests compile
eggrobin Jan 24, 2022
ae021b4
limit the cheesy world
eggrobin Jan 24, 2022
f429391
make it build more
eggrobin Jan 24, 2022
34ca967
make the benchmarks build
eggrobin Jan 24, 2022
438483b
navigation
eggrobin Jan 24, 2022
6b959f4
lint
eggrobin Jan 24, 2022
d4aae0f
pleroy’s comments on the C#
eggrobin Jan 26, 2022
e919037
C++ comments
eggrobin Jan 26, 2022
2ae9512
make it build
eggrobin Jan 26, 2022
43840ad
lint
eggrobin Jan 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ksp_plugin/interface_planetarium.cpp
Original file line number Diff line number Diff line change
@@ -305,6 +305,8 @@ void __cdecl principia__PlanetariumGetFlightPlanSegmentVertices(
{vertex_count});
CHECK_NOTNULL(plugin);
CHECK_NOTNULL(planetarium);
*vertex_count = 0;

Vessel const& vessel = *plugin->GetVessel(vessel_guid);
CHECK(vessel.has_flight_plan()) << vessel_guid;
auto const segment = vessel.flight_plan().GetSegment(index);
@@ -343,6 +345,8 @@ void __cdecl principia__PlanetariumGetPredictionVertices(
{vertex_count});
CHECK_NOTNULL(plugin);
CHECK_NOTNULL(planetarium);
*vertex_count = 0;

auto const prediction = plugin->GetVessel(vessel_guid)->prediction();
planetarium->PlotMethod3(
*prediction,
@@ -375,6 +379,7 @@ void __cdecl principia__PlanetariumGetPsychohistoryVertices(
{vertex_count});
CHECK_NOTNULL(plugin);
CHECK_NOTNULL(planetarium);
*vertex_count = 0;

// Do not plot the psychohistory when there is a target vessel as it is
// misleading.
@@ -422,6 +427,7 @@ void __cdecl principia__PlanetariumGetCelestialPastTrajectoryVertices(
{minimal_distance_from_camera, vertex_count});
CHECK_NOTNULL(plugin);
CHECK_NOTNULL(planetarium);
*vertex_count = 0;

// Do not plot the past when there is a target vessel as it is misleading.
if (plugin->renderer().HasTargetVessel()) {
14 changes: 10 additions & 4 deletions ksp_plugin_adapter/plotter.cs
Original file line number Diff line number Diff line change
@@ -61,13 +61,17 @@ private void PlotVesselTrajectories(DisposablePlanetarium planetarium,
out vertex_count_);
DrawLineMesh(target_psychohistory_, adapter_.target_history_colour,
adapter_.target_history_style);
planetarium.PlanetariumGetPredictionVertices(
Plugin,
target_id,
vertices_data_,
vertices_.Length,
out vertex_count_);
DrawLineMesh(target_prediction_, adapter_.target_prediction_colour,
adapter_.target_prediction_style);
}
// Main vessel flight plan.
if (Plugin.FlightPlanExists(main_vessel_guid)) {
int number_of_anomalous_manœuvres =
Plugin.FlightPlanNumberOfAnomalousManoeuvres(main_vessel_guid);
int number_of_manœuvres =
Plugin.FlightPlanNumberOfManoeuvres(main_vessel_guid);
int number_of_segments =
Plugin.FlightPlanNumberOfSegments(main_vessel_guid);
for (int i = flight_plan_segments_.Count; i < number_of_segments; ++i) {
@@ -146,6 +150,8 @@ private void PlotSubtreeTrajectories(DisposablePlanetarium planetarium,
vertices_.Length,
out double min_future_distance,
out vertex_count_);
min_distance_from_camera =
Math.Min(min_distance_from_camera, min_future_distance);
DrawLineMesh(trajectories.future, colour, GLLines.Style.Solid);
}
}