INNER CODE UNIT · C++

r

mosra/magnum-integration · src/Magnum/DartIntegration/ConvertShapeNode.cpp:162

        Float r = Float(coneShape->getRadius());

        if(convertTypes & ConvertShapeType::Primitive)
            shapeData.scaling = Vector3{r};

        if(convertTypes & ConvertShapeType::Mesh) {
            Float h(coneShape->getHeight());
            Float halfLength = 0.5f*h/r;

            shapeData.meshes = Containers::Array<Trade::MeshData>(NoInit, 1);
            new(&shapeData.meshes[0]) Trade::MeshData{Primitives::coneSolid(32, 32, halfLength, Primitives::ConeFlag::CapEnd)};

            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));
        }

    /* Cylinder */

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…