intravenous

diff src/vein.cc @ 9:90af225f469a

- merged collision detection code - reduced inertia
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 28 Apr 2012 17:10:29 +0300
parents 3fae5eb6a411 2723dc026c4f
children
line diff
     1.1 --- a/src/vein.cc	Sun Apr 22 07:15:28 2012 +0300
     1.2 +++ b/src/vein.cc	Sat Apr 28 17:10:29 2012 +0300
     1.3 @@ -29,20 +29,6 @@
     1.4  	free_program(sdr);
     1.5  }
     1.6  
     1.7 -Vector3 Vein::calc_center(const Vector3 &ppos) const
     1.8 -{
     1.9 -	Vector3 pt{0, 0, ppos.z};
    1.10 -	pt.x = sin(ppos.z * 0.75);
    1.11 -	pt.y = cos(ppos.z * 0.2) * 0.6;
    1.12 -	return pt;
    1.13 -}
    1.14 -
    1.15 -Vector3 Vein::calc_dir(const Vector3 &ppos) const
    1.16 -{
    1.17 -	Vector3 dir = calc_center(ppos + Vector3(0, 0, 0.01)) - calc_center(ppos - Vector3(0, 0, 0.01));
    1.18 -	return dir.normalized();
    1.19 -}
    1.20 -
    1.21  void Vein::build_idxbuf()
    1.22  {
    1.23  	delete [] idxbuf;
    1.24 @@ -80,6 +66,16 @@
    1.25  	return true;
    1.26  }
    1.27  
    1.28 +void Vein::set_radius(float rad)
    1.29 +{
    1.30 +	this->rad = rad;
    1.31 +}
    1.32 +
    1.33 +float Vein::get_radius() const
    1.34 +{
    1.35 +	return rad;
    1.36 +}
    1.37 +
    1.38  void Vein::set_fog_color(const Vector3 &col)
    1.39  {
    1.40  	fog_color = col;
    1.41 @@ -110,7 +106,7 @@
    1.42  		Vector3 right = cross_product(up, dir);
    1.43  		up = cross_product(dir, right);
    1.44  
    1.45 -		Matrix3x3 vrot{right, up, dir};
    1.46 +		Matrix3x3 vrot(right, up, dir);
    1.47  		vrot.transpose();
    1.48  
    1.49  		float theta = 0.0, dtheta = 2.0 * M_PI / (ring_subdiv - 1);
    1.50 @@ -149,3 +145,17 @@
    1.51  
    1.52  	glPopMatrix();
    1.53  }
    1.54 +
    1.55 +Vector3 Vein::calc_center(const Vector3 &ppos) const
    1.56 +{
    1.57 +	Vector3 pt(0, 0, ppos.z);
    1.58 +	pt.x = sin(ppos.z * 0.75);
    1.59 +	pt.y = cos(ppos.z * 0.2) * 0.6;
    1.60 +	return pt;
    1.61 +}
    1.62 +
    1.63 +Vector3 Vein::calc_dir(const Vector3 &ppos) const
    1.64 +{
    1.65 +	Vector3 dir = calc_center(ppos + Vector3(0, 0, 0.01)) - calc_center(ppos - Vector3(0, 0, 0.01));
    1.66 +	return dir.normalized();
    1.67 +}