1package jme3test.material;
2
3import com.jme3.app.SimpleApplication;
4import com.jme3.light.AmbientLight;
5import com.jme3.light.PointLight;
6import com.jme3.material.Material;
7import com.jme3.math.ColorRGBA;
8import com.jme3.math.Vector3f;
9import com.jme3.scene.Geometry;
10import com.jme3.scene.shape.Sphere;
11import com.jme3.util.TangentBinormalGenerator;
12
13public class TestUnshadedModel extends SimpleApplication {
14
15    public static void main(String[] args){
16        TestUnshadedModel app = new TestUnshadedModel();
17        app.start();
18    }
19
20    @Override
21    public void simpleInitApp() {
22        Sphere sphMesh = new Sphere(32, 32, 1);
23        sphMesh.setTextureMode(Sphere.TextureMode.Projected);
24        sphMesh.updateGeometry(32, 32, 1, false, false);
25        TangentBinormalGenerator.generate(sphMesh);
26
27        Geometry sphere = new Geometry("Rock Ball", sphMesh);
28        Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
29        mat.setColor("Ambient", ColorRGBA.DarkGray);
30        mat.setColor("Diffuse", ColorRGBA.White);
31        mat.setBoolean("UseMaterialColors", true);
32        sphere.setMaterial(mat);
33        rootNode.attachChild(sphere);
34
35        PointLight pl = new PointLight();
36        pl.setColor(ColorRGBA.White);
37        pl.setPosition(new Vector3f(4f, 0f, 0f));
38        rootNode.addLight(pl);
39
40        AmbientLight al = new AmbientLight();
41        al.setColor(ColorRGBA.White);
42        rootNode.addLight(al);
43    }
44}
45