Giter Site home page Giter Site logo

bevy_debug_lines's Introduction

bevy_debug_lines

A prototype plugin providing a simple line drawing api for bevy.

See docs.rs for documentation.

Expect breakage on master.

demo demo_2 Click on the above demo to play it.

About

This plugin uses a shader and sends individual points to the GPU, which then moves geometry to make a line. This is quite fast with a significant number of lines, and there is no added cost to moving lines around.

Usage

Add bevy_prototype_debug_lines to your Cargo.toml:

[dependencies]
bevy_prototype_debug_lines = "0.2.0"

Add the plugin in your App::build() phase:

use bevy::prelude::*;
use bevy_prototype_debug_lines::*;

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_plugin(DebugLinesPlugin)
        ...
        .run();
}

Draw a line in whatever system you have using the DebugLines resource:

fn some_system(
    ...
    mut lines: ResMut<DebugLines>
) {
    let start = Vec3::splat(-1.0);
    let end = Vec3::splat(1.0);
    let thickness = 0.01;
    lines.line(start, end, thickness);
}

See the examples for more complete usage examples.

Running Examples

You can run the examples like so:

cargo run --example 3d --features="example_deps"

Where 3d is one of the files in the examples

Notes and Missing Stuff

This plugin is incomplete, so there are some things missing and general annoyances:

  • More gracefully handle exceeding max lines (128000).
  • More, I'm sure...

Let me know if you have any requests, improvements, or suggestions on how to make this crate more ergonomic.

bevy_debug_lines's People

Contributors

toqozz avatar

Watchers

 avatar

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.