summaryrefslogtreecommitdiff
path: root/src/robotrace/GlobalState.java
blob: b435b8a8834d16f23fc69637ca0dc941b5c9c27f (plain)
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
package robotrace;

/**
 * The state variables that describe how the
 * scene should be rendered.
 */
public class GlobalState {
    
    // State variables.
    public boolean showAxes;    // Show an axis frame if true.
    public boolean showStick;   // Show robot(s) as stick figures.
    public int trackNr;         // Track to use:
                                // 0 -> test track,
                                // 1 -> O, 2 -> L, 3 -> C, 4 -> custom.
    
    public float tAnim;         // Time since start of animation in seconds.
    
    public int w;               // Width of window in pixels.
    public int h;               // Height of window in pixels.
    
    public Vector cnt;          // Center point.
    public float vDist;         // Distance eye point to center point.
    public float vWidth;        // Width of scene to be shown.
    public float theta;         // Azimuth angle in radians.
    public float phi;           // Inclination angle in radians.
    //public boolean persp;       // Perspective (true) or isometric (false) projection.
    
    public int camMode;         // In race mode: 0 -> overview,
                                //               1 -> tracking helicopter,
                                //               2 -> view from the side on the leader,
                                //               3 -> view from camera on top of
                                //                    last robot,
                                //               4 -> autoswitch.
    
    //public boolean lightCamera; // Light source is attached to camera (true)
                                // or world (false).

    /**
     * Default settings.
     */
    public final void reset() {
        showAxes = true;
        showStick = false;
        trackNr = 0;
        tAnim = -1;
        cnt = Vector.O;
        vDist = 10f;
        vWidth = 10f;
        theta = 0f;
        phi = 0f;
        //persp = false;
        camMode = 0;
        //lightCamera = false;
    }
    
    public GlobalState() {
        reset();
    }
    
    /**
     * Textual format.
     */
    @Override
    public String toString() {
        return "GlobalState{" +
                "showAxes=" + showAxes +
                ", showStick=" + showStick +
                ", trackNr=" + trackNr +
                ", tAnim=" + tAnim +
                ", w=" + w +
                ", h=" + h +
                ", cnt=" + cnt +
                ", vDist=" + vDist +
                ", vWidth=" + vWidth +
                ", phi=" + theta +
                ", theta=" + phi +
                //", persp=" + persp +
                ", camMode=" + camMode +
                //", lightCamera=" + lightCamera +
                '}';
    }
    
}