2024-12-05 23:58:22 +01:00
|
|
|
|
/*
|
|
|
|
|
|
NodeBuilder(Test) - creation and setup of render nodes
|
|
|
|
|
|
|
|
|
|
|
|
Copyright (C)
|
|
|
|
|
|
2024, Hermann Vosseler <Ichthyostega@web.de>
|
|
|
|
|
|
|
|
|
|
|
|
**Lumiera** is free software; you can redistribute it and/or modify it
|
|
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
|
|
Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
|
|
option) any later version. See the file COPYING for further details.
|
|
|
|
|
|
|
|
|
|
|
|
* *****************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/** @file node-builder-test.cpp
|
2024-12-06 23:43:18 +01:00
|
|
|
|
** Unit test \ref NodeBuilder_test demonstrates how to build render nodes.
|
2024-12-05 23:58:22 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "lib/test/run.hpp"
|
|
|
|
|
|
#include "steam/engine/node-builder.hpp"
|
2024-12-22 22:31:05 +01:00
|
|
|
|
#include "steam/engine/diagnostic-buffer-provider.hpp"
|
2024-12-05 23:58:22 +01:00
|
|
|
|
//#include "lib/util.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace steam {
|
|
|
|
|
|
namespace engine{
|
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************//**
|
2024-12-22 19:46:02 +01:00
|
|
|
|
* @test creating and configuring various kinds of Render Nodes.
|
2024-12-05 23:58:22 +01:00
|
|
|
|
*/
|
|
|
|
|
|
class NodeBuilder_test : public Test
|
|
|
|
|
|
{
|
|
|
|
|
|
virtual void
|
|
|
|
|
|
run (Arg)
|
|
|
|
|
|
{
|
2024-12-22 19:46:02 +01:00
|
|
|
|
build_simpleNode();
|
|
|
|
|
|
build_Node_fixedParam();
|
|
|
|
|
|
build_Node_dynamicParam();
|
|
|
|
|
|
build_connectedNodes();
|
|
|
|
|
|
build_ParamNode();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO build a simple output-only Render Node
|
|
|
|
|
|
* @todo WIP 12/24 🔁 define ⟶ implement
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
build_simpleNode()
|
|
|
|
|
|
{
|
|
|
|
|
|
auto fun = [](uint* buff){ *buff = LIFE_AND_UNIVERSE_4EVER; };
|
|
|
|
|
|
|
|
|
|
|
|
ProcNode node{prepareNode("Test")
|
|
|
|
|
|
.preparePort()
|
|
|
|
|
|
.invoke("fun()", fun)
|
|
|
|
|
|
.completePort()
|
|
|
|
|
|
.build()};
|
|
|
|
|
|
|
|
|
|
|
|
CHECK (watch(node).isSrc());
|
|
|
|
|
|
CHECK (watch(node).ports().size() == 1);
|
2024-12-22 22:31:05 +01:00
|
|
|
|
|
|
|
|
|
|
// Prepare setup to invoke such a Render Node...
|
|
|
|
|
|
using Buffer = long;
|
|
|
|
|
|
BufferProvider& provider = DiagnosticBufferProvider::build();
|
|
|
|
|
|
BuffHandle buff = provider.lockBufferFor<Buffer> (-55);
|
|
|
|
|
|
|
2024-12-22 19:46:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO build a Node with a fixed invocation parameter
|
|
|
|
|
|
* @todo WIP 12/24 🔁 define ⟶ implement
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
build_Node_fixedParam()
|
|
|
|
|
|
{
|
|
|
|
|
|
UNIMPLEMENTED ("build node with fixed param");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO build a Node with dynamically generated parameter
|
|
|
|
|
|
* @todo WIP 12/24 define ⟶ implement
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
build_Node_dynamicParam()
|
|
|
|
|
|
{
|
|
|
|
|
|
UNIMPLEMENTED ("build node with param-functor");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO build a chain with two connected Nodes
|
|
|
|
|
|
* @todo WIP 12/24 define ⟶ implement
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
build_connectedNodes()
|
|
|
|
|
|
{
|
|
|
|
|
|
UNIMPLEMENTED ("build two linked nodes");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test TODO
|
|
|
|
|
|
* @todo WIP 12/24 define ⟶ implement
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
|
|
|
|
|
build_ParamNode()
|
|
|
|
|
|
{
|
|
|
|
|
|
UNIMPLEMENTED ("build ParamNode + follow-up-Node");
|
|
|
|
|
|
}
|
2024-12-05 23:58:22 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Register this test class... */
|
|
|
|
|
|
LAUNCHER (NodeBuilder_test, "unit node");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}}} // namespace steam::engine::test
|