| | package uk.org.floop.epq3d; |
---|
| | |
---|
| | import javax.swing.*; |
---|
| | import java.awt.*; |
---|
| | |
---|
| | class App { |
---|
| | static ObjectCollection mainCollection; |
---|
| | private static void initWindow() { |
---|
| |
---|
| | |
---|
| | public static void main(String[] args) { |
---|
| | // invokeLater() is used here to prevent our graphics processing from |
---|
| | // blocking the GUI. https://stackoverflow.com/a/22534931/4655368 |
---|
| | // this is a lot of boilerplate code that you shouldn't be too concerned about. |
---|
| | // just know that when main runs it will call initWindow() once. |
---|
| | // will call initWindow() once. |
---|
| | SwingUtilities.invokeLater(App::initWindow); |
---|
| | } |
---|
| | |
---|
| | public static void initObjects(){ |
---|
| | mainCollection = new ObjectCollection(); |
---|
| | JsonReader Jason = new JsonReader("cube.json"); |
---|
| | Jason.getObjects(); |
---|
| | mainCollection = Jason.mainCollection; |
---|
| | mainCollection.initialiseAll(); |
---|
| | //textures = Jason.textures; |
---|
| | //mainCollection = new ObjectCollection(); |
---|
| | |
---|
| | Texture testTexture; |
---|
| | /*try { |
---|
| | //testTexture = ImageIO.read(new File("/home/cory/Screenshot from 2022-06-06 18-52-12.png")); |
---|
| | testTexture = new Texture(ImageIO.read(new File("/home/cory/Screenshot from 2022-09-26 13-05-40.png"))); |
---|
| | } catch (IOException e) { |
---|
| | throw new RuntimeException(e); |
---|
| | }*/ |
---|
| | Texture red = new Texture(Color.red); |
---|
| | Texture green = new Texture(Color.GREEN); |
---|
| | Texture blue = new Texture(Color.BLUE); |
---|
| | Texture cyan = new Texture(Color.CYAN); |
---|
| | Texture magenta = new Texture(Color.magenta); |
---|
| | Texture yellow = new Texture(Color.yellow); |
---|
| | |
---|
| | |
---|
| | mainCollection.addObject(new Object3d(new PointComp[]{ |
---|
| | new PointComp(-30,-10,-10), |
---|
| | new PointComp(-30,-10,10), |
---|
| | new PointComp(-30,10,-10), |
---|
| | new PointComp(-30,10,10), |
---|
| | new PointComp(-10,-10,-10), |
---|
| | new PointComp(-10,-10,10), |
---|
| | new PointComp(-10,10,-10), |
---|
| | new PointComp(-10,10,10) |
---|
| | |
---|
| | }, new int[][]{ |
---|
| | {0,2,3,1}, |
---|
| | {4,5,7,6}, |
---|
| | {0,1,5,4}, |
---|
| | {1,3,7,5}, |
---|
| | {3,2,6,7}, |
---|
| | {2,0,4,6}, |
---|
| | }, new Point2D[][]{ |
---|
| | {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | }, |
---|
| | false, |
---|
| | new Texture[]{red, green, blue, cyan, magenta, yellow}, |
---|
| | true)); |
---|
| | // Texture testTexture; |
---|
| | // /*try { |
---|
| | // //testTexture = ImageIO.read(new File("/home/cory/Screenshot from 2022-06-06 18-52-12.png")); |
---|
| | // testTexture = new Texture(ImageIO.read(new File("/home/cory/Screenshot from 2022-09-26 13-05-40.png"))); |
---|
| | // } catch (IOException e) { |
---|
| | // throw new RuntimeException(e); |
---|
| | // }*/ |
---|
| | // Texture red = new Texture("red", Color.red); |
---|
| | // Texture green = new Texture("green", Color.GREEN); |
---|
| | // Texture blue = new Texture("blue", Color.BLUE); |
---|
| | // Texture cyan = new Texture(Color.CYAN); |
---|
| | // Texture magenta = new Texture(Color.magenta); |
---|
| | // Texture yellow = new Texture(Color.yellow); |
---|
| | // |
---|
| | // |
---|
| | // mainCollection.addObject(new Object3d(new PointComp[]{ |
---|
| | // new PointComp(-10,10,10), |
---|
| | // new PointComp(-30,-10,-10), |
---|
| | // new PointComp(-30,-10,10), |
---|
| | // new PointComp(-30,10,-10), |
---|
| | // new PointComp(-30,10,10), |
---|
| | // new PointComp(-10,-10,-10), |
---|
| | // new PointComp(-10,-10,10), |
---|
| | // new PointComp(10,10,10), |
---|
| | // new PointComp(10,-10,10), |
---|
| | // new PointComp(0,0,24) |
---|
| | // new PointComp(-10,10,-10), |
---|
| | // new PointComp(-10,10,10) |
---|
| | // |
---|
| | // }, new int[][]{ |
---|
| | // {0,2,3,1}, |
---|
| | // {1,0,4}, |
---|
| | // {0,2,4}, |
---|
| | // {2,3,4}, |
---|
| | // {3,1,4} |
---|
| | // }, true)); |
---|
| | mainCollection.addObject(new Object3d(new PointComp[]{ |
---|
| | new PointComp(0,0,0), |
---|
| | new PointComp(20,0,0), |
---|
| | new PointComp(0,10,0), |
---|
| | new PointComp(0,0,10), |
---|
| | }, new int[][]{ |
---|
| | {0,1,2}, |
---|
| | {0,2,3}, |
---|
| | {0,3,1}, |
---|
| | {2,1,3} |
---|
| | }, new Point2D[][]{ |
---|
| | {new Point2D(0,0), new Point2D(100,0), new Point2D(0,100)}, |
---|
| | {new Point2D(0,0), new Point2D(100,0), new Point2D(0,100)}, |
---|
| | {new Point2D(0,0), new Point2D(100,0), new Point2D(0,100)}, |
---|
| | }, |
---|
| | false, |
---|
| | new Texture[]{red, blue, cyan, yellow}, |
---|
| | true)); |
---|
| | // {4,5,7,6}, |
---|
| | // {0,1,5,4}, |
---|
| | // {1,3,7,5}, |
---|
| | // {3,2,6,7}, |
---|
| | // {2,0,4,6}, |
---|
| | // }, new Point2D[][]{ |
---|
| | // {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | // {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | // {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | // {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | // {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | // {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | // {new Point2D(0, 0), new Point2D(100, 0), new Point2D(100, 100), new Point2D(0, 100)}, |
---|
| | // }, |
---|
| | // false, |
---|
| | // new Texture[]{red, green, blue, cyan, magenta, yellow}, |
---|
| | // true)); |
---|
| | //// mainCollection.addObject(new Object3d(new PointComp[]{ |
---|
| | //// new PointComp(-10,10,10), |
---|
| | //// new PointComp(-10,-10,10), |
---|
| | //// new PointComp(10,10,10), |
---|
| | //// new PointComp(10,-10,10), |
---|
| | //// new PointComp(0,0,24) |
---|
| | //// }, new int[][]{ |
---|
| | //// {0,2,3,1}, |
---|
| | //// {1,0,4}, |
---|
| | //// {0,2,4}, |
---|
| | //// {2,3,4}, |
---|
| | //// {3,1,4} |
---|
| | //// }, true)); |
---|
| | // mainCollection.addObject(new Object3d(new PointComp[]{ |
---|
| | // new PointComp(0,0,0), |
---|
| | // new PointComp(20,0,0), |
---|
| | // new PointComp(0,10,0), |
---|
| | // new PointComp(0,0,10), |
---|
| | // }, new int[][]{ |
---|
| | // {0,1,2}, |
---|
| | // {0,2,3}, |
---|
| | // {0,3,1}, |
---|
| | // {2,1,3} |
---|
| | // }, new Point2D[][]{ |
---|
| | // {new Point2D(0,0), new Point2D(100,0), new Point2D(0,100)}, |
---|
| | // {new Point2D(0,0), new Point2D(100,0), new Point2D(0,100)}, |
---|
| | // {new Point2D(0,0), new Point2D(100,0), new Point2D(0,100)}, |
---|
| | // }, |
---|
| | // false, |
---|
| | // new Texture[]{red, blue, cyan, yellow}, |
---|
| | // true)); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | |
|