当前位置: 首页>>代码示例>>Java>>正文


Java ParticleEmitter.setFacingVelocity方法代码示例

本文整理汇总了Java中com.jme3.effect.ParticleEmitter.setFacingVelocity方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleEmitter.setFacingVelocity方法的具体用法?Java ParticleEmitter.setFacingVelocity怎么用?Java ParticleEmitter.setFacingVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.effect.ParticleEmitter的用法示例。


在下文中一共展示了ParticleEmitter.setFacingVelocity方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSpark

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSpark(){
        spark = new ParticleEmitter("Spark", Type.Triangle, 30 * COUNT_FACTOR);
        spark.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1.0f / COUNT_FACTOR_F)));
        spark.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
        spark.setStartSize(.5f);
        spark.setEndSize(.5f);

//        spark.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f));
        spark.setFacingVelocity(true);
        spark.setParticlesPerSec(0);
        spark.setGravity(0, 5, 0);
        spark.setLowLife(1.1f);
        spark.setHighLife(1.5f);
        spark.setInitialVelocity(new Vector3f(0, 20, 0));
        spark.setVelocityVariation(1);
        spark.setImagesX(1);
        spark.setImagesY(1);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
        mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/spark.png"));
        spark.setMaterial(mat);
        explosionEffect.attachChild(spark);
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:TestExplosionEffect.java

示例2: createSmokeTrail

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSmokeTrail(){
        smoketrail = new ParticleEmitter("SmokeTrail", Type.Triangle, 22 * COUNT_FACTOR);
        smoketrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1.0f / COUNT_FACTOR_F)));
        smoketrail.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
        smoketrail.setStartSize(.2f);
        smoketrail.setEndSize(1f);

//        smoketrail.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
        smoketrail.setFacingVelocity(true);
        smoketrail.setParticlesPerSec(0);
        smoketrail.setGravity(0, 1, 0);
        smoketrail.setLowLife(.4f);
        smoketrail.setHighLife(.5f);
        smoketrail.setInitialVelocity(new Vector3f(0, 12, 0));
        smoketrail.setVelocityVariation(1);
        smoketrail.setImagesX(1);
        smoketrail.setImagesY(3);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
        mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/smoketrail.png"));
        smoketrail.setMaterial(mat);
        explosionEffect.attachChild(smoketrail);
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:TestExplosionEffect.java

示例3: createSpark

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSpark(){
    spark = new ParticleEmitter("Spark", Type.Triangle, 30 * COUNT_FACTOR);
    spark.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, (float) (1.0f / COUNT_FACTOR_F)));
    spark.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
    spark.setStartSize(.5f);
    spark.setEndSize(.5f);
    spark.setFacingVelocity(true);
    spark.setParticlesPerSec(0);
    spark.setGravity(0, 5, 0);
    spark.setLowLife(1.1f);
    spark.setHighLife(1.5f);
    spark.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 20, 0));
    spark.getParticleInfluencer().setVelocityVariation(1);
    spark.setImagesX(1);
    spark.setImagesY(1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/spark.png"));
    spark.setMaterial(mat);
    explosionEffect.attachChild(spark);
}
 
开发者ID:devinbost,项目名称:jMathGame3d,代码行数:21,代码来源:ExplosionEffect.java

示例4: createSparks

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private void createSparks() {
    sparks = new ParticleEmitter("Spark", Type.Triangle, 20);
    Material spark_mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    spark_mat.setTexture("Texture", assetManager.loadTexture("Effects/spark.png"));
    sparks.setMaterial(spark_mat);
    sparks.setImagesX(1);
    sparks.setImagesY(1);
    attachChild(sparks);

    sparks.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f)); // orange
    sparks.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
    sparks.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 10, 0));
    sparks.getParticleInfluencer().setVelocityVariation(1);
    sparks.setFacingVelocity(true);
    sparks.setGravity(0, 10, 0);
    sparks.setStartSize(.5f);
    sparks.setEndSize(.5f);
    sparks.setLowLife(.9f);
    sparks.setHighLife(1.1f);
    sparks.setParticlesPerSec(0);

}
 
开发者ID:kemonoske,项目名称:ArcaneMining,代码行数:23,代码来源:Explosion.java

示例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;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:66,代码来源:Emitter.java

示例6: getEmiterFromCaster

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
private ParticleEmitter getEmiterFromCaster(ParticleCaster caster){
	ParticleEmitter res = new ParticleEmitter("Particle caster", Type.Triangle, caster.getMaxCount());
	res.setParticlesPerSec(caster.getPerSecond());

	// material
	Material m = new Material(RendererPlatform.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
	res.setMaterial(m);
	if(!caster.getSpritePath().isEmpty())
		if(caster.getNbCol() == 0 || caster.getNbRow() == 0)
			LogUtil.warning("Can't apply particle material. You must specify colum and row count.");
		else
			m.setTexture("Texture", RendererPlatform.getAssetManager().loadTexture("textures/" + caster.getSpritePath()));
	
	m.getAdditionalRenderState().setBlendMode(caster.isAdd()? RenderState.BlendMode.Additive : RenderState.BlendMode.AlphaAdditive);
	
	// sprite
	res.setImagesX(caster.getNbCol());
	res.setImagesY(caster.getNbRow());

	// fanning
	res.getParticleInfluencer().setVelocityVariation((float)caster.getFanning());

	// size
	res.setStartSize((float)caster.getStartSize());
	res.setEndSize((float)caster.getEndSize());
	
	// life
	res.setLowLife((float)caster.getMinLife());
	res.setHighLife((float)caster.getMaxLife());

	// color
	res.setStartColor(TranslateUtil.toColorRGBA(caster.getStartColor()));
	res.setEndColor(TranslateUtil.toColorRGBA(caster.getEndColor()));
	
	// facing
	switch(caster.getFacing()){
	case Camera: break;
	case Horizontal: res.setFaceNormal(Vector3f.UNIT_Z); break;
	case Velocity: res.setFacingVelocity(true);
	}

	if(caster.getStartVariation() != 0) {
		res.setShape(new EmitterSphereShape(Vector3f.ZERO, (float)caster.getStartVariation()));
	}
	
	res.setGravity(caster.isGravity()? Vector3f.UNIT_Z.negate() : Vector3f.ZERO);
	
	return res;
}
 
开发者ID:meltzow,项目名称:supernovae,代码行数:50,代码来源:ParticleProc.java

示例7: createEmitter

import com.jme3.effect.ParticleEmitter; //导入方法依赖的package包/类
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;
}
 
开发者ID:methusalah,项目名称:OpenRTS,代码行数:42,代码来源:ParticlePerformer.java


注:本文中的com.jme3.effect.ParticleEmitter.setFacingVelocity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。