| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <title>Starting a JME3 application from the command-line :: jMonkeyEngine Docs</title>
- <link rel="canonical" href="https://wiki.jmonkeyengine.org/docs/jme3/simpleapplication_from_the_commandline.html">
- <meta name="keywords" content="documentation, install">
- <meta name="generator" content="Antora 2.3.3">
- <link rel="stylesheet" href="../../_/css/site.css">
- <meta property="og:image" content="https://wiki.jmonkeyengine.org/_/img/iconx128.png">
- <meta property="og:description" content="Starting a JME3 application from the command-line">
- <meta property="og:title" content="jMonkeyEngine Docs">
- <link rel="stylesheet" href="../../_/css/site-extra.css">
- <link rel="stylesheet" href="../../_/css/vendor/docsearch.min.css">
- <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css -->
- <link rel="icon" href="../../_/img/favicon.ico" type="image/x-icon">
- </head>
- <body class="article">
- <header class="header">
- <nav class="navbar">
- <div class="navbar-brand">
- <a class="navbar-item" href="https://wiki.jmonkeyengine.org">
- <img alt="" src="../../_/img/jme-logo.png" height="32" type="image/x-icon">
- </a>
- <div class="navbar-item hide-for-print">
- <input id="search-input" type="text" placeholder="Search docs">
- </div>
- <button class="navbar-burger" data-target="topbar-nav">
- <span></span>
- <span></span>
- <span></span>
- </button>
- </div>
- <div id="topbar-nav" class="navbar-menu">
- <div class="navbar-end">
- <div class="navbar-item theme-switch-wrapper">
- <label class="theme-switch" for="checkbox">
- <input type="checkbox" id="checkbox" />
- <div class="slider round"></div>
- </label>
- </div>
- <a class="navbar-item" href="https://github.com/jmonkeyengine/wiki">Github</a>
- </div>
- </div>
- </nav>
- </header>
- <div class="body">
- <div class="nav-container" data-component="docs" data-version="master">
- <aside class="nav">
- <div class="panels">
- <div class="nav-panel-menu is-active" data-panel="menu">
- <nav class="nav-menu">
- <h3 class="title"><a href="../documentation.html">Docs</a></h3>
- <ul class="nav-list">
- <li class="nav-item" data-depth="0">
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../documentation.html">Getting Started</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="https://javadoc.jmonkeyengine.org/v3.3.2-stable">JavaDoc</a>
- </li>
- <li class="nav-item" data-depth="1">
- <button class="nav-item-toggle"></button>
- <a class="nav-link" href="../jme3.html">jMonkeyEngine 3</a>
- <ul class="nav-list">
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Beginner Tutorials</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_simpleapplication.html">Hello SimpleApplication</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_node.html">Hello Node</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_asset.html">Hello Asset</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_main_event_loop.html">Hello Main Event Loop</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_input_system.html">Hello Input System</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_material.html">Hello Material</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_animation.html">Hello Animation</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_picking.html">Hello Picking</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_collision.html">Hello Collision</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_terrain.html">Hello Terrain</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_audio.html">Hello Audio</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_effects.html">Hello Effects</a>
- </li>
- <li class="nav-item" data-depth="3">
- <a class="nav-link" href="beginner/hello_physics.html">Hello Physics</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="2">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Intermediate Tutorials</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="intermediate/best_practices.html">Best Practices</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="intermediate/simpleapplication.html">Simple Application</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="features.html">Features</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="intermediate/optimization.html">Optimization</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="faq.html">FAQ</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">Math Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="math_for_dummies.html">Math For Dummies</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="intermediate/math.html">Math</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="math.html">More Math</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="rotate.html">Rotate</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="math_video_tutorials.html">Math Video Tutorials</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="3">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">3D Graphics Concepts</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="intermediate/multi-media_asset_pipeline.html">Multi-Media Asset Pipeline</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="scenegraph_for_dummies.html">Scenegraph for Dummies</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="beginner/hellovector.html">Hello Vector</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="terminology.html">Terminology</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="intermediate/how_to_use_materials.html">How to Use Materials</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="intermediate/transparency_sorting.html">Transparency and Sorting</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="external/blender.html">Importing from Blender</a>
- </li>
- <li class="nav-item" data-depth="4">
- <a class="nav-link" href="external/3dsmax.html">Importing from 3DS Max</a>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../logo.html">Logo Usage</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../bsd_license.html">License</a>
- </li>
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../github_tips.html">Github Tips</a>
- </li>
- </ul>
- </li>
- <li class="nav-item" data-depth="0">
- <button class="nav-item-toggle"></button>
- <span class="nav-text">SDK</span>
- <ul class="nav-list">
- <li class="nav-item" data-depth="1">
- <a class="nav-link" href="../sdk.html">jMonkeyEngine SDK</a>
- </li>
- </ul>
- </li>
- </ul>
- </nav>
- </div>
- <div class="nav-panel-explore" data-panel="explore">
- <div class="context">
- <span class="title">Docs</span>
- <span class="version">master</span>
- </div>
- <ul class="components">
- <li class="component is-current">
- <span class="title">Docs</span>
- <ul class="versions">
- <li class="version is-current is-latest">
- <a href="../documentation.html">master</a>
- </li>
- </ul>
- </li>
- <li class="component">
- <span class="title">Wiki UI</span>
- <ul class="versions">
- <li class="version is-latest">
- <a href="../../wiki-ui/index.html">master</a>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- </aside>
- </div>
- <main class="article">
- <div class="toolbar" role="navigation">
- <button class="nav-toggle"></button>
- <nav class="breadcrumbs" aria-label="breadcrumbs">
- <ul>
- <li><a href="../documentation.html">Docs</a></li>
- <li><a href="simpleapplication_from_the_commandline.html">Starting a JME3 application from the command-line</a></li>
- </ul>
- </nav>
- <div class="edit-this-page"><a href="https://github.com/jMonkeyEngine/wiki/edit/master/docs/modules/ROOT/pages/jme3/simpleapplication_from_the_commandline.adoc">Edit this Page</a></div>
- </div>
- <div class="content">
- <article class="doc">
- <h1 class="page">Starting a JME3 application from the command-line</h1>
- <div id="preamble">
- <div class="sectionbody">
- <div class="paragraph">
- <p>Although we recommend the jMonkeyEngine <a href="../sdk.html" class="page">SDK</a> for developing JME3 games, you can use any IDE (integrated development environment) such as <a href="setting_up_netbeans_and_jme3.html" class="page">NetBeans</a> or <a href="setting_up_jme3_in_eclipse.html" class="page">Eclipse</a>, and even work freely from the command-line. Here is a generic IDE-independent “getting started” tutorial.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="installing-the-jme3-framework"><a class="anchor" href="#installing-the-jme3-framework"></a>Installing the JME3 Framework</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>There are many ways to install the JME framework from the command-line, but for this tutorial we will narrow it down to two, the easy way and the hard way.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="installing-with-git-easy-way"><a class="anchor" href="#installing-with-git-easy-way"></a>Installing with Git (easy way)</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>You can build JME3 from the sources. (Recommended for JME3 developers.) This example expects <a href="https://help.github.com/articles/set-up-git/">Git</a> to be installed on your system.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>mkdir jme3
- cd jme3
- // if you have a rsa key configured
- git clone [email protected]:jMonkeyEngine/jmonkeyengine.git
- // or
- // if you don't, but you'll be asked for credential after the next command
- git clone https://github.com/jMonkeyEngine/jmonkeyengine.git
- //can take a while
- // build the engine and install it in your local maven repo.
- ./gradlew install</code></pre>
- </div>
- </div>
- <div class="admonitionblock tip">
- <table>
- <tr>
- <td class="icon">
- <i class="fa icon-tip" title="Tip"></i>
- </td>
- <td class="content">
- What is an <a href="https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/">RSA key</a>?
- </td>
- </tr>
- </table>
- </div>
- <div class="paragraph">
- <p>The install command will install the built jars into your local maven repositories org.jmonkeyengine folder, which on Linux is ~/.m2, and on Windows might be in AppData, or in your home directory.</p>
- </div>
- <div class="paragraph">
- <p>To use the engine in a game project, you can use <a href="https://hub.jmonkeyengine.org/t/bootmonkey-bootstrap-your-jme-project/37141">BootMonkey</a> or clone a template project from GitHub.</p>
- </div>
- <div class="paragraph">
- <p>To use the template, first create a folder for your project:</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>cd ..
- mkdir HelloJME3
- cd HelloJME3</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>Next, clone one of these templates:</p>
- </div>
- <div class="ulist">
- <ul>
- <li>
- <p><a href="https://github.com/Simsilica/Examples/tree/master/simple-jme">Simsilica/Examples</a></p>
- </li>
- <li>
- <p><a href="https://github.com/Nehon/base-jme">Nehon/base-jme</a></p>
- </li>
- </ul>
- </div>
- <div class="paragraph">
- <p>After cloning, open the <code>build.gradle</code> file and uncomment the <code>mavenLocal()</code> repository, change the version variable, and uncomment any dependencies you will need:</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>repositories {
- //This is where jme3 dependencies are stored.
- jcenter()
- //Uncomment this if you install local dependencies.
- mavenLocal()
- //Uncomment this if you use external dependencies
- //mavenCentral()
- //Uncomment this if you use jme3-niftygui
- //maven{url 'http://nifty-gui.sourceforge.net/nifty-maven-repo'}
- }
- ext.jmeVersion = "[3.2,)"
- ...
- dependencies {
- compile "org.jmonkeyengine:jme3-core:$jmeVersion"
- compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
- compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
- //Those are jme3 additional library uncomment the ones you need
- //compile "org.jmonkeyengine:jme3-android-native:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-android:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-bullet-native-android:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-blender:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-bullet-native:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-bullet:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-effects:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-jogg:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-jogl:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-lwjgl3:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-networking:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-plugins:$jmeVersion"
- //compile "org.jmonkeyengine:jme3-terrain:$jmeVersion"
- //You need to uncomment nifty repository in the repositories section if you use this dependency
- //compile "org.jmonkeyengine:jme3-niftygui:$jmeVersion"
- runtime project(':assets')
- }
- ...</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>For a detailed description of the separate jar files see <a href="jme3_source_structure.html#structure_of_jmonkeyengine3_jars" class="page">this list</a>.</p>
- </div>
- <div class="paragraph">
- <p>That’s it, you’re done. After the clone, you will have a project that contains a source package with a default blue cube JME3 app and a subproject that has the proper asset directory structure for your assets.</p>
- </div>
- <div class="paragraph">
- <p>Build and run your project and you should see a blue cube.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="manual-download-hard-way"><a class="anchor" href="#manual-download-hard-way"></a>Manual Download (hard way)</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>This example shows how to set up and run a simple application (HelloJME3) that depends on the jMonkeyEngine3 libraries.</p>
- </div>
- <div class="paragraph">
- <p>The directory structure will look as follows:</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>jme3/
- jme3/lib
- jme3/src
- ...
- HelloJME3/
- HelloJME3/lib
- HelloJME3/assets
- HelloJME3/src
- ...</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>To install the development version of jme3, download the latest <a href="https://github.com/jMonkeyEngine/jmonkeyengine/releases">stable release</a>, unzip the folder into a directory named <code>jme3</code>. The filenames here are just an example, but they will always be something like <code>jME3.x-stable</code>.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>mkdir jme3
- cd jme3
- unzip jME3.2-stable.zip
- cd ..</code></pre>
- </div>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="sample-project-directory-structure"><a class="anchor" href="#sample-project-directory-structure"></a>Sample Project Directory Structure</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>First we set up the directory and source package structure for your game project. Note that the game project directory <code>HelloJME3</code> is on the same level as your <code>jme3</code> folder. In this example, we create a Java package that we call <code>mygame</code> in the source directory.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>mkdir HelloJME3
- mkdir HelloJME3/src
- mkdir HelloJME3/src/mygame</code></pre>
- </div>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="libraries"><a class="anchor" href="#libraries"></a>Libraries</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>Next you copy the necessary JAR libraries from the download to your project. You only have to do this set of steps once every time you download a new JME3 build. For a detailed description of the separate jar files see <a href="jme3_source_structure.html#structure_of_jmonkeyengine3_jars" class="page">this list</a>.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>mkdir HelloJME3/build
- mkdir HelloJME3/lib
- cp jme3/lib/*.* HelloJME3/lib</code></pre>
- </div>
- </div>
- <div class="sect2">
- <h3 id="sample-code"><a class="anchor" href="#sample-code"></a>Sample Code</h3>
- <div class="paragraph">
- <p>To test your setup, create the file <code>HelloJME3/src/mygame/HelloJME3.java</code> with any text editor, paste the following sample code, and save.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">package mygame;
- import com.jme3.app.SimpleApplication;
- import com.jme3.material.Material;
- import com.jme3.math.Vector3f;
- import com.jme3.scene.Geometry;
- import com.jme3.scene.shape.Box;
- import com.jme3.math.ColorRGBA;
- public class HelloJME3 extends SimpleApplication {
- public static void main(String[] args){
- HelloJME3 app = new HelloJME3();
- app.start();
- }
- @Override
- public void simpleInitApp() {
- Box b = new Box(Vector3f.ZERO, 1, 1, 1);
- Geometry geom = new Geometry("Box", b);
- Material mat = new Material(assetManager,
- "Common/MatDefs/Misc/Unshaded.j3md");
- mat.setColor("Color", ColorRGBA.Blue);
- geom.setMaterial(mat);
- rootNode.attachChild(geom);
- }
- }</code></pre>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="build-and-run"><a class="anchor" href="#build-and-run"></a>Build and Run</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>We build the sample application into the build directory…</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>cd HelloJME3
- javac -d build -cp "lib/eventbus.jar:lib/j-ogg-all.jar:lib/jme3-lwjgl.jar:lib/jme3-bullet.jar:lib/jinput.jar:lib/lwjgl.jar:lib/stack-alloc.jar:lib/vecmath.jar:lib/xpp3.jar:lib/jme3-blender.jar:lib/jme3-core.jar:lib/jme3-desktop.jar:lib/jme3-jogg.jar:lib/jme3-plugins.jar:lib/jme3-terrain.jar:lib/jme3-testdata.jar:lib/jme3-niftygui.jar:lib/nifty-default-controls.jar:lib/nifty-examples.jar:lib/nifty-style-black.jar:lib/nifty.jar:." src/mygame/HelloJME3.java</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>… and run it.</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>cd build
- java -cp "../lib/eventbus.jar:../lib/j-ogg-all.jar:../lib/jme3-lwjgl.jar:../lib/jme3-bullet.jar:../lib/jinput.jar:../lib/lwjgl.jar:../lib/stack-alloc.jar:../lib/vecmath.jar:../lib/xpp3.jar:../lib/jme3-blender.jar:../lib/jme3-core.jar:../lib/jme3-desktop.jar:../lib/jme3-jogg.jar:../lib/jme3-plugins.jar:../lib/jme3-terrain.jar:../lib/jme3-testdata.jar:../lib/jme3-niftygui.jar:../lib/nifty-default-controls.jar:../lib/nifty-examples.jar:../lib/nifty-style-black.jar:../lib/nifty.jar:." mygame/HelloJME3</code></pre>
- </div>
- </div>
- <div class="admonitionblock note">
- <table>
- <tr>
- <td class="icon">
- <i class="fa icon-note" title="Note"></i>
- </td>
- <td class="content">
- If you use Windows, the classpath separator is <kbd>\</kbd> instead of <kbd>/</kbd>.
- </td>
- </tr>
- </table>
- </div>
- <div class="paragraph">
- <p>If a settings dialog pops up, confirm the default settings. You should now see a simple window with a 3-D cube. Use the mouse and the WASD keys to move. It works!</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="recommended-asset-directory-structure"><a class="anchor" href="#recommended-asset-directory-structure"></a>Recommended Asset Directory Structure</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>For <a href="intermediate/multi-media_asset_pipeline.html" class="page">multi-media files, models, and other assets</a>, we recommend creating the following project structure:</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>cd HelloJME3
- mkdir assets
- mkdir assets/Interface
- mkdir assets/Materials
- mkdir assets/MatDefs
- mkdir assets/Models
- mkdir assets/Scenes
- mkdir assets/Shaders
- mkdir assets/Sounds
- mkdir assets/Textures</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>This directory structure will allow <a href="intermediate/simpleapplication.html" class="page">SimpleApplication</a>'s default <a href="advanced/asset_manager.html" class="page">AssetManager</a> to load media files from your <code>assets</code> directory, like in this example:</p>
- </div>
- <div class="listingblock">
- <div class="content">
- <pre class="highlightjs highlight"><code>import com.jme3.scene.Spatial;
- ...
- Spatial elephant = assetManager.loadModel("Models/Elephant/Elephant.meshxml");
- rootNode.attachChild(elephant);
- ...</code></pre>
- </div>
- </div>
- <div class="paragraph">
- <p>You will learn more about the asset manager and how to customize it later. For now feel free to structure your assets (images, textures, models) into further sub-directories, like in this example the <code>assets/models/Elephant</code> directory that contains the <code>elephant.mesh.xml</code> model and its materials.</p>
- </div>
- </div>
- </div>
- <div class="sect1">
- <h2 id="next-steps"><a class="anchor" href="#next-steps"></a>Next Steps</h2>
- <div class="sectionbody">
- <div class="paragraph">
- <p>Now follow the <a href="../jme3.html" class="page">tutorials</a> and write your first jMonkeyEngine game.</p>
- </div>
- </div>
- </div>
- </article>
- <aside class="toc sidebar" data-title="Contents" data-levels="2">
- <div class="toc-menu"></div>
- </aside>
- </div>
- </main>
- </div>
- <footer class="footer">
- <p>Copyright 2020 jMonkeyEngine Wiki Contributors. Licensed BSD-3.</p>
- </footer>
- <script src="../../_/js/vendor/docsearch.min.js"></script>
- <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js -->
- <script>
- var search = docsearch({
- apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
- indexName: 'jmonkeyengine',
- inputSelector: '#search-input',
- autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
- algoliaOptions: { hitsPerPage: 10 }
- }).autocomplete
- search.on('autocomplete:closed', function () { search.autocomplete.setVal() })
- function focusSearchInput () { document.querySelector('#search-input').focus() }
- if (document.querySelector('.home-link.is-current')) window.addEventListener('load', focusSearchInput)
- </script>
- <script src="../../_/js/site.js"></script>
- <script async src="../../_/js/vendor/highlight.js"></script>
- </body>
- </html>
|