30#include "SourcesVulkan/DynamicInputProvider.h"
32#include"SourcesVulkan/DynamicInputProvider.h"
42 Headless, GLFW, OpenXR, Undefined
48 <<
" - -------------------------------------------------------------------------------------- -\n"
49 <<
"| Original authors: |\n"
51 <<
"| Universite Libre de Bruxelles, Brussels, Belgium: |\n"
52 <<
"| Sarah Fachada, Sarah.Fernandes.Pinto.Fachada@ulb.ac.be |\n"
53 <<
"| Daniele Bonatto, Daniele.Bonatto@ulb.ac.be |\n"
54 <<
"| Arnaud Schenkel, arnaud.schenkel@ulb.ac.be |\n"
56 <<
"| Koninklijke Philips N.V., Eindhoven, The Netherlands: |\n"
57 <<
"| Bart Kroon, bart.kroon@philips.com |\n"
58 <<
"| Bart Sonneveldt, bart.sonneveldt@philips.com |\n"
59 <<
" - -------------------------------------------------------------------------------------- -\n\n";
61 std::cout <<
"Hovitron version " << std::endl;
63 std::cout <<
"Usage: RVS PathToDLL [ --glfw "
65 <<
"|| --openxr][--mirror]"
69 <<
"[--blendingFactor value] [--start value] [--triangleThreshold value] [--scaleFactor value]"
71 std::cout <<
"--headless is currently not supported" << std::endl;
73 std::cout <<
"--openxr is not available since the code was not compiled with openxr flag" << std::endl;
79int main(
int argc,
char* argv[])
82 SetConsoleOutputCP(CP_UTF8);
85 WindowMode mode = WindowMode::Undefined;
86 PipelineMode pipelineMode = PipelineMode::Raster;
88 bool openXRmirror =
false;
90 float blendingFactor = 5.0;
91 float triangleThreshold = -1;
92 float scaleFactor = -1;
93 auto startingPoint = StartingPosition::Average;
94 float nearPlaneHeadset = -1;
95 float farPlaneHeadset = -1;
96 int32_t portNumber = 60392;
97 for (
int i = 1; i < argc; ++i) {
102 if (strcmp(argv[i],
"--help") == 0) {
106 else if (strcmp(argv[i],
"--headless") == 0) {
107 std::cout <<
"mode without window have been activated" << std::endl;
108 if (mode == WindowMode::Undefined) {
111 throw std::runtime_error(
"Currently the headless mode is unsupported");
116 throw std::runtime_error(
"Only one flag is accepted for chosing the window mode");
120 else if (strcmp(argv[i],
"--glfw") == 0) {
121 std::cout <<
"mode with a glfw window" << std::endl;
122 if (mode == WindowMode::Undefined) {
123 mode = WindowMode::GLFW;
127 throw std::runtime_error(
"Only one flag is accepted for chosing the window mode");
130 }
else if (strcmp(argv[i],
"--openxr") == 0) {
131 std::cout <<
"mode with OpenXR" << std::endl;
132 if (mode == WindowMode::Undefined) {
134 mode = WindowMode::OpenXR;
136 throw std::runtime_error(
"Not compiled with OpenXr, OpenXR mode unsupported");
142 throw std::runtime_error(
"Only one flag is accepted for chosing the window mode");
146 else if (strcmp(argv[i],
"--mirror") == 0) {
148 std::cout <<
"Mirror for openXR requested" << std::endl;
150 else if (strcmp(argv[i],
"--blendingFactor") == 0 || strcmp(argv[i],
"-b") == 0) {
153 auto factor = argv[i+1];
154 blendingFactor = std::stof(factor);
155 std::cout <<
"Blending factor set to: " << blendingFactor << std::endl;
159 throw std::runtime_error(
"blending factor missing");
163 else if (strcmp(argv[i],
"--triangleTreshold") == 0 || strcmp(argv[i],
"-t") == 0) {
166 auto factor = argv[i + 1];
167 triangleThreshold = std::stof(factor);
168 std::cout <<
"triangleThreshold set to: " << triangleThreshold << std::endl;
172 throw std::runtime_error(
"value for thriangleThreshold missing");
176 else if (strcmp(argv[i],
"--start") == 0 ) {
179 auto start = argv[i + 1];
180 if (strcmp(start,
"zero") == 0) {
181 startingPoint = StartingPosition::Zero;
182 PRINT(
"Starting point set to zero");
183 }
else if (strcmp(start,
"average") == 0) {
184 startingPoint = StartingPosition::Average;
185 PRINT(
"Starting point set to the average of the pose of the input cameras");
189 throw std::runtime_error((
" %s is not a supported mode for starting point", start));
195 throw std::runtime_error(
"Argument for starting position is missing ");
199 else if (strcmp(argv[i],
"--port") == 0 || strcmp(argv[i],
"-p") == 0) {
200#ifdef HVT_UDP_CONTROL
203 portNumber = stoi(argv[i + 1]);
204 PRINT(
"Port set to %d", portNumber);
208 throw std::runtime_error(
"Argument for port is missing ");
213 throw std::runtime_error(
"Not compiled with UDP control, --port argument is unavailable");
217 else if (pathDLL.empty()) {
222 throw std::runtime_error(
"Too many parameters (try --help)");
228 <<
" - -------------------------------------------------------------------------------------- -\n"
229 <<
"| Reference View Synthesizer (RVS) version Vulkan, based on (branch: v3.1) |\n"
231 <<
"| MPEG2018/N18068 Reference View Synthesizer (RVS) manual |\n"
232 <<
" - -------------------------------------------------------------------------------------- -" << std::endl;
234 if (pathDLL.empty()) {
237 throw std::runtime_error(
"Please specify at least a valid path to the dynamic library (.dll) that provide the input");
241 if (mode == WindowMode::Undefined) {
242 std::cout <<
"No mode for the window specidied --> fall back to GLFW window";
243 mode = WindowMode::GLFW;
246 if (openXRmirror && mode != WindowMode::OpenXR) {
247 std::cout <<
"Mirror for OpenXR mode is requested but the mode chosen isn't OpenXR, --mirror flag will be ignored" << std::endl;
248 openXRmirror =
false;
251 std::filesystem::path p = pathDLL;
252 auto dir = p.parent_path();
253 auto ex = std::filesystem::exists(p);
259 case WindowMode::GLFW:
263 case WindowMode::OpenXR:
265 static_cast<WindowOpenXR *
>(window)->setMirror(openXRmirror);
276#ifdef HVT_UDP_CONTROL
277 wraps->
init(portNumber);
282 if (triangleThreshold != -1) {
285 if (scaleFactor != -1) {
289 wraps->
endInit(inputDLL, startingPoint);
295 catch (
const std::exception& e) {
296 std::cerr << e.what() << std::endl;
file that contains the VulkanWrapper class that manages the classes related to Vulkan code and ease t...
Contains the class that represents a window created with the GLFW library.
Class that take care of the tasks linked to OpenXR (input and display), is used when HMD support is r...
Class that manages the classes related to Vulkan code and act as a wrapper around them.
void setScaleFactor(float scaleFactor)
void setTriangleThreshold(float triangleThreshold)
void endInit(InputProvider *input, StartingPosition startingPt=StartingPosition::Average)
void setBlendingFactor(float blendingfactor)
Abstraction of the way of the result is displayed (screen or HMD).
The class that represents a window created with the GLFW library.
Class that take care of the tasks linked to OpenXR (input and display), is used when HMD support is r...