forked from Game4all/bevy_vox_mesh
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathemissive-model.rs
42 lines (39 loc) · 1.2 KB
/
emissive-model.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use bevy::{core_pipeline::bloom::Bloom, prelude::*};
use bevy_vox_scene::VoxScenePlugin;
use utilities::{PanOrbitCamera, PanOrbitCameraPlugin};
fn main() {
App::new()
.add_plugins((
DefaultPlugins,
PanOrbitCameraPlugin,
VoxScenePlugin::default(),
))
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands, assets: Res<AssetServer>) {
// An hdr and bloom-enabled camera is needed to create the emissive glowing effect
commands.spawn((
Camera3d::default(),
Camera {
hdr: true,
..default()
},
Transform::from_xyz(-20.0, 10.0, 60.0).looking_at(Vec3::ZERO, Vec3::Y),
PanOrbitCamera::default(),
Bloom {
intensity: 0.3,
..default()
},
EnvironmentMapLight {
diffuse_map: assets.load("pisa_diffuse.ktx2"),
specular_map: assets.load("pisa_specular.ktx2"),
intensity: 500.0,
..default()
},
));
commands.spawn(
// Load a single model using the name assigned to it in MagicaVoxel
SceneRoot(assets.load("study.vox#workstation/computer")),
);
}