- Added a CameraRequest to the PreviewRequest to be able to request location, rotation and lookAt of the scene camera
- fixed some compilation warning

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7959 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent 2767600fe3
commit 8dba313b4a
  1. 2
      sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.java
  2. 31
      sdk/jme3-core/src/com/jme3/gde/core/scene/PreviewRequest.java
  3. 13
      sdk/jme3-core/src/com/jme3/gde/core/scene/ScenePreviewProcessor.java
  4. 2
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeParticleEmitter.java
  5. 4
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewSpatialPopup.java

@ -44,7 +44,6 @@ import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.text.Position.Bias;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
@ -266,7 +265,6 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
private void setSelectedTexture(Texture texture) {
if (texture != null) {
Logger.getLogger(TextureBrowser.class.getName()).finer("Looking for Texture: " + texture.getName());
System.out.println("texture : " + texture.getName());
String[] path = ("/" + texture.getName()).split("/");
TreePath parent = new TreePath((TreeNode) jTree1.getModel().getRoot());
jTree1.expandPath(TreeUtil.buildTreePath(jTree1, parent, path, 0, true));

@ -29,9 +29,11 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.gde.core.scene;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Spatial;
import java.awt.image.BufferedImage;
@ -40,13 +42,16 @@ import java.awt.image.BufferedImage;
* @author normenhansen
*/
public class PreviewRequest {
private Object requester;
private Spatial spatial;
private BufferedImage image;
private CameraRequest cameraRequest;
public PreviewRequest(Object requester, Spatial spatial) {
this.requester = requester;
this.spatial = spatial;
cameraRequest = new CameraRequest();
}
/**
@ -77,4 +82,28 @@ public class PreviewRequest {
this.image = image;
}
public CameraRequest getCameraRequest() {
return cameraRequest;
}
public class CameraRequest {
Vector3f location = null;
Quaternion rotation = null;
Vector3f lookAt = null;
Vector3f up = null;
public void setLocation(Vector3f location) {
this.location = location;
}
public void setLookAt(Vector3f lookAt, Vector3f up) {
this.lookAt = lookAt;
this.up = up;
}
public void setRotation(Quaternion rotation) {
this.rotation = rotation;
}
}
}

@ -67,6 +67,7 @@ public class ScenePreviewProcessor implements SceneProcessor {
private ConcurrentLinkedQueue<PreviewRequest> previewQueue = new ConcurrentLinkedQueue<PreviewRequest>();
private PreviewRequest currentPreviewRequest;
private RenderManager rm;
private PointLight light;
public void addRequest(PreviewRequest request) {
previewQueue.add(request);
@ -103,7 +104,7 @@ public class ScenePreviewProcessor implements SceneProcessor {
offView.setOutputFrameBuffer(offBuffer);
// setup framebuffer's scene
PointLight light = new PointLight();
light = new PointLight();
light.setPosition(offCamera.getLocation());
light.setColor(ColorRGBA.White);
previewNode.addLight(light);
@ -127,6 +128,16 @@ public class ScenePreviewProcessor implements SceneProcessor {
currentPreviewRequest = previewQueue.poll();
if (currentPreviewRequest != null) {
previewNode.attachChild(currentPreviewRequest.getSpatial());
if (currentPreviewRequest.getCameraRequest().location != null) {
offCamera.setLocation(currentPreviewRequest.getCameraRequest().location);
light.setPosition(currentPreviewRequest.getCameraRequest().location);
}
if (currentPreviewRequest.getCameraRequest().rotation != null) {
offCamera.setRotation(currentPreviewRequest.getCameraRequest().rotation);
}
if (currentPreviewRequest.getCameraRequest().lookAt != null) {
offCamera.lookAt(currentPreviewRequest.getCameraRequest().lookAt, currentPreviewRequest.getCameraRequest().up);
}
}
update(f);
}

@ -149,7 +149,7 @@ public class JmeParticleEmitter extends JmeGeometry {
}
private Property createButtonProperty() {
return new PropertySupport.ReadWrite("emit", Object.class, "Emit all particles", "Click here to emit all particles of this emitter ") {
return new PropertySupport.ReadWrite<Object>("emit", Object.class, "Emit all particles", "Click here to emit all particles of this emitter ") {
JmeParticleEmitterButtonProperty pe;

@ -116,10 +116,10 @@ public class NewSpatialPopup extends AbstractAction implements Presenter.Popup {
public Void call() throws Exception {
ParticleEmitter emit = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 200);
emit.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
emit.setGravity(0);
emit.setGravity(new Vector3f(0, 0, 0));
emit.setLowLife(5);
emit.setHighLife(10);
emit.setInitialVelocity(new Vector3f(0, 0, 0));
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);

Loading…
Cancel
Save