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); }
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); }
protected Spatial makeCharacter() { // load a character from jme3test-test-data Spatial golem = assetManager.loadModel("Models/Oto/Oto.mesh.xml"); golem.scale(0.5f); golem.setLocalTranslation(-1.0f, -1.5f, -0.6f); // We must add a light to make the model visible DirectionalLight sun = new DirectionalLight(); sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f)); golem.addLight(sun); return golem; } }
protected Spatial makeCharacter() { // load a character from jme3test-test-data Spatial golem = assetManager.loadModel("Models/Oto/Oto.mesh.xml"); golem.scale(0.5f); golem.setLocalTranslation(-1.0f, -1.5f, -0.6f); // We must add a light to make the model visible DirectionalLight sun = new DirectionalLight(); sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal()); golem.addLight(sun); return golem; } }
private void makeScene() { // load sky rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", SkyFactory.EnvMapType.CubeMap)); //assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class); Spatial scene = assetManager.loadModel("Models/Test/CornellBox.j3o"); DirectionalLight sun = new DirectionalLight(); sun.setDirection(new Vector3f(-0.4790551f, -0.39247334f, -0.7851566f)); scene.addLight(sun); rootNode.attachChild(scene); } }
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); }
@Override public void simpleInitApp() { bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); // bulletAppState.getPhysicsSpace().enableDebug(assetManager); cam.setFrustumFar(150f); flyCam.setMoveSpeed(10); setupKeys(); PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace()); // setupFloor(); buildPlayer(); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.5f, -1f, -0.3f).normalizeLocal()); rootNode.addLight(dl); dl = new DirectionalLight(); dl.setDirection(new Vector3f(0.5f, -0.1f, 0.3f).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 protected void initialize(Application app) { vp = app.getRenderManager().createMainView("debug", app.getCamera()); vp.attachScene(debugNode); vp.setClearDepth(true); this.app = app; for (ArmatureDebugger armatureDebugger : armatures.values()) { armatureDebugger.initialize(app.getAssetManager(), app.getCamera()); } app.getInputManager().addListener(actionListener, "shoot", "toggleJoints"); app.getInputManager().addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT), new MouseButtonTrigger(MouseInput.BUTTON_RIGHT)); app.getInputManager().addMapping("toggleJoints", new KeyTrigger(KeyInput.KEY_F10)); debugNode.addLight(new DirectionalLight(new Vector3f(-1f, -1f, -1f).normalizeLocal())); debugNode.addLight(new DirectionalLight(new Vector3f(1f, 1f, 1f).normalizeLocal(), new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f))); vp.setEnabled(false); }
@Test public void testDirectionalFiltering() { geom.addLight(new DirectionalLight(Vector3f.UNIT_Y)); checkFilteredLights(1); // Directional lights must never be filtered // Test for bounding Sphere geom.setModelBound(new BoundingSphere(0.5f, Vector3f.ZERO)); checkFilteredLights(1); // Directional lights must never be filtered }
@Override public void simpleInitApp() { viewPort.setBackgroundColor(ColorRGBA.LightGray); initKeys(); /** Add a light source so we can see the model */ DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal()); rootNode.addLight(dl); /** Load a model that contains animation */ player = (Node) assetManager.loadModel("Models/Oto/OtoOldAnim.j3o"); player.setLocalScale(0.5f); rootNode.attachChild(player); /** Create a controller and channels. */ control = player.getControl(AnimControl.class); control.addListener(this); channel = control.createChannel(); channel.setAnim("stand"); }
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"); }
@Test public void testSimpleSort() { Geometry g = new Geometry("test", new Mesh()); LightList list = new LightList(g); list.add(new SpotLight(Vector3f.ZERO, Vector3f.UNIT_X)); list.add(new PointLight(Vector3f.UNIT_X)); list.add(new DirectionalLight(Vector3f.UNIT_X)); list.add(new AmbientLight()); list.sort(true); assert list.get(0) instanceof AmbientLight; // Ambients always first assert list.get(1) instanceof DirectionalLight; // .. then directionals assert list.get(2) instanceof SpotLight; // Spot is 0 units away from geom assert list.get(3) instanceof PointLight; // .. and point is 1 unit away. }