Skip to content

Commit

Permalink
Fix library path. Simplify code of bvh.
Browse files Browse the repository at this point in the history
  • Loading branch information
satcy committed Apr 2, 2012
1 parent 208920b commit 6dcec43
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 62 deletions.
63 changes: 1 addition & 62 deletions libs/com/perfume/utils/bvh/Bvh.as
Original file line number Diff line number Diff line change
@@ -1,62 +1 @@
package com.perfume.utils.bvh{
import __AS3__.vec.Vector;
use namespace prfmbvh;
public class Bvh{
public var isLoop:Boolean;

private var _rootBone:BvhBone;
prfmbvh function set rootBone(__bone:BvhBone):void{ _rootBone = __bone; }

private var _frames:Vector.<Vector.<Number>>;
prfmbvh function set frames(__frames:Vector.<Vector.<Number>>):void{ _frames = __frames; }

private var _numFrames:uint;
public function get numFrames():Number { return _numFrames; }
prfmbvh function set numFramesInternal(_num:Number):void { _numFrames = _num; }

private var _frameTime:Number;
public function get frameTime():Number { return _frameTime; }
prfmbvh function set frameTimeInternal(_num:Number):void { _frameTime = _num; }

private var _bones:Vector.<BvhBone>;
public function get bones():Vector.<BvhBone> { return _bones; }

public function Bvh(_str:String) {
_bones = new Vector.<BvhBone>();
new BvhParser(this, _str);
}

public function destroy():void {
_bones = null;
_frames = null;
_rootBone = null;
}

public function gotoFrame(_frame:uint):void {
if (!isLoop) {
if (_frame >= _numFrames) _frame = _numFrames-1;
} else {
while (_frame >= _numFrames) _frame -= _numFrames;
}
var frame:Vector.<Number> = _frames[_frame];
var count:uint = 0;
for each (var _val:Number in frame) {
setBoneProp(count, _val);
count++;
}
}

private function setBoneProp(_index:Number, _val:Number):void {
var count:int = 0;
for each (var _bone:BvhBone in _bones) {
count += _bone.numChannels;
if (count > _index) {
var _idx:int = _index - (count - _bone.numChannels);
_bone[_bone.channels[_idx]] = _val;
break;
}
}
}

}
}
package com.perfume.utils.bvh{ import __AS3__.vec.Vector; use namespace prfmbvh; public class Bvh{ public var isLoop:Boolean; private var _rootBone:BvhBone; prfmbvh function set rootBone(__bone:BvhBone):void{ _rootBone = __bone; } private var _frames:Vector.<Vector.<Number>>; prfmbvh function set frames(__frames:Vector.<Vector.<Number>>):void{ _frames = __frames; } private var _numFrames:uint; public function get numFrames():Number { return _numFrames; } prfmbvh function set numFramesInternal(_num:Number):void { _numFrames = _num; } private var _frameTime:Number; public function get frameTime():Number { return _frameTime; } prfmbvh function set frameTimeInternal(_num:Number):void { _frameTime = _num; } private var _bones:Vector.<BvhBone>; public function get bones():Vector.<BvhBone> { return _bones; } public function Bvh(_str:String) { _bones = new Vector.<BvhBone>(); new BvhParser(this, _str); } public function destroy():void { _bones = null; _frames = null; _rootBone = null; } public function gotoFrame(_frame:uint):void { if (!isLoop) { if (_frame >= _numFrames) _frame = _numFrames-1; } else { while (_frame >= _numFrames) _frame -= _numFrames; } var frame:Vector.<Number> = _frames[_frame]; var numFrame:int = frame.length; var count:int = 0; var i:int; var l:int; for each (var _bone:BvhBone in _bones) { l = _bone.numChannels; for ( i=0; i<l; i++ ) { if ( count < numFrame ) { _bone[_bone.channels[i]] = frame[count]; count++; } } } } }}
Expand Down
Binary file modified simple-example/bin/test_bvh.swf
Binary file not shown.
Binary file modified simple-example/bin/test_bvh_line.swf
Binary file not shown.
Binary file modified simple-example/src/test_bvh.fla
Binary file not shown.
Binary file modified simple-example/src/test_bvh_line.fla
Binary file not shown.

0 comments on commit 6dcec43

Please sign in to comment.