本文整理汇总了Java中com.jme3.effect.ParticleEmitter.setNumParticles方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleEmitter.setNumParticles方法的具体用法?Java ParticleEmitter.setNumParticles怎么用?Java ParticleEmitter.setNumParticles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.effect.ParticleEmitter
的用法示例。
在下文中一共展示了ParticleEmitter.setNumParticles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFire
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private ParticleEmitter createFire() {
ParticleEmitter fire = new ParticleEmitter("fire-emitter",
ParticleMesh.Type.Triangle, 200);
Material material = new Material(Globals.assets,
"Common/MatDefs/Misc/Particle.j3md");
material.setTexture("Texture",
Globals.assets.loadTexture("Effects/flame.png"));
fire.setMaterial(material);
fire.setImagesX(2);
fire.setImagesY(2);
fire.setSelectRandomImage(true);
fire.setGravity(Vector3f.ZERO);
fire.setParticlesPerSec(100);
fire.setRandomAngle(true);
fire.setStartColor(new ColorRGBA(0.95f, 0.150f, 0.0f, 0.40f));
fire.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.0f));
fire.setLowLife(0.4f);
fire.setHighLife(0.5f);
fire.setNumParticles(120);
fire.setStartSize(7.50f);
fire.setEndSize(25f);
fire.getParticleInfluencer()
.setInitialVelocity(Vector3f.UNIT_X.mult(45.0f));
fire.getParticleInfluencer().setVelocityVariation(1f);
return fire;
}
示例2: Player
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
public Player(AssetManager assetManager, TerrainQuad terrainTo) {
terrain = terrainTo;
playerNode = assetManager.loadModel("Models/template animations9/template animations9.j3o");
//Geometry geom = new Geometry("Spatial", b.g);
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
mat.setColor("Color", ColorRGBA.BlackNoAlpha); // set color of material to blue
playerNode.setLocalScale(10, 10, 10);
playerNode.setLocalTranslation(0, 0, 0);
playerNode.setMaterial(mat);
atTarget = true;
this.attachChild(playerNode);
projectile = new ParticleEmitter("Emitter", Type.Triangle, 30);
Material mat_red = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat_red.setColor("Color", ColorRGBA.Red);
projectile.setMaterial(mat_red);
projectile.setImagesX(2); projectile.setImagesY(2); // 2x2 texture animation
projectile.setEndColor( new ColorRGBA(1f, 0f, 0f, 1f)); // red
projectile.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
projectile.getParticleInfluencer().setInitialVelocity(new Vector3f(0,2,0));
projectile.setStartSize(1.5f);
projectile.setEndSize(0.1f);
projectile.setGravity(0,0,0);
projectile.setLowLife(0.5f);
projectile.setHighLife(3f);
projectile.getParticleInfluencer().setVelocityVariation(0.3f);
projectile.setNumParticles(200);
this.attachChild(projectile);
}
示例3: createSmallExplosion
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmallExplosion(Node root, Vector3f location) {
ParticleEmitter fire = new ParticleEmitter("shotgun-explosion",
ParticleMesh.Type.Triangle, 20);
Material material = new Material(assetManager,
"Common/MatDefs/Misc/Particle.j3md");
material.setTexture("Texture",
assetManager.loadTexture("Effects/flame.png"));
fire.setMaterial(material);
fire.setImagesX(2);
fire.setImagesY(2);
fire.setSelectRandomImage(true);
fire.setGravity(Vector3f.ZERO);
fire.setRandomAngle(true);
fire.setStartColor(new ColorRGBA(0.95f, 0.150f, 0.0f, 0.40f));
fire.setEndColor(new ColorRGBA(1.0f, 1.0f, 0.0f, 0.0f));
fire.setLowLife(0.1f);
fire.setHighLife(0.3f);
fire.setNumParticles(100);
fire.setStartSize(0.50f);
fire.setEndSize(1.0f);
fire.getParticleInfluencer()
.setInitialVelocity(Vector3f.UNIT_X.mult(1.0f));
fire.getParticleInfluencer().setVelocityVariation(6f);
fire.setShape(new EmitterSphereShape(Vector3f.ZERO, 0.2f));
fire.setParticlesPerSec(0f);
root.attachChild(fire);
fire.setLocalTranslation(location);
fire.emitAllParticles();
fire.addControl(new CTimedExistence(1f));
}
示例4: createFireEmitter
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private ParticleEmitter createFireEmitter() {
ParticleEmitter fire = new ParticleEmitter("fire-emitter",
ParticleMesh.Type.Triangle, 200);
Material materialRed = new Material(assets,
"Common/MatDefs/Misc/Particle.j3md");
materialRed.setTexture("Texture",
assets.loadTexture("Effects/flame.png"));
fire.setMaterial(materialRed);
fire.setImagesX(2);
fire.setImagesY(2);
fire.setSelectRandomImage(true);
fire.setRandomAngle(true);
fire.setGravity(Vector3f.ZERO);
fire.setStartColor(new ColorRGBA(0.95f, 0.15f, 0f, 0.4f));
fire.setEndColor(new ColorRGBA(1f, 1f, 0f, 0f));
fire.setLowLife(0.1f);
fire.setHighLife(0.3f);
fire.setNumParticles(100);
fire.setStartSize(0.50f);
fire.setEndSize(30f);
fire.getParticleInfluencer()
.setInitialVelocity(Vector3f.UNIT_X.mult(15f));
fire.getParticleInfluencer().setVelocityVariation(1f);
fire.setShape(new EmitterSphereShape(Vector3f.ZERO, 2f));
fire.setParticlesPerSec(0f);
return fire;
}
示例5: loadEmitter
import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private ParticleEmitter loadEmitter(ParticleEmitter pe) {
pe.setName("emitter");
pe.setMeshType(ParticleMesh.Type.Triangle);
pe.setNumParticles(data.getNumParticles());
if (data.getEndColor() != null) {
pe.setEndColor(data.getEndColor());
}
if (data.getEndSize() != null) {
pe.setEndSize(data.getEndSize());
}
if (data.getFaceNormal() != null) {
pe.setFaceNormal(data.getFaceNormal());
}
if (data.getFacingVelocity() != null) {
pe.setFacingVelocity(data.getFacingVelocity());
}
if (data.getGravity() != null) {
pe.setGravity(data.getGravity());
}
if (data.getHighLife() != null) {
pe.setHighLife(data.getHighLife());
}
if (data.getImagesX() != null) {
pe.setImagesX(data.getImagesX());
}
if (data.getImagesY() != null) {
pe.setImagesY(data.getImagesY());
}
if (data.getLowLife() != null) {
pe.setLowLife(data.getLowLife());
}
if (data.getParticlesPerSec() != null) {
pe.setParticlesPerSec(data.getParticlesPerSec());
}
if (data.getRandomAngle() != null) {
pe.setRandomAngle(data.getRandomAngle());
}
if (data.getRotateSpeed() != null) {
pe.setRotateSpeed(data.getRotateSpeed());
}
if (data.getSelectRandomImage() != null) {
pe.setSelectRandomImage(data.getSelectRandomImage());
}
if (data.getStartColor() != null) {
pe.setStartColor(data.getStartColor());
}
if (data.getStartSize() != null) {
pe.setStartSize(data.getStartSize());
}
if (data.getInitialVelocity() != null) {
pe.getParticleInfluencer().setInitialVelocity(data.getInitialVelocity());
}
if (data.getVelocityVariation() != null) {
pe.getParticleInfluencer().setVelocityVariation(data.getVelocityVariation());
}
if (data.getShape() != null) {
pe.setShape(new EmitterShapeWrap((Position) Loader.load(data.getShape())));
}
AssetManager am = LuoYing.getAssetManager();
Material mat = new Material(am, AssetConstants.MATERIAL_PARTICLE);
mat.setTexture("Texture", am.loadTexture(data.getTexture()));
pe.setMaterial(mat);
return pe;
}