struct SimulationParams_std140_0
{
@align(16) gravity_0 : vec3<f32>,
@align(4) dt_0 : f32,
};
@binding(0) @group(0) var<uniform> entryPointParams_params_0 : SimulationParams_std140_0;
struct GridGeneric_std430_0
{
@align(4) num_active_blocks_0 : u32,
@align(4) cell_width_0 : f32,
@align(4) hmap_capacity_0 : u32,
@align(4) capacity_0 : u32,
};
@binding(1) @group(0) var<storage, read> entryPointParams_grid_0 : array<GridGeneric_std430_0>;
struct BlockVirtualId_std430_0
{
@align(16) id_0 : vec3<i32>,
};
struct BlockHeaderId_std430_0
{
@align(4) id_1 : u32,
};
struct GridHashMapEntryGeneric_std430_0
{
@align(16) state_0 : u32,
@align(16) key_0 : BlockVirtualId_std430_0,
@align(16) value_0 : BlockHeaderId_std430_0,
};
@binding(2) @group(0) var<storage, read> entryPointParams_hmap_entries_0 : array<GridHashMapEntryGeneric_std430_0>;
struct ActiveBlockHeaderGeneric_std430_0
{
@align(16) virtual_id_0 : BlockVirtualId_std430_0,
@align(16) first_particle_0 : u32,
@align(4) num_particles_0 : u32,
};
@binding(3) @group(0) var<storage, read> entryPointParams_active_blocks_0 : array<ActiveBlockHeaderGeneric_std430_0>;
struct NodeCdf_std430_0
{
@align(4) distance_0 : f32,
@align(4) affinities_0 : u32,
@align(4) closest_id_0 : u32,
};
struct Node_std430_0
{
@align(16) momentum_velocity_mass_0 : vec4<f32>,
@align(16) cdf_0 : NodeCdf_std430_0,
};
@binding(4) @group(0) var<storage, read> entryPointParams_nodes_0 : array<Node_std430_0>;
@binding(5) @group(0) var<storage, read> entryPointParams_sorted_particle_ids_0 : array<u32>;
struct Position_std430_0
{
@align(16) pt_0 : vec3<f32>,
};
@binding(6) @group(0) var<storage, read> entryPointParams_particles_pos_0 : array<Position_std430_0>;
struct _MatrixStorage_float3x3std430_0
{
@align(16) data_0 : array<vec3<f32>, i32(3)>,
};
struct Cdf_std430_0
{
@align(16) normal_0 : vec3<f32>,
@align(16) rigid_vel_0 : vec3<f32>,
@align(4) signed_distance_0 : f32,
@align(16) affinity_0 : u32,
};
struct Dynamics_std430_0
{
@align(16) velocity_0 : vec3<f32>,
@align(16) def_grad_0 : _MatrixStorage_float3x3std430_0,
@align(16) affine_0 : _MatrixStorage_float3x3std430_0,
@align(16) vel_grad_det_0 : f32,
@align(16) cdf_1 : Cdf_std430_0,
@align(16) init_volume_0 : f32,
@align(4) init_radius_0 : f32,
@align(8) mass_0 : f32,
@align(4) phase_0 : f32,
@align(16) enabled_0 : u32,
};
@binding(7) @group(0) var<storage, read_write> entryPointParams_particles_dyn_0 : array<Dynamics_std430_0>;
struct BodyVelocity_std430_0
{
@align(16) linear_0 : vec3<f32>,
@align(16) angular_0 : vec3<f32>,
};
@binding(8) @group(0) var<storage, read> entryPointParams_body_vels_0 : array<BodyVelocity_std430_0>;
struct BodyMassProperties_std430_0
{
@align(16) inv_inertia_0 : _MatrixStorage_float3x3std430_0,
@align(16) inv_mass_0 : vec3<f32>,
@align(16) com_0 : vec3<f32>,
};
@binding(9) @group(0) var<storage, read> entryPointParams_body_mprops_0 : array<BodyMassProperties_std430_0>;
struct BlockVirtualId_0
{
id_0 : vec3<i32>,
};
fn BlockVirtualId_x24init_0( i_0 : vec3<i32>) -> BlockVirtualId_0
{
var _S1 : BlockVirtualId_0;
_S1.id_0 = i_0;
return _S1;
}
fn pack_key_0( key_1 : BlockVirtualId_0) -> u32
{
return (((((bitcast<u32>(key_1.id_0.x + i32(1023)) & (u32(2047)))) | (((((bitcast<u32>(key_1.id_0.y + i32(511)) & (u32(1023)))) << (u32(11))))))) | (((((bitcast<u32>(key_1.id_0.z + i32(1023)) & (u32(2047)))) << (u32(21))))));
}
fn hash_0( packed_key_0 : u32) -> u32
{
var key_2 : u32 = packed_key_0 * u32(3432918353);
return ((((key_2 << (u32(15)))) | (((key_2 >> (u32(17))))))) * u32(461845907);
}
struct BlockHeaderId_0
{
id_1 : u32,
};
fn BlockHeaderId_x24init_0( i_1 : u32) -> BlockHeaderId_0
{
var _S2 : BlockHeaderId_0;
_S2.id_1 = i_1;
return _S2;
}
fn flatten_shared_index_0( x_0 : u32, y_0 : u32, z_0 : u32) -> u32
{
return x_0 + y_0 * u32(6) + z_0 * u32(6) * u32(6);
}
struct BlockPhysicalId_0
{
id_2 : u32,
};
fn BlockPhysicalId_x24init_0( i_2 : u32) -> BlockPhysicalId_0
{
var _S3 : BlockPhysicalId_0;
_S3.id_2 = i_2;
return _S3;
}
fn block_header_id_to_physical_id_0( hid_0 : BlockHeaderId_0) -> BlockPhysicalId_0
{
return BlockPhysicalId_x24init_0(hid_0.id_1 * u32(64));
}
struct NodePhysicalId_0
{
id_3 : u32,
};
fn NodePhysicalId_x24init_0( i_3 : u32) -> NodePhysicalId_0
{
var _S4 : NodePhysicalId_0;
_S4.id_3 = i_3;
return _S4;
}
fn node_id_0( pid_0 : BlockPhysicalId_0, shift_in_block_0 : vec3<u32>) -> NodePhysicalId_0
{
return NodePhysicalId_x24init_0(pid_0.id_2 + shift_in_block_0.x + shift_in_block_0.y * u32(4) + shift_in_block_0.z * u32(4) * u32(4));
}
var<workgroup> shared_nodes_vel_mass_0 : array<vec4<f32>, i32(216)>;
struct NodeCdf_0
{
distance_0 : f32,
affinities_0 : u32,
closest_id_0 : u32,
};
var<workgroup> shared_nodes_cdf_0 : array<NodeCdf_0, i32(216)>;
fn NodeCdf_x24init_0( distance_1 : f32, affinities_1 : u32, closest_id_1 : u32) -> NodeCdf_0
{
var _S5 : NodeCdf_0;
_S5.distance_0 = distance_1;
_S5.affinities_0 = affinities_1;
_S5.closest_id_0 = closest_id_1;
return _S5;
}
fn QuadraticKernel_inv_d_0( cell_width_1 : f32) -> f32
{
return 4.0f / (cell_width_1 * cell_width_1);
}
fn associated_grid_pos_0( part_pos_0 : ptr<function, Position_std430_0>, cell_width_2 : f32) -> vec3<f32>
{
var _S6 : vec3<f32> = vec3<f32>(cell_width_2);
return (round((*part_pos_0).pt_0 / _S6) - vec3<f32>(1.0f)) * _S6;
}
fn dir_to_associated_grid_node_0( part_pos_1 : ptr<function, Position_std430_0>, cell_width_3 : f32) -> vec3<f32>
{
var _S7 : vec3<f32> = associated_grid_pos_0(&((*part_pos_1)), cell_width_3);
return _S7 - (*part_pos_1).pt_0;
}
fn QuadraticKernel_eval_all_0( x_1 : f32) -> vec3<f32>
{
var _S8 : f32 = 1.5f - x_1;
var _S9 : f32 = x_1 - 1.0f;
var _S10 : f32 = x_1 - 0.5f;
return vec3<f32>(0.5f * _S8 * _S8, 0.75f - _S9 * _S9, 0.5f * _S10 * _S10);
}
fn QuadraticKernel_precompute_weights_0( ref_elt_pos_minus_particle_pos_0 : vec3<f32>, h_0 : f32) -> mat3x3<f32>
{
return mat3x3<f32>(QuadraticKernel_eval_all_0(- ref_elt_pos_minus_particle_pos_0.x / h_0), QuadraticKernel_eval_all_0(- ref_elt_pos_minus_particle_pos_0.y / h_0), QuadraticKernel_eval_all_0(- ref_elt_pos_minus_particle_pos_0.z / h_0));
}
fn associated_cell_index_in_block_off_by_one_0( part_pos_2 : ptr<function, Position_std430_0>, cell_width_4 : f32) -> vec3<u32>
{
var _S11 : vec3<f32> = round((*part_pos_2).pt_0 / vec3<f32>(cell_width_4)) - vec3<f32>(1.0f);
var _S12 : vec3<f32> = vec3<f32>(4.0f);
return vec3<u32>(_S11 - floor(_S11 / _S12) * _S12);
}
fn affinities_are_compatible_0( affinity1_0 : u32, affinity2_0 : u32) -> bool
{
var _S13 : u32 = (((affinity1_0 & (affinity2_0))) & (u32(65535)));
return ((((affinity1_0 >> (u32(16)))) & (_S13))) == ((((affinity2_0 >> (u32(16)))) & (_S13)));
}
fn body_velocity_at_point_0( com_1 : vec3<f32>, vels_0 : ptr<function, BodyVelocity_std430_0>, point_0 : vec3<f32>) -> vec3<f32>
{
return (*vels_0).linear_0 + cross((*vels_0).angular_0, point_0 - com_1);
}
fn project_velocity_0( vel_0 : vec3<f32>, n_0 : vec3<f32>) -> vec3<f32>
{
var _S14 : f32 = dot(vel_0, n_0);
if(_S14 < 0.0f)
{
var _S15 : vec3<f32> = vel_0 - n_0 * vec3<f32>(_S14);
var _S16 : f32 = length(_S15);
return select(vec3<f32>(0.0f), _S15 / vec3<f32>(_S16), _S16 > 9.99999993922529029e-09f) * vec3<f32>(max(0.0f, _S16 + 20.0f * _S14));
}
else
{
return vel_0;
}
}
fn outer_product_0( a_0 : vec3<f32>, b_0 : vec3<f32>) -> mat3x3<f32>
{
return mat3x3<f32>(a_0 * vec3<f32>(b_0.x), a_0 * vec3<f32>(b_0.y), a_0 * vec3<f32>(b_0.z));
}
fn affinity_bit_0( i_collider_0 : u32, affinity_1 : u32) -> bool
{
return ((affinity_1 & (((u32(1) << (i_collider_0)))))) != u32(0);
}
fn find_block_header_id_0( _S17 : BlockVirtualId_0) -> BlockHeaderId_0
{
var _S18 : u32 = pack_key_0(_S17);
var slot_0 : u32 = ((hash_0(_S18)) & ((entryPointParams_grid_0[i32(0)].hmap_capacity_0 - u32(1))));
for(;;)
{
var _S19 : GridHashMapEntryGeneric_std430_0 = entryPointParams_hmap_entries_0[slot_0];
if((_S19.state_0) == _S18)
{
var _S20 : BlockHeaderId_0 = BlockHeaderId_0( entryPointParams_hmap_entries_0[slot_0].value_0.id_1 );
return _S20;
}
else
{
if((_S19.state_0) == u32(4294967295))
{
break;
}
}
slot_0 = ((slot_0 + u32(1)) & ((entryPointParams_grid_0[i32(0)].hmap_capacity_0 - u32(1))));
}
return BlockHeaderId_x24init_0(u32(4294967295));
}
fn global_shared_memory_transfers_0( _S21 : vec3<u32>, _S22 : ptr<function, BlockVirtualId_std430_0>)
{
var _S23 : vec3<i32> = (*_S22).id_0;
var i_4 : u32 = u32(0);
for(;;)
{
if(i_4 <= u32(1))
{
}
else
{
break;
}
var j_0 : u32 = u32(0);
for(;;)
{
if(j_0 <= u32(1))
{
}
else
{
break;
}
var k_0 : u32 = u32(0);
for(;;)
{
if(k_0 <= u32(1))
{
}
else
{
break;
}
var _S24 : bool;
if(i_4 == u32(1))
{
_S24 = (_S21.x) > u32(1);
}
else
{
_S24 = false;
}
var _S25 : bool;
if(_S24)
{
_S25 = true;
}
else
{
if(j_0 == u32(1))
{
_S25 = (_S21.y) > u32(1);
}
else
{
_S25 = false;
}
}
var _S26 : bool;
if(_S25)
{
_S26 = true;
}
else
{
if(k_0 == u32(1))
{
_S26 = (_S21.z) > u32(1);
}
else
{
_S26 = false;
}
}
if(_S26)
{
k_0 = k_0 + u32(1);
continue;
}
var _S27 : vec3<u32> = vec3<u32>(i_4, j_0, k_0);
var _S28 : BlockHeaderId_0 = find_block_header_id_0(BlockVirtualId_x24init_0(_S23 + vec3<i32>(_S27)));
var _S29 : vec3<u32> = _S27 * vec3<u32>(u32(4)) + _S21;
var _S30 : u32 = flatten_shared_index_0(_S29.x, _S29.y, _S29.z);
if((_S28.id_1) != u32(4294967295))
{
var _S31 : NodePhysicalId_0 = node_id_0(block_header_id_to_physical_id_0(_S28), _S21);
shared_nodes_vel_mass_0[_S30] = entryPointParams_nodes_0[_S31.id_3].momentum_velocity_mass_0;
var _S32 : Node_std430_0 = entryPointParams_nodes_0[_S31.id_3];
shared_nodes_cdf_0[_S30].distance_0 = _S32.cdf_0.distance_0;
shared_nodes_cdf_0[_S30].affinities_0 = _S32.cdf_0.affinities_0;
shared_nodes_cdf_0[_S30].closest_id_0 = _S32.cdf_0.closest_id_0;
}
else
{
shared_nodes_vel_mass_0[_S30] = vec4<f32>(0.0f);
shared_nodes_cdf_0[_S30] = NodeCdf_x24init_0(0.0f, u32(0), u32(4294967295));
}
k_0 = k_0 + u32(1);
}
j_0 = j_0 + u32(1);
}
i_4 = i_4 + u32(1);
}
return;
}
fn particle_g2p_0( _S33 : u32, _S34 : f32, _S35 : f32)
{
var _S36 : vec3<f32> = vec3<f32>(0.0f);
var _S37 : vec4<f32> = vec4<f32>(0.0f);
var _S38 : mat3x3<f32> = mat3x3<f32>(_S36, _S36, _S36);
var momentum_velocity_mass_1 : vec4<f32>;
var rigid_vel_1 : vec3<f32>;
var velocity_gradient_0 : mat3x3<f32>;
var vel_grad_det_1 : f32;
if((entryPointParams_particles_dyn_0[_S33].enabled_0) != u32(0))
{
var _S39 : Position_std430_0 = entryPointParams_particles_pos_0[_S33];
var _S40 : vec3<f32> = entryPointParams_particles_dyn_0[_S33].velocity_0;
var _S41 : Cdf_std430_0 = entryPointParams_particles_dyn_0[_S33].cdf_1;
var _S42 : f32 = QuadraticKernel_inv_d_0(_S34);
var _S43 : vec3<f32> = dir_to_associated_grid_node_0(&(_S39), _S34);
var _S44 : mat3x3<f32> = QuadraticKernel_precompute_weights_0(_S43, _S34);
var _S45 : vec3<u32> = associated_cell_index_in_block_off_by_one_0(&(_S39), _S34);
var _S46 : u32 = flatten_shared_index_0(_S45.x, _S45.y, _S45.z);
var _S47 : u32 = _S46 + u32(86);
var _S48 : vec4<f32> = shared_nodes_vel_mass_0[_S47];
var _S49 : NodeCdf_0 = shared_nodes_cdf_0[_S47];
var _S50 : vec3<f32> = vec3<f32>(_S34);
var _S51 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(2), u32(2), u32(2))) * _S50;
if(!affinities_are_compatible_0(entryPointParams_particles_dyn_0[_S33].cdf_1.affinity_0, shared_nodes_cdf_0[_S47].affinities_0))
{
if((_S49.closest_id_0) != u32(4294967295))
{
var _S52 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S49.closest_id_0];
var _S53 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S49.closest_id_0].com_0, &(_S52), _S51 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S53 + project_velocity_0(_S40 - _S53, _S41.normal_0), _S48.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S48.w);
}
}
else
{
momentum_velocity_mass_1 = _S48;
}
var _S54 : f32 = _S44[i32(0)][u32(2)] * _S44[i32(1)][u32(2)];
var _S55 : f32 = _S54 * _S44[i32(2)][u32(2)];
var _S56 : vec4<f32> = momentum_velocity_mass_1 * vec4<f32>(_S55);
var _S57 : f32 = _S55 * _S42;
var _S58 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S59 : mat3x3<f32> = outer_product_0(_S58, _S51);
var _S60 : mat3x3<f32> = mat3x3<f32>(_S57, _S57, _S57, _S57, _S57, _S57, _S57, _S57, _S57);
var _S61 : mat3x3<f32> = mat3x3<f32>(_S60[0] * _S59[0], _S60[1] * _S59[1], _S60[2] * _S59[2]);
var _S62 : f32 = _S57 * dot(_S58, _S51);
var _S63 : u32 = _S46 + u32(74);
var _S64 : vec4<f32> = shared_nodes_vel_mass_0[_S63];
var _S65 : NodeCdf_0 = shared_nodes_cdf_0[_S63];
var _S66 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(2), u32(0), u32(2))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S63].affinities_0))
{
if((_S65.closest_id_0) != u32(4294967295))
{
var _S67 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S65.closest_id_0];
var _S68 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S65.closest_id_0].com_0, &(_S67), _S66 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S68 + project_velocity_0(_S40 - _S68, _S41.normal_0), _S64.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S64.w);
}
}
else
{
momentum_velocity_mass_1 = _S64;
}
var _S69 : f32 = _S44[i32(0)][u32(2)] * _S44[i32(1)][u32(0)];
var _S70 : f32 = _S69 * _S44[i32(2)][u32(2)];
var momentum_velocity_mass_2 : vec4<f32> = _S56 + momentum_velocity_mass_1 * vec4<f32>(_S70);
var _S71 : f32 = _S70 * _S42;
var _S72 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S73 : mat3x3<f32> = outer_product_0(_S72, _S66);
var _S74 : mat3x3<f32> = mat3x3<f32>(_S71, _S71, _S71, _S71, _S71, _S71, _S71, _S71, _S71);
var _S75 : mat3x3<f32> = _S61 + mat3x3<f32>(_S74[0] * _S73[0], _S74[1] * _S73[1], _S74[2] * _S73[2]);
var vel_grad_det_2 : f32 = _S62 + _S71 * dot(_S72, _S66);
var _S76 : u32 = _S46 + u32(80);
var _S77 : vec4<f32> = shared_nodes_vel_mass_0[_S76];
var _S78 : NodeCdf_0 = shared_nodes_cdf_0[_S76];
var _S79 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(2), u32(1), u32(2))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S76].affinities_0))
{
if((_S78.closest_id_0) != u32(4294967295))
{
var _S80 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S78.closest_id_0];
var _S81 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S78.closest_id_0].com_0, &(_S80), _S79 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S81 + project_velocity_0(_S40 - _S81, _S41.normal_0), _S77.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S77.w);
}
}
else
{
momentum_velocity_mass_1 = _S77;
}
var _S82 : f32 = _S44[i32(0)][u32(2)] * _S44[i32(1)][u32(1)];
var _S83 : f32 = _S82 * _S44[i32(2)][u32(2)];
var momentum_velocity_mass_3 : vec4<f32> = momentum_velocity_mass_2 + momentum_velocity_mass_1 * vec4<f32>(_S83);
var _S84 : f32 = _S83 * _S42;
var _S85 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S86 : mat3x3<f32> = outer_product_0(_S85, _S79);
var _S87 : mat3x3<f32> = mat3x3<f32>(_S84, _S84, _S84, _S84, _S84, _S84, _S84, _S84, _S84);
var _S88 : mat3x3<f32> = _S75 + mat3x3<f32>(_S87[0] * _S86[0], _S87[1] * _S86[1], _S87[2] * _S86[2]);
var vel_grad_det_3 : f32 = vel_grad_det_2 + _S84 * dot(_S85, _S79);
var _S89 : u32 = _S46 + u32(84);
var _S90 : vec4<f32> = shared_nodes_vel_mass_0[_S89];
var _S91 : NodeCdf_0 = shared_nodes_cdf_0[_S89];
var _S92 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(0), u32(2), u32(2))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S89].affinities_0))
{
if((_S91.closest_id_0) != u32(4294967295))
{
var _S93 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S91.closest_id_0];
var _S94 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S91.closest_id_0].com_0, &(_S93), _S92 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S94 + project_velocity_0(_S40 - _S94, _S41.normal_0), _S90.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S90.w);
}
}
else
{
momentum_velocity_mass_1 = _S90;
}
var _S95 : f32 = _S44[i32(0)][u32(0)] * _S44[i32(1)][u32(2)];
var _S96 : f32 = _S95 * _S44[i32(2)][u32(2)];
var momentum_velocity_mass_4 : vec4<f32> = momentum_velocity_mass_3 + momentum_velocity_mass_1 * vec4<f32>(_S96);
var _S97 : f32 = _S96 * _S42;
var _S98 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S99 : mat3x3<f32> = outer_product_0(_S98, _S92);
var _S100 : mat3x3<f32> = mat3x3<f32>(_S97, _S97, _S97, _S97, _S97, _S97, _S97, _S97, _S97);
var _S101 : mat3x3<f32> = _S88 + mat3x3<f32>(_S100[0] * _S99[0], _S100[1] * _S99[1], _S100[2] * _S99[2]);
var vel_grad_det_4 : f32 = vel_grad_det_3 + _S97 * dot(_S98, _S92);
var _S102 : u32 = _S46 + u32(72);
var _S103 : vec4<f32> = shared_nodes_vel_mass_0[_S102];
var _S104 : NodeCdf_0 = shared_nodes_cdf_0[_S102];
var _S105 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(0), u32(0), u32(2))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S102].affinities_0))
{
if((_S104.closest_id_0) != u32(4294967295))
{
var _S106 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S104.closest_id_0];
var _S107 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S104.closest_id_0].com_0, &(_S106), _S105 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S107 + project_velocity_0(_S40 - _S107, _S41.normal_0), _S103.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S103.w);
}
}
else
{
momentum_velocity_mass_1 = _S103;
}
var _S108 : f32 = _S44[i32(0)][u32(0)] * _S44[i32(1)][u32(0)];
var _S109 : f32 = _S108 * _S44[i32(2)][u32(2)];
var momentum_velocity_mass_5 : vec4<f32> = momentum_velocity_mass_4 + momentum_velocity_mass_1 * vec4<f32>(_S109);
var _S110 : f32 = _S109 * _S42;
var _S111 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S112 : mat3x3<f32> = outer_product_0(_S111, _S105);
var _S113 : mat3x3<f32> = mat3x3<f32>(_S110, _S110, _S110, _S110, _S110, _S110, _S110, _S110, _S110);
var _S114 : mat3x3<f32> = _S101 + mat3x3<f32>(_S113[0] * _S112[0], _S113[1] * _S112[1], _S113[2] * _S112[2]);
var vel_grad_det_5 : f32 = vel_grad_det_4 + _S110 * dot(_S111, _S105);
var _S115 : u32 = _S46 + u32(78);
var _S116 : vec4<f32> = shared_nodes_vel_mass_0[_S115];
var _S117 : NodeCdf_0 = shared_nodes_cdf_0[_S115];
var _S118 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(0), u32(1), u32(2))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S115].affinities_0))
{
if((_S117.closest_id_0) != u32(4294967295))
{
var _S119 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S117.closest_id_0];
var _S120 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S117.closest_id_0].com_0, &(_S119), _S118 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S120 + project_velocity_0(_S40 - _S120, _S41.normal_0), _S116.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S116.w);
}
}
else
{
momentum_velocity_mass_1 = _S116;
}
var _S121 : f32 = _S44[i32(0)][u32(0)] * _S44[i32(1)][u32(1)];
var _S122 : f32 = _S121 * _S44[i32(2)][u32(2)];
var momentum_velocity_mass_6 : vec4<f32> = momentum_velocity_mass_5 + momentum_velocity_mass_1 * vec4<f32>(_S122);
var _S123 : f32 = _S122 * _S42;
var _S124 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S125 : mat3x3<f32> = outer_product_0(_S124, _S118);
var _S126 : mat3x3<f32> = mat3x3<f32>(_S123, _S123, _S123, _S123, _S123, _S123, _S123, _S123, _S123);
var _S127 : mat3x3<f32> = _S114 + mat3x3<f32>(_S126[0] * _S125[0], _S126[1] * _S125[1], _S126[2] * _S125[2]);
var vel_grad_det_6 : f32 = vel_grad_det_5 + _S123 * dot(_S124, _S118);
var _S128 : u32 = _S46 + u32(85);
var _S129 : vec4<f32> = shared_nodes_vel_mass_0[_S128];
var _S130 : NodeCdf_0 = shared_nodes_cdf_0[_S128];
var _S131 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(1), u32(2), u32(2))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S128].affinities_0))
{
if((_S130.closest_id_0) != u32(4294967295))
{
var _S132 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S130.closest_id_0];
var _S133 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S130.closest_id_0].com_0, &(_S132), _S131 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S133 + project_velocity_0(_S40 - _S133, _S41.normal_0), _S129.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S129.w);
}
}
else
{
momentum_velocity_mass_1 = _S129;
}
var _S134 : f32 = _S44[i32(0)][u32(1)] * _S44[i32(1)][u32(2)];
var _S135 : f32 = _S134 * _S44[i32(2)][u32(2)];
var momentum_velocity_mass_7 : vec4<f32> = momentum_velocity_mass_6 + momentum_velocity_mass_1 * vec4<f32>(_S135);
var _S136 : f32 = _S135 * _S42;
var _S137 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S138 : mat3x3<f32> = outer_product_0(_S137, _S131);
var _S139 : mat3x3<f32> = mat3x3<f32>(_S136, _S136, _S136, _S136, _S136, _S136, _S136, _S136, _S136);
var _S140 : mat3x3<f32> = _S127 + mat3x3<f32>(_S139[0] * _S138[0], _S139[1] * _S138[1], _S139[2] * _S138[2]);
var vel_grad_det_7 : f32 = vel_grad_det_6 + _S136 * dot(_S137, _S131);
var _S141 : u32 = _S46 + u32(73);
var _S142 : vec4<f32> = shared_nodes_vel_mass_0[_S141];
var _S143 : NodeCdf_0 = shared_nodes_cdf_0[_S141];
var _S144 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(1), u32(0), u32(2))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S141].affinities_0))
{
if((_S143.closest_id_0) != u32(4294967295))
{
var _S145 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S143.closest_id_0];
var _S146 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S143.closest_id_0].com_0, &(_S145), _S144 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S146 + project_velocity_0(_S40 - _S146, _S41.normal_0), _S142.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S142.w);
}
}
else
{
momentum_velocity_mass_1 = _S142;
}
var _S147 : f32 = _S44[i32(0)][u32(1)] * _S44[i32(1)][u32(0)];
var _S148 : f32 = _S147 * _S44[i32(2)][u32(2)];
var momentum_velocity_mass_8 : vec4<f32> = momentum_velocity_mass_7 + momentum_velocity_mass_1 * vec4<f32>(_S148);
var _S149 : f32 = _S148 * _S42;
var _S150 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S151 : mat3x3<f32> = outer_product_0(_S150, _S144);
var _S152 : mat3x3<f32> = mat3x3<f32>(_S149, _S149, _S149, _S149, _S149, _S149, _S149, _S149, _S149);
var _S153 : mat3x3<f32> = _S140 + mat3x3<f32>(_S152[0] * _S151[0], _S152[1] * _S151[1], _S152[2] * _S151[2]);
var vel_grad_det_8 : f32 = vel_grad_det_7 + _S149 * dot(_S150, _S144);
var _S154 : u32 = _S46 + u32(79);
var _S155 : vec4<f32> = shared_nodes_vel_mass_0[_S154];
var _S156 : NodeCdf_0 = shared_nodes_cdf_0[_S154];
var _S157 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(1), u32(1), u32(2))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S154].affinities_0))
{
if((_S156.closest_id_0) != u32(4294967295))
{
var _S158 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S156.closest_id_0];
var _S159 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S156.closest_id_0].com_0, &(_S158), _S157 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S159 + project_velocity_0(_S40 - _S159, _S41.normal_0), _S155.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S155.w);
}
}
else
{
momentum_velocity_mass_1 = _S155;
}
var _S160 : f32 = _S44[i32(0)][u32(1)] * _S44[i32(1)][u32(1)];
var _S161 : f32 = _S160 * _S44[i32(2)][u32(2)];
var momentum_velocity_mass_9 : vec4<f32> = momentum_velocity_mass_8 + momentum_velocity_mass_1 * vec4<f32>(_S161);
var _S162 : f32 = _S161 * _S42;
var _S163 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S164 : mat3x3<f32> = outer_product_0(_S163, _S157);
var _S165 : mat3x3<f32> = mat3x3<f32>(_S162, _S162, _S162, _S162, _S162, _S162, _S162, _S162, _S162);
var _S166 : mat3x3<f32> = _S153 + mat3x3<f32>(_S165[0] * _S164[0], _S165[1] * _S164[1], _S165[2] * _S164[2]);
var vel_grad_det_9 : f32 = vel_grad_det_8 + _S162 * dot(_S163, _S157);
var _S167 : u32 = _S46 + u32(14);
var _S168 : vec4<f32> = shared_nodes_vel_mass_0[_S167];
var _S169 : NodeCdf_0 = shared_nodes_cdf_0[_S167];
var _S170 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(2), u32(2), u32(0))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S167].affinities_0))
{
if((_S169.closest_id_0) != u32(4294967295))
{
var _S171 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S169.closest_id_0];
var _S172 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S169.closest_id_0].com_0, &(_S171), _S170 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S172 + project_velocity_0(_S40 - _S172, _S41.normal_0), _S168.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S168.w);
}
}
else
{
momentum_velocity_mass_1 = _S168;
}
var _S173 : f32 = _S54 * _S44[i32(2)][u32(0)];
var momentum_velocity_mass_10 : vec4<f32> = momentum_velocity_mass_9 + momentum_velocity_mass_1 * vec4<f32>(_S173);
var _S174 : f32 = _S173 * _S42;
var _S175 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S176 : mat3x3<f32> = outer_product_0(_S175, _S170);
var _S177 : mat3x3<f32> = mat3x3<f32>(_S174, _S174, _S174, _S174, _S174, _S174, _S174, _S174, _S174);
var _S178 : mat3x3<f32> = _S166 + mat3x3<f32>(_S177[0] * _S176[0], _S177[1] * _S176[1], _S177[2] * _S176[2]);
var vel_grad_det_10 : f32 = vel_grad_det_9 + _S174 * dot(_S175, _S170);
var _S179 : u32 = _S46 + u32(2);
var _S180 : vec4<f32> = shared_nodes_vel_mass_0[_S179];
var _S181 : NodeCdf_0 = shared_nodes_cdf_0[_S179];
var _S182 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(2), u32(0), u32(0))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S179].affinities_0))
{
if((_S181.closest_id_0) != u32(4294967295))
{
var _S183 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S181.closest_id_0];
var _S184 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S181.closest_id_0].com_0, &(_S183), _S182 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S184 + project_velocity_0(_S40 - _S184, _S41.normal_0), _S180.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S180.w);
}
}
else
{
momentum_velocity_mass_1 = _S180;
}
var _S185 : f32 = _S69 * _S44[i32(2)][u32(0)];
var momentum_velocity_mass_11 : vec4<f32> = momentum_velocity_mass_10 + momentum_velocity_mass_1 * vec4<f32>(_S185);
var _S186 : f32 = _S185 * _S42;
var _S187 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S188 : mat3x3<f32> = outer_product_0(_S187, _S182);
var _S189 : mat3x3<f32> = mat3x3<f32>(_S186, _S186, _S186, _S186, _S186, _S186, _S186, _S186, _S186);
var _S190 : mat3x3<f32> = _S178 + mat3x3<f32>(_S189[0] * _S188[0], _S189[1] * _S188[1], _S189[2] * _S188[2]);
var vel_grad_det_11 : f32 = vel_grad_det_10 + _S186 * dot(_S187, _S182);
var _S191 : u32 = _S46 + u32(8);
var _S192 : vec4<f32> = shared_nodes_vel_mass_0[_S191];
var _S193 : NodeCdf_0 = shared_nodes_cdf_0[_S191];
var _S194 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(2), u32(1), u32(0))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S191].affinities_0))
{
if((_S193.closest_id_0) != u32(4294967295))
{
var _S195 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S193.closest_id_0];
var _S196 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S193.closest_id_0].com_0, &(_S195), _S194 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S196 + project_velocity_0(_S40 - _S196, _S41.normal_0), _S192.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S192.w);
}
}
else
{
momentum_velocity_mass_1 = _S192;
}
var _S197 : f32 = _S82 * _S44[i32(2)][u32(0)];
var momentum_velocity_mass_12 : vec4<f32> = momentum_velocity_mass_11 + momentum_velocity_mass_1 * vec4<f32>(_S197);
var _S198 : f32 = _S197 * _S42;
var _S199 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S200 : mat3x3<f32> = outer_product_0(_S199, _S194);
var _S201 : mat3x3<f32> = mat3x3<f32>(_S198, _S198, _S198, _S198, _S198, _S198, _S198, _S198, _S198);
var _S202 : mat3x3<f32> = _S190 + mat3x3<f32>(_S201[0] * _S200[0], _S201[1] * _S200[1], _S201[2] * _S200[2]);
var vel_grad_det_12 : f32 = vel_grad_det_11 + _S198 * dot(_S199, _S194);
var _S203 : u32 = _S46 + u32(12);
var _S204 : vec4<f32> = shared_nodes_vel_mass_0[_S203];
var _S205 : NodeCdf_0 = shared_nodes_cdf_0[_S203];
var _S206 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(0), u32(2), u32(0))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S203].affinities_0))
{
if((_S205.closest_id_0) != u32(4294967295))
{
var _S207 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S205.closest_id_0];
var _S208 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S205.closest_id_0].com_0, &(_S207), _S206 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S208 + project_velocity_0(_S40 - _S208, _S41.normal_0), _S204.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S204.w);
}
}
else
{
momentum_velocity_mass_1 = _S204;
}
var _S209 : f32 = _S95 * _S44[i32(2)][u32(0)];
var momentum_velocity_mass_13 : vec4<f32> = momentum_velocity_mass_12 + momentum_velocity_mass_1 * vec4<f32>(_S209);
var _S210 : f32 = _S209 * _S42;
var _S211 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S212 : mat3x3<f32> = outer_product_0(_S211, _S206);
var _S213 : mat3x3<f32> = mat3x3<f32>(_S210, _S210, _S210, _S210, _S210, _S210, _S210, _S210, _S210);
var _S214 : mat3x3<f32> = _S202 + mat3x3<f32>(_S213[0] * _S212[0], _S213[1] * _S212[1], _S213[2] * _S212[2]);
var vel_grad_det_13 : f32 = vel_grad_det_12 + _S210 * dot(_S211, _S206);
var _S215 : vec4<f32> = shared_nodes_vel_mass_0[_S46];
var _S216 : NodeCdf_0 = shared_nodes_cdf_0[_S46];
var _S217 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(0), u32(0), u32(0))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S46].affinities_0))
{
if((_S216.closest_id_0) != u32(4294967295))
{
var _S218 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S216.closest_id_0];
var _S219 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S216.closest_id_0].com_0, &(_S218), _S217 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S219 + project_velocity_0(_S40 - _S219, _S41.normal_0), _S215.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S215.w);
}
}
else
{
momentum_velocity_mass_1 = _S215;
}
var _S220 : f32 = _S108 * _S44[i32(2)][u32(0)];
var momentum_velocity_mass_14 : vec4<f32> = momentum_velocity_mass_13 + momentum_velocity_mass_1 * vec4<f32>(_S220);
var _S221 : f32 = _S220 * _S42;
var _S222 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S223 : mat3x3<f32> = outer_product_0(_S222, _S217);
var _S224 : mat3x3<f32> = mat3x3<f32>(_S221, _S221, _S221, _S221, _S221, _S221, _S221, _S221, _S221);
var _S225 : mat3x3<f32> = _S214 + mat3x3<f32>(_S224[0] * _S223[0], _S224[1] * _S223[1], _S224[2] * _S223[2]);
var vel_grad_det_14 : f32 = vel_grad_det_13 + _S221 * dot(_S222, _S217);
var _S226 : u32 = _S46 + u32(6);
var _S227 : vec4<f32> = shared_nodes_vel_mass_0[_S226];
var _S228 : NodeCdf_0 = shared_nodes_cdf_0[_S226];
var _S229 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(0), u32(1), u32(0))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S226].affinities_0))
{
if((_S228.closest_id_0) != u32(4294967295))
{
var _S230 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S228.closest_id_0];
var _S231 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S228.closest_id_0].com_0, &(_S230), _S229 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S231 + project_velocity_0(_S40 - _S231, _S41.normal_0), _S227.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S227.w);
}
}
else
{
momentum_velocity_mass_1 = _S227;
}
var _S232 : f32 = _S121 * _S44[i32(2)][u32(0)];
var momentum_velocity_mass_15 : vec4<f32> = momentum_velocity_mass_14 + momentum_velocity_mass_1 * vec4<f32>(_S232);
var _S233 : f32 = _S232 * _S42;
var _S234 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S235 : mat3x3<f32> = outer_product_0(_S234, _S229);
var _S236 : mat3x3<f32> = mat3x3<f32>(_S233, _S233, _S233, _S233, _S233, _S233, _S233, _S233, _S233);
var _S237 : mat3x3<f32> = _S225 + mat3x3<f32>(_S236[0] * _S235[0], _S236[1] * _S235[1], _S236[2] * _S235[2]);
var vel_grad_det_15 : f32 = vel_grad_det_14 + _S233 * dot(_S234, _S229);
var _S238 : u32 = _S46 + u32(13);
var _S239 : vec4<f32> = shared_nodes_vel_mass_0[_S238];
var _S240 : NodeCdf_0 = shared_nodes_cdf_0[_S238];
var _S241 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(1), u32(2), u32(0))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S238].affinities_0))
{
if((_S240.closest_id_0) != u32(4294967295))
{
var _S242 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S240.closest_id_0];
var _S243 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S240.closest_id_0].com_0, &(_S242), _S241 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S243 + project_velocity_0(_S40 - _S243, _S41.normal_0), _S239.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S239.w);
}
}
else
{
momentum_velocity_mass_1 = _S239;
}
var _S244 : f32 = _S134 * _S44[i32(2)][u32(0)];
var momentum_velocity_mass_16 : vec4<f32> = momentum_velocity_mass_15 + momentum_velocity_mass_1 * vec4<f32>(_S244);
var _S245 : f32 = _S244 * _S42;
var _S246 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S247 : mat3x3<f32> = outer_product_0(_S246, _S241);
var _S248 : mat3x3<f32> = mat3x3<f32>(_S245, _S245, _S245, _S245, _S245, _S245, _S245, _S245, _S245);
var _S249 : mat3x3<f32> = _S237 + mat3x3<f32>(_S248[0] * _S247[0], _S248[1] * _S247[1], _S248[2] * _S247[2]);
var vel_grad_det_16 : f32 = vel_grad_det_15 + _S245 * dot(_S246, _S241);
var _S250 : u32 = _S46 + u32(1);
var _S251 : vec4<f32> = shared_nodes_vel_mass_0[_S250];
var _S252 : NodeCdf_0 = shared_nodes_cdf_0[_S250];
var _S253 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(1), u32(0), u32(0))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S250].affinities_0))
{
if((_S252.closest_id_0) != u32(4294967295))
{
var _S254 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S252.closest_id_0];
var _S255 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S252.closest_id_0].com_0, &(_S254), _S253 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S255 + project_velocity_0(_S40 - _S255, _S41.normal_0), _S251.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S251.w);
}
}
else
{
momentum_velocity_mass_1 = _S251;
}
var _S256 : f32 = _S147 * _S44[i32(2)][u32(0)];
var momentum_velocity_mass_17 : vec4<f32> = momentum_velocity_mass_16 + momentum_velocity_mass_1 * vec4<f32>(_S256);
var _S257 : f32 = _S256 * _S42;
var _S258 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S259 : mat3x3<f32> = outer_product_0(_S258, _S253);
var _S260 : mat3x3<f32> = mat3x3<f32>(_S257, _S257, _S257, _S257, _S257, _S257, _S257, _S257, _S257);
var _S261 : mat3x3<f32> = _S249 + mat3x3<f32>(_S260[0] * _S259[0], _S260[1] * _S259[1], _S260[2] * _S259[2]);
var vel_grad_det_17 : f32 = vel_grad_det_16 + _S257 * dot(_S258, _S253);
var _S262 : u32 = _S46 + u32(7);
var _S263 : vec4<f32> = shared_nodes_vel_mass_0[_S262];
var _S264 : NodeCdf_0 = shared_nodes_cdf_0[_S262];
var _S265 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(1), u32(1), u32(0))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S262].affinities_0))
{
if((_S264.closest_id_0) != u32(4294967295))
{
var _S266 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S264.closest_id_0];
var _S267 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S264.closest_id_0].com_0, &(_S266), _S265 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S267 + project_velocity_0(_S40 - _S267, _S41.normal_0), _S263.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S263.w);
}
}
else
{
momentum_velocity_mass_1 = _S263;
}
var _S268 : f32 = _S160 * _S44[i32(2)][u32(0)];
var momentum_velocity_mass_18 : vec4<f32> = momentum_velocity_mass_17 + momentum_velocity_mass_1 * vec4<f32>(_S268);
var _S269 : f32 = _S268 * _S42;
var _S270 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S271 : mat3x3<f32> = outer_product_0(_S270, _S265);
var _S272 : mat3x3<f32> = mat3x3<f32>(_S269, _S269, _S269, _S269, _S269, _S269, _S269, _S269, _S269);
var _S273 : mat3x3<f32> = _S261 + mat3x3<f32>(_S272[0] * _S271[0], _S272[1] * _S271[1], _S272[2] * _S271[2]);
var vel_grad_det_18 : f32 = vel_grad_det_17 + _S269 * dot(_S270, _S265);
var _S274 : u32 = _S46 + u32(50);
var _S275 : vec4<f32> = shared_nodes_vel_mass_0[_S274];
var _S276 : NodeCdf_0 = shared_nodes_cdf_0[_S274];
var _S277 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(2), u32(2), u32(1))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S274].affinities_0))
{
if((_S276.closest_id_0) != u32(4294967295))
{
var _S278 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S276.closest_id_0];
var _S279 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S276.closest_id_0].com_0, &(_S278), _S277 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S279 + project_velocity_0(_S40 - _S279, _S41.normal_0), _S275.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S275.w);
}
}
else
{
momentum_velocity_mass_1 = _S275;
}
var _S280 : f32 = _S54 * _S44[i32(2)][u32(1)];
var momentum_velocity_mass_19 : vec4<f32> = momentum_velocity_mass_18 + momentum_velocity_mass_1 * vec4<f32>(_S280);
var _S281 : f32 = _S280 * _S42;
var _S282 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S283 : mat3x3<f32> = outer_product_0(_S282, _S277);
var _S284 : mat3x3<f32> = mat3x3<f32>(_S281, _S281, _S281, _S281, _S281, _S281, _S281, _S281, _S281);
var _S285 : mat3x3<f32> = _S273 + mat3x3<f32>(_S284[0] * _S283[0], _S284[1] * _S283[1], _S284[2] * _S283[2]);
var vel_grad_det_19 : f32 = vel_grad_det_18 + _S281 * dot(_S282, _S277);
var _S286 : u32 = _S46 + u32(38);
var _S287 : vec4<f32> = shared_nodes_vel_mass_0[_S286];
var _S288 : NodeCdf_0 = shared_nodes_cdf_0[_S286];
var _S289 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(2), u32(0), u32(1))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S286].affinities_0))
{
if((_S288.closest_id_0) != u32(4294967295))
{
var _S290 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S288.closest_id_0];
var _S291 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S288.closest_id_0].com_0, &(_S290), _S289 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S291 + project_velocity_0(_S40 - _S291, _S41.normal_0), _S287.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S287.w);
}
}
else
{
momentum_velocity_mass_1 = _S287;
}
var _S292 : f32 = _S69 * _S44[i32(2)][u32(1)];
var momentum_velocity_mass_20 : vec4<f32> = momentum_velocity_mass_19 + momentum_velocity_mass_1 * vec4<f32>(_S292);
var _S293 : f32 = _S292 * _S42;
var _S294 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S295 : mat3x3<f32> = outer_product_0(_S294, _S289);
var _S296 : mat3x3<f32> = mat3x3<f32>(_S293, _S293, _S293, _S293, _S293, _S293, _S293, _S293, _S293);
var _S297 : mat3x3<f32> = _S285 + mat3x3<f32>(_S296[0] * _S295[0], _S296[1] * _S295[1], _S296[2] * _S295[2]);
var vel_grad_det_20 : f32 = vel_grad_det_19 + _S293 * dot(_S294, _S289);
var _S298 : u32 = _S46 + u32(44);
var _S299 : vec4<f32> = shared_nodes_vel_mass_0[_S298];
var _S300 : NodeCdf_0 = shared_nodes_cdf_0[_S298];
var _S301 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(2), u32(1), u32(1))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S298].affinities_0))
{
if((_S300.closest_id_0) != u32(4294967295))
{
var _S302 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S300.closest_id_0];
var _S303 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S300.closest_id_0].com_0, &(_S302), _S301 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S303 + project_velocity_0(_S40 - _S303, _S41.normal_0), _S299.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S299.w);
}
}
else
{
momentum_velocity_mass_1 = _S299;
}
var _S304 : f32 = _S82 * _S44[i32(2)][u32(1)];
var momentum_velocity_mass_21 : vec4<f32> = momentum_velocity_mass_20 + momentum_velocity_mass_1 * vec4<f32>(_S304);
var _S305 : f32 = _S304 * _S42;
var _S306 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S307 : mat3x3<f32> = outer_product_0(_S306, _S301);
var _S308 : mat3x3<f32> = mat3x3<f32>(_S305, _S305, _S305, _S305, _S305, _S305, _S305, _S305, _S305);
var _S309 : mat3x3<f32> = _S297 + mat3x3<f32>(_S308[0] * _S307[0], _S308[1] * _S307[1], _S308[2] * _S307[2]);
var vel_grad_det_21 : f32 = vel_grad_det_20 + _S305 * dot(_S306, _S301);
var _S310 : u32 = _S46 + u32(48);
var _S311 : vec4<f32> = shared_nodes_vel_mass_0[_S310];
var _S312 : NodeCdf_0 = shared_nodes_cdf_0[_S310];
var _S313 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(0), u32(2), u32(1))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S310].affinities_0))
{
if((_S312.closest_id_0) != u32(4294967295))
{
var _S314 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S312.closest_id_0];
var _S315 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S312.closest_id_0].com_0, &(_S314), _S313 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S315 + project_velocity_0(_S40 - _S315, _S41.normal_0), _S311.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S311.w);
}
}
else
{
momentum_velocity_mass_1 = _S311;
}
var _S316 : f32 = _S95 * _S44[i32(2)][u32(1)];
var momentum_velocity_mass_22 : vec4<f32> = momentum_velocity_mass_21 + momentum_velocity_mass_1 * vec4<f32>(_S316);
var _S317 : f32 = _S316 * _S42;
var _S318 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S319 : mat3x3<f32> = outer_product_0(_S318, _S313);
var _S320 : mat3x3<f32> = mat3x3<f32>(_S317, _S317, _S317, _S317, _S317, _S317, _S317, _S317, _S317);
var _S321 : mat3x3<f32> = _S309 + mat3x3<f32>(_S320[0] * _S319[0], _S320[1] * _S319[1], _S320[2] * _S319[2]);
var vel_grad_det_22 : f32 = vel_grad_det_21 + _S317 * dot(_S318, _S313);
var _S322 : u32 = _S46 + u32(36);
var _S323 : vec4<f32> = shared_nodes_vel_mass_0[_S322];
var _S324 : NodeCdf_0 = shared_nodes_cdf_0[_S322];
var _S325 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(0), u32(0), u32(1))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S322].affinities_0))
{
if((_S324.closest_id_0) != u32(4294967295))
{
var _S326 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S324.closest_id_0];
var _S327 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S324.closest_id_0].com_0, &(_S326), _S325 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S327 + project_velocity_0(_S40 - _S327, _S41.normal_0), _S323.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S323.w);
}
}
else
{
momentum_velocity_mass_1 = _S323;
}
var _S328 : f32 = _S108 * _S44[i32(2)][u32(1)];
var momentum_velocity_mass_23 : vec4<f32> = momentum_velocity_mass_22 + momentum_velocity_mass_1 * vec4<f32>(_S328);
var _S329 : f32 = _S328 * _S42;
var _S330 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S331 : mat3x3<f32> = outer_product_0(_S330, _S325);
var _S332 : mat3x3<f32> = mat3x3<f32>(_S329, _S329, _S329, _S329, _S329, _S329, _S329, _S329, _S329);
var _S333 : mat3x3<f32> = _S321 + mat3x3<f32>(_S332[0] * _S331[0], _S332[1] * _S331[1], _S332[2] * _S331[2]);
var vel_grad_det_23 : f32 = vel_grad_det_22 + _S329 * dot(_S330, _S325);
var _S334 : u32 = _S46 + u32(42);
var _S335 : vec4<f32> = shared_nodes_vel_mass_0[_S334];
var _S336 : NodeCdf_0 = shared_nodes_cdf_0[_S334];
var _S337 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(0), u32(1), u32(1))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S334].affinities_0))
{
if((_S336.closest_id_0) != u32(4294967295))
{
var _S338 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S336.closest_id_0];
var _S339 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S336.closest_id_0].com_0, &(_S338), _S337 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S339 + project_velocity_0(_S40 - _S339, _S41.normal_0), _S335.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S335.w);
}
}
else
{
momentum_velocity_mass_1 = _S335;
}
var _S340 : f32 = _S121 * _S44[i32(2)][u32(1)];
var momentum_velocity_mass_24 : vec4<f32> = momentum_velocity_mass_23 + momentum_velocity_mass_1 * vec4<f32>(_S340);
var _S341 : f32 = _S340 * _S42;
var _S342 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S343 : mat3x3<f32> = outer_product_0(_S342, _S337);
var _S344 : mat3x3<f32> = mat3x3<f32>(_S341, _S341, _S341, _S341, _S341, _S341, _S341, _S341, _S341);
var _S345 : mat3x3<f32> = _S333 + mat3x3<f32>(_S344[0] * _S343[0], _S344[1] * _S343[1], _S344[2] * _S343[2]);
var vel_grad_det_24 : f32 = vel_grad_det_23 + _S341 * dot(_S342, _S337);
var _S346 : u32 = _S46 + u32(49);
var _S347 : vec4<f32> = shared_nodes_vel_mass_0[_S346];
var _S348 : NodeCdf_0 = shared_nodes_cdf_0[_S346];
var _S349 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(1), u32(2), u32(1))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S346].affinities_0))
{
if((_S348.closest_id_0) != u32(4294967295))
{
var _S350 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S348.closest_id_0];
var _S351 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S348.closest_id_0].com_0, &(_S350), _S349 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S351 + project_velocity_0(_S40 - _S351, _S41.normal_0), _S347.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S347.w);
}
}
else
{
momentum_velocity_mass_1 = _S347;
}
var _S352 : f32 = _S134 * _S44[i32(2)][u32(1)];
var momentum_velocity_mass_25 : vec4<f32> = momentum_velocity_mass_24 + momentum_velocity_mass_1 * vec4<f32>(_S352);
var _S353 : f32 = _S352 * _S42;
var _S354 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S355 : mat3x3<f32> = outer_product_0(_S354, _S349);
var _S356 : mat3x3<f32> = mat3x3<f32>(_S353, _S353, _S353, _S353, _S353, _S353, _S353, _S353, _S353);
var _S357 : mat3x3<f32> = _S345 + mat3x3<f32>(_S356[0] * _S355[0], _S356[1] * _S355[1], _S356[2] * _S355[2]);
var vel_grad_det_25 : f32 = vel_grad_det_24 + _S353 * dot(_S354, _S349);
var _S358 : u32 = _S46 + u32(37);
var _S359 : vec4<f32> = shared_nodes_vel_mass_0[_S358];
var _S360 : NodeCdf_0 = shared_nodes_cdf_0[_S358];
var _S361 : vec3<f32> = _S43 + vec3<f32>(vec3<u32>(u32(1), u32(0), u32(1))) * _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S358].affinities_0))
{
if((_S360.closest_id_0) != u32(4294967295))
{
var _S362 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S360.closest_id_0];
var _S363 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S360.closest_id_0].com_0, &(_S362), _S361 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S363 + project_velocity_0(_S40 - _S363, _S41.normal_0), _S359.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S359.w);
}
}
else
{
momentum_velocity_mass_1 = _S359;
}
var _S364 : f32 = _S147 * _S44[i32(2)][u32(1)];
var momentum_velocity_mass_26 : vec4<f32> = momentum_velocity_mass_25 + momentum_velocity_mass_1 * vec4<f32>(_S364);
var _S365 : f32 = _S364 * _S42;
var _S366 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S367 : mat3x3<f32> = outer_product_0(_S366, _S361);
var _S368 : mat3x3<f32> = mat3x3<f32>(_S365, _S365, _S365, _S365, _S365, _S365, _S365, _S365, _S365);
var _S369 : mat3x3<f32> = _S357 + mat3x3<f32>(_S368[0] * _S367[0], _S368[1] * _S367[1], _S368[2] * _S367[2]);
var vel_grad_det_26 : f32 = vel_grad_det_25 + _S365 * dot(_S366, _S361);
var _S370 : u32 = _S46 + u32(43);
var _S371 : vec4<f32> = shared_nodes_vel_mass_0[_S370];
var _S372 : NodeCdf_0 = shared_nodes_cdf_0[_S370];
var _S373 : vec3<f32> = _S43 + _S50;
if(!affinities_are_compatible_0(_S41.affinity_0, shared_nodes_cdf_0[_S370].affinities_0))
{
if((_S372.closest_id_0) != u32(4294967295))
{
var _S374 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[_S372.closest_id_0];
var _S375 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[_S372.closest_id_0].com_0, &(_S374), _S373 + _S39.pt_0);
momentum_velocity_mass_1 = vec4<f32>(_S375 + project_velocity_0(_S40 - _S375, _S41.normal_0), _S371.w);
}
else
{
momentum_velocity_mass_1 = vec4<f32>(_S40, _S371.w);
}
}
else
{
momentum_velocity_mass_1 = _S371;
}
var _S376 : f32 = _S160 * _S44[i32(2)][u32(1)];
var momentum_velocity_mass_27 : vec4<f32> = momentum_velocity_mass_26 + momentum_velocity_mass_1 * vec4<f32>(_S376);
var _S377 : f32 = _S376 * _S42;
var _S378 : vec3<f32> = momentum_velocity_mass_1.xyz;
var _S379 : mat3x3<f32> = outer_product_0(_S378, _S373);
var _S380 : mat3x3<f32> = mat3x3<f32>(_S377, _S377, _S377, _S377, _S377, _S377, _S377, _S377, _S377);
var _S381 : mat3x3<f32> = _S369 + mat3x3<f32>(_S380[0] * _S379[0], _S380[1] * _S379[1], _S380[2] * _S379[2]);
var vel_grad_det_27 : f32 = vel_grad_det_26 + _S377 * dot(_S378, _S373);
var i_5 : u32 = u32(0);
rigid_vel_1 = _S36;
for(;;)
{
if(i_5 < u32(16))
{
}
else
{
break;
}
if(affinity_bit_0(i_5, _S41.affinity_0))
{
var _S382 : BodyVelocity_std430_0 = entryPointParams_body_vels_0[i_5];
var _S383 : vec3<f32> = body_velocity_at_point_0(entryPointParams_body_mprops_0[i_5].com_0, &(_S382), _S39.pt_0);
rigid_vel_1 = rigid_vel_1 + _S383;
}
i_5 = i_5 + u32(1);
}
velocity_gradient_0 = _S381;
vel_grad_det_1 = vel_grad_det_27;
momentum_velocity_mass_1 = momentum_velocity_mass_27;
}
else
{
rigid_vel_1 = _S36;
velocity_gradient_0 = _S38;
vel_grad_det_1 = 0.0f;
momentum_velocity_mass_1 = _S37;
}
entryPointParams_particles_dyn_0[_S33].cdf_1.rigid_vel_0 = rigid_vel_1;
var _S384 : array<vec3<f32>, i32(3)> = array<vec3<f32>, i32(3)>( vec3<f32>(velocity_gradient_0[i32(0)][i32(0)], velocity_gradient_0[i32(0)][i32(1)], velocity_gradient_0[i32(0)][i32(2)]), vec3<f32>(velocity_gradient_0[i32(1)][i32(0)], velocity_gradient_0[i32(1)][i32(1)], velocity_gradient_0[i32(1)][i32(2)]), vec3<f32>(velocity_gradient_0[i32(2)][i32(0)], velocity_gradient_0[i32(2)][i32(1)], velocity_gradient_0[i32(2)][i32(2)]) );
entryPointParams_particles_dyn_0[_S33].affine_0.data_0 = _S384;
entryPointParams_particles_dyn_0[_S33].vel_grad_det_0 = vel_grad_det_1;
entryPointParams_particles_dyn_0[_S33].velocity_0 = momentum_velocity_mass_1.xyz;
return;
}
@compute
@workgroup_size(4, 4, 4)
fn g2p(@builtin(workgroup_id) block_id_0 : vec3<u32>, @builtin(local_invocation_id) tid_0 : vec3<u32>, @builtin(local_invocation_index) tid_flat_0 : u32)
{
var _S385 : u32 = block_id_0.x;
var _S386 : ActiveBlockHeaderGeneric_std430_0 = entryPointParams_active_blocks_0[_S385];
global_shared_memory_transfers_0(tid_0, &(_S386.virtual_id_0));
workgroupBarrier();
var _S387 : u32 = entryPointParams_active_blocks_0[_S385].first_particle_0 + entryPointParams_active_blocks_0[_S385].num_particles_0;
var sorted_particle_id_0 : u32 = entryPointParams_active_blocks_0[_S385].first_particle_0 + tid_flat_0;
for(;;)
{
if(sorted_particle_id_0 < _S387)
{
}
else
{
break;
}
particle_g2p_0(entryPointParams_sorted_particle_ids_0[sorted_particle_id_0], entryPointParams_grid_0[i32(0)].cell_width_0, entryPointParams_params_0.dt_0);
sorted_particle_id_0 = sorted_particle_id_0 + u32(64);
}
return;
}