69 lines
2.7 KiB
Java
69 lines
2.7 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.jme3.app.SimpleApplication
|
|
* com.jme3.font.BitmapText
|
|
* com.jme3.light.DirectionalLight
|
|
* com.jme3.light.Light
|
|
* com.jme3.material.Material
|
|
* com.jme3.math.Vector3f
|
|
* com.jme3.scene.Geometry
|
|
* com.jme3.scene.Mesh
|
|
* com.jme3.scene.Spatial
|
|
* com.jme3.scene.shape.Box
|
|
*/
|
|
package jme3.hello;
|
|
|
|
import com.jme3.app.SimpleApplication;
|
|
import com.jme3.font.BitmapText;
|
|
import com.jme3.light.DirectionalLight;
|
|
import com.jme3.light.Light;
|
|
import com.jme3.material.Material;
|
|
import com.jme3.math.Vector3f;
|
|
import com.jme3.scene.Geometry;
|
|
import com.jme3.scene.Mesh;
|
|
import com.jme3.scene.Spatial;
|
|
import com.jme3.scene.shape.Box;
|
|
|
|
public class HelloAssets
|
|
extends SimpleApplication {
|
|
public static void main(String[] args) {
|
|
HelloAssets app = new HelloAssets();
|
|
app.start();
|
|
}
|
|
|
|
public void simpleInitApp() {
|
|
Spatial teapot = this.assetManager.loadModel("Models/Teapot/Teapot.obj");
|
|
Material mat_default = new Material(this.assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
|
|
teapot.setMaterial(mat_default);
|
|
this.rootNode.attachChild(teapot);
|
|
Box box = new Box(Vector3f.ZERO, 2.5f, 2.5f, 1.0f);
|
|
Geometry wall = new Geometry("Box", (Mesh)box);
|
|
Material mat_brick = new Material(this.assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
|
mat_brick.setTexture("ColorMap", this.assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg"));
|
|
wall.setMaterial(mat_brick);
|
|
wall.setLocalTranslation(2.0f, -2.5f, 0.0f);
|
|
this.rootNode.attachChild((Spatial)wall);
|
|
this.guiNode.detachAllChildren();
|
|
this.guiFont = this.assetManager.loadFont("Interface/Fonts/Default.fnt");
|
|
BitmapText helloText = new BitmapText(this.guiFont, false);
|
|
helloText.setSize((float)this.guiFont.getCharSet().getRenderedSize());
|
|
helloText.setText("Hello World");
|
|
helloText.setLocalTranslation(300.0f, helloText.getLineHeight(), 0.0f);
|
|
this.guiNode.attachChild((Spatial)helloText);
|
|
Spatial ninja = this.assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");
|
|
ninja.scale(0.05f, 0.05f, 0.05f);
|
|
ninja.rotate(0.0f, -3.0f, 0.0f);
|
|
ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);
|
|
this.rootNode.attachChild(ninja);
|
|
DirectionalLight sun = new DirectionalLight();
|
|
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
|
|
this.rootNode.addLight((Light)sun);
|
|
Spatial gameLevel = this.assetManager.loadModel("Scenes/main.j3o");
|
|
gameLevel.setLocalTranslation(0.0f, -5.2f, 0.0f);
|
|
gameLevel.setLocalScale(2.0f);
|
|
this.rootNode.attachChild(gameLevel);
|
|
}
|
|
}
|