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
85
|
package sk.neuromancer.sphaera.rewrite;
import sk.neuromancer.sphaera.interf.Moving;
import sk.neuromancer.sphaera.interf.Tickable;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.math.Vector3;
public class Player extends DirectedSphere implements Moving, Tickable{
public static float BASE_RADIUS = 1f;
public static float CAM_MULT = 1.0f;
public static float CAM_BASE = 28f;
public static final Color DEFAULT_DIFFUSE = new Color(0.1f, 0.1f, 0.1f, 1f);
public static final Color DEFAULT_SPECULAR = new Color(1f, 1f, 1f, 0.5f);
public static final Color DEFAULT_AMBIENT = new Color(0.05f, 0.05f, 0.05f, 0.5f);
public static final Color DEFAULT_REFLECTION = new Color(1f, 1f, 1f, 0.5f);
public static final Material BASE_MAT = new Material(ColorAttribute.createDiffuse(DEFAULT_DIFFUSE),
ColorAttribute.createReflection(DEFAULT_SPECULAR),
ColorAttribute.createAmbient(DEFAULT_AMBIENT),
ColorAttribute.createReflection(DEFAULT_REFLECTION)
);
public static final float MOV_SPEED = 1.2f;
public static final float ROT_SPEED = 5f;
private float speed = MOV_SPEED;
public Player() {
super();
}
public Player(float radius) {
super(radius);
}
public Player(float radius, Material... mat) {
super(radius, mat);
}
public Player(float x, float y, float z, float radius, Material... mat) {
super(x, y, z, radius, mat);
}
public Player(Sphere parent, float a, float b, float radius, Vector3 direction,
Material... mat) {
super(parent, a, b, radius, direction, mat);
}
public Vector3 getCameraPosition(){
return this.getRelativePosition().setLength(CAM_BASE + this.getRadius() * CAM_MULT);
}
public Vector3 getCameraDirection(){
return this.getCameraPosition().scl(-1);
}
public Vector3 getCameraUp(){
return this.getDirection();
}
@Override
public void tick(long tickCount) {
}
public float getSpeed(){
return this.speed;
}
public void setSpeed(float speed){
this.speed = speed;
}
/*
@Override public void dropOnParent(Vector3 oldParentPos){
super.dropOnParent(oldParentPos);
setDirection(this.getDirection().scl(-1));
}
*/
}
|