Przeglądaj źródła

convert tabs to spaces in 18 .java files

Stephen Gold 3 lat temu
rodzic
commit
07f785928a

+ 15 - 15
jme3-bullet/src/common/java/com/jme3/bullet/control/KinematicRagdollControl.java

@@ -879,21 +879,21 @@ public class KinematicRagdollControl extends AbstractPhysicsControl implements P
         animControl.setEnabled(mode == Mode.Kinematic);
 
         baseRigidBody.setKinematic(mode == Mode.Kinematic);
-		if (mode != Mode.IK) {
-			TempVars vars = TempVars.get();
-
-			for (PhysicsBoneLink link : boneLinks.values()) {
-				link.rigidBody.setKinematic(mode == Mode.Kinematic);
-				if (mode == Mode.Ragdoll) {
-					Quaternion tmpRot1 = vars.quat1;
-					Vector3f position = vars.vect1;
-					//making sure that the ragdoll is at the correct place.
-					matchPhysicObjectToBone(link, position, tmpRot1);
-				}
-
-			}
-			vars.release();
-		}
+        if (mode != Mode.IK) {
+            TempVars vars = TempVars.get();
+
+            for (PhysicsBoneLink link : boneLinks.values()) {
+                link.rigidBody.setKinematic(mode == Mode.Kinematic);
+                if (mode == Mode.Ragdoll) {
+                    Quaternion tmpRot1 = vars.quat1;
+                    Vector3f position = vars.vect1;
+                    //making sure that the ragdoll is at the correct place.
+                    matchPhysicObjectToBone(link, position, tmpRot1);
+                }
+
+            }
+            vars.release();
+        }
 
         if(mode != Mode.IK){
             for (Bone bone : skeleton.getRoots()) {

+ 11 - 11
jme3-desktop/src/main/java/com/jme3/app/state/AWTComponentAppState.java

@@ -61,16 +61,16 @@ public class AWTComponentAppState extends AbstractAppState {
   @Override
   public void stateAttached(final AppStateManager stateManager) {
     processor = new AWTFrameProcessor();
-	processor.setTransferMode(transferMode);
+    processor.setTransferMode(transferMode);
 
-	AWTTaskExecutor.getInstance().addToExecute(new Runnable() {
+    AWTTaskExecutor.getInstance().addToExecute(new Runnable() {
 
-	  @Override
-	  public void run() {
-	    processor.bind(component, stateManager.getApplication(), stateManager.getApplication().getViewPort());
-	  }
-	      
-	});
+      @Override
+      public void run() {
+        processor.bind(component, stateManager.getApplication(), stateManager.getApplication().getViewPort());
+      }
+      
+    });
   }
   
   @Override
@@ -80,7 +80,7 @@ public class AWTComponentAppState extends AbstractAppState {
   
   @Override
   public void update(float tpf) {
-	executor.execute();
+    executor.execute();
     super.update(tpf);
   }
   
@@ -121,7 +121,7 @@ public class AWTComponentAppState extends AbstractAppState {
    * @see #setTransferMode(com.jme3.system.AWTFrameProcessor.TransferMode)
    */
   public AWTFrameProcessor.TransferMode getTransferMode(){
-	  return transferMode;
+    return transferMode;
   }
   
   /**
@@ -130,6 +130,6 @@ public class AWTComponentAppState extends AbstractAppState {
    * @see #getTransferMode()
    */
   public void setTransferMode(AWTFrameProcessor.TransferMode mode) {
-	  this.transferMode = mode;
+    this.transferMode = mode;
   }
 }

+ 1 - 1
jme3-desktop/src/main/java/com/jme3/input/awt/AwtKeyInput.java

@@ -610,7 +610,7 @@ public class AwtKeyInput implements KeyInput, KeyListener {
             case KeyEvent.VK_ALT:
                 return KEY_LMENU; //Left vs. Right need to improve
             case KeyEvent.VK_META:
-            	return KEY_RCONTROL;
+                return KEY_RCONTROL;
             case KeyEvent.VK_PRINTSCREEN:
                 return KEY_PRTSCR;
 

+ 8 - 8
jme3-desktop/src/main/java/com/jme3/input/awt/AwtMouseInput.java

@@ -213,14 +213,14 @@ public class AwtMouseInput implements MouseInput, MouseListener, MouseWheelListe
         return transparentCursor;
     }
 
-//	public void setHardwareCursor(URL file, int xHotspot, int yHotspot) {
-//	    //Create the image from the provided url
-//	    java.awt.Image cursorImage = new ImageIcon( file ).getImage( );
-//	    //Create a custom cursor with this image
-//	    opaqueCursor = Toolkit.getDefaultToolkit().createCustomCursor( cursorImage , new Point( xHotspot , yHotspot ) , "custom cursor" );
-//	    //Use this cursor
-//	    setCursorVisible( isCursorVisible );
-//	}
+//    public void setHardwareCursor(URL file, int xHotspot, int yHotspot) {
+//        //Create the image from the provided url
+//        java.awt.Image cursorImage = new ImageIcon( file ).getImage( );
+//        //Create a custom cursor with this image
+//        opaqueCursor = Toolkit.getDefaultToolkit().createCustomCursor( cursorImage , new Point( xHotspot , yHotspot ) , "custom cursor" );
+//        //Use this cursor
+//        setCursorVisible( isCursorVisible );
+//    }
 
 
     @Override

+ 590 - 590
jme3-desktop/src/main/java/com/jme3/system/AWTFrameProcessor.java

@@ -62,595 +62,595 @@ import com.jme3.texture.Image;
  */
 public class AWTFrameProcessor implements SceneProcessor, PropertyChangeListener {
 
-	public enum TransferMode {
-		ALWAYS,
-		ON_CHANGES
-	}
-
-	private Application application = null;
-
-	/**
-	 * The width listener.
-	 */
-	protected PropertyChangeListener widthListener;
-
-	/**
-	 * The height listener.
-	 */
-	protected PropertyChangeListener heightListener;
-
-	/**
-	 * The ration listener.
-	 */
-	protected PropertyChangeListener rationListener;
-
-	/**
-	 * The flag to decide when we should resize.
-	 */
-	private final AtomicInteger reshapeNeeded;
-
-	/**
-	 * The render manager.
-	 */
-	private RenderManager renderManager;
-
-	/**
-	 * The source view port.
-	 */
-	private ViewPort viewPort;
-
-	/**
-	 * The frame transfer.
-	 */
-	private AWTComponentRenderer frameTransfer;
-
-	/**
-	 * The transfer mode.
-	 */
-	private TransferMode transferMode;
-
-	/**
-	 * The destination of jMe frames.
-	 */
-	protected volatile Component destination;
-
-	/**
-	 * The flag is true if this processor is main.
-	 */
-	private volatile boolean main;
-
-	private int askWidth;
-	private int askHeight;
-
-	private boolean askFixAspect;
-	private boolean enabled;
-
-	@Override
-	public void initialize(RenderManager rm, ViewPort vp) {
-		this.renderManager = rm;
-	}
-
-	@Override
-	public void reshape(ViewPort vp, int w, int h) {
-		// TODO Auto-generated method stub
-	}
-
-	@Override
-	public boolean isInitialized() {
-		return frameTransfer != null;
-	}
-
-	@Override
-	public void preFrame(float tpf) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public void postQueue(RenderQueue rq) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public void postFrame(FrameBuffer out) {
-		if (!isEnabled()) {
-			return;
-		}
-
-		final AWTComponentRenderer frameTransfer = getFrameTransfer();
-		if (frameTransfer != null) {
-			frameTransfer.copyFrameBufferToImage(getRenderManager());
-		}
-
-		// for the next frame
-		if (hasDestination() && reshapeNeeded.get() > 0 && reshapeNeeded.decrementAndGet() >= 0) {
-
-			if (frameTransfer != null) {
-				frameTransfer.dispose();
-			}
-
-			setFrameTransfer(reshapeInThread(askWidth, askHeight, askFixAspect));
-		}
-	}
-
-	@Override
-	public void cleanup() {
-		final AWTComponentRenderer frameTransfer = getFrameTransfer();
-
-		if (frameTransfer != null) {
-			frameTransfer.dispose();
-			setFrameTransfer(null);
-		}
-	}
-
-	@Override
-	public void setProfiler(AppProfiler profiler) {
+    public enum TransferMode {
+        ALWAYS,
+        ON_CHANGES
+    }
+
+    private Application application = null;
+
+    /**
+     * The width listener.
+     */
+    protected PropertyChangeListener widthListener;
+
+    /**
+     * The height listener.
+     */
+    protected PropertyChangeListener heightListener;
+
+    /**
+     * The ration listener.
+     */
+    protected PropertyChangeListener rationListener;
+
+    /**
+     * The flag to decide when we should resize.
+     */
+    private final AtomicInteger reshapeNeeded;
+
+    /**
+     * The render manager.
+     */
+    private RenderManager renderManager;
+
+    /**
+     * The source view port.
+     */
+    private ViewPort viewPort;
+
+    /**
+     * The frame transfer.
+     */
+    private AWTComponentRenderer frameTransfer;
+
+    /**
+     * The transfer mode.
+     */
+    private TransferMode transferMode;
+
+    /**
+     * The destination of jMe frames.
+     */
+    protected volatile Component destination;
+
+    /**
+     * The flag is true if this processor is main.
+     */
+    private volatile boolean main;
+
+    private int askWidth;
+    private int askHeight;
+
+    private boolean askFixAspect;
+    private boolean enabled;
+
+    @Override
+    public void initialize(RenderManager rm, ViewPort vp) {
+        this.renderManager = rm;
+    }
+
+    @Override
+    public void reshape(ViewPort vp, int w, int h) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public boolean isInitialized() {
+        return frameTransfer != null;
+    }
+
+    @Override
+    public void preFrame(float tpf) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void postQueue(RenderQueue rq) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void postFrame(FrameBuffer out) {
+        if (!isEnabled()) {
+            return;
+        }
+
+        final AWTComponentRenderer frameTransfer = getFrameTransfer();
+        if (frameTransfer != null) {
+            frameTransfer.copyFrameBufferToImage(getRenderManager());
+        }
+
+        // for the next frame
+        if (hasDestination() && reshapeNeeded.get() > 0 && reshapeNeeded.decrementAndGet() >= 0) {
+
+            if (frameTransfer != null) {
+                frameTransfer.dispose();
+            }
+
+            setFrameTransfer(reshapeInThread(askWidth, askHeight, askFixAspect));
+        }
+    }
+
+    @Override
+    public void cleanup() {
+        final AWTComponentRenderer frameTransfer = getFrameTransfer();
+
+        if (frameTransfer != null) {
+            frameTransfer.dispose();
+            setFrameTransfer(null);
+        }
+    }
+
+    @Override
+    public void setProfiler(AppProfiler profiler) {
             // not implemented
-	}
-
-	@Override
-	public void propertyChange(PropertyChangeEvent evt) {
-		System.out.println("Property changed: "+evt.getPropertyName()+" "+evt.getOldValue()+" -> "+evt.getNewValue());
-	}
-
-	public AWTFrameProcessor() {
-		transferMode = TransferMode.ALWAYS;
-		askWidth = 1;
-		askHeight = 1;
-		main = true;
-		reshapeNeeded = new AtomicInteger(2);    
-	}
-
-	/**
-	 * Notify about that the ratio was changed.
-	 *
-	 * @param newValue the new value of the ratio.
-	 */
-	protected void notifyChangedRatio(Boolean newValue) {
-		notifyComponentResized(destination.getWidth(), destination.getHeight(), newValue);
-	}
-
-	/**
-	 * Notify about that the height was changed.
-	 *
-	 * @param newValue the new value of the height.
-	 */
-	protected void notifyChangedHeight(Number newValue) {
-		notifyComponentResized(destination.getWidth(), newValue.intValue(), isPreserveRatio());
-	}
-
-	/**
-	 * Notify about that the width was changed.
-	 *
-	 * @param newValue the new value of the width.
-	 */
-	protected void notifyChangedWidth(Number newValue) {
-		notifyComponentResized(newValue.intValue(), destination.getHeight(), isPreserveRatio());
-	}
-
-	/**
-	 * Gets the application.
-	 *
-	 * @return the application.
-	 */
-	protected Application getApplication() {
-		return application;
-	}
-
-	/**
-	 * Sets the application.
-	 *
-	 * @param application the application.
-	 */
-	protected void setApplication(Application application) {
-		this.application = application;
-	}
-
-	/**
-	 * Gets the current destination.
-	 *
-	 * @return the current destination.
-	 */
-	protected Component getDestination() {
-		return destination;
-	}
-
-	/**
-	 * Sets the destination.
-	 *
-	 * @param destination the destination.
-	 */
-	protected void setDestination(Component destination) {
-		this.destination = destination;
-	}
-
-	/**
-	 * Checks of existing destination.
-	 * @return true if destination is exists.
-	 */
-	protected boolean hasDestination() {
-		return destination != null;
-	}
-
-	/**
-	 * Checks of existing application.
-	 * @return true if destination is exists.
-	 */
-	protected boolean hasApplication() {
-		return application != null;
-	}
-
-
-	/**
-	 * Gets the frame transfer.
-	 * @return the file transfer.
-	 */
-	protected AWTComponentRenderer getFrameTransfer() {
-		return frameTransfer;
-	}
-
-	/**
-	 * Sets the frame transfer.
-	 *
-	 * @param frameTransfer the file transfer.
-	 */
-	protected void setFrameTransfer(AWTComponentRenderer frameTransfer) {
-		this.frameTransfer = frameTransfer;
-	}
-
-	/**
-	 * Gets the view port.
-	 *
-	 * @return the view port.
-	 */
-	protected ViewPort getViewPort() {
-		return viewPort;
-	}
-
-	/**
-	 * Gets the render manager.
-	 *
-	 * @return the render manager.
-	 */
-	protected RenderManager getRenderManager() {
-		return renderManager;
-	}
-
-	public boolean isMain() {
-		return main;
-	}
-
-	public boolean isEnabled() {
-		return enabled;
-	}
-
-	public void setEnabled(final boolean enabled) {
-		this.enabled = enabled;
-	}
-
-	/**
-	 * Handle resizing.
-	 *
-	 * @param newWidth  the new width.
-	 * @param newHeight the new height.
-	 * @param fixAspect true if need to fix aspect.
-	 */
-	protected void notifyComponentResized(int newWidth, int newHeight, boolean fixAspect) {
-
-		newWidth = Math.max(newWidth, 1);
-		newHeight = Math.max(newHeight, 1);
-
-		if (askWidth == newWidth && askWidth == newHeight && askFixAspect == fixAspect) {
-			return;
-		}
-
-		askWidth = newWidth;
-		askHeight = newHeight;
-		askFixAspect = fixAspect;
-		reshapeNeeded.set(2);
-	}
-
-	public void reshape() {
-		reshapeNeeded.set(2);
-	}
-
-	/**
-	 * Is preserve ratio.
-	 *
-	 * @return is preserve ratio.
-	 */
-	protected boolean isPreserveRatio() {
-		return false;
-	}
-
-	/**
-	 * Gets destination width.
-	 *
-	 * @return the destination width.
-	 */
-	protected int getDestinationWidth() {
-		return getDestination().getWidth();
-	}
-
-	/**
-	 * Gets destination height.
-	 *
-	 * @return the destination height.
-	 */
-	protected int getDestinationHeight() {
-		return getDestination().getHeight();
-	}
-
-	/**
-	 * Bind this processor.
-	 *
-	 * @param destination the destination.
-	 * @param application the application.
-	 */
-	public void bind(Component destination, Application application) {
-		final RenderManager renderManager = application.getRenderManager();
-
-		if (renderManager == null) {
-			throw new RuntimeException("No render manager available from the application.");
-		}
-
-		List<ViewPort> postViews = renderManager.getPostViews();
-		if (postViews.isEmpty()) {
-			throw new RuntimeException("the list of a post view is empty.");
-		}
-
-		bind(destination, application, postViews.get(postViews.size() - 1), true);
-	}
-
-	/**
-	 * Bind this processor.
-	 *
-	 * @param destination the destination.
-	 * @param application the application.
-	 * @param viewPort    the view port.
-	 */
-	public void bind(Component destination, Application application, ViewPort viewPort) {
-		bind(destination, application, viewPort, true);
-	}
-
-	/**
-	 * Bind this processor.
-	 *
-	 * @param destination the destination.
-	 * @param application the application.
-	 * @param viewPort    the view port.
-	 * @param main        true if this processor is main.
-	 */
-	public void bind(final Component destination, final Application application, ViewPort viewPort, boolean main) {
-
-		if (hasApplication()) {
-			throw new RuntimeException("This process is already bonded.");
-		}
-
-		setApplication(application);
-		setEnabled(true);
-
-		this.main = main;
-		this.viewPort = viewPort;
-		this.viewPort.addProcessor(this);
-
-		if (EventQueue.isDispatchThread()) {
-			bindDestination(application, destination);
-		} else {
-			EventQueue.invokeLater(new Runnable() {
-
-				@Override
-				public void run() {
-					bindDestination(application, destination);
-				}});
-		}
-	}
-
-	/**
-	 * Unbind this processor from its current destination.
-	 */
-	public void unbind() {
-
-		if (viewPort != null) {
-			viewPort.removeProcessor(this);
-			viewPort = null;
-		}
-
-		if (EventQueue.isDispatchThread()) {
-			unbindDestination();
-		} else {
-			EventQueue.invokeLater(new Runnable() {
-
-				@Override
-				public void run() {
-					unbindDestination();
-				}});
-		}
-
-	}
-
-	/**
-	 * Bind this processor.
-	 *
-	 * @param application the application.
-	 * @param destination the destination.
-	 */
-	protected void bindDestination(Application application, Component destination) {
-
-		if (!EventQueue.isDispatchThread()) {
-			throw new RuntimeException("bind has to be done from the Event Dispatching thread.");
-		}
-
-		if (isMain()) {
-
-			if (application.getContext() != null) {
-				if (application.getContext() instanceof AWTContext) {
-					AWTContext context = (AWTContext) application.getContext();
-					AWTMouseInput mouseInput = context.getMouseInput();
-					mouseInput.bind(destination);
-					AWTKeyInput keyInput = context.getKeyInput();
-					keyInput.bind(destination);
-
-					setDestination(destination);
-					bindListeners();
-
-					notifyComponentResized(getDestinationWidth(), getDestinationHeight(), isPreserveRatio());
-
-				} else {
-					throw new IllegalArgumentException("Underlying application has to use AWTContext (actually using "+application.getContext().getClass().getSimpleName()+")");
-				}
-			} else {
-				throw new IllegalArgumentException("Underlying application has to use a valid AWTContext (context is null)");
-			}
-		}
-	}
-
-	/**
-	 * Unbind this processor from destination.
-	 */
-	protected void unbindDestination() {
-
-		if (!EventQueue.isDispatchThread()) {
-			throw new RuntimeException("unbind has to be done from the Event Dispatching thread.");
-		}
-
-		if (hasApplication() && isMain()) {
-			final AWTContext context = (AWTContext) getApplication().getContext();
-			final AWTMouseInput mouseInput = context.getMouseInput();
-			mouseInput.unbind();
-			final AWTKeyInput keyInput = context.getKeyInput();
-			keyInput.unbind();
-		}
-
-		setApplication(null);
-
-		if (hasDestination()) {
-			unbindListeners();
-			setDestination(null);
-		}
-	}
-
-
-	protected void bindListeners() {
-		Component destination = getDestination();
-		destination.addPropertyChangeListener(this);
-		destination.addPropertyChangeListener(this);
-	}
-
-
-	protected void unbindListeners() {
-		Component destination = getDestination();
-		destination.removePropertyChangeListener(this);
-		destination.removePropertyChangeListener(this);
-	}
-
-	/**
-	 * Reshape the current frame transfer for the new size.
-	 *
-	 * @param width     the width.
-	 * @param height    the height.
-	 * @param fixAspect true if need to fix aspect ration.
-	 * @return the new frame transfer.
-	 */
-	protected AWTComponentRenderer reshapeInThread(final int width, final int height, final boolean fixAspect) {
-
-		reshapeCurrentViewPort(width, height);
-
-		ViewPort viewPort = getViewPort();
-		RenderManager renderManager = getRenderManager();
-		FrameBuffer frameBuffer = viewPort.getOutputFrameBuffer();
-
-		AWTComponentRenderer frameTransfer = createFrameTransfer(frameBuffer, width, height);
-		frameTransfer.init(renderManager.getRenderer(), isMain());
-
-		if (isMain()) {
-			AWTContext context = (AWTContext) getApplication().getContext();
-			context.setHeight(height);
-			context.setWidth(width);
-		}
-
-		return frameTransfer;
-	}
-
-	/**
-	 * Create a new frame transfer.
-	 *
-	 * @param frameBuffer the frame buffer.
-	 * @param width       the width.
-	 * @param height      the height.
-	 * @return the new frame transfer.
-	 */
-	protected AWTComponentRenderer createFrameTransfer(FrameBuffer frameBuffer, int width, int height) {
-		return new AWTComponentRenderer(getDestination(), getTransferMode(), isMain() ? null : frameBuffer, width, height);
-	}
-
-	/**
-	 * Reshape the current view port.
-	 *
-	 * @param width  the width.
-	 * @param height the height.
-	 */
-	protected void reshapeCurrentViewPort(int width, int height) {
-
-		ViewPort viewPort = getViewPort();
-		Camera camera = viewPort.getCamera();
-		int cameraAngle = getCameraAngle();
-		float aspect = (float) camera.getWidth() / camera.getHeight();
-
-		if (isMain()) {
-			getRenderManager().notifyReshape(width, height);
-			camera.setFrustumPerspective(cameraAngle, aspect, 1f, 10000);
-			return;
-		}
-
-		camera.resize(width, height, true);
-		camera.setFrustumPerspective(cameraAngle, aspect, 1f, 10000);
-
-		final List<SceneProcessor> processors = viewPort.getProcessors();
-
-		boolean found = false;
-		Iterator<SceneProcessor> iter = processors.iterator();
-		while(!found && iter.hasNext()) {
-			if (!(iter.next() instanceof AWTFrameProcessor)) {
-				found = true;
-			}
-		}
-
-		if (found) {
-
-			FrameBuffer frameBuffer = new FrameBuffer(width, height, 1);
-			frameBuffer.setDepthBuffer(Image.Format.Depth);
-			frameBuffer.setColorBuffer(Image.Format.RGBA8);
-			frameBuffer.setSrgb(true);
-
-			viewPort.setOutputFrameBuffer(frameBuffer);
-		}
-
-		for (final SceneProcessor sceneProcessor : processors) {
-			if (!sceneProcessor.isInitialized()) {
-				sceneProcessor.initialize(renderManager, viewPort);
-			} else {
-				sceneProcessor.reshape(viewPort, width, height);
-			}
-		}
-	}
-
-	/**
-	 * Gets camera angle.
-	 *
-	 * @return the camera angle.
-	 */
-	protected int getCameraAngle() {
-		final String angle = System.getProperty("awt.frame.transfer.camera.angle", "45");
-		return Integer.parseInt(angle);
-	}
-
-	public TransferMode getTransferMode() {
-		return transferMode;
-	}
-
-	public void setTransferMode(TransferMode transferMode) {
-		this.transferMode = transferMode;
-	}
+    }
+
+    @Override
+    public void propertyChange(PropertyChangeEvent evt) {
+        System.out.println("Property changed: "+evt.getPropertyName()+" "+evt.getOldValue()+" -> "+evt.getNewValue());
+    }
+
+    public AWTFrameProcessor() {
+        transferMode = TransferMode.ALWAYS;
+        askWidth = 1;
+        askHeight = 1;
+        main = true;
+        reshapeNeeded = new AtomicInteger(2);    
+    }
+
+    /**
+     * Notify about that the ratio was changed.
+     *
+     * @param newValue the new value of the ratio.
+     */
+    protected void notifyChangedRatio(Boolean newValue) {
+        notifyComponentResized(destination.getWidth(), destination.getHeight(), newValue);
+    }
+
+    /**
+     * Notify about that the height was changed.
+     *
+     * @param newValue the new value of the height.
+     */
+    protected void notifyChangedHeight(Number newValue) {
+        notifyComponentResized(destination.getWidth(), newValue.intValue(), isPreserveRatio());
+    }
+
+    /**
+     * Notify about that the width was changed.
+     *
+     * @param newValue the new value of the width.
+     */
+    protected void notifyChangedWidth(Number newValue) {
+        notifyComponentResized(newValue.intValue(), destination.getHeight(), isPreserveRatio());
+    }
+
+    /**
+     * Gets the application.
+     *
+     * @return the application.
+     */
+    protected Application getApplication() {
+        return application;
+    }
+
+    /**
+     * Sets the application.
+     *
+     * @param application the application.
+     */
+    protected void setApplication(Application application) {
+        this.application = application;
+    }
+
+    /**
+     * Gets the current destination.
+     *
+     * @return the current destination.
+     */
+    protected Component getDestination() {
+        return destination;
+    }
+
+    /**
+     * Sets the destination.
+     *
+     * @param destination the destination.
+     */
+    protected void setDestination(Component destination) {
+        this.destination = destination;
+    }
+
+    /**
+     * Checks of existing destination.
+     * @return true if destination is exists.
+     */
+    protected boolean hasDestination() {
+        return destination != null;
+    }
+
+    /**
+     * Checks of existing application.
+     * @return true if destination is exists.
+     */
+    protected boolean hasApplication() {
+        return application != null;
+    }
+
+
+    /**
+     * Gets the frame transfer.
+     * @return the file transfer.
+     */
+    protected AWTComponentRenderer getFrameTransfer() {
+        return frameTransfer;
+    }
+
+    /**
+     * Sets the frame transfer.
+     *
+     * @param frameTransfer the file transfer.
+     */
+    protected void setFrameTransfer(AWTComponentRenderer frameTransfer) {
+        this.frameTransfer = frameTransfer;
+    }
+
+    /**
+     * Gets the view port.
+     *
+     * @return the view port.
+     */
+    protected ViewPort getViewPort() {
+        return viewPort;
+    }
+
+    /**
+     * Gets the render manager.
+     *
+     * @return the render manager.
+     */
+    protected RenderManager getRenderManager() {
+        return renderManager;
+    }
+
+    public boolean isMain() {
+        return main;
+    }
+
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(final boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    /**
+     * Handle resizing.
+     *
+     * @param newWidth  the new width.
+     * @param newHeight the new height.
+     * @param fixAspect true if need to fix aspect.
+     */
+    protected void notifyComponentResized(int newWidth, int newHeight, boolean fixAspect) {
+
+        newWidth = Math.max(newWidth, 1);
+        newHeight = Math.max(newHeight, 1);
+
+        if (askWidth == newWidth && askWidth == newHeight && askFixAspect == fixAspect) {
+            return;
+        }
+
+        askWidth = newWidth;
+        askHeight = newHeight;
+        askFixAspect = fixAspect;
+        reshapeNeeded.set(2);
+    }
+
+    public void reshape() {
+        reshapeNeeded.set(2);
+    }
+
+    /**
+     * Is preserve ratio.
+     *
+     * @return is preserve ratio.
+     */
+    protected boolean isPreserveRatio() {
+        return false;
+    }
+
+    /**
+     * Gets destination width.
+     *
+     * @return the destination width.
+     */
+    protected int getDestinationWidth() {
+        return getDestination().getWidth();
+    }
+
+    /**
+     * Gets destination height.
+     *
+     * @return the destination height.
+     */
+    protected int getDestinationHeight() {
+        return getDestination().getHeight();
+    }
+
+    /**
+     * Bind this processor.
+     *
+     * @param destination the destination.
+     * @param application the application.
+     */
+    public void bind(Component destination, Application application) {
+        final RenderManager renderManager = application.getRenderManager();
+
+        if (renderManager == null) {
+            throw new RuntimeException("No render manager available from the application.");
+        }
+
+        List<ViewPort> postViews = renderManager.getPostViews();
+        if (postViews.isEmpty()) {
+            throw new RuntimeException("the list of a post view is empty.");
+        }
+
+        bind(destination, application, postViews.get(postViews.size() - 1), true);
+    }
+
+    /**
+     * Bind this processor.
+     *
+     * @param destination the destination.
+     * @param application the application.
+     * @param viewPort    the view port.
+     */
+    public void bind(Component destination, Application application, ViewPort viewPort) {
+        bind(destination, application, viewPort, true);
+    }
+
+    /**
+     * Bind this processor.
+     *
+     * @param destination the destination.
+     * @param application the application.
+     * @param viewPort    the view port.
+     * @param main        true if this processor is main.
+     */
+    public void bind(final Component destination, final Application application, ViewPort viewPort, boolean main) {
+
+        if (hasApplication()) {
+            throw new RuntimeException("This process is already bonded.");
+        }
+
+        setApplication(application);
+        setEnabled(true);
+
+        this.main = main;
+        this.viewPort = viewPort;
+        this.viewPort.addProcessor(this);
+
+        if (EventQueue.isDispatchThread()) {
+            bindDestination(application, destination);
+        } else {
+            EventQueue.invokeLater(new Runnable() {
+
+                @Override
+                public void run() {
+                    bindDestination(application, destination);
+                }});
+        }
+    }
+
+    /**
+     * Unbind this processor from its current destination.
+     */
+    public void unbind() {
+
+        if (viewPort != null) {
+            viewPort.removeProcessor(this);
+            viewPort = null;
+        }
+
+        if (EventQueue.isDispatchThread()) {
+            unbindDestination();
+        } else {
+            EventQueue.invokeLater(new Runnable() {
+
+                @Override
+                public void run() {
+                    unbindDestination();
+                }});
+        }
+
+    }
+
+    /**
+     * Bind this processor.
+     *
+     * @param application the application.
+     * @param destination the destination.
+     */
+    protected void bindDestination(Application application, Component destination) {
+
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("bind has to be done from the Event Dispatching thread.");
+        }
+
+        if (isMain()) {
+
+            if (application.getContext() != null) {
+                if (application.getContext() instanceof AWTContext) {
+                    AWTContext context = (AWTContext) application.getContext();
+                    AWTMouseInput mouseInput = context.getMouseInput();
+                    mouseInput.bind(destination);
+                    AWTKeyInput keyInput = context.getKeyInput();
+                    keyInput.bind(destination);
+
+                    setDestination(destination);
+                    bindListeners();
+
+                    notifyComponentResized(getDestinationWidth(), getDestinationHeight(), isPreserveRatio());
+
+                } else {
+                    throw new IllegalArgumentException("Underlying application has to use AWTContext (actually using "+application.getContext().getClass().getSimpleName()+")");
+                }
+            } else {
+                throw new IllegalArgumentException("Underlying application has to use a valid AWTContext (context is null)");
+            }
+        }
+    }
+
+    /**
+     * Unbind this processor from destination.
+     */
+    protected void unbindDestination() {
+
+        if (!EventQueue.isDispatchThread()) {
+            throw new RuntimeException("unbind has to be done from the Event Dispatching thread.");
+        }
+
+        if (hasApplication() && isMain()) {
+            final AWTContext context = (AWTContext) getApplication().getContext();
+            final AWTMouseInput mouseInput = context.getMouseInput();
+            mouseInput.unbind();
+            final AWTKeyInput keyInput = context.getKeyInput();
+            keyInput.unbind();
+        }
+
+        setApplication(null);
+
+        if (hasDestination()) {
+            unbindListeners();
+            setDestination(null);
+        }
+    }
+
+
+    protected void bindListeners() {
+        Component destination = getDestination();
+        destination.addPropertyChangeListener(this);
+        destination.addPropertyChangeListener(this);
+    }
+
+
+    protected void unbindListeners() {
+        Component destination = getDestination();
+        destination.removePropertyChangeListener(this);
+        destination.removePropertyChangeListener(this);
+    }
+
+    /**
+     * Reshape the current frame transfer for the new size.
+     *
+     * @param width     the width.
+     * @param height    the height.
+     * @param fixAspect true if need to fix aspect ration.
+     * @return the new frame transfer.
+     */
+    protected AWTComponentRenderer reshapeInThread(final int width, final int height, final boolean fixAspect) {
+
+        reshapeCurrentViewPort(width, height);
+
+        ViewPort viewPort = getViewPort();
+        RenderManager renderManager = getRenderManager();
+        FrameBuffer frameBuffer = viewPort.getOutputFrameBuffer();
+
+        AWTComponentRenderer frameTransfer = createFrameTransfer(frameBuffer, width, height);
+        frameTransfer.init(renderManager.getRenderer(), isMain());
+
+        if (isMain()) {
+            AWTContext context = (AWTContext) getApplication().getContext();
+            context.setHeight(height);
+            context.setWidth(width);
+        }
+
+        return frameTransfer;
+    }
+
+    /**
+     * Create a new frame transfer.
+     *
+     * @param frameBuffer the frame buffer.
+     * @param width       the width.
+     * @param height      the height.
+     * @return the new frame transfer.
+     */
+    protected AWTComponentRenderer createFrameTransfer(FrameBuffer frameBuffer, int width, int height) {
+        return new AWTComponentRenderer(getDestination(), getTransferMode(), isMain() ? null : frameBuffer, width, height);
+    }
+
+    /**
+     * Reshape the current view port.
+     *
+     * @param width  the width.
+     * @param height the height.
+     */
+    protected void reshapeCurrentViewPort(int width, int height) {
+
+        ViewPort viewPort = getViewPort();
+        Camera camera = viewPort.getCamera();
+        int cameraAngle = getCameraAngle();
+        float aspect = (float) camera.getWidth() / camera.getHeight();
+
+        if (isMain()) {
+            getRenderManager().notifyReshape(width, height);
+            camera.setFrustumPerspective(cameraAngle, aspect, 1f, 10000);
+            return;
+        }
+
+        camera.resize(width, height, true);
+        camera.setFrustumPerspective(cameraAngle, aspect, 1f, 10000);
+
+        final List<SceneProcessor> processors = viewPort.getProcessors();
+
+        boolean found = false;
+        Iterator<SceneProcessor> iter = processors.iterator();
+        while(!found && iter.hasNext()) {
+            if (!(iter.next() instanceof AWTFrameProcessor)) {
+                found = true;
+            }
+        }
+
+        if (found) {
+
+            FrameBuffer frameBuffer = new FrameBuffer(width, height, 1);
+            frameBuffer.setDepthBuffer(Image.Format.Depth);
+            frameBuffer.setColorBuffer(Image.Format.RGBA8);
+            frameBuffer.setSrgb(true);
+
+            viewPort.setOutputFrameBuffer(frameBuffer);
+        }
+
+        for (final SceneProcessor sceneProcessor : processors) {
+            if (!sceneProcessor.isInitialized()) {
+                sceneProcessor.initialize(renderManager, viewPort);
+            } else {
+                sceneProcessor.reshape(viewPort, width, height);
+            }
+        }
+    }
+
+    /**
+     * Gets camera angle.
+     *
+     * @return the camera angle.
+     */
+    protected int getCameraAngle() {
+        final String angle = System.getProperty("awt.frame.transfer.camera.angle", "45");
+        return Integer.parseInt(angle);
+    }
+
+    public TransferMode getTransferMode() {
+        return transferMode;
+    }
+
+    public void setTransferMode(TransferMode transferMode) {
+        this.transferMode = transferMode;
+    }
 }

+ 233 - 233
jme3-ios/src/main/java/com/jme3/renderer/ios/JmeIosGLES.java

@@ -16,124 +16,124 @@ import java.util.logging.Logger;
 public class JmeIosGLES {
     private static final Logger logger = Logger.getLogger(JmeIosGLES.class.getName());
     
-	private static boolean ENABLE_ERROR_CHECKING = true;
+    private static boolean ENABLE_ERROR_CHECKING = true;
 
     public static final int GL_ALPHA = 0x00001906;
     public static final int GL_ALWAYS = 0x00000207;
-	public static final int GL_ARRAY_BUFFER = 0x00008892;
-	public static final int GL_BACK = 0x00000405;
-	public static final int GL_BLEND = 0x00000be2;
-	public static final int GL_BYTE = 0x00001400;
-	public static final int GL_CLAMP_TO_EDGE = 0x0000812f;
-	public static final int GL_COLOR_ATTACHMENT0 = 0x00008ce0;
-	public static final int GL_COLOR_BUFFER_BIT = 0x00004000;
-	public static final int GL_COMPILE_STATUS = 0x00008b81;
-	public static final int GL_COMPRESSED_TEXTURE_FORMATS = 0x000086a3;
-	public static final int GL_CULL_FACE = 0x00000b44;
-	public static final int GL_DEPTH_ATTACHMENT = 0x00008d00;
-	public static final int GL_DEPTH_BUFFER_BIT = 0x00000100;
+    public static final int GL_ARRAY_BUFFER = 0x00008892;
+    public static final int GL_BACK = 0x00000405;
+    public static final int GL_BLEND = 0x00000be2;
+    public static final int GL_BYTE = 0x00001400;
+    public static final int GL_CLAMP_TO_EDGE = 0x0000812f;
+    public static final int GL_COLOR_ATTACHMENT0 = 0x00008ce0;
+    public static final int GL_COLOR_BUFFER_BIT = 0x00004000;
+    public static final int GL_COMPILE_STATUS = 0x00008b81;
+    public static final int GL_COMPRESSED_TEXTURE_FORMATS = 0x000086a3;
+    public static final int GL_CULL_FACE = 0x00000b44;
+    public static final int GL_DEPTH_ATTACHMENT = 0x00008d00;
+    public static final int GL_DEPTH_BUFFER_BIT = 0x00000100;
     public static final int GL_DEPTH_COMPONENT = 0x00001902;
     public static final int GL_DEPTH_COMPONENT16 = 0x000081a5;
-	public static final int GL_DEPTH_TEST = 0x00000b71;
-	public static final int GL_DITHER = 0x00000bd0;
-	public static final int GL_DST_COLOR = 0x00000306;
-	public static final int GL_DYNAMIC_DRAW = 0x000088e8;
-	public static final int GL_EQUAL = 0x00000202;
-	public static final int GL_ELEMENT_ARRAY_BUFFER = 0x00008893;
-	public static final int GL_EXTENSIONS = 0x00001f03;
-	public static final int GL_FALSE = 0x00000000;
-	public static final int GL_FLOAT = 0x00001406;
-	public static final int GL_FRAGMENT_SHADER = 0x00008b30;
-	public static final int GL_FRAMEBUFFER = 0x00008d40;
-	public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x00008cd1;
-	public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x00008cd0;
-	public static final int GL_FRAMEBUFFER_COMPLETE = 0x00008cd5;
-	public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x00008cd6;
-	public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x00008cd9;
-	public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x00008cd7;
-	public static final int GL_FRAMEBUFFER_UNSUPPORTED = 0x00008cdd;
-	public static final int GL_FRONT = 0x00000404;
-	public static final int GL_FRONT_AND_BACK = 0x00000408;
-	public static final int GL_GEQUAL = 0x00000206;
-	public static final int GL_GREATER = 0x00000204;
-	public static final int GL_HIGH_FLOAT = 0x00008df2;
-	public static final int GL_INFO_LOG_LENGTH = 0x00008b84;
-	public static final int GL_INT = 0x00001404;
-	public static final int GL_LEQUAL = 0x00000203;
-	public static final int GL_LESS = 0x00000201;
-	public static final int GL_LINEAR = 0x00002601;
-	public static final int GL_LINEAR_MIPMAP_LINEAR = 0x00002703;
-	public static final int GL_LINEAR_MIPMAP_NEAREST = 0x00002701;
-	public static final int GL_LINES = 0x00000001;
-	public static final int GL_LINE_LOOP = 0x00000002;
-	public static final int GL_LINE_STRIP = 0x00000003;
-	public static final int GL_LINK_STATUS = 0x00008b82;
-	public static final int GL_LUMINANCE = 0x00001909;
-	public static final int GL_LUMINANCE_ALPHA = 0x0000190a;
-	public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x0000851c;
-	public static final int GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x00008dfd;
-	public static final int GL_MAX_RENDERBUFFER_SIZE = 0x000084e8;
-	public static final int GL_MAX_TEXTURE_IMAGE_UNITS = 0x00008872;
-	public static final int GL_MAX_TEXTURE_SIZE = 0x00000d33;
-	public static final int GL_MAX_VARYING_VECTORS = 0x00008dfc;
-	public static final int GL_MAX_VERTEX_ATTRIBS = 0x00008869;
-	public static final int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x00008b4c;
-	public static final int GL_MAX_VERTEX_UNIFORM_VECTORS = 0x00008dfb;
-	public static final int GL_MIRRORED_REPEAT = 0x00008370;
-	public static final int GL_NEAREST = 0x00002600;
-	public static final int GL_NEAREST_MIPMAP_LINEAR = 0x00002702;
-	public static final int GL_NEAREST_MIPMAP_NEAREST = 0x00002700;
-	public static final int GL_NEVER = 0x00000200;
-	public static final int GL_NONE = 0x00000000;
-	public static final int GL_NOTEQUAL = 0x00000205;
-	public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x000086a2;
-	public static final int GL_ONE = 0x00000001;
-	public static final int GL_ONE_MINUS_SRC_ALPHA = 0x00000303;
-	public static final int GL_ONE_MINUS_SRC_COLOR = 0x00000301;
-	public static final int GL_POINTS = 0x00000000;
-	public static final int GL_POLYGON_OFFSET_FILL = 0x00008037;
-	public static final int GL_RENDERBUFFER = 0x00008d41;
-	public static final int GL_RENDERER = 0x00001f01;
-	public static final int GL_REPEAT = 0x00002901;
+    public static final int GL_DEPTH_TEST = 0x00000b71;
+    public static final int GL_DITHER = 0x00000bd0;
+    public static final int GL_DST_COLOR = 0x00000306;
+    public static final int GL_DYNAMIC_DRAW = 0x000088e8;
+    public static final int GL_EQUAL = 0x00000202;
+    public static final int GL_ELEMENT_ARRAY_BUFFER = 0x00008893;
+    public static final int GL_EXTENSIONS = 0x00001f03;
+    public static final int GL_FALSE = 0x00000000;
+    public static final int GL_FLOAT = 0x00001406;
+    public static final int GL_FRAGMENT_SHADER = 0x00008b30;
+    public static final int GL_FRAMEBUFFER = 0x00008d40;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x00008cd1;
+    public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x00008cd0;
+    public static final int GL_FRAMEBUFFER_COMPLETE = 0x00008cd5;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x00008cd6;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x00008cd9;
+    public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x00008cd7;
+    public static final int GL_FRAMEBUFFER_UNSUPPORTED = 0x00008cdd;
+    public static final int GL_FRONT = 0x00000404;
+    public static final int GL_FRONT_AND_BACK = 0x00000408;
+    public static final int GL_GEQUAL = 0x00000206;
+    public static final int GL_GREATER = 0x00000204;
+    public static final int GL_HIGH_FLOAT = 0x00008df2;
+    public static final int GL_INFO_LOG_LENGTH = 0x00008b84;
+    public static final int GL_INT = 0x00001404;
+    public static final int GL_LEQUAL = 0x00000203;
+    public static final int GL_LESS = 0x00000201;
+    public static final int GL_LINEAR = 0x00002601;
+    public static final int GL_LINEAR_MIPMAP_LINEAR = 0x00002703;
+    public static final int GL_LINEAR_MIPMAP_NEAREST = 0x00002701;
+    public static final int GL_LINES = 0x00000001;
+    public static final int GL_LINE_LOOP = 0x00000002;
+    public static final int GL_LINE_STRIP = 0x00000003;
+    public static final int GL_LINK_STATUS = 0x00008b82;
+    public static final int GL_LUMINANCE = 0x00001909;
+    public static final int GL_LUMINANCE_ALPHA = 0x0000190a;
+    public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x0000851c;
+    public static final int GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x00008dfd;
+    public static final int GL_MAX_RENDERBUFFER_SIZE = 0x000084e8;
+    public static final int GL_MAX_TEXTURE_IMAGE_UNITS = 0x00008872;
+    public static final int GL_MAX_TEXTURE_SIZE = 0x00000d33;
+    public static final int GL_MAX_VARYING_VECTORS = 0x00008dfc;
+    public static final int GL_MAX_VERTEX_ATTRIBS = 0x00008869;
+    public static final int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x00008b4c;
+    public static final int GL_MAX_VERTEX_UNIFORM_VECTORS = 0x00008dfb;
+    public static final int GL_MIRRORED_REPEAT = 0x00008370;
+    public static final int GL_NEAREST = 0x00002600;
+    public static final int GL_NEAREST_MIPMAP_LINEAR = 0x00002702;
+    public static final int GL_NEAREST_MIPMAP_NEAREST = 0x00002700;
+    public static final int GL_NEVER = 0x00000200;
+    public static final int GL_NONE = 0x00000000;
+    public static final int GL_NOTEQUAL = 0x00000205;
+    public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x000086a2;
+    public static final int GL_ONE = 0x00000001;
+    public static final int GL_ONE_MINUS_SRC_ALPHA = 0x00000303;
+    public static final int GL_ONE_MINUS_SRC_COLOR = 0x00000301;
+    public static final int GL_POINTS = 0x00000000;
+    public static final int GL_POLYGON_OFFSET_FILL = 0x00008037;
+    public static final int GL_RENDERBUFFER = 0x00008d41;
+    public static final int GL_RENDERER = 0x00001f01;
+    public static final int GL_REPEAT = 0x00002901;
     public static final int GL_RGB = 0x00001907;
-	public static final int GL_RGB565 = 0x00008d62;
-	public static final int GL_RGB5_A1 = 0x00008057;
-	public static final int GL_RGBA = 0x00001908;
+    public static final int GL_RGB565 = 0x00008d62;
+    public static final int GL_RGB5_A1 = 0x00008057;
+    public static final int GL_RGBA = 0x00001908;
     public static final int GL_RGBA4 = 0x00008056;
-	public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x0000809e;
-	public static final int GL_SCISSOR_TEST = 0x00000c11;
-	public static final int GL_SHADING_LANGUAGE_VERSION = 0x00008b8c;
-	public static final int GL_SHORT = 0x00001402;
-	public static final int GL_SRC_COLOR = 0x00000300;
-	public static final int GL_SRC_ALPHA = 0x00000302;
-	public static final int GL_STATIC_DRAW = 0x000088e4;
-	public static final int GL_STENCIL_BUFFER_BIT = 0x00000400;
-	public static final int GL_STREAM_DRAW = 0x000088e0;
-	public static final int GL_SUBPIXEL_BITS = 0x00000d50;
-	public static final int GL_TEXTURE = 0x00001702;
-	public static final int GL_TEXTURE0 = 0x000084c0;
-	public static final int GL_TEXTURE_2D = 0x00000de1;
-	public static final int GL_TEXTURE_CUBE_MAP = 0x00008513;
-	public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x00008515;
-	public static final int GL_TEXTURE_MAG_FILTER = 0x00002800;
-	public static final int GL_TEXTURE_MIN_FILTER = 0x00002801;
-	public static final int GL_TEXTURE_WRAP_S = 0x00002802;
-	public static final int GL_TEXTURE_WRAP_T = 0x00002803;
-	public static final int GL_TRIANGLES = 0x00000004;
-	public static final int GL_TRIANGLE_FAN = 0x00000006;
-	public static final int GL_TRIANGLE_STRIP = 0x00000005;
-	public static final int GL_TRUE = 0x00000001;
-	public static final int GL_UNPACK_ALIGNMENT = 0x00000cf5;
-	public static final int GL_UNSIGNED_BYTE = 0x00001401;
-	public static final int GL_UNSIGNED_INT = 0x00001405;
-	public static final int GL_UNSIGNED_SHORT = 0x00001403;
+    public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x0000809e;
+    public static final int GL_SCISSOR_TEST = 0x00000c11;
+    public static final int GL_SHADING_LANGUAGE_VERSION = 0x00008b8c;
+    public static final int GL_SHORT = 0x00001402;
+    public static final int GL_SRC_COLOR = 0x00000300;
+    public static final int GL_SRC_ALPHA = 0x00000302;
+    public static final int GL_STATIC_DRAW = 0x000088e4;
+    public static final int GL_STENCIL_BUFFER_BIT = 0x00000400;
+    public static final int GL_STREAM_DRAW = 0x000088e0;
+    public static final int GL_SUBPIXEL_BITS = 0x00000d50;
+    public static final int GL_TEXTURE = 0x00001702;
+    public static final int GL_TEXTURE0 = 0x000084c0;
+    public static final int GL_TEXTURE_2D = 0x00000de1;
+    public static final int GL_TEXTURE_CUBE_MAP = 0x00008513;
+    public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x00008515;
+    public static final int GL_TEXTURE_MAG_FILTER = 0x00002800;
+    public static final int GL_TEXTURE_MIN_FILTER = 0x00002801;
+    public static final int GL_TEXTURE_WRAP_S = 0x00002802;
+    public static final int GL_TEXTURE_WRAP_T = 0x00002803;
+    public static final int GL_TRIANGLES = 0x00000004;
+    public static final int GL_TRIANGLE_FAN = 0x00000006;
+    public static final int GL_TRIANGLE_STRIP = 0x00000005;
+    public static final int GL_TRUE = 0x00000001;
+    public static final int GL_UNPACK_ALIGNMENT = 0x00000cf5;
+    public static final int GL_UNSIGNED_BYTE = 0x00001401;
+    public static final int GL_UNSIGNED_INT = 0x00001405;
+    public static final int GL_UNSIGNED_SHORT = 0x00001403;
     public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 0x00008033;
     public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 0x00008034;
     public static final int GL_UNSIGNED_SHORT_5_6_5 = 0x00008363;
-	public static final int GL_VENDOR = 0x00001f00;
-	public static final int GL_VERSION = 0x00001f02;
-	public static final int GL_VERTEX_SHADER = 0x00008b31;
-	public static final int GL_ZERO = 0x00000000;
+    public static final int GL_VENDOR = 0x00001f00;
+    public static final int GL_VERSION = 0x00001f02;
+    public static final int GL_VERTEX_SHADER = 0x00008b31;
+    public static final int GL_ZERO = 0x00000000;
 
     /**
      * A private constructor to inhibit instantiation of this class.
@@ -141,135 +141,135 @@ public class JmeIosGLES {
     private JmeIosGLES() {
     }
 
-	public static native void glActiveTexture(int texture);
-	public static native void glAttachShader(int program, int shader);
-	public static native void glBindBuffer(int target, int buffer);
-	public static native void glBindFramebuffer(int target, int framebuffer);
-	public static native void glBindRenderbuffer(int target, int renderbuffer);
-	public static native void glBindTexture(int target, int texture);
-//	public static native void glBindVertexArray // TODO: Investigate this 
+    public static native void glActiveTexture(int texture);
+    public static native void glAttachShader(int program, int shader);
+    public static native void glBindBuffer(int target, int buffer);
+    public static native void glBindFramebuffer(int target, int framebuffer);
+    public static native void glBindRenderbuffer(int target, int renderbuffer);
+    public static native void glBindTexture(int target, int texture);
+//    public static native void glBindVertexArray // TODO: Investigate this 
     public static native void glBlendEquationSeparate(int colorMode, int alphaMode);
-	public static native void glBlendFunc(int sfactor, int dfactor);
-	public static native void glBlendFuncSeparate(int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha);
-	public static native void glBufferData(int target, int size, Buffer data, int usage);
-	public static native void glBufferData2(int target, int size, byte[] data, int offset, int usage);
-	public static native void glBufferSubData(int target, int offset, int size, Buffer data);
-	public static native void glBufferSubData2(int target, int offset, int size, byte[] data, int dataoffset);
-	public static native int glCheckFramebufferStatus(int target);
-	public static native void glClear(int mask);
-	public static native void glClearColor(float red, float green, float blue, float alpha);
-	public static native void glColorMask(boolean red, boolean green, boolean blue, boolean alpha);
-	public static native void glCompileShader(int shader);
-	public static native void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize, Buffer pixels);
-	public static native void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int imageSize, Buffer pixels);
-	public static native int glCreateProgram();
-	public static native int glCreateShader(int type);
-	public static native void glCullFace(int mode);
-	public static native void glDeleteBuffers(int n, int[] buffers, int offset);
-	public static native void glDeleteFramebuffers(int n, int[] framebuffers, int offset);
-	public static native void glDeleteProgram(int program);
-	public static native void glDeleteRenderbuffers(int n, int[] renderbuffers, int offset);
-	public static native void glDeleteShader(int shader);
-	public static native void glDeleteTextures(int n, int[] textures, int offset);
-	public static native void glDepthFunc(int func);
-	public static native void glDepthMask(boolean flag);
-	public static native void glDepthRangef(float zNear, float zFar);
-	public static native void glDetachShader(int program, int shader);
-	public static native void glDisableVertexAttribArray(int index);
-	public static native void glDisable(int cap);
-	public static native void glDrawArrays(int mode, int first, int count);
-	public static native void glDrawElements(int mode, int count, int type, Buffer indices);
-	public static native void glDrawElements2(int mode, int count, int type, byte[] indices, int offset);
-	public static native void glDrawElementsIndex(int mode, int count, int type, int offset);
-	public static native void glEnable(int cap);
-	public static native void glEnableVertexAttribArray(int index);
-	public static native void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget, int renderbuffer);
-	public static native void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, int level);
-	public static native void glGenBuffers(int n, int[] buffers, int offset);
-	public static native void glGenFramebuffers(int n, int[] framebuffers, int offset);
-	public static native void glGenRenderbuffers(int n, int[] renderbuffers, int offset);
-	public static native void glGenTextures(int n, int[] textures, int offset);
-	public static native void glGenerateMipmap(int target);
-	public static native int glGetAttribLocation(int program, String name);
-	public static native void glGetBoolean(int pname, ByteBuffer params);
-	public static native int glGetError();
-	public static native void glGetFloatv (int pname, float[] params, int offset);
-	public static native void glGetFramebufferAttachmentParameteriv(int target, int attachment, int pname, int[] params, int offset);
-	public static native void glGetIntegerv (int pname, int[] params, int offset);
-	public static native String glGetProgramInfoLog(int program);
-	public static native void glGetProgramiv(int program, int pname, int[] params, int offset);
-	public static native String glGetShaderInfoLog(int shader);
-	public static native void glGetShaderiv(int shader, int pname, int[] params, int offset);
-	public static native String glGetString(int name);
-	public static native int glGetUniformLocation(int program, String name);
-	public static native boolean glIsEnabled(int cap);
-	public static native boolean glIsFramebuffer(int framebuffer);
-	public static native boolean glIsRenderbuffer(int renderbuffer);
-	public static native void glLineWidth(float width);
-	public static native void glLinkProgram(int program);
-	public static native void glPixelStorei(int pname, int param);
-	public static native void glPolygonOffset(float factor, float units);
-	public static native void glReadPixels(int vpX, int vpY, int vpW, int vpH, int format, int type, Buffer pixels);
-	public static native void glReadPixels2(int vpX, int vpY, int vpW, int vpH, int format, int type, byte[] pixels, int offset, int size);
-	public static native void glRenderbufferStorage(int target, int internalformat, int width, int height);
-	public static native void glScissor(int x, int y, int width, int height);
-	public static native void glShaderSource(int shader, String string);
-	public static native void glStencilFuncSeparate(int face, int func, int ref, int mask);
-	public static native void glStencilOpSeparate(int face, int sfail, int dpfail, int dppass);
-	public static native void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, Buffer pixels);
-	public static native void glTexParameteri(int target, int pname, int param);
-	public static native void glTexParameterf(int target, int pname, float param);
-	public static native void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, Buffer pixels);
-	public static native void glUniform1f(int location, float x);
-	public static native void glUniform1fv(int location, int count, FloatBuffer v);
-	public static native void glUniform1fv2(int location, int count, float[] v, int offset);
-	public static native void glUniform1i(int location, int x);
-	public static native void glUniform1iv(int location, int count, IntBuffer v);
-	public static native void glUniform1iv2(int location, int count, int[] v, int offset);
-	public static native void glUniform2f(int location, float x, float y);
-	public static native void glUniform2fv(int location, int count, FloatBuffer v);
-	public static native void glUniform2fv2(int location, int count, float[] v, int offset);
-	public static native void glUniform3f(int location, float x, float y, float z);
-	public static native void glUniform3fv(int location, int count, FloatBuffer v);
-	public static native void glUniform3fv2(int location, int count, float[] v, int offset);
-	public static native void glUniform4f(int location, float x, float y, float z, float w);
-	public static native void glUniform4fv(int location, int count, FloatBuffer v);
-	public static native void glUniform4fv2(int location, int count, float[] v, int offset);
-	public static native void glUniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value);
-	public static native void glUniformMatrix3fv2(int location, int count, boolean transpose, float[] value, int offset);
-	public static native void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value);
-	public static native void glUniformMatrix4fv2(int location, int count, boolean transpose, float[] value, int offset);
-	public static native void glUseProgram(int program);
-	//public static native void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, byte[] ptr, int offset);
-	public static native void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, Buffer ptr);
-	public static native void glVertexAttribPointer2(int indx, int size, int type, boolean normalized, int stride, int offset);
-	public static native void glViewport(int x, int y, int width, int height);
-	
-	// New methods for GLES3
-	public static native void glBeginQuery(int target, int query);
-	public static native void glEndQuery(int target);
-	public static native void glGenQueries(int num, IntBuffer buff);
-	public static native void glGetQueryObjectuiv(int query, int pname, int[] params);
-	public static native void glGetQueryiv(int query, int pname, int[] params);
-	public static native void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter);
-	public static native void glDrawArraysInstanced(int mode, int first, int count, int primcount);
-	public static native void glDrawBuffers(int size, IntBuffer data); //TODO: use buffer or intbuffer?
-	public static native void glDrawElementsInstanced(int mode, int indices_count, int type, long indices_buffer_offset, int primcount);
-	public static native void glVertexAttribDivisor(int index, int divisor);
-	public static native void glFramebufferTextureLayer(int target, int attachment, int texture, int level, int layer);
+    public static native void glBlendFunc(int sfactor, int dfactor);
+    public static native void glBlendFuncSeparate(int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha);
+    public static native void glBufferData(int target, int size, Buffer data, int usage);
+    public static native void glBufferData2(int target, int size, byte[] data, int offset, int usage);
+    public static native void glBufferSubData(int target, int offset, int size, Buffer data);
+    public static native void glBufferSubData2(int target, int offset, int size, byte[] data, int dataoffset);
+    public static native int glCheckFramebufferStatus(int target);
+    public static native void glClear(int mask);
+    public static native void glClearColor(float red, float green, float blue, float alpha);
+    public static native void glColorMask(boolean red, boolean green, boolean blue, boolean alpha);
+    public static native void glCompileShader(int shader);
+    public static native void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize, Buffer pixels);
+    public static native void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int imageSize, Buffer pixels);
+    public static native int glCreateProgram();
+    public static native int glCreateShader(int type);
+    public static native void glCullFace(int mode);
+    public static native void glDeleteBuffers(int n, int[] buffers, int offset);
+    public static native void glDeleteFramebuffers(int n, int[] framebuffers, int offset);
+    public static native void glDeleteProgram(int program);
+    public static native void glDeleteRenderbuffers(int n, int[] renderbuffers, int offset);
+    public static native void glDeleteShader(int shader);
+    public static native void glDeleteTextures(int n, int[] textures, int offset);
+    public static native void glDepthFunc(int func);
+    public static native void glDepthMask(boolean flag);
+    public static native void glDepthRangef(float zNear, float zFar);
+    public static native void glDetachShader(int program, int shader);
+    public static native void glDisableVertexAttribArray(int index);
+    public static native void glDisable(int cap);
+    public static native void glDrawArrays(int mode, int first, int count);
+    public static native void glDrawElements(int mode, int count, int type, Buffer indices);
+    public static native void glDrawElements2(int mode, int count, int type, byte[] indices, int offset);
+    public static native void glDrawElementsIndex(int mode, int count, int type, int offset);
+    public static native void glEnable(int cap);
+    public static native void glEnableVertexAttribArray(int index);
+    public static native void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget, int renderbuffer);
+    public static native void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, int level);
+    public static native void glGenBuffers(int n, int[] buffers, int offset);
+    public static native void glGenFramebuffers(int n, int[] framebuffers, int offset);
+    public static native void glGenRenderbuffers(int n, int[] renderbuffers, int offset);
+    public static native void glGenTextures(int n, int[] textures, int offset);
+    public static native void glGenerateMipmap(int target);
+    public static native int glGetAttribLocation(int program, String name);
+    public static native void glGetBoolean(int pname, ByteBuffer params);
+    public static native int glGetError();
+    public static native void glGetFloatv (int pname, float[] params, int offset);
+    public static native void glGetFramebufferAttachmentParameteriv(int target, int attachment, int pname, int[] params, int offset);
+    public static native void glGetIntegerv (int pname, int[] params, int offset);
+    public static native String glGetProgramInfoLog(int program);
+    public static native void glGetProgramiv(int program, int pname, int[] params, int offset);
+    public static native String glGetShaderInfoLog(int shader);
+    public static native void glGetShaderiv(int shader, int pname, int[] params, int offset);
+    public static native String glGetString(int name);
+    public static native int glGetUniformLocation(int program, String name);
+    public static native boolean glIsEnabled(int cap);
+    public static native boolean glIsFramebuffer(int framebuffer);
+    public static native boolean glIsRenderbuffer(int renderbuffer);
+    public static native void glLineWidth(float width);
+    public static native void glLinkProgram(int program);
+    public static native void glPixelStorei(int pname, int param);
+    public static native void glPolygonOffset(float factor, float units);
+    public static native void glReadPixels(int vpX, int vpY, int vpW, int vpH, int format, int type, Buffer pixels);
+    public static native void glReadPixels2(int vpX, int vpY, int vpW, int vpH, int format, int type, byte[] pixels, int offset, int size);
+    public static native void glRenderbufferStorage(int target, int internalformat, int width, int height);
+    public static native void glScissor(int x, int y, int width, int height);
+    public static native void glShaderSource(int shader, String string);
+    public static native void glStencilFuncSeparate(int face, int func, int ref, int mask);
+    public static native void glStencilOpSeparate(int face, int sfail, int dpfail, int dppass);
+    public static native void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, Buffer pixels);
+    public static native void glTexParameteri(int target, int pname, int param);
+    public static native void glTexParameterf(int target, int pname, float param);
+    public static native void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, Buffer pixels);
+    public static native void glUniform1f(int location, float x);
+    public static native void glUniform1fv(int location, int count, FloatBuffer v);
+    public static native void glUniform1fv2(int location, int count, float[] v, int offset);
+    public static native void glUniform1i(int location, int x);
+    public static native void glUniform1iv(int location, int count, IntBuffer v);
+    public static native void glUniform1iv2(int location, int count, int[] v, int offset);
+    public static native void glUniform2f(int location, float x, float y);
+    public static native void glUniform2fv(int location, int count, FloatBuffer v);
+    public static native void glUniform2fv2(int location, int count, float[] v, int offset);
+    public static native void glUniform3f(int location, float x, float y, float z);
+    public static native void glUniform3fv(int location, int count, FloatBuffer v);
+    public static native void glUniform3fv2(int location, int count, float[] v, int offset);
+    public static native void glUniform4f(int location, float x, float y, float z, float w);
+    public static native void glUniform4fv(int location, int count, FloatBuffer v);
+    public static native void glUniform4fv2(int location, int count, float[] v, int offset);
+    public static native void glUniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value);
+    public static native void glUniformMatrix3fv2(int location, int count, boolean transpose, float[] value, int offset);
+    public static native void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value);
+    public static native void glUniformMatrix4fv2(int location, int count, boolean transpose, float[] value, int offset);
+    public static native void glUseProgram(int program);
+    //public static native void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, byte[] ptr, int offset);
+    public static native void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, Buffer ptr);
+    public static native void glVertexAttribPointer2(int indx, int size, int type, boolean normalized, int stride, int offset);
+    public static native void glViewport(int x, int y, int width, int height);
+    
+    // New methods for GLES3
+    public static native void glBeginQuery(int target, int query);
+    public static native void glEndQuery(int target);
+    public static native void glGenQueries(int num, IntBuffer buff);
+    public static native void glGetQueryObjectuiv(int query, int pname, int[] params);
+    public static native void glGetQueryiv(int query, int pname, int[] params);
+    public static native void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter);
+    public static native void glDrawArraysInstanced(int mode, int first, int count, int primcount);
+    public static native void glDrawBuffers(int size, IntBuffer data); //TODO: use buffer or intbuffer?
+    public static native void glDrawElementsInstanced(int mode, int indices_count, int type, long indices_buffer_offset, int primcount);
+    public static native void glVertexAttribDivisor(int index, int divisor);
+    public static native void glFramebufferTextureLayer(int target, int attachment, int texture, int level, int layer);
 
-	// New methods from GL2 interface which are supported in GLES30
-	public static native void glReadBuffer(int mode);
-	public static native void glCompressedTexImage3D(int target, int level, int internalFormat, int width, int height, int depth,
+    // New methods from GL2 interface which are supported in GLES30
+    public static native void glReadBuffer(int mode);
+    public static native void glCompressedTexImage3D(int target, int level, int internalFormat, int width, int height, int depth,
                                            int border, int size, ByteBuffer data);
-	public static native void glCompressedTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width,
-										   int height, int depth, int format, int size, ByteBuffer data);
-	public static native void glTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border,
-										   int format, int type, ByteBuffer data);
-	public static native void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height,
+    public static native void glCompressedTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width,
+                                           int height, int depth, int format, int size, ByteBuffer data);
+    public static native void glTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border,
+                                           int format, int type, ByteBuffer data);
+    public static native void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height,
                                     int depth, int format, int type, ByteBuffer data);
-	
-									
+
+
     public static void checkGLError() {
         if (!ENABLE_ERROR_CHECKING) {
             return;

+ 3 - 3
jme3-ios/src/main/java/com/jme3/system/ios/IGLESContext.java

@@ -138,7 +138,7 @@ public class IGLESContext implements JmeContext {
     @Override
     public boolean isCreated() {
         logger.log(Level.FINE, "IGLESContext isCreated");
-		return created.get();
+        return created.get();
     }
 
     @Override
@@ -191,8 +191,8 @@ public class IGLESContext implements JmeContext {
     @Override
     public void destroy(boolean waitFor) {
         logger.log(Level.FINE, "IGLESContext destroy");
-		listener.destroy();
-		needClose.set(true);
+        listener.destroy();
+        needClose.set(true);
         if (waitFor) {
             //waitFor(false);
         }

+ 3 - 3
jme3-ios/src/main/java/com/jme3/system/ios/IosImageLoader.java

@@ -51,11 +51,11 @@ public class IosImageLoader implements AssetLoader {
         Image img = null;
         InputStream in = null;
         try {
-        	in = info.openStream();
+            in = info.openStream();
             img = loadImageData(Format.RGBA8, flip, in);
         } finally {
-        	if (in != null) {
-            	in.close();
+            if (in != null) {
+                in.close();
             }
         }
         return img;

+ 3 - 3
jme3-jbullet/src/main/java/com/jme3/bullet/collision/shapes/CylinderCollisionShape.java

@@ -90,9 +90,9 @@ public class CylinderCollisionShape extends CollisionShape {
      */
     @Override
     public void setScale(Vector3f scale) {
-    	 if (!scale.equals(Vector3f.UNIT_XYZ)) {
-    		 Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
-    	 }
+        if (!scale.equals(Vector3f.UNIT_XYZ)) {
+            Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
+        }
     }
 
     @Override

+ 73 - 73
jme3-jbullet/src/main/java/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java

@@ -46,87 +46,87 @@ import java.io.IOException;
  * Uses Bullet Physics Heightfield terrain collision system. This is MUCH faster
  * than using a regular mesh.
  * There are a couple tricks though:
- *	-No rotation or translation is supported.
- *	-The collision bbox must be centered around 0,0,0 with the height above and below the y-axis being
- *	equal on either side. If not, the whole collision box is shifted vertically and things don't collide
- *	as they should.
+ *    -No rotation or translation is supported.
+ *    -The collision bbox must be centered around 0,0,0 with the height above and below the y-axis being
+ *    equal on either side. If not, the whole collision box is shifted vertically and things don't collide
+ *    as they should.
  * 
  * @author Brent Owens
  */
 public class HeightfieldCollisionShape extends CollisionShape {
 
-	//protected HeightfieldTerrainShape heightfieldShape;
-	protected int heightStickWidth;
-	protected int heightStickLength;
-	protected float[] heightfieldData;
-	protected float heightScale;
-	protected float minHeight;
-	protected float maxHeight;
-	protected int upAxis;
-	protected boolean flipQuadEdges;
-
-	protected HeightfieldCollisionShape() {
-
-	}
-
-	public HeightfieldCollisionShape(float[] heightmap) {
-		createCollisionHeightfield(heightmap, Vector3f.UNIT_XYZ);
-	}
-
-	public HeightfieldCollisionShape(float[] heightmap, Vector3f scale) {
-		createCollisionHeightfield(heightmap, scale);
-	}
-
-	protected void createCollisionHeightfield(float[] heightmap, Vector3f worldScale) {
-		this.scale = worldScale;
-		this.heightScale = 1;//don't change away from 1, we use worldScale instead to scale
-		
-		this.heightfieldData = heightmap;
-
-		float min = heightfieldData[0];
-		float max = heightfieldData[0];
-		// calculate min and max height
-		for (int i=0; i<heightfieldData.length; i++) {
-			if (heightfieldData[i] < min)
-				min = heightfieldData[i];
-			if (heightfieldData[i] > max)
-				max = heightfieldData[i];
-		}
-		// we need to center the terrain collision box at 0,0,0 for BulletPhysics. And to do that we need to set the
-		// min and max height to be equal on either side of the y axis, otherwise it gets shifted and collision is incorrect.
-		if (max < 0)
-			max = -min;
-		else {
-			if (Math.abs(max) > Math.abs(min))
-				min = -max;
-			else
-				max = -min;
-		}
-		this.minHeight = min;
-		this.maxHeight = max;
-
-		this.upAxis = HeightfieldTerrainShape.YAXIS;
-		this.flipQuadEdges = false;
-
-		heightStickWidth = (int) FastMath.sqrt(heightfieldData.length);
-		heightStickLength = heightStickWidth;
-
-
-		createShape();
-	}
-	
-	protected void createShape() {
-
-		HeightfieldTerrainShape shape = new HeightfieldTerrainShape(heightStickWidth, heightStickLength, heightfieldData, heightScale, minHeight, maxHeight, upAxis, flipQuadEdges);
-		shape.setLocalScaling(new javax.vecmath.Vector3f(scale.x, scale.y, scale.z));
-		cShape = shape;
-		cShape.setLocalScaling(Converter.convert(getScale()));
+    //protected HeightfieldTerrainShape heightfieldShape;
+    protected int heightStickWidth;
+    protected int heightStickLength;
+    protected float[] heightfieldData;
+    protected float heightScale;
+    protected float minHeight;
+    protected float maxHeight;
+    protected int upAxis;
+    protected boolean flipQuadEdges;
+
+    protected HeightfieldCollisionShape() {
+
+    }
+
+    public HeightfieldCollisionShape(float[] heightmap) {
+        createCollisionHeightfield(heightmap, Vector3f.UNIT_XYZ);
+    }
+
+    public HeightfieldCollisionShape(float[] heightmap, Vector3f scale) {
+        createCollisionHeightfield(heightmap, scale);
+    }
+
+    protected void createCollisionHeightfield(float[] heightmap, Vector3f worldScale) {
+        this.scale = worldScale;
+        this.heightScale = 1;//don't change away from 1, we use worldScale instead to scale
+        
+        this.heightfieldData = heightmap;
+
+        float min = heightfieldData[0];
+        float max = heightfieldData[0];
+        // calculate min and max height
+        for (int i=0; i<heightfieldData.length; i++) {
+            if (heightfieldData[i] < min)
+                min = heightfieldData[i];
+            if (heightfieldData[i] > max)
+                max = heightfieldData[i];
+        }
+        // we need to center the terrain collision box at 0,0,0 for BulletPhysics. And to do that we need to set the
+        // min and max height to be equal on either side of the y axis, otherwise it gets shifted and collision is incorrect.
+        if (max < 0)
+            max = -min;
+        else {
+            if (Math.abs(max) > Math.abs(min))
+                min = -max;
+            else
+                max = -min;
+        }
+        this.minHeight = min;
+        this.maxHeight = max;
+
+        this.upAxis = HeightfieldTerrainShape.YAXIS;
+        this.flipQuadEdges = false;
+
+        heightStickWidth = (int) FastMath.sqrt(heightfieldData.length);
+        heightStickLength = heightStickWidth;
+
+
+        createShape();
+    }
+
+    protected void createShape() {
+
+        HeightfieldTerrainShape shape = new HeightfieldTerrainShape(heightStickWidth, heightStickLength, heightfieldData, heightScale, minHeight, maxHeight, upAxis, flipQuadEdges);
+        shape.setLocalScaling(new javax.vecmath.Vector3f(scale.x, scale.y, scale.z));
+        cShape = shape;
+        cShape.setLocalScaling(Converter.convert(getScale()));
                 cShape.setMargin(margin);
-	}
+    }
 
-	public Mesh createJmeMesh(){
+    public Mesh createJmeMesh(){
         //TODO return Converter.convert(bulletMesh);
-		return null;
+        return null;
     }
 
     @Override

+ 4 - 4
jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglKernel.java

@@ -233,8 +233,8 @@ public class LwjglKernel extends Kernel {
         }
         CLCommandQueue q = ((LwjglCommandQueue) queue).getQueue();
         int ret = CL10.clEnqueueNDRangeKernel(q, kernel,
-			globalWorkSize.getDimension(), null, Utils.pointerBuffers[1],
-			p2, null, Utils.pointerBuffers[0]);
+            globalWorkSize.getDimension(), null, Utils.pointerBuffers[1],
+            p2, null, Utils.pointerBuffers[0]);
         Utils.checkError(ret, "clEnqueueNDRangeKernel");
         return new LwjglEvent(q.getCLEvent(Utils.pointerBuffers[0].get(0)));
     }
@@ -251,8 +251,8 @@ public class LwjglKernel extends Kernel {
         }
         CLCommandQueue q = ((LwjglCommandQueue) queue).getQueue();
         int ret = CL10.clEnqueueNDRangeKernel(q, kernel,
-			globalWorkSize.getDimension(), null, Utils.pointerBuffers[1],
-			p2, null, null);
+            globalWorkSize.getDimension(), null, Utils.pointerBuffers[1],
+            p2, null, null);
         Utils.checkError(ret, "clEnqueueNDRangeKernel");
     }
 

+ 4 - 4
jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java

@@ -123,9 +123,9 @@ public final class LwjglPlatform implements Platform {
         return Arrays.asList(platform.getInfoString(CL10.CL_PLATFORM_EXTENSIONS).split(" "));
     }
 
-	@Override
-	public String toString() {
-		return getName();
-	}
+    @Override
+    public String toString() {
+        return getName();
+    }
 
 }

+ 6 - 6
jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/Utils.java

@@ -55,12 +55,12 @@ public class Utils {
     /** Maps OpenCL error token values to their String representations. 
         Taken directly from org.lwjgl.opencl.Util
      */
-	private static final Map<Integer, String> CL_ERROR_TOKENS = LWJGLUtil.getClassTokens(new LWJGLUtil.TokenFilter() {
-                @Override
-		public boolean accept(final Field field, final int value) {
-			return value < 0; // Currently, all OpenCL errors have negative values.
-		}
-	}, null, CL10.class, CL11.class, CL12.class, KHRGLSharing.class, KHRICD.class, APPLEGLSharing.class, EXTDeviceFission.class);
+    private static final Map<Integer, String> CL_ERROR_TOKENS = LWJGLUtil.getClassTokens(new LWJGLUtil.TokenFilter() {
+        @Override
+        public boolean accept(final Field field, final int value) {
+            return value < 0; // Currently, all OpenCL errors have negative values.
+        }
+    }, null, CL10.class, CL11.class, CL12.class, KHRGLSharing.class, KHRICD.class, APPLEGLSharing.class, EXTDeviceFission.class);
     
     public static int getMajorVersion(String version, String prefix) {
         String s = version.substring(prefix.length());

+ 1 - 1
jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglDisplay.java

@@ -100,7 +100,7 @@ public class LwjglDisplay extends LwjglAbstractDisplay {
 
         boolean pixelFormatChanged = false;
         if (created.get() && (pixelFormat.getBitsPerPixel() != pf.getBitsPerPixel()
-        					||pixelFormat.getAlphaBits() != pf.getAlphaBits()
+                            ||pixelFormat.getAlphaBits() != pf.getAlphaBits()
                             ||pixelFormat.getDepthBits() != pf.getDepthBits()
                             ||pixelFormat.getStencilBits() != pf.getStencilBits()
                             ||pixelFormat.getSamples() != pf.getSamples())){

+ 4 - 4
jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglKernel.java

@@ -188,8 +188,8 @@ public class LwjglKernel extends Kernel {
         }
         long q = ((LwjglCommandQueue) queue).getQueue();
         int ret = CL10.clEnqueueNDRangeKernel(q, kernel,
-			globalWorkSize.getDimension(), null, Utils.pointerBuffers[1],
-			p2, null, Utils.pointerBuffers[0]);
+            globalWorkSize.getDimension(), null, Utils.pointerBuffers[1],
+            p2, null, Utils.pointerBuffers[0]);
         Utils.checkError(ret, "clEnqueueNDRangeKernel");
         return new LwjglEvent(Utils.pointerBuffers[0].get(0));
     }
@@ -206,8 +206,8 @@ public class LwjglKernel extends Kernel {
         }
         long q = ((LwjglCommandQueue) queue).getQueue();
         int ret = CL10.clEnqueueNDRangeKernel(q, kernel,
-			globalWorkSize.getDimension(), null, Utils.pointerBuffers[1],
-			p2, null, null);
+            globalWorkSize.getDimension(), null, Utils.pointerBuffers[1],
+            p2, null, null);
         Utils.checkError(ret, "clEnqueueNDRangeKernel");
     }
 

+ 4 - 4
jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java

@@ -162,9 +162,9 @@ public final class LwjglPlatform implements Platform {
         return Arrays.asList(Info.clGetPlatformInfoStringASCII(platform, CL10.CL_PLATFORM_EXTENSIONS).split(" "));
     }
 
-	@Override
-	public String toString() {
-		return getName();
-	}
+    @Override
+    public String toString() {
+        return getName();
+    }
 
 }

+ 130 - 131
jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/Sync.java

@@ -43,135 +43,134 @@ class Sync {
 
 
 
-	/** number of nano seconds in a second */
-	private static final long NANOS_IN_SECOND = 1000L * 1000L * 1000L;
-
-	/** The time to sleep/yield until the next frame */
-	private static long nextFrame = 0;
-	
-	/** whether the initialisation code has run */
-	private static boolean initialised = false;
-	
-	/** for calculating the averages the previous sleep/yield times are stored */
-	private static RunningAvg sleepDurations = new RunningAvg(10);
-	private static RunningAvg yieldDurations = new RunningAvg(10);
-	
-	
-	/**
-	 * An accurate sync method that will attempt to run at a constant frame rate.
-	 * It should be called once every frame.
-	 * 
-	 * @param fps - the desired frame rate, in frames per second
-	 */
-	public static void sync(int fps) {
-		if (fps <= 0) return;
-		if (!initialised) initialise();
-		
-		try {
-			// sleep until the average sleep time is greater than the time remaining till nextFrame
-			for (long t0 = getTime(), t1; (nextFrame - t0) > sleepDurations.avg(); t0 = t1) {
-				Thread.sleep(1);
-				sleepDurations.add((t1 = getTime()) - t0); // update average sleep time
-			}
-	
-			// slowly dampen sleep average if too high to avoid yielding too much
-			sleepDurations.dampenForLowResTicker();
-	
-			// yield until the average yield time is greater than the time remaining till nextFrame
-			for (long t0 = getTime(), t1; (nextFrame - t0) > yieldDurations.avg(); t0 = t1) {
-				Thread.yield();
-				yieldDurations.add((t1 = getTime()) - t0); // update average yield time
-			}
-		} catch (InterruptedException e) {
-			
-		}
-		
-		// schedule next frame, drop frame(s) if already too late for next frame
-		nextFrame = Math.max(nextFrame + NANOS_IN_SECOND / fps, getTime());
-	}
-	
-	/**
-	 * This method will initialise the sync method by setting initial
-	 * values for sleepDurations/yieldDurations and nextFrame.
-	 * 
-	 * If running on windows it will start the sleep timer fix.
-	 */
-	private static void initialise() {
-		initialised = true;
-		
-		sleepDurations.init(1000 * 1000);
-		yieldDurations.init((int) (-(getTime() - getTime()) * 1.333));
-		
-		nextFrame = getTime();
-		
-		
-			// On windows the sleep functions can be highly inaccurate by 
-			// over 10ms making in unusable. However it can be forced to 
-			// be a bit more accurate by running a separate sleeping daemon
-			// thread.
-			Thread timerAccuracyThread = new Thread(new Runnable() {
-                                @Override
-				public void run() {
-					try {
-						while(true)Thread.sleep(Long.MAX_VALUE);
-					} catch (Exception e) {}
-				}
-			});
-			
-			timerAccuracyThread.setName("LWJGL Timer");
-			timerAccuracyThread.setDaemon(true);
-			timerAccuracyThread.start();
-		}
-	
-
-	/**
-	 * Get the system time in nano seconds
-	 * 
-	 * @return will return the current time in nano's
-	 */
-	private static long getTime() {
-		long time= System.currentTimeMillis()& 0x7FFFFFFFFFFFFFFFL;
-		long res= 1000;
-		return (time * NANOS_IN_SECOND) / res;
-	}
-
-	private static class RunningAvg {
-		private final long[] slots;
-		private int offset;
-		
-		private static final long DAMPEN_THRESHOLD = 10 * 1000L * 1000L; // 10ms
-		private static final float DAMPEN_FACTOR = 0.9f; // don't change: 0.9f is exactly right!
-
-		public RunningAvg(int slotCount) {
-			this.slots = new long[slotCount];
-			this.offset = 0;
-		}
-
-		public void init(long value) {
-			while (this.offset < this.slots.length) {
-				this.slots[this.offset++] = value;
-			}
-		}
-
-		public void add(long value) {
-			this.slots[this.offset++ % this.slots.length] = value;
-			this.offset %= this.slots.length;
-		}
-
-		public long avg() {
-			long sum = 0;
-			for (int i = 0; i < this.slots.length; i++) {
-				sum += this.slots[i];
-			}
-			return sum / this.slots.length;
-		}
-		
-		public void dampenForLowResTicker() {
-			if (this.avg() > DAMPEN_THRESHOLD) {
-				for (int i = 0; i < this.slots.length; i++) {
-					this.slots[i] *= DAMPEN_FACTOR;
-				}
-			}
-		}
-	}
+    /** number of nano seconds in a second */
+    private static final long NANOS_IN_SECOND = 1000L * 1000L * 1000L;
+
+    /** The time to sleep/yield until the next frame */
+    private static long nextFrame = 0;
+
+    /** whether the initialisation code has run */
+    private static boolean initialised = false;
+
+    /** for calculating the averages the previous sleep/yield times are stored */
+    private static RunningAvg sleepDurations = new RunningAvg(10);
+    private static RunningAvg yieldDurations = new RunningAvg(10);
+
+    /**
+     * An accurate sync method that will attempt to run at a constant frame rate.
+     * It should be called once every frame.
+     * 
+     * @param fps - the desired frame rate, in frames per second
+     */
+    public static void sync(int fps) {
+        if (fps <= 0) return;
+        if (!initialised) initialise();
+
+        try {
+            // sleep until the average sleep time is greater than the time remaining till nextFrame
+            for (long t0 = getTime(), t1; (nextFrame - t0) > sleepDurations.avg(); t0 = t1) {
+                Thread.sleep(1);
+                sleepDurations.add((t1 = getTime()) - t0); // update average sleep time
+            }
+
+            // slowly dampen sleep average if too high to avoid yielding too much
+            sleepDurations.dampenForLowResTicker();
+
+            // yield until the average yield time is greater than the time remaining till nextFrame
+            for (long t0 = getTime(), t1; (nextFrame - t0) > yieldDurations.avg(); t0 = t1) {
+                Thread.yield();
+                yieldDurations.add((t1 = getTime()) - t0); // update average yield time
+            }
+        } catch (InterruptedException e) {
+
+        }
+
+        // schedule next frame, drop frame(s) if already too late for next frame
+        nextFrame = Math.max(nextFrame + NANOS_IN_SECOND / fps, getTime());
+    }
+
+    /**
+     * This method will initialise the sync method by setting initial
+     * values for sleepDurations/yieldDurations and nextFrame.
+     * 
+     * If running on windows it will start the sleep timer fix.
+     */
+    private static void initialise() {
+        initialised = true;
+
+        sleepDurations.init(1000 * 1000);
+        yieldDurations.init((int) (-(getTime() - getTime()) * 1.333));
+
+        nextFrame = getTime();
+
+
+            // On windows the sleep functions can be highly inaccurate by 
+            // over 10ms making in unusable. However it can be forced to 
+            // be a bit more accurate by running a separate sleeping daemon
+            // thread.
+            Thread timerAccuracyThread = new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        while(true)Thread.sleep(Long.MAX_VALUE);
+                    } catch (Exception e) {}
+                }
+            });
+
+            timerAccuracyThread.setName("LWJGL Timer");
+            timerAccuracyThread.setDaemon(true);
+            timerAccuracyThread.start();
+        }
+
+
+    /**
+     * Get the system time in nano seconds
+     * 
+     * @return will return the current time in nano's
+     */
+    private static long getTime() {
+        long time= System.currentTimeMillis()& 0x7FFFFFFFFFFFFFFFL;
+        long res= 1000;
+        return (time * NANOS_IN_SECOND) / res;
+    }
+
+    private static class RunningAvg {
+        private final long[] slots;
+        private int offset;
+
+        private static final long DAMPEN_THRESHOLD = 10 * 1000L * 1000L; // 10ms
+        private static final float DAMPEN_FACTOR = 0.9f; // don't change: 0.9f is exactly right!
+
+        public RunningAvg(int slotCount) {
+            this.slots = new long[slotCount];
+            this.offset = 0;
+        }
+
+        public void init(long value) {
+            while (this.offset < this.slots.length) {
+                this.slots[this.offset++] = value;
+            }
+        }
+
+        public void add(long value) {
+            this.slots[this.offset++ % this.slots.length] = value;
+            this.offset %= this.slots.length;
+        }
+
+        public long avg() {
+            long sum = 0;
+            for (int i = 0; i < this.slots.length; i++) {
+                sum += this.slots[i];
+            }
+            return sum / this.slots.length;
+        }
+
+        public void dampenForLowResTicker() {
+            if (this.avg() > DAMPEN_THRESHOLD) {
+                for (int i = 0; i < this.slots.length; i++) {
+                    this.slots[i] *= DAMPEN_FACTOR;
+                }
+            }
+        }
+    }
 }

+ 1 - 1
jme3-networking/src/main/java/com/jme3/network/kernel/tcp/SelectorKernel.java

@@ -205,7 +205,7 @@ public class SelectorKernel extends AbstractKernel
 
         // Must copy the shared data before we use it
         byte[] dataCopy = new byte[size];
-		System.arraycopy(shared.array(), 0, dataCopy, 0, size);
+        System.arraycopy(shared.array(), 0, dataCopy, 0, size);
 
         Envelope env = new Envelope( p, dataCopy, true );
         addEnvelope( env );