-
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
Add framework
, based on testapp
#298
Add framework
, based on testapp
#298
Conversation
almost 10,000 line changes and rising 🐳 🐦... I wrote a little unit test / tutorial that shows the important parts of using the new framework: A ton of grunt work required to rewrite all the Before and after for 'bounds' (click to expand)Before: // Header 1
#define TESTAPP_DATA_BOUNDS 2, \
idBounds, idOutOfBounds
struct PlBounds
{
PipelineDef<EStgCont> boundsSet {"boundsSet"};
PipelineDef<EStgRevd> outOfBounds {"outOfBounds"};
};
// Header 2
osp::Session setup_bounds(
osp::TopTaskBuilder& rBuilder,
osp::ArrayView<entt::any> topData,
osp::Session const& scene,
osp::Session const& commonScene,
osp::Session const& physShapes);
// Source
Session setup_bounds(
TopTaskBuilder& rBuilder,
ArrayView<entt::any> const topData,
Session const& scene,
Session const& commonScene,
Session const& physShapes)
{
OSP_DECLARE_GET_DATA_IDS(commonScene, TESTAPP_DATA_COMMON_SCENE);
OSP_DECLARE_GET_DATA_IDS(physShapes, TESTAPP_DATA_PHYS_SHAPES);
auto const tgScn = scene .get_pipelines<PlScene>();
auto const tgCS = commonScene .get_pipelines<PlCommonScene>();
auto const tgShSp = physShapes .get_pipelines<PlPhysShapes>();
Session out;
OSP_DECLARE_CREATE_DATA_IDS(out, topData, TESTAPP_DATA_BOUNDS);
auto const tgBnds = out.create_pipelines<PlBounds>(rBuilder);
rBuilder.pipeline(tgBnds.boundsSet) .parent(tgScn.update);
rBuilder.pipeline(tgBnds.outOfBounds) .parent(tgScn.update);
top_emplace< ActiveEntSet_t > (topData, idBounds);
top_emplace< ActiveEntVec_t > (topData, idOutOfBounds);
rBuilder.task()
.name ("Check for out-of-bounds entities")
.run_on ({tgScn.update(Run)})
.sync_with ({tgCS.transform(Ready), tgBnds.boundsSet(Ready), tgBnds.outOfBounds(Modify__)})
.push_to (out.m_tasks)
.args ({ idBasic, idBounds, idOutOfBounds })
.func([] (ACtxBasic const& rBasic, ActiveEntSet_t const& rBounds, ActiveEntVec_t& rOutOfBounds) noexcept
{
... After: // Header 1
struct FIBounds {
struct DataIds {
DataId bounds;
DataId outOfBounds;
};
struct Pipelines {
PipelineDef<EStgCont> boundsSet {"boundsSet"};
PipelineDef<EStgRevd> outOfBounds {"outOfBounds"};
};
};
// Header 2
extern osp::fw::FeatureDef const ftrBounds;
// Source
FeatureDef const ftrBounds = feature_def("Bounds", [] (
FeatureBuilder &rFB,
Implement<FIBounds> bounds,
DependOn<FIScene> scn,
DependOn<FICommonScene> comScn,
DependOn<FIPhysShapes> physShapes)
{
rFB.pipeline(bounds.pl.boundsSet) .parent(scn.pl.update);
rFB.pipeline(bounds.pl.outOfBounds) .parent(scn.pl.update);
rFB.data_emplace< ActiveEntSet_t > (bounds.di.bounds);
rFB.data_emplace< ActiveEntVec_t > (bounds.di.outOfBounds);
rFB.task()
.name ("Check for out-of-bounds entities")
.run_on ({scn.pl.update(Run)})
.sync_with ({comScn.pl.transform(Ready), bounds.pl.boundsSet(Ready), bounds.pl.outOfBounds(Modify__)})
.args ({ comScn.di.basic, bounds.di.bounds, bounds.di.outOfBounds })
.func([] (ACtxBasic const &rBasic, ActiveEntSet_t const &rBounds, ActiveEntVec_t &rOutOfBounds) noexcept
{
...
</details>
|
1069fc0
into
TheOpenSpaceProgram:master
Heavily addresses #288, most info on these new changes are here.
This can allow the GDExtension application (#294) to not need to depend on testapp.