From: kobayasi Date: Sun, 16 Feb 2014 17:10:33 +0000 (+0900) Subject: Change build system ant to sbt. X-Git-Tag: v0.8.0~7 X-Git-Url: http://git.osdn.net/view?p=mikumikustudio%2FMikuMikuStudio.git;a=commitdiff_plain;h=de461ea618562ec30c37a32e57e0610b4746eb08 Change build system ant to sbt. --- diff --git a/build.sbt b/build.sbt new file mode 100644 index 000000000..18a240e06 --- /dev/null +++ b/build.sbt @@ -0,0 +1,17 @@ +lazy val root = + (project.in(file(".")) + .settings(Common.settings: _*) + .aggregate(engine, desktop, android, gdx, niftygui) + ) + +lazy val engine = project + +lazy val desktop = project.dependsOn(engine) + +lazy val android = project + +lazy val gdx = project + +lazy val niftygui = project.dependsOn(engine) + + diff --git a/desktop/build.sbt b/desktop/build.sbt new file mode 100644 index 000000000..3deb9750f --- /dev/null +++ b/desktop/build.sbt @@ -0,0 +1,19 @@ +Common.settings + +name := "mms-desktop" + +unmanagedSourceDirectories in Compile ++= Seq( + baseDirectory.value / "../engine/src/lwjgl-oal" + , baseDirectory.value / "../engine/src/lwjgl-ogl" + , baseDirectory.value / "../engine/src/blender" +) + +libraryDependencies += "org.lwjgl.lwjgl" % "lwjgl" % "2.9.0" + +libraryDependencies += "net.sf.sociaal" % "j-ogg-oggd" % "3.0.0.20130526" + +libraryDependencies += "net.sf.sociaal" % "j-ogg-vorbisd" % "3.0.0.20130526" + +libraryDependencies += "net.java.jinput" % "jinput" % "2.0.5" + +libraryDependencies += "org.bushe" % "eventbus" % "1.4" diff --git a/engine/src/desktop/com/jme3/app/AppletHarness.java b/desktop/src/main/java/com/jme3/app/AppletHarness.java similarity index 100% rename from engine/src/desktop/com/jme3/app/AppletHarness.java rename to desktop/src/main/java/com/jme3/app/AppletHarness.java diff --git a/engine/src/desktop/com/jme3/system/JmeCanvasContext.java b/desktop/src/main/java/com/jme3/system/JmeCanvasContext.java similarity index 98% rename from engine/src/desktop/com/jme3/system/JmeCanvasContext.java rename to desktop/src/main/java/com/jme3/system/JmeCanvasContext.java index 1d250b5af..caae4a959 100644 --- a/engine/src/desktop/com/jme3/system/JmeCanvasContext.java +++ b/desktop/src/main/java/com/jme3/system/JmeCanvasContext.java @@ -32,7 +32,7 @@ package com.jme3.system; -import java.awt.Canvas; +import java.awt.*; public interface JmeCanvasContext extends JmeContext { public Canvas getCanvas(); diff --git a/desktop/src/main/java/com/jme3/system/JmeSystemDelegateImpl.java b/desktop/src/main/java/com/jme3/system/JmeSystemDelegateImpl.java new file mode 100644 index 000000000..91e62c909 --- /dev/null +++ b/desktop/src/main/java/com/jme3/system/JmeSystemDelegateImpl.java @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2009-2010 jMonkeyEngine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'jMonkeyEngine' nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.jme3.system; + +import com.jme3.app.SettingsDialog; +import com.jme3.app.SettingsDialog.SelectionListener; +import com.jme3.asset.AssetManager; +import com.jme3.asset.AssetNotFoundException; +import com.jme3.asset.DesktopAssetManager; +import com.jme3.audio.AudioRenderer; + +import javax.swing.*; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class JmeSystemDelegateImpl implements JmeSystemDelegate{ + + private static final Logger logger = Logger.getLogger(JmeSystemDelegateImpl.class.getName()); + private boolean initialized = false; + private boolean lowPermissions = false; + + public boolean trackDirectMemory() { + return false; + } + + public void setLowPermissions(boolean lowPerm) { + lowPermissions = lowPerm; + } + + public boolean isLowPermissions() { + return lowPermissions; + } + + public AssetManager newAssetManager(URL configFile) { + return new DesktopAssetManager(configFile); + } + + public AssetManager newAssetManager() { + return new DesktopAssetManager(null); + } + + public boolean showSettingsDialog(AppSettings sourceSettings, final boolean loadFromRegistry) { + if (SwingUtilities.isEventDispatchThread()) { + throw new IllegalStateException("Cannot run from EDT"); + } + + + final AppSettings settings = new AppSettings(false); + settings.copyFrom(sourceSettings); + String iconPath = sourceSettings.getSettingsDialogImage(); + final URL iconUrl = JmeSystem.class.getResource(iconPath.startsWith("/") ? iconPath : "/" + iconPath); + if (iconUrl == null) { + throw new AssetNotFoundException(sourceSettings.getSettingsDialogImage()); + } + + final AtomicBoolean done = new AtomicBoolean(); + final AtomicInteger result = new AtomicInteger(); + final Object lock = new Object(); + + final SelectionListener selectionListener = new SelectionListener() { + + public void onSelection(int selection) { + synchronized (lock) { + done.set(true); + result.set(selection); + lock.notifyAll(); + } + } + }; + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + synchronized (lock) { + SettingsDialog dialog = new SettingsDialog(settings, iconUrl, loadFromRegistry); + dialog.setSelectionListener(selectionListener); + dialog.showDialog(); + } + } + }); + + synchronized (lock) { + while (!done.get()) { + try { + lock.wait(); + } catch (InterruptedException ex) { + } + } + } + + sourceSettings.copyFrom(settings); + + return result.get() == SettingsDialog.APPROVE_SELECTION; + } + + private boolean is64Bit(String arch) { + if (arch.equals("x86")) { + return false; + } else if (arch.equals("amd64")) { + return true; + } else if (arch.equals("x86_64")) { + return true; + } else if (arch.equals("ppc") || arch.equals("PowerPC")) { + return false; + } else if (arch.equals("ppc64")) { + return true; + } else if (arch.equals("i386") || arch.equals("i686")) { + return false; + } else if (arch.equals("universal")) { + return false; + } else { + throw new UnsupportedOperationException("Unsupported architecture: " + arch); + } + } + + public Platform getPlatform() { + String os = System.getProperty("os.name").toLowerCase(); + String arch = System.getProperty("os.arch").toLowerCase(); + logger.log(Level.INFO,"os = "+os+" arch = "+arch); + boolean is64 = is64Bit(arch); + if (os.contains("windows")) { + return is64 ? Platform.Windows64 : Platform.Windows32; + } else if (os.contains("linux") || os.contains("freebsd")) { + return is64 ? Platform.Linux64 : Platform.Linux32; + } else if (os.contains("mac os x") || os.contains("darwin")) { + if (arch.startsWith("ppc")) { + return is64 ? Platform.MacOSX_PPC64 : Platform.MacOSX_PPC32; + } else { + return is64 ? Platform.MacOSX64 : Platform.MacOSX32; + } + } else if (os.contains("sunos")) { + return is64 ? Platform.SolarisAMD64 : Platform.SolarisX86; + } else { + throw new UnsupportedOperationException("The specified platform: " + os + " is not supported."); + } + } + + private JmeContext newContextLwjgl(AppSettings settings, JmeContext.Type type) { + try { + Class ctxClazz = null; + switch (type) { + case Canvas: + ctxClazz = (Class) Class.forName("com.jme3.system.lwjgl.LwjglCanvas"); + break; + case Display: + ctxClazz = (Class) Class.forName("com.jme3.system.lwjgl.LwjglDisplay"); + break; + case OffscreenSurface: + ctxClazz = (Class) Class.forName("com.jme3.system.lwjgl.LwjglOffscreenBuffer"); + break; + default: + throw new IllegalArgumentException("Unsupported context type " + type); + } + + return ctxClazz.newInstance(); + } catch (InstantiationException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (IllegalAccessException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (ClassNotFoundException ex) { + logger.log(Level.SEVERE, "CRITICAL ERROR: Context class is missing!\n" + + "Make sure jme3_lwjgl-ogl is on the classpath.", ex); + } + + return null; + } + + private JmeContext newContextJogl(AppSettings settings, JmeContext.Type type) { + try { + Class ctxClazz = null; + switch (type) { + case Display: + ctxClazz = (Class) Class.forName("com.jme3.system.jogl.JoglDisplay"); + break; + case Canvas: + ctxClazz = (Class) Class.forName("com.jme3.system.jogl.JoglCanvas"); + break; + default: + throw new IllegalArgumentException("Unsupported context type " + type); + } + + return ctxClazz.newInstance(); + } catch (InstantiationException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (IllegalAccessException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (ClassNotFoundException ex) { + logger.log(Level.SEVERE, "CRITICAL ERROR: Context class is missing!\n" + + "Make sure jme3_jogl is on the classpath.", ex); + } + + return null; + } + + private JmeContext newContextCustom(AppSettings settings, JmeContext.Type type) { + try { + String className = settings.getRenderer().substring("CUSTOM".length()); + + Class ctxClazz = null; + ctxClazz = (Class) Class.forName(className); + return ctxClazz.newInstance(); + } catch (InstantiationException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (IllegalAccessException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (ClassNotFoundException ex) { + logger.log(Level.SEVERE, "CRITICAL ERROR: Context class is missing!", ex); + } + + return null; + } + + public JmeContext newContext(AppSettings settings, JmeContext.Type contextType) { + initialize(settings); + JmeContext ctx; + if (settings.getRenderer() == null + || settings.getRenderer().equals("NULL") + || contextType == JmeContext.Type.Headless) { + ctx = new NullContext(); + ctx.setSettings(settings); + } else if (settings.getRenderer().startsWith("LWJGL")) { + ctx = newContextLwjgl(settings, contextType); + ctx.setSettings(settings); + } else if (settings.getRenderer().startsWith("JOGL")) { + ctx = newContextJogl(settings, contextType); + ctx.setSettings(settings); + } else if (settings.getRenderer().startsWith("CUSTOM")) { + ctx = newContextCustom(settings, contextType); + ctx.setSettings(settings); + } else { + throw new UnsupportedOperationException( + "Unrecognizable renderer specified: " + + settings.getRenderer()); + } + return ctx; + } + + public AudioRenderer newAudioRenderer(AppSettings settings) { + initialize(settings); + Class clazz = null; + try { + if (settings.getAudioRenderer().startsWith("LWJGL")) { + clazz = (Class) Class.forName("com.jme3.audio.lwjgl.LwjglAudioRenderer"); + } else if (settings.getAudioRenderer().startsWith("JOAL")) { + clazz = (Class) Class.forName("com.jme3.audio.joal.JoalAudioRenderer"); + } else { + throw new UnsupportedOperationException( + "Unrecognizable audio renderer specified: " + + settings.getAudioRenderer()); + } + + AudioRenderer ar = clazz.newInstance(); + return ar; + } catch (InstantiationException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (IllegalAccessException ex) { + logger.log(Level.SEVERE, "Failed to create context", ex); + } catch (ClassNotFoundException ex) { + logger.log(Level.SEVERE, "CRITICAL ERROR: Audio implementation class is missing!\n" + + "Make sure jme3_lwjgl-oal or jm3_joal is on the classpath.", ex); + } + return null; + } + + public void initialize(AppSettings settings) { + if (initialized) { + return; + } + + initialized = true; + try { + if (!lowPermissions) { + // can only modify logging settings + // if permissions are available +// JmeFormatter formatter = new JmeFormatter(); +// Handler fileHandler = new FileHandler("jme.log"); +// fileHandler.setFormatter(formatter); +// Logger.getLogger("").addHandler(fileHandler); +// Handler consoleHandler = new ConsoleHandler(); +// consoleHandler.setFormatter(formatter); +// Logger.getLogger("").removeHandler(Logger.getLogger("").getHandlers()[0]); +// Logger.getLogger("").addHandler(consoleHandler); + } +// } catch (IOException ex){ +// logger.log(Level.SEVERE, "I/O Error while creating log file", ex); + } catch (SecurityException ex) { + logger.log(Level.SEVERE, "Security error in creating log file", ex); + } + logger.log(Level.INFO, "Running on {0} chototsu", getFullName()); + + + if (!lowPermissions) { + try { + Natives.extractNativeLibs(getPlatform(), settings); + } catch (IOException ex) { + logger.log(Level.SEVERE, "Error while copying native libraries", ex); + } + } + } + + public String getFullName() { + return "jMonkeyEngine 3.0.0 Beta"; + } + + public InputStream getResourceAsStream(String name) { + return JmeSystem.class.getResourceAsStream(name); + } + + public URL getResource(String name) { + return JmeSystem.class.getResource(name); + } +} diff --git a/engine/src/desktop/com/jme3/system/Natives.java b/desktop/src/main/java/com/jme3/system/Natives.java similarity index 98% rename from engine/src/desktop/com/jme3/system/Natives.java rename to desktop/src/main/java/com/jme3/system/Natives.java index 82fdec521..135abbdbd 100644 --- a/engine/src/desktop/com/jme3/system/Natives.java +++ b/desktop/src/main/java/com/jme3/system/Natives.java @@ -31,12 +31,7 @@ */ package com.jme3.system; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; diff --git a/engine/src/desktop/com/jme3/system/awt/AwtPanel.java b/desktop/src/main/java/com/jme3/system/awt/AwtPanel.java similarity index 97% rename from engine/src/desktop/com/jme3/system/awt/AwtPanel.java rename to desktop/src/main/java/com/jme3/system/awt/AwtPanel.java index d80e24792..79beec831 100644 --- a/engine/src/desktop/com/jme3/system/awt/AwtPanel.java +++ b/desktop/src/main/java/com/jme3/system/awt/AwtPanel.java @@ -8,13 +8,8 @@ import com.jme3.texture.FrameBuffer; import com.jme3.texture.Image.Format; import com.jme3.util.BufferUtils; import com.jme3.util.Screenshots; -import java.awt.AWTException; -import java.awt.BufferCapabilities; -import java.awt.Canvas; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.ImageCapabilities; -import java.awt.RenderingHints; + +import java.awt.*; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.geom.AffineTransform; diff --git a/engine/src/desktop/com/jme3/system/awt/AwtPanelsContext.java b/desktop/src/main/java/com/jme3/system/awt/AwtPanelsContext.java similarity index 96% rename from engine/src/desktop/com/jme3/system/awt/AwtPanelsContext.java rename to desktop/src/main/java/com/jme3/system/awt/AwtPanelsContext.java index 56c7289f7..9a072d078 100644 --- a/engine/src/desktop/com/jme3/system/awt/AwtPanelsContext.java +++ b/desktop/src/main/java/com/jme3/system/awt/AwtPanelsContext.java @@ -7,11 +7,8 @@ import com.jme3.input.TouchInput; import com.jme3.input.awt.AwtKeyInput; import com.jme3.input.awt.AwtMouseInput; import com.jme3.renderer.Renderer; -import com.jme3.system.AppSettings; -import com.jme3.system.JmeContext; -import com.jme3.system.JmeSystem; -import com.jme3.system.SystemListener; -import com.jme3.system.Timer; +import com.jme3.system.*; + import java.util.ArrayList; public class AwtPanelsContext implements JmeContext { diff --git a/engine/src/desktop/com/jme3/system/awt/PaintMode.java b/desktop/src/main/java/com/jme3/system/awt/PaintMode.java similarity index 100% rename from engine/src/desktop/com/jme3/system/awt/PaintMode.java rename to desktop/src/main/java/com/jme3/system/awt/PaintMode.java diff --git a/desktop/src/main/resources/native/linux/libbulletjme.so b/desktop/src/main/resources/native/linux/libbulletjme.so new file mode 100644 index 000000000..600af2c95 Binary files /dev/null and b/desktop/src/main/resources/native/linux/libbulletjme.so differ diff --git a/desktop/src/main/resources/native/linux/libbulletjme64.so b/desktop/src/main/resources/native/linux/libbulletjme64.so new file mode 100644 index 000000000..17cc24148 Binary files /dev/null and b/desktop/src/main/resources/native/linux/libbulletjme64.so differ diff --git a/desktop/src/main/resources/native/linux/libjinput-linux.so b/desktop/src/main/resources/native/linux/libjinput-linux.so new file mode 100644 index 000000000..3cdc43973 Binary files /dev/null and b/desktop/src/main/resources/native/linux/libjinput-linux.so differ diff --git a/desktop/src/main/resources/native/linux/libjinput-linux64.so b/desktop/src/main/resources/native/linux/libjinput-linux64.so new file mode 100644 index 000000000..de1ee5f3c Binary files /dev/null and b/desktop/src/main/resources/native/linux/libjinput-linux64.so differ diff --git a/desktop/src/main/resources/native/linux/liblwjgl.so b/desktop/src/main/resources/native/linux/liblwjgl.so new file mode 100644 index 000000000..79a5e93f5 Binary files /dev/null and b/desktop/src/main/resources/native/linux/liblwjgl.so differ diff --git a/desktop/src/main/resources/native/linux/liblwjgl64.so b/desktop/src/main/resources/native/linux/liblwjgl64.so new file mode 100644 index 000000000..e3189e21b Binary files /dev/null and b/desktop/src/main/resources/native/linux/liblwjgl64.so differ diff --git a/desktop/src/main/resources/native/linux/libopenal.so b/desktop/src/main/resources/native/linux/libopenal.so new file mode 100644 index 000000000..0a3a619b4 Binary files /dev/null and b/desktop/src/main/resources/native/linux/libopenal.so differ diff --git a/desktop/src/main/resources/native/linux/libopenal64.so b/desktop/src/main/resources/native/linux/libopenal64.so new file mode 100644 index 000000000..e0693c01a Binary files /dev/null and b/desktop/src/main/resources/native/linux/libopenal64.so differ diff --git a/desktop/src/main/resources/native/macosx/libbulletjme.jnilib b/desktop/src/main/resources/native/macosx/libbulletjme.jnilib new file mode 100644 index 000000000..6f270e851 Binary files /dev/null and b/desktop/src/main/resources/native/macosx/libbulletjme.jnilib differ diff --git a/desktop/src/main/resources/native/macosx/libjinput-osx.jnilib b/desktop/src/main/resources/native/macosx/libjinput-osx.jnilib new file mode 100644 index 000000000..59a3eab5e Binary files /dev/null and b/desktop/src/main/resources/native/macosx/libjinput-osx.jnilib differ diff --git a/desktop/src/main/resources/native/macosx/liblwjgl.jnilib b/desktop/src/main/resources/native/macosx/liblwjgl.jnilib new file mode 100644 index 000000000..6745b83d7 Binary files /dev/null and b/desktop/src/main/resources/native/macosx/liblwjgl.jnilib differ diff --git a/desktop/src/main/resources/native/macosx/libopenal.dylib b/desktop/src/main/resources/native/macosx/libopenal.dylib new file mode 100644 index 000000000..3c6d0f7f4 Binary files /dev/null and b/desktop/src/main/resources/native/macosx/libopenal.dylib differ diff --git a/desktop/src/main/resources/native/macosx/openal.dylib b/desktop/src/main/resources/native/macosx/openal.dylib new file mode 100644 index 000000000..cb8e45846 Binary files /dev/null and b/desktop/src/main/resources/native/macosx/openal.dylib differ diff --git a/desktop/src/main/resources/native/solaris/libbulletjme.so b/desktop/src/main/resources/native/solaris/libbulletjme.so new file mode 100644 index 000000000..1b586adca Binary files /dev/null and b/desktop/src/main/resources/native/solaris/libbulletjme.so differ diff --git a/desktop/src/main/resources/native/solaris/libbulletjme64.so b/desktop/src/main/resources/native/solaris/libbulletjme64.so new file mode 100644 index 000000000..b111ed650 Binary files /dev/null and b/desktop/src/main/resources/native/solaris/libbulletjme64.so differ diff --git a/desktop/src/main/resources/native/solaris/liblwjgl.so b/desktop/src/main/resources/native/solaris/liblwjgl.so new file mode 100644 index 000000000..052180168 Binary files /dev/null and b/desktop/src/main/resources/native/solaris/liblwjgl.so differ diff --git a/desktop/src/main/resources/native/solaris/liblwjgl64.so b/desktop/src/main/resources/native/solaris/liblwjgl64.so new file mode 100644 index 000000000..18ba304c5 Binary files /dev/null and b/desktop/src/main/resources/native/solaris/liblwjgl64.so differ diff --git a/desktop/src/main/resources/native/solaris/libopenal.so b/desktop/src/main/resources/native/solaris/libopenal.so new file mode 100644 index 000000000..be5dbce01 Binary files /dev/null and b/desktop/src/main/resources/native/solaris/libopenal.so differ diff --git a/desktop/src/main/resources/native/solaris/libopenal64.so b/desktop/src/main/resources/native/solaris/libopenal64.so new file mode 100644 index 000000000..3ef75b5ce Binary files /dev/null and b/desktop/src/main/resources/native/solaris/libopenal64.so differ diff --git a/desktop/src/main/resources/native/windows/OpenAL32.dll b/desktop/src/main/resources/native/windows/OpenAL32.dll new file mode 100644 index 000000000..1f69e9454 Binary files /dev/null and b/desktop/src/main/resources/native/windows/OpenAL32.dll differ diff --git a/desktop/src/main/resources/native/windows/OpenAL64.dll b/desktop/src/main/resources/native/windows/OpenAL64.dll new file mode 100644 index 000000000..6f2a2fe13 Binary files /dev/null and b/desktop/src/main/resources/native/windows/OpenAL64.dll differ diff --git a/desktop/src/main/resources/native/windows/bulletjme.dll b/desktop/src/main/resources/native/windows/bulletjme.dll new file mode 100644 index 000000000..e14f709da Binary files /dev/null and b/desktop/src/main/resources/native/windows/bulletjme.dll differ diff --git a/desktop/src/main/resources/native/windows/bulletjme.lib b/desktop/src/main/resources/native/windows/bulletjme.lib new file mode 100644 index 000000000..7b80f082a Binary files /dev/null and b/desktop/src/main/resources/native/windows/bulletjme.lib differ diff --git a/desktop/src/main/resources/native/windows/bulletjme64.dll b/desktop/src/main/resources/native/windows/bulletjme64.dll new file mode 100644 index 000000000..ed44912fe Binary files /dev/null and b/desktop/src/main/resources/native/windows/bulletjme64.dll differ diff --git a/desktop/src/main/resources/native/windows/bulletjme64.lib b/desktop/src/main/resources/native/windows/bulletjme64.lib new file mode 100644 index 000000000..e8c494af7 Binary files /dev/null and b/desktop/src/main/resources/native/windows/bulletjme64.lib differ diff --git a/desktop/src/main/resources/native/windows/jinput-dx8.dll b/desktop/src/main/resources/native/windows/jinput-dx8.dll new file mode 100644 index 000000000..6d27ad5eb Binary files /dev/null and b/desktop/src/main/resources/native/windows/jinput-dx8.dll differ diff --git a/desktop/src/main/resources/native/windows/jinput-dx8_64.dll b/desktop/src/main/resources/native/windows/jinput-dx8_64.dll new file mode 100644 index 000000000..67305896d Binary files /dev/null and b/desktop/src/main/resources/native/windows/jinput-dx8_64.dll differ diff --git a/desktop/src/main/resources/native/windows/jinput-raw.dll b/desktop/src/main/resources/native/windows/jinput-raw.dll new file mode 100644 index 000000000..ce1d16201 Binary files /dev/null and b/desktop/src/main/resources/native/windows/jinput-raw.dll differ diff --git a/desktop/src/main/resources/native/windows/jinput-raw_64.dll b/desktop/src/main/resources/native/windows/jinput-raw_64.dll new file mode 100644 index 000000000..3d2b3ada9 Binary files /dev/null and b/desktop/src/main/resources/native/windows/jinput-raw_64.dll differ diff --git a/desktop/src/main/resources/native/windows/lwjgl.dll b/desktop/src/main/resources/native/windows/lwjgl.dll new file mode 100644 index 000000000..b20daef5b Binary files /dev/null and b/desktop/src/main/resources/native/windows/lwjgl.dll differ diff --git a/desktop/src/main/resources/native/windows/lwjgl64.dll b/desktop/src/main/resources/native/windows/lwjgl64.dll new file mode 100644 index 000000000..a6025c635 Binary files /dev/null and b/desktop/src/main/resources/native/windows/lwjgl64.dll differ diff --git a/engine/build.sbt b/engine/build.sbt new file mode 100644 index 000000000..b25ff608f --- /dev/null +++ b/engine/build.sbt @@ -0,0 +1,47 @@ +import sbt.Keys._ + +Common.settings + +name := "mms-engine" + +unmanagedSourceDirectories in Compile := Seq( +// baseDirectory.value / "src/blender" + baseDirectory.value / "src/bullet" + , baseDirectory.value / "src/core" + , baseDirectory.value / "src/core-data" + , baseDirectory.value / "src/core-effects" + , baseDirectory.value / "src/core-plugins" + , baseDirectory.value / "src/desktop" + , baseDirectory.value / "src/desktop-fx" + , baseDirectory.value / "src/games" +// , baseDirectory.value / "src/jheora" +// , baseDirectory.value / "src/lwjgl-oal" +// , baseDirectory.value / "src/lwjgl-ogl" + , baseDirectory.value / "src/mmd" + , baseDirectory.value / "src/networking" +// , baseDirectory.value / "src/niftygui" + , baseDirectory.value / "src/ogre" + , baseDirectory.value / "src/pack" + , baseDirectory.value / "src/tools" + , baseDirectory.value / "src/terrain" + , baseDirectory.value / "src/xml" +) + +sources in Compile ~= { + dirs => dirs filter(file => (!file.getAbsolutePath.contains("cinematic"))) +} + +unmanagedResourceDirectories in Compile <<= unmanagedSourceDirectories in Compile + +unmanagedResources in Compile ~= { + dirs => dirs filter(file => (!file.getAbsolutePath.endsWith(".java") && !file.getAbsolutePath.endsWith(".scala"))) +} + +//unmanagedBase := baseDirectory.value / "lib2" + +libraryDependencies += "java3d" % "vecmath" % "1.3.1" + +libraryDependencies += "xpp3" % "xpp3" % "1.1.4c" + +libraryDependencies += "com.jme3" % "noise" % "3.0.0-SNAPSHOT" + diff --git a/engine/lib/MMDLoaderJME3-javadoc.jar b/engine/lib/MMDLoaderJME3-javadoc.jar deleted file mode 100644 index 9162f81ec..000000000 Binary files a/engine/lib/MMDLoaderJME3-javadoc.jar and /dev/null differ diff --git a/engine/lib/MMDLoaderJME3-lib.jar b/engine/lib/MMDLoaderJME3-lib.jar deleted file mode 100644 index 6c9fa25e5..000000000 Binary files a/engine/lib/MMDLoaderJME3-lib.jar and /dev/null differ diff --git a/engine/lib/MMDLoaderJME3-source.jar b/engine/lib/MMDLoaderJME3-source.jar deleted file mode 100644 index d9bfa2efe..000000000 Binary files a/engine/lib/MMDLoaderJME3-source.jar and /dev/null differ diff --git a/engine/src/core/com/jme3/app/Application.java b/engine/src/core/com/jme3/app/Application.java index b39fa3aed..9503f45ae 100644 --- a/engine/src/core/com/jme3/app/Application.java +++ b/engine/src/core/com/jme3/app/Application.java @@ -48,7 +48,6 @@ import com.jme3.input.InputManager; import com.jme3.renderer.RenderManager; import com.jme3.renderer.ViewPort; import com.jme3.system.AppSettings; -import com.jme3.system.JmeCanvasContext; import com.jme3.system.JmeContext; import java.net.MalformedURLException; import java.net.URL; diff --git a/engine/src/desktop/com/jme3/system/JmeSystem.java b/engine/src/desktop/com/jme3/system/JmeSystem.java index c759c663a..865906956 100644 --- a/engine/src/desktop/com/jme3/system/JmeSystem.java +++ b/engine/src/desktop/com/jme3/system/JmeSystem.java @@ -31,314 +31,86 @@ */ package com.jme3.system; -import com.jme3.app.SettingsDialog; -import com.jme3.app.SettingsDialog.SelectionListener; import com.jme3.asset.AssetManager; -import com.jme3.asset.AssetNotFoundException; -import com.jme3.asset.DesktopAssetManager; import com.jme3.audio.AudioRenderer; -import java.io.IOException; + import java.io.InputStream; import java.net.URL; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.logging.Level; import java.util.logging.Logger; -import javax.swing.SwingUtilities; public class JmeSystem { private static final Logger logger = Logger.getLogger(JmeSystem.class.getName()); private static boolean initialized = false; - private static boolean lowPermissions = false; + + private static JmeSystemDelegate delegate; + + static { + try { + delegate = (JmeSystemDelegate) Class.forName("com.jme3.system.JmeSystemDelegateImpl").newInstance(); + } catch (Exception ex) { + throw new RuntimeException("initialize failed.", ex); + } + } public static boolean trackDirectMemory() { return false; } + public static JmeSystemDelegate getDelegate() { + return delegate; + } + + public static void setDelegate(JmeSystemDelegate delegate) { + JmeSystem.delegate = delegate; + } + public static void setLowPermissions(boolean lowPerm) { - lowPermissions = lowPerm; + delegate.setLowPermissions(lowPerm); } public static boolean isLowPermissions() { - return lowPermissions; + return delegate.isLowPermissions(); } public static AssetManager newAssetManager(URL configFile) { - return new DesktopAssetManager(configFile); + return delegate.newAssetManager(configFile); } public static AssetManager newAssetManager() { - return new DesktopAssetManager(null); + return delegate.newAssetManager(null); } public static boolean showSettingsDialog(AppSettings sourceSettings, final boolean loadFromRegistry) { - if (SwingUtilities.isEventDispatchThread()) { - throw new IllegalStateException("Cannot run from EDT"); - } - - - final AppSettings settings = new AppSettings(false); - settings.copyFrom(sourceSettings); - String iconPath = sourceSettings.getSettingsDialogImage(); - final URL iconUrl = JmeSystem.class.getResource(iconPath.startsWith("/") ? iconPath : "/" + iconPath); - if (iconUrl == null) { - throw new AssetNotFoundException(sourceSettings.getSettingsDialogImage()); - } - - final AtomicBoolean done = new AtomicBoolean(); - final AtomicInteger result = new AtomicInteger(); - final Object lock = new Object(); - - final SelectionListener selectionListener = new SelectionListener() { - - public void onSelection(int selection) { - synchronized (lock) { - done.set(true); - result.set(selection); - lock.notifyAll(); - } - } - }; - SwingUtilities.invokeLater(new Runnable() { - - public void run() { - synchronized (lock) { - SettingsDialog dialog = new SettingsDialog(settings, iconUrl, loadFromRegistry); - dialog.setSelectionListener(selectionListener); - dialog.showDialog(); - } - } - }); - - synchronized (lock) { - while (!done.get()) { - try { - lock.wait(); - } catch (InterruptedException ex) { - } - } - } - - sourceSettings.copyFrom(settings); - - return result.get() == SettingsDialog.APPROVE_SELECTION; - } - - private static boolean is64Bit(String arch) { - if (arch.equals("x86")) { - return false; - } else if (arch.equals("amd64")) { - return true; - } else if (arch.equals("x86_64")) { - return true; - } else if (arch.equals("ppc") || arch.equals("PowerPC")) { - return false; - } else if (arch.equals("ppc64")) { - return true; - } else if (arch.equals("i386") || arch.equals("i686")) { - return false; - } else if (arch.equals("universal")) { - return false; - } else { - throw new UnsupportedOperationException("Unsupported architecture: " + arch); - } + return delegate.showSettingsDialog(sourceSettings, loadFromRegistry); } public static Platform getPlatform() { - String os = System.getProperty("os.name").toLowerCase(); - String arch = System.getProperty("os.arch").toLowerCase(); - logger.log(Level.INFO,"os = "+os+" arch = "+arch); - boolean is64 = is64Bit(arch); - if (os.contains("windows")) { - return is64 ? Platform.Windows64 : Platform.Windows32; - } else if (os.contains("linux") || os.contains("freebsd")) { - return is64 ? Platform.Linux64 : Platform.Linux32; - } else if (os.contains("mac os x") || os.contains("darwin")) { - if (arch.startsWith("ppc")) { - return is64 ? Platform.MacOSX_PPC64 : Platform.MacOSX_PPC32; - } else { - return is64 ? Platform.MacOSX64 : Platform.MacOSX32; - } - } else if (os.contains("sunos")) { - return is64 ? Platform.SolarisAMD64 : Platform.SolarisX86; - } else { - throw new UnsupportedOperationException("The specified platform: " + os + " is not supported."); - } - } - - private static JmeContext newContextLwjgl(AppSettings settings, JmeContext.Type type) { - try { - Class ctxClazz = null; - switch (type) { - case Canvas: - ctxClazz = (Class) Class.forName("com.jme3.system.lwjgl.LwjglCanvas"); - break; - case Display: - ctxClazz = (Class) Class.forName("com.jme3.system.lwjgl.LwjglDisplay"); - break; - case OffscreenSurface: - ctxClazz = (Class) Class.forName("com.jme3.system.lwjgl.LwjglOffscreenBuffer"); - break; - default: - throw new IllegalArgumentException("Unsupported context type " + type); - } - - return ctxClazz.newInstance(); - } catch (InstantiationException ex) { - logger.log(Level.SEVERE, "Failed to create context", ex); - } catch (IllegalAccessException ex) { - logger.log(Level.SEVERE, "Failed to create context", ex); - } catch (ClassNotFoundException ex) { - logger.log(Level.SEVERE, "CRITICAL ERROR: Context class is missing!\n" - + "Make sure jme3_lwjgl-ogl is on the classpath.", ex); - } - - return null; - } - - private static JmeContext newContextJogl(AppSettings settings, JmeContext.Type type) { - try { - Class ctxClazz = null; - switch (type) { - case Display: - ctxClazz = (Class) Class.forName("com.jme3.system.jogl.JoglDisplay"); - break; - case Canvas: - ctxClazz = (Class) Class.forName("com.jme3.system.jogl.JoglCanvas"); - break; - default: - throw new IllegalArgumentException("Unsupported context type " + type); - } - - return ctxClazz.newInstance(); - } catch (InstantiationException ex) { - logger.log(Level.SEVERE, "Failed to create context", ex); - } catch (IllegalAccessException ex) { - logger.log(Level.SEVERE, "Failed to create context", ex); - } catch (ClassNotFoundException ex) { - logger.log(Level.SEVERE, "CRITICAL ERROR: Context class is missing!\n" - + "Make sure jme3_jogl is on the classpath.", ex); - } - - return null; - } - - private static JmeContext newContextCustom(AppSettings settings, JmeContext.Type type) { - try { - String className = settings.getRenderer().substring("CUSTOM".length()); - - Class ctxClazz = null; - ctxClazz = (Class) Class.forName(className); - return ctxClazz.newInstance(); - } catch (InstantiationException ex) { - logger.log(Level.SEVERE, "Failed to create context", ex); - } catch (IllegalAccessException ex) { - logger.log(Level.SEVERE, "Failed to create context", ex); - } catch (ClassNotFoundException ex) { - logger.log(Level.SEVERE, "CRITICAL ERROR: Context class is missing!", ex); - } - - return null; + return delegate.getPlatform(); } public static JmeContext newContext(AppSettings settings, JmeContext.Type contextType) { - initialize(settings); - JmeContext ctx; - if (settings.getRenderer() == null - || settings.getRenderer().equals("NULL") - || contextType == JmeContext.Type.Headless) { - ctx = new NullContext(); - ctx.setSettings(settings); - } else if (settings.getRenderer().startsWith("LWJGL")) { - ctx = newContextLwjgl(settings, contextType); - ctx.setSettings(settings); - } else if (settings.getRenderer().startsWith("JOGL")) { - ctx = newContextJogl(settings, contextType); - ctx.setSettings(settings); - } else if (settings.getRenderer().startsWith("CUSTOM")) { - ctx = newContextCustom(settings, contextType); - ctx.setSettings(settings); - } else { - throw new UnsupportedOperationException( - "Unrecognizable renderer specified: " - + settings.getRenderer()); - } - return ctx; + return delegate.newContext(settings, contextType); } public static AudioRenderer newAudioRenderer(AppSettings settings) { - initialize(settings); - Class clazz = null; - try { - if (settings.getAudioRenderer().startsWith("LWJGL")) { - clazz = (Class) Class.forName("com.jme3.audio.lwjgl.LwjglAudioRenderer"); - } else if (settings.getAudioRenderer().startsWith("JOAL")) { - clazz = (Class) Class.forName("com.jme3.audio.joal.JoalAudioRenderer"); - } else { - throw new UnsupportedOperationException( - "Unrecognizable audio renderer specified: " - + settings.getAudioRenderer()); - } - - AudioRenderer ar = clazz.newInstance(); - return ar; - } catch (InstantiationException ex) { - logger.log(Level.SEVERE, "Failed to create context", ex); - } catch (IllegalAccessException ex) { - logger.log(Level.SEVERE, "Failed to create context", ex); - } catch (ClassNotFoundException ex) { - logger.log(Level.SEVERE, "CRITICAL ERROR: Audio implementation class is missing!\n" - + "Make sure jme3_lwjgl-oal or jm3_joal is on the classpath.", ex); - } - return null; + return delegate.newAudioRenderer(settings); } public static void initialize(AppSettings settings) { - if (initialized) { - return; - } - + delegate.initialize(settings); initialized = true; - try { - if (!lowPermissions) { - // can only modify logging settings - // if permissions are available -// JmeFormatter formatter = new JmeFormatter(); -// Handler fileHandler = new FileHandler("jme.log"); -// fileHandler.setFormatter(formatter); -// Logger.getLogger("").addHandler(fileHandler); -// Handler consoleHandler = new ConsoleHandler(); -// consoleHandler.setFormatter(formatter); -// Logger.getLogger("").removeHandler(Logger.getLogger("").getHandlers()[0]); -// Logger.getLogger("").addHandler(consoleHandler); - } -// } catch (IOException ex){ -// logger.log(Level.SEVERE, "I/O Error while creating log file", ex); - } catch (SecurityException ex) { - logger.log(Level.SEVERE, "Security error in creating log file", ex); - } - logger.log(Level.INFO, "Running on {0} chototsu", getFullName()); - - - if (!lowPermissions) { - try { - Natives.extractNativeLibs(getPlatform(), settings); - } catch (IOException ex) { - logger.log(Level.SEVERE, "Error while copying native libraries", ex); - } - } } public static String getFullName() { - return "jMonkeyEngine 3.0.0 Beta"; + return delegate.getFullName(); } public static InputStream getResourceAsStream(String name) { - return JmeSystem.class.getResourceAsStream(name); + return delegate.getResourceAsStream(name); } public static URL getResource(String name) { - return JmeSystem.class.getResource(name); + return delegate.getResource(name); } } diff --git a/engine/src/desktop/com/jme3/system/JmeSystemDelegate.java b/engine/src/desktop/com/jme3/system/JmeSystemDelegate.java new file mode 100644 index 000000000..dd414586a --- /dev/null +++ b/engine/src/desktop/com/jme3/system/JmeSystemDelegate.java @@ -0,0 +1,36 @@ +package com.jme3.system; + +import com.jme3.asset.AssetManager; +import com.jme3.audio.AudioRenderer; + +import java.io.InputStream; +import java.net.URL; + +/** + * Created by kobayasi on 2014/02/17. + */ +public interface JmeSystemDelegate { + public void setLowPermissions(boolean lowPerm); + + public boolean isLowPermissions(); + + public AssetManager newAssetManager(URL configFile); + + public AssetManager newAssetManager(); + + public boolean showSettingsDialog(AppSettings sourceSettings, final boolean loadFromRegistry); + + public Platform getPlatform(); + + public JmeContext newContext(AppSettings settings, JmeContext.Type contextType); + + public AudioRenderer newAudioRenderer(AppSettings settings); + + public void initialize(AppSettings settings); + + public String getFullName(); + + public InputStream getResourceAsStream(String name); + + public URL getResource(String name); +} \ No newline at end of file diff --git a/niftygui/build.sbt b/niftygui/build.sbt new file mode 100644 index 000000000..e60d73f79 --- /dev/null +++ b/niftygui/build.sbt @@ -0,0 +1,19 @@ +import sbt.Keys._ + +Common.settings + +name := "mms-niftygui-support" + +unmanagedSourceDirectories in Compile := Seq( + baseDirectory.value / "../engine/src/niftygui" + , baseDirectory.value / "../engine/src/core/com/jme3/cinematic" +) + +libraryDependencies += "lessvoid" % "nifty" % "1.3.3" + + +//sources in Compile ~= { +// dirs => dirs filter(_.getAbsolutePath.contains("cinematic")) +//} + +//unmanagedBase := baseDirectory.value / "lib2" diff --git a/project/Common.scala b/project/Common.scala new file mode 100644 index 000000000..2101187ab --- /dev/null +++ b/project/Common.scala @@ -0,0 +1,16 @@ +import sbt._ +import sbt.Keys._ + +object Common { + lazy val settings = Seq( + organization := "info.projectkyoto" + , version := "1.0.0-SNAPSHOT" + , autoScalaLibrary := false + , crossPaths := false + , javacOptions ++= Seq("-encoding", "UTF-8", "-source", "1.6", "-target", "1.6") + , javacOptions in doc := Seq("-locale", "en_US", "-encoding", "UTF-8", "-source", "1.6") + , resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots" + , resolvers += "nifty-maven-repo.sourceforge.net" at "http://nifty-gui.sourceforge.net/nifty-maven-repo" + ) +} + diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 000000000..1bb3aa332 --- /dev/null +++ b/project/build.properties @@ -0,0 +1,2 @@ +sbt.version=0.13.1 + diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 000000000..24369e627 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0") +