ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
MultiTextureRenderer.h
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 
8 #pragma once
9 
10 #include <ecvMaterial.h>
11 
13 
14 // Forward declarations
15 class vtkTexture;
16 class vtkActor;
17 class vtkTextureUnitManager;
18 class vtkRenderWindow;
19 
20 namespace PclUtils {
21 namespace renders {
22 
33 public:
35  ~MultiTextureRenderer() override = default;
36 
37  bool CanHandle(size_t material_count,
38  bool has_pbr_textures,
39  bool has_multiple_map_kd) const override;
40 
41  RenderingMode GetMode() const override;
42 
43  bool Apply(vtkLODActor* actor,
44  const class ccMaterialSet* materials,
45  vtkPolyData* polydata,
46  vtkRenderer* renderer) override;
47 
48  bool Update(vtkActor* actor,
49  const class ccMaterialSet* materials,
50  vtkPolyData* polydata,
51  vtkRenderer* renderer) override;
52 
53  std::string GetName() const override;
54 
59  bool ApplyMaterial(ccMaterial::CShared material,
60  vtkActor* actor,
61  float intensity_scale = 1.0f) const;
62 
63 private:
67  int LoadTexture(ccMaterial::CShared material, ::vtkTexture* vtk_tex) const;
68 
72  ::vtkTextureUnitManager* GetTextureUnitManager(
73  ::vtkRenderWindow* render_window) const;
74 };
75 
76 } // namespace renders
77 } // namespace PclUtils
PclUtils::renders::MultiTextureRenderer::ApplyMaterial
bool ApplyMaterial(ccMaterial::CShared material, vtkActor *actor, float intensity_scale=1.0f) const
Apply material properties to actor.
Definition: MultiTextureRenderer.cpp:582
ecvMaterial.h
ecvColor::RgbaTpl::g
Type g
Definition: ecvColorTypes.h:150
PclUtils::renders::MultiTextureRenderer::Update
bool Update(vtkActor *actor, const class ccMaterialSet *materials, vtkPolyData *polydata, vtkRenderer *renderer) override
Update existing actor with new materials.
Definition: MultiTextureRenderer.cpp:428
cloudViewer::utility::filesystem::DirectoryExists
bool DirectoryExists(const std::string &directory)
Definition: FileSystem.cpp:473
cloudViewer::utility::filesystem::IsDirectory
bool IsDirectory(const std::string &directory)
Definition: FileSystem.cpp:454
FileSystem.h
PclUtils::renders::MultiTextureRenderer::~MultiTextureRenderer
~MultiTextureRenderer() override=default
MultiTextureRenderer.h
cloudViewer::utility::filesystem::GetFileExtensionInLowerCase
std::string GetFileExtensionInLowerCase(const std::string &filename)
Definition: FileSystem.cpp:281
PclUtils::renders::MultiTextureRenderer::GetMode
RenderingMode GetMode() const override
Get the rendering mode this renderer implements.
Definition: MultiTextureRenderer.cpp:63
CVLog::Print
static bool Print(const char *format,...)
Prints out a formatted message in console.
Definition: CVLog.cpp:113
CVLog.h
ccMaterial::CShared
QSharedPointer< const ccMaterial > CShared
Const + Shared type.
Definition: ecvMaterial.h:31
vtkSmartPointer
Definition: WidgetMap.h:20
PclUtils
Definition: CustomContextItem.cpp:18
CVLog::PrintDebug
static bool PrintDebug(const char *format,...)
Same as Print, but works only in Debug mode.
Definition: CVLog.cpp:153
PclUtils::renders::TextureRendererBase::ValidateMaterials
bool ValidateMaterials(const class ccMaterialSet *materials) const
Helper: Validate materials.
Definition: TextureRendererBase.cpp:36
CVLog::Error
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Definition: CVLog.cpp:143
cloudViewer::utility::filesystem::FileExists
bool FileExists(const std::string &filename)
Definition: FileSystem.cpp:524
cloudViewer::utility::filesystem::IsFile
bool IsFile(const std::string &filename)
Definition: FileSystem.cpp:435
ccMaterial::GetTexture
static QImage GetTexture(const QString &absoluteFilename)
Returns the texture image associated to a given name.
Definition: ecvMaterial.cpp:206
PclUtils::renders::MultiTextureRenderer::MultiTextureRenderer
MultiTextureRenderer()
cloudViewer::t::geometry::path
static const std::string path
Definition: PointCloud.cpp:59
ecvColor::RgbaTpl::r
Type r
Definition: ecvColorTypes.h:150
PclUtils::renders::RenderingMode::MULTI_TEXTURE
@ MULTI_TEXTURE
PclUtils::renders::MultiTextureRenderer::Apply
bool Apply(vtkLODActor *actor, const class ccMaterialSet *materials, vtkPolyData *polydata, vtkRenderer *renderer) override
Apply rendering to actor.
Definition: MultiTextureRenderer.cpp:67
cloudViewer::utility::filesystem::ListFilesInDirectory
bool ListFilesInDirectory(const std::string &directory, std::vector< std::string > &filenames)
Definition: FileSystem.cpp:561
cloudViewer::utility::filesystem::GetFileParentDirectory
std::string GetFileParentDirectory(const std::string &filename)
Definition: FileSystem.cpp:314
PclUtils::renders::RenderingMode
RenderingMode
Rendering mode enumeration.
Definition: TextureRendererBase.h:35
CVTools::FromQString
static std::string FromQString(const QString &qs)
Definition: CVTools.cpp:100
ccMaterial::TextureMapType
TextureMapType
Texture map types for PBR materials.
Definition: ecvMaterial.h:176
ecvColor::RgbaTpl::a
Type a
Definition: ecvColorTypes.h:150
CVTools.h
CVLog::Warning
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
Definition: CVLog.cpp:133
ecvMaterialSet.h
PclUtils::renders::TextureRendererBase
Base class for all texture renderers.
Definition: TextureRendererBase.h:48
ccMaterialSet
Mesh (triangle) material.
Definition: ecvMaterialSet.h:16
TextureRendererBase.h
cloudViewer::utility::ToUpper
std::string ToUpper(const std::string &s)
Convert string to the upper case.
Definition: Helper.cpp:249
PclUtils::renders::TextureRendererBase::ClearTextures
void ClearTextures(vtkActor *actor)
Helper: Clear all textures from actor.
Definition: TextureRendererBase.cpp:20
PclUtils::renders::MultiTextureRenderer::CanHandle
bool CanHandle(size_t material_count, bool has_pbr_textures, bool has_multiple_map_kd) const override
Check if this renderer can handle the given material.
Definition: MultiTextureRenderer.cpp:51
PclUtils::renders::MultiTextureRenderer
Multi-texture renderer.
Definition: MultiTextureRenderer.h:32
ecvColor::RgbaTpl::b
Type b
Definition: ecvColorTypes.h:150
PclUtils::renders::TextureRendererBase::ValidateActor
bool ValidateActor(vtkActor *actor) const
Helper: Validate actor.
Definition: TextureRendererBase.cpp:28
PclUtils::renders::MultiTextureRenderer::GetName
std::string GetName() const override
Get renderer name for logging.
Definition: MultiTextureRenderer.cpp:446
MaterialConverter.h
ecvColor::RgbaTpl
RGBA color structure.
Definition: ecvColorTypes.h:145