Java Code Examples for com.jme3.export.OutputCapsule#write()

The following examples show how to use com.jme3.export.OutputCapsule#write() . 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: 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 2
Source File: HingeJoint.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 capsule = ex.getCapsule(this);
    capsule.write(axisA, "axisA", new Vector3f());
    capsule.write(axisB, "axisB", new Vector3f());

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

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

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

    capsule.write(((HingeConstraint) constraint).getEnableAngularMotor(), "enableAngularMotor", false);
    capsule.write(((HingeConstraint) constraint).getMotorTargetVelosity(), "targetVelocity", 0.0f);
    capsule.write(((HingeConstraint) constraint).getMaxMotorImpulse(), "maxMotorImpulse", 0.0f);
}
 
Example 3
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 4
Source File: Texture3D.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(wrapS, "wrapS", WrapMode.EdgeClamp);
    capsule.write(wrapT, "wrapT", WrapMode.EdgeClamp);
    capsule.write(wrapR, "wrapR", WrapMode.EdgeClamp);
}
 
Example 5
Source File: CylinderCollisionShape.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(halfExtents, "halfExtents", new Vector3f(0.5f, 0.5f, 0.5f));
    capsule.write(axis, "axis", 1);
}
 
Example 6
Source File: Sphere.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void write(JmeExporter e) throws IOException {
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.write(zSamples, "zSamples", 0);
    capsule.write(radialSamples, "radialSamples", 0);
    capsule.write(radius, "radius", 0);
    capsule.write(useEvenSlices, "useEvenSlices", false);
    capsule.write(textureMode, "textureMode", TextureMode.Original);
    capsule.write(interior, "interior", false);
}
 
Example 7
Source File: Cylinder.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(axisSamples, "axisSamples", 0);
    capsule.write(radialSamples, "radialSamples", 0);
    capsule.write(radius, "radius", 0);
    capsule.write(radius2, "radius2", 0);
    capsule.write(height, "height", 0);
    capsule.write(closed, "closed", false);
    capsule.write(inverted, "inverted", false);
}
 
Example 8
Source File: PhysicsHoverControl.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(enabled, "enabled", true);
    oc.write(spatial, "spatial", null);
}
 
Example 9
Source File: MotionEvent.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(lookAt, "lookAt", null);
    oc.write(upVector, "upVector", Vector3f.UNIT_Y);
    oc.write(rotation, "rotation", null);
    oc.write(directionType, "directionType", Direction.None);
    oc.write(path, "path", null);
    oc.write(spatial, "spatial", null);
}
 
Example 10
Source File: BillboardControl.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(orient, "orient", null);
    capsule.write(look, "look", null);
    capsule.write(left, "left", null);
    capsule.write(alignment, "alignment", Alignment.Screen);
}
 
Example 11
Source File: SpotLight.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(direction, "direction", new Vector3f());
    oc.write(position, "position", new Vector3f());
    oc.write(spotInnerAngle, "spotInnerAngle", FastMath.QUARTER_PI / 8);
    oc.write(spotOuterAngle, "spotOuterAngle", FastMath.QUARTER_PI / 6);
    oc.write(spotRange, "spotRange", 100);
}
 
Example 12
Source File: PointLightShadowFilter.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 13
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 14
Source File: HeightfieldCollisionShape.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 capsule = ex.getCapsule(this);
    capsule.write(heightStickWidth, "heightStickWidth", 0);
    capsule.write(heightStickLength, "heightStickLength", 0);
    capsule.write(heightScale, "heightScale", 0);
    capsule.write(minHeight, "minHeight", 0);
    capsule.write(maxHeight, "maxHeight", 0);
    capsule.write(upAxis, "upAxis", 1);
    capsule.write(heightfieldData, "heightfieldData", new float[0]);
    capsule.write(flipQuadEdges, "flipQuadEdges", false);
}
 
Example 15
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 16
Source File: MeshCollisionShape.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
     * creates a jme mesh from the collision shape, only needed for debugging
     */
//    public Mesh createJmeMesh(){
//        return Converter.convert(bulletMesh);
//    }
    public void write(JmeExporter ex) throws IOException {
        super.write(ex);
        OutputCapsule capsule = ex.getCapsule(this);
        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 17
Source File: DefaultParticleInfluencer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(startVelocity, "startVelocity", Vector3f.ZERO);
    oc.write(velocityVariation, "variation", 0.2f);
}
 
Example 18
Source File: GuiTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(screen, "screen", "");
}
 
Example 19
Source File: LodDistanceCalculatorFactory.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void write(JmeExporter ex) throws IOException {
OutputCapsule c = ex.getCapsule(this);
c.write(lodThreshold, "lodThreshold", null);
      c.write(lodThresholdSize, "lodThresholdSize", 2);
  }
 
Example 20
Source File: DirectionalLight.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void write(JmeExporter ex) throws IOException {
    super.write(ex);
    OutputCapsule oc = ex.getCapsule(this);
    oc.write(direction, "direction", null);
}