Search in sources :

Example 1 with CullHint

use of com.jme3.scene.Spatial.CullHint in project jmonkeyengine by jMonkeyEngine.

the class Spatial method write.

public void write(JmeExporter ex) throws IOException {
    OutputCapsule capsule = ex.getCapsule(this);
    capsule.write(name, "name", null);
    capsule.write(worldBound, "world_bound", null);
    capsule.write(cullHint, "cull_mode", CullHint.Inherit);
    capsule.write(batchHint, "batch_hint", BatchHint.Inherit);
    capsule.write(queueBucket, "queue", RenderQueue.Bucket.Inherit);
    capsule.write(shadowMode, "shadow_mode", ShadowMode.Inherit);
    capsule.write(localTransform, "transform", Transform.IDENTITY);
    capsule.write(localLights, "lights", null);
    capsule.writeSavableArrayList(new ArrayList(localOverrides), "overrides", null);
    // Shallow clone the controls array to convert its type.
    capsule.writeSavableArrayList(new ArrayList(controls), "controlsList", null);
    capsule.writeStringSavableMap(userData, "user_data", null);
}
Also used : SafeArrayList(com.jme3.util.SafeArrayList)

Example 2 with CullHint

use of com.jme3.scene.Spatial.CullHint in project jmonkeyengine by jMonkeyEngine.

the class Spatial method read.

public void read(JmeImporter im) throws IOException {
    InputCapsule ic = im.getCapsule(this);
    name = ic.readString("name", null);
    worldBound = (BoundingVolume) ic.readSavable("world_bound", null);
    cullHint = ic.readEnum("cull_mode", CullHint.class, CullHint.Inherit);
    batchHint = ic.readEnum("batch_hint", BatchHint.class, BatchHint.Inherit);
    queueBucket = ic.readEnum("queue", RenderQueue.Bucket.class, RenderQueue.Bucket.Inherit);
    shadowMode = ic.readEnum("shadow_mode", ShadowMode.class, ShadowMode.Inherit);
    localTransform = (Transform) ic.readSavable("transform", Transform.IDENTITY);
    localLights = (LightList) ic.readSavable("lights", null);
    localLights.setOwner(this);
    ArrayList<MatParamOverride> localOverridesList = ic.readSavableArrayList("overrides", null);
    if (localOverridesList == null) {
        localOverrides = new SafeArrayList<>(MatParamOverride.class);
    } else {
        localOverrides = new SafeArrayList(MatParamOverride.class, localOverridesList);
    }
    worldOverrides = new SafeArrayList<>(MatParamOverride.class);
    //changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split
    //the AnimControl creates the SkeletonControl for old files and add it to the spatial.
    //The SkeletonControl must be the last in the stack so we add the list of all other control before it.
    //When backward compatibility won't be needed anymore this can be replaced by :
    //controls = ic.readSavableArrayList("controlsList", null));
    controls.addAll(0, ic.readSavableArrayList("controlsList", null));
    userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null);
}
Also used : Bucket(com.jme3.renderer.queue.RenderQueue.Bucket) SafeArrayList(com.jme3.util.SafeArrayList) ShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode) MatParamOverride(com.jme3.material.MatParamOverride)

Aggregations

SafeArrayList (com.jme3.util.SafeArrayList)2 MatParamOverride (com.jme3.material.MatParamOverride)1 Bucket (com.jme3.renderer.queue.RenderQueue.Bucket)1 ShadowMode (com.jme3.renderer.queue.RenderQueue.ShadowMode)1