File tree Expand file tree Collapse file tree 2 files changed +9
-21
lines changed
gdnative-core/src/core_types/geom Expand file tree Collapse file tree 2 files changed +9
-21
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ jobs:
105
105
- rust : { toolchain: 'nightly' }
106
106
testflags : ' -- --skip ui_tests'
107
107
- os : { id: ubuntu-latest, name: linux }
108
- rust : { toolchain: '1.48 ', postfix: ' (msrv 1.48 )' }
108
+ rust : { toolchain: '1.51 ', postfix: ' (msrv 1.51 )' }
109
109
testflags : ' -- --skip ui_tests'
110
110
runs-on : ${{ matrix.os.id }}
111
111
steps :
@@ -233,17 +233,21 @@ jobs:
233
233
fail-fast : false # cancel all jobs as soon as one fails?
234
234
matrix :
235
235
include :
236
+ # Latest Godot with different Rust versions
236
237
- rust : stable
237
238
godot : " 3.4.1"
238
239
postfix : ' '
239
240
- rust : nightly
240
241
godot : " 3.4.1"
241
242
postfix : ' (nightly)'
242
- - rust : ' 1.48 '
243
+ - rust : ' 1.51 '
243
244
godot : " 3.4.1"
244
- postfix : ' (msrv 1.48)'
245
+ postfix : ' (msrv 1.51)'
246
+
247
+ # Test with older engine version
248
+ # Note: headless versions of Godot <= 3.3 may crash with a bug, see feature description in lib.rs
245
249
- rust : stable
246
- godot : " 3.2 "
250
+ godot : " 3.3.1 "
247
251
postfix : ' '
248
252
build_args : ' --features custom-godot'
249
253
Original file line number Diff line number Diff line change 1
1
use crate :: core_types:: Vector2 ;
2
2
3
- /// Clamp method for f32.
4
- /// NOTE: This method was copied as-is from std. This was done to avoid compatibility issues
5
- /// with newer rustc versions and should be removed in favor of f32::clamp once that is stable.
6
- #[ inline]
7
- fn clamp ( num : f32 , min : f32 , max : f32 ) -> f32 {
8
- assert ! ( min <= max) ;
9
- let mut x = num;
10
- if x < min {
11
- x = min;
12
- }
13
- if x > max {
14
- x = max;
15
- }
16
- x
17
- }
18
-
19
3
/// Affine 2D transform (2x3 matrix).
20
4
///
21
5
/// Represents transformations such as translation, rotation, or scaling.
@@ -228,7 +212,7 @@ impl Transform2D {
228
212
// slerp rotation
229
213
let v1 = Vector2 :: new ( f32:: cos ( r1) , f32:: sin ( r1) ) ;
230
214
let v2 = Vector2 :: new ( f32:: cos ( r2) , f32:: sin ( r2) ) ;
231
- let dot = clamp ( v1. dot ( v2) , -1.0 , 1.0 ) ;
215
+ let dot = v1. dot ( v2) . clamp ( -1.0 , 1.0 ) ;
232
216
233
217
let v = if dot > 0.9995 {
234
218
//linearly interpolate to avoid numerical precision issues
You can’t perform that action at this time.
0 commit comments