本文整理汇总了Java中com.jme3.gde.core.scene.SceneApplication类的典型用法代码示例。如果您正苦于以下问题:Java SceneApplication类的具体用法?Java SceneApplication怎么用?Java SceneApplication使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SceneApplication类属于com.jme3.gde.core.scene包,在下文中一共展示了SceneApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sceneClosed
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public void sceneClosed(SceneRequest request) {
if (request == currentRequest) {
SceneApplication.getApplication().removeSceneListener(this);
final SceneRequest current = currentRequest;
currentRequest = null;
final VehicleEditorController controller = editorController;
setLoadedScene(null, false);
cameraController.disable();
cameraController = null;
SceneApplication.getApplication().enqueue(new Callable<Void>() {
public Void call() throws Exception {
controller.cleanupApplication();
current.getRootNode().getParent().removeLight(dirLight);
return null;
}
});
}
}
示例2: testVehicle
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public void testVehicle() {
if (jmeRootNode == null) {
return;
}
final Node node = jmeRootNode.getLookup().lookup(Node.class);
if (node != null) {
SceneApplication.getApplication().enqueue(new Callable() {
public Object call() throws Exception {
doTestVehicle(node);
return null;
}
});
}
}
示例3: actionPerformed
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
SceneApplication.getApplication().enqueue(new Callable<Void>() {
@Override
public Void call() throws Exception {
EnvironmentCamera envCam = SceneApplication.getApplication().getStateManager().getState(EnvironmentCamera.class);
SceneToolController toolController = SceneApplication.getApplication().getStateManager().getState(SceneToolController.class);
if (toolController != null) {
envCam.setPosition(toolController.getCursorLocation());
} else {
envCam.setPosition(new Vector3f(0, 0, 0));
}
LightProbe lightProbe = LightProbeFactory.makeProbe(envCam, node, new JmeLightProbeProgressHandler());
lightProbe.setName("LightProbe");
node.addLight(lightProbe);
((BoundingSphere) lightProbe.getBounds()).setRadius(10);
node.updateModelBound();
addLightUndo(node, lightProbe);
setModified();
return null;
}
});
}
示例4: actionPerformed
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public void actionPerformed(ActionEvent ev) {
ProjectAssetManager pm = context.getLookup().lookup(ProjectAssetManager.class);
if (pm == null) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "AssetManager not found!");
return;
}
Element assetElement = context.getLookup().lookup(Element.class);
com.jme3.scene.Node node = new com.jme3.scene.Node("PreviewRootNode");
Spatial model = null;
model = AssetPackLoader.loadAssetPackModel(pm, new AssetConfiguration(assetElement));
node.attachChild(model);
JmeNode jmeNode = NodeUtility.createNode(node);
SceneApplication app = SceneApplication.getApplication();
SceneRequest request = new SceneRequest(app, jmeNode, pm);
try {
request.setDataObject(DataObject.find(context.getLookup().lookup(Project.class).getProjectDirectory()));
} catch (DataObjectNotFoundException ex) {
Exceptions.printStackTrace(ex);
}
request.setWindowTitle("AssetPack - PreView Model");
app.openScene(request);
}
示例5: init
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
private void init() {
SceneApplication.getApplication().addSceneListener(this);
Sphere sphMesh = new Sphere(32, 32, 2.5f);
sphMesh.setTextureMode(Sphere.TextureMode.Projected);
sphMesh.updateGeometry(32, 32, 2.5f, false, false);
Logger log = Logger.getLogger(TangentBinormalGenerator.class.getName());
log.setLevel(Level.SEVERE);
TangentBinormalGenerator.generate(sphMesh);
sphere = new Geometry("previewSphere", sphMesh);
sphere.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_X));
Box boxMesh = new Box(1.75f, 1.75f, 1.75f);
TangentBinormalGenerator.generate(boxMesh);
box = new Geometry("previewBox", boxMesh);
box.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.DEG_TO_RAD * 30, Vector3f.UNIT_X).multLocal(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_Y)));
Quad quadMesh = new Quad(4.5f, 4.5f);
TangentBinormalGenerator.generate(quadMesh);
quad = new Geometry("previewQuad", quadMesh);
quad.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0));
currentGeom = sphere;
init = true;
}
示例6: addModel
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public void addModel(final SpatialAssetDataObject file, final Vector3f location) {
if (selectedSpat == null) {
return;
}
if (selectedSpat instanceof Node) {
final Node selected = (Node) selectedSpat;
ProjectAssetManager manager = file.getLookup().lookup(ProjectAssetManager.class);
if (manager != null) {
manager.clearCache();
}
setNeedsSave(true);
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
doAddModel(file, selected, location);
return null;
}
});
} else {
displayInfo("Please select a Node to attach to\nin the SceneExplorer.");
}
}
示例7: linkModel
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public void linkModel(final AssetManager manager, final String assetName, final Vector3f location) {
if (selectedSpat == null) {
return;
}
if (selectedSpat instanceof Node) {
final Node selected = (Node) ((selectedSpat instanceof AssetLinkNode) ? selectedSpat.getParent() : selectedSpat);
setNeedsSave(true);
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
doLinkModel(manager, assetName, selected, location);
return null;
}
});
} else {
displayInfo("Please select a Node to attach to\nin the SceneExplorer.");
}
}
示例8: jSpinner1StateChanged
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
private void jSpinner1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner1StateChanged
// This is called, when the spinner of the near plane has been changed.
float near = ((float)jSlider1.getValue() / 1000f);
float spin = (Float)jSpinner1.getValue();
// Prevent an endless loop of state changes and don't change the slider when the spinner
// has gone out of range, since this would lead to the slider's StateChanged overwriting the spinner again.
// but we want the spinner to be a free-form field
if (spin <= 2000f && spin >= 100f && !FastMath.approximateEquals((Float)(jSpinner1.getValue()), near)) {
jSlider1.setValue((int)((Float)(jSpinner1.getValue()) * 1000f));
}
final Camera cam = SceneApplication.getApplication().getCamera();
cam.setFrustumPerspective(45f, (float)cam.getWidth() / cam.getHeight(), spin, cam.getFrustumFar());
}
示例9: save
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public void save() throws IOException {
if (alphaLayersChanged) {
SceneApplication.getApplication().enqueue(new Callable() {
public Object call() throws Exception {
//currentFileObject.saveAsset();
//TerrainSaveCookie sc = currentFileObject.getCookie(TerrainSaveCookie.class);
//if (sc != null) {
//Node root = rootNode.getLookup().lookup(Node.class);
doSaveAlphaImages();
//content.remove(TerrainSaveCookie.this);
//}
return null;
}
});
alphaLayersChanged = false;
}
}
示例10: setNormalMap
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
/**
* Set the normal map at the specified layer.
* Blocks on the GL thread
*/
public void setNormalMap(final int layer, final String texturePath) {
if (texturePath != null) {
Texture tex = SceneApplication.getApplication().getAssetManager().loadTexture(texturePath);
setNormalMap(layer, tex);
} else {
setNormalMap(layer, (Texture)null);
}
/*try {
SceneApplication.getApplication().enqueue(new Callable() {
public Object call() throws Exception {
doSetNormalMap(layer, texturePath);
return null;
}
}).get();
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex);
}*/
}
示例11: setShininess
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
protected void setShininess(final float shininess) {
if (SceneApplication.getApplication().isOgl()) {
Terrain terrain = (Terrain) getTerrain(null);
if (terrain == null)
return;
terrain.getMaterial().setFloat("Shininess", shininess);
setNeedsSave(true);
} else {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
setShininess(shininess);
return null;
}
});
}
}
示例12: actionPerformed
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
SceneApplication.getApplication().enqueue(new Callable<Void>() {
public Void call() throws Exception {
ParticleEmitter emit = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 200);
emit.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
emit.setGravity(new Vector3f(0, 0, 0));
emit.setLowLife(5);
emit.setHighLife(10);
emit.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0));
emit.setImagesX(15);
Material mat = new Material(SceneApplication.getApplication().getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
emit.setMaterial(mat);
node.attachChild(emit);
addSpatialUndo(node, emit);
setModified();
return null;
}
});
}
示例13: getInplaceEditor
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public InplaceEditor getInplaceEditor() {
if (ed == null) {
ed = new ButtonInplaceEditor("Emit!");
ed.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SceneApplication.getApplication().enqueue(new Callable<Object>() {
public Object call() throws Exception {
pe.getEmitter().killAllParticles();
pe.getEmitter().emitAllParticles();
return null;
}
});
}
});
}
return ed;
}
示例14: AppStateExplorerTopComponent
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public AppStateExplorerTopComponent() {
initComponents();
setName(Bundle.CTL_AppStateExplorerTopComponent());
setToolTipText(Bundle.HINT_AppStateExplorerTopComponent());
ActionMap map = getActionMap();
map.put("delete", ExplorerUtils.actionDelete(explorerManager, true));
// map.put("moveup", new MoveUpAction());
// map.put("movedown", new MoveDownAction());
associateLookup(ExplorerUtils.createLookup(explorerManager, map));
//TODO: move to scene listener notify in scene?
SceneRequest request = SceneApplication.getApplication().getCurrentSceneRequest();
if (request != null) {
listener.sceneOpened(request);
}
SceneApplication.getApplication().addSceneListener(listener);
}
示例15: TexturePreview
import com.jme3.gde.core.scene.SceneApplication; //导入依赖的package包/类
public TexturePreview(ProjectAssetManager assetManager) {
this.assetManager = assetManager;
Quad quadMesh = new Quad(4.5f, 4.5f);
Quad quadMesh3D = new Quad(4.5f, 4.5f);
quadMesh3D.scaleTextureCoordinates(new Vector2f(4, 4));
quad = new Geometry("previewQuad", quadMesh);
quad.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0));
quad3D = new Geometry("previewQuad", quadMesh3D);
quad3D.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0));
material3D = new Material(assetManager, "com/jme3/gde/core/properties/preview/tex3DThumb.j3md");
material3D.setFloat("InvDepth", 1f / 16f);
material3D.setInt("Rows", 4);
material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
SceneApplication.getApplication().addSceneListener(this);
}