From 7604a15a1797f51a78132fc0ffbdc95a857d77c8 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 29 Nov 2013 00:33:58 +0100 Subject: Refactor: move Material outside RobotRace --- src/Material.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/RobotRace.java | 51 --------------------------------------------------- 2 files changed, 51 insertions(+), 51 deletions(-) create mode 100644 src/Material.java diff --git a/src/Material.java b/src/Material.java new file mode 100644 index 0000000..1968e7f --- /dev/null +++ b/src/Material.java @@ -0,0 +1,51 @@ +/** + * Materials that can be used for the robots. + */ +public enum Material { + + /** + * Gold material properties. + * Modify the default values to make it look like gold. + */ + GOLD ( + new float[] {0.8f, 0.8f, 0.8f, 1.0f}, + new float[] {0.0f, 0.0f, 0.0f, 1.0f}), + + /** + * Silver material properties. + * Modify the default values to make it look like silver. + */ + SILVER ( + new float[] {0.8f, 0.8f, 0.8f, 1.0f}, + new float[] {0.0f, 0.0f, 0.0f, 1.0f}), + + /** + * Wood material properties. + * Modify the default values to make it look like wood. + */ + WOOD ( + new float[] {0.8f, 0.8f, 0.8f, 1.0f}, + new float[] {0.0f, 0.0f, 0.0f, 1.0f}), + + /** + * Orange material properties. + * Modify the default values to make it look like orange. + */ + ORANGE ( + new float[] {0.8f, 0.8f, 0.8f, 1.0f}, + new float[] {0.0f, 0.0f, 0.0f, 1.0f}); + + /** The diffuse RGBA reflectance of the material. */ + float[] diffuse; + + /** The specular RGBA reflectance of the material. */ + float[] specular; + + /** + * Constructs a new material with diffuse and specular properties. + */ + private Material(float[] diffuse, float[] specular) { + this.diffuse = diffuse; + this.specular = specular; + } +} diff --git a/src/RobotRace.java b/src/RobotRace.java index f064de8..61edd34 100644 --- a/src/RobotRace.java +++ b/src/RobotRace.java @@ -286,57 +286,6 @@ public class RobotRace extends Base { } /** - * Materials that can be used for the robots. - */ - public enum Material { - - /** - * Gold material properties. - * Modify the default values to make it look like gold. - */ - GOLD ( - new float[] {0.8f, 0.8f, 0.8f, 1.0f}, - new float[] {0.0f, 0.0f, 0.0f, 1.0f}), - - /** - * Silver material properties. - * Modify the default values to make it look like silver. - */ - SILVER ( - new float[] {0.8f, 0.8f, 0.8f, 1.0f}, - new float[] {0.0f, 0.0f, 0.0f, 1.0f}), - - /** - * Wood material properties. - * Modify the default values to make it look like wood. - */ - WOOD ( - new float[] {0.8f, 0.8f, 0.8f, 1.0f}, - new float[] {0.0f, 0.0f, 0.0f, 1.0f}), - - /** - * Orange material properties. - * Modify the default values to make it look like orange. - */ - ORANGE ( - new float[] {0.8f, 0.8f, 0.8f, 1.0f}, - new float[] {0.0f, 0.0f, 0.0f, 1.0f}); - - /** The diffuse RGBA reflectance of the material. */ - float[] diffuse; - - /** The specular RGBA reflectance of the material. */ - float[] specular; - - /** - * Constructs a new material with diffuse and specular properties. - */ - private Material(float[] diffuse, float[] specular) { - this.diffuse = diffuse; - this.specular = specular; - } - } - * Implementation of a camera with a position and orientation. */ private class Camera { -- cgit v1.2.1