diff options
Diffstat (limited to 'core/src/sk/neuromancer/sphaera/rewrite/Player.java')
| -rwxr-xr-x | core/src/sk/neuromancer/sphaera/rewrite/Player.java | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/core/src/sk/neuromancer/sphaera/rewrite/Player.java b/core/src/sk/neuromancer/sphaera/rewrite/Player.java new file mode 100755 index 0000000..254438e --- /dev/null +++ b/core/src/sk/neuromancer/sphaera/rewrite/Player.java @@ -0,0 +1,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)); + } +*/ +} |
