Skip to content

Commit

Permalink
Remove all deprecated API, implementation and tests (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwestphal authored Jul 16, 2024
1 parent 1595af6 commit d8ef6a1
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 618 deletions.
45 changes: 0 additions & 45 deletions application/F3DOptionsParser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,12 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o
// cxxopts sense.
HasDefault LocalHasDefaultNo = allOptionsInitialized ? HasDefault::YES : HasDefault::NO;

#ifndef F3D_NO_DEPRECATED
// Deprecated options that needs further processing
std::string deprecatedHDRI;
std::vector<std::string> deprecatedInputs;
bool deprecatedQuiet = false;
#endif

try
{
cxxopts::Options cxxOptions(this->ExecutableName, F3D::AppTitle);
cxxOptions.custom_help("[OPTIONS...] file1 file2 ...");
// clang-format off
auto grp0 = cxxOptions.add_options("Applicative");
#ifndef F3D_NO_DEPRECATED
this->DeclareOption(grp0, "input", "", "Input files (deprecated)", deprecatedInputs, LocalHasDefaultNo, MayHaveConfig::YES , "<files>");
#endif
this->DeclareOption(grp0, "output", "", "Render to file", appOptions.Output, LocalHasDefaultNo, MayHaveConfig::YES, "<png file>");
this->DeclareOption(grp0, "no-background", "", "No background when render to file", appOptions.NoBackground, HasDefault::YES, MayHaveConfig::YES);
this->DeclareOption(grp0, "help", "h", "Print help");
Expand All @@ -348,9 +338,6 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o

auto grp1 = cxxOptions.add_options("General");
this->DeclareOption(grp1, "verbose", "", "Set verbose level, providing more information about the loaded data in the console output", appOptions.VerboseLevel, HasDefault::YES, MayHaveConfig::YES, "{debug, info, warning, error, quiet}", HasImplicitValue::YES, "debug");
#ifndef F3D_NO_DEPRECATED
this->DeclareOption(grp1, "quiet", "", "Enable quiet mode, which supersede any verbose options and prevent any console output to be generated at all (deprecated, using `--verbose=quiet` instead)", deprecatedQuiet, HasDefault::YES, MayHaveConfig::YES );
#endif
this->DeclareOption(grp1, "progress", "", "Show loading progress bar", options.getAsBoolRef("ui.loader-progress"), HasDefault::YES, MayHaveConfig::YES);
this->DeclareOption(grp1, "animation-progress", "", "Show animation progress bar", options.getAsBoolRef("ui.animation-progress"), HasDefault::YES, MayHaveConfig::YES);
this->DeclareOption(grp1, "geometry-only", "", "Do not read materials, cameras and lights from file", appOptions.GeometryOnly, HasDefault::YES, MayHaveConfig::YES);
Expand Down Expand Up @@ -383,9 +370,6 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o
this->DeclareOption(grp2, "opacity", "", "Opacity", options.getAsDoubleRef("model.color.opacity"), HasDefault::YES, MayHaveConfig::YES, "<opacity>");
this->DeclareOption(grp2, "roughness", "", "Roughness coefficient (0.0-1.0)", options.getAsDoubleRef("model.material.roughness"), HasDefault::YES, MayHaveConfig::YES, "<roughness>");
this->DeclareOption(grp2, "metallic", "", "Metallic coefficient (0.0-1.0)", options.getAsDoubleRef("model.material.metallic"), HasDefault::YES, MayHaveConfig::YES, "<metallic>");
#ifndef F3D_NO_DEPRECATED
this->DeclareOption(grp2, "hdri", "", "Path to an image file that will be used as a light source and skybox (deprecated)", deprecatedHDRI, LocalHasDefaultNo, MayHaveConfig::YES, "<file path>");
#endif
this->DeclareOption(grp2, "hdri-file", "", "Path to an image file that can be used as a light source and skybox", options.getAsStringRef("render.hdri.file"), LocalHasDefaultNo, MayHaveConfig::YES, "<file path>");
this->DeclareOption(grp2, "hdri-ambient", "f", "Enable HDRI ambient lighting", options.getAsBoolRef("render.hdri.ambient"), HasDefault::YES, MayHaveConfig::YES);
this->DeclareOption(grp2, "hdri-skybox", "j", "Enable HDRI skybox background", options.getAsBoolRef("render.background.skybox"), HasDefault::YES, MayHaveConfig::YES);
Expand Down Expand Up @@ -457,35 +441,6 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o
{
auto result = cxxOptions.parse(this->Argc, this->Argv);

#ifndef F3D_NO_DEPRECATED
if (deprecatedQuiet)
{
f3d::log::warn("--quiet option is deprecated, please use --verbose=quiet instead.");
appOptions.VerboseLevel = "quiet";
}

if (!deprecatedHDRI.empty())
{
options.set("render.hdri.file", deprecatedHDRI);
options.set("render.hdri.ambient", true);
options.set("render.background.skybox", true);

f3d::log::warn("--hdri option is deprecated, please use --hdri-file, --hdri-ambient and "
"--hdri-skybox instead.");
}

for (const std::string& input : deprecatedInputs)
{
/* `deprecatedInputs` may contain an empty string instead of being empty itself */
if (!input.empty())
{
f3d::log::warn("--input option is deprecated, please use positional arguments instead.");
break;
}
}
inputs = deprecatedInputs;
#endif

auto unmatched = result.unmatched();
bool found_unknown_option = false;
for (std::string unknownOption : unmatched)
Expand Down
9 changes: 0 additions & 9 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,6 @@ if(VTK_VERSION VERSION_GREATER_EQUAL 9.2.20221220)
f3d_test(NAME TestInteractionHDRIRaytracingFullFromNone DATA suzanne.ply THRESHOLD 120 ARGS --hdri-file=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr -r --samples=1 LONG_TIMEOUT INTERACTION)

endif()

if (NOT F3D_EXCLUDE_DEPRECATED)
f3d_test(NAME TestHDRIDeprecated DATA suzanne.ply ARGS --hdri=${F3D_SOURCE_DIR}/testing/data/palermo_park_1k.hdr LONG_TIMEOUT)
endif ()
endif()

# Zoom factor was introduced in https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9958
Expand Down Expand Up @@ -910,11 +906,6 @@ f3d_test(NAME TestNoFileConfigFile CONFIG ${F3D_SOURCE_DIR}/testing/configs/verb
# Test help display
f3d_test(NAME TestHelp ARGS --help REGEXP "Usage:")
f3d_test(NAME TestHelpPositional ARGS --help REGEXP "file1 file2 \.\.\.")
if (NOT F3D_EXCLUDE_DEPRECATED)
f3d_test(NAME TestDeprecatedHelpInput ARGS --help REGEXP "--input")
f3d_test(NAME TestDeprecatedInput ARGS --input a.b REGEXP "--input option is deprecated")
f3d_test(NAME TestDeprecatedQuietNonExistentFile DATA nonExistentFile.vtp ARGS --filename --verbose --quiet --no-render REGEXP_FAIL "File .*nonExistentFile.vtp does not exist" NO_BASELINE)
endif()

# Test version display
f3d_test(NAME TestVersion ARGS --version REGEXP "Version:")
Expand Down
10 changes: 0 additions & 10 deletions library/public/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ class F3D_EXPORT image
*/
unsigned int getWidth() const;
unsigned int getHeight() const;
#ifndef F3D_NO_DEPRECATED
F3D_DEPRECATED image& setResolution(unsigned int width, unsigned int height);
#endif
///@}

///@{ @name Channel Count
Expand All @@ -118,9 +115,6 @@ class F3D_EXPORT image
* \deprecated { setChannelCount is deprecated, use the appropriate constructor }
*/
unsigned int getChannelCount() const;
#ifndef F3D_NO_DEPRECATED
F3D_DEPRECATED image& setChannelCount(unsigned int dim);
#endif
///@}

/**
Expand All @@ -143,10 +137,6 @@ class F3D_EXPORT image
*/
image& setContent(void* buffer);
void* getContent() const;
#ifndef F3D_NO_DEPRECATED
F3D_DEPRECATED image& setData(unsigned char* buffer);
F3D_DEPRECATED unsigned char* getData() const;
#endif
///@}

/**
Expand Down
35 changes: 0 additions & 35 deletions library/src/image.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -231,32 +231,12 @@ unsigned int image::getHeight() const
return dims[1];
}

#ifndef F3D_NO_DEPRECATED
//----------------------------------------------------------------------------
image& image::setResolution(unsigned int width, unsigned int height)
{
this->Internals->Image->SetDimensions(static_cast<int>(width), static_cast<int>(height), 1);
this->Internals->Image->AllocateScalars(
VTK_UNSIGNED_CHAR, static_cast<int>(this->getChannelCount()));
return *this;
}
#endif

//----------------------------------------------------------------------------
unsigned int image::getChannelCount() const
{
return this->Internals->Image->GetNumberOfScalarComponents();
}

#ifndef F3D_NO_DEPRECATED
//----------------------------------------------------------------------------
image& image::setChannelCount(unsigned int dim)
{
this->Internals->Image->AllocateScalars(VTK_UNSIGNED_CHAR, static_cast<int>(dim));
return *this;
}
#endif

//----------------------------------------------------------------------------
image::ChannelType image::getChannelType() const
{
Expand Down Expand Up @@ -297,21 +277,6 @@ void* image::getContent() const
return this->Internals->Image->GetScalarPointer();
}

#ifndef F3D_NO_DEPRECATED
//----------------------------------------------------------------------------
image& image::setData(unsigned char* buffer)
{
this->setContent(buffer);
return *this;
}

//----------------------------------------------------------------------------
unsigned char* image::getData() const
{
return static_cast<unsigned char*>(this->getContent());
}
#endif

//----------------------------------------------------------------------------
bool image::compare(const image& reference, double threshold, image& diff, double& error) const
{
Expand Down
26 changes: 0 additions & 26 deletions library/src/options.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ class options::internals
static_assert(!std::is_array_v<T> && !std::is_pointer_v<T>);
try
{
#ifndef F3D_NO_DEPRECATED
if (this->IsDeprecated(name))
{
log::warn("Option ", name, " is deprecated");
}
#endif
T& opt = std::get<T>(this->Options.at(name));
opt = value;
}
Expand Down Expand Up @@ -94,12 +88,6 @@ class options::internals
{
try
{
#ifndef F3D_NO_DEPRECATED
if (this->IsDeprecated(name))
{
log::warn("Option ", name, " is deprecated");
}
#endif
return std::get<T>(this->Options.at(name));
}
catch (const std::bad_variant_access&)
Expand All @@ -113,17 +101,6 @@ class options::internals
}
}

#ifndef F3D_NO_DEPRECATED
bool IsDeprecated(const std::string& name)
{
// compile time list of deprecated options
constexpr std::string_view deprecated[] = { "render.background.hdri" };

auto it = std::find(std::begin(deprecated), std::end(deprecated), name);
return it != std::end(deprecated);
}
#endif

std::map<std::string, OptionVariant> Options;
};

Expand Down Expand Up @@ -166,9 +143,6 @@ options::options()
this->Internals->init("render.hdri.file", std::string());
this->Internals->init("render.hdri.ambient", false);
this->Internals->init("render.background.color", std::vector<double>{ 0.2, 0.2, 0.2 });
#ifndef F3D_NO_DEPRECATED
this->Internals->init("render.background.hdri", std::string());
#endif
this->Internals->init("render.background.skybox", false);
this->Internals->init("render.background.blur", false);
this->Internals->init("render.background.blur.coc", 20.0);
Expand Down
9 changes: 0 additions & 9 deletions library/src/window_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,6 @@ void window_impl::UpdateDynamicOptions()
std::string hdriFile = this->Internals->Options.getAsString("render.hdri.file");
bool hdriAmbient = this->Internals->Options.getAsBool("render.hdri.ambient");
bool hdriSkybox = this->Internals->Options.getAsBool("render.background.skybox");
#ifndef F3D_NO_DEPRECATED
std::string legacyHDRI = this->Internals->Options.getAsString("render.background.hdri");
if (!legacyHDRI.empty())
{
hdriFile = legacyHDRI;
hdriAmbient = true;
hdriSkybox = true;
}
#endif
this->Internals->Renderer->SetHDRIFile(hdriFile);
this->Internals->Renderer->SetUseImageBasedLighting(hdriAmbient);
this->Internals->Renderer->ShowHDRISkybox(hdriSkybox);
Expand Down
5 changes: 0 additions & 5 deletions library/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ list(APPEND libf3dSDKTests_list
TestSDKWindowNative.cxx
)

if(NOT F3D_EXCLUDE_DEPRECATED)
list(APPEND libf3dSDKTests_list
TestSDKImageDeprecated.cxx)
endif()

# HDRI test needs https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9767
if(VTK_VERSION VERSION_GREATER_EQUAL 9.2.20221220)
list(APPEND libf3dSDKTests_list
Expand Down
15 changes: 0 additions & 15 deletions library/testing/TestSDKDynamicHDRI.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,5 @@ int TestSDKDynamicHDRI(int argc, char* argv[])
}
#endif

#ifndef F3D_NO_DEPRECATED
// Check deprecated HDRI options
opt.set("render.hdri.ambient", false);
opt.set("render.background.skybox", false);
opt.set("render.background.hdri", std::string(argv[1]) + "data/palermo_park_1k.hdr");

ret = TestSDKHelpers::RenderTest(eng.getWindow(), std::string(argv[1]) + "baselines/",
std::string(argv[2]), "TestSDKDynamicHDRI", 50);
if (!ret)
{
std::cerr << "Render with deprecated HDRI option failed" << std::endl;
return EXIT_FAILURE;
}
#endif

return EXIT_SUCCESS;
}
Loading

0 comments on commit d8ef6a1

Please sign in to comment.