ld33_umonster

diff src/dragon.cc @ 8:bed39534d471

fell back to the equi-radii capsule which works
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Aug 2015 02:26:01 +0300
parents 92d662deb66e
children 4f6168f3ca82
line diff
     1.1 --- a/src/dragon.cc	Tue Aug 25 00:38:00 2015 +0300
     1.2 +++ b/src/dragon.cc	Tue Aug 25 02:26:01 2015 +0300
     1.3 @@ -10,10 +10,11 @@
     1.4  #define DYN_FCOUNT		64
     1.5  #define DYN_VCOUNT		(DYN_FCOUNT * 3)
     1.6  
     1.7 -#define NUM_NECK_SEG	8
     1.8 +#define NUM_NECK_SEG	10
     1.9  static const float nseg_sizes[NUM_NECK_SEG][2] = {
    1.10 -	{1.0, 3.0}, {1.0, 1.5}, {1.5, 2.0}, {2.0, 2.5}, {2.5, 3.0}, {3.0, 3.5}
    1.11 +	{2.0, 2.0}, {1.0, 1.0}, {1.0, 1.0}, {1.25, 1.25}, {1.3, 1.3}, {1.5, 1.5}, {1.6, 1.6}, {1.75, 1.75}, {2.0, 2.0}, {2.1, 2.1}
    1.12  };
    1.13 +#define NSEG_SZ_SCALE	0.5f
    1.14  
    1.15  static Vector3 bezier(const Vector3 &a, const Vector3 &b, const Vector3 &c, const Vector3 &d, float t);
    1.16  static float mseval(struct metasurface *ms, float x, float y, float z);
    1.17 @@ -36,8 +37,9 @@
    1.18  	neck_seg = new Capsule[neck_seg_count];
    1.19  
    1.20  	for(int i=0; i<neck_seg_count; i++) {
    1.21 -		neck_seg[i].w[0] = nseg_sizes[i][0];
    1.22 -		neck_seg[i].w[1] = nseg_sizes[i][1];
    1.23 +		int idx = neck_seg_count - i - 1;
    1.24 +		neck_seg[i].w[0] = nseg_sizes[idx][0] * NSEG_SZ_SCALE;
    1.25 +		neck_seg[i].w[1] = nseg_sizes[idx][1] * NSEG_SZ_SCALE;
    1.26  	}
    1.27  
    1.28  	msurf = msurf_create();
    1.29 @@ -135,8 +137,8 @@
    1.30  
    1.31  void Dragon::draw() const
    1.32  {
    1.33 -	static float bmin[] = { head_xlim[0] - VOXEL_PAD * 0.9, head_ylim[0] - VOXEL_PAD, head_pos.z };
    1.34 -	static float bmax[] = { head_xlim[1] + VOXEL_PAD * 0.9, head_ylim[1] + VOXEL_PAD * 2.1f, pos.z + VOXEL_PAD };
    1.35 +	static float bmin[] = { head_xlim[0] - VOXEL_PAD * 1.2f, head_ylim[0] - VOXEL_PAD, head_pos.z };
    1.36 +	static float bmax[] = { head_xlim[1] + VOXEL_PAD * 1.2f, head_ylim[1] + VOXEL_PAD * 2.1f, pos.z + VOXEL_PAD };
    1.37  	msurf_set_bounds(msurf, bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2]);
    1.38  
    1.39