mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
Implement bytemuck behind a feature (#775)
This commit is contained in:
@@ -8,8 +8,10 @@ use crate::*;
|
||||
///
|
||||
/// Mathematically this is known as a "point", but the term position was chosen so not to
|
||||
/// conflict with the unit (one point = X physical pixels).
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Default, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
|
||||
pub struct Pos2 {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
|
||||
@@ -6,8 +6,10 @@ use crate::*;
|
||||
/// A rectangular region of space.
|
||||
///
|
||||
/// Normally given in points, e.g. logical pixels.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
|
||||
pub struct Rect {
|
||||
pub min: Pos2,
|
||||
pub max: Pos2,
|
||||
|
||||
@@ -3,7 +3,10 @@ use crate::*;
|
||||
/// Linearly transforms positions from one [`Rect`] to another.
|
||||
///
|
||||
/// `RectTransform` stores the rectangles, and therefore supports clamping and culling.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
|
||||
pub struct RectTransform {
|
||||
from: Rect,
|
||||
to: Rect,
|
||||
|
||||
@@ -13,7 +13,10 @@ use super::Vec2;
|
||||
//
|
||||
/// Normally a `Rot2` is normalized (unit-length).
|
||||
/// If not, it will also scale vectors.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
|
||||
pub struct Rot2 {
|
||||
/// angle.sin()
|
||||
s: f32,
|
||||
|
||||
@@ -6,8 +6,10 @@ use std::ops::{Add, AddAssign, Div, Mul, MulAssign, Neg, Sub, SubAssign};
|
||||
/// emath represents positions using [`crate::Pos2`].
|
||||
///
|
||||
/// Normally the units are points (logical pixels).
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Default, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
|
||||
pub struct Vec2 {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
|
||||
Reference in New Issue
Block a user