X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmeshgen.c;h=980491339051cf0e8f8d38cd791f3ea7740e3046;hb=3bf187fe037df34459f04bf4e625f38afb80fcf8;hp=b9e394f04784a8fb8b874d3361a45e2b8a6b8e70;hpb=f0f09a5f3f76fd4207e4d2d71f29f876b2b379f7;p=retroray diff --git a/src/meshgen.c b/src/meshgen.c index b9e394f..9804913 100644 --- a/src/meshgen.c +++ b/src/meshgen.c @@ -5,8 +5,8 @@ /* -------- sphere -------- */ -#define SURAD(u) ((u) * 2.0 * M_PI) -#define SVRAD(v) ((v) * M_PI) +#define SURAD(u) ((u) * 2.0 * CGM_PI) +#define SVRAD(v) ((v) * CGM_PI) static void sphvec(cgm_vec3 *v, float theta, float phi) { @@ -47,19 +47,19 @@ void gen_sphere(struct cmesh *mesh, float rad, int usub, int vsub, float urange, u = 0.0; for(i=0; ix = 0.5 * theta / M_PI + 0.5; - uvarr->y = phi / M_PI; + uvarr->x = 0.5 * theta / CGM_PI + 0.5; + uvarr->y = phi / CGM_PI; uvarr++; } } @@ -254,11 +254,11 @@ void gen_torus(struct cmesh *mesh, float mainrad, float ringrad, int usub, int v u = 0.0; for(i=0; ix = pos.x * cos(angle); res->y = pos.y; res->z = pos.x * sin(angle); @@ -807,7 +807,7 @@ void gen_revol(struct cmesh *mesh, int usub, int vsub, cgm_vec2 (*rfunc)(float, } } -static inline void sweep_vert(cgm_vec3 *res, float u, float v, float height, +static CGM_INLINE void sweep_vert(cgm_vec3 *res, float u, float v, float height, cgm_vec2 (*sf)(float, float, void*), void *cls) { cgm_vec2 pos = sf(u, v, cls);