public void setupLighting() { dl = new DirectionalLight(); dl.setDirection(lightDir); dl.setColor(new ColorRGBA(.9f, .9f, .9f, 1)); rootNode.addLight(dl); } Material mat;
public void setupLighting() { dl = new DirectionalLight(); dl.setDirection(lightDir); dl.setColor(new ColorRGBA(.9f, .9f, .9f, 1)); rootNode.addLight(dl); } Material mat;
public void setupLighting() { DirectionalLight dl = new DirectionalLight(); dl.setDirection(lightDir); dl.setColor(new ColorRGBA(.9f, .9f, .9f, 1)); rootNode.addLight(dl); dl = new DirectionalLight(); dl.setDirection(new Vector3f(1, 0, -1).normalizeLocal()); dl.setColor(new ColorRGBA(.4f, .4f, .4f, 1)); // rootNode.addLight(dl); }
public void setupLighting(){ boolean hdr = false; if (toneMapFilter != null){ hdr = toneMapFilter.isEnabled(); } DirectionalLight dl = new DirectionalLight(); if (dlsr != null) { dlsr.setLight(dl); } dl.setDirection(lightDir); if (hdr){ dl.setColor(new ColorRGBA(3, 3, 3, 1)); }else{ dl.setColor(new ColorRGBA(.9f, .9f, .9f, 1)); } rootNode.addLight(dl); dl = new DirectionalLight(); dl.setDirection(new Vector3f(1, 0, -1).normalizeLocal()); if (hdr){ dl.setColor(new ColorRGBA(1, 1, 1, 1)); }else{ dl.setColor(new ColorRGBA(.4f, .4f, .4f, 1)); } rootNode.addLight(dl); }
private void setupLight() { // AmbientLight al = new AmbientLight(); // al.setColor(ColorRGBA.White.mult(1)); // rootNode.addLight(al); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal()); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); rootNode.addLight(dl); }
private void setupLight() { DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal()); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); rootNode.addLight(dl); }
private void createLight() { Vector3f direction = new Vector3f(-0.1f, -0.7f, -1).normalizeLocal(); DirectionalLight dl = new DirectionalLight(); dl.setDirection(direction); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); rootNode.addLight(dl); }
public void setupLighting(){ DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-1, -1, 1).normalizeLocal()); dl.setColor(new ColorRGBA(2,2,2,1)); rootNode.addLight(dl); }
@Override public void simpleInitApp() { Spatial ogreModel = assetManager.loadModel("Models/Oto/Oto.mesh.xml"); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.White); dl.setDirection(new Vector3f(0,-1,-1).normalizeLocal()); rootNode.addLight(dl); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryExporter exp = new BinaryExporter(); exp.save(ogreModel, baos); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); BinaryImporter imp = new BinaryImporter(); imp.setAssetManager(assetManager); Node ogreModelReloaded = (Node) imp.load(bais, null, null); AnimComposer composer = ogreModelReloaded.getControl(AnimComposer.class); composer.setCurrentAction("Walk"); rootNode.attachChild(ogreModelReloaded); } catch (IOException ex){ ex.printStackTrace(); } } }
private void setUpLight() { // We add light so we see the scene AmbientLight al = new AmbientLight(); al.setColor(ColorRGBA.White.mult(1.3f)); rootNode.addLight(al); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.White); dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal()); rootNode.addLight(dl); }
public void simpleInitApp() { cam.setLocation(new Vector3f(0f, 0.5f, 3f)); viewPort.setBackgroundColor(ColorRGBA.LightGray); // Add a light source to the scene. DirectionalLight directionalLight = new DirectionalLight(); directionalLight.setColor(ColorRGBA.Magenta); directionalLight.setDirection(Vector3f.UNIT_XYZ.negate()); rootNode.addLight(directionalLight); // Create and add a teapot to the scene graph. Spatial teapotModel = assetManager.loadModel("Models/Teapot/Teapot.obj"); rootNode.attachChild(teapotModel); // Create the two moving quads with custom blend modes. createLeftQuad(); createRightQuad(); }
@Override public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.DarkGray); Spatial bumpy = (Spatial) assetManager.loadModel("Models/MonkeyHead/MonkeyHead.mesh.xml"); rootNode.attachChild(bumpy); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(lightMdl); // flourescent main light pl = new PointLight(); pl.setColor(new ColorRGBA(0.88f, 0.92f, 0.95f, 1.0f)); rootNode.addLight(pl); // sunset light DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f,-0.7f,1).normalizeLocal()); dl.setColor(new ColorRGBA(0.44f, 0.30f, 0.20f, 1.0f)); rootNode.addLight(dl); // skylight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.6f,-1,-0.6f).normalizeLocal()); dl.setColor(new ColorRGBA(0.10f, 0.22f, 0.44f, 1.0f)); rootNode.addLight(dl); // white ambient light dl = new DirectionalLight(); dl.setDirection(new Vector3f(1, -0.5f,-0.1f).normalizeLocal()); dl.setColor(new ColorRGBA(0.50f, 0.40f, 0.50f, 1.0f)); rootNode.addLight(dl); }
public void simpleInitApp() { Geometry teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj"); DirectionalLight dl = new DirectionalLight(); dl.setColor(ColorRGBA.White); dl.setDirection(Vector3f.UNIT_XYZ.negate()); rootNode.addLight(dl); rootNode.attachChild(teaGeom); // Setup first view cam.setParallelProjection(true); float aspect = (float) cam.getWidth() / cam.getHeight(); cam.setFrustum(-1000, 1000, -aspect * frustumSize, aspect * frustumSize, frustumSize, -frustumSize); inputManager.addListener(this, "Size+", "Size-"); inputManager.addMapping("Size+", new KeyTrigger(KeyInput.KEY_W)); inputManager.addMapping("Size-", new KeyTrigger(KeyInput.KEY_S)); }
@Override public void simpleInitApp() { flyCam.setMoveSpeed(20); Sphere sphereMesh = new Sphere(32, 32, 1); sphereMesh.setTextureMode(Sphere.TextureMode.Projected); sphereMesh.updateGeometry(32, 32, 1, false, false); addMesh("Sphere", sphereMesh, new Vector3f(-1, 0, 0)); Quad quadMesh = new Quad(1, 1); quadMesh.updateGeometry(1, 1); addMesh("Quad", quadMesh, new Vector3f(1, 0, 0)); Mesh strip = createTriangleStripMesh(); addMesh("strip", strip, new Vector3f(0, -3, 0)); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(1, -1, -1).normalizeLocal()); dl.setColor(ColorRGBA.White); rootNode.addLight(dl); }
@Override public void simpleInitApp() { flyCam.setMoveSpeed(10f); cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f)); cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f)); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal()); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); rootNode.addLight(dl); BlenderKey blenderKey = new BlenderKey("Blender/2.4x/animtest.blend"); Spatial scene = (Spatial) assetManager.loadModel(blenderKey); rootNode.attachChild(scene); Spatial model = this.findNode(rootNode, "Cube"); model.center(); control = model.getControl(AnimControl.class); channel = control.createChannel(); channel.setAnim("Action"); }
@Override public void simpleInitApp() { flyCam.setMoveSpeed(10f); cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f)); cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f)); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal()); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); rootNode.addLight(dl); BlenderKey blenderKey = new BlenderKey("Blender/2.4x/BaseMesh_249.blend"); Spatial scene = (Spatial) assetManager.loadModel(blenderKey); rootNode.attachChild(scene); Spatial model = this.findNode(rootNode, "BaseMesh_01"); model.center(); control = model.getControl(AnimControl.class); channel = control.createChannel(); channel.setAnim("run_01"); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(10f, 3f, 40f)); cam.lookAtDirection(Vector3f.UNIT_Z.negate(), Vector3f.UNIT_Y); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal()); dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f)); rootNode.addLight(dl); AnimComposer composer; Spatial originalModel = assetManager.loadModel("Models/Oto/Oto.mesh.xml"); composer = originalModel.getControl(AnimComposer.class); composer.setCurrentAction("Walk"); rootNode.attachChild(originalModel); Spatial clonedModel = originalModel.clone(); clonedModel.move(10, 0, 0); composer = clonedModel.getControl(AnimComposer.class); composer.setCurrentAction("push"); rootNode.attachChild(clonedModel); Spatial exportedModel = BinaryExporter.saveAndLoad(assetManager, originalModel); exportedModel.move(20, 0, 0); composer = exportedModel.getControl(AnimComposer.class); composer.setCurrentAction("pull"); rootNode.attachChild(exportedModel); } }
private void createScene() { Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); mat.setFloat("Shininess", 1f); mat.setBoolean("UseMaterialColors", true); mat.setColor("Ambient", ColorRGBA.Black); mat.setColor("Diffuse", ColorRGBA.DarkGray); mat.setColor("Specular", ColorRGBA.White.mult(0.6f)); Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); matSoil.setBoolean("UseMaterialColors", true); matSoil.setColor("Ambient", ColorRGBA.Gray); matSoil.setColor("Diffuse", ColorRGBA.Gray); matSoil.setColor("Specular", ColorRGBA.Black); teapot = assetManager.loadModel("Models/Teapot/Teapot.obj"); teapot.setLocalScale(3); teapot.setMaterial(mat); rootNode.attachChild(teapot); Geometry soil = new Geometry("soil", new Box(50, 1, 50)); soil.setLocalTranslation(0, -1, 0); soil.setMaterial(matSoil); rootNode.attachChild(soil); DirectionalLight light = new DirectionalLight(); light.setDirection(new Vector3f(0, -1, 0).normalizeLocal()); light.setColor(ColorRGBA.White.mult(1.5f)); rootNode.addLight(light); }
private void createScene() { Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); mat.setFloat("Shininess", 1f); mat.setBoolean("UseMaterialColors", true); mat.setColor("Ambient", ColorRGBA.Black); mat.setColor("Diffuse", ColorRGBA.DarkGray); mat.setColor("Specular", ColorRGBA.White.mult(0.6f)); Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); matSoil.setBoolean("UseMaterialColors", true); matSoil.setColor("Ambient", ColorRGBA.Black); matSoil.setColor("Diffuse", ColorRGBA.Black); matSoil.setColor("Specular", ColorRGBA.Black); teapot = assetManager.loadModel("Models/Teapot/Teapot.obj"); teapot.setName("Teapot"); teapot.setLocalScale(3); teapot.setMaterial(mat); rootNode.attachChild(teapot); Geometry soil = new Geometry("soil", new Box(50, 1, 50)); soil.setLocalTranslation(0, -1, 0); soil.setMaterial(matSoil); rootNode.attachChild(soil); DirectionalLight light = new DirectionalLight(); light.setDirection(new Vector3f(0, -1, 0).normalizeLocal()); light.setColor(ColorRGBA.White.mult(1.5f)); rootNode.addLight(light); }