This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// plugin for demonstrating bevy v0.13 system stepping using egui interface | |
// Released under the MIT License | |
use std::collections::HashMap; | |
use bevy::{ | |
app::MainScheduleOrder, | |
ecs::schedule::{InternedScheduleLabel, NodeId, ScheduleLabel, Stepping}, | |
prelude::*, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# used this on an ubuntu docker image with `apt install python3-libfshfs` | |
import pyfshfs | |
import os | |
def export_file(entry, dest): | |
print(f'export {dest}') | |
dir = os.path.dirname(dest) | |
if not os.path.exists(dir): | |
os.makedirs(dir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn gltf_node_spawner( | |
mut commands: Commands, | |
node_handles: Query<(Entity, &Handle<GltfNode>), Added<Handle<GltfNode>>>, | |
assets_gltf_nodes: Res<Assets<GltfNode>>, | |
assets_gltf_mesh: Res<Assets<GltfMesh>>, | |
) { | |
for (parent, handle) in &node_handles { | |
let Some(node) = assets_gltf_nodes.get(handle) else { | |
warn!("GltfNode not found: entity {:?}, {:?}", parent, handle); | |
continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// bevy v0.12 demo of rendering a single entity at multiple locations | |
/// | |
/// Motivation: | |
/// I have a use-case in my game where I have a single entity (with various | |
/// components) that must be visible at two places on the screen at the same | |
/// time (non-euclidean grid shenanigans). I didn't want to duplicate a | |
/// subset of the entity's components then manage the duplicate's lifetime. | |
/// Through conversations in the bevy discord, the idea came up of making | |
/// modifications to the render pipeline to achive this. | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// implemention of SystemParam-based egui Widgets for bevy 0.10 | |
/// adapted from: https://github.com/bevyengine/bevy/discussions/5522 | |
/// | |
/// Effectively widgets can access world components/resources similar | |
/// to systems. | |
#![allow(clippy::type_complexity)] | |
use bevy::ecs::system::{SystemParam, SystemState}; | |
use bevy::prelude::*; | |
use bevy_egui::egui; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// minimal example of adding a custom render pipeline in bevy 0.11. | |
/// | |
/// When this example runs, you should only see a blue screen. There are no | |
/// vertex buffers, or anything else in this example. Effectively it is | |
/// shader-toy written in bevy. | |
/// | |
/// This revision adds a post-processing node to the RenderGraph to | |
/// execute the shader. Thanks to @Jasmine on the bevy discord for | |
/// suggesting I take a second look at the bevy post-processing example | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Example workaround for ecs-based race-conditions when used in muds. | |
//! The key problem is two characters stunning each other in the same | |
//! frame, only one of them should end up stunned. | |
//! | |
//! This solution in bevy uses an exclusive system that runs without | |
//! world deferment. | |
#[allow(unused)] | |
use anyhow::{bail, Result}; | |
use bevy::{log::LogPlugin, prelude::*}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Navigate cscope in neovim using telescope with multiple databases | |
Setup: | |
local cscope = require('cscope') | |
-- look for cscope.out in the current working directory | |
cscope.add_database { path = "." } | |
-- add a second database and set the top-level path for files in that db | |
cscope.add_database { | |
path = "/project/altitude/src", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(clippy::type_complexity)] | |
#![allow(clippy::too_many_arguments)] | |
use bevy::{ | |
core_pipeline::tonemapping::Tonemapping, prelude::*, render::view::RenderLayers, | |
scene::SceneInstance, | |
}; | |
use bevy_dolly::prelude::*; | |
use bevy_egui::{egui, EguiContexts, EguiPlugin, EguiUserTextures}; | |
use bevy_inspector_egui::quick::WorldInspectorPlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Load a GLB Scene, and draw an Axis-Aligned Bounding-Box around the entire | |
//! scene | |
//! | |
//! Works in Bevy v0.10 | |
#![allow(clippy::type_complexity)] | |
use bevy::{ | |
core_pipeline::tonemapping::Tonemapping, prelude::*, render::primitives::Aabb, | |
scene::SceneInstance, transform::TransformSystem::TransformPropagate, | |
}; |
NewerOlder