void processBone(BvhBone bone, Joint joint) { joint.Position = new Vector3(bone.getOffsetX(), bone.getOffsetY(), bone.getOffsetZ()); joint.Name = bone.getName(); joint.Kind = JointNameTable.GetJointType(joint.Name); if (joint.Name.StartsWith("Left") || joint.Name.StartsWith("l")) { joint.Side = JointSide.Left; } else if (joint.Name.StartsWith("Right") || joint.Name.StartsWith("r")) { joint.Side = JointSide.Right; } if (bone.hasChildren()) { foreach (BvhBone childBone in bone.getChildren()) { Joint childJoint = new Joint(); processBone(bone, childJoint); if (childJoint.Kind != JointType.Invalid) { joint.Children.Add(childJoint); } } } }
void processBone(BvhBone bone, Joint joint) { joint.Position = new Vector3(bone.getOffsetX(), bone.getOffsetY(), bone.getOffsetZ()); joint.Name = bone.getName(); joint.Kind = JointNameTable.GetJointType(joint.Name); if (joint.Name.StartsWith("Left") || joint.Name.StartsWith("l")) { joint.Side = JointSide.Left; } else if (joint.Name.StartsWith("Right") || joint.Name.StartsWith("r")) { joint.Side = JointSide.Right; } if (bone.hasChildren()) { foreach (BvhBone childBone in bone.getChildren()) { Joint childJoint = new Joint(); processBone(bone, childJoint); if (childJoint.Kind != JointType.Invalid) joint.Children.Add(childJoint); } } }
private BvhBone _parseBone() { //_currentBone is Parent BvhBone bone = new BvhBone(_currentBone); _bones.Add(bone); bone.setName(_lines[_currentLine]._boneName); //1 // +2 OFFSET _currentLine++; // 2 { _currentLine++; // 3 OFFSET bone.setOffsetX(_lines[_currentLine].getOffsetX()); bone.setOffsetY(_lines[_currentLine].getOffsetY()); bone.setOffsetZ(_lines[_currentLine].getOffsetZ()); // +3 CHANNELS _currentLine++; bone.setnbChannels(_lines[_currentLine].getNbChannels()); bone.setChannels(_lines[_currentLine].getChannelsProps()); // +4 JOINT or End Site or } _currentLine++; while (_currentLine < _lines.Count) { String lineType = _lines[_currentLine].getLineType(); if (BvhLine.BONE.Equals(lineType)) //JOINT or ROOT { BvhBone child = _parseBone(); //generate new BvhBONE child.setParent(bone); bone.getChildren().Add(child); } else if (BvhLine.END_SITE.Equals(lineType)) { _currentLine++; // { _currentLine++; // OFFSET bone.setEndOffsetX(_lines[_currentLine].getOffsetX()); bone.setEndOffsetY(_lines[_currentLine].getOffsetY()); bone.setEndOffsetZ(_lines[_currentLine].getOffsetZ()); _currentLine++; //} _currentLine++; //} return(bone); } else if (BvhLine.BRACE_CLOSED.Equals(lineType)) { return(bone); //} } _currentLine++; } Console.WriteLine("//Something strange"); return(bone); }
private BvhBone _parseBone() { //_currentBone is Parent BvhBone bone = new BvhBone( _currentBone ); _bones.Add(bone); bone.setName( _lines[_currentLine]._boneName ); //1 // +2 OFFSET _currentLine++; // 2 { _currentLine++; // 3 OFFSET bone.setOffsetX( _lines[_currentLine].getOffsetX() ); bone.setOffsetY( _lines[_currentLine].getOffsetY() ); bone.setOffsetZ( _lines[_currentLine].getOffsetZ() ); // +3 CHANNELS _currentLine++; bone.setnbChannels( _lines[_currentLine].getNbChannels() ); bone.setChannels( _lines[_currentLine].getChannelsProps() ); // +4 JOINT or End Site or } _currentLine++; while(_currentLine < _lines.Count) { String lineType = _lines[_currentLine].getLineType(); if ( BvhLine.BONE.Equals( lineType ) ) //JOINT or ROOT { BvhBone child = _parseBone(); //generate new BvhBONE child.setParent( bone ); bone.getChildren().Add(child); } else if( BvhLine.END_SITE.Equals( lineType ) ) { _currentLine++; // { _currentLine++; // OFFSET bone.setEndOffsetX( _lines[_currentLine].getOffsetX() ); bone.setEndOffsetY( _lines[_currentLine].getOffsetY() ); bone.setEndOffsetZ( _lines[_currentLine].getOffsetZ() ); _currentLine++; //} _currentLine++; //} return bone; } else if( BvhLine.BRACE_CLOSED.Equals( lineType ) ) { return bone; //} } _currentLine++; } Console.WriteLine("//Something strange"); return bone; }