Skip to content
Snippets Groups Projects
Commit dacc609a authored by Jay Jay Billings's avatar Jay Jay Billings
Browse files

Merge remote-tracking branch 'origin/master' into kasper/reflectivity/ui


Conflicts:
	repository/org.eclipse.ice.repository/ice.product.launch

Signed-off-by: default avatarJay Jay Billings <billingsjj@ornl.gov>
parents fc1f0540 cfa8ad5d
No related branches found
No related tags found
No related merge requests found
Showing
with 99 additions and 862 deletions
...@@ -357,8 +357,13 @@ ...@@ -357,8 +357,13 @@
<module>../src/org.eclipse.ice.viz</module> <module>../src/org.eclipse.ice.viz</module>
<module>../tests/org.eclipse.ice.viz.test</module> <module>../tests/org.eclipse.ice.viz.test</module>
<module>../src/org.eclipse.ice.viz.service</module> <module>../src/org.eclipse.ice.viz.service</module>
<module>../src/org.eclipse.ice.viz.service.geometry</module>
<module>../tests/org.eclipse.ice.viz.service.test</module> <module>../tests/org.eclipse.ice.viz.service.test</module>
<module>../src/org.eclipse.ice.viz.service.geometry</module>
<module>../tests/org.eclipse.ice.viz.service.geometry.test</module>
<module>../src/org.eclipse.ice.viz.service.jme3</module>
<module>../tests/org.eclipse.ice.viz.service.jme3.test</module>
<module>../src/org.eclipse.ice.viz.service.mesh</module>
<module>../tests/org.eclipse.ice.viz.service.mesh.test</module>
<module>../src/org.eclipse.ice.viz.service.visit</module> <module>../src/org.eclipse.ice.viz.service.visit</module>
<module>../tests/org.eclipse.ice.viz.service.visit.test</module> <module>../tests/org.eclipse.ice.viz.service.visit.test</module>
<module>../src/org.eclipse.ice.viz.service.paraview</module> <module>../src/org.eclipse.ice.viz.service.paraview</module>
......
<<<<<<< HEAD
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench"> <launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
<booleanAttribute key="append.args" value="true"/> <booleanAttribute key="append.args" value="true"/>
......
This diff is collapsed.
...@@ -5,6 +5,6 @@ Bundle-SymbolicName: org.eclipse.ice.analysistool ...@@ -5,6 +5,6 @@ Bundle-SymbolicName: org.eclipse.ice.analysistool
Bundle-Version: 2.0.0 Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.ice.analysistool Export-Package: org.eclipse.ice.analysistool
Import-Package: org.eclipse.ice.datastructures.form
Require-Bundle: org.eclipse.ice.datastructures;bundle-version="2.0.0"
Bundle-Vendor: Oak Ridge National Laboratory Bundle-Vendor: Oak Ridge National Laboratory
Import-Package: com.jme3.util,
org.eclipse.ice.datastructures.form
...@@ -83,4 +83,4 @@ public interface IAnalysisAsset { ...@@ -83,4 +83,4 @@ public interface IAnalysisAsset {
* @return <p>The URI</p> * @return <p>The URI</p>
*/ */
public URI getURI(); public URI getURI();
} }
\ No newline at end of file
...@@ -8,8 +8,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7 ...@@ -8,8 +8,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.eclipse.core.filesystem, Import-Package: org.eclipse.core.filesystem,
org.eclipse.ice.item, org.eclipse.ice.item,
org.slf4j;version="1.7.2" org.slf4j;version="1.7.2"
Require-Bundle: org.eclipse.ice.datastructures;bundle-version="2.0.0", Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.100",
org.eclipse.core.runtime;bundle-version="3.9.100", org.eclipse.core.resources;bundle-version="3.8.101",
org.eclipse.core.resources;bundle-version="3.8.101" org.eclipse.ice.datastructures;bundle-version="2.0.0"
Export-Package: org.eclipse.ice.caebat.batml Export-Package: org.eclipse.ice.caebat.batml
Bundle-Vendor: Oak Ridge National Laboratory Bundle-Vendor: Oak Ridge National Laboratory
...@@ -13,7 +13,6 @@ Import-Package: com.sun.jersey.api.client, ...@@ -13,7 +13,6 @@ Import-Package: com.sun.jersey.api.client,
org.eclipse.core.runtime;version="3.4.0", org.eclipse.core.runtime;version="3.4.0",
org.eclipse.equinox.app;version="1.1.0", org.eclipse.equinox.app;version="1.1.0",
org.eclipse.ice.client.common, org.eclipse.ice.client.common,
org.eclipse.ice.client.widgets.geometry,
org.eclipse.ice.core.iCore, org.eclipse.ice.core.iCore,
org.eclipse.ice.datastructures.ICEObject, org.eclipse.ice.datastructures.ICEObject,
org.eclipse.ice.datastructures.componentVisitor, org.eclipse.ice.datastructures.componentVisitor,
...@@ -22,6 +21,7 @@ Import-Package: com.sun.jersey.api.client, ...@@ -22,6 +21,7 @@ Import-Package: com.sun.jersey.api.client,
org.eclipse.ice.iclient, org.eclipse.ice.iclient,
org.eclipse.ice.iclient.uiwidgets, org.eclipse.ice.iclient.uiwidgets,
org.eclipse.ice.item, org.eclipse.ice.item,
org.eclipse.ice.viz.service.geometry.widgets,
org.eclipse.jface.action, org.eclipse.jface.action,
org.eclipse.jface.databinding.swt, org.eclipse.jface.databinding.swt,
org.eclipse.jface.dialogs, org.eclipse.jface.dialogs,
......
...@@ -36,6 +36,7 @@ Import-Package: com.jme3.math, ...@@ -36,6 +36,7 @@ Import-Package: com.jme3.math,
org.eclipse.ice.materials, org.eclipse.ice.materials,
org.eclipse.ice.reactor.plant, org.eclipse.ice.reactor.plant,
org.eclipse.ice.viz.service, org.eclipse.ice.viz.service,
org.eclipse.ice.viz.service.jme3.application,
org.eclipse.jgit.api;version="3.2.0", org.eclipse.jgit.api;version="3.2.0",
org.eclipse.jgit.api.errors;version="3.2.0", org.eclipse.jgit.api.errors;version="3.2.0",
org.eclipse.ui, org.eclipse.ui,
......
...@@ -38,6 +38,7 @@ import org.eclipse.ice.datastructures.resource.ICEResource; ...@@ -38,6 +38,7 @@ import org.eclipse.ice.datastructures.resource.ICEResource;
import org.eclipse.ice.item.nuclear.MOOSE; import org.eclipse.ice.item.nuclear.MOOSE;
import org.eclipse.ice.item.nuclear.MOOSEModel; import org.eclipse.ice.item.nuclear.MOOSEModel;
import org.eclipse.ice.reactor.plant.PlantComposite; import org.eclipse.ice.reactor.plant.PlantComposite;
import org.eclipse.ice.viz.service.jme3.application.ViewAppState;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager; import org.eclipse.jface.action.ToolBarManager;
......
...@@ -4,126 +4,44 @@ Bundle-Name: Eclipse Widgets RCP Bundle ...@@ -4,126 +4,44 @@ Bundle-Name: Eclipse Widgets RCP Bundle
Bundle-SymbolicName: org.eclipse.ice.client.widgets.rcp;singleton:=true Bundle-SymbolicName: org.eclipse.ice.client.widgets.rcp;singleton:=true
Bundle-Version: 2.0.0 Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.ice.client.widgets.geometry, Export-Package: org.eclipse.ice.client.widgets.jme,
org.eclipse.ice.client.widgets.jme,
org.eclipse.ice.client.widgets.mesh,
org.eclipse.ice.client.widgets.mesh.properties,
org.eclipse.ice.client.widgets.reactoreditor.plant org.eclipse.ice.client.widgets.reactoreditor.plant
Import-Package: com.jme3.animation, Import-Package: com.jme3.app,
com.jme3.app,
com.jme3.app.state, com.jme3.app.state,
com.jme3.asset, com.jme3.asset,
com.jme3.asset.cache,
com.jme3.asset.plugins,
com.jme3.audio,
com.jme3.audio.lwjgl,
com.jme3.audio.plugins,
com.jme3.bounding, com.jme3.bounding,
com.jme3.bullet,
com.jme3.bullet.collision,
com.jme3.bullet.collision.shapes,
com.jme3.bullet.collision.shapes.infos,
com.jme3.bullet.control,
com.jme3.bullet.control.ragdoll,
com.jme3.bullet.debug,
com.jme3.bullet.joints,
com.jme3.bullet.joints.motors,
com.jme3.bullet.objects,
com.jme3.bullet.objects.infos,
com.jme3.bullet.util,
com.jme3.cinematic,
com.jme3.cinematic.events,
com.jme3.collision, com.jme3.collision,
com.jme3.collision.bih,
com.jme3.cursors.plugins,
com.jme3.effect,
com.jme3.effect.influencers,
com.jme3.effect.shapes,
com.jme3.export, com.jme3.export,
com.jme3.export.binary,
com.jme3.export.xml,
com.jme3.font, com.jme3.font,
com.jme3.font.plugins,
com.jme3.input, com.jme3.input,
com.jme3.input.awt,
com.jme3.input.controls, com.jme3.input.controls,
com.jme3.input.dummy,
com.jme3.input.event,
com.jme3.input.lwjgl,
com.jme3.light, com.jme3.light,
com.jme3.material, com.jme3.material,
com.jme3.material.plugins,
com.jme3.math, com.jme3.math,
com.jme3.post, com.jme3.post,
com.jme3.post.filters,
com.jme3.post.ssao,
com.jme3.renderer, com.jme3.renderer,
com.jme3.renderer.lwjgl,
com.jme3.renderer.queue, com.jme3.renderer.queue,
com.jme3.scene, com.jme3.scene,
com.jme3.scene.control,
com.jme3.scene.debug,
com.jme3.scene.mesh, com.jme3.scene.mesh,
com.jme3.scene.plugins,
com.jme3.scene.plugins.blender,
com.jme3.scene.plugins.blender.animations,
com.jme3.scene.plugins.blender.cameras,
com.jme3.scene.plugins.blender.constraints,
com.jme3.scene.plugins.blender.constraints.definitions,
com.jme3.scene.plugins.blender.curves,
com.jme3.scene.plugins.blender.file,
com.jme3.scene.plugins.blender.lights,
com.jme3.scene.plugins.blender.materials,
com.jme3.scene.plugins.blender.meshes,
com.jme3.scene.plugins.blender.modifiers,
com.jme3.scene.plugins.blender.objects,
com.jme3.scene.plugins.blender.particles,
com.jme3.scene.plugins.blender.textures,
com.jme3.scene.plugins.blender.textures.blending,
com.jme3.scene.plugins.blender.textures.generating,
com.jme3.scene.plugins.blender.textures.io,
com.jme3.scene.plugins.ogre,
com.jme3.scene.plugins.ogre.matext,
com.jme3.scene.shape, com.jme3.scene.shape,
com.jme3.shader,
com.jme3.shader.plugins,
com.jme3.shadow,
com.jme3.system, com.jme3.system,
com.jme3.system.awt, com.jme3.system.awt,
com.jme3.system.lwjgl,
com.jme3.terrain,
com.jme3.terrain.geomipmap,
com.jme3.terrain.geomipmap.grid,
com.jme3.terrain.geomipmap.lodcalc,
com.jme3.terrain.geomipmap.lodcalc.util,
com.jme3.terrain.geomipmap.picking,
com.jme3.terrain.heightmap,
com.jme3.terrain.noise,
com.jme3.terrain.noise.basis,
com.jme3.terrain.noise.filter,
com.jme3.terrain.noise.fractal,
com.jme3.terrain.noise.modulator,
com.jme3.texture, com.jme3.texture,
com.jme3.texture.image,
com.jme3.texture.plugins,
com.jme3.ui,
com.jme3.util, com.jme3.util,
com.jme3.util.blockparser, org.eclipse.core.runtime;version="3.5.0",
com.jme3.util.xml,
com.jme3.water,
org.eclipse.core.resources,
org.eclipse.core.runtime;version="3.4.0",
org.eclipse.core.runtime.jobs,
org.eclipse.ice.datastructures.ICEObject, org.eclipse.ice.datastructures.ICEObject,
org.eclipse.ice.datastructures.form.geometry, org.eclipse.ice.datastructures.form.geometry,
org.eclipse.ice.reactor.plant, org.eclipse.ice.reactor.plant,
org.eclipse.ice.viz.service.geometry, org.eclipse.ice.viz.service.jme3.application,
org.eclipse.ice.viz.service.jme3.internal,
org.eclipse.ice.viz.service.jme3.widgets,
org.eclipse.ice.viz.service.geometry.shapes,
org.eclipse.jface.databinding.swt, org.eclipse.jface.databinding.swt,
org.eclipse.ui.views.properties.tabbed,
org.osgi.framework, org.osgi.framework,
org.slf4j;version="1.7.2" org.slf4j;version="1.7.2"
Require-Bundle: org.eclipse.ice.client.compatibility;bundle-version="2.0.0", Require-Bundle: org.eclipse.ice.client.compatibility;bundle-version="2.0.0",
org.eclipse.ice.datastructures;bundle-version="2.0.0" org.eclipse.ice.datastructures;bundle-version="2.0.0",
org.eclipse.ice.viz.service;bundle-version="2.0.0"
Bundle-ClassPath: . Bundle-ClassPath: .
Service-Component: OSGI-INF/MasterApplicationFactory.xml, Service-Component: OSGI-INF/MasterApplicationFactory.xml,
OSGI-INF/MasterApplicationHolder.xml OSGI-INF/MasterApplicationHolder.xml
......
...@@ -3,9 +3,5 @@ bin.includes = META-INF/,\ ...@@ -3,9 +3,5 @@ bin.includes = META-INF/,\
.,\ .,\
pom.xml,\ pom.xml,\
build.properties,\ build.properties,\
icons/,\ icons/
OSGI-INF/
src.includes = META-INF/,\
src/,\
build.properties
source.. = src/ source.. = src/
/*******************************************************************************
* Copyright (c) 2012, 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.client.widgets.geometry;
import java.awt.Canvas;
import java.awt.EventQueue;
import java.awt.Frame;
import org.eclipse.ice.datastructures.form.GeometryComponent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.widgets.Composite;
import com.jme3.app.SimpleApplication;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeCanvasContext;
/**
* <p>
* This is a factory class to create Composites that contain the Geometry
* widgets. It is meant to be implemented by whichever version of the Geometry
* widgets is loaded, whether RAP or RCP, but called only once from the
* ICEGeometryPage.
* </p>
*
* @author Jay Jay Billings, Taylor Patterson, Jordan H. Deyton
*/
public class GeometryCompositeFactory {
/**
* <p>
* The actual JME3 application running the geometry under the hood.
* </p>
*
*
*/
private SimpleApplication simpleApplication;
/**
* <p>
* This operation renders the GeometryComponent.
* </p>
*
* @param parent
* <p>
* The parent composite to which the Geometry composite belongs.
* </p>
* @param geometryComp
* <p>
* The GeometryComponent that should be rendered.
* </p>
*/
public void renderGeometryComposite(Composite parent,
GeometryComponent geometryComp) {
// Set JME3 application settings
AppSettings settings = new AppSettings(true);
settings.setFrameRate(60);
settings.setRenderer(AppSettings.LWJGL_OPENGL_ANY);
simpleApplication = new GeometryApplication();
final GeometryApplication geometryApplication = (GeometryApplication) simpleApplication;
geometryApplication.setSettings(settings);
geometryApplication.setPauseOnLostFocus(false);
// Place JME3 canvas on the parent composite
// Create the embedded frame
Composite embeddedFrame = new Composite(parent, SWT.EMBEDDED);
geometryApplication.createCanvas();
JmeCanvasContext canvasContext = (JmeCanvasContext) geometryApplication
.getContext();
canvasContext.setSystemListener(geometryApplication);
// Create the SWT frame
Frame window = SWT_AWT.new_Frame(embeddedFrame);
Canvas canvas = canvasContext.getCanvas();
window.add(canvas);
window.pack();
window.setVisible(true);
// Load the Geometry if available
if (geometryComp != null) {
geometryApplication.loadGeometry(geometryComp);
}
// Start the canvas
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
geometryApplication.startCanvas();
}
});
return;
}
/**
* This operation retrieves the SimpleApplication created by this factory.
*
* @return The SimpleApplication created by this factory
*/
public SimpleApplication getApplication() {
return simpleApplication;
}
}
\ No newline at end of file
...@@ -19,6 +19,8 @@ import java.util.concurrent.atomic.AtomicBoolean; ...@@ -19,6 +19,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.ice.datastructures.ICEObject.ICEObject; import org.eclipse.ice.datastructures.ICEObject.ICEObject;
import org.eclipse.ice.datastructures.ICEObject.IUpdateable; import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
import org.eclipse.ice.datastructures.ICEObject.IUpdateableListener; import org.eclipse.ice.datastructures.ICEObject.IUpdateableListener;
import org.eclipse.ice.viz.service.jme3.application.IRenderQueue;
import org.eclipse.ice.viz.service.jme3.widgets.AbstractView;
import com.jme3.scene.Node; import com.jme3.scene.Node;
......
...@@ -12,11 +12,12 @@ ...@@ -12,11 +12,12 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.ice.client.widgets.jme; package org.eclipse.ice.client.widgets.jme;
import org.eclipse.ice.client.widgets.jme.internal.MasterApplicationHolder;
import org.eclipse.ice.client.widgets.mesh.MeshAppState;
import org.eclipse.ice.client.widgets.reactoreditor.plant.PlantAppState; import org.eclipse.ice.client.widgets.reactoreditor.plant.PlantAppState;
import org.eclipse.ice.datastructures.form.mesh.MeshComponent; import org.eclipse.ice.datastructures.form.MeshComponent;
import org.eclipse.ice.reactor.plant.PlantComposite; import org.eclipse.ice.reactor.plant.PlantComposite;
import org.eclipse.ice.viz.service.jme3.application.MasterApplication;
import org.eclipse.ice.viz.service.jme3.application.ViewAppState;
import org.eclipse.ice.viz.service.jme3.internal.MasterApplicationHolder;
/** /**
* This factory is used to create custom {@link ViewAppState}s for components * This factory is used to create custom {@link ViewAppState}s for components
...@@ -79,35 +80,35 @@ public class ViewFactory { ...@@ -79,35 +80,35 @@ public class ViewFactory {
} }
/** /**
* Creates a {@link MeshAppState} for the specified // * Creates a {@link MeshAppState} for the specified
* <code>MeshComponent</code>. // * <code>MeshComponent</code>.
* // *
* @param mesh // * @param mesh
* The root <code>MeshComponent</code> or mesh that contains // * The root <code>MeshComponent</code> or mesh that contains
* edges, vertices, and other <code>MeshComponent</code>s. // * edges, vertices, and other <code>MeshComponent</code>s.
* @return A new <code>MeshAppState</code>, or null if there is no core // * @return A new <code>MeshAppState</code>, or null if there is no core
* <code>MasterApplication</code> in the background. // * <code>MasterApplication</code> in the background.
*/ // */
public MeshAppState createMeshView(MeshComponent mesh) { // public MeshAppState createMeshView(MeshComponent mesh) {
//
MeshAppState view = null; // MeshAppState view = null;
//
if (app != null) { // if (app != null) {
//
// If necessary, wait until the MasterApplication has started before // // If necessary, wait until the MasterApplication has started before
// trying to add a new AppState, or nothing may initialize. // // trying to add a new AppState, or nothing may initialize.
if (!app.isInitialized()) { // if (!app.isInitialized()) {
app.blockUntilInitialized(0); // app.blockUntilInitialized(0);
} // }
//
view = new MeshAppState(); // view = new MeshAppState();
view.start(app); // view.start(app);
//
view.setMesh(mesh); // view.setMesh(mesh);
} // }
//
return view; // return view;
} // }
/** /**
* Creates a {@link PlantAppState} for the specified * Creates a {@link PlantAppState} for the specified
......
/*******************************************************************************
* Copyright (c) 2014 UT-Battelle, LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Initial API and implementation and/or initial documentation - Jay Jay Billings,
* Jordan H. Deyton, Dasha Gorin, Alexander J. McCaskey, Taylor Patterson,
* Claire Saunders, Matthew Wang, Anna Wojtowicz
*******************************************************************************/
package org.eclipse.ice.client.widgets.mesh;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jme3.app.FlyCamAppState;
import com.jme3.app.SimpleApplication;
import com.jme3.app.StatsAppState;
import com.jme3.app.state.AppState;
import com.jme3.collision.Collidable;
import com.jme3.collision.CollisionResult;
import com.jme3.collision.CollisionResults;
import com.jme3.material.Material;
import com.jme3.material.RenderState.BlendMode;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Ray;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Line;
import com.jme3.system.awt.AwtPanel;
/**
* This class provides a basic version of a jME3 SimpleApplication that should
* be extended to provide 3D views inside an ICE editor or view. It is
* configured to use the AwtPanelsContext to render the 3D view.
*
* @author Jordan H. Deyton
*
*/
public abstract class AbstractApplication extends SimpleApplication {
/**
* Logger for handling event messages and other information.
*/
private static final Logger logger = LoggerFactory
.getLogger(AbstractApplication.class);
// ---- Application Initialization ---- //
/**
* A thread-safe boolean signifying that the SimpleApplication's
* simpleInitApp() has completely finished. This can help avoid issues where
* associated data is set before the application is constructed.
*/
private final AtomicBoolean initialized;
/**
* The jME3 AwtPanel used to render the jME3 application. We use this to
* prevent the jME3 application from consuming all mouse and key events,
* even when it should not have focus (a problem first discovered in
* Windows).
*/
private AwtPanel renderPanel;
// ------------------------------------ //
// ---- Materials ---- //
/**
* A HashMap of materials that should be shared in the application.
*/
protected final Map<String, Material> materials;
// ------------------- //
// ---- Heads Up Display (HUD) ---- //
/**
* A flag to indicate whether or not the HUD should be displayed.
*/
private final AtomicBoolean displayHUD;
/**
* This Node is attached to the application's guiNode. By default, it can be
* toggled by {@link #setDisplayHUD(boolean)}. Objects displayed on the HUD
* should be attached to this node.
*/
protected final Node HUD;
// -------------------------------- //
// ---- Camera ---- //
// ---------------- //
// ---- Scene ---- //
/**
* A flag to indicate whether or not to show lines representing the x, y,
* and z axes at the origin (of jME3 space).
*/
private final AtomicBoolean displayAxes;
/**
* This Node is attached to the scene. By default, it can be toggled by
* {@link #setDisplayAxes(boolean)}. The default colors of the axes are as
* follows:<br>
* <br>
* x - red<br>
* y - green<br>
* z - blue
*/
protected final Node axes;
// --------------- //
/**
* The default constructor. Initializes the application with a FlyCam. It
* also allows statistics to be opened with the F5 key.
*/
public AbstractApplication() {
this(new StatsAppState(), new FlyCamAppState());
}
/**
* Initializes the application with the specified AppStates.
*
* @param initialStates
* The initial AppStates. Custom AppStates should extend
* AbstractAppState.
*/
public AbstractApplication(AppState... initialStates) {
super(initialStates);
// Initialize all class variables here.
// ---- Application Initialization ---- //
initialized = new AtomicBoolean(false);
// ------------------------------------ //
// ---- Materials ---- //
materials = new HashMap<String, Material>();
// ------------------- //
// ---- Heads Up Display (HUD) ---- //
displayHUD = new AtomicBoolean(true);
HUD = new Node("HUD");
// -------------------------------- //
// ---- Camera ---- //
// ---------------- //
// ---- Scene ---- //
displayAxes = new AtomicBoolean(true);
axes = new Node("Axes");
// --------------- //
return;
}
// ---- Application Initialization ---- //
/**
* Whether or not the AbstractApplication is initialized. This can prevent
* unnecessary updates from occurring before the jME3 components have been
* declared and initialized.
*
* @return True if the AbstractApplication has been initialized, false
* otherwise.
*/
public final boolean isInitialized() {
return initialized.get();
}
/**
* Sets the AwtPanel used to render the scene in the AWT Frame embedded in
* SWT through the SWT_AWT bridge.
*
* @param panel
* The AwtPanel that is used in lieu of an AWT Canvas.
*/
public final void setAwtPanel(AwtPanel panel) {
if (panel != null) {
renderPanel = panel;
}
return;
}
/**
* <p>
* Overrides the method from the jME3 SimpleApplication to initialize the
* scene, camera, etc. This is called automatically at the start of the jME3
* application. <b>It is recommended that this method <i>not</i> be
* overridden.</b>
* </p>
*
*/
@Override
public void simpleInitApp() {
// Set up the materials used in the application. We should try to re-use
// materials as often as we can.
initMaterials();
// Set up the HUD.
// If necessary, we should initially attach the HUD to the GUI.
if (getDisplayHUD()) {
guiNode.attachChild(HUD);
}
initHUD();
// Set up the initial scene.
// If necessary, we should initially attach the axes to the scene.
initAxes();
if (getDisplayAxes()) {
rootNode.attachChild(axes);
}
initScene();
// Set up the camera.
initCamera();
// Set up the user's controls.
initControls();
// To render the scene in the AwtPanel, we have to attach the scene
// (viewPort) and the gui/HUD (guiViewPort) to the panel. The first
// argument is a boolean for overrideMainFramebuffer.
if (renderPanel != null) {
renderPanel.attachTo(true, viewPort);
renderPanel.attachTo(true, guiViewPort);
}
// At this point, the jME3 side should be completely initialized.
initialized.set(true);
return;
}
/**
* Initializes the materials used by the application. These should be stored
* in {@link #materials}. The default behavior provides the materials used
* for the axes.
*/
protected void initMaterials() {
materials.put("XAxis", createBasicMaterial(ColorRGBA.Red));
materials.put("YAxis", createBasicMaterial(ColorRGBA.Green));
materials.put("ZAxis", createBasicMaterial(ColorRGBA.Blue));
}
/**
* <p>
* Initializes the HUD by updating the guiNode.
* </p>
*
*/
protected abstract void initHUD();
/**
* <p>
* Initializes the different components of the scene, including the grid,
* the player, physics, etc.
* </p>
*
*/
protected abstract void initScene();
/**
* <p>
* Initializes a chase camera that follows the player. The camera should be
* locked to a top-down view.
* </p>
*
*/
protected abstract void initCamera();
/**
* <p>
* Initializes listeners and maps triggers to them for key presses, mouse
* clicks, and mouse movement.
* </p>
*
*/
protected abstract void initControls();
// ------------------------------------ //
// ---- Application Update/Synchronization ---- //
/**
* Does nothing by default.
*/
@Override
public void simpleUpdate(float tpf) {
return;
}
// -------------------------------------------- //
// ---- Materials ---- //
/**
* Gets the Material stored in the PlantApplication for reuse.
*
* @param key
* The key associated with the material.
* @return The material associated with the key, or null if none exists.
*/
public Material getMaterial(String key) {
return materials.get(key);
}
/**
* Adds a Material to the PlantApplication for later reuse. Null keys and
* values are not accepted.
*
* @param key
* The key to use for the Material. If this is the same as a
* previous key, the value will be overwritten.
* @param material
* The Material to store for later reuse.
*/
public void addMaterial(String key, Material material) {
if (key != null && material != null) {
materials.put(key, material);
}
}
/**
* Removes a Material from the PlantApplication.
*
* @param key
* The key of the Material to remove.
* @return The Material that was previously stored in the PlantApplication.
*/
public Material removeMaterial(String key) {
return materials.remove(key);
}
// ------------------- //
// ---- Heads Up Display (HUD) ---- //
/**
* This operation returns the value of the boolean flag for whether or not
* the heads-up display should be displayed.
*
* @return The boolean indicating whether or not the HUD should be
* displayed.
*/
public boolean getDisplayHUD() {
return displayHUD.get();
}
/**
* This operation sets the boolean to display or hide the heads-up display.
*
* @param enabled
* The boolean value to indicate whether or not the HUD should be
* displayed.
*/
public void setDisplayHUD(final boolean enabled) {
if (displayHUD.compareAndSet(!enabled, enabled)) {
enqueue(new Callable<Boolean>() {
@Override
public Boolean call() {
if (enabled) {
guiNode.attachChild(HUD);
} else {
guiNode.detachChild(HUD);
}
return true;
}
});
}
return;
}
// -------------------------------- //
// ---- Scene ---- //
/**
* A flag to indicate whether or not to show lines representing the x, y,
* and z axes at the origin (of jME3 space). The default colors of the axes
* are as follows:<br>
* <br>
* x - red<br>
* y - green<br>
* z - blue
*/
public boolean getDisplayAxes() {
return displayAxes.get();
}
/**
* Sets whether or not to show the axes representing the unit vectors for x,
* y, and z. The default colors of the axes are as follows:<br>
* <br>
* x - red<br>
* y - green<br>
* z - blue
*/
public void setDisplayAxes(final boolean enabled) {
if (displayAxes.compareAndSet(!enabled, enabled)) {
enqueue(new Callable<Boolean>() {
@Override
public Boolean call() {
if (enabled) {
rootNode.attachChild(axes);
} else {
rootNode.detachChild(axes);
}
return true;
}
});
}
return;
}
/**
* Creates the default axes, which are lines of different colors from the
* origin to the unit vectors. These are attached to the Node {@link #axes}.
*/
protected void initAxes() {
Geometry geometry;
Line line;
float lineWidth = 3f;
// Create the x axis as a red line of unit length.
line = new Line(Vector3f.ZERO, Vector3f.UNIT_X);
line.setLineWidth(lineWidth);
geometry = new Geometry("x", line);
geometry.setMaterial(materials.get("XAxis"));
axes.attachChild(geometry);
// Create the y axis as a green line of unit length.
line = new Line(Vector3f.ZERO, Vector3f.UNIT_Y);
line.setLineWidth(lineWidth);
geometry = new Geometry("y", line);
geometry.setMaterial(materials.get("YAxis"));
axes.attachChild(geometry);
// Create the z axis as a blue line of unit length.
line = new Line(Vector3f.ZERO, Vector3f.UNIT_Z);
line.setLineWidth(lineWidth);
geometry = new Geometry("z", line);
geometry.setMaterial(materials.get("ZAxis"));
axes.attachChild(geometry);
return;
}
// --------------- //
// ---- Utility methods ---- //
/**
* Generates a new, basic Material for use in the jME3 app.
*
* @param color
* The color of the material.
* @return A jME3 Material using Unshaded.j3md.
*/
public Material createBasicMaterial(ColorRGBA color) {
Material material = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
material.setColor("Color", color != null ? color : ColorRGBA.Red);
return material;
}
/**
* Generates a new, basic material for use in the jME3 app.
*
* @param color
* The color of the material.
* @return A jME3 Material using Lighting.j3md.
*/
public Material createLitMaterial(ColorRGBA color) {
Material material = new Material(assetManager,
"Common/MatDefs/Light/Lighting.j3md");
material.setBoolean("UseMaterialColors", true);
material.setColor("Diffuse", color);
material.setFloat("Shininess", 12f);
material.setColor("Specular", ColorRGBA.White);
material.setColor("Ambient", ColorRGBA.LightGray);
material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
return material;
}
/**
* Gets a {@link CollisionResults} between a {@link Collidable} and a
* {@link Ray}. Collidables like Spatials and Nodes can be tested for
* collisions with Rays (usually from {@link #getCrosshairRay()} and
* {@link #getCursorRay()}.
*
* @param collidable
* The object we are trying to hit.
* @param ray
* A ray that is being cast at the collidable.
* @return A CollisionResults for the collision between the collidable
* object and the ray.
*/
public CollisionResults getCollision(Collidable collidable, Ray ray) {
// Create a new results list.
CollisionResults results = new CollisionResults();
// See if the ray collides.
if (collidable != null && ray != null) {
collidable.collideWith(ray, results);
}
return results;
}
/**
* Gets a Ray from the crosshair's location to the grid. This uses the
* camera's position and direction.
*
* @return A Ray derived from the crosshair's location.
*/
public Ray getCrosshairRay() {
return new Ray(cam.getLocation(), cam.getDirection());
}
/**
* Gets a Ray from the camera to the cursor. The Ray can be used to
* determine where on the grid the cursor is pointed.
* <p>
* <b>Use this method when getting the cursor's location after a mouse-move
* event. For mouse-click events, use {@link #getCursorRayFromClick()}.</b>
* </p>
*
* @return A Ray derived from the cursor's location.
*/
public Ray getCursorRay() {
// Cursor-based picking (the ray from the camera to the.
Vector2f click2d = inputManager.getCursorPosition();
Vector3f click3d = cam.getWorldCoordinates(click2d, 0f);
Vector3f dir = cam.getWorldCoordinates(click2d, 1f)
.subtractLocal(click3d).normalizeLocal();
return new Ray(click3d, dir);
}
/**
* Gets a Ray from the camera to the cursor. The Ray can be used to
* determine where on the grid the cursor is pointed.
* <p>
* <b>During click events, jME3 calculates the 2D cursor position as
* Y-decreasing from top to bottom. Use this method when getting the
* cursor's location after a mouse-click event. For mouse-move events, use
* {@link #getCursorRay()}.</b>
* </p>
*
* @return A Ray derived from the cursor's location.
*/
public Ray getCursorRayFromClick() {
// TODO - When we update jME3, we can probably remove this, because
// there was a bug where mouse click y-coordinates were inconsistent
// with mouse movement y-coordinates. See
// http://hub.jmonkeyengine.org/forum/topic/issues-with-mouse-input-on-awtpanel/
// Cursor-based picking (the ray from the camera to the.
Vector2f click2d = inputManager.getCursorPosition();
// Alter the 2D vector so that the Y position increases from top to
// bottom.
click2d.y = renderPanel.getHeight() - click2d.y;
Vector3f click3d = cam.getWorldCoordinates(click2d, 0f);
Vector3f dir = cam.getWorldCoordinates(click2d, 1f)
.subtractLocal(click3d).normalizeLocal();
return new Ray(click3d, dir);
}
/**
* Prints out a CollisionResults Collection for debugging/diagnosis.
*
* @param results
* A CollisionResults Collection to print out.
*/
public void printCollisionResults(CollisionResults results) {
if (results != null) {
// Print the results of the collision.
logger.info("Hits: " + results.size());
if (results.size() > 0) {
// Print the results.
for (CollisionResult result : results) {
// For each hit, we know distance, impact point, name of
// geometry.
float dist = result.getDistance();
Vector3f pt = result.getContactPoint();
String hit = result.getGeometry().getName();
logger.info("Hit " + hit + " at distance " + dist
+ " at location " + pt.toString());
}
}
}
return;
}
// ------------------------- //
}
...@@ -16,8 +16,8 @@ import java.util.concurrent.Callable; ...@@ -16,8 +16,8 @@ import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.ice.client.widgets.jme.AbstractController; import org.eclipse.ice.client.widgets.jme.AbstractController;
import org.eclipse.ice.client.widgets.jme.IRenderQueue;
import org.eclipse.ice.datastructures.ICEObject.IUpdateable; import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
import org.eclipse.ice.viz.service.jme3.application.IRenderQueue;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.ice.client.widgets.reactoreditor.plant; package org.eclipse.ice.client.widgets.reactoreditor.plant;
import org.eclipse.ice.client.widgets.jme.AbstractView; import org.eclipse.ice.viz.service.jme3.widgets.AbstractView;
import com.jme3.material.Material; import com.jme3.material.Material;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
......
...@@ -14,10 +14,10 @@ package org.eclipse.ice.client.widgets.reactoreditor.plant; ...@@ -14,10 +14,10 @@ package org.eclipse.ice.client.widgets.reactoreditor.plant;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import org.eclipse.ice.client.widgets.jme.IRenderQueue;
import org.eclipse.ice.datastructures.ICEObject.IUpdateable; import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
import org.eclipse.ice.reactor.plant.HeatExchanger; import org.eclipse.ice.reactor.plant.HeatExchanger;
import org.eclipse.ice.reactor.plant.Junction; import org.eclipse.ice.reactor.plant.Junction;
import org.eclipse.ice.viz.service.jme3.application.IRenderQueue;
import com.jme3.bounding.BoundingBox; import com.jme3.bounding.BoundingBox;
import com.jme3.math.Quaternion; import com.jme3.math.Quaternion;
......
...@@ -20,7 +20,6 @@ import java.util.TreeSet; ...@@ -20,7 +20,6 @@ import java.util.TreeSet;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.ice.client.widgets.jme.IRenderQueue;
import org.eclipse.ice.datastructures.ICEObject.IUpdateable; import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
import org.eclipse.ice.reactor.plant.HeatExchanger; import org.eclipse.ice.reactor.plant.HeatExchanger;
import org.eclipse.ice.reactor.plant.IJunction; import org.eclipse.ice.reactor.plant.IJunction;
...@@ -29,6 +28,7 @@ import org.eclipse.ice.reactor.plant.Junction; ...@@ -29,6 +28,7 @@ import org.eclipse.ice.reactor.plant.Junction;
import org.eclipse.ice.reactor.plant.Pipe; import org.eclipse.ice.reactor.plant.Pipe;
import org.eclipse.ice.reactor.plant.PlantComponent; import org.eclipse.ice.reactor.plant.PlantComponent;
import org.eclipse.ice.reactor.plant.Reactor; import org.eclipse.ice.reactor.plant.Reactor;
import org.eclipse.ice.viz.service.jme3.application.IRenderQueue;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
......
...@@ -16,10 +16,9 @@ import java.util.ArrayList; ...@@ -16,10 +16,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import org.eclipse.ice.client.widgets.geometry.Tube;
import org.eclipse.ice.client.widgets.jme.IRenderQueue;
import org.eclipse.ice.datastructures.ICEObject.IUpdateable; import org.eclipse.ice.datastructures.ICEObject.IUpdateable;
import org.eclipse.ice.reactor.plant.Pipe; import org.eclipse.ice.reactor.plant.Pipe;
import org.eclipse.ice.viz.service.jme3.application.IRenderQueue;
import com.jme3.bounding.BoundingBox; import com.jme3.bounding.BoundingBox;
import com.jme3.math.FastMath; import com.jme3.math.FastMath;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment