• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package jme3test.material;
2 
3 import com.jme3.app.SimpleApplication;
4 import com.jme3.light.AmbientLight;
5 import com.jme3.light.PointLight;
6 import com.jme3.material.Material;
7 import com.jme3.math.ColorRGBA;
8 import com.jme3.math.Vector3f;
9 import com.jme3.scene.Geometry;
10 import com.jme3.scene.shape.Sphere;
11 import com.jme3.util.TangentBinormalGenerator;
12 
13 public class TestUnshadedModel extends SimpleApplication {
14 
main(String[] args)15     public static void main(String[] args){
16         TestUnshadedModel app = new TestUnshadedModel();
17         app.start();
18     }
19 
20     @Override
simpleInitApp()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