Miloslav Ciz %!s(int64=3) %!d(string=hai) anos
pai
achega
20d39c2456
Modificáronse 4 ficheiros con 9 adicións e 6 borrados
  1. 2 2
      TODO.txt
  2. 1 1
      programs/make.sh
  3. 1 1
      programs/stack.c
  4. 5 2
      programs/water.c

+ 2 - 2
TODO.txt

@@ -4,9 +4,7 @@ TODO:
   colliding joint, the speeds always cancel out -- leave as is or somehow fix?
 - function that tests a validity of an environemnt function, i.e. if it behaves
   mathematically correct + test built in env functions with it
-- demo: testing different frictions on skewed plane, also different elasticities
 - zero weight joints should behave how?
-- test different tick lengths (demo)
 - test env functions with a single distinct point near camera
 - env function: heightmap
 - bounding box/sphere test functions/macros for optimization of environment
@@ -15,8 +13,10 @@ TODO:
 
 DONE:
 - demo: car
+- demo: testing different frictions on skewed plane, also different elasticities
 - bug? bodies stuck inside each other resist falling down by gravity (stack.c)
   ^ Seems to be okay now?
+- test different tick lengths (demo) <-- seems OK
 - ray casting against bodies
 - world state hash? for testing determinism etc.
 - check if using fastBSphere vs normal BSphere doesn't affect the simulation

+ 1 - 1
programs/make.sh

@@ -1,5 +1,5 @@
 #!/bin/bash
 
-PROGRAM=stack # change this to name of a program you want to compile :)
+PROGRAM=water # change this to name of a program you want to compile :)
 
 clear; clear; g++ -x c -g -fmax-errors=5 -pedantic -O3 -Wall -Wextra -Wstrict-prototypes -Wold-style-definition -Wno-unused-parameter -Wno-missing-field-initializers -o $PROGRAM $PROGRAM.c -lm -lSDL2 && ./$PROGRAM

+ 1 - 1
programs/stack.c

@@ -1,4 +1,4 @@
-// #define FPS 50
+//#define FPS 10
 
 #include "helper.h"
 

+ 5 - 2
programs/water.c

@@ -1,3 +1,5 @@
+//#define FPS 60
+
 #define CAMERA_STEP 200
 
 #include "helper.h"
@@ -135,9 +137,10 @@ for (int index = 0; index < WATER_JOINTS; ++index)
 
     TPE_worldStep(&tpe_world);
 
-    TPE_bodyApplyGravity(&tpe_world.bodies[1], bodies[1].joints[0].position.y > 0 ? 5 : -10);
+    #define G ((5 * 30) / FPS)
+    TPE_bodyApplyGravity(&tpe_world.bodies[1], bodies[1].joints[0].position.y > 0 ? G : (-2 * G));
 
-    #define ACC 25
+    #define ACC ((25 * 30) / FPS )
     if (sdl_keyboard[SDL_SCANCODE_W])
       TPE_bodyAccelerate(&bodies[1],TPE_vec3(0,0,ACC));
     else if (sdl_keyboard[SDL_SCANCODE_S])