use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class TestParticleExportingCloning method simpleInitApp.
@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);
ParticleEmitter emit3 = BinaryExporter.saveAndLoad(assetManager, emit);
emit3.move(-3, 0, 0);
rootNode.attachChild(emit3);
}
use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class TestPointSprite method simpleInitApp.
@Override
public void simpleInitApp() {
final ParticleEmitter emit = new ParticleEmitter("Emitter", Type.Point, 10000);
emit.setShape(new EmitterBoxShape(new Vector3f(-1.8f, -1.8f, -1.8f), new Vector3f(1.8f, 1.8f, 1.8f)));
emit.setGravity(0, 0, 0);
emit.setLowLife(60);
emit.setHighLife(60);
emit.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0));
emit.setImagesX(15);
emit.setStartSize(0.05f);
emit.setEndSize(0.05f);
emit.setStartColor(ColorRGBA.White);
emit.setEndColor(ColorRGBA.White);
emit.setSelectRandomImage(true);
emit.emitAllParticles();
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat.setBoolean("PointSprite", true);
mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png"));
emit.setMaterial(mat);
rootNode.attachChild(emit);
inputManager.addListener(new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
if ("setNum".equals(name) && isPressed) {
emit.setNumParticles(5000);
emit.emitAllParticles();
}
}
}, "setNum");
inputManager.addMapping("setNum", new KeyTrigger(KeyInput.KEY_SPACE));
}
use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class TestSoftParticles method createParticles.
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);
// 2x2 texture animation
fire.setImagesY(2);
// red
fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f));
// yellow
fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f));
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);
// 2x2 texture animation
smoke.setImagesY(1);
// dark gray
smoke.setStartColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1f));
// gray
smoke.setEndColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.3f));
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);
}
use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class TestOgreConvert method simpleInitApp.
@Override
public void simpleInitApp() {
Spatial ogreModel = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
DirectionalLight dl = new DirectionalLight();
dl.setColor(ColorRGBA.White);
dl.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
rootNode.addLight(dl);
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BinaryExporter exp = new BinaryExporter();
exp.save(ogreModel, baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
BinaryImporter imp = new BinaryImporter();
imp.setAssetManager(assetManager);
Node ogreModelReloaded = (Node) imp.load(bais, null, null);
AnimControl control = ogreModelReloaded.getControl(AnimControl.class);
AnimChannel chan = control.createChannel();
chan.setAnim("Walk");
rootNode.attachChild(ogreModelReloaded);
} catch (IOException ex) {
ex.printStackTrace();
}
}
use of com.jme3.asset.AssetManager in project jmonkeyengine by jMonkeyEngine.
the class TestRagDoll method simpleInitApp.
@Override
public void simpleInitApp() {
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
bulletAppState.setDebugEnabled(true);
inputManager.addMapping("Pull ragdoll up", new MouseButtonTrigger(0));
inputManager.addListener(this, "Pull ragdoll up");
PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
createRagDoll();
}
Aggregations