DeveloperExample-MCellCollada
From Whole Brain Catalog
Contents |
[edit] Developer Example, Collada file loading and MCell example.
This document will describe the developer code example relating to Collada rendering and the MCell sample data set. An MCell simulation was run to show the diffusion of two different populations of molecules, which are rendered red and green. The molecules have a reaction to produce a third molecular product, rendered in yellow. Additionally there are two boxes in the scene that are rendered as well. This is an initial test of the rendering capability of JME using the output of an MCell simulation.
[edit] How to Install the Binary
- Download the binary version from here
- Unzip
- execute run.bat on windows or run.sh on mac / linux
[edit] How to Install
[edit] From eclipse
I. First, install and download eclipse and the Maven Plugin Instructions Here
- Checkout a new project from SVN; http://wholebrain.googlecode.com/svn/colladaMoleculesExample/trunk
- Window->Show View->Other...
- Choose SVN->SVN Repository
- Right click within the SVN Repository View that comes up and click New->Repository Location...
- put: https://wholebrain.googlecode.com/svn/ If asked about a digital certificate, Accept Permanently.
- Navigate down to, and right click on the colladaMoleculesExample/ folder and choose Checkout...
- You will be prompted to check out the project. Choose "Check out as a project configured using the New Project Wizard".
- In the "New Project" window that pops up, select Java->Java Project and hit Next
- Do NOT install the code into a path with spaces (like Documents and Settings in Windows). It will cause problems compiling. You can check this by looking at the greyed out "Directory" text box in the "Contents" group just under the Project name at the top of the window. If any of the directories in the path contains a space, you'll need to cancel this Window, open File->Switch Workspace...->Other... and pick a workspace at a location without a space in the file name. Once you have done that, come back and redo this step.
- In the next window, pick a project name you like (for example, "DevExample")
- Click "Finish" and hit OK to any windows that popup
- Right-click on the project, and from the Maven submenu, click "enable dependency management"
- From the same Maven submenu, select "enable nested modules"
- Right click on the project and look at Build path...->Java Build Path->Libraries tab. Click on the arrow to open up the JRE system library. Make sure this is pointing to a jdk 1.5 that is loaded on your machine. If it isn't, then press the Add Library... button and install a new JRE System library that does point to 1.5. On windows, its usually under C:\Program Files\Java. If you can't find a 1.5 JDK, you'll need to download it.
- Create a new run configuration
- Select Run > Run Configurations:
- Under "Maven", create a new run configuration. Name it "clean install". Make the workspace the root under your new project. In the box called "goals" type "clean install". Run this.
[edit] How to Run
Run the main method TestColladaMolecules.java, setting up a run configuration for that file.
[edit] From a command line
We use Maven to build our code. The first thing to know about Maven is provides the "single command" ability to build an entire code base. With SVN and Maven installed you can issue the following commands to download and build the entire source:
svn co http://wholebrain.googlecode.com/svn/colladaMoleculesExample/trunk colladaMoleculesExample cd colladaMoleculesExample mvn clean install
The one caveat to this is that you need to place a single configuration file called settings.xml in your maven directory. Your maven directory is located at ~/.m2 on linux/mac, C:\Users\[username]\.m2 on Vista, and C:\Documents and settings\[username]\.m2 in Windows XP. You can download our copy of the settings.xml file here. This will point your copy of Maven at our proxy maven repository, which contains many of the third party dependencies necessary for the Whole Brain Catalog.
This last process (mvn clean install) will take a long time because it does a lot of magic things for you. First of all it downloads all the jar files that the Whole Brain Catalog depends on to your local machine, under your maven home directory. This will take a while as the WBC depends on a lot of jars. It will also download Maven specific jar files that are used to build the code, run tests, create java docs, do deployment, and so on. Once all these jars are downloaded, it will go step-by-step through the wbc modules, compile them, run their test cases, and package them into jars.
[edit] How to run
After this is finished (will say BUILD SUCCESSFUL), you'll find within colladaMoleculesExample/target a file called ColladaMoleculesExample-X.X.X-SNAPSHOT-release.zip (X.X.X is in place of version numbers). Unzip this and you should find a run.bat file and a run.sh file, one of which you should be able to run to see the example.
[edit] Using
- Use the keys (W,A,S,D,Q,Z) for movement.
- After you load the example, use the W key to navigate towards the boxes that will be visible in the distance. You can use the S key to navigate backwards if you get too close. As you cycle through the files, you will see the boxes disappear and the red, green, and yellow molecules displayed.
[edit] Notes About The Example
The TestColladaMolecules.java class has a main() method which does the following:
- Initializes the JME engine ('the view')
- Loads in the example Collada files (available in resources/viz_medium
- Key files: resources/viz_small directory
- box_test.meshes.0000.dae - two boxes, outer box and inner box
- box_test.molecules.0000.dae - box_test.molecules.1000.dae - series of Collada files specifying the positions of molecules.

