1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use rusting_engine::{
CollisionType, ComputeShaderType, Engine, Material, Physics, ShaderType,
Transform,
};
pub fn main() {
let mut engine =
Engine::new("RustingEngine - Stress Test PBR (10k Objects)");
engine.set_light([300.0, 500.0, 300.0], [1.0, 1.0, 1.0], 50000.0);
// engine.add_gltf(Transform {
// position: [0.0, 0.0, 0.0],
// scale: [10.0, 10.0, 10.0],
// ..Default::default()
// },
// &Material::standard()
// .color([0.1, 1.0, 0.1])
// .shader(ShaderType::Pbr)
// .build(),
// &Physics::default()
// .compute_shader(ComputeShaderType::FullPhysics)
// .mass(10.0)
// .gravity_scale(1.0)
// .collision_type(CollisionType::Sphere),
// "./testModels/1kRustingSphere.gltf"
// );
engine.add_gltf(
Transform {
position: [5.0, 100.0, 5.0],
scale: [10.0, 10.0, 10.0],
..Default::default()
},
&Material::standard()
.color([1.0, 1.0, 1.0])
.shader(ShaderType::Pbr)
.build(),
&Physics::default()
.compute_shader(ComputeShaderType::Test)
.mass(10.0)
.gravity_scale(1.0)
.collision_type(CollisionType::Sphere),
"./testModels/1kRustingSphere.gltf",
);
for i in 0..10 {
for j in 0..10 {
for k in 0..10 {
engine.add_gltf(
Transform {
position: [
0.0 + (1.0 * i as f32),
0.0 + (1.0 * j as f32),
0.0 + (1.0 * k as f32),
],
scale: [1.0, 1.0, 1.0],
..Default::default()
},
&Material::standard()
.color([1.0, 1.0, 1.0])
.shader(ShaderType::Pbr)
.build(),
&Physics::default()
.compute_shader(ComputeShaderType::Test)
.mass(10.0)
.gravity_scale(1.0)
.collision_type(CollisionType::Box),
"./testModels/cube.gltf",
);
}
}
}
engine.set_scene_shader(ShaderType::Heavy);
engine.set_scene_physic(ComputeShaderType::Test);
engine.run();
}