Git Product home page Git Product logo

Comments (4)

fu5ha avatar fu5ha commented on August 28, 2024 3

from rendy.

carnoxen avatar carnoxen commented on August 28, 2024 1

Hi, I want to ask for an error. I compiled this project, but got this error ⬇

[ERROR][rendy_resource::escape] Terminal must be dropped after all `Escape`s
[ERROR][rendy_resource::escape] Terminal must be dropped after all `Escape`s
[ERROR][rendy_resource::escape] Terminal must be dropped after all `Escape`s
[ERROR][rendy_resource::escape] Terminal must be dropped after all `Escape`s
[ERROR][rendy_resource::escape] Terminal must be dropped after all `Escape`s
[ERROR][rendy_resource::escape] Terminal must be dropped after all `Escape`s

It seems related about this issue, so is there anything for fixing this?

from rendy.

zakarumych avatar zakarumych commented on August 28, 2024

Cleanup methods require exclusive access to factory.
If you create separate factories then rendy share nothing, except atomic integer to generate ids, but backend can share something.

from rendy.

crsaracco avatar crsaracco commented on August 28, 2024

Not sure how related this is, but I also got this while generating meshes and materials. Would something like this run in multiple threads?

struct GameState;
impl SimpleState for GameState {
    fn on_start(&mut self, state_data: StateData<'_, GameData<'_, '_>>) {
        initialize_camera(state_data.world);

        for x in -1..2 {
            for y in -1..2 {
                for z in -1..2 {
                    initialize_cube(state_data.world, x as f32 * 3.0, y as f32 * 3.0, z as f32 * 3.0);
                }
            }
        }

        initialize_light(state_data.world);
    }
}

fn initialize_cube(world: &mut World, x: f32, y: f32, z: f32) {
    let mesh = world.exec(|loader: AssetLoaderSystemData<'_, Mesh>| {
        loader.load_from_data(
            Shape::Cube
                .generate::<(Vec<Position>, Vec<Normal>, Vec<Tangent>, Vec<TexCoord>)>(None)
                .into(),
            (),
        )
    });

    let albedo = material_generator::albedo(world, 1.0, 0.0, 0.0, 1.0);
    let metallic_roughness = material_generator::metallic_roughness(world, 0.5, 0.5);
    let material = material_generator::generate_material(world, albedo, metallic_roughness);

    let mut transform = Transform::default();
    transform.set_translation_xyz(x, y, z);

    world
        .create_entity()
        .with(mesh)
        .with(material)
        .with(transform)
        .build();
}

// `metallic_roughness` and `generate_material` look similar
pub fn albedo(world: &mut World, red: f32, green: f32, blue: f32, alpha: f32) -> Handle<Texture> {
    let albedo = world.exec(|loader: AssetLoaderSystemData<'_, Texture>| {
        loader.load_from_data(
            load_from_linear_rgba(LinSrgba::new(red, green, blue, alpha)).into(),
            (),
        )
    });
    albedo
}

from rendy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.