gpuray_glsl

annotate util/anim.c @ 1:92695e89164b

vc project
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 09 Nov 2014 14:30:37 +0200
parents
children
rev   line source
nuclear@0 1 #include <stdio.h>
nuclear@0 2 #include <math.h>
nuclear@0 3
nuclear@0 4 #define NUM_SEG 96
nuclear@0 5 #define DIST 12
nuclear@0 6 #define NAME "green_sphere"
nuclear@0 7 #define FULL_TIME 10.0
nuclear@0 8 #define BOUNCES 6.0
nuclear@0 9 #define HEIGHT 3.5
nuclear@0 10
nuclear@0 11 int main(void)
nuclear@0 12 {
nuclear@0 13 int i;
nuclear@0 14 for(i=0; i<NUM_SEG; i++) {
nuclear@0 15 float t = (float)i / (NUM_SEG - 1);
nuclear@0 16 float angle = 2.0 * M_PI * t;
nuclear@0 17 float x = -cos(angle) * DIST;
nuclear@0 18 float z = -sin(angle) * DIST;
nuclear@0 19
nuclear@0 20 float y = fabs(sin(angle * BOUNCES)) * HEIGHT;
nuclear@0 21
nuclear@0 22 printf("xform -name %s -time %.2f -pos %.2f %.2f %.2f\n",
nuclear@0 23 NAME, t * FULL_TIME, x, y, z);
nuclear@0 24 }
nuclear@0 25 return 0;
nuclear@0 26 }