Java Code Examples for com.jme3.export.InputCapsule#readFloatArray()

The following examples show how to use com.jme3.export.InputCapsule#readFloatArray() . 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: TerrainPatch.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);
    size = ic.readInt("size", 16);
    totalSize = ic.readInt("totalSize", 16);
    quadrant = ic.readShort("quadrant", (short)0);
    stepScale = (Vector3f) ic.readSavable("stepScale", Vector3f.UNIT_XYZ);
    offset = (Vector2f) ic.readSavable("offset", Vector3f.UNIT_XYZ);
    offsetAmount = ic.readFloat("offsetAmount", 0);
    //lodCalculator = (LodCalculator) ic.readSavable("lodCalculator", new DistanceLodCalculator());
    //lodCalculator.setTerrainPatch(this);
    //lodCalculatorFactory = (LodCalculatorFactory) ic.readSavable("lodCalculatorFactory", null);
    lodEntropy = ic.readFloatArray("lodEntropy", null);
    geomap = (LODGeomap) ic.readSavable("geomap", null);

    Mesh regen = geomap.createMesh(stepScale, new Vector2f(1,1), offset, offsetAmount, totalSize, false);
    setMesh(regen);
    //TangentBinormalGenerator.generate(this); // note that this will be removed
    ensurePositiveVolumeBBox();
}
 
Example 2
Source File: HullCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
     * De-serialize this shape, for example when loading from a J3O file.
     *
     * @param im importer (not null)
     * @throws IOException from importer
     */
    @Override
    public void read(JmeImporter im) throws IOException {
        super.read(im);
        InputCapsule capsule = im.getCapsule(this);

        // for backwards compatability
        Mesh mesh = (Mesh) capsule.readSavable("hullMesh", null);
        if (mesh != null) {
            this.points = getPoints(mesh);
        } else {
            this.points = capsule.readFloatArray("points", null);

        }
//        fbuf = ByteBuffer.allocateDirect(points.length * 4).asFloatBuffer();
//        fbuf.put(points);
//        fbuf = FloatBuffer.wrap(points).order(ByteOrder.nativeOrder()).asFloatBuffer();
        createShape();
    }
 
Example 3
Source File: DacConfiguration.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * De-serialize this control, for example when loading from a J3O file.
 *
 * @param im importer (not null)
 * @throws IOException from importer
 */
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);

    damping = ic.readFloat("damping", 0.6f);
    eventDispatchImpulseThreshold
            = ic.readFloat("eventDispatchImpulseThreshold", 0f);

    jointMap.clear();
    blConfigMap.clear();
    String[] linkedBoneNames = ic.readStringArray("linkedBoneNames", null);
    Savable[] linkedBoneJoints
            = ic.readSavableArray("linkedBoneJoints", null);
    float[] blConfigs = ic.readFloatArray("blConfigs", null);
    for (int i = 0; i < linkedBoneNames.length; ++i) {
        String boneName = linkedBoneNames[i];
        RangeOfMotion rom = (RangeOfMotion) linkedBoneJoints[i];
        jointMap.put(boneName, rom);
        blConfigMap.put(boneName, blConfigs[i]);
    }

    torsoMass = ic.readFloat("torsoMass", 1f);
    gravityVector = (Vector3f) ic.readSavable("gravity", null);
}
 
Example 4
Source File: TerrainPatch.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule ic = im.getCapsule(this);
    size = ic.readInt("size", 16);
    totalSize = ic.readInt("totalSize", 16);
    quadrant = ic.readShort("quadrant", (short)0);
    stepScale = (Vector3f) ic.readSavable("stepScale", Vector3f.UNIT_XYZ);
    offset = (Vector2f) ic.readSavable("offset", Vector3f.UNIT_XYZ);
    offsetAmount = ic.readFloat("offsetAmount", 0);
    //lodCalculator = (LodCalculator) ic.readSavable("lodCalculator", new DistanceLodCalculator());
    //lodCalculator.setTerrainPatch(this);
    //lodCalculatorFactory = (LodCalculatorFactory) ic.readSavable("lodCalculatorFactory", null);
    lodEntropy = ic.readFloatArray("lodEntropy", null);
    geomap = (LODGeomap) ic.readSavable("geomap", null);
    
    Mesh regen = geomap.createMesh(stepScale, new Vector2f(1,1), offset, offsetAmount, totalSize, false);
    setMesh(regen);
    //TangentBinormalGenerator.generate(this); // note that this will be removed
    ensurePositiveVolumeBBox();
}
 
Example 5
Source File: HullCollisionShape.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
    public void read(JmeImporter im) throws IOException {
        super.read(im);
        InputCapsule capsule = im.getCapsule(this);

        // for backwards compatability
        Mesh mesh = (Mesh) capsule.readSavable("hullMesh", null);
        if (mesh != null) {
            this.points = getPoints(mesh);
        } else {
            this.points = capsule.readFloatArray("points", null);

        }
//        fbuf = ByteBuffer.allocateDirect(points.length * 4).asFloatBuffer();
//        fbuf.put(points);
//        fbuf = FloatBuffer.wrap(points).order(ByteOrder.nativeOrder()).asFloatBuffer();
        createShape();
    }
 
Example 6
Source File: HeightfieldCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * De-serialize this shape, for example when loading from a J3O file.
 *
 * @param im importer (not null)
 * @throws IOException from importer
 */
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule capsule = im.getCapsule(this);
    heightStickWidth = capsule.readInt("heightStickWidth", 0);
    heightStickLength = capsule.readInt("heightStickLength", 0);
    heightScale = capsule.readFloat("heightScale", 0);
    minHeight = capsule.readFloat("minHeight", 0);
    maxHeight = capsule.readFloat("maxHeight", 0);
    upAxis = capsule.readInt("upAxis", 1);
    heightfieldData = capsule.readFloatArray("heightfieldData", new float[0]);
    flipQuadEdges = capsule.readBoolean("flipQuadEdges", false);
    createShape();
}
 
Example 7
Source File: HullCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule capsule = im.getCapsule(this);

    // for backwards compatability
    Mesh mesh = (Mesh) capsule.readSavable("hullMesh", null);
    if (mesh != null) {
        this.points = getPoints(mesh);
    } else {
        this.points = capsule.readFloatArray("points", null);

    }
    createShape(this.points);
}
 
Example 8
Source File: HeightfieldCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule capsule = im.getCapsule(this);
    heightStickWidth = capsule.readInt("heightStickWidth", 0);
    heightStickLength = capsule.readInt("heightStickLength", 0);
    heightScale = capsule.readFloat("heightScale", 0);
    minHeight = capsule.readFloat("minHeight", 0);
    maxHeight = capsule.readFloat("maxHeight", 0);
    upAxis = capsule.readInt("upAxis", 1);
    heightfieldData = capsule.readFloatArray("heightfieldData", new float[0]);
    flipQuadEdges = capsule.readBoolean("flipQuadEdges", false);
    createShape();
}
 
Example 9
Source File: BIHTree.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);
    mesh = (Mesh) ic.readSavable("mesh", null);
    root = (BIHNode) ic.readSavable("root", null);
    maxTrisPerNode = ic.readInt("tris_per_node", 0);
    pointData = ic.readFloatArray("points", null);
    triIndices = ic.readIntArray("indices", null);
}
 
Example 10
Source File: HeightfieldCollisionShape.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule capsule = im.getCapsule(this);
    heightStickWidth = capsule.readInt("heightStickWidth", 0);
    heightStickLength = capsule.readInt("heightStickLength", 0);
    heightScale = capsule.readFloat("heightScale", 0);
    minHeight = capsule.readFloat("minHeight", 0);
    maxHeight = capsule.readFloat("maxHeight", 0);
    upAxis = capsule.readInt("upAxis", 1);
    heightfieldData = capsule.readFloatArray("heightfieldData", new float[0]);
    flipQuadEdges = capsule.readBoolean("flipQuadEdges", false);
    createShape();
}
 
Example 11
Source File: HullCollisionShape.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule capsule = im.getCapsule(this);

    // for backwards compatability
    Mesh mesh = (Mesh) capsule.readSavable("hullMesh", null);
    if (mesh != null) {
        this.points = getPoints(mesh);
    } else {
        this.points = capsule.readFloatArray("points", null);

    }
    createShape(this.points);
}
 
Example 12
Source File: HeightfieldCollisionShape.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule capsule = im.getCapsule(this);
    heightStickWidth = capsule.readInt("heightStickWidth", 0);
    heightStickLength = capsule.readInt("heightStickLength", 0);
    heightScale = capsule.readFloat("heightScale", 0);
    minHeight = capsule.readFloat("minHeight", 0);
    maxHeight = capsule.readFloat("maxHeight", 0);
    upAxis = capsule.readInt("upAxis", 1);
    heightfieldData = capsule.readFloatArray("heightfieldData", new float[0]);
    flipQuadEdges = capsule.readBoolean("flipQuadEdges", false);
    createShape();
}
 
Example 13
Source File: BIHTree.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);
    mesh = (Mesh) ic.readSavable("mesh", null);
    root = (BIHNode) ic.readSavable("root", null);
    maxTrisPerNode = ic.readInt("tris_per_node", 0);
    pointData = ic.readFloatArray("points", null);
    triIndices = ic.readIntArray("indices", null);
}
 
Example 14
Source File: SpatialTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);
    translations = (CompactVector3Array) ic.readSavable("translations", null);
    rotations = (CompactQuaternionArray) ic.readSavable("rotations", null);
    times = ic.readFloatArray("times", null);
    scales = (CompactVector3Array) ic.readSavable("scales", null);
}