mirror of
https://github.com/bevyengine/bevy
synced 2024-11-24 21:53:07 +00:00
Updated glam
to 0.21
. (#5142)
Removed `const_vec2`/`const_vec3` and replaced with equivalent `.from_array`. # Objective Fixes #5112 ## Solution - `encase` needs to update to `glam` as well. See teoxoy/encase#4 on progress on that. - `hexasphere` also needs to be updated, see OptimisticPeach/hexasphere#12.
This commit is contained in:
parent
8f721d8d0a
commit
33f9b3940d
25 changed files with 71 additions and 82 deletions
|
@ -7,7 +7,7 @@ publish = false
|
|||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[dev-dependencies]
|
||||
glam = "0.20"
|
||||
glam = "0.21"
|
||||
rand = "0.8"
|
||||
rand_chacha = "0.3"
|
||||
criterion = { version = "0.3", features = ["html_reports"] }
|
||||
|
|
|
@ -13,4 +13,4 @@ proc-macro = true
|
|||
|
||||
[dependencies]
|
||||
bevy_macro_utils = { path = "../bevy_macro_utils", version = "0.8.0-dev" }
|
||||
encase_derive_impl = "0.2"
|
||||
encase_derive_impl = "0.3.0"
|
||||
|
|
|
@ -350,11 +350,11 @@ mod test {
|
|||
|
||||
let touch_event = Touch {
|
||||
id: 4,
|
||||
start_position: Vec2::new(0.0, 0.0),
|
||||
start_position: Vec2::ZERO,
|
||||
start_force: None,
|
||||
previous_position: Vec2::new(0.0, 0.0),
|
||||
previous_position: Vec2::ZERO,
|
||||
previous_force: None,
|
||||
position: Vec2::new(0.0, 0.0),
|
||||
position: Vec2::ZERO,
|
||||
force: None,
|
||||
};
|
||||
|
||||
|
@ -383,7 +383,7 @@ mod test {
|
|||
|
||||
let touch_event = TouchInput {
|
||||
phase: TouchPhase::Started,
|
||||
position: Vec2::new(4.0, 4.0),
|
||||
position: Vec2::splat(4.0),
|
||||
force: None,
|
||||
id: 4,
|
||||
};
|
||||
|
@ -398,7 +398,7 @@ mod test {
|
|||
|
||||
let moved_touch_event = TouchInput {
|
||||
phase: TouchPhase::Moved,
|
||||
position: Vec2::new(5.0, 5.0),
|
||||
position: Vec2::splat(5.0),
|
||||
force: None,
|
||||
id: touch_event.id,
|
||||
};
|
||||
|
@ -419,7 +419,7 @@ mod test {
|
|||
|
||||
let cancel_touch_event = TouchInput {
|
||||
phase: TouchPhase::Cancelled,
|
||||
position: Vec2::new(1.0, 1.0),
|
||||
position: Vec2::ONE,
|
||||
force: None,
|
||||
id: touch_event.id,
|
||||
};
|
||||
|
@ -434,7 +434,7 @@ mod test {
|
|||
|
||||
let end_touch_event = TouchInput {
|
||||
phase: TouchPhase::Ended,
|
||||
position: Vec2::new(4.0, 4.0),
|
||||
position: Vec2::splat(4.0),
|
||||
force: None,
|
||||
id: 4,
|
||||
};
|
||||
|
@ -456,7 +456,7 @@ mod test {
|
|||
|
||||
let touch_event = TouchInput {
|
||||
phase: TouchPhase::Started,
|
||||
position: Vec2::new(4.0, 4.0),
|
||||
position: Vec2::splat(4.0),
|
||||
force: None,
|
||||
id: 4,
|
||||
};
|
||||
|
@ -478,7 +478,7 @@ mod test {
|
|||
|
||||
let touch_event = TouchInput {
|
||||
phase: TouchPhase::Ended,
|
||||
position: Vec2::new(4.0, 4.0),
|
||||
position: Vec2::splat(4.0),
|
||||
force: None,
|
||||
id: 4,
|
||||
};
|
||||
|
@ -500,7 +500,7 @@ mod test {
|
|||
|
||||
let touch_event = TouchInput {
|
||||
phase: TouchPhase::Cancelled,
|
||||
position: Vec2::new(4.0, 4.0),
|
||||
position: Vec2::splat(4.0),
|
||||
force: None,
|
||||
id: 4,
|
||||
};
|
||||
|
|
|
@ -9,4 +9,4 @@ license = "MIT OR Apache-2.0"
|
|||
keywords = ["bevy"]
|
||||
|
||||
[dependencies]
|
||||
glam = { version = "0.20.0", features = ["serde", "bytemuck"] }
|
||||
glam = { version = "0.21", features = ["serde", "bytemuck"] }
|
||||
|
|
|
@ -11,7 +11,7 @@ license = "Zlib AND (MIT OR Apache-2.0)"
|
|||
keywords = ["bevy", "3D", "graphics", "algorithm", "tangent"]
|
||||
|
||||
[dependencies]
|
||||
glam = "0.20.0"
|
||||
glam = "0.21"
|
||||
|
||||
[[example]]
|
||||
name = "generate"
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use std::collections::HashSet;
|
||||
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_math::{
|
||||
const_vec2, Mat4, UVec2, UVec3, Vec2, Vec3, Vec3A, Vec3Swizzles, Vec4, Vec4Swizzles,
|
||||
};
|
||||
use bevy_math::{Mat4, UVec2, UVec3, Vec2, Vec3, Vec3A, Vec3Swizzles, Vec4, Vec4Swizzles};
|
||||
use bevy_reflect::prelude::*;
|
||||
use bevy_render::{
|
||||
camera::{Camera, CameraProjection, OrthographicProjection},
|
||||
|
@ -497,8 +495,8 @@ fn ndc_position_to_cluster(
|
|||
.clamp(UVec3::ZERO, cluster_dimensions - UVec3::ONE)
|
||||
}
|
||||
|
||||
const VEC2_HALF: Vec2 = const_vec2!([0.5, 0.5]);
|
||||
const VEC2_HALF_NEGATIVE_Y: Vec2 = const_vec2!([0.5, -0.5]);
|
||||
const VEC2_HALF: Vec2 = Vec2::splat(0.5);
|
||||
const VEC2_HALF_NEGATIVE_Y: Vec2 = Vec2::new(0.5, -0.5);
|
||||
|
||||
// Calculate bounds for the light using a view space aabb.
|
||||
// Returns a (Vec3, Vec3) containing min and max with
|
||||
|
@ -587,8 +585,8 @@ fn cluster_space_light_aabb(
|
|||
)
|
||||
}
|
||||
|
||||
const NDC_MIN: Vec2 = const_vec2!([-1.0, -1.0]);
|
||||
const NDC_MAX: Vec2 = const_vec2!([1.0, 1.0]);
|
||||
const NDC_MIN: Vec2 = Vec2::NEG_ONE;
|
||||
const NDC_MAX: Vec2 = Vec2::ONE;
|
||||
|
||||
// Sort point lights with shadows enabled first, then by a stable key so that the index
|
||||
// can be used to limit the number of point light shadows to render based on the device and
|
||||
|
|
|
@ -9,7 +9,7 @@ use bevy_ecs::{
|
|||
prelude::*,
|
||||
system::{lifetimeless::*, SystemParamItem},
|
||||
};
|
||||
use bevy_math::{const_vec3, Mat4, UVec2, UVec3, UVec4, Vec2, Vec3, Vec4, Vec4Swizzles};
|
||||
use bevy_math::{Mat4, UVec2, UVec3, UVec4, Vec2, Vec3, Vec4, Vec4Swizzles};
|
||||
use bevy_render::{
|
||||
camera::{Camera, CameraProjection},
|
||||
color::Color,
|
||||
|
@ -501,11 +501,6 @@ pub fn extract_lights(
|
|||
|
||||
pub(crate) const POINT_LIGHT_NEAR_Z: f32 = 0.1f32;
|
||||
|
||||
// Can't do `Vec3::Y * -1.0` because mul isn't const
|
||||
const NEGATIVE_X: Vec3 = const_vec3!([-1.0, 0.0, 0.0]);
|
||||
const NEGATIVE_Y: Vec3 = const_vec3!([0.0, -1.0, 0.0]);
|
||||
const NEGATIVE_Z: Vec3 = const_vec3!([0.0, 0.0, -1.0]);
|
||||
|
||||
pub(crate) struct CubeMapFace {
|
||||
pub(crate) target: Vec3,
|
||||
pub(crate) up: Vec3,
|
||||
|
@ -515,33 +510,33 @@ pub(crate) struct CubeMapFace {
|
|||
pub(crate) const CUBE_MAP_FACES: [CubeMapFace; 6] = [
|
||||
// 0 GL_TEXTURE_CUBE_MAP_POSITIVE_X
|
||||
CubeMapFace {
|
||||
target: NEGATIVE_X,
|
||||
up: NEGATIVE_Y,
|
||||
target: Vec3::NEG_X,
|
||||
up: Vec3::NEG_Y,
|
||||
},
|
||||
// 1 GL_TEXTURE_CUBE_MAP_NEGATIVE_X
|
||||
CubeMapFace {
|
||||
target: Vec3::X,
|
||||
up: NEGATIVE_Y,
|
||||
up: Vec3::NEG_Y,
|
||||
},
|
||||
// 2 GL_TEXTURE_CUBE_MAP_POSITIVE_Y
|
||||
CubeMapFace {
|
||||
target: NEGATIVE_Y,
|
||||
target: Vec3::NEG_Y,
|
||||
up: Vec3::Z,
|
||||
},
|
||||
// 3 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
|
||||
CubeMapFace {
|
||||
target: Vec3::Y,
|
||||
up: NEGATIVE_Z,
|
||||
up: Vec3::NEG_Z,
|
||||
},
|
||||
// 4 GL_TEXTURE_CUBE_MAP_POSITIVE_Z
|
||||
CubeMapFace {
|
||||
target: NEGATIVE_Z,
|
||||
up: NEGATIVE_Y,
|
||||
target: Vec3::NEG_Z,
|
||||
up: Vec3::NEG_Y,
|
||||
},
|
||||
// 5 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
|
||||
CubeMapFace {
|
||||
target: Vec3::Z,
|
||||
up: NEGATIVE_Y,
|
||||
up: Vec3::NEG_Y,
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -1016,7 +1011,7 @@ struct GpuClusterLightIndexListsUniform {
|
|||
|
||||
// NOTE: Assert at compile time that GpuClusterLightIndexListsUniform
|
||||
// fits within the maximum uniform buffer binding size
|
||||
const _: () = assert!(GpuClusterLightIndexListsUniform::SIZE.get() <= 16384);
|
||||
const _: () = assert!(GpuClusterLightIndexListsUniform::SHADER_SIZE.get() <= 16384);
|
||||
|
||||
impl Default for GpuClusterLightIndexListsUniform {
|
||||
fn default() -> Self {
|
||||
|
|
|
@ -25,7 +25,7 @@ thiserror = "1.0"
|
|||
once_cell = "1.11"
|
||||
serde = "1"
|
||||
smallvec = { version = "1.6", features = ["serde", "union", "const_generics"], optional = true }
|
||||
glam = { version = "0.20.0", features = ["serde"], optional = true }
|
||||
glam = { version = "0.21", features = ["serde"], optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
ron = "0.7.0"
|
||||
|
|
|
@ -922,7 +922,7 @@ bevy_reflect::tests::should_reflect_debug::Test {
|
|||
|
||||
assert_eq!(
|
||||
result,
|
||||
r#"{"type":"glam::vec3::Vec3","struct":{"x":{"type":"f32","value":12.0},"y":{"type":"f32","value":3.0},"z":{"type":"f32","value":-6.9}}}"#
|
||||
r#"{"type":"glam::f32::vec3::Vec3","struct":{"x":{"type":"f32","value":12.0},"y":{"type":"f32","value":3.0},"z":{"type":"f32","value":-6.9}}}"#
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ thiserror = "1.0"
|
|||
futures-lite = "1.4.0"
|
||||
anyhow = "1.0"
|
||||
hex = "0.4.2"
|
||||
hexasphere = "7.0.0"
|
||||
hexasphere = "7.2"
|
||||
parking_lot = "0.11.0"
|
||||
regex = "1.5"
|
||||
copyless = "0.1.5"
|
||||
|
@ -70,4 +70,4 @@ flate2 = { version = "1.0.22", optional = true }
|
|||
ruzstd = { version = "0.2.4", optional = true }
|
||||
# For transcoding of UASTC/ETC1S universal formats, and for .basis file support
|
||||
basis-universal = { version = "0.2.0", optional = true }
|
||||
encase = { version = "0.2", features = ["glam"] }
|
||||
encase = { version = "0.3", features = ["glam"] }
|
||||
|
|
|
@ -1153,7 +1153,9 @@ impl encase::ShaderType for Color {
|
|||
type ExtraMetadata = ();
|
||||
|
||||
const METADATA: encase::private::Metadata<Self::ExtraMetadata> = {
|
||||
let size = encase::private::SizeValue::from(<f32 as encase::private::Size>::SIZE).mul(4);
|
||||
let size =
|
||||
encase::private::SizeValue::from(<f32 as encase::private::ShaderSize>::SHADER_SIZE)
|
||||
.mul(4);
|
||||
let alignment = encase::private::AlignmentValue::from_next_power_of_two_size(size);
|
||||
|
||||
encase::private::Metadata {
|
||||
|
@ -1214,7 +1216,7 @@ impl encase::private::CreateFrom for Color {
|
|||
}
|
||||
}
|
||||
|
||||
impl encase::Size for Color {}
|
||||
impl encase::ShaderSize for Color {}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum HexColorError {
|
||||
|
|
|
@ -505,8 +505,8 @@ struct MeshAttributeData {
|
|||
values: VertexAttributeValues,
|
||||
}
|
||||
|
||||
const VEC3_MIN: Vec3 = const_vec3!([std::f32::MIN, std::f32::MIN, std::f32::MIN]);
|
||||
const VEC3_MAX: Vec3 = const_vec3!([std::f32::MAX, std::f32::MAX, std::f32::MAX]);
|
||||
const VEC3_MIN: Vec3 = Vec3::splat(std::f32::MIN);
|
||||
const VEC3_MAX: Vec3 = Vec3::splat(std::f32::MAX);
|
||||
|
||||
fn face_normal(a: [f32; 3], b: [f32; 3], c: [f32; 3]) -> [f32; 3] {
|
||||
let (a, b, c) = (Vec3::from(a), Vec3::from(b), Vec3::from(c));
|
||||
|
|
|
@ -118,7 +118,7 @@ impl From<Capsule> for Mesh {
|
|||
// North.
|
||||
vs[j] = Vec3::new(0.0, summit, 0.0);
|
||||
vts[j] = Vec2::new(s_texture_polar, 1.0);
|
||||
vns[j] = Vec3::new(0.0, 1.0, 0.0);
|
||||
vns[j] = Vec3::Y;
|
||||
|
||||
// South.
|
||||
let idx = vert_offset_south_cap + j;
|
||||
|
|
|
@ -49,6 +49,6 @@ pub mod encase {
|
|||
pub use encase::*;
|
||||
}
|
||||
|
||||
pub use self::encase::{ShaderType, Size as ShaderSize};
|
||||
pub use self::encase::{ShaderSize, ShaderType};
|
||||
|
||||
pub use naga::ShaderStage;
|
||||
|
|
|
@ -798,6 +798,6 @@ mod test {
|
|||
#[test]
|
||||
fn image_default_size() {
|
||||
let image = Image::default();
|
||||
assert_eq!(Vec2::new(1.0, 1.0), image.size());
|
||||
assert_eq!(Vec2::ONE, image.size());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ impl RenderAsset for ColorMaterial {
|
|||
flags: flags.bits(),
|
||||
};
|
||||
|
||||
let byte_buffer = [0u8; ColorMaterialUniformData::SIZE.get() as usize];
|
||||
let byte_buffer = [0u8; ColorMaterialUniformData::SHADER_SIZE.get() as usize];
|
||||
let mut buffer = encase::UniformBuffer::new(byte_buffer);
|
||||
buffer.write(&value).unwrap();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use bevy_ecs::{
|
|||
prelude::*,
|
||||
system::{lifetimeless::*, SystemParamItem},
|
||||
};
|
||||
use bevy_math::{const_vec2, Vec2};
|
||||
use bevy_math::Vec2;
|
||||
use bevy_reflect::Uuid;
|
||||
use bevy_render::{
|
||||
color::Color,
|
||||
|
@ -307,17 +307,17 @@ impl Default for SpriteMeta {
|
|||
const QUAD_INDICES: [usize; 6] = [0, 2, 3, 0, 1, 2];
|
||||
|
||||
const QUAD_VERTEX_POSITIONS: [Vec2; 4] = [
|
||||
const_vec2!([-0.5, -0.5]),
|
||||
const_vec2!([0.5, -0.5]),
|
||||
const_vec2!([0.5, 0.5]),
|
||||
const_vec2!([-0.5, 0.5]),
|
||||
Vec2::new(-0.5, -0.5),
|
||||
Vec2::new(0.5, -0.5),
|
||||
Vec2::new(0.5, 0.5),
|
||||
Vec2::new(-0.5, 0.5),
|
||||
];
|
||||
|
||||
const QUAD_UVS: [Vec2; 4] = [
|
||||
const_vec2!([0., 1.]),
|
||||
const_vec2!([1., 1.]),
|
||||
const_vec2!([1., 0.]),
|
||||
const_vec2!([0., 0.]),
|
||||
Vec2::new(0., 1.),
|
||||
Vec2::new(1., 1.),
|
||||
Vec2::new(1., 0.),
|
||||
Vec2::new(0., 0.),
|
||||
];
|
||||
|
||||
#[derive(Component, Eq, PartialEq, Copy, Clone)]
|
||||
|
|
|
@ -62,7 +62,7 @@ impl FontAtlasSet {
|
|||
vec![FontAtlas::new(
|
||||
textures,
|
||||
texture_atlases,
|
||||
Vec2::new(512.0, 512.0),
|
||||
Vec2::splat(512.0),
|
||||
)]
|
||||
});
|
||||
let glyph_texture = Font::get_outlined_glyph_texture(outlined_glyph);
|
||||
|
|
|
@ -92,7 +92,7 @@ impl<ID: Hash + Eq> TextPipeline<ID> {
|
|||
id,
|
||||
TextLayoutInfo {
|
||||
glyphs: Vec::new(),
|
||||
size: Vec2::new(0., 0.),
|
||||
size: Vec2::ZERO,
|
||||
},
|
||||
);
|
||||
return Ok(());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::Transform;
|
||||
use bevy_ecs::{component::Component, reflect::ReflectComponent};
|
||||
use bevy_math::{const_vec3, Affine3A, Mat3, Mat4, Quat, Vec3};
|
||||
use bevy_math::{Affine3A, Mat3, Mat4, Quat, Vec3};
|
||||
use bevy_reflect::prelude::*;
|
||||
use std::ops::Mul;
|
||||
|
||||
|
@ -39,7 +39,7 @@ impl GlobalTransform {
|
|||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub const fn from_xyz(x: f32, y: f32, z: f32) -> Self {
|
||||
Self::from_translation(const_vec3!([x, y, z]))
|
||||
Self::from_translation(Vec3::new(x, y, z))
|
||||
}
|
||||
|
||||
/// Creates a new identity [`GlobalTransform`], with no translation, rotation, and a scale of 1
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::GlobalTransform;
|
||||
use bevy_ecs::{component::Component, reflect::ReflectComponent};
|
||||
use bevy_math::{const_vec3, Mat3, Mat4, Quat, Vec3};
|
||||
use bevy_math::{Mat3, Mat4, Quat, Vec3};
|
||||
use bevy_reflect::prelude::*;
|
||||
use bevy_reflect::Reflect;
|
||||
use std::ops::Mul;
|
||||
|
@ -43,7 +43,7 @@ impl Transform {
|
|||
/// `z`-value.
|
||||
#[inline]
|
||||
pub const fn from_xyz(x: f32, y: f32, z: f32) -> Self {
|
||||
Self::from_translation(const_vec3!([x, y, z]))
|
||||
Self::from_translation(Vec3::new(x, y, z))
|
||||
}
|
||||
|
||||
/// Creates a new identity [`Transform`], with no translation, rotation, and a scale of 1 on
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{prelude::CameraUi, CalculatedClip, Node, UiColor, UiImage};
|
|||
use bevy_app::prelude::*;
|
||||
use bevy_asset::{load_internal_asset, AssetEvent, Assets, Handle, HandleUntyped};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_math::{const_vec3, Mat4, Vec2, Vec3, Vec4Swizzles};
|
||||
use bevy_math::{Mat4, Vec2, Vec3, Vec4Swizzles};
|
||||
use bevy_reflect::TypeUuid;
|
||||
use bevy_render::{
|
||||
camera::{Camera, CameraProjection, DepthCalculation, OrthographicProjection, WindowOrigin},
|
||||
|
@ -353,10 +353,10 @@ impl Default for UiMeta {
|
|||
}
|
||||
|
||||
const QUAD_VERTEX_POSITIONS: [Vec3; 4] = [
|
||||
const_vec3!([-0.5, -0.5, 0.0]),
|
||||
const_vec3!([0.5, -0.5, 0.0]),
|
||||
const_vec3!([0.5, 0.5, 0.0]),
|
||||
const_vec3!([-0.5, 0.5, 0.0]),
|
||||
Vec3::new(-0.5, -0.5, 0.0),
|
||||
Vec3::new(0.5, -0.5, 0.0),
|
||||
Vec3::new(0.5, 0.5, 0.0),
|
||||
Vec3::new(-0.5, 0.5, 0.0),
|
||||
];
|
||||
|
||||
const QUAD_INDICES: [usize; 6] = [0, 2, 3, 0, 1, 2];
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
//! Demonstrates rotating entities in 2D using quaternions.
|
||||
|
||||
use bevy::{
|
||||
math::{const_vec2, Vec3Swizzles},
|
||||
prelude::*,
|
||||
time::FixedTimestep,
|
||||
};
|
||||
use bevy::{math::Vec3Swizzles, prelude::*, time::FixedTimestep};
|
||||
|
||||
const TIME_STEP: f32 = 1.0 / 60.0;
|
||||
const BOUNDS: Vec2 = const_vec2!([1200.0, 640.0]);
|
||||
const BOUNDS: Vec2 = Vec2::new(1200.0, 640.0);
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//! A simplified implementation of the classic game "Breakout".
|
||||
|
||||
use bevy::{
|
||||
math::{const_vec2, const_vec3},
|
||||
prelude::*,
|
||||
sprite::collide_aabb::{collide, Collision},
|
||||
time::FixedTimestep,
|
||||
|
@ -12,18 +11,17 @@ const TIME_STEP: f32 = 1.0 / 60.0;
|
|||
|
||||
// These constants are defined in `Transform` units.
|
||||
// Using the default 2D camera they correspond 1:1 with screen pixels.
|
||||
// The `const_vec3!` macros are needed as functions that operate on floats cannot be constant in Rust.
|
||||
const PADDLE_SIZE: Vec3 = const_vec3!([120.0, 20.0, 0.0]);
|
||||
const PADDLE_SIZE: Vec3 = Vec3::new(120.0, 20.0, 0.0);
|
||||
const GAP_BETWEEN_PADDLE_AND_FLOOR: f32 = 60.0;
|
||||
const PADDLE_SPEED: f32 = 500.0;
|
||||
// How close can the paddle get to the wall
|
||||
const PADDLE_PADDING: f32 = 10.0;
|
||||
|
||||
// We set the z-value of the ball to 1 so it renders on top in the case of overlapping sprites.
|
||||
const BALL_STARTING_POSITION: Vec3 = const_vec3!([0.0, -50.0, 1.0]);
|
||||
const BALL_SIZE: Vec3 = const_vec3!([30.0, 30.0, 0.0]);
|
||||
const BALL_STARTING_POSITION: Vec3 = Vec3::new(0.0, -50.0, 1.0);
|
||||
const BALL_SIZE: Vec3 = Vec3::new(30.0, 30.0, 0.0);
|
||||
const BALL_SPEED: f32 = 400.0;
|
||||
const INITIAL_BALL_DIRECTION: Vec2 = const_vec2!([0.5, -0.5]);
|
||||
const INITIAL_BALL_DIRECTION: Vec2 = Vec2::new(0.5, -0.5);
|
||||
|
||||
const WALL_THICKNESS: f32 = 10.0;
|
||||
// x coordinates
|
||||
|
@ -33,7 +31,7 @@ const RIGHT_WALL: f32 = 450.;
|
|||
const BOTTOM_WALL: f32 = -300.;
|
||||
const TOP_WALL: f32 = 300.;
|
||||
|
||||
const BRICK_SIZE: Vec2 = const_vec2!([100., 30.]);
|
||||
const BRICK_SIZE: Vec2 = Vec2::new(100., 30.);
|
||||
// These values are exact
|
||||
const GAP_BETWEEN_PADDLE_AND_BRICKS: f32 = 270.0;
|
||||
const GAP_BETWEEN_BRICKS: f32 = 5.0;
|
||||
|
|
|
@ -45,7 +45,7 @@ fn setup(
|
|||
subdivisions: 9,
|
||||
})),
|
||||
material: materials.add(StandardMaterial::from(Color::WHITE)),
|
||||
transform: Transform::from_scale(Vec3::splat(-1.0)),
|
||||
transform: Transform::from_scale(Vec3::NEG_ONE),
|
||||
..default()
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue