|
42 | 42 | import java.io.File; |
43 | 43 |
|
44 | 44 | /** |
45 | | - * Shows how to load COLLADA models. |
| 45 | + * Shows how to load {@link <a href="https://www.khronos.org/collada/">COLLADA</a> 3D models. |
46 | 46 | */ |
47 | 47 | public class ColladaViewer extends ApplicationTemplate { |
48 | 48 |
|
@@ -83,23 +83,17 @@ protected void addColladaLayer(ColladaRoot colladaRoot) { |
83 | 83 | } |
84 | 84 | } |
85 | 85 |
|
86 | | - /** |
87 | | - * A <code>Thread</code> that loads a COLLADA file and displays it in an <code>AppFrame</code>. |
88 | | - */ |
| 86 | + // A <code>Thread</code> that loads a COLLADA file and displays it in an <code>AppFrame</code>. |
89 | 87 | public static class WorkerThread extends Thread { |
90 | 88 |
|
91 | | - /** |
92 | | - * Indicates the source of the COLLADA file loaded by this thread. Initialized during construction. |
93 | | - */ |
| 89 | + // Indicates the source of the COLLADA file loaded by this thread. Initialized during construction. |
94 | 90 | protected Object colladaSource; |
95 | | - /** |
96 | | - * Geographic position of the COLLADA model. |
97 | | - */ |
| 91 | + |
| 92 | + // Geographic position of the COLLADA model. |
98 | 93 | protected Position position; |
99 | | - /** |
100 | | - * Indicates the <code>AppFrame</code> the COLLADA file content is displayed in. Initialized during |
101 | | - * construction. |
102 | | - */ |
| 94 | + |
| 95 | + // Indicates the <code>AppFrame</code> the COLLADA file content is displayed in. Initialized during |
| 96 | + // construction. |
103 | 97 | protected AppFrame appFrame; |
104 | 98 |
|
105 | 99 | /** |
@@ -137,17 +131,22 @@ public void run() { |
137 | 131 | } |
138 | 132 | } |
139 | 133 | } |
140 | | - |
| 134 | + |
141 | 135 | public static void main(String[] args) { |
| 136 | + |
| 137 | + // Set camera position and pitch angle. |
142 | 138 | Configuration.setValue(AVKey.INITIAL_LATITUDE, 40.028); |
143 | 139 | Configuration.setValue(AVKey.INITIAL_LONGITUDE, -105.27284091410579); |
144 | 140 | Configuration.setValue(AVKey.INITIAL_ALTITUDE, 4000); |
145 | 141 | Configuration.setValue(AVKey.INITIAL_PITCH, 50); |
146 | | - |
| 142 | + |
| 143 | + // Set the application frame to update, a position for the model, and a path to the COLLADA file. |
147 | 144 | final AppFrame af = (AppFrame) start("WorldWind COLLADA Viewer", AppFrame.class); |
148 | | - |
149 | | - new WorkerThread(new File("testData/collada/cu_macky/CU Macky.dae"), |
150 | | - Position.fromDegrees(40.009993372683, -105.272774533734), af).start(); |
| 145 | + final Position MackyAuditoriumPosition = Position.fromDegrees(40.009993372683, -105.272774533734); |
| 146 | + final File ColladaFile = new File("testData/collada/cu_macky/CU Macky.dae"); |
| 147 | + |
| 148 | + // Invoque the <code>Thread</code> to load the COLLADA model asynchronously. |
| 149 | + new WorkerThread(ColladaFile, MackyAuditoriumPosition, af).start(); |
151 | 150 |
|
152 | 151 | } |
153 | 152 | } |
0 commit comments