Giter Club home page Giter Club logo

radiant-rs's People

Contributors

phosphorus15 avatar sinesc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

radiant-rs's Issues

Font::with_size

Should probably be Font::clone_with_size() to be in line with Layer::with_program() vs. Layer::clone_with_program()

Move component id from Layer to Renderer::draw_layer()

Currently required at draw time since the frame offset is not fixed and depends on the number of frames in the sprite.
To move this to Renderer::draw_layer(), Sprite::draw() would have to save the frame- and component count to the AVec. The absolute offset could be computed in the shader.

Abstract the backend

Step-by-step approach.

  • First refactor components like Display, Texture, Sprite, ... to expose only abstracted API to the rest of the library (keep directly using glium internally within each component).
  • todo: Needs more details.

Add some common blendmodes

Lookup some common blendmodes and see if they can be approximated with opengl blendfuncs.
Also look into KHR_blend_equation_advanced.

Clean up font handling

Currently fonts are created with a color and size.

  • size: might make sense, maybe. (Technical reason was: Rusttype's FontCache needs a unique id per font. Might not actually need it per size though. Should be able to abstract it in either case.)
  • color: not in line with sprites, color should be set during draw.

There are various methods to write text. These could be streamlined with a builder like draw_rect() was with RectBuilder.

Add cheap blit method

Currently everything goes through shaders. Add an API to blit from one rendertarget to another.

Support builder pattern

As an alternative, support the builder pattern for Display, Font, Texture and possibly Sprite (which currently doesn't use the Info struct either)

Additional error handling

  • Font::from_info can fail with a panic if no matching system font could be found. Since this is out of the control of the programmer it must be catchable.
  • Display::new currently falls back to windowed silently if full-screen cannot be acquired.
  • Display::new currently panics if the window cannot be created.
  • sprite::parse_parameters panics if the filename is invalid. This might be ok, but needs helpful error message.

Possible use-after-free vulnerability sighted

It is confirmed that radiant-rs suffers from an use-after-free vulnerablity within the target_frame public function, a possible panic thrown by draw_func would cause an uninitialized memory to be freed, which is equivalent to use-after-free (which is constantly exploitable).

pub fn target_frame<F>(renderer: &core::Renderer, frame: &mut glium::Frame, draw_func: F) where F: FnMut() {
    let wrapper = {
        let owned_frame = mem::replace(frame, unsafe { mem::uninitialized() });
        let backend_frame = super::Frame(owned_frame);
        Rc::new(RefCell::new(Some(backend_frame)))
    };
    renderer.render_to(&core::RenderTarget::frame(&wrapper), draw_func);
    let backend_frame = mem::replace(&mut *wrapper.borrow_mut(), None).unwrap();
    let owned_frame = backend_frame.into_inner();
    let uninitialized = mem::replace(frame, owned_frame);
    mem::forget(uninitialized);
}

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.