cloth2

diff src/cloth.cc @ 2:b4b8f736332b

switched Cloth::transform to match the new vector/matrix multiplication conventions in gmath
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 13 Jan 2016 20:00:37 +0200
parents dc15b741486c
children
line diff
     1.1 --- a/src/cloth.cc	Mon Jan 11 20:24:13 2016 +0200
     1.2 +++ b/src/cloth.cc	Wed Jan 13 20:00:37 2016 +0200
     1.3 @@ -16,8 +16,8 @@
     1.4  void Cloth::create_rect(int x, int y, float width, float height)
     1.5  {
     1.6  	int num = x * y;
     1.7 -	float dx = width / (float)x;
     1.8 -	float dy = height / (float)y;
     1.9 +	float dx = width / (float)(x - 1);
    1.10 +	float dy = height / (float)(y - 1);
    1.11  
    1.12  	masses.resize(num);
    1.13  	conn.resize(num);
    1.14 @@ -97,7 +97,7 @@
    1.15  void Cloth::transform(const Matrix4x4 &xform)
    1.16  {
    1.17  	for(size_t i=0; i<masses.size(); i++) {
    1.18 -		masses[i].pos = masses[i].pos * xform;
    1.19 +		masses[i].pos = xform * masses[i].pos;
    1.20  	}
    1.21  }
    1.22