Skip to content
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

Replaced std::string filenames with vsg::Path #271

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/app/vsgmultigpu/vsgmultigpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int main(int argc, char** argv)
if (arguments.read("--or")) windowTraits->overrideRedirect = true;
arguments.read("--display", windowTraits->display);
auto numFrames = arguments.value(-1, "-f");
auto pathFilename = arguments.value(std::string(), "-p");
auto pathFilename = arguments.value<vsg::Path>("", "-p");
auto horizonMountainHeight = arguments.value(-1.0, "--hmh");
auto powerWall = arguments.read({"--power-wall", "--pw"});
auto sharedScene = !arguments.read({"--no-shared"});
Expand Down Expand Up @@ -329,7 +329,7 @@ int main(int argc, char** argv)
// add close handler to respond to the close window button and pressing escape
viewer->addEventHandler(vsg::CloseHandler::create(viewer));

if (pathFilename.empty())
if (!pathFilename)
{
auto trackball = vsg::Trackball::create(master_camera);

Expand Down
5 changes: 2 additions & 3 deletions examples/app/vsgskybox/vsgskybox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,9 @@ int main(int argc, char** argv)
arguments.read("--display", windowTraits->display);
arguments.read("--samples", windowTraits->samples);
auto numFrames = arguments.value(-1, "-f");
auto pathFilename = arguments.value(std::string(), "-p");
auto horizonMountainHeight = arguments.value(0.0, "--hmh");
auto skyboxFilename = arguments.value(vsg::Path(), "--skybox");
auto outputFilename = arguments.value(vsg::Path(), "-o");
auto skyboxFilename = arguments.value<vsg::Path>("", "--skybox");
auto outputFilename = arguments.value<vsg::Path>("", "-o");

if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

Expand Down
4 changes: 2 additions & 2 deletions examples/commands/vsgexecutecommands/vsgexecutecommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ int main(int argc, char** argv)
bool multiThreading = arguments.read("--mt");
bool useExecuteCommands = !arguments.read("--no-ec"); // by default use ExecuteCommands, but allow it to be disabled using --no-ec
auto numFrames = arguments.value(-1, "-f");
auto pathFilename = arguments.value(std::string(), "-p");
auto pathFilename = arguments.value<vsg::Path>("", "-p");

if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

Expand Down Expand Up @@ -279,7 +279,7 @@ int main(int argc, char** argv)
// assign a CloseHandler to the Viewer to respond to pressing Escape or the window close button
viewer->addEventHandlers({vsg::CloseHandler::create(viewer)});

if (pathFilename.empty())
if (!pathFilename)
{
viewer->addEventHandler(vsg::Trackball::create(camera));
}
Expand Down
4 changes: 2 additions & 2 deletions examples/commands/vsgocclusionquery/vsgocclusionquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char** argv)
arguments.read("--display", windowTraits->display);
arguments.read("--samples", windowTraits->samples);
auto numFrames = arguments.value(-1, "-f");
auto pathFilename = arguments.value(std::string(), "-p");
auto pathFilename = arguments.value<vsg::Path>("", "-p");
if (arguments.read("--rgb")) options->mapRGBtoRGBAHint = false;

if (int log_level = 0; arguments.read("--log-level", log_level)) vsg::Logger::instance()->level = vsg::Logger::Level(log_level);
Expand Down Expand Up @@ -125,7 +125,7 @@ int main(int argc, char** argv)
// add close handler to respond to the close window button and pressing escape
viewer->addEventHandler(vsg::CloseHandler::create(viewer));

if (pathFilename.empty())
if (!pathFilename)
{
viewer->addEventHandler(vsg::Trackball::create(camera, ellipsoidModel));
}
Expand Down
4 changes: 2 additions & 2 deletions examples/commands/vsgtimestamps/vsgtimestamps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char** argv)
arguments.read("--display", windowTraits->display);
arguments.read("--samples", windowTraits->samples);
auto numFrames = arguments.value(-1, "-f");
auto pathFilename = arguments.value(std::string(), "-p");
auto pathFilename = arguments.value<vsg::Path>("", "-p");
if (arguments.read("--rgb")) options->mapRGBtoRGBAHint = false;

if (int log_level = 0; arguments.read("--log-level", log_level)) vsg::Logger::instance()->level = vsg::Logger::Level(log_level);
Expand Down Expand Up @@ -144,7 +144,7 @@ int main(int argc, char** argv)
// add close handler to respond to the close window button and pressing escape
viewer->addEventHandler(vsg::CloseHandler::create(viewer));

if (pathFilename.empty())
if (!pathFilename)
{
viewer->addEventHandler(vsg::Trackball::create(camera, ellipsoidModel));
}
Expand Down
4 changes: 2 additions & 2 deletions examples/core/vsgallocator/vsgallocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ int main(int argc, char** argv)
arguments.read("--samples", windowTraits->samples);
bool reportAtEndOfAllFrames = arguments.read("--report");
auto numFrames = arguments.value(-1, "-f");
auto pathFilename = arguments.value(std::string(), "-p");
auto pathFilename = arguments.value<vsg::Path>("", "-p");
auto loadLevels = arguments.value(0, "--load-levels");
auto horizonMountainHeight = arguments.value(0.0, "--hmh");
auto maxPagedLOD = arguments.value(0, "--maxPagedLOD");
Expand Down Expand Up @@ -277,7 +277,7 @@ int main(int argc, char** argv)
// add close handler to respond to the close window button and pressing escape
viewer->addEventHandler(vsg::CloseHandler::create(viewer));

if (pathFilename.empty())
if (!pathFilename)
{
viewer->addEventHandler(vsg::Trackball::create(camera, ellipsoidModel));
}
Expand Down
12 changes: 6 additions & 6 deletions examples/io/vsgio/vsgio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main(int argc, char** argv)
auto numLevels = arguments.value(4u, {"--levels", "-l"});
auto useQuadGroup = arguments.read("-q");
auto inputFilename = arguments.value(std::string(), "-i");
auto outputFilename = arguments.value(std::string(), "-o");
auto outputFilename = arguments.value<vsg::Path>("", "-o");

if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

Expand Down Expand Up @@ -106,15 +106,15 @@ int main(int argc, char** argv)

if (object)
{
if (outputFilename.empty())
if (outputFilename)
{
// write graph to console
vsg::VSG io;
io.write(object, std::cout);
vsg::write(object, outputFilename);
}
else
{
vsg::write(object, outputFilename);
// write graph to console
vsg::VSG io;
io.write(object, std::cout);
}
}

Expand Down
8 changes: 4 additions & 4 deletions examples/nodes/vsggroups/vsggroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ int main(int argc, char** argv)
auto numTraversals = arguments.value(10u, {"-t", "--traversals"});
auto type = arguments.value(std::string("vsg::Group"), "--type");
auto quiet = arguments.read("-q");
auto inputFilename = arguments.value(std::string(""), "-i");
auto outputFilename = arguments.value(std::string(""), "-o");
auto inputFilename = arguments.value<vsg::Path>("", "-i");
auto outputFilename = arguments.value<vsg::Path>("", "-o");
vsg::ref_ptr<vsg::RecordTraversal> vsg_recordTraversal(arguments.read("-d") ? new vsg::RecordTraversal : nullptr);
vsg::ref_ptr<VsgConstVisitor> vsg_ConstVisitor(arguments.read("-c") ? new VsgConstVisitor : nullptr);
if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);
Expand All @@ -202,7 +202,7 @@ int main(int argc, char** argv)
unsigned int numNodes = 0;
unsigned int numBytes = 0;

if (!inputFilename.empty())
if (inputFilename)
{
vsg_root = vsg::read_cast<vsg::Node>(inputFilename);

Expand Down Expand Up @@ -278,7 +278,7 @@ int main(int argc, char** argv)

clock::time_point after_traversal = clock::now();

if (!outputFilename.empty())
if (outputFilename)
{
vsg::write(vsg_root, outputFilename);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/nodes/vsglights/vsglights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int main(int argc, char** argv)

// bool useStagingBuffer = arguments.read({"--staging-buffer", "-s"});

auto outputFilename = arguments.value<std::string>("", "-o");
auto outputFilename = arguments.value<vsg::Path>("", "-o");

bool add_ambient = true;
bool add_directional = true;
Expand Down Expand Up @@ -208,7 +208,7 @@ int main(int argc, char** argv)
}

// write out scene if required
if (!outputFilename.empty())
if (outputFilename)
{
vsg::write(scene, outputFilename, options);
return 0;
Expand Down
6 changes: 3 additions & 3 deletions examples/nodes/vsgpagedlod/vsgpagedlod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ int main(int argc, char** argv)
arguments.read("--screen", windowTraits->screenNum);
arguments.read("--display", windowTraits->display);
arguments.read("--samples", windowTraits->samples);
auto outputFilename = arguments.value(std::string(), "-o");
auto outputFilename = arguments.value<vsg::Path>("", "-o");
auto numFrames = arguments.value(-1, "-f");
auto pathFilename = arguments.value(std::string(), "-p");
auto pathFilename = arguments.value<vsg::Path>("", "-p");
auto maxPagedLOD = arguments.value(0, "--maxPagedLOD");
auto loadLevels = arguments.value(0, "--load-levels");
auto horizonMountainHeight = arguments.value(0.0, "--hmh");
Expand Down Expand Up @@ -164,7 +164,7 @@ int main(int argc, char** argv)
// add close handler to respond to the close window button and pressing escape
viewer->addEventHandler(vsg::CloseHandler::create(viewer));

if (pathFilename.empty())
if (!pathFilename)
{
if (ellipsoidModel)
{
Expand Down
8 changes: 4 additions & 4 deletions examples/nodes/vsgtiledatabase/vsgtiledatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ int main(int argc, char** argv)
arguments.read("--screen", windowTraits->screenNum);
arguments.read("--display", windowTraits->display);
arguments.read("--samples", windowTraits->samples);
auto outputFilename = arguments.value(std::string(), "-o");
auto outputFilename = arguments.value<vsg::Path>("", "-o");
auto numFrames = arguments.value(-1, "-f");
auto pathFilename = arguments.value(std::string(), "-p");
auto pathFilename = arguments.value<vsg::Path>("", "-p");
auto maxPagedLOD = arguments.value(0, "--maxPagedLOD");
auto loadLevels = arguments.value(0, "--load-levels");
auto horizonMountainHeight = arguments.value(0.0, "--hmh");
Expand Down Expand Up @@ -124,7 +124,7 @@ int main(int argc, char** argv)

if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

if (!outputFilename.empty())
if (outputFilename)
{
vsg::write(vsg_scene, outputFilename);
return 0;
Expand Down Expand Up @@ -185,7 +185,7 @@ int main(int argc, char** argv)
// add close handler to respond to the close window button and pressing escape
viewer->addEventHandler(vsg::CloseHandler::create(viewer));

if (pathFilename.empty())
if (pathFilename)
{
if (ellipsoidModel)
{
Expand Down
4 changes: 2 additions & 2 deletions examples/nodes/vsgtransform/vsgtransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int argc, char** argv)

// bool useStagingBuffer = arguments.read({"--staging-buffer", "-s"});

auto outputFilename = arguments.value<std::string>("", "-o");
auto outputFilename = arguments.value<vsg::Path>("", "-o");

if (argc<=1)
{
Expand Down Expand Up @@ -83,7 +83,7 @@ int main(int argc, char** argv)
}

// write out scene if required
if (!outputFilename.empty())
if (outputFilename)
{
vsg::write(scene, outputFilename, options);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/state/vsgstateswitch/vsgstateswitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int main(int argc, char** argv)

bool insertStateSwitch = !arguments.read("-n"); // no replacement of GraphicsPipeline, so assume loaded scene graph has required vsg::StateSwitch
bool separateRenderGraph = arguments.read("-s");
auto outputFilename = arguments.value<std::string>("", "-o");
auto outputFilename = arguments.value<vsg::Path>("", "-o");

if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

Expand Down Expand Up @@ -147,7 +147,7 @@ int main(int argc, char** argv)
scenegraph->accept(rgp);
}

if (!outputFilename.empty())
if (outputFilename)
{
vsg::write(scenegraph, outputFilename, options);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/utils/vsgbuilder/vsgbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int main(int argc, char** argv)

if (arguments.read("--shared")) options->sharedObjects = vsg::SharedObjects::create();

auto outputFilename = arguments.value<std::string>("", "-o");
auto outputFilename = arguments.value<vsg::Path>("", "-o");

bool floatColors = !arguments.read("--ubvec4-colors");
stateInfo.wireframe = arguments.read("--wireframe");
Expand Down Expand Up @@ -257,7 +257,7 @@ int main(int argc, char** argv)
}

// write out scene if required
if (!outputFilename.empty())
if (outputFilename)
{
vsg::write(scene, outputFilename, options);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/vk/vsgcompute/vsgcompute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int main(int argc, char** argv)
auto debugLayer = arguments.read({"--debug", "-d"});
auto apiDumpLayer = arguments.read({"--api", "-a"});
auto workgroupSize = arguments.value(32, "-w");
auto outputFilename = arguments.value<std::string>("", "-o");
auto outputFilename = arguments.value<vsg::Path>("", "-o");
auto outputAsFloat = arguments.read("-f");
if (arguments.errors()) return arguments.writeErrorMessages(std::cerr);

Expand Down Expand Up @@ -103,7 +103,7 @@ int main(int argc, char** argv)
auto time = std::chrono::duration<float, std::chrono::milliseconds::period>(std::chrono::steady_clock::now() - startTime).count();
std::cout << "Time to run commands " << time << "ms" << std::endl;

if (!outputFilename.empty())
if (outputFilename)
{
// Map the buffer memory and assign as a vec4Array2D that will automatically unmap itself on destruction.
auto image = vsg::MappedData<vsg::vec4Array2D>::create(bufferMemory, 0, 0, vsg::Data::Properties{VK_FORMAT_R32G32B32A32_SFLOAT}, width, height); // deviceMemory, offset, flags an d dimensions
Expand Down