use of com.jme3.export.InputCapsule in project jmonkeyengine by jMonkeyEngine.
the class KinematicRagdollControl method read.
/**
* de-serialize this control
*
* @param im
* @throws IOException
*/
@Override
public void read(JmeImporter im) throws IOException {
super.read(im);
InputCapsule ic = im.getCapsule(this);
String[] loadedBoneList = ic.readStringArray("boneList", new String[0]);
boneList.addAll(Arrays.asList(loadedBoneList));
PhysicsBoneLink[] loadedBoneLinks = (PhysicsBoneLink[]) ic.readSavableArray("boneList", new PhysicsBoneLink[0]);
for (PhysicsBoneLink physicsBoneLink : loadedBoneLinks) {
boneLinks.put(physicsBoneLink.bone.getName(), physicsBoneLink);
}
modelPosition.set((Vector3f) ic.readSavable("modelPosition", new Vector3f()));
modelRotation.set((Quaternion) ic.readSavable("modelRotation", new Quaternion()));
targetModel = (Spatial) ic.readSavable("targetModel", null);
skeleton = (Skeleton) ic.readSavable("skeleton", null);
// preset //TODO
initScale = (Vector3f) ic.readSavable("initScale", null);
mode = ic.readEnum("mode", Mode.class, Mode.Kinematic);
blendedControl = ic.readBoolean("blendedControl", false);
weightThreshold = ic.readFloat("weightThreshold", -1.0f);
blendStart = ic.readFloat("blendStart", 0.0f);
blendTime = ic.readFloat("blendTime", 1.0f);
eventDispatchImpulseThreshold = ic.readFloat("eventDispatchImpulseThreshold", 10);
rootMass = ic.readFloat("rootMass", 15);
totalMass = ic.readFloat("totalMass", 0);
}
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);
}
Aggregations