19 #include <vtkLODActor.h>
20 #include <vtkPolyData.h>
21 #include <vtkPolyDataMapper.h>
22 #include <vtkRenderer.h>
28 : vtk_renderer_(
std::make_unique<
VtkUtils::VtkMultiTextureRenderer>()) {}
31 bool has_pbr_textures,
32 bool has_multiple_map_kd)
const {
43 return material_count == 1 && !has_multiple_map_kd;
50 vtkPolyData* polydata,
51 vtkRenderer* renderer) {
57 "[PBRRenderer::Apply] Applying unified PBR rendering for %zu "
59 "(VTK PBR only supports single material per actor, using first "
60 "material). VtkMultiTextureRenderer will automatically detect "
62 "(PBR/TEXTURED/MATERIAL_ONLY) based on material properties.",
69 "[PBRRenderer::Apply] Converted material '%s': "
70 "baseColorTexture=%s, normalTexture=%s, metallicTexture=%s, "
71 "roughnessTexture=%s, aoTexture=%s, hasPBRTextures=%d, "
73 pbr_material.name.c_str(), pbr_material.baseColorTexture.c_str(),
74 pbr_material.normalTexture.c_str(),
75 pbr_material.metallicTexture.c_str(),
76 pbr_material.roughnessTexture.c_str(),
77 pbr_material.aoTexture.c_str(), pbr_material.hasPBRTextures(),
78 pbr_material.hasAnyTexture());
83 bool result = vtk_renderer_->ApplyPBRMaterial(actor_ptr, pbr_material,
88 "[PBRRenderer::Apply] PBR material applied successfully");
90 CVLog::Error(
"[PBRRenderer::Apply] Failed to apply PBR material");
98 vtkPolyData* polydata,
99 vtkRenderer* renderer) {
104 vtkLODActor* lod_actor = vtkLODActor::SafeDownCast(actor);
107 "[PBRRenderer::Update] Actor is not a vtkLODActor, cannot "
112 return Apply(lod_actor, materials, polydata, renderer);
static bool PrintDebug(const char *format,...)
Same as Print, but works only in Debug mode.
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static bool Error(const char *format,...)
Display an error dialog with formatted message.
static VtkUtils::VtkMultiTextureRenderer::PBRMaterial FromMaterialSet(const ccMaterialSet *materials)
Convert first material from ccMaterialSet to PBRMaterial.
bool Apply(vtkLODActor *actor, const class ccMaterialSet *materials, vtkPolyData *polydata, vtkRenderer *renderer) override
Apply rendering to actor.
std::string GetName() const override
Get renderer name for logging.
RenderingMode GetMode() const override
Get the rendering mode this renderer implements.
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.
bool Update(vtkActor *actor, const class ccMaterialSet *materials, vtkPolyData *polydata, vtkRenderer *renderer) override
Update existing actor with new materials.
bool ValidateActor(vtkActor *actor) const
Helper: Validate actor.
bool ValidateMaterials(const class ccMaterialSet *materials) const
Helper: Validate materials.
Mesh (triangle) material.
RenderingMode
Rendering mode enumeration.