gpuray_glsl

diff util/anim.c @ 0:f234630e38ff

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 09 Nov 2014 13:03:36 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/util/anim.c	Sun Nov 09 13:03:36 2014 +0200
     1.3 @@ -0,0 +1,26 @@
     1.4 +#include <stdio.h>
     1.5 +#include <math.h>
     1.6 +
     1.7 +#define NUM_SEG	96
     1.8 +#define DIST	12
     1.9 +#define NAME	"green_sphere"
    1.10 +#define FULL_TIME	10.0
    1.11 +#define BOUNCES		6.0
    1.12 +#define HEIGHT		3.5
    1.13 +
    1.14 +int main(void)
    1.15 +{
    1.16 +	int i;
    1.17 +	for(i=0; i<NUM_SEG; i++) {
    1.18 +		float t = (float)i / (NUM_SEG - 1);
    1.19 +		float angle = 2.0 * M_PI * t;
    1.20 +		float x = -cos(angle) * DIST;
    1.21 +		float z = -sin(angle) * DIST;
    1.22 +
    1.23 +		float y = fabs(sin(angle * BOUNCES)) * HEIGHT;
    1.24 +
    1.25 +		printf("xform -name %s -time %.2f -pos %.2f %.2f %.2f\n",
    1.26 +				NAME, t * FULL_TIME, x, y, z);
    1.27 +	}
    1.28 +	return 0;
    1.29 +}