2021-10-01 17:56:26 +00:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
2021-09-30 20:31:47 +00:00
|
|
|
use bevy::prelude::*;
|
|
|
|
|
|
|
|
const DIS: f32 = 300.0;
|
|
|
|
const SIZE: f32 = 20.0;
|
|
|
|
const HEIGHT: f32 = 400.0;
|
|
|
|
|
|
|
|
pub fn spawn_columns(
|
|
|
|
commands: &mut Commands,
|
|
|
|
meshes: &mut Assets<Mesh>,
|
|
|
|
materials: &mut Assets<StandardMaterial>,
|
|
|
|
) {
|
|
|
|
let mut column_material: StandardMaterial = Color::rgb(0.7, 0.7, 0.7).into();
|
|
|
|
column_material.metallic = 0.0;
|
|
|
|
column_material.reflectance = 0.0;
|
|
|
|
let column_material = materials.add(column_material);
|
|
|
|
let col_mesh = meshes.add(Mesh::from(shape::Box::new(SIZE, HEIGHT, SIZE)));
|
|
|
|
for i in -8..8 {
|
|
|
|
for j in -8..8 {
|
|
|
|
commands.spawn_bundle(PbrBundle {
|
|
|
|
mesh: col_mesh.clone(),
|
|
|
|
material: column_material.clone(),
|
|
|
|
transform: Transform::from_xyz(i as f32 * DIS, HEIGHT / 2.0, j as f32 * DIS),
|
|
|
|
..Default::default()
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|