Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. package nl.vu.cs.s2.simbadtest;
  2.  
  3. import java.awt.Color;
  4.  
  5. import javax.vecmath.Color3f;
  6. import javax.vecmath.Vector3d;
  7. import javax.vecmath.Vector3f;
  8.  
  9. import simbad.sim.Box;
  10. import simbad.sim.EnvironmentDescription;
  11. import simbad.sim.Wall;
  12.  
  13. public class ExampleEnvironment extends EnvironmentDescription {
  14. public ExampleEnvironment() {
  15.  
  16. // turn on the lights
  17. this.light1IsOn = true;
  18. this.light2IsOn = true;
  19.  
  20. // enable the physics engine in order to have better physics effects on the objects
  21. this.setUsePhysics(true);
  22.  
  23. // show the axes so that we know where things are
  24. this.showAxis(true);
  25.  
  26. this.setWorldSize(25);
  27.  
  28. //Main walls
  29.  
  30. Wall mainWall1 = new Wall(new Vector3d(-12.5, 0, 0), 25, 2, this);
  31. mainWall1.setColor(new Color3f(Color.BLUE));
  32. mainWall1.rotate90(1);
  33. add(mainWall1);
  34.  
  35. Wall mainWall2 = new Wall(new Vector3d(12.5, 0, 0), 25, 2, this);
  36. mainWall2.setColor(new Color3f(Color.BLUE));
  37. mainWall2.rotate90(1);
  38. add(mainWall2);
  39.  
  40. Wall mainWall3 = new Wall(new Vector3d(0, 0, 12.5), 25, 2, this);
  41. mainWall3.setColor(new Color3f(Color.BLUE));
  42. add(mainWall3);
  43.  
  44. Wall mainWall4 = new Wall(new Vector3d(0, 0, -12.5), 25, 2, this);
  45. mainWall4.setColor(new Color3f(Color.BLUE));
  46. add(mainWall4);
  47.  
  48.  
  49. //Horizontal walls
  50.  
  51. Wall hw1 = new Wall(new Vector3d(-2.5, 0, -5), 5, 2, this);
  52. hw1.setColor(new Color3f(Color.RED));
  53. hw1.rotate90(1);
  54. add(hw1);
  55.  
  56. Wall hw2 = new Wall(new Vector3d(-2.5, 0, 5), 5, 2, this);
  57. hw2.setColor(new Color3f(Color.RED));
  58. hw2.rotate90(1);
  59. add(hw2);
  60.  
  61. Wall hw3 = new Wall(new Vector3d(7.5, 0, -7.5), 10, 2, this);
  62. hw3.setColor(new Color3f(Color.RED));
  63. hw3.rotate90(1);
  64. add(hw3);
  65.  
  66. Wall hw4 = new Wall(new Vector3d(2.5, 0, 5), 15, 2, this);
  67. hw4.setColor(new Color3f(Color.RED));
  68. hw4.rotate90(1);
  69. add(hw4);
  70.  
  71. Wall hw5 = new Wall(new Vector3d(-7.5, 0, 10), 5, 2, this);
  72. hw5.setColor(new Color3f(Color.RED));
  73. hw5.rotate90(1);
  74. add(hw5);
  75.  
  76. //Vertical walls
  77.  
  78. Wall vw1 = new Wall(new Vector3d(-7.5, 0, 2.5), 10, 2, this);
  79. vw1.setColor(new Color3f(Color.RED));
  80. add(vw1);
  81.  
  82. Wall vw2 = new Wall(new Vector3d(-10, 0, -2.5), 5, 2, this);
  83. vw2.setColor(new Color3f(Color.RED));
  84. add(vw2);
  85.  
  86. Wall vw3 = new Wall(new Vector3d(-5, 0, -7.5), 5, 2, this);
  87. vw3.setColor(new Color3f(Color.RED));
  88. add(vw3);
  89.  
  90. Wall vw4 = new Wall(new Vector3d(5, 0, -7.5), 5, 2, this);
  91. vw4.setColor(new Color3f(Color.RED));
  92. add(vw4);
  93.  
  94. Wall vw5 = new Wall(new Vector3d(0, 0, -2.5), 5, 2, this);
  95. vw5.setColor(new Color3f(Color.RED));
  96. add(vw5);
  97.  
  98. Wall vw6 = new Wall(new Vector3d(5, 0, 7.5), 5, 2, this);
  99. vw6.setColor(new Color3f(Color.RED));
  100. add(vw6);
  101.  
  102. Wall vw7 = new Wall(new Vector3d(10, 0, 2.5), 5, 2, this);
  103. vw7.setColor(new Color3f(Color.RED));
  104. add(vw7);
  105.  
  106.  
  107. //Box
  108. Box box1 = new Box(new Vector3d(-10, 0, 10), new Vector3f(1, 1, 1), this);
  109. box1.setColor(new Color3f(Color.GREEN));
  110. add(box1);
  111. }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement