1
1
use std:: time:: Duration ;
2
- use std:: io:: Read ;
3
2
use std:: collections:: VecDeque ;
4
3
use ammolite_math:: * ;
5
4
use wasm_bindgen:: prelude:: * ;
6
- use lazy_static:: lazy_static;
7
5
use mlib:: * ;
8
6
7
+ #[ allow( unused) ]
9
8
macro_rules! print {
10
9
( $mapp: ident, $( $tt: tt) * ) => {
11
10
let formatted = format!( $( $tt) * ) ;
12
11
$mapp. io. out. extend( formatted. as_bytes( ) ) ;
13
12
}
14
13
}
15
14
15
+ #[ allow( unused) ]
16
16
macro_rules! println {
17
17
( $mapp: ident, $( $tt: tt) * ) => {
18
18
print!( $mapp, $( $tt) * ) ;
19
19
$mapp. io. out. push( '\n' as u8 )
20
20
}
21
21
}
22
22
23
+ #[ allow( unused) ]
23
24
macro_rules! eprint {
24
25
( $mapp: ident, $( $tt: tt) * ) => {
25
26
let formatted = format!( $( $tt) * ) ;
26
27
$mapp. io. err. extend( formatted. as_bytes( ) ) ;
27
28
}
28
29
}
29
30
31
+ #[ allow( unused) ]
30
32
macro_rules! eprintln {
31
33
( $mapp: ident, $( $tt: tt) * ) => {
32
34
eprint!( $mapp, $( $tt) * ) ;
@@ -35,6 +37,7 @@ macro_rules! eprintln {
35
37
}
36
38
37
39
// Implementation from https://doc.rust-lang.org/std/macro.dbg.html
40
+ #[ allow( unused) ]
38
41
macro_rules! dbg {
39
42
( $mapp: ident, ) => {
40
43
eprintln!( $mapp, "[{}:{}]" , file!( ) , line!( ) ) ;
@@ -61,16 +64,17 @@ const MODEL_BUTTON_NEXT_BYTES: &'static [u8] = include_bytes!("/home/limeth/Docu
61
64
// TODO: Use a procedural macro to output include_bytes! macros for every model
62
65
// in the resources directory (if a feature is used/release build; otherwise it
63
66
// would slow down linting)
64
- const MODELS_MAIN_LEN : usize = 5 ;
67
+ const MODELS_MAIN_LEN : usize = 1 ;
65
68
const MODELS_MAIN_BYTES_SCALE : [ ( & ' static [ u8 ] , f32 ) ; MODELS_MAIN_LEN ] = [
66
- ( include_bytes ! ( "../../ammolite/resources/DamagedHelmet/glTF-Binary/DamagedHelmet.glb" ) , 1.0 ) ,
67
- ( include_bytes ! ( "../../ammolite/resources/Corset/glTF-Binary/Corset.glb" ) , 40.0 ) ,
68
- ( include_bytes ! ( "../../ammolite/resources/AntiqueCamera/glTF-Binary/AntiqueCamera.glb" ) , 0.1 ) ,
69
+ // (include_bytes!("../../ammolite/resources/DamagedHelmet/glTF-Binary/DamagedHelmet.glb"), 1.0),
70
+ // (include_bytes!("../../ammolite/resources/Corset/glTF-Binary/Corset.glb"), 40.0),
71
+ // (include_bytes!("../../ammolite/resources/AntiqueCamera/glTF-Binary/AntiqueCamera.glb"), 0.1),
69
72
( include_bytes ! ( "../../ammolite/resources/WaterBottle/glTF-Binary/WaterBottle.glb" ) , 5.0 ) ,
70
- ( include_bytes ! ( "/home/limeth/Documents/School/mvr/team07/mvr_3D_models/hlusijak/laser/zaba.glb" ) , 0.01 ) ,
73
+ // (include_bytes!("/home/limeth/Documents/School/mvr/team07/mvr_3D_models/hlusijak/laser/zaba.glb"), 0.01),
71
74
] ;
72
75
const MODEL_MARKER_BYTES : & ' static [ u8 ] = include_bytes ! ( "../../ammolite/resources/sphere_1m_radius.glb" ) ;
73
76
const SELECTION_DELAY : f32 = 1.0 ;
77
+ const ANIMATION_SPEED : f32 = 0.0 ;
74
78
const ENTITY_COUNT : usize = 20 ;
75
79
76
80
fn construct_model_matrix ( scale : f32 , translation : & Vec3 , rotation : & Vec3 ) -> Mat4 {
@@ -214,8 +218,6 @@ impl Mapp for ExampleMapp {
214
218
let secs_elapsed = duration_to_seconds ( elapsed) ;
215
219
// dbg!(self, elapsed);
216
220
// dbg!(self, secs_elapsed);
217
- let anim_speed = 0.2 ;
218
-
219
221
for ( index, entity) in self . entities_main . clone ( ) . iter ( ) . enumerate ( ) {
220
222
if entity. is_none ( ) {
221
223
return ;
@@ -224,7 +226,7 @@ impl Mapp for ExampleMapp {
224
226
let transform = construct_model_matrix (
225
227
MODELS_MAIN_BYTES_SCALE [ self . current_main_model_index ] . 1 ,
226
228
& [ 0.0 , 0.0 , 2.0 + 1.0 * index as f32 ] . into ( ) ,
227
- & [ ( secs_elapsed * anim_speed ) . sin ( ) * 1.0 , std:: f32:: consts:: PI + ( secs_elapsed * anim_speed ) . cos ( ) * 3.0 / 2.0 , 0.0 ] . into ( ) ,
229
+ & [ ( secs_elapsed * ANIMATION_SPEED ) . sin ( ) * 1.0 , std:: f32:: consts:: PI + ( secs_elapsed * ANIMATION_SPEED ) . cos ( ) * 3.0 / 2.0 , 0.0 ] . into ( ) ,
228
230
) ;
229
231
230
232
self . cmd ( CommandKind :: EntityTransformSet {
@@ -285,15 +287,15 @@ impl Mapp for ExampleMapp {
285
287
( model_selector, transform)
286
288
} ;
287
289
self . cmd ( CommandKind :: EntityParentSet {
288
- entity : entity ,
290
+ entity,
289
291
parent_entity : self . root_entity ,
290
292
} ) ;
291
293
self . cmd ( CommandKind :: EntityModelSet {
292
- entity : entity ,
294
+ entity,
293
295
model : model_selector,
294
296
} ) ;
295
297
self . cmd ( CommandKind :: EntityTransformSet {
296
- entity : entity ,
298
+ entity,
297
299
transform : Some ( transform) ,
298
300
} ) ;
299
301
} ,
@@ -339,7 +341,7 @@ impl Mapp for ExampleMapp {
339
341
} ) ;
340
342
self . cmd ( CommandKind :: RayTrace {
341
343
origin : position,
342
- direction : direction ,
344
+ direction,
343
345
} ) ;
344
346
}
345
347
} ,
@@ -362,7 +364,7 @@ impl Mapp for ExampleMapp {
362
364
} ) ;
363
365
364
366
self . ray_tracing_task = Some ( RayTracingTask {
365
- direction : direction ,
367
+ direction,
366
368
total_distance,
367
369
} ) ;
368
370
} else {
0 commit comments