com.jme3.export.OutputCapsule Java Examples

The following examples show how to use com.jme3.export.OutputCapsule. 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: DefineList.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void write(JmeExporter ex) throws IOException{
    OutputCapsule oc = ex.getCapsule(this);

    String[] keys = new String[defines.size()];
    String[] vals = new String[defines.size()];

    int i = 0;
    for (Map.Entry<String, String> define : defines.entrySet()){
        keys[i] = define.getKey();
        vals[i] = define.getValue();
        i++;
    }

    oc.write(keys, "keys", null);
    oc.write(vals, "vals", null);

    // for compatability only with older versions
    oc.write(compiled, "compiled", null);
}
 
Example #3
Source File: PhysicsRigidBody.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);

    capsule.write(getMass(), "mass", 1.0f);

    capsule.write(getGravity(), "gravity", Vector3f.ZERO);
    capsule.write(getFriction(), "friction", 0.5f);
    capsule.write(getRestitution(), "restitution", 0);
    capsule.write(getAngularFactor(), "angularFactor", 1);
    capsule.write(kinematic, "kinematic", false);

    capsule.write(constructionInfo.linearDamping, "linearDamping", 0);
    capsule.write(constructionInfo.angularDamping, "angularDamping", 0);
    capsule.write(constructionInfo.linearSleepingThreshold, "linearSleepingThreshold", 0.8f);
    capsule.write(constructionInfo.angularSleepingThreshold, "angularSleepingThreshold", 1.0f);

    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);

    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
    capsule.write(getPhysicsRotationMatrix(new Matrix3f()), "physicsRotation", new Matrix3f());

    capsule.writeSavableArrayList(joints, "joints", null);
}
 
Example #4
Source File: BitmapCharacter.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(c, "c", 0);
    oc.write(x, "x", 0);
    oc.write(y, "y", 0);
    oc.write(width, "width", 0);
    oc.write(height, "height", 0);
    oc.write(xOffset, "xOffset", 0);
    oc.write(yOffset, "yOffset", 0);
    oc.write(xAdvance, "xAdvance", 0);

    int[] seconds = new int[kerning.size()];
    int[] amounts = new int[seconds.length];

    int i = 0;
    for (Entry<Integer> entry : kerning){
        seconds[i] = entry.getKey();
        amounts[i] = entry.getValue();
        i++;
    }

    oc.write(seconds, "seconds", null);
    oc.write(amounts, "amounts", null);
}
 
Example #5
Source File: HingeJoint.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(axisA, "axisA", new Vector3f());
    capsule.write(axisB, "axisB", new Vector3f());

    capsule.write(angularOnly, "angularOnly", false);

    capsule.write(getLowerLimit(), "lowerLimit", 1e30f);
    capsule.write(getUpperLimit(), "upperLimit", -1e30f);

    capsule.write(biasFactor, "biasFactor", 0.3f);
    capsule.write(relaxationFactor, "relaxationFactor", 1f);
    capsule.write(limitSoftness, "limitSoftness", 0.9f);

    capsule.write(getEnableMotor(), "enableAngularMotor", false);
    capsule.write(getMotorTargetVelocity(), "targetVelocity", 0.0f);
    capsule.write(getMaxMotorImpulse(), "maxMotorImpulse", 0.0f);
}
 
Example #6
Source File: MatParam.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(type, "varType", null);
    oc.write(name, "name", null);
    oc.write(ffBinding, "ff_binding", null);
    if (value instanceof Savable) {
        Savable s = (Savable) value;
        oc.write(s, "value_savable", null);
    } else if (value instanceof Float) {
        Float f = (Float) value;
        oc.write(f.floatValue(), "value_float", 0f);
    } else if (value instanceof Integer) {
        Integer i = (Integer) value;
        oc.write(i.intValue(), "value_int", 0);
    } else if (value instanceof Boolean) {
        Boolean b = (Boolean) value;
        oc.write(b.booleanValue(), "value_bool", false);
    }
}
 
Example #7
Source File: Texture.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void write(JmeExporter e) throws IOException {
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(name, "name", null);
    
    if (key == null){
        // no texture key is set, try to save image instead then
        capsule.write(image, "image", null);
    }else{
        capsule.write(key, "key", null);
    }
    
    capsule.write(anisotropicFilter, "anisotropicFilter", 1);
    capsule.write(minificationFilter, "minificationFilter",
            MinFilter.BilinearNoMipMaps);
    capsule.write(magnificationFilter, "magnificationFilter",
            MagFilter.Bilinear);
}
 
Example #8
Source File: Technique.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(def, "def", null);
    // TODO:
    // oc.write(owner, "owner", null);
    oc.writeSavableArrayList(worldBindUniforms, "worldBindUniforms", null);
    oc.write(defines, "defines", null);
    oc.write(shader, "shader", null);
}
 
Example #9
Source File: TextureKey.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(flipY, "flip_y", false);
    oc.write(generateMips, "generate_mips", false);
    oc.write(asCube, "as_cubemap", false);
    oc.write(anisotropy, "anisotropy", 0);
}
 
Example #10
Source File: DepthOfFieldFilter.java    From MikuMikuStudio with BSD 2-Clause "Simplified" 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(focusDistance, "focusDistance", 50f);
    oc.write(focusRange, "focusRange", 10f);
}
 
Example #11
Source File: SpotLightShadowFilter.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 #12
Source File: SSAOFilter.java    From MikuMikuStudio with BSD 2-Clause "Simplified" 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(sampleRadius, "sampleRadius", 5.1f);
    oc.write(intensity, "intensity", 1.5f);
    oc.write(scale, "scale", 0.2f);
    oc.write(bias, "bias", 0.1f);
}
 
Example #13
Source File: ConeCollisionShape.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(radius, "radius", 0.5f);
    capsule.write(height, "height", 0.5f);
    capsule.write(axis, "axis", PhysicsSpace.AXIS_Y);
}
 
Example #14
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 #15
Source File: ShaderNodeVariable.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * jme serialization (not used)
 *
 * @param ex the exporter
 * @throws IOException
 */
@Override
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(name, "name", "");
    oc.write(type, "type", "");
    oc.write(prefix, "prefix", "");
    oc.write(nameSpace, "nameSpace", "");
    oc.write(condition, "condition", null);
    oc.write(shaderOutput, "shaderOutput", false);
    oc.write(multiplicity, "multiplicity", null);
    oc.write(defaultValue, "defaultValue", null);
}
 
Example #16
Source File: PhysicsVehicle.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 {
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(tuning.frictionSlip, "frictionSlip", 10.5f);
    capsule.write(tuning.maxSuspensionTravelCm, "maxSuspensionTravelCm", 500f);
    capsule.write(tuning.maxSuspensionForce, "maxSuspensionForce", 6000f);
    capsule.write(tuning.suspensionCompression, "suspensionCompression", 0.83f);
    capsule.write(tuning.suspensionDamping, "suspensionDamping", 0.88f);
    capsule.write(tuning.suspensionStiffness, "suspensionStiffness", 5.88f);
    capsule.writeSavableArrayList(wheels, "wheelsList", new ArrayList<VehicleWheel>());
    super.write(ex);
}
 
Example #17
Source File: ShaderGenerationInfo.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 {
    OutputCapsule oc = ex.getCapsule(this);
    oc.writeSavableArrayList((ArrayList) attributes, "attributes", new ArrayList<ShaderNodeVariable>());
    oc.writeSavableArrayList((ArrayList) vertexUniforms, "vertexUniforms", new ArrayList<ShaderNodeVariable>());
    oc.writeSavableArrayList((ArrayList) varyings, "varyings", new ArrayList<ShaderNodeVariable>());
    oc.writeSavableArrayList((ArrayList) fragmentUniforms, "fragmentUniforms", new ArrayList<ShaderNodeVariable>());
    oc.writeSavableArrayList((ArrayList) fragmentGlobals, "fragmentGlobals", new ArrayList<ShaderNodeVariable>());
    oc.write(vertexGlobal, "vertexGlobal", null);
}
 
Example #18
Source File: SixDofJoint.java    From MikuMikuStudio with BSD 2-Clause "Simplified" 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(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);
}
 
Example #19
Source File: TerrainQuad.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule c = e.getCapsule(this);
    c.write(size, "size", 0);
    c.write(totalSize, "totalSize", 0);
    c.write(stepScale, "stepScale", null);
    c.write(offset, "offset", new Vector2f(0,0));
    c.write(offsetAmount, "offsetAmount", 0);
    c.write(quadrant, "quadrant", 0);
    //c.write(lodCalculatorFactory, "lodCalculatorFactory", null);
    //c.write(lodCalculator, "lodCalculator", null);
}
 
Example #20
Source File: Cinematic.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);

    oc.writeSavableArrayList((ArrayList) cinematicEvents, "cinematicEvents", null);
    oc.writeStringSavableMap(cameras, "cameras", null);
    oc.write(timeLine, "timeLine", null);
    oc.write(niftyXmlPath, "niftyXmlPath", null);


}
 
Example #21
Source File: SpatialTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(translations, "translations", null);
    oc.write(rotations, "rotations", null);
    oc.write(times, "times", null);
    oc.write(scales, "scales", null);
}
 
Example #22
Source File: PhysicsCollisionObject.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(collisionGroup, "collisionGroup", 0x00000001);
    capsule.write(collisionGroupsMask, "collisionGroupsMask", 0x00000001);
    capsule.write(debugShape, "debugShape", null);
    capsule.write(collisionShape, "collisionShape", null);
}
 
Example #23
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 #24
Source File: PhysicsGhostObject.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
    capsule.write(getPhysicsRotationMatrix(new Matrix3f()), "physicsRotation", new Matrix3f());
    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);
}
 
Example #25
Source File: PhysicsGhostObject.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(getPhysicsLocation(new Vector3f()), "physicsLocation", new Vector3f());
    capsule.write(getPhysicsRotationMatrix(new Matrix3f()), "physicsRotation", new Matrix3f());
    capsule.write(getCcdMotionThreshold(), "ccdMotionThreshold", 0);
    capsule.write(getCcdSweptSphereRadius(), "ccdSweptSphereRadius", 0);
}
 
Example #26
Source File: Torus.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 {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(circleSamples, "circleSamples", 0);
    capsule.write(radialSamples, "radialSamples", 0);
    capsule.write(innerRadius, "innerRadius", 0);
    capsule.write(outerRadius, "outerRadius", 0);
}
 
Example #27
Source File: TorsoLink.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Serialize this link, 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(managedBones, "managedBones", null);
    oc.write(submode, "submode", KinematicSubmode.Animated);
    oc.write(endModelTransform, "endModelTransforms", new Transform());
    oc.write(meshToModel, "meshToModel", new Transform());
    oc.write(startModelTransform, "startModelTransforms", new Transform());
    oc.write(prevBoneTransforms, "prevBoneTransforms", new Transform[0]);
    oc.write(startBoneTransforms, "startBoneTransforms", new Transform[0]);
}
 
Example #28
Source File: Point2PointJoint.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule cap = ex.getCapsule(this);
    cap.write(getDamping(), "damping", 1.0f);
    cap.write(getTau(), "tau", 0.3f);
    cap.write(getImpulseClamp(), "impulseClamp", 0f);
}
 
Example #29
Source File: DacConfiguration.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(damping, "damping", 0.6f);
    oc.write(eventDispatchImpulseThreshold, "eventDispatchImpulseThreshold",
            0f);

    int count = countLinkedBones();
    String[] linkedBoneNames = new String[count];
    RangeOfMotion[] roms = new RangeOfMotion[count];
    float[] blConfigs = new float[count];
    int i = 0;
    for (Map.Entry<String, Float> entry : blConfigMap.entrySet()) {
        linkedBoneNames[i] = entry.getKey();
        roms[i] = jointMap.get(entry.getKey());
        blConfigs[i] = entry.getValue();
        ++i;
    }
    oc.write(linkedBoneNames, "linkedBoneNames", null);
    oc.write(roms, "linkedBoneJoints", null);
    oc.write(blConfigs, "blConfigs", null);

    oc.write(torsoMass, "torsoMass", 1f);
    oc.write(gravityVector, "gravity", null);
}
 
Example #30
Source File: LightControl.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(controlDir, CONTROL_DIR_NAME, ControlDirection.SpatialToLight);
    oc.write(light, LIGHT_NAME, null);
}