|
@@ -3,22 +3,22 @@
|
|
|
* @author Michael Guerrero / http://realitymeltdown.com
|
|
|
*/
|
|
|
|
|
|
-THREE.BoneAxisHelper = function ( bone, baseBoxSize, scaleRatio ) {
|
|
|
+THREE.BoneHelper = function ( bone, jointBoxSize, scaleRatio ) {
|
|
|
|
|
|
THREE.Object3D.call( this );
|
|
|
|
|
|
this.scaleRatio = ( scaleRatio !== undefined ) ? scaleRatio : 1;
|
|
|
this.bone = bone;
|
|
|
|
|
|
- var baseBoxSize = ( baseBoxSize !== undefined ) ? baseBoxSize : 1;
|
|
|
- var boxSize = baseBoxSize * this.scaleRatio;
|
|
|
+ var jointBoxSize = ( jointBoxSize !== undefined ) ? jointBoxSize : 1;
|
|
|
+ var boxSize = jointBoxSize * this.scaleRatio;
|
|
|
var boxGeometry = new THREE.BoxGeometry(boxSize, boxSize, boxSize);
|
|
|
var boxMaterial = new THREE.MeshBasicMaterial();
|
|
|
|
|
|
this.cube = new THREE.Mesh(boxGeometry, boxMaterial);
|
|
|
this.add(this.cube);
|
|
|
|
|
|
- this.axes = new THREE.AxisHelper( baseBoxSize * 3 );
|
|
|
+ this.axes = new THREE.AxisHelper( jointBoxSize * 3 );
|
|
|
this.add( this.axes );
|
|
|
|
|
|
if ( this.bone.parent instanceof THREE.Bone ) {
|
|
@@ -28,6 +28,8 @@ THREE.BoneAxisHelper = function ( bone, baseBoxSize, scaleRatio ) {
|
|
|
|
|
|
lineGeometry.vertices.push( new THREE.Vector3() );
|
|
|
lineGeometry.vertices.push( new THREE.Vector3() );
|
|
|
+ lineGeometry.colors.push( new THREE.Color( 0, 0, 0) );
|
|
|
+ lineGeometry.colors.push( new THREE.Color( 1, 1, 1) );
|
|
|
|
|
|
this.line = new THREE.Line( lineGeometry, lineMaterial );
|
|
|
this.add(this.line);
|
|
@@ -38,9 +40,9 @@ THREE.BoneAxisHelper = function ( bone, baseBoxSize, scaleRatio ) {
|
|
|
};
|
|
|
|
|
|
|
|
|
-THREE.BoneAxisHelper.prototype = Object.create( THREE.Object3D.prototype );
|
|
|
+THREE.BoneHelper.prototype = Object.create( THREE.Object3D.prototype );
|
|
|
|
|
|
-THREE.BoneAxisHelper.prototype.update = function () {
|
|
|
+THREE.BoneHelper.prototype.update = function () {
|
|
|
|
|
|
if ( this.visible && this.bone.parent instanceof THREE.Bone ) {
|
|
|
|