com.jme3.scene.shape.Quad Java Examples
The following examples show how to use
com.jme3.scene.shape.Quad.
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: DDSPreview.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public DDSPreview(ProjectAssetManager assetManager) { this.assetManager = assetManager; Quad quadMesh = new Quad(4.5f, 4.5f); Quad quadMesh3D = new Quad(4.5f, 4.5f); quadMesh3D.scaleTextureCoordinates(new Vector2f(4, 4)); quad = new Geometry("previewQuad", quadMesh); quad.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0)); quad3D = new Geometry("previewQuad", quadMesh3D); quad3D.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0)); material3D = new Material(assetManager, "com/jme3/gde/core/properties/preview/tex3DThumb.j3md"); material3D.setFloat("InvDepth", 1f / 16f); material3D.setInt("Rows", 4); material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); SceneApplication.getApplication().addSceneListener(this); }
Example #2
Source File: PopupState.java From Lemur with BSD 3-Clause "New" or "Revised" License | 6 votes |
protected Geometry createBlocker( float z, ColorRGBA backgroundColor ) { Camera cam = getApplication().getCamera(); // Get the inverse scale of whatever the current guiNode is so that // we can find a proper screen size float width = cam.getWidth() / guiNode.getLocalScale().x; float height = cam.getHeight() / guiNode.getLocalScale().y; Quad quad = new Quad(width, height); Geometry result = new Geometry("blocker", quad); GuiMaterial guiMat = createBlockerMaterial(backgroundColor); result.setMaterial(guiMat.getMaterial()); //result.setQueueBucket(Bucket.Transparent); // no, it goes in the gui bucket. result.setLocalTranslation(0, 0, z); return result; }
Example #3
Source File: TextEntryComponent.java From Lemur with BSD 3-Clause "New" or "Revised" License | 6 votes |
public TextEntryComponent( DocumentModel model, BitmapFont font ) { this.font = font; this.bitmapText = new BitmapText(font); bitmapText.setLineWrapMode(LineWrapMode.Clip); // Can't really do this since we don't know what // bucket it will actually end up in Gui or regular. //bitmapText.setQueueBucket( Bucket.Transparent ); this.model = model; // Create a versioned reference for watching for updates, external or otherwise this.modelRef = model.createReference(); this.caratRef = model.createCaratReference(); cursorQuad = new Quad(getCursorWidth(), bitmapText.getLineHeight()); cursor = new Geometry( "cursor", cursorQuad ); GuiMaterial mat = GuiGlobals.getInstance().createMaterial(new ColorRGBA(1,1,1,0.75f), false); cursor.setMaterial(mat.getMaterial()); cursor.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha); cursor.setUserData("layer", 1); bitmapText.attachChild(cursor); if( model.getText() != null ) { resetText(); } }
Example #4
Source File: TextEntryComponent.java From Lemur with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public TextEntryComponent clone() { TextEntryComponent result = (TextEntryComponent)super.clone(); result.bitmapText = new BitmapText(font); bitmapText.setLineWrapMode(LineWrapMode.Clip); result.model = model.clone(); result.preferredSize = null; result.textBox = null; result.keyHandler = result.new KeyHandler(); result.cursorQuad = new Quad(getCursorWidth(), bitmapText.getLineHeight()); result.cursor = new Geometry("cursor", cursorQuad); GuiMaterial mat = GuiGlobals.getInstance().createMaterial(new ColorRGBA(1,1,1,0.75f), false); result.cursor.setMaterial(mat.getMaterial()); result.cursor.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha); result.bitmapText.attachChild(cursor); result.resetText(); return result; }
Example #5
Source File: TestBlendEquations.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Adds a "transparent" quad to the scene, that limits the color values of the scene behind the object.<br/> * This effect can be good seen on bright areas of the scene (e.g. areas with specular lighting effects). */ private void createRightQuad() { Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); material.setColor("Color", new ColorRGBA(0.4f, 0.4f, 0.4f, 1f)); // Min( Source , Destination) material.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Custom); material.getAdditionalRenderState().setBlendEquation(RenderState.BlendEquation.Min); material.getAdditionalRenderState().setBlendEquationAlpha(RenderState.BlendEquationAlpha.Min); // In OpenGL no blend factors are used, when using the blend equations Min or Max! //material.getAdditionalRenderState().setCustomBlendFactors( // RenderState.BlendFunc.One, RenderState.BlendFunc.One, // RenderState.BlendFunc.One, RenderState.BlendFunc.One); rightQuad = new Geometry("RightQuad", new Quad(1f, 1f)); rightQuad.setMaterial(material); rightQuad.setQueueBucket(RenderQueue.Bucket.Transparent); rootNode.attachChild(rightQuad); }
Example #6
Source File: TestBlendEquations.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Adds a "transparent" quad to the scene, that shows an inverse blue value sight of the scene behind. */ private void createLeftQuad() { Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); // This color creates a blue value image. The effect will have a strength of 80% (set by the alpha value). material.setColor("Color", new ColorRGBA(0f, 0f, 1f, 0.8f)); // Result.RGB = Source.A * Source.RGB - Source.A * Destination.RGB // Result.A = Destination.A material.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Custom); material.getAdditionalRenderState().setBlendEquation(RenderState.BlendEquation.Subtract); material.getAdditionalRenderState().setBlendEquationAlpha(RenderState.BlendEquationAlpha.Add); material.getAdditionalRenderState().setCustomBlendFactors( RenderState.BlendFunc.Src_Alpha, RenderState.BlendFunc.Src_Alpha, RenderState.BlendFunc.Zero, RenderState.BlendFunc.One); leftQuad = new Geometry("LeftQuad", new Quad(1f, 1f)); leftQuad.setMaterial(material); leftQuad.setQueueBucket(RenderQueue.Bucket.Transparent); rootNode.attachChild(leftQuad); }
Example #7
Source File: TestJaime.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void setupFloor() { Quad q = new Quad(20, 20); q.scaleTextureCoordinates(Vector2f.UNIT_XY.mult(10)); Geometry geom = new Geometry("floor", q); Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); mat.setColor("Diffuse", ColorRGBA.White); mat.setColor("Specular", ColorRGBA.White); mat.setColor("Ambient", ColorRGBA.Black); mat.setBoolean("UseMaterialColors", true); mat.setFloat("Shininess", 0); geom.setMaterial(mat); geom.rotate(-FastMath.HALF_PI, 0, 0); geom.center(); geom.setShadowMode(RenderQueue.ShadowMode.Receive); rootNode.attachChild(geom); }
Example #8
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 #9
Source File: BaseMaterialEditor3DPart.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
public BaseMaterialEditor3DPart(@NotNull final T fileEditor) { super(fileEditor); this.testBox = new Geometry("Box", new Box(2, 2, 2)); this.testSphere = new Geometry("Sphere", new Sphere(30, 30, 2)); this.testQuad = new Geometry("Quad", new Quad(4, 4)); this.testQuad.setLocalTranslation(QUAD_OFFSET); this.lightEnabled = MaterialFileEditor.DEFAULT_LIGHT_ENABLED; TangentGenerator.useMikktspaceGenerator(testBox); TangentGenerator.useMikktspaceGenerator(testSphere); TangentGenerator.useMikktspaceGenerator(testQuad); final DirectionalLight light = notNull(getLightForCamera()); light.setDirection(LIGHT_DIRECTION); final EditorCamera editorCamera = notNull(getEditorCamera()); editorCamera.setDefaultHorizontalRotation(H_ROTATION); editorCamera.setDefaultVerticalRotation(V_ROTATION); getModelNode().attachChild(getNodeForCamera()); }
Example #10
Source File: TestParallax.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void setupFloor() { mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m"); Node floorGeom = new Node("floorGeom"); Quad q = new Quad(100, 100); q.scaleTextureCoordinates(new Vector2f(10, 10)); Geometry g = new Geometry("geom", q); g.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); floorGeom.attachChild(g); TangentBinormalGenerator.generate(floorGeom); floorGeom.setLocalTranslation(-50, 22, 60); //floorGeom.setLocalScale(100); floorGeom.setMaterial(mat); rootNode.attachChild(floorGeom); }
Example #11
Source File: TestSimpleBumps.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { Quad quadMesh = new Quad(1, 1); Geometry sphere = new Geometry("Rock Ball", quadMesh); Material mat = assetManager.loadMaterial("Textures/BumpMapTest/SimpleBump.j3m"); sphere.setMaterial(mat); TangentBinormalGenerator.generate(sphere); 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 #12
Source File: TestParallaxPBR.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void setupFloor() { mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWallPBR.j3m"); //mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWallPBR2.j3m"); Node floorGeom = new Node("floorGeom"); Quad q = new Quad(100, 100); q.scaleTextureCoordinates(new Vector2f(10, 10)); Geometry g = new Geometry("geom", q); g.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); floorGeom.attachChild(g); TangentBinormalGenerator.generate(floorGeom); floorGeom.setLocalTranslation(-50, 22, 60); //floorGeom.setLocalScale(100); floorGeom.setMaterial(mat); rootNode.attachChild(floorGeom); }
Example #13
Source File: TestAnisotropicFilter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { maxAniso = renderer.getLimits().get(Limits.TextureAnisotropy); flyCam.setDragToRotate(true); flyCam.setMoveSpeed(100); cam.setLocation(new Vector3f(197.02617f, 4.6769195f, -194.89545f)); cam.setRotation(new Quaternion(0.07921988f, 0.8992258f, -0.18292196f, 0.38943136f)); Quad q = new Quad(1000, 1000); q.scaleTextureCoordinates(new Vector2f(1000, 1000)); Geometry geom = new Geometry("quad", q); geom.rotate(-FastMath.HALF_PI, 0, 0); geom.setMaterial(createCheckerBoardMaterial(assetManager)); rootNode.attachChild(geom); inputManager.addMapping("higher", new KeyTrigger(KeyInput.KEY_1)); inputManager.addMapping("lower", new KeyTrigger(KeyInput.KEY_2)); inputManager.addListener(this, "higher"); inputManager.addListener(this, "lower"); }
Example #14
Source File: AbstractSceneEditor3DPart.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
/** * Create collision plane. */ @FromAnyThread private void createCollisionPlane() { final AssetManager assetManager = EditorUtil.getAssetManager(); final Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); final RenderState renderState = material.getAdditionalRenderState(); renderState.setFaceCullMode(RenderState.FaceCullMode.Off); renderState.setWireframe(true); final float size = 20000; final Geometry geometry = new Geometry("plane", new Quad(size, size)); geometry.setMaterial(material); geometry.setLocalTranslation(-size / 2, -size / 2, 0); collisionPlane = new Node(); collisionPlane.attachChild(geometry); }
Example #15
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 #16
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 #17
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 #18
Source File: TestBitmapText3D.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void simpleInitApp() { Quad q = new Quad(6, 3); Geometry g = new Geometry("quad", q); g.setLocalTranslation(0, -3, -0.0001f); g.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(g); BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); BitmapText txt = new BitmapText(fnt, false); txt.setBox(new Rectangle(0, 0, 6, 3)); txt.setQueueBucket(Bucket.Transparent); txt.setSize( 0.5f ); txt.setText(txtB); rootNode.attachChild(txt); }
Example #19
Source File: TestSimpleBumps.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void simpleInitApp() { Quad quadMesh = new Quad(1, 1); Geometry sphere = new Geometry("Rock Ball", quadMesh); Material mat = assetManager.loadMaterial("Textures/BumpMapTest/SimpleBump.j3m"); sphere.setMaterial(mat); TangentBinormalGenerator.generate(sphere); 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 #20
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 #21
Source File: StatsAppState.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void loadDarken() { Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", new ColorRGBA(0,0,0,0.5f)); mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); darkenFps = new Geometry("StatsDarken", new Quad(200, fpsText.getLineHeight())); darkenFps.setMaterial(mat); darkenFps.setLocalTranslation(0, 0, -1); darkenFps.setCullHint(showFps && darkenBehind ? CullHint.Never : CullHint.Always); guiNode.attachChild(darkenFps); darkenStats = new Geometry("StatsDarken", new Quad(200, statsView.getHeight())); darkenStats.setMaterial(mat); darkenStats.setLocalTranslation(0, fpsText.getHeight(), -1); darkenStats.setCullHint(showStats && darkenBehind ? CullHint.Never : CullHint.Always); guiNode.attachChild(darkenStats); }
Example #22
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 #23
Source File: TestImageRaster.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void convertAndPutImage(Image image, float posX, float posY) { Texture tex = new Texture2D(image); tex.setMagFilter(MagFilter.Nearest); tex.setMinFilter(MinFilter.NearestNoMipMaps); tex.setAnisotropicFilter(16); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", tex); Quad q = new Quad(5, 5); Geometry g = new Geometry("quad", q); g.setLocalTranslation(posX, posY - 5, -0.0001f); g.setMaterial(mat); rootNode.attachChild(g); BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); BitmapText txt = new BitmapText(fnt); txt.setBox(new Rectangle(0, 0, 5, 5)); txt.setQueueBucket(RenderQueue.Bucket.Transparent); txt.setSize(0.5f); txt.setText(image.getFormat().name()); txt.setLocalTranslation(posX, posY, 0); rootNode.attachChild(txt); }
Example #24
Source File: TestBitmapText3D.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { Quad q = new Quad(6, 3); Geometry g = new Geometry("quad", q); g.setLocalTranslation(0, -3, -0.0001f); g.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); rootNode.attachChild(g); BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); BitmapText txt = new BitmapText(fnt, false); txt.setBox(new Rectangle(0, 0, 6, 3)); txt.setQueueBucket(Bucket.Transparent); txt.setSize( 0.5f ); txt.setText(txtB); rootNode.attachChild(txt); }
Example #25
Source File: MoveTool.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public MoveTool() { axisPickType = AxisMarkerPickType.axisAndPlane; setOverrideCameraControl(true); float size = 1000; Geometry g = new Geometry("plane", new Quad(size, size)); g.setLocalTranslation(-size/2, -size/2, 0); plane = new Node(); plane.attachChild(g); }
Example #26
Source File: CollideIgnoreTransformTest.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Attach a red square in the XY plane with its lower left corner at (0, 0, * 0). It is composed of 2 triangles. */ void createRedSquare() { Mesh quadMesh = new Quad(1f, 1f); Geometry redSquare = new Geometry("red square", quadMesh); Material red = assetManager.loadMaterial("Common/Materials/RedColor.j3m"); redSquare.setMaterial(red); rootNode.attachChild(redSquare); redSquare.setLocalTranslation(0f, 3f, 0f); redSquare.setIgnoreTransform(true); }
Example #27
Source File: SceneComposerToolController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
protected LightMarker(Light light) { this.light = light; Quad q = new Quad(0.5f, 0.5f); this.setMesh(q); this.setMaterial(getLightMarkerMaterial()); this.addControl(new LightMarkerControl()); this.setQueueBucket(Bucket.Transparent); }
Example #28
Source File: BoundingCollisionTest.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testSphereTriangleCollision() { BoundingSphere sphere = new BoundingSphere(1, Vector3f.ZERO); Geometry geom = new Geometry("geom", new Quad(1, 1)); checkCollision(sphere, geom, 2); // The box touches the edges of the triangles. sphere.setCenter(new Vector3f(-1f + FastMath.ZERO_TOLERANCE, 0, 0)); checkCollision(sphere, geom, 2); // Move it slightly farther.. sphere.setCenter(new Vector3f(-1f - FastMath.ZERO_TOLERANCE, 0, 0)); checkCollision(sphere, geom, 0); // Parallel triangle / box side, touching sphere.setCenter(new Vector3f(0, 0, -1f)); checkCollision(sphere, geom, 2); // Not touching sphere.setCenter(new Vector3f(0, 0, -1f - FastMath.ZERO_TOLERANCE)); checkCollision(sphere, geom, 0); // Test collisions only against one of the triangles sphere.setCenter(new Vector3f(-0.9f, 1.2f, 0f)); checkCollision(sphere, geom, 1); sphere.setCenter(new Vector3f(1.2f, -0.9f, 0f)); checkCollision(sphere, geom, 1); }
Example #29
Source File: BoundingCollisionTest.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void testBoxTriangleCollision() { BoundingBox box = new BoundingBox(Vector3f.ZERO, 1, 1, 1); Geometry geom = new Geometry("geom", new Quad(1, 1)); checkCollision(box, geom, 2); // Both triangles intersect // The box touches the edges of the triangles. box.setCenter(new Vector3f(-1f, 0, 0)); checkCollision(box, geom, 2); // Move it slightly farther.. box.setCenter(new Vector3f(-1f - FastMath.ZERO_TOLERANCE, 0, 0)); checkCollision(box, geom, 0); // Parallel triangle / box side, touching box.setCenter(new Vector3f(0, 0, -1f)); checkCollision(box, geom, 2); // Not touching box.setCenter(new Vector3f(0, 0, -1f - FastMath.ZERO_TOLERANCE)); checkCollision(box, geom, 0); // Test collisions only against one of the triangles box.setCenter(new Vector3f(-1f, 1.5f, 0f)); checkCollision(box, geom, 1); box.setCenter(new Vector3f(1.5f, -1f, 0f)); checkCollision(box, geom, 1); }
Example #30
Source File: SceneComposerToolController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
protected AudioMarker(AudioNode audio) { this.audio = audio; Quad q = new Quad(0.5f, 0.5f); this.setMesh(q); this.setMaterial(getAudioMarkerMaterial()); this.addControl(new AudioMarkerControl()); this.setQueueBucket(Bucket.Transparent); }