New to Amethyst, trying to display a generated mesh, would like some help

(Martin) #1

I am trying to display a mesh that I have generated myself. I have half written the code for the mesh, but I’m not sure what I need to do to make it build and run.

First, I have written two functions, which create a mesh and a PNG that will be UV mapped onto the mesh.

pub fn make_mesh() -> ( // returns (mesh_points, mesh_triangles, uvs)


pub fn make_image() -> image::DynamicImage

Now I call these functions, and then try to use them in some simple code, which is basically the standard Amethyst example code.

        let (mesh_points, mesh_triangles, uvs) = make_data::make_mesh();
        let image = make_data::make_image();
        let (mesh, albedo) = {
            let mesh = world.exec(|loader: AssetLoaderSystemData<'_, Mesh>| {
            let image_data = load_from_image(
                ImageTextureConfig {
                    format: Some(ImageFormat::PNG),
                    sampler_info: SamplerInfo::new(Filter::Linear, WrapMode::Border),
            let albedo = world.exec(|loader: AssetLoaderSystemData<'_, Texture>| {
                loader.load_from_data(image_data, ())

            (mesh, albedo)

This is not building at all. I just have no idea at this stage which types and methods I should be using.

The Amethyst documentation is a bit light on at this point, so I would welcome any advice on how to proceed.

(Chris Burnor) #2

What are the build errors that code above is generating? Or is it ‘building’ but not actually rendering to screen?