INNER CODE UNIT · C++
r
mosra/magnum-integration · src/Magnum/DartIntegration/ConvertShapeNode.cpp:183
Float r = Float(cylinderShape->getRadius());
if(convertTypes & ConvertShapeType::Primitive)
shapeData.scaling = Vector3{r};
if(convertTypes & ConvertShapeType::Mesh) {
Float h(cylinderShape->getHeight());
Float halfLength = 0.5f*h/r;
shapeData.meshes = Containers::Array<Trade::MeshData>(NoInit, 1);
new(&shapeData.meshes[0]) Trade::MeshData{Primitives::cylinderSolid(32, 32, halfLength, Primitives::CylinderFlag::CapEnds)};
Matrix4 rot = Matrix4::rotationX(90.0_degf);
MeshTools::transformVectorsInPlace(rot, shapeData.meshes[0].mutableAttribute<Vector3>(Trade::MeshAttribute::Position));
MeshTools::transformVectorsInPlace(rot, shapeData.meshes[0].mutableAttribute<Vector3>(Trade::MeshAttribute::Normal));
}
/* Ellipsoid */