Skip to content

Always use repr(C) for vertices. #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions obj-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ pub trait FromRawVertex<I>: Sized {

/// Vertex data type of `Obj` which contains position and normal data of a vertex.
#[derive(Default, Copy, PartialEq, Clone, Debug)]
#[repr(C)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "vulkano", repr(C))]
#[cfg_attr(feature = "vulkano", derive(Zeroable, Pod))]
pub struct Vertex {
/// Position vector of a vertex.
Expand Down Expand Up @@ -173,8 +173,8 @@ impl<I: FromPrimitive + Copy> FromRawVertex<I> for Vertex {

/// Vertex data type of `Obj` which contains only position data of a vertex.
#[derive(Default, Copy, PartialEq, Clone, Debug)]
#[repr(C)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "vulkano", repr(C))]
#[cfg_attr(feature = "vulkano", derive(Zeroable, Pod))]
pub struct Position {
/// Position vector of a vertex.
Expand Down Expand Up @@ -239,8 +239,8 @@ impl<I: FromPrimitive> FromRawVertex<I> for Position {

/// Vertex data type of `Obj` which contains position, normal and texture data of a vertex.
#[derive(Default, Copy, PartialEq, Clone, Debug)]
#[repr(C)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "vulkano", repr(C))]
#[cfg_attr(feature = "vulkano", derive(Zeroable, Pod))]
pub struct TexturedVertex {
/// Position vector of a vertex.
Expand Down
Loading