@@ -83,23 +83,23 @@ impl Projection {
83
83
#[ allow( clippy:: too_many_arguments) ]
84
84
pub fn create_for_hmd (
85
85
eye : ProjectionEye ,
86
- aspect : f32 ,
87
- intraocular_dist : f32 ,
88
- display_width : f32 ,
89
- display_to_lens : f32 ,
90
- oversample : f32 ,
91
- near : f32 ,
92
- far : f32 ,
86
+ aspect : f64 ,
87
+ intraocular_dist : f64 ,
88
+ display_width : f64 ,
89
+ display_to_lens : f64 ,
90
+ oversample : f64 ,
91
+ near : f64 ,
92
+ far : f64 ,
93
93
) -> Self {
94
94
InnerProjection :: create_for_hmd (
95
95
eye as i64 ,
96
- aspect as f64 ,
97
- intraocular_dist as f64 ,
98
- display_width as f64 ,
99
- display_to_lens as f64 ,
100
- oversample as f64 ,
101
- near as f64 ,
102
- far as f64 ,
96
+ aspect,
97
+ intraocular_dist,
98
+ display_width,
99
+ display_to_lens,
100
+ oversample,
101
+ near,
102
+ far,
103
103
)
104
104
}
105
105
@@ -108,21 +108,14 @@ impl Projection {
108
108
///
109
109
/// _Godot equivalent: Projection.create_frustum()_
110
110
pub fn create_frustum (
111
- left : f32 ,
112
- right : f32 ,
113
- bottom : f32 ,
114
- top : f32 ,
115
- near : f32 ,
116
- far : f32 ,
111
+ left : f64 ,
112
+ right : f64 ,
113
+ bottom : f64 ,
114
+ top : f64 ,
115
+ near : f64 ,
116
+ far : f64 ,
117
117
) -> Self {
118
- InnerProjection :: create_frustum (
119
- left as f64 ,
120
- right as f64 ,
121
- bottom as f64 ,
122
- top as f64 ,
123
- near as f64 ,
124
- far as f64 ,
125
- )
118
+ InnerProjection :: create_frustum ( left, right, bottom, top, near, far)
126
119
}
127
120
128
121
/// Creates a new Projection that projects positions in a frustum with the
@@ -133,43 +126,29 @@ impl Projection {
133
126
///
134
127
/// _Godot equivalent: Projection.create_frustum_aspect()_
135
128
pub fn create_frustum_aspect (
136
- size : f32 ,
137
- aspect : f32 ,
129
+ size : f64 ,
130
+ aspect : f64 ,
138
131
offset : Vector2 ,
139
- near : f32 ,
140
- far : f32 ,
132
+ near : f64 ,
133
+ far : f64 ,
141
134
flip_fov : bool ,
142
135
) -> Self {
143
- InnerProjection :: create_frustum_aspect (
144
- size as f64 ,
145
- aspect as f64 ,
146
- offset,
147
- near as f64 ,
148
- far as f64 ,
149
- flip_fov,
150
- )
136
+ InnerProjection :: create_frustum_aspect ( size, aspect, offset, near, far, flip_fov)
151
137
}
152
138
153
139
/// Creates a new Projection that projects positions using an orthogonal
154
140
/// projection with the given clipping planes.
155
141
///
156
142
/// _Godot equivalent: Projection.create_orthogonal()_
157
143
pub fn create_orthogonal (
158
- left : f32 ,
159
- right : f32 ,
160
- bottom : f32 ,
161
- top : f32 ,
162
- near : f32 ,
163
- far : f32 ,
144
+ left : f64 ,
145
+ right : f64 ,
146
+ bottom : f64 ,
147
+ top : f64 ,
148
+ near : f64 ,
149
+ far : f64 ,
164
150
) -> Self {
165
- InnerProjection :: create_orthogonal (
166
- left as f64 ,
167
- right as f64 ,
168
- bottom as f64 ,
169
- top as f64 ,
170
- near as f64 ,
171
- far as f64 ,
172
- )
151
+ InnerProjection :: create_orthogonal ( left, right, bottom, top, near, far)
173
152
}
174
153
175
154
/// Creates a new Projection that projects positions using an orthogonal
@@ -180,19 +159,13 @@ impl Projection {
180
159
///
181
160
/// _Godot equivalent: Projection.create_orthogonal_aspect()_
182
161
pub fn create_orthogonal_aspect (
183
- size : f32 ,
184
- aspect : f32 ,
185
- near : f32 ,
186
- far : f32 ,
162
+ size : f64 ,
163
+ aspect : f64 ,
164
+ near : f64 ,
165
+ far : f64 ,
187
166
flip_fov : bool ,
188
167
) -> Self {
189
- InnerProjection :: create_orthogonal_aspect (
190
- size as f64 ,
191
- aspect as f64 ,
192
- near as f64 ,
193
- far as f64 ,
194
- flip_fov,
195
- )
168
+ InnerProjection :: create_orthogonal_aspect ( size, aspect, near, far, flip_fov)
196
169
}
197
170
198
171
/// Creates a new Projection that projects positions using a perspective
@@ -204,19 +177,13 @@ impl Projection {
204
177
///
205
178
/// _Godot equivalent: Projection.create_perspective()_
206
179
pub fn create_perspective (
207
- fov_y : f32 ,
208
- aspect : f32 ,
209
- near : f32 ,
210
- far : f32 ,
180
+ fov_y : f64 ,
181
+ aspect : f64 ,
182
+ near : f64 ,
183
+ far : f64 ,
211
184
flip_fov : bool ,
212
185
) -> Self {
213
- InnerProjection :: create_perspective (
214
- fov_y as f64 ,
215
- aspect as f64 ,
216
- near as f64 ,
217
- far as f64 ,
218
- flip_fov,
219
- )
186
+ InnerProjection :: create_perspective ( fov_y, aspect, near, far, flip_fov)
220
187
}
221
188
222
189
/// Creates a new Projection that projects positions using a perspective
@@ -231,32 +198,32 @@ impl Projection {
231
198
/// _Godot equivalent: Projection.create_perspective_hmd()_
232
199
#[ allow( clippy:: too_many_arguments) ]
233
200
pub fn create_perspective_hmd (
234
- fov_y : f32 ,
235
- aspect : f32 ,
236
- near : f32 ,
237
- far : f32 ,
201
+ fov_y : f64 ,
202
+ aspect : f64 ,
203
+ near : f64 ,
204
+ far : f64 ,
238
205
flip_fov : bool ,
239
206
eye : ProjectionEye ,
240
- intraocular_dist : f32 ,
241
- convergence_dist : f32 ,
207
+ intraocular_dist : f64 ,
208
+ convergence_dist : f64 ,
242
209
) -> Self {
243
210
InnerProjection :: create_perspective_hmd (
244
- fov_y as f64 ,
245
- aspect as f64 ,
246
- near as f64 ,
247
- far as f64 ,
211
+ fov_y,
212
+ aspect,
213
+ near,
214
+ far,
248
215
flip_fov,
249
216
eye as i64 ,
250
- intraocular_dist as f64 ,
251
- convergence_dist as f64 ,
217
+ intraocular_dist,
218
+ convergence_dist,
252
219
)
253
220
}
254
221
255
222
/// Return the determinant of the matrix.
256
223
///
257
224
/// _Godot equivalent: Projection.determinant()_
258
- pub fn determinant ( & self ) -> f32 {
259
- self . glam ( |mat| mat. determinant ( ) )
225
+ pub fn determinant ( & self ) -> f64 {
226
+ self . glam ( |mat| mat. determinant ( ) ) as f64
260
227
}
261
228
262
229
/// Returns a copy of this Projection with the signs of the values of the Y
@@ -271,8 +238,8 @@ impl Projection {
271
238
/// Returns the X:Y aspect ratio of this Projection's viewport.
272
239
///
273
240
/// _Godot equivalent: Projection.get_aspect()_
274
- pub fn aspect ( & self ) -> f32 {
275
- self . as_inner ( ) . get_aspect ( ) as f32
241
+ pub fn aspect ( & self ) -> f64 {
242
+ self . as_inner ( ) . get_aspect ( )
276
243
}
277
244
278
245
/// Returns the dimensions of the far clipping plane of the projection,
@@ -286,24 +253,24 @@ impl Projection {
286
253
/// Returns the horizontal field of view of the projection (in degrees).
287
254
///
288
255
/// _Godot equivalent: Projection.get_fov()_
289
- pub fn fov ( & self ) -> f32 {
290
- self . as_inner ( ) . get_fov ( ) as f32
256
+ pub fn fov ( & self ) -> f64 {
257
+ self . as_inner ( ) . get_fov ( )
291
258
}
292
259
293
260
/// Returns the vertical field of view of a projection (in degrees) which
294
261
/// has the given horizontal field of view (in degrees) and aspect ratio.
295
262
///
296
263
/// _Godot equivalent: Projection.get_fovy()_
297
- pub fn fovy_of ( fov_x : f32 , aspect : f32 ) -> f32 {
298
- InnerProjection :: get_fovy ( fov_x as f64 , aspect as f64 ) as f32
264
+ pub fn fovy_of ( fov_x : f64 , aspect : f64 ) -> f64 {
265
+ InnerProjection :: get_fovy ( fov_x, aspect)
299
266
}
300
267
301
268
/// Returns the factor by which the visible level of detail is scaled by
302
269
/// this Projection.
303
270
///
304
271
/// _Godot equivalent: Projection.get_lod_multiplier()_
305
- pub fn lod_multiplier ( & self ) -> f32 {
306
- self . as_inner ( ) . get_lod_multiplier ( ) as f32
272
+ pub fn lod_multiplier ( & self ) -> f64 {
273
+ self . as_inner ( ) . get_lod_multiplier ( )
307
274
}
308
275
309
276
/// Returns the number of pixels with the given pixel width displayed per
@@ -334,16 +301,16 @@ impl Projection {
334
301
/// clipped.
335
302
///
336
303
/// _Godot equivalent: Projection.get_z_far()_
337
- pub fn z_far ( & self ) -> f32 {
338
- self . as_inner ( ) . get_z_far ( ) as f32
304
+ pub fn z_far ( & self ) -> f64 {
305
+ self . as_inner ( ) . get_z_far ( )
339
306
}
340
307
341
308
/// Returns the distance for this Projection before which positions are
342
309
/// clipped.
343
310
///
344
311
/// _Godot equivalent: Projection.get_z_near()_
345
- pub fn z_near ( & self ) -> f32 {
346
- self . as_inner ( ) . get_z_near ( ) as f32
312
+ pub fn z_near ( & self ) -> f64 {
313
+ self . as_inner ( ) . get_z_near ( )
347
314
}
348
315
349
316
/// Returns a Projection that performs the inverse of this Projection's
@@ -376,8 +343,8 @@ impl Projection {
376
343
/// Note: The original Projection must be a perspective projection.
377
344
///
378
345
/// _Godot equivalent: Projection.perspective_znear_adjusted()_
379
- pub fn perspective_znear_adjusted ( & self , new_znear : f32 ) -> Self {
380
- self . as_inner ( ) . perspective_znear_adjusted ( new_znear as f64 )
346
+ pub fn perspective_znear_adjusted ( & self , new_znear : f64 ) -> Self {
347
+ self . as_inner ( ) . perspective_znear_adjusted ( new_znear)
381
348
}
382
349
383
350
#[ doc( hidden) ]
0 commit comments