Java Reference
In-Depth Information
Figure 12. Second code segment of BillboardDemo.java
44. Shape3D createRunway()
45. {
46. Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
47. int vertex = 4;
48. int StripCount[] = {vertex};
49. TriangleStripArray Runway1 = new TriangleStripArray(vertex,
50. TriangleStripArray.COORDINATES|TriangleStripArray.COLOR_3,
51. StripCount);
52. Runway1.setCoordinate(0, new Point3f(-10.0f,0.0f, -50.0f));
53. Runway1.setCoordinate(1, new Point3f(-10.0f, 0.0f,50.0f));
54. Runway1.setCoordinate(2, new Point3f(10.0f, 0.0f,-50.0f));
55. Runway1.setCoordinate(3, new Point3f(10.0f, 0.0f,50.0f));
56. for(int i = 0; i < 4; i++) Runway1.setColor( i, black);
57. return new Shape3D(Runway1);
58. }
59.
60. Shape3D createTree()
61. {
62. int vertex = 14;
63. int StripCount[] = {vertex};
64. LineStripArray tree = new LineStripArray(vertex,
65. LineStripArray.COORDINATES|LineStripArray.COLOR_3, StripCount);
66. tree.setCoordinate(0, new Point3f(-0.5f,0.0f, 0.0f));
67. tree.setCoordinate(1, new Point3f(-0.25f, 0.2f,0.0f));
68. tree.setCoordinate(2, new Point3f(-0.5f, 0.2f,0.0f));
69. tree.setCoordinate(3, new Point3f(-0.25f, 0.4f,0.0f));
70. tree.setCoordinate(4, new Point3f(-0.5f,0.4f, 0.0f));
71. tree.setCoordinate(5, new Point3f(0.0f,0.6f, 0.0f));
72. tree.setCoordinate(6, new Point3f(0.5f,0.4f, 0.0f));
73. tree.setCoordinate(7, new Point3f(0.25f,0.4f, 0.0f));
74. tree.setCoordinate(8, new Point3f(0.5f,0.2f, 0.0f));
75. tree.setCoordinate(9, new Point3f(0.25f,0.2f, 0.0f));
76. tree.setCoordinate(10, new Point3f(0.5f,0.0f, 0.0f));
77. tree.setCoordinate(11, new Point3f(0.25f,-0.2f, 0.0f));
78. tree.setCoordinate(12, new Point3f(-0.25f,-0.2f, 0.0f));
79. tree.setCoordinate(13, new Point3f(-0.5f,0.0f, 0.0f));
80. Color3f green = new Color3f(0.0f, 1.0f, 0.5f);
81. Color3f brown = new Color3f(0.7f, 0.5f, 0.5f);
82. for(int i = 0; i <11; i++) tree.setColor( i, green);
83. for (int j=11; j<14;j++) tree.setColor(j,brown);
84. return new Shape3D(tree);
85. }
86.
Search WWH ::




Custom Search