NetDEM v1.0
Loading...
Searching...
No Matches
particle.wgsl.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4
6struct Particle {
7 id: i32,
8 shape_id: i32,
9 enable_bound_aabb: i32,
10 need_update_linked_list: i32,
11
12 material_type: i32,
13 density: f32,
14 damp_viscous: f32,
15 damp_numerical: f32,
16
17 bound_min: vec3<f32>,
18 padding1: f32,
19 bound_max: vec3<f32>,
20 margin: f32,
21
22 bound_disp: vec3<f32>,
23 padding2: f32,
24
25 pos: vec3<f32>,
26 padding3: f32,
27 quaternion: vec4<f32>,
28
29 vel: vec3<f32>,
30 padding4: f32,
31 spin: vec3<f32>,
32 padding5: f32,
33
34 vel_m0p5: vec3<f32>,
35 padding6: f32,
36 spin_principal: vec3<f32>,
37 padding7: f32,
38
39 force: vec3<f32>,
40 padding8: f32,
41 moment: vec3<f32>,
42 padding9: f32,
43};
44
45@group(0) @binding(0) var<storage, read_write> particles : array<Particle>;
46
47@compute @workgroup_size(32)
48fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
49 let index = GlobalInvocationID.x;
50 if index >= arrayLength(&particles) {
51 return;
52 }
53
54 let dt = 1.0e-6f; //time step
55 particles[index].vel.z += -10.0f * dt;
56 particles[index].pos += particles[index].vel * dt;
57}
58
59)";
shader_source
Definition particle.wgsl.h:5