提交 209aab7d 编写于 作者: M michael

Added vertex coloring to the bone helper to help illustrate direction.

Fixed the name of the BoneHelper object.
上级 1d439d02
......@@ -36,7 +36,7 @@ THREE.BlendCharacter = function () {
for ( var i = 0; i < self.skeleton.bones.length; ++i ) {
var helper = new THREE.BoneAxisHelper( self.skeleton.bones[ i ], 2, 1 );
var helper = new THREE.BoneHelper( self.skeleton.bones[ i ], 2, 1 );
helper.update();
self.add( helper );
self.boneHelpers.push( helper );
......
......@@ -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 ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册