Skip to content

Commit

Permalink
Fix --no-render issue (#1289)
Browse files Browse the repository at this point in the history
* Improve renderer initialization code

* Fixing an issue with `--no-render` mode

 - Fix an issue with `--no-render -x --hdri-ambient`
 - Add a test for it
  • Loading branch information
mwestphal authored Feb 15, 2024
1 parent fc1760d commit a5ecb6b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
3 changes: 1 addition & 2 deletions application/F3DStarter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,9 @@ int F3DStarter::Start(int argc, char** argv)
// Load a file
this->LoadFile();

f3d::log::debug("========== Rendering ==========");

if (!this->Internals->AppOptions.NoRender)
{
f3d::log::debug("========== Rendering ==========");
f3d::window& window = this->Internals->Engine->getWindow();
f3d::interactor& interactor = this->Internals->Engine->getInteractor();

Expand Down
1 change: 1 addition & 0 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ f3d_test(NAME TestNonExistentFile DATA nonExistentFile.vtp ARGS --filename WILL_
f3d_test(NAME TestUnsupportedFile DATA unsupportedFile.dummy ARGS --filename WILL_FAIL)
f3d_test(NAME TestComponentName DATA from_abq.vtu ARGS --scalars --bar --comp=2 DEFAULT_LIGHTS)
f3d_test(NAME TestNoRender DATA dragon.vtu NO_RENDER)
f3d_test(NAME TestNoRenderWithOptions DATA dragon.vtu ARGS --hdri-ambient --axis NO_RENDER) # These options causes issues if not handled correctly
f3d_test(NAME TestNoFile NO_DATA_FORCE_RENDER)
f3d_test(NAME TestGroupGeometries DATA mb/recursive ARGS --group-geometries DEFAULT_LIGHTS)
f3d_test(NAME TestGroupGeometriesColoring DATA mb/recursive ARGS --group-geometries --scalars=Polynomial -b DEFAULT_LIGHTS)
Expand Down
2 changes: 2 additions & 0 deletions library/VTKExtensions/Rendering/vtkF3DRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ void vtkF3DRenderer::ReleaseGraphicsResources(vtkWindow* w)
void vtkF3DRenderer::Initialize(const std::string& up)
{
this->OriginalLightIntensities.clear();
this->RemoveAllViewProps();
this->RemoveAllLights();

this->AddActor(this->FilenameActor);
this->AddActor(this->GridActor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void vtkF3DRendererWithColoring::SetImporter(vtkF3DGenericImporter* importer)
//----------------------------------------------------------------------------
void vtkF3DRendererWithColoring::Initialize(const std::string& up)
{
this->RemoveAllViewProps();
this->RemoveAllLights();
// This remove all actors and view props
this->Superclass::Initialize(up);

this->ArrayIndexForColoring = -1;
this->ComponentForColoring = -1;
Expand All @@ -95,8 +95,6 @@ void vtkF3DRendererWithColoring::Initialize(const std::string& up)
this->CheatSheetConfigured = false;
this->ColoringActorsPropertiesConfigured = false;
this->ColoringConfigured = false;

this->Superclass::Initialize(up);
}

//----------------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions library/src/window_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@ void window_impl::UpdateDynamicOptions()
this->Initialize(false);
}

if (this->Internals->WindowType == Type::NONE)
{
// With a NONE window type, only update the actors to get accurate bounding box information
this->Internals->Renderer->UpdateActors();
return;
}

// Set the cache path if not already
this->Internals->Renderer->SetCachePath(this->Internals->GetCachePath());

Expand Down

0 comments on commit a5ecb6b

Please sign in to comment.