use of com.jme3.export.InputCapsule in project jmonkeyengine by jMonkeyEngine.
the class Texture2D method read.
@Override
public void read(JmeImporter e) throws IOException {
super.read(e);
InputCapsule capsule = e.getCapsule(this);
wrapS = capsule.readEnum("wrapS", WrapMode.class, WrapMode.EdgeClamp);
wrapT = capsule.readEnum("wrapT", WrapMode.class, WrapMode.EdgeClamp);
}
use of com.jme3.export.InputCapsule in project jmonkeyengine by jMonkeyEngine.
the class SpotLight method read.
@Override
public void read(JmeImporter im) throws IOException {
super.read(im);
InputCapsule ic = im.getCapsule(this);
spotInnerAngle = ic.readFloat("spotInnerAngle", FastMath.QUARTER_PI / 8);
spotOuterAngle = ic.readFloat("spotOuterAngle", FastMath.QUARTER_PI / 6);
computeAngleParameters();
direction = (Vector3f) ic.readSavable("direction", new Vector3f());
position = (Vector3f) ic.readSavable("position", new Vector3f());
spotRange = ic.readFloat("spotRange", 100);
if (spotRange != 0) {
this.invSpotRange = 1 / spotRange;
} else {
this.invSpotRange = 0;
}
}
use of com.jme3.export.InputCapsule in project jmonkeyengine by jMonkeyEngine.
the class ParticleEmitter method read.
@Override
public void read(JmeImporter im) throws IOException {
super.read(im);
InputCapsule ic = im.getCapsule(this);
shape = (EmitterShape) ic.readSavable("shape", DEFAULT_SHAPE);
if (shape == DEFAULT_SHAPE) {
// Prevent reference to static
shape = shape.deepClone();
}
meshType = ic.readEnum("meshType", ParticleMesh.Type.class, ParticleMesh.Type.Triangle);
int numParticles = ic.readInt("numParticles", 0);
enabled = ic.readBoolean("enabled", true);
particlesPerSec = ic.readFloat("particlesPerSec", 0);
lowLife = ic.readFloat("lowLife", 0);
highLife = ic.readFloat("highLife", 0);
gravity = (Vector3f) ic.readSavable("gravity", null);
imagesX = ic.readInt("imagesX", 1);
imagesY = ic.readInt("imagesY", 1);
startColor = (ColorRGBA) ic.readSavable("startColor", null);
endColor = (ColorRGBA) ic.readSavable("endColor", null);
startSize = ic.readFloat("startSize", 0);
endSize = ic.readFloat("endSize", 0);
worldSpace = ic.readBoolean("worldSpace", false);
this.setIgnoreTransform(worldSpace);
facingVelocity = ic.readBoolean("facingVelocity", false);
faceNormal = (Vector3f) ic.readSavable("faceNormal", new Vector3f(Vector3f.NAN));
selectRandomImage = ic.readBoolean("selectRandomImage", false);
randomAngle = ic.readBoolean("randomAngle", false);
rotateSpeed = ic.readFloat("rotateSpeed", 0);
switch(meshType) {
case Point:
particleMesh = new ParticlePointMesh();
this.setMesh(particleMesh);
break;
case Triangle:
particleMesh = new ParticleTriMesh();
this.setMesh(particleMesh);
break;
default:
throw new IllegalStateException("Unrecognized particle type: " + meshType);
}
this.setNumParticles(numParticles);
// particleMesh.initParticleData(this, particles.length);
// particleMesh.setImagesXY(imagesX, imagesY);
particleInfluencer = (ParticleInfluencer) ic.readSavable("influencer", DEFAULT_INFLUENCER);
if (particleInfluencer == DEFAULT_INFLUENCER) {
particleInfluencer = particleInfluencer.clone();
}
if (im.getFormatVersion() == 0) {
// find it in the controls and take it out, then add the proper one in
for (int i = 0; i < controls.size(); i++) {
Object obj = controls.get(i);
if (obj instanceof ParticleEmitter) {
controls.remove(i);
// now add the proper one in
controls.add(new ParticleEmitterControl(this));
break;
}
}
// compatability before gravity was not a vector but a float
if (gravity == null) {
gravity = new Vector3f();
gravity.y = ic.readFloat("gravity", 0);
}
} else {
// since the parentEmitter is not loaded, it must be
// loaded separately
control = getControl(ParticleEmitterControl.class);
control.parentEmitter = this;
}
}
use of com.jme3.export.InputCapsule in project jmonkeyengine by jMonkeyEngine.
the class ChaseCamera method read.
/**
* Read the camera
* @param im
* @throws IOException
*/
public void read(JmeImporter im) throws IOException {
InputCapsule ic = im.getCapsule(this);
maxDistance = ic.readFloat("maxDistance", 40);
minDistance = ic.readFloat("minDistance", 1);
}
use of com.jme3.export.InputCapsule in project jmonkeyengine by jMonkeyEngine.
the class EmitterSphereShape method read.
@Override
public void read(JmeImporter im) throws IOException {
InputCapsule ic = im.getCapsule(this);
center = (Vector3f) ic.readSavable("center", null);
radius = ic.readFloat("radius", 0);
}
Aggregations