com.jme3.util.SkyFactory Java Examples
The following examples show how to use
com.jme3.util.SkyFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestSimpleWater.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void initScene() { //init cam location cam.setLocation(new Vector3f(0, 10, 10)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); //init scene sceneNode = new Node("Scene"); mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); geom.setMaterial(mat); sceneNode.attachChild(geom); // load sky sceneNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", SkyFactory.EnvMapType.CubeMap)); rootNode.attachChild(sceneNode); //add lightPos Geometry Sphere lite=new Sphere(8, 8, 3.0f); lightSphere=new Geometry("lightsphere", lite); lightSphere.setMaterial(mat); lightSphere.setLocalTranslation(lightPos); rootNode.attachChild(lightSphere); }
Example #2
Source File: TestSkyLoadingLagoon.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void simpleInitApp() { Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); /* Texture west = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_x.png"); Texture east = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_x.png"); Texture north = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_z.png"); Texture south = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_z.png"); Texture up = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_y.png"); Texture down = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_y.png"); */ Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
Example #3
Source File: TestSkyLoadingPrimitives.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void simpleInitApp() { /* Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); */ Texture west = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_x.png"); Texture east = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_x.png"); Texture north = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_z.png"); Texture south = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_z.png"); Texture up = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_y.png"); Texture down = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_y.png"); Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
Example #4
Source File: TestSimpleWater.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void initScene() { //init cam location cam.setLocation(new Vector3f(0, 10, 10)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); //init scene sceneNode = new Node("Scene"); mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); geom.setMaterial(mat); sceneNode.attachChild(geom); // load sky sceneNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false)); rootNode.attachChild(sceneNode); //add lightPos Geometry Sphere lite=new Sphere(8, 8, 3.0f); lightSphere=new Geometry("lightsphere", lite); lightSphere.setMaterial(mat); lightSphere.setLocalTranslation(lightPos); rootNode.attachChild(lightSphere); }
Example #5
Source File: TestEnvironmentMapping.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { final Node buggy = (Node) assetManager.loadModel("Models/Buggy/Buggy.j3o"); TextureKey key = new TextureKey("Textures/Sky/Bright/BrightSky.dds", true); key.setGenerateMips(true); key.setAsCube(true); final Texture tex = assetManager.loadTexture(key); for (Spatial geom : buggy.getChildren()) { if (geom instanceof Geometry) { Material m = ((Geometry) geom).getMaterial(); m.setTexture("EnvMap", tex); m.setVector3("FresnelParams", new Vector3f(0.05f, 0.18f, 0.11f)); } } flyCam.setEnabled(false); ChaseCamera chaseCam = new ChaseCamera(cam, inputManager); chaseCam.setLookAtOffset(new Vector3f(0,0.5f,-1.0f)); buggy.addControl(chaseCam); rootNode.attachChild(buggy); rootNode.attachChild(SkyFactory.createSky(assetManager, tex, false)); FilterPostProcessor fpp = new FilterPostProcessor(assetManager); BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects); bf.setBloomIntensity(2.3f); bf.setExposurePower(0.6f); fpp.addFilter(bf); viewPort.addProcessor(fpp); }
Example #6
Source File: TestEverything.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void setupSkyBox(){ Texture envMap; if (renderer.getCaps().contains(Caps.FloatTexture)){ envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.hdr"); }else{ envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg"); } rootNode.attachChild(SkyFactory.createSky(assetManager, envMap, new Vector3f(-1,-1,-1), SkyFactory.EnvMapType.SphereMap)); }
Example #7
Source File: TestSkyLoading.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
Example #8
Source File: TerrainTestAdvanced.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void createSky() { Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
Example #9
Source File: TestFog.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void simpleInitApp() { this.flyCam.setMoveSpeed(10); Node mainScene=new Node(); cam.setLocation(new Vector3f(-27.0f, 1.0f, 75.0f)); cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f)); // load sky mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false)); // create the geometry and attach it // load the level from zip or http zip if (useHttp) { assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class.getName()); } else { assetManager.registerLocator("wildhouse.zip", ZipLocator.class.getName()); } Spatial scene = assetManager.loadModel("main.scene"); DirectionalLight sun = new DirectionalLight(); Vector3f lightDir=new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f); sun.setDirection(lightDir); sun.setColor(ColorRGBA.White.clone().multLocal(2)); scene.addLight(sun); mainScene.attachChild(scene); rootNode.attachChild(mainScene); fpp=new FilterPostProcessor(assetManager); //fpp.setNumSamples(4); fog=new FogFilter(); fog.setFogColor(new ColorRGBA(0.9f, 0.9f, 0.9f, 1.0f)); fog.setFogDistance(155); fog.setFogDensity(2.0f); fpp.addFilter(fog); viewPort.addProcessor(fpp); initInputs(); }
Example #10
Source File: TestPostFilters.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void setupSkyBox() { Texture envMap; if (renderer.getCaps().contains(Caps.FloatTexture)) { envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.hdr"); } else { envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg"); } rootNode.attachChild(SkyFactory.createSky(assetManager, envMap, new Vector3f(-1, -1, -1), true)); }
Example #11
Source File: TestSpotLightTerrain.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void createSky() { Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
Example #12
Source File: DDSPreview.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void requestPreview(String textureName, String displayName, int width, int height, JComponent picLabel, JLabel infoLabel) { TextureKey key = new TextureKey(textureName); picPreview = picLabel; assetManager.deleteFromCache(key); Texture t = assetManager.loadTexture(key); Spatial geom = quad; if (key.getTextureTypeHint() == Texture.Type.TwoDimensional) { material.setTexture("ColorMap", t); geom.setMaterial(material); if (infoLabel != null) { infoLabel.setText(" " + displayName + " w : " + t.getImage().getWidth() + " h : " + t.getImage().getHeight()); } } else if (key.getTextureTypeHint() == Texture.Type.ThreeDimensional) { geom = quad3D; assetManager.deleteFromCache(key); key.setAsTexture3D(true); t = assetManager.loadTexture(key); material3D.setTexture("Texture", t); geom.setMaterial(material3D); if (infoLabel != null) { infoLabel.setText(" " + displayName + " (Texture3D) w : " + t.getImage().getWidth() + " h : " + t.getImage().getHeight() + " d : " + t.getImage().getDepth()); } } else if (key.getTextureTypeHint() == Texture.Type.CubeMap) { assetManager.deleteFromCache(key); geom = SkyFactory.createSky(assetManager, textureName, false); if (infoLabel != null) { infoLabel.setText(" " + displayName + " (CubeMap) w : " + t.getImage().getWidth() + " h : " + t.getImage().getHeight()); } } PreviewRequest request = new PreviewRequest(this, geom, width, height); request.getCameraRequest().setLocation(new Vector3f(0, 0, 5.3f)); request.getCameraRequest().setLookAt(new Vector3f(0, 0, 0), Vector3f.UNIT_Y.mult(-1)); SceneApplication.getApplication().createPreview(request); }
Example #13
Source File: TestSceneLoading.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void simpleInitApp() { this.flyCam.setMoveSpeed(10); // load sky rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false)); File file = new File("wildhouse.zip"); if (!file.exists()) { useHttp = true; } // create the geometry and attach it // load the level from zip or http zip if (useHttp) { assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class.getName()); } else { assetManager.registerLocator("wildhouse.zip", ZipLocator.class.getName()); } Spatial scene = assetManager.loadModel("main.scene"); AmbientLight al = new AmbientLight(); scene.addLight(al); DirectionalLight sun = new DirectionalLight(); sun.setDirection(new Vector3f(0.69077975f, -0.6277887f, -0.35875428f).normalizeLocal()); sun.setColor(ColorRGBA.White.clone().multLocal(2)); scene.addLight(sun); rootNode.attachChild(scene); }
Example #14
Source File: TestHoveringTank.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { bulletAppState = new BulletAppState(); bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL); stateManager.attach(bulletAppState); // bulletAppState.getPhysicsSpace().enableDebug(assetManager); bulletAppState.getPhysicsSpace().setAccuracy(1f/30f); rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false)); PssmShadowRenderer pssmr = new PssmShadowRenderer(assetManager, 2048, 3); pssmr.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal()); pssmr.setLambda(0.55f); pssmr.setShadowIntensity(0.6f); pssmr.setCompareMode(CompareMode.Hardware); pssmr.setFilterMode(FilterMode.Bilinear); viewPort.addProcessor(pssmr); setupKeys(); createTerrain(); buildPlayer(); DirectionalLight dl = new DirectionalLight(); dl.setColor(new ColorRGBA(1.0f, 0.94f, 0.8f, 1f).multLocal(1.3f)); dl.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal()); rootNode.addLight(dl); Vector3f lightDir2 = new Vector3f(0.70518064f, 0.5902297f, -0.39287305f); DirectionalLight dl2 = new DirectionalLight(); dl2.setColor(new ColorRGBA(0.7f, 0.85f, 1.0f, 1f)); dl2.setDirection(lightDir2); rootNode.addLight(dl2); }
Example #15
Source File: TestEverything.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void setupSkyBox(){ Texture envMap; if (renderer.getCaps().contains(Caps.FloatTexture)){ envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.hdr"); }else{ envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg"); } rootNode.attachChild(SkyFactory.createSky(assetManager, envMap, new Vector3f(-1,-1,-1), true)); }
Example #16
Source File: TestSkyLoading.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void simpleInitApp() { Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
Example #17
Source File: TerrainEditorController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private Spatial doCreateSky(Node parent, Texture west, Texture east, Texture north, Texture south, Texture top, Texture bottom, Vector3f normalScale) { AssetManager manager = SceneApplication.getApplication().getAssetManager(); Spatial sky = SkyFactory.createSky(manager, west, east, north, south, top, bottom, normalScale); parent.attachChild(sky); return sky; }
Example #18
Source File: TerrainEditorController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private Spatial doCreateSky(Node parent, Texture texture, boolean useSpheremap, Vector3f normalScale) { AssetManager manager = SceneApplication.getApplication().getAssetManager(); Spatial sky = SkyFactory.createSky(manager, texture, normalScale, useSpheremap); parent.attachChild(sky); return sky; }
Example #19
Source File: AdvancedPbrWithStudioSky3DEditorPart.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
public AdvancedPbrWithStudioSky3DEditorPart(@NotNull final T fileEditor) { super(fileEditor); final AssetManager assetManager = EditorUtil.getAssetManager(); final Geometry sky = (Geometry) SkyFactory.createSky(assetManager, "graphics/textures/sky/studio.hdr", SkyFactory.EnvMapType.EquirectMap); final Node stateNode = getStateNode(); stateNode.attachChild(sky); }
Example #20
Source File: TestSpotLightTerrain.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void createSky() { Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
Example #21
Source File: TestRenderToCubemap.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(3, 3, 3)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); Texture offTex = setupOffscreenView(); Spatial sky = SkyFactory.createSky(assetManager, offTex, EnvMapType.CubeMap); rootNode.attachChild(sky); }
Example #22
Source File: TestHoveringTank.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { bulletAppState = new BulletAppState(); bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL); stateManager.attach(bulletAppState); // bulletAppState.getPhysicsSpace().enableDebug(assetManager); bulletAppState.getPhysicsSpace().setAccuracy(1f/30f); rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", EnvMapType.CubeMap)); DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, 2048, 3); dlsr.setLambda(0.55f); dlsr.setShadowIntensity(0.6f); dlsr.setEdgeFilteringMode(EdgeFilteringMode.Bilinear); viewPort.addProcessor(dlsr); setupKeys(); createTerrain(); buildPlayer(); DirectionalLight dl = new DirectionalLight(); dlsr.setLight(dl); dl.setColor(new ColorRGBA(1.0f, 0.94f, 0.8f, 1f).multLocal(1.3f)); dl.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal()); rootNode.addLight(dl); Vector3f lightDir2 = new Vector3f(0.70518064f, 0.5902297f, -0.39287305f); DirectionalLight dl2 = new DirectionalLight(); dl2.setColor(new ColorRGBA(0.7f, 0.85f, 1.0f, 1f)); dl2.setDirection(lightDir2); rootNode.addLight(dl2); }
Example #23
Source File: TestPostFilters.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void setupSkyBox() { Texture envMap; if (renderer.getCaps().contains(Caps.FloatTexture)) { envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.hdr"); } else { envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg"); } Spatial sky = SkyFactory.createSky(assetManager, envMap, new Vector3f(-1f, -1f, -1f), EnvMapType.SphereMap); rootNode.attachChild(sky); }
Example #24
Source File: TestPostFiltersCompositing.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
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); }
Example #25
Source File: TestEnvironmentMapping.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { final Node buggy = (Node) assetManager.loadModel("Models/Buggy/Buggy.j3o"); TextureKey key = new TextureKey("Textures/Sky/Bright/BrightSky.dds", true); key.setGenerateMips(true); key.setTextureTypeHint(Texture.Type.CubeMap); final Texture tex = assetManager.loadTexture(key); for (Spatial geom : buggy.getChildren()) { if (geom instanceof Geometry) { Material m = ((Geometry) geom).getMaterial(); m.setTexture("EnvMap", tex); m.setVector3("FresnelParams", new Vector3f(0.05f, 0.18f, 0.11f)); } } flyCam.setEnabled(false); ChaseCamera chaseCam = new ChaseCamera(cam, inputManager); chaseCam.setLookAtOffset(new Vector3f(0,0.5f,-1.0f)); buggy.addControl(chaseCam); rootNode.attachChild(buggy); rootNode.attachChild(SkyFactory.createSky(assetManager, tex, SkyFactory.EnvMapType.CubeMap)); FilterPostProcessor fpp = new FilterPostProcessor(assetManager); BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects); bf.setBloomIntensity(2.3f); bf.setExposurePower(0.6f); fpp.addFilter(bf); DirectionalLight l = new DirectionalLight(); l.setDirection(new Vector3f(0, -1, -1)); rootNode.addLight(l); viewPort.addProcessor(fpp); }
Example #26
Source File: TestSceneLoading.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { File file = new File("wildhouse.zip"); if (!file.exists()) { useHttp = true; } this.flyCam.setMoveSpeed(10); // load sky rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", SkyFactory.EnvMapType.CubeMap)); // create the geometry and attach it // load the level from zip or http zip if (useHttp) { assetManager.registerLocator("https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jmonkeyengine/wildhouse.zip", HttpZipLocator.class); } else { assetManager.registerLocator("wildhouse.zip", ZipLocator.class); } Spatial scene = assetManager.loadModel("main.scene"); AmbientLight al = new AmbientLight(); scene.addLight(al); DirectionalLight sun = new DirectionalLight(); sun.setDirection(new Vector3f(0.69077975f, -0.6277887f, -0.35875428f).normalizeLocal()); sun.setColor(ColorRGBA.White.clone().multLocal(2)); scene.addLight(sun); rootNode.attachChild(scene); }
Example #27
Source File: TestFog.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { this.flyCam.setMoveSpeed(50); Node mainScene=new Node(); cam.setLocation(new Vector3f(-34.74095f, 95.21318f, -287.4945f)); cam.setRotation(new Quaternion(0.023536969f, 0.9361278f, -0.016098259f, -0.35050195f)); // load sky mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", SkyFactory.EnvMapType.CubeMap)); createTerrain(mainScene); DirectionalLight sun = new DirectionalLight(); Vector3f lightDir=new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f); sun.setDirection(lightDir); sun.setColor(ColorRGBA.White.clone().multLocal(2)); mainScene.addLight(sun); rootNode.attachChild(mainScene); fpp=new FilterPostProcessor(assetManager); //fpp.setNumSamples(4); int numSamples = getContext().getSettings().getSamples(); if( numSamples > 0 ) { fpp.setNumSamples(numSamples); } fog=new FogFilter(); fog.setFogColor(new ColorRGBA(0.9f, 0.9f, 0.9f, 1.0f)); fog.setFogDistance(155); fog.setFogDensity(1.0f); fpp.addFilter(fog); viewPort.addProcessor(fpp); initInputs(); }
Example #28
Source File: TerrainTestAdvanced.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void createSky() { Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
Example #29
Source File: JmeFilePreviewManager.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
/** * Prepare a transfer processor to transfer preview result to a image view. * * @return the transfer processor. */ @JmeThread private @NotNull FrameTransferSceneProcessor prepareScene() { var jmeApplication = JmeApplication.getInstance(); var assetManager = jmeApplication.getAssetManager(); var sky = SkyFactory.createSky(assetManager, "graphics/textures/sky/studio.hdr", SkyFactory.EnvMapType.EquirectMap); var light = new DirectionalLight(); light.setDirection(LIGHT_DIRECTION); var cameraNode = new Node("Camera node"); var rootNode = jmeApplication.getPreviewNode(); rootNode.addControl(this); rootNode.attachChild(sky); rootNode.addLight(light); rootNode.attachChild(cameraNode); rootNode.attachChild(modelNode); var camera = jmeApplication.getPreviewCamera(); var editorCamera = new EditorCamera(camera, cameraNode); editorCamera.setMaxDistance(10000); editorCamera.setMinDistance(0.01F); editorCamera.setSmoothMotion(false); editorCamera.setRotationSensitivity(1); editorCamera.setZoomSensitivity(0.2F); //TODO added supporting moving the camera processor = bind(jmeApplication, imageView, imageView, jmeApplication.getPreviewViewPort(), false); processor.setTransferMode(ON_CHANGES); processor.setEnabled(false); return processor; }
Example #30
Source File: TestParallax.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
public void setupSkyBox() { rootNode.attachChild(SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false)); }