INNER CODE UNIT · C++
material
mosra/magnum-integration · src/Magnum/DartIntegration/ConvertShapeNode.cpp:261
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)) {
/* Use max index if MeshShape color index is bigger
than available; this is the behavior described
in DART */
Int colorIndex = (UnsignedInt(meshShape->getColorIndex()) >= meshData->vertexCount()) ? meshData->vertexCount() - 1 : meshShape->getColorIndex();
/* Assuming AssimpImporter, which always returns
colors as Color4 */
CORRADE_INTERNAL_ASSERT(meshData->attributeFormat(Trade::MeshAttribute::Color) == VertexFormat::Vector4);