goat3d

diff exporters/maxgoat/src/maxgoat.cc @ 90:8b156bc5205b

[maxgoat] fixed the transform export bug [goatview] added widgets for the animation controls [goatview] added a grid ground plane with automatic sizing and transitions from size to size
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 17 May 2014 06:26:24 +0300
parents 9862541fdcf5
children
line diff
     1.1 --- a/exporters/maxgoat/src/maxgoat.cc	Fri May 16 05:23:10 2014 +0300
     1.2 +++ b/exporters/maxgoat/src/maxgoat.cc	Sat May 17 06:26:24 2014 +0300
     1.3 @@ -295,13 +295,13 @@
     1.4  	// grab the animation data
     1.5  	if(!dynamic_cast<GoatAnimExporter*>(this)) {
     1.6  		// no animation, just get the static PRS
     1.7 -		GMatrix maxmatrix = maxnode->GetObjectTM();
     1.8 +		GMatrix maxmatrix = maxnode->GetLocalTM();
     1.9  		Point3 trans = maxmatrix.Translation();
    1.10  		Quat rot = maxmatrix.Rotation();
    1.11  		Point3 scale = maxmatrix.Scaling();
    1.12  
    1.13  		goat3d_set_node_position(node, trans.x, trans.y, trans.z, 0);
    1.14 -		goat3d_set_node_rotation(node, rot.x, rot.y, rot.z, rot.w, 0);
    1.15 +		goat3d_set_node_rotation(node, rot.x, rot.y, rot.z, -rot.w, 0);
    1.16  		goat3d_set_node_scaling(node, scale.x, scale.y, scale.z, 0);
    1.17  
    1.18  	} else {
    1.19 @@ -412,19 +412,19 @@
    1.20  		maxlog("node %s: getting %d linear rotation keys\n", nodename, rkeys.Count());
    1.21  		for(int i=0; i<rkeys.Count(); i++) {
    1.22  			Quat q = rkeys[i].linearKey.qval;
    1.23 -			goat3d_set_node_rotation(node, q.x, q.y, q.z, q.w, KEY_TIME(rkeys[i]));
    1.24 +			goat3d_set_node_rotation(node, q.x, q.y, q.z, -q.w, KEY_TIME(rkeys[i]));
    1.25  		}
    1.26  	} else if(ctrl->GetBezierKeys(rkeys, IGAME_ROT)) {
    1.27  		maxlog("node %s: getting %d bezier rotation keys\n", nodename, rkeys.Count());
    1.28  		for(int i=0; i<rkeys.Count(); i++) {
    1.29  			Quat q = rkeys[i].bezierKey.qval;
    1.30 -			goat3d_set_node_rotation(node, q.x, q.y, q.z, q.w, KEY_TIME(rkeys[i]));
    1.31 +			goat3d_set_node_rotation(node, q.x, q.y, q.z, -q.w, KEY_TIME(rkeys[i]));
    1.32  		}
    1.33  	} else if(ctrl->GetTCBKeys(rkeys, IGAME_ROT)) {
    1.34  		maxlog("node %s: getting %d TCB rotation keys\n", nodename, rkeys.Count());
    1.35  		for(int i=0; i<rkeys.Count(); i++) {
    1.36  			Quat q(rkeys[i].tcbKey.aval);
    1.37 -			goat3d_set_node_rotation(node, q.x, q.y, q.z, q.w, KEY_TIME(rkeys[i]));
    1.38 +			goat3d_set_node_rotation(node, q.x, q.y, q.z, -q.w, KEY_TIME(rkeys[i]));
    1.39  		}
    1.40  	} else {
    1.41  		get_euler_keys(ctrl, node);
    1.42 @@ -471,7 +471,7 @@
    1.43  	while(it != euler.end()) {
    1.44  		Quat q;
    1.45  		EulerToQuat(it->second, q, order);
    1.46 -		goat3d_set_node_rotation(node, q.x, q.y, q.z, q.w, it->first);
    1.47 +		goat3d_set_node_rotation(node, q.x, q.y, q.z, -q.w, it->first);
    1.48  		++it;
    1.49  	}
    1.50  }