Merged color Mesh


using GeometryBasics

using AbstractPlotting

function colormesh((geometry, color))
    mesh1 = normal_mesh(geometry)
    npoints = length(GeometryBasics.coordinates(mesh1))
    return GeometryBasics.pointmeta(mesh1; color=fill(color, npoints))
end
# create an array of differently colored boxes in the direction of the 3 axes
x = Vec3f0(0); baselen = 0.2f0; dirlen = 1f0
rectangles = [
    (Rect(Vec3f0(x), Vec3f0(dirlen, baselen, baselen)), RGBAf0(1,0,0,1)),
    (Rect(Vec3f0(x), Vec3f0(baselen, dirlen, baselen)), RGBAf0(0,1,0,1)),
    (Rect(Vec3f0(x), Vec3f0(baselen, baselen, dirlen)), RGBAf0(0,0,1,1))
]

meshes = map(colormesh, rectangles)
mesh(merge(meshes))