Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reordered main function to make it more tutorial-like
 - Added link to COLLADA's official website.
 - Added comments to distinguish coordinates related to camera from
   coordinates related to the 3D model.
 - Changed single line comments to the corresponding bracket.
 - Made reference to the CU Macky Auditorium on its position.
  • Loading branch information
Beak-man committed Sep 16, 2020
commit 4b5f1ab7e8d00265436d9371a9c7c5de77b16ce2
37 changes: 18 additions & 19 deletions src/gov/nasa/worldwindx/examples/ColladaViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import java.io.File;

/**
* Shows how to load COLLADA models.
* Shows how to load {@link <a href="https://www.khronos.org/collada/">COLLADA</a> 3D models.
*/
public class ColladaViewer extends ApplicationTemplate {

Expand Down Expand Up @@ -83,23 +83,17 @@ protected void addColladaLayer(ColladaRoot colladaRoot) {
}
}

/**
* A <code>Thread</code> that loads a COLLADA file and displays it in an <code>AppFrame</code>.
*/
// A <code>Thread</code> that loads a COLLADA file and displays it in an <code>AppFrame</code>.
public static class WorkerThread extends Thread {

/**
* Indicates the source of the COLLADA file loaded by this thread. Initialized during construction.
*/
// Indicates the source of the COLLADA file loaded by this thread. Initialized during construction.
protected Object colladaSource;
/**
* Geographic position of the COLLADA model.
*/

// Geographic position of the COLLADA model.
protected Position position;
/**
* Indicates the <code>AppFrame</code> the COLLADA file content is displayed in. Initialized during
* construction.
*/

// Indicates the <code>AppFrame</code> the COLLADA file content is displayed in. Initialized during
// construction.
protected AppFrame appFrame;

/**
Expand Down Expand Up @@ -137,17 +131,22 @@ public void run() {
}
}
}

public static void main(String[] args) {

// Set camera position and pitch angle.
Configuration.setValue(AVKey.INITIAL_LATITUDE, 40.028);
Configuration.setValue(AVKey.INITIAL_LONGITUDE, -105.27284091410579);
Configuration.setValue(AVKey.INITIAL_ALTITUDE, 4000);
Configuration.setValue(AVKey.INITIAL_PITCH, 50);


// Set the application frame to update, a position for the model, and a path to the COLLADA file.
final AppFrame af = (AppFrame) start("WorldWind COLLADA Viewer", AppFrame.class);

new WorkerThread(new File("testData/collada/cu_macky/CU Macky.dae"),
Position.fromDegrees(40.009993372683, -105.272774533734), af).start();
final Position MackyAuditoriumPosition = Position.fromDegrees(40.009993372683, -105.272774533734);
final File ColladaFile = new File("testData/collada/cu_macky/CU Macky.dae");

// Invoque the <code>Thread</code> to load the COLLADA model asynchronously.
new WorkerThread(ColladaFile, MackyAuditoriumPosition, af).start();

}
}