diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html index e582301d3..66b80977e 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html @@ -126,7 +126,7 @@ Loading a model: Loading a scene from an Ogre3D dotScene file stored inside a zip:
-assetManager.registerLocator("town.zip", ZipLocator.class.getName()); +Alternatively to ZipLocator, there is also a HttpZipLocator that can stream models from a zip file online:assetManager.registerLocator("town.zip", ZipLocator.class); Spatial scene = assetManager.loadModel("main.scene"); rootNode.attachChild(scene);@@ -134,7 +134,7 @@ rootNode.attachChild(scene);
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", - HttpZipLocator.class.getName()); + HttpZipLocator.class); Spatial scene = assetManager.loadModel("main.scene"); rootNode.attachChild(scene);@@ -175,7 +175,7 @@ rootNode.attachChild(scene); - +
-Since bullet is not (yet) multithreaded or GPU accelerated the jME3 implementation allows to run each physics space on a separate thread that is executed in parallel to rendering. +Since bullet is not (yet) multithreaded or GPU accelerated, the jME3 implementation allows to run each physics space on a separate thread that is executed in parallel to rendering.
+ A SimpleApplication with a BulletAppState allows setting the threading type via
setThreadingType(ThreadingType type);
- where ThreadingType can be either SEQUENTIAL or PARALLEL. + where ThreadingType can be either SEQUENTIAL or PARALLEL. By default, it's SEQUENTIAL.
-In the simpleInitApp() method: - +You can activate PARALLEL threading in the simpleInitApp() method:
bulletAppState = new BulletAppState(); bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL); stateManager.attach(bulletAppState);
-The physics update happens in parallel to rendering, after the users changes have been made in the update() call. This way the loop logic is still maintained: the user can set and change values in physics and scenegraph objects before render() and physicsUpdate() are called in parallel. More physics spaces can simply be added by using multiple bulletAppStates. +Now the physics update happens in parallel to render(), that is, after the user's changes in the update() call have been applied. During update() the physics update loop pauses. This way the loop logic is still maintained: the user can set and change values in physics and scenegraph objects before render() and physicsUpdate() are called in parallel. This allows you to use physics methods in update() as if it was single-threaded. +
+PARALLEL | SEQUENTIAL | +
---|---|
1. update(), 2. render() and physics update(). | 1. update(), 2. render(), 3. physics update(). | +
Physics Debug View is rendered inaccurately (out of sync) | Physics Debug View is rendered accurately. | +
+ +
@@ -218,7 +220,7 @@ See also:
-
+ +Using the GUI Node is the default approach in jme3 to create simple HUDs. If you just quickly want to display a line of text, or a simple icon on the screen, use the no-frills GUI Node, it's easier. +
+-Using the GUI Node is the default approach in jme3 to create simple HUDs. If you just quickly want to display a line of text, or a simple icon on the screen, use this no-frills method. -
- -
-Next to the rootNode for the 3-dimensional scene graph, jME3 also offers a 2-dimension (orthogonal) node, the guiNode
.
+You already know the rootNode
that holds the 3-dimensional scene graph. jME3 also offers a 2-dimension (orthogonal) node, the guiNode
.
This is how you use the guiNode for HUDs:
-Note: The size unit for the guiNode is pixels, not world units. +
setDisplayStatView(false); setDisplayFps(false);
-By default, the guiNode has some scene graph statistics attached in SimpleApplication. To clear the guiNode and attach your own GUI elements, you detach all children. + +
guiNode.detachAllChildren();
- -It is technically possible to attach Quads and 3D Geometries to the HUD. They show up as flat, static GUI elements. Note that if you use a lit Material, you must add a light to the guiNode. Also remember that size units are pixels in the HUD (a 2-wu cube is displayed tiny 2 pixels wide!). -
- -(0f,0f)
, and the top right corner is at (settings.getWidth(),settings.getHeight())
.(0f,0f)
, and the top right corner is at (settings.getWidth(),settings.getHeight())
.pic.move(x, y, -2)
or hudText.setLocalTranslation(x,y,-2)
.pic.move(x, y, -1)
to move the picture to the background, or hudText.setLocalTranslation(x,y,1)
to move text to the foreground.+ +It is technically possible to attach Quads and 3D Geometries to the HUD. They show up as flat, static GUI elements. The size unit for the guiNode is pixels, not world units. If you attach a Geometry that uses a lit Material, you must add a light to the guiNode. +
+ ++
bulletAppState.getPhysicsSpace().add(myThing_phys); ...+
bulletAppState.getPhysicsSpace().add(myThing_phys); +rootNode.attachChild(myThing_geo);
bulletAppState.getPhysicsSpace().remove(myThing_phys); -myModel.removeFromParent();+
bulletAppState.getPhysicsSpace().remove(myThing_phys); +myThing_geo.removeFromParent();
-
On a RigidBodyControl, you can apply the following physical forces: @@ -458,7 +459,7 @@ On a RigidBodyControl, you can apply the following physical forces: (See detailed explanation below.)
+ +
setApplyPhysicsLocal(true)
for an object to make it move relatively to its local physics space. You would do that if you need a physics space that moves with a node (e.g. a spaceship with artificial gravity surrounded by zero-g space). By default, it's set to false, and all movement is relative to the world.
+-The rootNode is the central element of the scene graph. Even if the scenegraph is empty, it always has at least its rootNode. All other Spatials are attached to the rootNode in a parent-child relationship. If you think you need to understand the scene graph concept better, please read Scenegraph for dummies first. +The rootNode is the central element of the scene graph. Even if the scene graph is empty, it always contains at least the rootNode. We attach Spatials to the rootNode. Attached Spatials are always in a parent-child relationship. Every time you attach a Spatial to something, it is implicitly detached from its previous parent. A Spatial can have only one parent. A Spatial can have several children. +
+ ++If you think you need to understand the scene graph concept better, please read Scenegraph for dummies first.
@@ -18,7 +22,7 @@ The rootNode is the central element of the scene graph. Even if the scenegraph i
-In your Java code, a Spatial is either a com.jme3.scene.Node or a com.jme3.scene.Geometry. You use the two for different purposes:
+In your Java code, a Spatial is either a com.jme3.scene.Node
or a com.jme3.scene.Geometry
. You use the two for different purposes:
@@ -30,17 +34,18 @@ In your Java code, a Spatial is either a com.jme3.scene.Node or a com.jme3.scene
-
Spatial s = new Spatial();
! A Spatial is an abstract concept, like a mammal (there is no actual creature called "mammal" walking around here). You create a Node, or load a Geometry object. Some methods however require a Spatial argument: This is because they are able to accept both Nodes and Geometries as arguments. In this case, you must cast a Node or Geometry to Spatial.
+Spatial s = new Spatial();
! A Spatial is an abstract concept, like a mammal (there is no actual creature called "mammal" walking around here). You either create a Node or a Geometry object. Some methods however require a Spatial argument: This is because they are able to accept both Nodes and Geometries as arguments. In this case, you must cast a Node or Geometry to Spatial.
-You can include custom Java objects in Nodes and Geometries. This is useful for maintaining information about a game element, such as health, budget, ammunition, inventory, equipment, etc for players, or landmark locations for terrains, and much more. +You can include custom user data –that is, custom Java objects and methods– in Nodes and Geometries. This is very useful for maintaining information about a game element, such as health, budget, ammunition, inventory, equipment, etc for players, or landmark locations for terrains, and much more.
-You do not need to create a custom class that extends Node or Geometry to be able to add custom fields to a spatial – use the setUserData() method instead. Neither do you need to create a custom class that extends Node to be able to add custom accessor methods to this spatial – use a Control instead. Where ever the spatial is accessible, you can also access the object's game data and accessors. +
setUserData()
method instead. Where ever the Spatial is accessible, you can easily access the object's game data and accessors this way.
+
-For example when you initialize your custom PlayerControl class:
+The following example adds an integer field named health
to the Spatil player_node
, and initializes it to 100.
// init custom data fields in this Control's Spatial (Node or Geometry) -spatial.setUserData("Health", 100);+
player_node.setUserData("health", 100);
+To be able to add accessors to the player, you create a custom PlayerControl class and add it to the Spatial. -In your PlayerControl, you offer accessors that manipulate and get this custom data: +
+player_node.addControl(PlayerControl.class);+
+In PlayerControl you define methods that set and get your users data in the spatial
object.
public int getHealth() { - return (Integer)spatial.getUserData("Health"); + return (Integer)spatial.getUserData("health"); } public void setHealth(int h) { - spatial.setUserData("Health",h); + spatial.setUserData("health",h); }
-
-Elsewhere in your code, you can access this data wherever you have access to the spatial.
-
+Elsewhere in your code, you can access this data wherever you have access to the Spatial player_node
.
health = player_node.getControl(PlayerControl.class).getHealth(); ... player_node.getControl(PlayerControl.class).setHealth(99);- -
-You can add as many data objects (including Strings, Integers, Floats, Arrays,) to a Spatial as you need. Just make sure to label them with different Strings (health
, inventory
, equipment
, etc). The saved data can also be custom Java objects if you make the Java class implement the Savable interface. When you save a Spatial as a j3o file, the custom data is saved too, and it will be restored the next time you load the j3o!
-
health
, inventory
, equipment
, etc). -You can list all data keys that are already defined for one Spatial: +This is how you list all data keys that are already defined for one Spatial:
for(String key : spatial.getUserDataKeys()){ - System.out.println(spatial.getName()+"'s keys: "+key); + System.out.println(spatial.getName()+"'s keys: "+key); }
Here is a usage example of a ZipLocator that is registered to a file town.zip
in the top level of your project directory:
assetManager.registerLocator("town.zip", ZipLocator.class.getName()); +- +assetManager.registerLocator("town.zip", ZipLocator.class); Spatial scene = assetManager.loadModel("main.scene"); rootNode.attachChild(scene);@@ -224,7 +224,7 @@ Here is a HttpZipLocator that can download zipped models and load them:assetManager.registerLocator( "http://jmonkeyengine.googlecode.com/files/wildhouse.zip", - HttpZipLocator.class.getName()); + HttpZipLocator.class); Spatial scene = assetManager.loadModel("main.scene"); rootNode.attachChild(scene);@@ -346,7 +346,7 @@ rootNode.attachChild(scene);
town.zip
is in the project directory.simpleInitApp() {
assetManager.registerLocator("town.zip", ZipLocator.class.getName()); +
simpleInitApp() {
assetManager.registerLocator("town.zip", ZipLocator.class); Spatial gameLevel = assetManager.loadModel("main.scene"); gameLevel.setLocalTranslation(0, -5.2f, 0); gameLevel.setLocalScale(2); @@ -472,11 +472,7 @@ Let's add some action to the scene and continue with the ()
For the scene, you load the sceneModel
from a zip file, and adjust the size.
assetManager.registerLocator("town.zip", ZipLocator.class.getName()); +assetManager.registerLocator("town.zip", ZipLocator.class); sceneModel = assetManager.loadModel("main.scene"); sceneModel.setLocalScale(2f);diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender.html new file mode 100644 index 000000000..f68c8aab7 --- /dev/null +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender.html @@ -0,0 +1,91 @@ + +Creating jME3 models in Blender3D
++ ++ ++This section discusses how to create and import models from Blender3D (2.62+, see bottom of page for Blender 2.49 and before) to jME3. +
+ +Asset Management
++ ++ ++For the managing of assets in general, be sure to read the Asset Pipeline Documentation. It contains vital information on how to manage your asset files. +
+ +Creation Process
++ ++ \ No newline at end of file diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_apply_bones.png b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_apply_bones.png new file mode 100644 index 000000000..617454726 Binary files /dev/null and b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_apply_bones.png differ diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_apply_mesh.png b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_apply_mesh.png new file mode 100644 index 000000000..c063a8d1b Binary files /dev/null and b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_apply_mesh.png differ diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_envelopes.png b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_envelopes.png new file mode 100644 index 000000000..eee1b7aaf Binary files /dev/null and b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_envelopes.png differ diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_finished.png b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_finished.png new file mode 100644 index 000000000..006f4cb21 Binary files /dev/null and b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_finished.png differ diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_rootbone.png b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_rootbone.png new file mode 100644 index 000000000..9bb251d2a Binary files /dev/null and b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/external/blender_rootbone.png differ diff --git a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html index 343c9bbff..bb0403100 100644 --- a/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html +++ b/sdk/jme3-core/javahelp/com/jme3/gde/core/docs/jme3/faq.html @@ -146,7 +146,7 @@ If you are not using the default+To export an animated model in Blender make sure the following conditions are met: + +
++
+- +
Apply Location, Rotation and Scate to the mesh on Blender: On 3D View editor on Blender, select the mesh in Object Mode and go to the 3D View Editor’s header → Object Menu → Apply → Location / Rotation / Location.+- +
Apply Location, Rotation and Scate to the armature on Blender: On 3D View editor on Blender, select the armature in Object Mode and go to the 3D View Editor’s header → Object Menu → Apply → Location / Rotation / Location.+- +
Set the mesh’s origin point in the bottom of the mesh (see the images bellow).+- +
Set the armature’s origin point in the bottom of the armature (see the images bellow).+- +
Armature’s origin point and mesh’s origin point must be in the same location(see the images bellow).+- +
Use a root bone located in the armature’s origin. This root bone must be in vertical position (see the images bellow) and it is the root bone of the armature. If you rotate the root bone, the the entire armature might be rotate when you import the model into jMonkey (I’m just mentioning the result, I don’t know where is the problem (jmonkey importer or blender’s ogre exporter plugin)).+- +
Uncheck “Bone Envelopes” checkbox on the Armature modifier for the mesh (see the images bellow).+- +
Uncheck “Envelopes” checkbox on the armature (see the images bellow).+- +
Use SkeletonDebugger to show the skeleton on your game in order to check if the mesh and the skeleton are loaded correctly:+final Material soldier2Mat = assetManager.loadMaterial("Materials/soldier2/soldier2.j3m"); + final Spatial soldier2 = assetManager.loadModel("Models/soldier2/soldier2.j3o"); + TangentBinormalGenerator.generate(soldier2); + soldier2.setMaterial(soldier2Mat); + + final Node soldier2Node = new Node("Soldier2 Node"); + + soldier2Node.attachChild(soldier2); + rootNode.attachChild(soldier2Node); + + final AnimControl control = soldier2.getControl(AnimControl.class); + control.addListener(this); + final AnimChanel channel = control.createChannel(); + + final SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton()); + final Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); + mat.setColor("Color", ColorRGBA.Green); + mat.getAdditionalRenderState().setDepthTest(false); + skeletonDebug.setMaterial(mat); + soldier2Node.attachChild(skeletonDebug);+ ++ + + + + + +
+ ++Also check out these videos and resources: + +
++
+ +- +
()+- +
+- +
+assets
directory, verify that youthis.assetManager.registerLocator("assets/", FileLocator.class); // default this.assetManager.registerLocator("c:/jme3User/JMEisSoCool/myAwesomeFolder/", FileLocator.class); -this.assetManager.registerLocator("town.zip", ZipLocator.class.getName());+this.assetManager.registerLocator("town.zip", ZipLocator.class);
@@ -556,7 +556,10 @@ Use a PhysicsControl's hinges and joints.
-At the bottom left of every default SimpleGame, you see the StatsView and the FPS (frames per seconds) view. It provides you with extra information during the development phase. For example, if the object count is increasing and the FPS slows down, then you now that your code attaches too many and does not detach enough objects.
+At the bottom left of every default SimpleGame, you see the StatsView and the FPS (frames per seconds) view. These views provide you with extra information during the development phase. For example, if you notice the object count is increasing and the FPS is decreasing, then you know that your code attaches too many objects and does not detach enough of them again (maybe a loop gone wild?).
+
+Learn more: StatsView
+
setDisplayFps(false); // to hide the FPS setDisplayStatView(false); // to hide the statistics+
+
+
+Learn more: StatsView
+
+
+ +Assets are files that are not code. Your multi-media assets includes, for example, your textures (image files), models (mesh files), and sounds (audio files). + +
+DO | DON'T | +
---|---|
Save original models plus textures into assets/Textures . | Don't leave textures or models in a folder outside your JME project: The game cannot load or reference them from there. | +
Save sounds into assets/Sounds . | Don't leave audio files in a folder outside your JME project: The game cannot load or reference them from there. | +
Create simple, low-polygon models. | Don't create high-polygon models, they render too slow to be useful in games. | +
Only use Diffuse Map, Normal Map, Glow Map, Specular Map in your models. | Don't use unsupported material properties that are not listed in the Materials Overview. | +
Use UV texture / texture atlases / baking for each texture map. | Don't create models based on multiple separate textures, it will break the model into separate meshes. | +
Convert original models to .j3o format. Move .j3o files into assets/Models . | Don't reference original Blender/Ogre/OBJ files in your load() code, because these unoptimized files are not packaged into the final JAR. | +
+ +Read on for details. +
+ +
+
+Store your assets in subfolders of your project's assets
directory. The assets
directory is the default path where a JME game's Asset Manager looks for files to load.
+
jMonkeyProjects/MyGame/assets/Interface/ # .font, .jpg, .png, .xml +jMonkeyProjects/MyGame/assets/MatDefs/ # .j3md +jMonkeyProjects/MyGame/assets/Materials/ # .j3m +jMonkeyProjects/MyGame/assets/Models/ # .j3o +jMonkeyProjects/MyGame/assets/Scenes/ # .j3o +jMonkeyProjects/MyGame/assets/Shaders/ # .j3f, .vert, .frag +jMonkeyProjects/MyGame/assets/Sounds/ # .ogg, .wav +jMonkeyProjects/MyGame/assets/Textures/ # .jpg, .png; also .mesh.xml+.material, .mtl+.obj,+ +
+Prepare the asset
folder structure for your individual project:
+
+
assets
in any way that suits your project (see example above). Stick with one system.Textures/vehicles/car1/
, Materials/vehicles/car1/
, Models/vehicles/car1/
, , Sounds/vehicles/car1/
(etc) directories now.+ + +
+ ++See also: +
++ +Install a graphic editor such as Gimp or Photoshop. Consult the graphic editor's documentation for specific details how to do the following tasks. + +
+assets/Textures
directory. assets/Materials
directory.+ +
+ +Install a mesh editor such as Blender or 3D Studio MAX. Reuse textures and materials as much as possible. Consult the mesh editor's documentation for specific details how to do the following tasks. + +
+assets/Textures
directory, together with their Textures. (for now)+ +See also: +
+ ++
+ +Convert all models and scenes to jME3's binary .j3o format to load() them. You use the jMonkeyEngine SDK to do the conversion. + +
+assets/Textures
directory (or subdirectories) together with all its textures.assets/Textures/…
path.assets/Models/
or assets/Scenes/
directory.
+
+This process ensures that the texture paths are correct, and it also keeps your assets/Models
folder free from textures. You can reuse your set of textures for many models.
+
+Must I convert to .j3o? – Yes! +
++ +
+See also: Model Loader and Viewer + +
+ +GeometryBatchFactory.optimize(complexNode, true);+
+If you have problems updating the SDK, try deleting all files from jmonkeyplatform/update/download or [settings folder]/update/download depending on your system (look above for the settings folder location). +
+ +