Java Code Examples for com.jme3.export.JmeExporter#getCapsule()

The following examples show how to use com.jme3.export.JmeExporter#getCapsule() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioNode.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(audioKey, "audio_key", null);
    oc.write(loop, "looping", false);
    oc.write(volume, "volume", 1);
    oc.write(pitch, "pitch", 1);
    oc.write(timeOffset, "time_offset", 0);
    oc.write(dryFilter, "dry_filter", null);

    oc.write(velocity, "velocity", null);
    oc.write(reverbEnabled, "reverb_enabled", false);
    oc.write(reverbFilter, "reverb_filter", null);
    oc.write(maxDistance, "max_distance", 20);
    oc.write(refDistance, "ref_distance", 10);

    oc.write(directional, "directional", false);
    oc.write(direction, "direction", null);
    oc.write(innerAngle, "inner_angle", 360);
    oc.write(outerAngle, "outer_angle", 360);

    oc.write(positional, "positional", false);
    oc.write(velocityFromTranslation, "velocity_from_translation", false);
}
 
Example 2
Source File: DynamicAnimControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this control, for example when saving to a J3O file.
 *
 * @param ex the exporter (not null)
 * @throws IOException from the exporter
 */
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);

    // isReady and collisionListeners not written
    oc.write(ragdollMass, "ragdollMass", 1f);
    oc.write(centerLocation, "centerLocation", null);
    oc.write(centerVelocity, "centerVelocity", null);
}
 
Example 3
Source File: PhysicsCharacter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this character, for example when saving to a J3O file.
 *
 * @param e exporter (not null)
 * @throws IOException from exporter
 */
@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(stepHeight, "stepHeight", 1.0f);
    capsule.write(getGravity(), "gravity", 9.8f * 3);
    capsule.write(getMaxSlope(), "maxSlope", 1.0f);
    capsule.write(fallSpeed, "fallSpeed", 55.0f);
    capsule.write(jumpSpeed, "jumpSpeed", 10.0f);
    capsule.write(upAxis, "upAxis", 1);
    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);
    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
}
 
Example 4
Source File: DirectionalLightShadowFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(shadowRenderer, "shadowRenderer", null);

}
 
Example 5
Source File: GImpactCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
     * Serialize this shape, for example when saving to a J3O file.
     *
     * @param ex exporter (not null)
     * @throws IOException from exporter
     */
    @Override
    public void write(JmeExporter ex) throws IOException {
        super.write(ex);
        OutputCapsule capsule = ex.getCapsule(this);
//        capsule.write(worldScale, "worldScale", new Vector3f(1, 1, 1));
        capsule.write(numVertices, "numVertices", 0);
        capsule.write(numTriangles, "numTriangles", 0);
        capsule.write(vertexStride, "vertexStride", 0);
        capsule.write(triangleIndexStride, "triangleIndexStride", 0);

        capsule.write(triangleIndexBase.array(), "triangleIndexBase", new byte[0]);
        capsule.write(vertexBase.array(), "vertexBase", new byte[0]);
    }
 
Example 6
Source File: CompoundCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this shape, for example when saving to a J3O file.
 *
 * @param ex exporter (not null)
 * @throws IOException from exporter
 */
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.writeSavableArrayList(children, "children", new ArrayList<ChildCollisionShape>());
}
 
Example 7
Source File: SixDofJoint.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this joint, for example when saving to a J3O file.
 *
 * @param ex exporter (not null)
 * @throws IOException from exporter
 */
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(angularUpperLimit, "angularUpperLimit", new Vector3f(Vector3f.POSITIVE_INFINITY));
    capsule.write(angularLowerLimit, "angularLowerLimit", new Vector3f(Vector3f.NEGATIVE_INFINITY));
    capsule.write(linearUpperLimit, "linearUpperLimit", new Vector3f(Vector3f.POSITIVE_INFINITY));
    capsule.write(linearLowerLimit, "linearLowerLimit", new Vector3f(Vector3f.NEGATIVE_INFINITY));
    int i = 0;
    for (Iterator<RotationalLimitMotor> it = rotationalMotors.iterator(); it.hasNext();) {
        RotationalLimitMotor rotationalLimitMotor = it.next();
        capsule.write(rotationalLimitMotor.getBounce(), "rotMotor" + i + "_Bounce", 0.0f);
        capsule.write(rotationalLimitMotor.getDamping(), "rotMotor" + i + "_Damping", 1.0f);
        capsule.write(rotationalLimitMotor.getERP(), "rotMotor" + i + "_ERP", 0.5f);
        capsule.write(rotationalLimitMotor.getHiLimit(), "rotMotor" + i + "_HiLimit", Float.POSITIVE_INFINITY);
        capsule.write(rotationalLimitMotor.getLimitSoftness(), "rotMotor" + i + "_LimitSoftness", 0.5f);
        capsule.write(rotationalLimitMotor.getLoLimit(), "rotMotor" + i + "_LoLimit", Float.NEGATIVE_INFINITY);
        capsule.write(rotationalLimitMotor.getMaxLimitForce(), "rotMotor" + i + "_MaxLimitForce", 300.0f);
        capsule.write(rotationalLimitMotor.getMaxMotorForce(), "rotMotor" + i + "_MaxMotorForce", 0.1f);
        capsule.write(rotationalLimitMotor.getTargetVelocity(), "rotMotor" + i + "_TargetVelocity", 0);
        capsule.write(rotationalLimitMotor.isEnableMotor(), "rotMotor" + i + "_EnableMotor", false);
        i++;
    }
    capsule.write(getTranslationalLimitMotor().getAccumulatedImpulse(), "transMotor_AccumulatedImpulse", Vector3f.ZERO);
    capsule.write(getTranslationalLimitMotor().getDamping(), "transMotor_Damping", 1.0f);
    capsule.write(getTranslationalLimitMotor().getLimitSoftness(), "transMotor_LimitSoftness", 0.7f);
    capsule.write(getTranslationalLimitMotor().getLowerLimit(), "transMotor_LowerLimit", Vector3f.ZERO);
    capsule.write(getTranslationalLimitMotor().getRestitution(), "transMotor_Restitution", 0.5f);
    capsule.write(getTranslationalLimitMotor().getUpperLimit(), "transMotor_UpperLimit", Vector3f.ZERO);

    for (int axisIndex = 0; axisIndex < 3; ++axisIndex) {
        capsule.write(translationalMotor.isEnabled(axisIndex),
                "transMotor_Enable" + axisIndex, false);
    }
}
 
Example 8
Source File: BloomFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(glowMode, "glowMode", GlowMode.Scene);
    oc.write(blurScale, "blurScale", 1.5f);
    oc.write(exposurePower, "exposurePower", 5.0f);
    oc.write(exposureCutOff, "exposureCutOff", 0.0f);
    oc.write(bloomIntensity, "bloomIntensity", 2.0f);
    oc.write(downSamplingFactor, "downSamplingFactor", 1);
}
 
Example 9
Source File: ParticleEmitter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(shape, "shape", DEFAULT_SHAPE);
    oc.write(meshType, "meshType", ParticleMesh.Type.Triangle);
    oc.write(enabled, "enabled", true);
    oc.write(particles.length, "numParticles", 0);
    oc.write(particlesPerSec, "particlesPerSec", 0);
    oc.write(lowLife, "lowLife", 0);
    oc.write(highLife, "highLife", 0);
    oc.write(gravity, "gravity", null);
    oc.write(imagesX, "imagesX", 1);
    oc.write(imagesY, "imagesY", 1);

    oc.write(startColor, "startColor", null);
    oc.write(endColor, "endColor", null);
    oc.write(startSize, "startSize", 0);
    oc.write(endSize, "endSize", 0);
    oc.write(worldSpace, "worldSpace", false);
    oc.write(facingVelocity, "facingVelocity", false);
    oc.write(faceNormal, "faceNormal", new Vector3f(Vector3f.NAN));
    oc.write(selectRandomImage, "selectRandomImage", false);
    oc.write(randomAngle, "randomAngle", false);
    oc.write(rotateSpeed, "rotateSpeed", 0);

    oc.write(particleInfluencer, "influencer", DEFAULT_INFLUENCER);
}
 
Example 10
Source File: ConeJoint.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(rotA, "rotA", new Matrix3f());
    capsule.write(rotB, "rotB", new Matrix3f());

    capsule.write(angularOnly, "angularOnly", false);
    capsule.write(swingSpan1, "swingSpan1", 1e30f);
    capsule.write(swingSpan2, "swingSpan2", 1e30f);
    capsule.write(twistSpan, "twistSpan", 1e30f);
}
 
Example 11
Source File: Geometry.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(mesh, "mesh", null);
    if (material != null) {
        oc.write(material.getAssetName(), "materialName", null);
    }
    oc.write(material, "material", null);
    oc.write(ignoreTransform, "ignoreTransform", false);
}
 
Example 12
Source File: GhostControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this control, for example when saving to a J3O file.
 *
 * @param ex exporter (not null)
 * @throws IOException from exporter
 */
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(enabled, "enabled", true);
    oc.write(applyLocal, "applyLocalPhysics", false);
    oc.write(spatial, "spatial", null);
}
 
Example 13
Source File: Image.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(format, "format", Format.RGBA8);
    capsule.write(width, "width", 0);
    capsule.write(height, "height", 0);
    capsule.write(depth, "depth", 0);
    capsule.write(mipMapSizes, "mipMapSizes", null);
    capsule.write(multiSamples, "multiSamples", 1);
    capsule.writeByteBufferArrayList(data, "data", null);
    capsule.write(colorSpace, "colorSpace", null);
}
 
Example 14
Source File: RadialBlurFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(sampleDist, "sampleDist", 1.0f);
    oc.write(sampleStrength, "sampleStrength", 2.2f);
}
 
Example 15
Source File: DirectionalLightShadowRendererVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(lambda, "lambda", 0.65f);
    oc.write(zFarOverride, "zFarOverride", 0);
    oc.write(light, "light", null);
    oc.write(fadeInfo, "fadeInfo", null);
    oc.write(fadeLength, "fadeLength", 0f);
}
 
Example 16
Source File: DepthOfFieldFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(blurScale, "blurScale", 1f);
    oc.write(blurScale, "blurThreshold", 0.2f);
    oc.write(focusDistance, "focusDistance", 50f);
    oc.write(focusRange, "focusRange", 10f);
    oc.write(debugUnfocus, "debugUnfocus", false); // strange to write this I guess
}
 
Example 17
Source File: SphereCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(radius, "radius", 0.5f);
}
 
Example 18
Source File: BoxCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(halfExtents, "halfExtents", new Vector3f(1, 1, 1));
}
 
Example 19
Source File: EmitterBoxShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(min, "min", null);
    oc.write(len, "length", null);
}
 
Example 20
Source File: DefaultParticleInfluencer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(initialVelocity, "initialVelocity", Vector3f.ZERO);
    oc.write(velocityVariation, "variation", 0.2f);
}