Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 117
Matrix4x3 v2#433
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
Uh oh!
There was an error while loading. Please reload this page.
Matrix4x3 v2 #433
Changes from all commits
169005c680317c6b699a5951a990File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,31 +1,39 @@ | ||||||||||||||||||||||
| //! a set of common SPIR-V Matrices, used for intrinsics | ||||||||||||||||||||||
| use core::fmt::{Debug, Display, Formatter}; | ||||||||||||||||||||||
| use glam::{Affine3A, Mat3, Mat3A, Mat4, Vec3, Vec3A}; | ||||||||||||||||||||||
| /// A Matrix with 4 columns of [`Vec3`], very similar to glam's [`Affine3A`]. | ||||||||||||||||||||||
| /// | ||||||||||||||||||||||
| /// Primarily used in ray tracing extensions to represent object rotation, scale and translation. | ||||||||||||||||||||||
| /// | ||||||||||||||||||||||
| /// # Limitations | ||||||||||||||||||||||
| /// These Limitations apply to all structs marked with `#[spirv(matrix)]`, which `Matrix4x3` is the only one in | ||||||||||||||||||||||
| /// `spirv-std`: | ||||||||||||||||||||||
| /// * Cannot be used within buffers, push constants or anything that requires an "explicit layout". Use [`Affine3A`], | ||||||||||||||||||||||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for my education - why don't we use one of these types instead? Or wrap one?
| ||||||||||||||||||||||
| /// [`Mat4`] or the combination of [`Mat3`] with [`Vec3`] instead and convert them to `Matrix4x3` in the shader. | ||||||||||||||||||||||
| /// * There may be other situations where this type may surprisingly fail! | ||||||||||||||||||||||
| #[derive(Clone, Copy, Default, PartialEq)] | ||||||||||||||||||||||
| #[repr(C)] | ||||||||||||||||||||||
| #[spirv(matrix)] | ||||||||||||||||||||||
| #[allow(missing_docs)] | ||||||||||||||||||||||
| pub struct Matrix4x3 { | ||||||||||||||||||||||
| pub x: Vec3A, | ||||||||||||||||||||||
| pub y: Vec3A, | ||||||||||||||||||||||
| pub z: Vec3A, | ||||||||||||||||||||||
| pub w: Vec3A, | ||||||||||||||||||||||
| pub x_axis: Vec3A, | ||||||||||||||||||||||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did this change? Is it more or less consistent with other APIs?
| ||||||||||||||||||||||
| implMatrix4x3{ | |
| /// Convert from glam's [`Affine3A`] | |
| pubfnfrom_affine3a(affine:Affine3A) -> Self{ | |
| Self{ | |
| x_axis: affine.x_axis, | |
| y_axis: affine.y_axis, | |
| z_axis: affine.z_axis, | |
| w_axis: affine.w_axis, | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit too inward facing. Just state the limitations. I guess you can optionally ask for a task.