INNER CODE UNIT · C++
colorMode
mosra/magnum-integration · src/Magnum/DartIntegration/ConvertShapeNode.cpp:254
auto colorMode = meshShape->getColorMode();
/* Only get materials from mesh if the appropriate color mode */
if(importer->materialCount() && convertTypes & ConvertShapeType::Material) {
if(colorMode == dart::dynamics::MeshShape::ColorMode::MATERIAL_COLOR) {
/* Assuming AssimpImporter, which has no concept of
unassigned materials */
CORRADE_INTERNAL_ASSERT(meshMaterial.second() != -1);
Containers::Optional<Trade::MaterialData> material = importer->material(meshMaterial.second());
if(material) {
materials[i] = std::move(*material).as<Trade::PhongMaterialData>();
} else {
Warning{} << "DartIntegration::convertShapeNode(): could not load material with index" << meshMaterial.second() << Debug::nospace << ". Falling back to SHAPE_COLOR mode";
materials[i] = std::move(nodeMaterial);
}
} else if(colorMode == dart::dynamics::MeshShape::ColorMode::COLOR_INDEX) {
/* Get diffuse color from Mesh color */
if(meshData->hasAttribute(Trade::MeshAttribute::Color)) {