Java Code Examples for com.jme3.scene.shape.Quad#updateGeometry()
The following examples show how to use
com.jme3.scene.shape.Quad#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: TestUrlLoading.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { // create a simple plane/quad Quad quadMesh = new Quad(1, 1); quadMesh.updateGeometry(1, 1, true); Geometry quad = new Geometry("Textured Quad", quadMesh); assetManager.registerLocator("https://raw.githubusercontent.com/jMonkeyEngine/BookSamples/master/assets/Textures/", UrlLocator.class); TextureKey key = new TextureKey("mucha-window.png", false); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", tex); quad.setMaterial(mat); float aspect = tex.getImage().getWidth() / (float) tex.getImage().getHeight(); quad.setLocalScale(new Vector3f(aspect * 1.5f, 1.5f, 1)); quad.center(); rootNode.attachChild(quad); }
Example 3
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 4
Source File: TestOnlineJar.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void simpleInitApp() { // create a simple plane/quad Quad quadMesh = new Quad(1, 1); quadMesh.updateGeometry(1, 1, true); Geometry quad = new Geometry("Textured Quad", quadMesh); assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/town.zip", HttpZipLocator.class); TextureKey key = new TextureKey("grass.jpg", false); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", tex); quad.setMaterial(mat); float aspect = tex.getImage().getWidth() / (float) tex.getImage().getHeight(); quad.setLocalScale(new Vector3f(aspect * 1.5f, 1.5f, 1)); quad.center(); rootNode.attachChild(quad); }
Example 5
Source File: TestUrlLoading.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void simpleInitApp() { // create a simple plane/quad Quad quadMesh = new Quad(1, 1); quadMesh.updateGeometry(1, 1, true); Geometry quad = new Geometry("Textured Quad", quadMesh); assetManager.registerLocator("http://www.jmonkeyengine.com/wp-content/uploads/2010/09/", UrlLocator.class); TextureKey key = new TextureKey("planet-2.jpg", false); key.setGenerateMips(true); Texture tex = assetManager.loadTexture(key); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", tex); quad.setMaterial(mat); float aspect = tex.getImage().getWidth() / (float) tex.getImage().getHeight(); quad.setLocalScale(new Vector3f(aspect * 1.5f, 1.5f, 1)); quad.center(); rootNode.attachChild(quad); }
Example 6
Source File: TestOnlineJar.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { // create a simple plane/quad Quad quadMesh = new Quad(1, 1); quadMesh.updateGeometry(1, 1, true); Geometry quad = new Geometry("Textured Quad", quadMesh); assetManager.registerLocator("https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jmonkeyengine/town.zip", HttpZipLocator.class); assetManager.registerLocator("https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jmonkeyengine/wildhouse.zip", HttpZipLocator.class); Picture pic1 = new Picture("Picture1"); pic1.move(0, 0, -1); pic1.setPosition(0, 0); pic1.setWidth(128); pic1.setHeight(128); pic1.setImage(assetManager, "grass.jpg", false); guiNode.attachChild(pic1); Picture pic2 = new Picture("Picture1"); pic2.move(0, 0, -1); pic2.setPosition(128, 0); pic2.setWidth(128); pic2.setHeight(128); pic2.setImage(assetManager, "glasstile2.png", false); guiNode.attachChild(pic2); }
Example 7
Source File: TestMipMapGen.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { BitmapText txt = guiFont.createLabel("Left: HW Mips"); txt.setLocalTranslation(0, settings.getHeight() - txt.getLineHeight() * 4, 0); guiNode.attachChild(txt); txt = guiFont.createLabel("Right: AWT Mips"); txt.setLocalTranslation(0, settings.getHeight() - txt.getLineHeight() * 3, 0); guiNode.attachChild(txt); // create a simple plane/quad Quad quadMesh = new Quad(1, 1); quadMesh.updateGeometry(1, 1, false); quadMesh.updateBound(); Geometry quad1 = new Geometry("Textured Quad", quadMesh); Geometry quad2 = new Geometry("Textured Quad 2", quadMesh); Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.png"); tex.setMinFilter(Texture.MinFilter.Trilinear); Texture texCustomMip = tex.clone(); Image imageCustomMip = texCustomMip.getImage().clone(); MipMapGenerator.generateMipMaps(imageCustomMip); texCustomMip.setImage(imageCustomMip); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setTexture("ColorMap", tex); Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat2.setTexture("ColorMap", texCustomMip); quad1.setMaterial(mat1); // quad1.setLocalTranslation(1, 0, 0); quad2.setMaterial(mat2); quad2.setLocalTranslation(1, 0, 0); rootNode.attachChild(quad1); rootNode.attachChild(quad2); }
Example 8
Source File: TestMipMapGen.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
@Override public void simpleInitApp() { BitmapText txt = guiFont.createLabel("Left: HW Mips"); txt.setLocalTranslation(0, settings.getHeight() - txt.getLineHeight() * 4, 0); guiNode.attachChild(txt); txt = guiFont.createLabel("Right: AWT Mips"); txt.setLocalTranslation(0, settings.getHeight() - txt.getLineHeight() * 3, 0); guiNode.attachChild(txt); // create a simple plane/quad Quad quadMesh = new Quad(1, 1); quadMesh.updateGeometry(1, 1, false); quadMesh.updateBound(); Geometry quad1 = new Geometry("Textured Quad", quadMesh); Geometry quad2 = new Geometry("Textured Quad 2", quadMesh); Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.png"); tex.setMinFilter(Texture.MinFilter.Trilinear); Texture texCustomMip = tex.clone(); Image imageCustomMip = texCustomMip.getImage().clone(); MipMapGenerator.generateMipMaps(imageCustomMip); texCustomMip.setImage(imageCustomMip); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setTexture("ColorMap", tex); Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat2.setTexture("ColorMap", texCustomMip); quad1.setMaterial(mat1); // quad1.setLocalTranslation(1, 0, 0); quad2.setMaterial(mat2); quad2.setLocalTranslation(1, 0, 0); rootNode.attachChild(quad1); rootNode.attachChild(quad2); }