Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: issue #1220. (backport #1237) #1248

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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