Blender_bevy_components_wor.../examples/bevy_gltf_components/basic
Mark Moissette 09915f521d
chore(Bevy): Update to bevy 0.13 (#136)
* chore(crates): updated crates to Bevy 0.13
   * updated deps
   * updated / changed code where relevant
   * updated README files
   * bumped version numbers for upcoming release
   * updated rust-toolchain
   * updated assets where relevant
   * closes #132 
* feat(bevy_gltf_components): 
  * added GltfProcessed flag component to improve performance of iteration over added<gltfExtras>
  * closes #144 
  * light & shadow processing is now integrated,  to match  lights coming from Blender: you can now control whether 
  lights cast shadows, the cascade resolution , background color etc  from Blender
   * closes #155 

* feat(bevy_registry_export): added boilerplate to make registry path relative to assets folder 
  * closes #137 
* feat(tools): added boilerplate for internal tools
   * clean zip file generator for blender add-on releases
   * example gltf file generator
* feat(lighting): added components, exporter support & testing for blender-configurable shadows
   * added BlenderLightShadows component to bevy_gltf_components
   * added writing shadow information to gltf_auto_export
   * updated tests
   * closes #157 

Co-authored-by: Jan Hohenheim <jan@hohenheim.ch>
2024-03-04 22:16:31 +01:00
..
assets chore(Bevy): Update to bevy 0.13 (#136) 2024-03-04 22:16:31 +01:00
src chore(Bevy): Update to bevy 0.13 (#136) 2024-03-04 22:16:31 +01:00
Cargo.toml chore(Bevy): Update to bevy 0.13 (#136) 2024-03-04 22:16:31 +01:00
README.md chore(): cleanup & simplification pass (#122) 2024-02-07 14:07:17 +01:00
index.html chore(): cleanup & simplification pass (#122) 2024-02-07 14:07:17 +01:00

README.md

Basic bevy_gltf_components + wasm demo

Running this example (non-wasm)

cargo run --features bevy/dynamic_linking

Wasm

Setup

as per the bevy documentation:

rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli

Building this example

navigate to the current folder , and then

cargo build --release --target wasm32-unknown-unknown --target-dir ./target
wasm-bindgen --out-name wasm_example \
  --out-dir ./target/wasm \
  --target web target/wasm32-unknown-unknown/release/bevy_gltf_components_basic_wasm_example.wasm

Running this example

run a web server in the current folder, and navigate to the page, you should see the example in your browser

Additional notes

  • You usually define either the Components directly or use Proxy components that get replaced in Bevy systems with the actual Components that you want (usually when for some reason, ie external crates with unregistered components etc) you cannot use the components directly.

Included are the following modules / tools

  • process_gltf the most important module: this is the one extracting component information from the gltf files
  • insert_dependant_component a small utility to automatically inject components that are dependant on an other component for example an Entity with a Player component should also always have a ShouldBeWithPlayer component you get a warning if you use this though, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components)
  • camera an example post process/replace proxies plugin, for Camera that also adds CameraTracking functions (to enable a camera to follow an object, ie the player)
  • lighting an other example post process/replace proxies plugin for lighting, that toggles shadows, lighting config, etc so that things look closer to the original Blender data
  • physics an other example post process/replace proxies plugin for physics, that add Rapier Colliders, Rigidbodies etc . Most of these do not need proxies these days, as the most Rapier components are in the Registry & can be used directly

Feel free to use as you want, rip it appart, use any/all parts that you need !

This tooling and workflow has enabled me to go from a blank Bevy + Blender setup to a working barebones level in very little time (30 minutes or so ?) ! You can then add your own components & systems for your own gameplay very easilly

Information

  • the Bevy/ Rust code is here
  • the Blender file is here
  • I added bevy_editor_pls as a dependency for convenience so you can inspect your level/components