Java Code Examples for com.jme3.scene.shape.Sphere#updateGeometry()
The following examples show how to use
com.jme3.scene.shape.Sphere#updateGeometry() .
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: TestTangentGen.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@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); }
Example 2
Source File: TestUnshadedModel.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { Sphere sphMesh = new Sphere(32, 32, 1); sphMesh.setTextureMode(Sphere.TextureMode.Projected); sphMesh.updateGeometry(32, 32, 1, false, false); TangentBinormalGenerator.generate(sphMesh); Geometry sphere = new Geometry("Rock Ball", sphMesh); Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); mat.setColor("Ambient", ColorRGBA.DarkGray); mat.setColor("Diffuse", ColorRGBA.White); mat.setBoolean("UseMaterialColors", true); sphere.setMaterial(mat); rootNode.attachChild(sphere); PointLight pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(4f, 0f, 0f)); rootNode.addLight(pl); AmbientLight al = new AmbientLight(); al.setColor(ColorRGBA.White); rootNode.addLight(al); }
Example 3
Source File: TestNormalMapping.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { Sphere sphMesh = new Sphere(32, 32, 1); sphMesh.setTextureMode(Sphere.TextureMode.Projected); sphMesh.updateGeometry(32, 32, 1, false, false); TangentBinormalGenerator.generate(sphMesh); Geometry sphere = new Geometry("Rock Ball", sphMesh); Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); sphere.setMaterial(mat); rootNode.attachChild(sphere); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(lightMdl); pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(0f, 0f, 4f)); rootNode.addLight(pl); // DirectionalLight dl = new DirectionalLight(); // dl.setDirection(new Vector3f(1,-1,1).normalizeLocal()); // dl.setColor(new ColorRGBA(0.22f, 0.15f, 0.1f, 1.0f)); // rootNode.addLight(dl); }
Example 4
Source File: TestUnshadedModel.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void simpleInitApp() { Sphere sphMesh = new Sphere(32, 32, 1); sphMesh.setTextureMode(Sphere.TextureMode.Projected); sphMesh.updateGeometry(32, 32, 1, false, false); TangentBinormalGenerator.generate(sphMesh); Geometry sphere = new Geometry("Rock Ball", sphMesh); Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); mat.setColor("Ambient", ColorRGBA.DarkGray); mat.setColor("Diffuse", ColorRGBA.White); mat.setBoolean("UseMaterialColors", true); sphere.setMaterial(mat); rootNode.attachChild(sphere); PointLight pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(4f, 0f, 0f)); rootNode.addLight(pl); AmbientLight al = new AmbientLight(); al.setColor(ColorRGBA.White); rootNode.addLight(al); }
Example 5
Source File: TestTangentGen.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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); }
Example 6
Source File: TestUnshadedModel.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void simpleInitApp() { Sphere sphMesh = new Sphere(32, 32, 1); sphMesh.setTextureMode(Sphere.TextureMode.Projected); sphMesh.updateGeometry(32, 32, 1, false, false); TangentBinormalGenerator.generate(sphMesh); Geometry sphere = new Geometry("Rock Ball", sphMesh); Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); mat.setColor("Ambient", ColorRGBA.DarkGray); mat.setColor("Diffuse", ColorRGBA.White); mat.setBoolean("UseMaterialColors", true); sphere.setMaterial(mat); rootNode.attachChild(sphere); PointLight pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(4f, 0f, 0f)); rootNode.addLight(pl); AmbientLight al = new AmbientLight(); al.setColor(ColorRGBA.White); rootNode.addLight(al); }
Example 7
Source File: TestNormalMapping.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void simpleInitApp() { Sphere sphMesh = new Sphere(32, 32, 1); sphMesh.setTextureMode(Sphere.TextureMode.Projected); sphMesh.updateGeometry(32, 32, 1, false, false); TangentBinormalGenerator.generate(sphMesh); Geometry sphere = new Geometry("Rock Ball", sphMesh); Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); sphere.setMaterial(mat); rootNode.attachChild(sphere); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(lightMdl); pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(0f, 0f, 4f)); rootNode.addLight(pl); // DirectionalLight dl = new DirectionalLight(); // dl.setDirection(new Vector3f(1,-1,1).normalizeLocal()); // dl.setColor(new ColorRGBA(0.22f, 0.15f, 0.1f, 1.0f)); // rootNode.addLight(dl); }
Example 8
Source File: MaterialPreviewWidget.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void initWidget() { SceneApplication.getApplication().addSceneListener(this); Sphere sphMesh = new Sphere(32, 32, 2.5f); sphMesh.setTextureMode(Sphere.TextureMode.Projected); sphMesh.updateGeometry(32, 32, 2.5f, false, false); TangentBinormalGenerator.generate(sphMesh); sphere = new Geometry("previewSphere", sphMesh); sphere.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_X)); Box boxMesh = new Box(new Vector3f(0, 0, 0), 1.75f, 1.75f, 1.75f); TangentBinormalGenerator.generate(boxMesh); box = new Geometry("previewBox", boxMesh); box.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.DEG_TO_RAD * 30, Vector3f.UNIT_X).multLocal(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_Y))); Quad quadMesh = new Quad(4.5f, 4.5f); TangentBinormalGenerator.generate(quadMesh); quad = new Geometry("previewQuad", quadMesh); quad.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0)); currentGeom = sphere; sphereButton.setSelected(true); init=true; }
Example 9
Source File: TestNormalMapping.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { Sphere sphMesh = new Sphere(32, 32, 1); sphMesh.setTextureMode(Sphere.TextureMode.Projected); sphMesh.updateGeometry(32, 32, 1, false, false); TangentBinormalGenerator.generate(sphMesh); Geometry sphere = new Geometry("Rock Ball", sphMesh); Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); sphere.setMaterial(mat); rootNode.attachChild(sphere); lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f)); lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(lightMdl); pl = new PointLight(); pl.setColor(ColorRGBA.White); pl.setPosition(new Vector3f(0f, 0f, 4f)); rootNode.addLight(pl); AmbientLight al = new AmbientLight(); al.setColor(new ColorRGBA(0.44f, 0.40f, 0.20f, 1.0f)); rootNode.addLight(al); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(1,-1,-1).normalizeLocal()); dl.setColor(new ColorRGBA(0.92f, 0.85f, 0.8f, 1.0f)); rootNode.addLight(dl); }
Example 10
Source File: TestShadowsPerf.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { flyCam.setMoveSpeed(50); flyCam.setEnabled(false); viewPort.setBackgroundColor(ColorRGBA.DarkGray); cam.setLocation(new Vector3f(-53.952988f, 27.15874f, -32.875023f)); cam.setRotation(new Quaternion(0.1564309f, 0.6910534f, -0.15713608f, 0.6879555f)); // cam.setLocation(new Vector3f(53.64627f, 130.56f, -11.247704f)); // cam.setRotation(new Quaternion(-6.5737107E-4f, 0.76819664f, -0.64021313f, -7.886125E-4f)); //// cam.setFrustumFar(500); mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m"); Box b = new Box(800, 1, 700); b.scaleTextureCoordinates(new Vector2f(50, 50)); Geometry ground = new Geometry("ground", b); ground.setMaterial(mat); rootNode.attachChild(ground); ground.setShadowMode(ShadowMode.Receive); Sphere sphMesh = new Sphere(32, 32, 1); sphMesh.setTextureMode(Sphere.TextureMode.Projected); sphMesh.updateGeometry(32, 32, 1, false, false); TangentBinormalGenerator.generate(sphMesh); sphere = new Geometry("Rock Ball", sphMesh); sphere.setLocalTranslation(0, 5, 0); sphere.setMaterial(mat); sphere.setShadowMode(ShadowMode.CastAndReceive); rootNode.attachChild(sphere); DirectionalLight dl = new DirectionalLight(); dl.setDirection(new Vector3f(0, -1, 0).normalizeLocal()); dl.setColor(ColorRGBA.White); rootNode.addLight(dl); AmbientLight al = new AmbientLight(); al.setColor(ColorRGBA.White.mult(0.7f)); rootNode.addLight(al); //rootNode.setShadowMode(ShadowMode.CastAndReceive); createballs(); final DirectionalLightShadowRenderer pssmRenderer = new DirectionalLightShadowRenderer(assetManager, 1024, 4); viewPort.addProcessor(pssmRenderer); // // final PssmShadowFilter pssmRenderer = new PssmShadowFilter(assetManager, 1024, 4); // FilterPostProcessor fpp = new FilterPostProcessor(assetManager); // fpp.addFilter(pssmRenderer); // viewPort.addProcessor(fpp); pssmRenderer.setLight(dl); pssmRenderer.setLambda(0.55f); pssmRenderer.setShadowIntensity(0.55f); pssmRenderer.setShadowCompareMode(com.jme3.shadow.CompareMode.Software); pssmRenderer.setEdgeFilteringMode(EdgeFilteringMode.PCF4); //pssmRenderer.displayDebug(); inputManager.addListener(new ActionListener() { @Override public void onAction(String name, boolean isPressed, float tpf) { if (name.equals("display") && isPressed) { //pssmRenderer.debugFrustrums(); System.out.println("tetetetet"); } if (name.equals("add") && isPressed) { createballs(); } } }, "display", "add"); inputManager.addMapping("display", new KeyTrigger(KeyInput.KEY_SPACE)); inputManager.addMapping("add", new KeyTrigger(KeyInput.KEY_RETURN)); }