本文整理汇总了Java中com.jme3.effect.shapes.EmitterShape类的典型用法代码示例。如果您正苦于以下问题:Java EmitterShape类的具体用法?Java EmitterShape怎么用?Java EmitterShape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmitterShape类属于com.jme3.effect.shapes包,在下文中一共展示了EmitterShape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildForImpl
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
@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);
}
}
示例2: influenceParticle
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
@Override
public void influenceParticle(Particle particle, EmitterShape emitterShape) {
emitterShape.getRandomPointAndNormal(particle.position, particle.velocity);
// influencing the particle's velocity
if (surfaceTangentFactor == 0.0f) {
particle.velocity.multLocal(normalVelocity);
} else {
// calculating surface tangent (velocity contains the 'normal' value)
temp.set(particle.velocity.z * surfaceTangentFactor, particle.velocity.y * surfaceTangentFactor, -particle.velocity.x * surfaceTangentFactor);
if (surfaceTangentRotation != 0.0f) {// rotating the tangent
Matrix3f m = new Matrix3f();
m.fromAngleNormalAxis(FastMath.PI * surfaceTangentRotation, particle.velocity);
temp = m.multLocal(temp);
}
// applying normal factor (this must be done first)
particle.velocity.multLocal(normalVelocity);
// adding tangent vector
particle.velocity.addLocal(temp);
}
if (velocityVariation != 0.0f) {
this.applyVelocityVariation(particle);
}
}
示例3: SceneExplorerProperty
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
public SceneExplorerProperty(T instance, Class valueType, String getter, String setter, ScenePropertyChangeListener listener) throws NoSuchMethodException {
super(instance, valueType, getter, setter);
addPropertyChangeListener(listener);
if (valueType == Vector3f.class) {
setPropertyEditorClass(Vector3fPropertyEditor.class);
} else if (valueType == Quaternion.class) {
setPropertyEditorClass(QuaternionPropertyEditor.class);
} else if (valueType == Matrix3f.class) {
setPropertyEditorClass(Matrix3fPropertyEditor.class);
} else if (valueType == ColorRGBA.class) {
setPropertyEditorClass(ColorRGBAPropertyEditor.class);
} else if (valueType == EmitterShape.class) {
setPropertyEditorClass(EmitterShapePropertyEditor.class);
} else if (valueType == Vector2f.class) {
setPropertyEditorClass(Vector2fPropertyEditor.class);
}
for (SceneExplorerPropertyEditor di : Lookup.getDefault().lookupAll(SceneExplorerPropertyEditor.class)) {
di.setEditor(valueType, this);
}
}
示例4: createEmitterShape
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
@Override
@FXThread
protected @NotNull EmitterShape createEmitterShape(@NotNull final VarTable vars) {
final Vector3f min = vars.get(PROPERTY_MIN);
final Vector3f max = vars.get(PROPERTY_MAX);
return new EmitterBoxShape(min, max);
}
示例5: handleResult
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
/**
* Handle the result from the dialog.
*
* @param vars the table with variables.
*/
@FXThread
private void handleResult(@NotNull final VarTable vars) {
final TreeNode<?> treeNode = getNode();
final ParticleEmitter element = (ParticleEmitter) treeNode.getElement();
final EmitterShape emitterShape = createEmitterShape(vars);
final NodeTree<?> nodeTree = getNodeTree();
final ChangeConsumer changeConsumer = notNull(nodeTree.getChangeConsumer());
changeConsumer.execute(new ChangeEmitterShapeOperation(emitterShape, element));
}
示例6: createEmitterShape
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
@Override
@FXThread
protected @NotNull EmitterShape createEmitterShape(@NotNull final VarTable vars) {
final Geometry geometry = vars.get(PROPERTY_GEOMETRY);
final List<Mesh> meshes = singletonList(geometry.getMesh());
return createEmitterShape(meshes);
}
示例7: createEmitterShape
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
@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);
}
示例8: switchShape
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
private void switchShape(final @NotNull ModelChangeConsumer editor) {
final EmitterShape shape = emitter.getShape();
final EmitterShape newShape = prevShape;
prevShape = shape;
emitter.setShape(newShape);
EXECUTOR_MANAGER.addFXTask(() -> editor.notifyFXReplaced(emitter, prevShape, newShape, true, true));
}
示例9: getChildren
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
@NotNull
@Override
public Array<TreeNode<?>> getChildren(@NotNull final NodeTree<?> nodeTree) {
final ParticleEmitter element = getElement();
final TreeNode<ParticleInfluencer> influencerTreeNode = FACTORY_REGISTRY.createFor(element.getParticleInfluencer());
final TreeNode<EmitterShape> shapeTreeNode = FACTORY_REGISTRY.createFor(element.getShape());
final Array<TreeNode<?>> children = ArrayFactory.newArray(TreeNode.class);
if (influencerTreeNode != null) children.add(influencerTreeNode);
if (shapeTreeNode != null) children.add(shapeTreeNode);
children.addAll(super.getChildren(nodeTree));
return children;
}
示例10: SceneExplorerProperty
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
public SceneExplorerProperty(T instance, Class valueType, String getter, String setter, ScenePropertyChangeListener listener) throws NoSuchMethodException {
super(instance, valueType, getter, setter);
primitive = isPrimitive(instance, getter);
if (!primitive) {
cloneable = canClone(instance, getter);
instantiable = canRecreate(instance, getter);
} else {
cloneable = false;
instantiable = false;
}
if (valueType == Vector3f.class) {
setPropertyEditorClass(Vector3fPropertyEditor.class);
} else if (valueType == Quaternion.class) {
setPropertyEditorClass(QuaternionPropertyEditor.class);
} else if (valueType == Matrix3f.class) {
setPropertyEditorClass(Matrix3fPropertyEditor.class);
} else if (valueType == ColorRGBA.class) {
setPropertyEditorClass(ColorRGBAPropertyEditor.class);
} else if (valueType == EmitterShape.class) {
setPropertyEditorClass(EmitterShapePropertyEditor.class);
} else if (valueType == Vector2f.class) {
setPropertyEditorClass(Vector2fPropertyEditor.class);
} else if (valueType == ParticleInfluencer.class) {
setPropertyEditorClass(ParticleInfluencerPropertyEditor.class);
} else if (Light.class.isAssignableFrom(valueType)) {
setPropertyEditorClass(LightPropertyEditor.class);
}
for (SceneExplorerPropertyEditor di : Lookup.getDefault().lookupAll(SceneExplorerPropertyEditor.class)) {
di.setEditor(valueType, this);
}
//TODO: instantiates editor?
editable = this.canWrite();
logger.log(Level.FINE, "Created SceneExplorerProperty for {0},\n cloneable = {1},\n instantiatable = {2},\n primitive = {3},\n editable = {4}", new Object[]{valueType, cloneable, instantiable, primitive, editable});
addPropertyChangeListener(listener);
}
示例11: notifyListeners
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
private void notifyListeners(EmitterShape before, EmitterShape after) {
for (Iterator<PropertyChangeListener> it = listeners.iterator(); it.hasNext();) {
PropertyChangeListener propertyChangeListener = it.next();
//TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion
propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after));
}
}
示例12: createPurpleEmitter
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
private ParticleEmitter createPurpleEmitter() {
ParticleEmitter purple = new ParticleEmitter("poison-emitter",
ParticleMesh.Type.Triangle, 400);
Material mat = new Material(assets,
"Common/MatDefs/Misc/Particle.j3md");
mat.setTexture("Texture", assets.loadTexture("Effects/flame.png"));
purple.setMaterial(mat);
purple.setImagesX(2);
purple.setImagesY(2);
purple.setSelectRandomImage(true);
purple.setStartColor(new ColorRGBA(0.8f, 0.015f, 0.8f, 0.6f));
purple.setEndColor(new ColorRGBA(0.8f, 0.015f, 0.8f, 0.6f));
purple.setStartSize(1f);
purple.setEndSize(2f);
purple.setLowLife(0.2f);
purple.setHighLife(0.2f);
purple.setParticlesPerSec(300);
purple.getParticleInfluencer().setInitialVelocity(Vector3f.ZERO);
purple.getParticleInfluencer().setVelocityVariation(0);
purple.setInWorldSpace(false);
EmitterShape shape =
new EmitterArcShape(Vector3f.ZERO, 0.3f, 0.8f, 1.5f * RADIUS);
purple.setShape(shape);
purple.setRandomAngle(true);
return purple;
}
示例13: deepClone
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
@Override
public EmitterShape deepClone() {
try {
EmitterArcShape clone = (EmitterArcShape) super.clone();
clone.origin = origin.clone();
return clone;
} catch (CloneNotSupportedException ex) {
throw new AssertionError();
}
}
示例14: deepClone
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
@Override
public EmitterShape deepClone(){
try {
EmitterCircleShape clone = (EmitterCircleShape) super.clone();
clone.center = center.clone();
return clone;
} catch (CloneNotSupportedException ex) {
throw new AssertionError();
}
}
示例15: apply
import com.jme3.effect.shapes.EmitterShape; //导入依赖的package包/类
@Override
public Node apply(Node node, BlenderContext blenderContext) {
if (invalid) {
LOGGER.log(Level.WARNING, "Particles modifier is invalid! Cannot be applied to: {0}", node.getName());
return node;
}
MaterialHelper materialHelper = blenderContext.getHelper(MaterialHelper.class);
ParticleEmitter emitter = particleEmitter.clone();
// veryfying the alpha function for particles' texture
Integer alphaFunction = MaterialHelper.ALPHA_MASK_HYPERBOLE;
char nameSuffix = emitter.getName().charAt(emitter.getName().length() - 1);
if (nameSuffix == 'B' || nameSuffix == 'N') {
alphaFunction = MaterialHelper.ALPHA_MASK_NONE;
}
// removing the type suffix from the name
emitter.setName(emitter.getName().substring(0, emitter.getName().length() - 1));
// applying emitter shape
EmitterShape emitterShape = emitter.getShape();
List<Mesh> meshes = new ArrayList<Mesh>();
for (Spatial spatial : node.getChildren()) {
if (spatial instanceof Geometry) {
Mesh mesh = ((Geometry) spatial).getMesh();
if (mesh != null) {
meshes.add(mesh);
Material material = materialHelper.getParticlesMaterial(((Geometry) spatial).getMaterial(), alphaFunction, blenderContext);
emitter.setMaterial(material);// TODO: divide into several pieces
}
}
}
if (meshes.size() > 0 && emitterShape instanceof EmitterMeshVertexShape) {
((EmitterMeshVertexShape) emitterShape).setMeshes(meshes);
}
node.attachChild(emitter);
return node;
}