Giter VIP home page Giter VIP logo

Comments (5)

mrDIMAS avatar mrDIMAS commented on May 25, 2024 1

I'll add this information to the book.

from fyrox.

Wandalen avatar Wandalen commented on May 25, 2024

Same question regarding renderer?

fn set_quality_settings(renderer: &mut Renderer) {
    let mut settings = QualitySettings::high();

    // Disable something.
    settings.use_ssao = false;
    settings.fxaa = false;

    // Apply.
    Log::verify(renderer.set_quality_settings(&settings))
}

from fyrox.

Wandalen avatar Wandalen commented on May 25, 2024

I've found zero examples which use any kind of builder, but UI. Frustrating :(

from fyrox.

mrDIMAS avatar mrDIMAS commented on May 25, 2024

Hi! You need to borrow a scene from the container: let scene = &mut context.scenes[self.scene]. It can be done in pretty much any methods of your plugin. Keep in mind, that game template uses async scene loader and self.scene will be set to a correct value on after the scene is fully loaded. So ideally, you should do a checked borrow if let Some(scene) = context.scenes.try_get_mut(self.scene) { ... }. Also, if you need to catch the moment when you scene is fully loaded, then you could place your code in the place where the scene is fetched from the async loader (here for example - https://github.com/FyroxEngine/Fyrox-demo-projects/blob/main/sound/game/src/lib.rs#L137).

About the renderer: you can access it from graphics context. For example: if let GraphicsContext::Initialized(ref mut graphics_context) = plugin.graphics_context { ... }. Notice the GraphicsContext::Initialized - since creation of the graphics context is delayed to Event::Resumed, at the start of your app, there's no GraphicsContext, it will be created shortly after. If you need to catch the moment when it is fully initialized, use Plugin::on_graphics_context_initialized method.

These quirks are here, because the engine supports WebAssembly and Android. Both of these platforms enforces their limitations and we have to live with them.

from fyrox.

mrDIMAS avatar mrDIMAS commented on May 25, 2024

Added:

  1. Fetching scenes - https://fyrox-book.github.io/fyrox/scene/scene.html#where-all-my-scenes-located
  2. Fetching renderer - https://fyrox-book.github.io/fyrox/rendering/settings.html#how-to-apply
    I'm closing the issue.

from fyrox.

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.