-
Notifications
You must be signed in to change notification settings - Fork 34
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
Landergame #264
Draft
kwiesmueller
wants to merge
3
commits into
TheOpenSpaceProgram:master
Choose a base branch
from
kwiesmueller:landergame
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Landergame #264
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ OSP-MAGNUM.cbp | |
CMakeSettings.json | ||
out/ | ||
.vs/ | ||
.vscode/ | ||
build/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
#include "lander.h" | ||
#include "../testapp.h" | ||
#include "../identifiers.h" | ||
#include "../sessions/common.h" | ||
#include "../sessions/magnum.h" | ||
#include "../sessions/misc.h" | ||
#include "../sessions/newton.h" | ||
#include "../sessions/physics.h" | ||
#include "../sessions/shapes.h" | ||
#include "../sessions/terrain.h" | ||
#include "../sessions/universe.h" | ||
#include "../sessions/vehicles.h" | ||
#include "../sessions/vehicles_machines.h" | ||
#include "../sessions/vehicles_prebuilt.h" | ||
#include "../scenarios.h" | ||
|
||
#include <osp/tasks/top_utils.h> | ||
|
||
#include <adera/activescene/vehicles_vb_fn.h> | ||
|
||
namespace lander | ||
{ | ||
// MaterialIds hints which shaders should be used to draw a DrawEnt | ||
// DrawEnts can be assigned to multiple materials | ||
static constexpr auto sc_matVisualizer = osp::draw::MaterialId(0); | ||
static constexpr auto sc_matFlat = osp::draw::MaterialId(1); | ||
static constexpr auto sc_matPhong = osp::draw::MaterialId(2); | ||
static constexpr int sc_materialCount = 4; | ||
|
||
RendererSetupFunc_t lander::setup_lander_scenario(TestApp &rTestApp) | ||
{ | ||
#define SCENE_SESSIONS scene, commonScene, uniCore, uniScnFrame, uniPlanet, physics, \ | ||
prefabs, parts, signalsFloat, vehicleSpawn, vehicleSpawnVB, vehicles, \ | ||
newton, vehicleSpawnNwt, nwtRocketSet, rocketsNwt, \ | ||
machRocket, machRcsDriver | ||
#define SCENE_SESSIONS_COUNT 18 | ||
#define RENDERER_SESSIONS sceneRenderer, magnumScene, planetDraw, \ | ||
cameraCtrl, cameraFree, shVisual, shFlat, shPhong, \ | ||
prefabDraw, vehicleDraw, vehicleCtrl, cameraVehicle | ||
#define RENDERER_SESSIONS_COUNT 12 | ||
|
||
using namespace testapp::scenes; | ||
using adera::ACtxVehicleSpawnVB; | ||
using osp::top_get; | ||
using osp::TopTaskBuilder; | ||
using osp::active::ACtxVehicleSpawn; | ||
using testapp::PlApplication; | ||
// using osp::active::ad; | ||
|
||
auto const defaultPkg = rTestApp.m_defaultPkg; | ||
auto const application = rTestApp.m_application; | ||
auto &rTopData = rTestApp.m_topData; | ||
|
||
TopTaskBuilder builder{rTestApp.m_tasks, rTestApp.m_scene.m_edges, rTestApp.m_taskData}; | ||
|
||
auto &[SCENE_SESSIONS] = resize_then_unpack<SCENE_SESSIONS_COUNT>(rTestApp.m_scene.m_sessions); | ||
|
||
scene = setup_scene(builder, rTopData, application); | ||
commonScene = setup_common_scene(builder, rTopData, scene, application, defaultPkg); | ||
|
||
auto const tgApp = application.get_pipelines<PlApplication>(); | ||
uniCore = setup_uni_core(builder, rTopData, tgApp.mainLoop); | ||
uniScnFrame = setup_uni_sceneframe(builder, rTopData, uniCore); | ||
uniPlanet = setup_uni_landerplanet(builder, rTopData, uniCore, uniScnFrame); | ||
|
||
physics = setup_physics(builder, rTopData, scene, commonScene); | ||
prefabs = setup_prefabs(builder, rTopData, application, scene, commonScene, physics); | ||
parts = setup_parts(builder, rTopData, application, scene); | ||
signalsFloat = setup_signals_float(builder, rTopData, scene, parts); | ||
vehicleSpawn = setup_vehicle_spawn(builder, rTopData, scene); | ||
vehicleSpawnVB = setup_vehicle_spawn_vb(builder, rTopData, application, scene, commonScene, prefabs, parts, vehicleSpawn, signalsFloat); | ||
vehicles = setup_prebuilt_vehicles(builder, rTopData, application, scene); | ||
|
||
machRocket = setup_mach_rocket(builder, rTopData, scene, parts, signalsFloat); | ||
machRcsDriver = setup_mach_rcsdriver(builder, rTopData, scene, parts, signalsFloat); | ||
|
||
newton = setup_newton(builder, rTopData, scene, commonScene, physics); | ||
vehicleSpawnNwt = setup_vehicle_spawn_newton(builder, rTopData, application, commonScene, physics, prefabs, parts, vehicleSpawn, newton); | ||
nwtRocketSet = setup_newton_factors(builder, rTopData); | ||
rocketsNwt = setup_rocket_thrust_newton(builder, rTopData, scene, commonScene, physics, prefabs, parts, signalsFloat, newton, nwtRocketSet); | ||
|
||
OSP_DECLARE_GET_DATA_IDS(vehicleSpawn, TESTAPP_DATA_VEHICLE_SPAWN); | ||
OSP_DECLARE_GET_DATA_IDS(vehicleSpawnVB, TESTAPP_DATA_VEHICLE_SPAWN_VB); | ||
OSP_DECLARE_GET_DATA_IDS(vehicles, TESTAPP_DATA_TEST_VEHICLES); | ||
|
||
auto &rVehicleSpawn = top_get<ACtxVehicleSpawn>(rTopData, idVehicleSpawn); | ||
auto &rVehicleSpawnVB = top_get<ACtxVehicleSpawnVB>(rTopData, idVehicleSpawnVB); | ||
auto &rPrebuiltVehicles = top_get<PrebuiltVehicles>(rTopData, idPrebuiltVehicles); | ||
|
||
rVehicleSpawn.spawnRequest.push_back( | ||
{.position = {30.0f, 0.0f, 0.0f}, | ||
.velocity = {0.0f, 0.0f, 0.0f}, | ||
.rotation = {}}); | ||
rVehicleSpawnVB.dataVB.push_back(rPrebuiltVehicles[gc_pbvSimpleCommandServiceModule].get()); | ||
|
||
RendererSetupFunc_t const setup_renderer = [](TestApp &rTestApp) -> void | ||
{ | ||
auto const application = rTestApp.m_application; | ||
auto const windowApp = rTestApp.m_windowApp; | ||
auto const magnum = rTestApp.m_magnum; | ||
auto &rTopData = rTestApp.m_topData; | ||
|
||
TopTaskBuilder builder{rTestApp.m_tasks, rTestApp.m_renderer.m_edges, rTestApp.m_taskData}; | ||
|
||
auto &[SCENE_SESSIONS] = unpack<SCENE_SESSIONS_COUNT>(rTestApp.m_scene.m_sessions); | ||
auto &[RENDERER_SESSIONS] = resize_then_unpack<RENDERER_SESSIONS_COUNT>(rTestApp.m_renderer.m_sessions); | ||
|
||
sceneRenderer = setup_scene_renderer(builder, rTopData, application, windowApp, commonScene); | ||
create_materials(rTopData, sceneRenderer, sc_materialCount); | ||
|
||
magnumScene = setup_magnum_scene(builder, rTopData, application, rTestApp.m_windowApp, sceneRenderer, rTestApp.m_magnum, scene, commonScene); | ||
cameraCtrl = setup_camera_ctrl(builder, rTopData, windowApp, sceneRenderer, magnumScene); | ||
// cameraFree = setup_camera_free (builder, rTopData, windowApp, scene, cameraCtrl); | ||
shVisual = setup_shader_visualizer(builder, rTopData, windowApp, sceneRenderer, magnum, magnumScene, sc_matVisualizer); | ||
// shFlat = setup_shader_flat (builder, rTopData, windowApp, sceneRenderer, magnum, magnumScene, sc_matFlat); | ||
shPhong = setup_shader_phong(builder, rTopData, windowApp, sceneRenderer, magnum, magnumScene, sc_matPhong); | ||
planetDraw = setup_landerplanet_draw(builder, rTopData, windowApp, sceneRenderer, cameraCtrl, commonScene, uniCore, uniScnFrame, uniPlanet, sc_matVisualizer, sc_matFlat); | ||
|
||
prefabDraw = setup_prefab_draw(builder, rTopData, application, windowApp, sceneRenderer, commonScene, prefabs, sc_matPhong); | ||
vehicleDraw = setup_vehicle_spawn_draw(builder, rTopData, sceneRenderer, vehicleSpawn); | ||
vehicleCtrl = setup_vehicle_control(builder, rTopData, windowApp, scene, parts, signalsFloat); | ||
cameraVehicle = setup_camera_vehicle(builder, rTopData, windowApp, scene, sceneRenderer, commonScene, physics, parts, cameraCtrl, vehicleCtrl); | ||
|
||
setup_magnum_draw(rTestApp, scene, sceneRenderer, magnumScene); | ||
}; | ||
return setup_renderer; | ||
} | ||
|
||
} // namespace lander |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "../testapp.h" | ||
|
||
namespace lander | ||
{ | ||
using testapp::TestApp; | ||
|
||
using RendererSetupFunc_t = void (*)(TestApp &); | ||
using MagnumDrawFunc_t = void (*)(TestApp &, osp::Session const &, osp::Session const &, osp::Session const &); | ||
|
||
RendererSetupFunc_t setup_lander_scenario(TestApp &rTestApp); | ||
} // namespace lander |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm fairly certain we would want to keep the behavior of a "graceful" exit.
if that's not working, we should debug why and get it fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was for debugging something. Will remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, if I remove it and close the window it doesn't stop the application. So I think exiting here is more expected behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closing the window isn't supposed to exit the application in the current code.
Arguably that's not really what most people want, but it's what the current code was intended to do.