Normand Briere
2018-07-03 02e145cb923d601395acc7f15ae9e13f85ef2fbb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package mocap.figure;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.vecmath.Point3d;
 
/**
 * Manages a number of figures.
 * 
 * @author Michael Kipp
 */
public class FigureManager {
 
    private List<Figure> _figures = new ArrayList<Figure>();
 
    public FigureManager() {
    }
 
    /**
     * Creates a new figure object and add it to the pool.
    
     * @return Created figure object.
     */
    public Figure addFigure(String name, Bone skeleton, Point3d offset) {
        Figure f = new Figure(name, skeleton);
        f.setOffset(offset);
        _figures.add(f);
        return f;
    }
 
    public List<Figure> getFigures() {
        return _figures;
    }
 
    public void update(float fps) {
        for (Figure f : _figures) {
            if (f.hasAnimation()) {
                f.getPlayer().update(fps);
            }
        }
    }
 
    public boolean playAll() {
        if (_figures.size() > 0) {
            for (Figure f : _figures) {
                f.getPlayer().setIsPlaying(true);
            }
            return true;
        } else {
            return false;
        }
    }
 
    public void pauseAll() {
        for (Figure f : _figures) {
            f.getPlayer().setIsPlaying(false);
        }
    }
 
    public void stopAll() {
        for (Figure f : _figures) {
            f.getPlayer().reset();
        }
    }
 
    public void frameForwardAll() {
        for (Figure f : _figures) {
            f.getPlayer().frameForward();
        }
    }
 
    public void frameBackwardAll() {
        for (Figure f : _figures) {
            f.getPlayer().frameBackward();
        }
    }
 
    public void setFpsAll(float fps) {
        for (Figure f : _figures) {
            f.getPlayer().setPlaybackFps(fps);
        }
    }
}