8000 GitHub - shanecelis/bevy_plane_cut: A plane cut material for bevy
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

shanecelis/bevy_plane_cut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

bevy_plane_cut

Maintenance CI crates-io api-docs

A plane cut material for the bevy game engine.

simple example

Install

Install the crate.

cargo add bevy_plane_cut

Usage

Add Plugin to App

use bevy::prelude::*;
fn main() {
    App::new()
        .add_plugins(bevy_plane_cut::PlaneCutPlugin)
        .run();
}

Add Material to Object

use bevy::{
    prelude::*,
    color::palettes::basic,
    pbr::ExtendedMaterial,
};
use bevy_plane_cut::*;

fn setup(
    mut commands: Commands,
    mut meshes: ResMut<Assets<Mesh>>,
    mut materials: ResMut<Assets<PlaneCutMaterial>>) {

    commands.spawn(MaterialMeshBundle {
        mesh: meshes.add(Sphere::new(1.0)),
        material: materials.add(ExtendedMaterial {
            base: StandardMaterial {
                base_color: basic::RED.into(),
                ..default()
            },
            extension: PlaneCutExt {
                plane: Vec4::new(-1.0, 1.0, -2.0, 0.0),
                color: Color::linear_rgb(0.0, 0.0, 0.7),
                shaded: true,
                space: Space::World,
            },
        }),
        ..default()
    });
}

Examples

Run the "simple" example like so:

cargo run --example simple

This will show a red sphere with a light rotating around it and blue plane cut.

  • simple - A red sphere with a plane cut.
  • simple_screenspace - A red sphere with a plane cut in screen space.
  • moving_cut - A red sphere with a plane cut moving in and out.

Not Working Examples

simple_deferred

  • simple_deferred - same as simple but using deferred renderer. NOTE: This one does not look right on my macOS machine.
  • deferred - A red sphere rendered with deferred renderer. This has no plane cut at all and it still does not look right. I'm using macOS, so I'd be curious if it looks correct on other platforms.
  • two_cuts - This is a material that has been extended by PlaneCutExt twice. However, it has a bug. See two_cuts.rs example for more details. PRs welcome!

Compatibility

bevy_plane_cut bevy
0.2 0.14
0.1 0.13

License

This crate is licensed under the MIT License or the Apache License 2.0. The examples are licensed under the CC0 license.

Acknowlegments

About

A plane cut material for bevy

Resources

License

Apache-2.0 and 2 other licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
CC0-1.0
LICENSE-CC0
MIT
LICENSE-MIT

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published
0