seperate rand instances for each thread
[carveJwlIkooP6JGAAIwe30JlM.git] / world_routes.c
index 2fe52a66367e61c76441c31b01295f64ada2610b..ca072e62985290569c6a7d780e2ed0b588efea99 100644 (file)
@@ -488,7 +488,6 @@ static void world_gen_routes_generate( u32 instance_id ){
    vg_info( "Generating route meshes\n" );
    vg_async_stall();
 
-   vg_rand_seed( 2000 );
    vg_async_item *call_scene = scene_alloc_async( &world->scene_lines, 
                                                   &world->mesh_route_lines,
                                                   200000, 300000 );
@@ -698,7 +697,7 @@ static void world_routes_fixedupdate( world_instance *world ){
    rb_presolve_contacts( rb_contact_buffer, rb_contact_count );
 
    for( int i=0; i<rb_contact_count; i++ ){
-      rb_contact_restitution( rb_contact_buffer+i, vg_randf64() );
+      rb_contact_restitution( rb_contact_buffer+i, vg_randf64(&vg.rand) );
    }
 
    for( int i=0; i<6; i++ ){
@@ -882,13 +881,13 @@ static void world_routes_fracture( world_instance *world, ent_gate *gate,
             v3_muls( origin, -1.0f, particle->mlocal[3] );
 
             v3_copy( world_co, particle->obj.rb.co );
-            v3_muls( imp_v, 1.0f+vg_randf64(), particle->obj.rb.v );
+            v3_muls( imp_v, 1.0f+vg_randf64(&vg.rand), particle->obj.rb.v );
             particle->obj.rb.v[1] += 2.0f;
 
             v4_copy( q, particle->obj.rb.q );
-            particle->obj.rb.w[0] = vg_randf64()*2.0f-1.0f;
-            particle->obj.rb.w[1] = vg_randf64()*2.0f-1.0f;
-            particle->obj.rb.w[2] = vg_randf64()*2.0f-1.0f;
+            particle->obj.rb.w[0] = vg_randf64(&vg.rand)*2.0f-1.0f;
+            particle->obj.rb.w[1] = vg_randf64(&vg.rand)*2.0f-1.0f;
+            particle->obj.rb.w[2] = vg_randf64(&vg.rand)*2.0f-1.0f;
 
             particle->obj.type = k_rb_shape_sphere;
             particle->obj.inf.sphere.radius = r*0.6f;