Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
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
9 changes: 6 additions & 3 deletions jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ protected FrameBuffer(FrameBuffer src) {
*
* @param format The format to use for the depth buffer.
* @throws IllegalArgumentException If <code>format</code> is not a depth format.
* @deprecated Use setDepthTarget
* @deprecated Use
* {@link #setDepthTarget(com.jme3.texture.FrameBuffer.FrameBufferBufferTarget)}
*/
@Deprecated
public void setDepthBuffer(Image.Format format) {
Expand Down Expand Up @@ -656,7 +657,8 @@ public void addColorTexture(TextureCubeMap tex, TextureCubeMap.Face face) {
* Set the depth texture to use for this framebuffer.
*
* @param tex The color texture to set.
* @deprecated Use setDepthTarget
* @deprecated Use
* {@link #setDepthTarget(com.jme3.texture.FrameBuffer.FrameBufferTextureTarget)}
*/
@Deprecated
public void setDepthTexture(Texture2D tex) {
Expand All @@ -677,7 +679,8 @@ public void setDepthTexture(Texture2D tex) {
*
* @param tex the TextureArray to apply
* @param layer (default=-1)
* @deprecated Use setDepthTarget
* @deprecated Use
* {@link #setDepthTarget(com.jme3.texture.FrameBuffer.FrameBufferTextureTarget)}
*/
@Deprecated
public void setDepthTexture(TextureArray tex, int layer) {
Expand Down
9 changes: 4 additions & 5 deletions jme3-desktop/src/main/java/com/jme3/input/AWTKeyInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@
*/
package com.jme3.input;

import com.jme3.input.event.KeyInputEvent;
import java.awt.Component;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import com.jme3.input.KeyInput;
import com.jme3.input.event.KeyInputEvent;
import com.jme3.system.AWTContext;


/**
* The implementation of the {@link KeyInput} dedicated to AWT {@link Component component}.
* <p>
Expand Down Expand Up @@ -166,11 +165,11 @@ public class AWTKeyInput extends AWTInput implements KeyInput, KeyListener{
KEY_CODE_TO_JME.put(KeyEvent.VK_META, KEY_RCONTROL);
}

private final LinkedList<KeyInputEvent> keyInputEvents;
private final Deque<KeyInputEvent> keyInputEvents;

public AWTKeyInput(AWTContext context) {
super(context);
keyInputEvents = new LinkedList<KeyInputEvent>();
keyInputEvents = new LinkedList<>();
}

@Override
Expand Down
17 changes: 8 additions & 9 deletions jme3-desktop/src/main/java/com/jme3/input/AWTMouseInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,21 @@
*/
package com.jme3.input;

import com.jme3.cursors.plugins.JmeCursor;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.input.event.MouseMotionEvent;
import java.awt.Component;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

import com.jme3.cursors.plugins.JmeCursor;
import com.jme3.input.MouseInput;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.input.event.MouseMotionEvent;
import com.jme3.system.AWTContext;

/**
* The implementation of the {@link MouseInput} dedicated to AWT {@link Component component}.
* <p>
Expand All @@ -70,18 +69,18 @@ public class AWTMouseInput extends AWTInput implements MouseInput, MouseListener
*/
private static final int WHEEL_SCALE = 10;

private final LinkedList<MouseMotionEvent> mouseMotionEvents;
private final Deque<MouseMotionEvent> mouseMotionEvents;

private final LinkedList<MouseButtonEvent> mouseButtonEvents;
private final Deque<MouseButtonEvent> mouseButtonEvents;

private int mouseX;
private int mouseY;
private int mouseWheel;

public AWTMouseInput(AWTContext context) {
super(context);
mouseMotionEvents = new LinkedList<MouseMotionEvent>();
mouseButtonEvents = new LinkedList<MouseButtonEvent>();
mouseMotionEvents = new LinkedList<>();
mouseButtonEvents = new LinkedList<>();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand All @@ -53,10 +54,10 @@ public class AwtKeyInput implements KeyInput, KeyListener {

private static final Logger logger = Logger.getLogger(AwtKeyInput.class.getName());

private final ArrayList<KeyInputEvent> eventQueue = new ArrayList<>();
private final List<KeyInputEvent> eventQueue = new ArrayList<>();
private RawInputListener listener;
private Component component;
private BitSet keyStateSet = new BitSet(0xFF);
private final BitSet keyStateSet = new BitSet(0xFF);

public AwtKeyInput(){
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public class AwtMouseInput implements MouseInput, MouseListener, MouseWheelListe

private Component component;

private final ArrayList<MouseButtonEvent> eventQueue = new ArrayList<>();
private final ArrayList<MouseButtonEvent> eventQueueCopy = new ArrayList<>();
private final java.util.List<MouseButtonEvent> eventQueue = new ArrayList<>();
private final java.util.List<MouseButtonEvent> eventQueueCopy = new ArrayList<>();

private int lastEventX;
private int lastEventY;
Expand Down
23 changes: 12 additions & 11 deletions jme3-desktop/src/main/java/com/jme3/system/awt/AwtPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import com.jme3.renderer.ViewPort;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.texture.FrameBuffer;
import com.jme3.texture.Image.Format;
import com.jme3.util.BufferUtils;
import com.jme3.util.Screenshots;
import java.awt.*;
Expand All @@ -57,6 +56,8 @@

public class AwtPanel extends Canvas implements SceneProcessor {

private static final Logger logger = Logger.getLogger(AwtPanel.class.getName());

private boolean attachAsMain = false;

private BufferedImage img;
Expand All @@ -66,19 +67,19 @@ public class AwtPanel extends Canvas implements SceneProcessor {
private IntBuffer intBuf;
private RenderManager rm;
private PaintMode paintMode;
private ArrayList<ViewPort> viewPorts = new ArrayList<>();
private final java.util.List<ViewPort> viewPorts = new ArrayList<>();

// Visibility/drawing vars
private BufferStrategy strategy;
private AffineTransformOp transformOp;
private AtomicBoolean hasNativePeer = new AtomicBoolean(false);
private AtomicBoolean showing = new AtomicBoolean(false);
private AtomicBoolean repaintRequest = new AtomicBoolean(false);
private final AtomicBoolean hasNativePeer = new AtomicBoolean(false);
private final AtomicBoolean showing = new AtomicBoolean(false);
private final AtomicBoolean repaintRequest = new AtomicBoolean(false);

// Reshape vars
private int newWidth = 1;
private int newHeight = 1;
private AtomicBoolean reshapeNeeded = new AtomicBoolean(false);
private final AtomicBoolean reshapeNeeded = new AtomicBoolean(false);
private final Object lock = new Object();

public AwtPanel(PaintMode paintMode) {
Expand Down Expand Up @@ -180,7 +181,7 @@ public void drawFrameInThread() {
BufferCapabilities.FlipContents.UNDEFINED)
);
} catch (AWTException ex) {
ex.printStackTrace();
logger.log(Level.WARNING, "Failed to create buffer strategy!", ex);
}
strategy = getBufferStrategy();
}
Expand All @@ -190,7 +191,7 @@ public void drawFrameInThread() {
do {
Graphics2D g2d = (Graphics2D) strategy.getDrawGraphics();
if (g2d == null) {
Logger.getLogger(AwtPanel.class.getName()).log(Level.WARNING, "OGL: DrawGraphics was null.");
logger.log(Level.WARNING, "OGL: DrawGraphics was null.");
return;
}

Expand All @@ -210,7 +211,7 @@ public boolean isActiveDrawing() {
}

public void attachTo(boolean overrideMainFramebuffer, ViewPort... vps) {
if (viewPorts.size() > 0) {
if (!viewPorts.isEmpty()) {
for (ViewPort vp : viewPorts) {
vp.setOutputFrameBuffer(null);
}
Expand Down Expand Up @@ -242,8 +243,8 @@ private void reshapeInThread(int width, int height) {
}

fb = new FrameBuffer(width, height, 1);
fb.setDepthBuffer(Format.Depth);
fb.setColorBuffer(Format.RGB8);
fb.setDepthTarget(FrameBuffer.FrameBufferTarget.newTarget(com.jme3.texture.Image.Format.Depth));
fb.addColorTarget(FrameBuffer.FrameBufferTarget.newTarget(com.jme3.texture.Image.Format.RGB8));
fb.setSrgb(srgb);

if (attachAsMain) {
Expand Down
Loading