Skip to content

Commit

Permalink
Fix: issue #1220. (#1237)
Browse files Browse the repository at this point in the history
Signed-off-by: chama1176 <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
(cherry picked from commit 85dfbef)
  • Loading branch information
chama1176 authored and mergify[bot] committed Jul 19, 2024
1 parent 3d472c3 commit 1d973de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

#include "assimp_loader.hpp"

#include <algorithm>
#include <cctype>
#include <filesystem>
#include <memory>
#include <string>
#include <vector>
Expand Down Expand Up @@ -245,6 +248,18 @@ std::vector<Ogre::MaterialPtr> AssimpLoader::loadMaterials(
const std::string & resource_path, const aiScene * scene)
{
std::vector<Ogre::MaterialPtr> material_table_out;

std::string ext = std::filesystem::path(resource_path).extension().string();
std::transform(ext.begin(), ext.end(), ext.begin(),
[](unsigned char c) {return std::tolower(c);});
// STL meshes don't support proper
// materials: use Ogre's default material
if (ext == ".stl" || ext == ".stlb") {
material_table_out.push_back(
Ogre::MaterialManager::getSingleton().getByName("BaseWhiteNoLighting"));
return material_table_out;
}

for (uint32_t i = 0; i < scene->mNumMaterials; i++) {
std::string material_name;
material_name = resource_path + "Material" + std::to_string(i);
Expand Down
3 changes: 3 additions & 0 deletions rviz_rendering/src/rviz_rendering/ogre_logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class CustomOgreLogListener : public Ogre::LogListener
case Ogre::LogMessageLevel::LML_NORMAL:
RVIZ_RENDERING_LOG_INFO(message.c_str());
break;
case Ogre::LogMessageLevel::LML_WARNING:
RVIZ_RENDERING_LOG_WARNING(message.c_str());
break;
case Ogre::LogMessageLevel::LML_CRITICAL:
RVIZ_RENDERING_LOG_ERROR(message.c_str());
break;
Expand Down

0 comments on commit 1d973de

Please sign in to comment.