com.jme3.effect.shapes.EmitterSphereShape Java Examples
The following examples show how to use
com.jme3.effect.shapes.EmitterSphereShape.
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: TestExplosionEffect.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void createFlash(){ flash = new ParticleEmitter("Flash", EMITTER_TYPE, 24 * COUNT_FACTOR); flash.setSelectRandomImage(true); flash.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1f / COUNT_FACTOR_F)); flash.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f)); flash.setStartSize(.1f); flash.setEndSize(3.0f); flash.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f)); flash.setParticlesPerSec(0); flash.setGravity(0, 0, 0); flash.setLowLife(.2f); flash.setHighLife(.2f); flash.getParticleInfluencer() .setInitialVelocity(new Vector3f(0, 5f, 0)); flash.getParticleInfluencer().setVelocityVariation(1); flash.setImagesX(2); flash.setImagesY(2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flash.png")); mat.setBoolean("PointSprite", POINT_SPRITE); flash.setMaterial(mat); explosionEffect.attachChild(flash); }
Example #2
Source File: NewSpatialPopup.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void actionPerformed(ActionEvent e) { SceneApplication.getApplication().enqueue(new Callable<Void>() { public Void call() throws Exception { ParticleEmitter emit = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 200); emit.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f)); emit.setGravity(new Vector3f(0, 0, 0)); emit.setLowLife(5); emit.setHighLife(10); emit.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0)); emit.setImagesX(15); Material mat = new Material(SceneApplication.getApplication().getAssetManager(), "Common/MatDefs/Misc/Particle.j3md"); emit.setMaterial(mat); node.attachChild(emit); addSpatialUndo(node, emit); setModified(); return null; } }); }
Example #3
Source File: TestExplosionEffect.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void createRoundSpark(){ roundspark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR); roundspark.setStartColor(new ColorRGBA(1f, 0.29f, 0.34f, (float) (1.0 / COUNT_FACTOR_F))); roundspark.setEndColor(new ColorRGBA(0, 0, 0, (float) (0.5f / COUNT_FACTOR_F))); roundspark.setStartSize(1.2f); roundspark.setEndSize(1.8f); roundspark.setShape(new EmitterSphereShape(Vector3f.ZERO, 2f)); roundspark.setParticlesPerSec(0); roundspark.setGravity(0, -.5f, 0); roundspark.setLowLife(1.8f); roundspark.setHighLife(2f); roundspark.setInitialVelocity(new Vector3f(0, 3, 0)); roundspark.setVelocityVariation(.5f); roundspark.setImagesX(1); roundspark.setImagesY(1); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/roundspark.png")); mat.setBoolean("PointSprite", POINT_SPRITE); roundspark.setMaterial(mat); explosionEffect.attachChild(roundspark); }
Example #4
Source File: TestExplosionEffect.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void createFlash(){ flash = new ParticleEmitter("Flash", EMITTER_TYPE, 24 * COUNT_FACTOR); flash.setSelectRandomImage(true); flash.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1f / COUNT_FACTOR_F))); flash.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f)); flash.setStartSize(.1f); flash.setEndSize(3.0f); flash.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f)); flash.setParticlesPerSec(0); flash.setGravity(0, 0, 0); flash.setLowLife(.2f); flash.setHighLife(.2f); flash.setInitialVelocity(new Vector3f(0, 5f, 0)); flash.setVelocityVariation(1); flash.setImagesX(2); flash.setImagesY(2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flash.png")); mat.setBoolean("PointSprite", POINT_SPRITE); flash.setMaterial(mat); explosionEffect.attachChild(flash); }
Example #5
Source File: TestExplosionEffect.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void createFlame(){ flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR); flame.setSelectRandomImage(true); flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F))); flame.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f)); flame.setStartSize(1.3f); flame.setEndSize(2f); flame.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f)); flame.setParticlesPerSec(0); flame.setGravity(0, -5, 0); flame.setLowLife(.4f); flame.setHighLife(.5f); flame.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 7, 0)); flame.getParticleInfluencer().setVelocityVariation(1f); flame.setImagesX(2); flame.setImagesY(2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); mat.setBoolean("PointSprite", POINT_SPRITE); flame.setMaterial(mat); explosionEffect.attachChild(flame); }
Example #6
Source File: TestWalkingChar.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void prepareEffect() { int COUNT_FACTOR = 1; float COUNT_FACTOR_F = 1f; effect = new ParticleEmitter("Flame", Type.Triangle, 32 * COUNT_FACTOR); effect.setSelectRandomImage(true); effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F))); effect.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f)); effect.setStartSize(1.3f); effect.setEndSize(2f); effect.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f)); effect.setParticlesPerSec(0); effect.setGravity(0, -5, 0); effect.setLowLife(.4f); effect.setHighLife(.5f); effect.setInitialVelocity(new Vector3f(0, 7, 0)); effect.setVelocityVariation(1f); effect.setImagesX(2); effect.setImagesY(2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); effect.setMaterial(mat); // effect.setLocalScale(100); rootNode.attachChild(effect); }
Example #7
Source File: BombControl.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void prepareEffect(AssetManager assetManager) { int COUNT_FACTOR = 1; float COUNT_FACTOR_F = 1f; effect = new ParticleEmitter("Flame", Type.Triangle, 32 * COUNT_FACTOR); effect.setSelectRandomImage(true); effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F))); effect.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f)); effect.setStartSize(1.3f); effect.setEndSize(2f); effect.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f)); effect.setParticlesPerSec(0); effect.setGravity(0, -5f, 0); effect.setLowLife(.4f); effect.setHighLife(.5f); effect.setInitialVelocity(new Vector3f(0, 7, 0)); effect.setVelocityVariation(1f); effect.setImagesX(2); effect.setImagesY(2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); effect.setMaterial(mat); }
Example #8
Source File: TestExplosionEffect.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void createRoundSpark(){ roundspark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR); roundspark.setStartColor(new ColorRGBA(1f, 0.29f, 0.34f, (float) (1.0 / COUNT_FACTOR_F))); roundspark.setEndColor(new ColorRGBA(0, 0, 0, 0.5f / COUNT_FACTOR_F)); roundspark.setStartSize(1.2f); roundspark.setEndSize(1.8f); roundspark.setShape(new EmitterSphereShape(Vector3f.ZERO, 2f)); roundspark.setParticlesPerSec(0); roundspark.setGravity(0, -.5f, 0); roundspark.setLowLife(1.8f); roundspark.setHighLife(2f); roundspark.getParticleInfluencer() .setInitialVelocity(new Vector3f(0, 3, 0)); roundspark.getParticleInfluencer().setVelocityVariation(.5f); roundspark.setImagesX(1); roundspark.setImagesY(1); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/roundspark.png")); mat.setBoolean("PointSprite", POINT_SPRITE); roundspark.setMaterial(mat); explosionEffect.attachChild(roundspark); }
Example #9
Source File: EmitterShapePropertyBuilder.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread protected void buildForImpl(@NotNull final Object object, @Nullable final Object parent, @NotNull final VBox container, @NotNull final ModelChangeConsumer changeConsumer) { if (!(object instanceof EmitterShape)) return; final EmitterShape shape = (EmitterShape) object; if (shape instanceof EmitterPointShape) { createControls(container, changeConsumer, (EmitterPointShape) object); } else if (shape instanceof EmitterBoxShape) { createControls(container, changeConsumer, (EmitterBoxShape) object); } else if (shape instanceof EmitterSphereShape) { createControls(container, changeConsumer, (EmitterSphereShape) object); } }
Example #10
Source File: TestExplosionEffect.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void createFlame(){ flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR); flame.setSelectRandomImage(true); flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F))); flame.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f)); flame.setStartSize(1.3f); flame.setEndSize(2f); flame.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f)); flame.setParticlesPerSec(0); flame.setGravity(0, -5, 0); flame.setLowLife(.4f); flame.setHighLife(.5f); flame.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 7, 0)); flame.getParticleInfluencer().setVelocityVariation(1f); flame.setImagesX(2); flame.setImagesY(2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); mat.setBoolean("PointSprite", POINT_SPRITE); flame.setMaterial(mat); explosionEffect.attachChild(flame); }
Example #11
Source File: TestParticleExportingCloning.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { ParticleEmitter emit = new ParticleEmitter("Emitter", Type.Triangle, 200); emit.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f)); emit.setGravity(0, 0, 0); emit.setLowLife(5); emit.setHighLife(10); emit.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0)); emit.setImagesX(15); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png")); emit.setMaterial(mat); ParticleEmitter emit2 = emit.clone(); emit2.move(3, 0, 0); rootNode.attachChild(emit); rootNode.attachChild(emit2); ParticleEmitter emit3 = BinaryExporter.saveAndLoad(assetManager, emit); emit3.move(-3, 0, 0); rootNode.attachChild(emit3); }
Example #12
Source File: TestWalkingChar.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void prepareEffect() { int COUNT_FACTOR = 1; float COUNT_FACTOR_F = 1f; effect = new ParticleEmitter("Flame", Type.Triangle, 32 * COUNT_FACTOR); effect.setSelectRandomImage(true); effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F))); effect.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f)); effect.setStartSize(1.3f); effect.setEndSize(2f); effect.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f)); effect.setParticlesPerSec(0); effect.setGravity(0, -5, 0); effect.setLowLife(.4f); effect.setHighLife(.5f); effect.getParticleInfluencer() .setInitialVelocity(new Vector3f(0, 7, 0)); effect.getParticleInfluencer().setVelocityVariation(1f); effect.setImagesX(2); effect.setImagesY(2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); effect.setMaterial(mat); // effect.setLocalScale(100); rootNode.attachChild(effect); }
Example #13
Source File: BombControl.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void prepareEffect(AssetManager assetManager) { int COUNT_FACTOR = 1; float COUNT_FACTOR_F = 1f; effect = new ParticleEmitter("Flame", Type.Triangle, 32 * COUNT_FACTOR); effect.setSelectRandomImage(true); effect.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F))); effect.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f)); effect.setStartSize(1.3f); effect.setEndSize(2f); effect.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f)); effect.setParticlesPerSec(0); effect.setGravity(0, -5f, 0); effect.setLowLife(.4f); effect.setHighLife(.5f); effect.getParticleInfluencer() .setInitialVelocity(new Vector3f(0, 7, 0)); effect.getParticleInfluencer().setVelocityVariation(1f); effect.setImagesX(2); effect.setImagesY(2); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); effect.setMaterial(mat); }
Example #14
Source File: EmitterShapePropertyBuilder.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
/** * Create controls. * * @param container the container. * @param changeConsumer the change consumer. * @param shape the shape. */ @FxThread private void createControls(@NotNull final VBox container, @NotNull final ModelChangeConsumer changeConsumer, @NotNull final EmitterSphereShape shape) { final Vector3f center = shape.getCenter(); final float radius = shape.getRadius(); final FloatPropertyControl<ModelChangeConsumer, EmitterSphereShape> radiusControl = new FloatPropertyControl<>(radius, Messages.MODEL_PROPERTY_RADIUS, changeConsumer); radiusControl.setSyncHandler(EmitterSphereShape::getRadius); radiusControl.setApplyHandler(EmitterSphereShape::setRadius); radiusControl.setEditObject(shape); final Vector3fPropertyControl<ModelChangeConsumer, EmitterSphereShape> centerControl = new Vector3fPropertyControl<>(center, Messages.MODEL_PROPERTY_CENTER, changeConsumer); centerControl.setSyncHandler(EmitterSphereShape::getCenter); centerControl.setApplyHandler(EmitterSphereShape::setCenter); centerControl.setEditObject(shape); FXUtils.addToPane(centerControl, container); buildSplitLine(container); FXUtils.addToPane(radiusControl, container); }
Example #15
Source File: TestParticleExportingCloning.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { ParticleEmitter emit = new ParticleEmitter("Emitter", Type.Triangle, 200); emit.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f)); emit.setGravity(0, 0, 0); emit.setLowLife(5); emit.setHighLife(10); emit.setInitialVelocity(new Vector3f(0, 0, 0)); emit.setImagesX(15); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png")); emit.setMaterial(mat); ParticleEmitter emit2 = emit.clone(); emit2.move(3, 0, 0); rootNode.attachChild(emit); rootNode.attachChild(emit2); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { BinaryExporter.getInstance().save(emit, out); BinaryImporter imp = new BinaryImporter(); imp.setAssetManager(assetManager); ParticleEmitter emit3 = (ParticleEmitter) imp.load(out.toByteArray()); emit3.move(-3, 0, 0); rootNode.attachChild(emit3); } catch (IOException ex) { ex.printStackTrace(); } // Camera cam2 = cam.clone(); // cam.setViewPortTop(0.5f); // cam2.setViewPortBottom(0.5f); // ViewPort vp = renderManager.createMainView("SecondView", cam2); // viewPort.setClearEnabled(false); // vp.attachScene(rootNode); }
Example #16
Source File: CreateSphereShapeEmitterAction.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
@Override @FxThread protected @NotNull EmitterShape createEmitterShape(@NotNull final VarTable vars) { final Vector3f center = vars.get(PROPERTY_CENTER); final float radius = vars.getFloat(PROPERTY_RADIUS); return new EmitterSphereShape(center, radius); }
Example #17
Source File: ParticlePerformer.java From OpenRTS with MIT License | 4 votes |
private void createEmitter(ParticleActor actor){ ParticleEmitter emitter = new ParticleEmitter("", ParticleMesh.Type.Triangle, actor.maxCount); Material m = actorDrawer.getParticleMat(actor.spritePath); if(!actor.add) { m.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha); } emitter.setMaterial(m); emitter.setParticlesPerSec(actor.perSecond); emitter.setImagesX(actor.nbRow); emitter.setImagesY(actor.nbCol); emitter.setStartColor(TranslateUtil.toColorRGBA(actor.startColor)); emitter.setEndColor(TranslateUtil.toColorRGBA(actor.endColor)); emitter.setStartSize((float)actor.startSize); emitter.setEndSize((float)actor.endSize); if(actor.gravity) { emitter.setGravity(0, 0, 4); } else { emitter.setGravity(0, 0, 0); } emitter.setLowLife((float)actor.minLife); emitter.setHighLife((float)actor.maxLife); emitter.setRotateSpeed((float)actor.rotationSpeed); if(actor.startVariation != 0) { emitter.setShape(new EmitterSphereShape(Vector3f.ZERO, (float)actor.startVariation)); } if(actor.facing == ParticleActor.Facing.Horizontal) { emitter.setFaceNormal(Vector3f.UNIT_Z); } if(actor.velocity != 0) { emitter.setFacingVelocity(true); } emitter.setQueueBucket(Bucket.Transparent); actorDrawer.mainNode.attachChild(emitter); actor.getViewElements().particleEmitter = emitter; }
Example #18
Source File: TestSoftParticles.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
private void createParticles() { Material material = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); material.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png")); material.setFloat("Softness", 3f); // //Fire ParticleEmitter fire = new ParticleEmitter("Fire", ParticleMesh.Type.Triangle, 30); fire.setMaterial(material); fire.setShape(new EmitterSphereShape(Vector3f.ZERO, 0.1f)); fire.setImagesX(2); fire.setImagesY(2); // 2x2 texture animation fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f)); // red fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow fire.setStartSize(0.6f); fire.setEndSize(0.01f); fire.setGravity(0, -0.3f, 0); fire.setLowLife(0.5f); fire.setHighLife(3f); fire.setLocalTranslation(0, 0.2f, 0); particleNode.attachChild(fire); ParticleEmitter smoke = new ParticleEmitter("Smoke", ParticleMesh.Type.Triangle, 30); smoke.setMaterial(material); smoke.setShape(new EmitterSphereShape(Vector3f.ZERO, 5)); smoke.setImagesX(1); smoke.setImagesY(1); // 2x2 texture animation smoke.setStartColor(new ColorRGBA(0.1f, 0.1f, 0.1f,1f)); // dark gray smoke.setEndColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.3f)); // gray smoke.setStartSize(3f); smoke.setEndSize(5f); smoke.setGravity(0, -0.001f, 0); smoke.setLowLife(100f); smoke.setHighLife(100f); smoke.setLocalTranslation(0, 0.1f, 0); smoke.emitAllParticles(); particleNode.attachChild(smoke); }
Example #19
Source File: EmitterSphereShapeTreeNode.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
public EmitterSphereShapeTreeNode(@NotNull final EmitterSphereShape element, final long objectId) { super(element, objectId); }