X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrtris;a=blobdiff_plain;f=src%2Fstarfield.c;fp=src%2Fstarfield.c;h=6f7b9ae46ca4eadbec304c1f5e2017cfeda6d265;hp=0000000000000000000000000000000000000000;hb=7e20f7693be642b006fa6c4d65f6da1b00b0621f;hpb=3bdc1e0adfc4261ffd74e65b094ca3f1a05dc6b6 diff --git a/src/starfield.c b/src/starfield.c new file mode 100644 index 0000000..6f7b9ae --- /dev/null +++ b/src/starfield.c @@ -0,0 +1,123 @@ +#include +#include +#include +#include +#include +#include "opengl.h" +#include "game.h" +#include "logger.h" + +static unsigned int tex_bolt, tex_star; +static float star_speed = 100.0f; +static float star_depth = 1000.0f; +static float star_size = 0.35f; + +#define STAR_ZOFFS 100.0f +#define STAR_COUNT 4096 +static cgm_vec3 star[STAR_COUNT]; +static float star_lenxy[STAR_COUNT]; + +int init_starfield(void) +{ + int i; + float width; + + if(!(tex_star = img_gltexture_load("data/pimg.png"))) { + error_log("failed to load star texture\n"); + return -1; + } + if(!(tex_bolt = img_gltexture_load("data/bolt.png"))) { + error_log("failed to load star tail texture\n"); + return -1; + } + + width = star_depth / 4.0f; + for(i=0; i