Skip to content
Snippets Groups Projects
Commit f86d5e27 authored by Mathias Paulin's avatar Mathias Paulin :speech_balloon:
Browse files

remove outdated tests

parent 97c8bc69
Branches
No related tags found
No related merge requests found
......@@ -29,7 +29,6 @@ option(BUILD_PLUGIN "Compile Plugin" OFF)
option(BUILD_MARA "Compile Mara Application" OFF)
option(BUILD_MARABOUTAGE "Compile MaraBoutage Application" ON)
option(BUILD_DEMO "Compile libRenderer usage DEMO" OFF)
option(BUILD_TESTNODEGRAPH "Compile the node graph test demo" OFF)
add_subdirectory(src)
......
......@@ -23,8 +23,3 @@ if(BUILD_DEMO)
set(VIEWER_IN_BUILD_TREE True)
add_subdirectory(DemoApp EXCLUDE_FROM_ALL)
endif()
if (BUILD_TESTNODEGRAPH)
set(TESTNODEGRAPH_IN_BUILD_TREE True)
add_subdirectory(TestNodeGraph EXCLUDE_FROM_ALL)
endif()
cmake_minimum_required(VERSION 3.6)
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER "3.9")
cmake_policy(SET CMP0071 NEW)
endif ()
if (APPLE)
cmake_policy(SET CMP0042 NEW)
endif (APPLE)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
project(TestNodeGraph VERSION 0.0.1)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/installed-${CMAKE_CXX_COMPILER_ID}-${CMAKE_BUILD_TYPE}" CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
message("Set install prefix to ${CMAKE_INSTALL_PREFIX}")
endif ()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED 17)
# ///////////////////////////////
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(app_sources
main.cpp
NodeBasedRenderer.cpp
)
set(app_headers
NodeBasedRenderer.hpp
)
set(app_uis
)
set(app_resources
)
add_executable(${PROJECT_NAME} MACOSX_BUNDLE
${app_sources}
${app_headers}
${app_uis}
${app_resources}
)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
target_include_directories(${PROJECT_NAME} PRIVATE
${RADIUM_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR} # Moc
${CMAKE_CURRENT_SOURCE_DIR}
)
if (TESTNODEGRAPH_IN_BUILD_TREE)
message(STATUS " *** ${PROJECT_NAME} *** Building application into the lib and plugin build tree")
else ()
message(STATUS " *** ${PROJECT_NAME} *** Building application from the installed library")
# If the application is built as standalone, uses libGLTF from its installed tree
find_package(RadiumNBR COMPONENTS NBR REQUIRED )
endif ()
target_link_libraries(${PROJECT_NAME}
PUBLIC
RadiumNBR::NBR
)
configure_radium_app(
NAME ${PROJECT_NAME}
USE_PLUGINS
)
#include "NodeBasedRenderer.hpp"
void NodeBasedRenderer::init() {
std::cout << "\e[31m\e[1mNodeBasedRenderer\e[0m: \e[1minitialization\e[0m." << std::endl;
m_renderObjects.push_back({"a", RenderObjectVisibility::MASK});
m_renderObjects.push_back({"b", RenderObjectVisibility::OPAQUE});
m_renderObjects.push_back({"c", RenderObjectVisibility::OPAQUE});
m_renderObjects.push_back({"d", RenderObjectVisibility::MASK});
m_renderObjects.push_back({"e", RenderObjectVisibility::BLEND});
m_renderObjects.push_back({"f", RenderObjectVisibility::BLEND});
m_lights.push_back({LightType::DIRECTIONAL});
m_lights.push_back({LightType::DIRECTIONAL});
m_lights.push_back({LightType::POINT});
m_lights.push_back({LightType::SPOT});
m_lights.push_back({LightType::POINT});
m_lights.push_back({LightType::POINT});
std::cout << "\e[31m\e[1mNodeBasedRenderer\e[0m: passing implicit data to rendergraph \"" << m_originalGraph.getName() << "\": " << m_renderObjects.size() << " render objects and " << m_lights.size() << " lights." << std::endl;
dynamic_cast<DataNode<Ra::Engine::Rendering::RenderObject>*>(m_originalGraph.getRenderObjectNode())->setElements(m_renderObjects);
dynamic_cast<DataNode<Ra::Engine::Scene::Light>*>(m_originalGraph.getLightNode())->setElements(m_lights);
m_originalGraph.init();
}
void NodeBasedRenderer::update() {
std::cout << "\e[31m\e[1mNodeBasedRenderer\e[0m: \e[1mupdate\e[0m." << std::endl;
m_originalGraph.update();
}
void NodeBasedRenderer::execute() {
std::cout << std::endl << "\e[31m\e[1mNodeBasedRenderer\e[0m: \e[1mexecute\e[0m." << std::endl;
m_originalGraph.execute();
}
void NodeBasedRenderer::destroy() {
std::cout << "\e[31m\e[1mNodeBasedRenderer\e[0m: \e[1mdestroy\e[0m." << std::endl;
m_originalGraph.destroy();
}
void NodeBasedRenderer::resize(uint32_t width, uint32_t height) {
std::cout << "\e[31m\e[1mNodeBasedRenderer\e[0m: \e[1mresize\e[0m: " << width << "x" << height << "." << std::endl;
m_originalGraph.resize(width, height);
}
void NodeBasedRenderer::launch() {
std::cout << std::endl << "\e[31m\e[1mNodeBasedRenderer\e[0m: launch." << std::endl;
init();
int nbIter = 5;
std::cout << std::endl << "\e[31m\e[1mNodeBasedRenderer\e[0m: start loop." << std::endl;
for (size_t i = 0; i < nbIter; i++) {
std::cout << std::endl << "\e[31m\e[1mNodeBasedRenderer\e[0m: \e[1mnew iteration\e[0m, \e[1mLOOP " << i << "\e[0m --------------------------------------------------------------------------------------------------------------------------" << std::endl;
update();
execute();
std::cout << "\e[31m\e[1mNodeBasedRenderer\e[0m: end loop." << std::endl;
}
std::cout << std::endl;
destroy();
}
\ No newline at end of file
#pragma once
#include <RadiumNBR/NodeGraph/RenderGraph.hpp>
class NodeBasedRenderer {
public:
NodeBasedRenderer(RenderGraph& originalGraph) : m_originalGraph(originalGraph) {}
void init();
void update();
void execute();
void destroy();
void resize(uint32_t width, uint32_t height);
void launch();
private:
RenderGraph& m_originalGraph;
std::vector<RenderObject> m_renderObjects;
std::vector<Light> m_lights;
};
\ No newline at end of file
#include "NodeBasedRenderer.hpp"
#include <RadiumNBR/NodeGraph/ExternalData.hpp>
#include <RadiumNBR/NodeGraph/PremadeNodes/DataNode.hpp>
#include <RadiumNBR/NodeGraph/PremadeNodes/FilterNode.hpp>
#include <RadiumNBR/NodeGraph/PremadeNodes/LocalLightNode.hpp>
#include <RadiumNBR/NodeGraph/PremadeNodes/SinkNode.hpp>
#include <RadiumNBR/NodeGraph/PremadeNodes/SourceNode.hpp>
#include <RadiumNBR/NodeGraph/PremadeNodes/ZGeomPrepassNode.hpp>
#include <RadiumNBR/NodeGraph/RenderGraph.hpp>
#include <vector>
int main() {
RenderGraph rg("testJSON", "rg.json");
NodeBasedRenderer nbr(rg);
nbr.launch();
/*RenderGraph rg("test");
auto zprepass = new ZPrepass("zPrepass");
rg.addNode(zprepass);
auto source = new SourceNode<int>("colorSource");
source->setData(1);
rg.addNode(source);
auto dp = new DummyPass("dummyPass");
rg.addNode(dp);
auto sink = new SinkNode<int>("fromZPrepass");
rg.addNode(sink);
auto colorsink = new SinkNode<float>("fromDummyPass");
rg.addNode(colorsink);
auto roFilterByVisibility = new FilterNode<RenderObject>("filterByVisibility", [] (const auto& r) { return r.visibility == RenderObjectVisibility::OPAQUE; });
rg.addNode(roFilterByVisibility);
auto roFilterByName = new FilterNode<RenderObject>("filterByName", [] (const auto& r) { return r.name == "b"; } );
rg.addNode(roFilterByName);
auto lFilterByType = new FilterNode<Light>("filterByType", [] (const auto& l) { return l.type == LightType::DIRECTIONAL; });
rg.addNode(lFilterByType);
// Unused pass, to be removed at graph's compilation
auto dp2 = new DummyPass("dummyPass2");
rg.addNode(dp2);
auto sourceToSink = new SourceNode<int>("sourceToSink");
sourceToSink->setData(45);
rg.addNode(sourceToSink);
auto sinkFromSource = new SinkNode<int>("sinkFromSource");
rg.addNode(sinkFromSource);
rg.addLink(source, "to", dp, "in");
rg.addLink(zprepass, "outFloat", dp, "in2");
rg.addLink(zprepass, "outInt", sink, "from");
rg.addLink(sourceToSink, "to", colorsink, "from"); // Won't work : not the same type of data (int -> float)
rg.addLink(dp, "out", colorsink, "from");
rg.addLink(rg.getRenderObjectNode(), "outData", roFilterByVisibility, "in");
rg.addLink(rg.getLightNode(), "outData", dp, "inRenderObjects"); // Won't work : type mismatch (vector<Light> -> vector<RenderObject>)
rg.addLink(roFilterByVisibility, "out", roFilterByName, "in");
rg.addLink(roFilterByName, "out", zprepass, "inRO");
rg.addLink(rg.getLightNode(), "outData", lFilterByType, "in");
rg.addLink(lFilterByType, "out", zprepass, "inLights");
rg.addLink(roFilterByVisibility, "out", lFilterByType, "in"); // Won't work : not the same type of data (vector<RenderObject> -> vector<Light>)
rg.addLink(source, "to", dp, "in2"); // Won't work : there is already a link connected to dp's input 2 and type mismatch (int -> float)
rg.addLink(rg.getRenderObjectNode(), "outData", zprepass, "inRO"); // Won't work : there is already render objects on zprepass
rg.addLink(lFilterByType, "out", zprepass, "inLights"); // Won't work : there is already lights on zprepass
// rg.addLink(colorsink, source); TEMPORAL, not yet implemented
rg.addLink(sourceToSink, "to", sinkFromSource, "from");
NodeBasedRenderer nbr(rg);
nbr.launch();*/
}
{
"nodes": [
{
"nodeType": "ZPrepass",
"name": "zprepass"
},
{
"nodeType": "Source",
"type": "int",
"value": 1,
"name": "colorSource"
},
{
"nodeType": "DummyPass",
"name": "dummyPass"
},
{
"nodeType": "Sink",
"type": "int",
"name": "fromZPrepass"
},
{
"nodeType": "Sink",
"type": "float",
"name": "fromDummyPass"
},
{
"nodeType": "Filter",
"type": "RenderObject",
"filterBy": "visibility",
"filterOp": "equal",
"filterParam": "opaque",
"name": "filterByVisibility"
},
{
"nodeType": "Filter",
"type": "RenderObject",
"filterBy": "name",
"filterOp": "equal",
"filterParam": "b",
"name": "filterByName"
},
{
"nodeType": "Filter",
"type": "Light",
"filterBy": "type",
"filterOp": "equal",
"filterParam": "directional",
"name": "filterByType"
},
{
"nodeType": "DummyPass",
"name": "dummyPass2"
},
{
"nodeType": "Source",
"type": "int",
"value": 45,
"name": "sourceToSink"
},
{
"nodeType": "Sink",
"type": "int",
"name": "sinkFromSource"
}
],
"links": [
{
"nodeFrom": "colorSource",
"output": "to",
"nodeTo": "dummyPass",
"input": "in"
},
{
"nodeFrom": "zprepass",
"output": "outFloat",
"nodeTo": "dummyPass",
"input": "in2"
},
{
"nodeFrom": "zprepass",
"output": "outInt",
"nodeTo": "fromZPrepass",
"input": "from"
},
{
"nodeFrom": "sourceToSink",
"output": "to",
"nodeTo": "fromDummyPass",
"input": "from"
},
{
"nodeFrom": "dummyPass",
"output": "out",
"nodeTo": "fromDummyPass",
"input": "from"
},
{
"nodeFrom": "renderObjects",
"output": "outData",
"nodeTo": "filterByVisibility",
"input": "in"
},
{
"nodeFrom": "lights",
"output": "outData",
"nodeTo": "dummyPass",
"input": "inRenderObjects"
},
{
"nodeFrom": "filterByVisibility",
"output": "out",
"nodeTo": "filterByName",
"input": "in"
},
{
"nodeFrom": "filterByName",
"output": "out",
"nodeTo": "zprepass",
"input": "inRO"
},
{
"nodeFrom": "lights",
"output": "outData",
"nodeTo": "filterByType",
"input": "in"
},
{
"nodeFrom": "filterByType",
"output": "out",
"nodeTo": "zprepass",
"input": "inLights"
},
{
"nodeFrom": "filterByVisibility",
"output": "out",
"nodeTo": "filterByType",
"input": "in"
},
{
"nodeFrom": "colorSource",
"output": "to",
"nodeTo": "dummyPass",
"input": "in2"
},
{
"nodeFrom": "renderObjects",
"output": "outData",
"nodeTo": "zprepass",
"input": "inRO"
},
{
"nodeFrom": "filterByType",
"output": "out",
"nodeTo": "zprepass",
"input": "inLights"
},
{
"nodeFrom": "sourceToSink",
"output": "to",
"nodeTo": "sinkFromSource",
"input": "from"
}
]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment