1 | public class PBvh |
---|
2 | { |
---|
3 | public BvhParser parser; |
---|
4 | private int myColor; |
---|
5 | |
---|
6 | public PBvh(String[] data, int c) |
---|
7 | { |
---|
8 | parser = new BvhParser(); |
---|
9 | parser.init(); |
---|
10 | parser.parse( data ); |
---|
11 | myColor=c; |
---|
12 | } |
---|
13 | |
---|
14 | public void update( int ms ) |
---|
15 | { |
---|
16 | parser.moveMsTo( ms );//30-sec loop |
---|
17 | parser.update(); |
---|
18 | } |
---|
19 | |
---|
20 | public void draw() |
---|
21 | { |
---|
22 | fill(myColor); |
---|
23 | |
---|
24 | for( BvhBone b : parser.getBones()) |
---|
25 | { |
---|
26 | pushMatrix(); |
---|
27 | translate(b.absPos.x, b.absPos.y, b.absPos.z); |
---|
28 | ellipse(0, 0, 2, 2); |
---|
29 | popMatrix(); |
---|
30 | if (!b.hasChildren()) |
---|
31 | { |
---|
32 | pushMatrix(); |
---|
33 | translate( b.absEndPos.x, b.absEndPos.y, b.absEndPos.z); |
---|
34 | ellipse(0, 0, 10, 10); |
---|
35 | popMatrix(); |
---|
36 | } |
---|
37 | |
---|
38 | } |
---|
39 | } |
---|
40 | } |
---|