-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added glam_assert! to check preconditions.
Is enabled by default in debug and can be enabled in other profiles using the `glam-assert` feature or the `debug-assertions` property in `Cargo.toml`. This means glam assertions can be enabed independently of debug assertions. Switched current debug_assert usage to use glam_assert. Made matrix inverse determinant != 0 asserts consistent between matrix types.
- Loading branch information
1 parent
bc15fde
commit 8c86ebf
Showing
11 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
#[cfg(any(debug_assertions, feature = "glam-assert"))] | ||
macro_rules! glam_assert { | ||
($($arg:tt)*) => ( assert!($($arg)*); ) | ||
} | ||
#[cfg(not(any(debug_assertions, feature = "glam-assert")))] | ||
macro_rules! glam_assert { | ||
($($arg:tt)*) => () | ||
} | ||
|
||
macro_rules! is_normalized { | ||
($self:expr, threshold => $threshold:expr) => { | ||
($self.length_squared() - 1.0).abs() < $threshold | ||
}; | ||
($self:expr) => { | ||
is_normalized!($self, threshold => 0.00001) | ||
}; | ||
} |