ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
TextureRendererBase.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
9 
10 #include <CVLog.h>
11 #include <ecvMaterialSet.h>
12 
13 // VTK
14 #include <vtkActor.h>
15 #include <vtkProperty.h>
16 
17 namespace PclUtils {
18 namespace renders {
19 
20 void TextureRendererBase::ClearTextures(vtkActor* actor) {
21  if (!actor) return;
22  vtkProperty* property = actor->GetProperty();
23  if (property) {
24  property->RemoveAllTextures();
25  }
26 }
27 
28 bool TextureRendererBase::ValidateActor(vtkActor* actor) const {
29  if (!actor) {
30  CVLog::Error("[TextureRendererBase::ValidateActor] Actor is null");
31  return false;
32  }
33  return true;
34 }
35 
37  const ccMaterialSet* materials) const {
38  if (!materials) {
40  "[TextureRendererBase::ValidateMaterials] Materials is null");
41  return false;
42  }
43  if (materials->empty()) {
45  "[TextureRendererBase::ValidateMaterials] Materials is empty");
46  return false;
47  }
48  return true;
49 }
50 
51 } // namespace renders
52 } // namespace PclUtils
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
Definition: CVLog.cpp:133
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Definition: CVLog.cpp:143
void ClearTextures(vtkActor *actor)
Helper: Clear all textures from actor.
bool ValidateActor(vtkActor *actor) const
Helper: Validate actor.
bool ValidateMaterials(const class ccMaterialSet *materials) const
Helper: Validate materials.
Mesh (triangle) material.