Search in sources :

Example 6 with SafeArrayList

use of com.jme3.util.SafeArrayList in project jmonkeyengine by jMonkeyEngine.

the class Technique method makeCurrent.

/**
     * Called by the material to determine which shader to use for rendering.
     * 
     * The {@link TechniqueDefLogic} is used to determine the shader to use
     * based on the {@link LightMode}.
     * 
     * @param renderManager The render manager for which the shader is to be selected.
     * @param rendererCaps The renderer capabilities which the shader should support.
     * @return A compatible shader.
     */
Shader makeCurrent(RenderManager renderManager, SafeArrayList<MatParamOverride> worldOverrides, SafeArrayList<MatParamOverride> forcedOverrides, LightList lights, EnumSet<Caps> rendererCaps) {
    TechniqueDefLogic logic = def.getLogic();
    AssetManager assetManager = owner.getMaterialDef().getAssetManager();
    dynamicDefines.clear();
    dynamicDefines.setAll(paramDefines);
    if (worldOverrides != null) {
        applyOverrides(dynamicDefines, worldOverrides);
    }
    if (forcedOverrides != null) {
        applyOverrides(dynamicDefines, forcedOverrides);
    }
    return logic.makeCurrent(assetManager, renderManager, rendererCaps, lights, dynamicDefines);
}
Also used : AssetManager(com.jme3.asset.AssetManager) TechniqueDefLogic(com.jme3.material.logic.TechniqueDefLogic)

Example 7 with SafeArrayList

use of com.jme3.util.SafeArrayList in project jmonkeyengine by jMonkeyEngine.

the class Node method read.

@Override
public void read(JmeImporter e) throws IOException {
    // XXX: Load children before loading itself!!
    // This prevents empty children list if controls query
    // it in Control.setSpatial().
    children = new SafeArrayList(Spatial.class, e.getCapsule(this).readSavableArrayList("children", null));
    // go through children and set parent to this node
    if (children != null) {
        for (Spatial child : children.getArray()) {
            child.parent = this;
        }
    }
    super.read(e);
}
Also used : SafeArrayList(com.jme3.util.SafeArrayList)

Example 8 with SafeArrayList

use of com.jme3.util.SafeArrayList 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)

Example 9 with SafeArrayList

use of com.jme3.util.SafeArrayList in project jmonkeyengine by jMonkeyEngine.

the class AssetLinkNode method write.

@Override
public void write(JmeExporter e) throws IOException {
    SafeArrayList<Spatial> childs = children;
    children = new SafeArrayList<Spatial>(Spatial.class);
    super.write(e);
    OutputCapsule capsule = e.getCapsule(this);
    capsule.writeSavableArrayList(assetLoaderKeys, "assetLoaderKeyList", null);
    children = childs;
}
Also used : OutputCapsule(com.jme3.export.OutputCapsule)

Aggregations

MatParamOverride (com.jme3.material.MatParamOverride)2 Uniform (com.jme3.shader.Uniform)2 VarType (com.jme3.shader.VarType)2 SafeArrayList (com.jme3.util.SafeArrayList)2 AssetManager (com.jme3.asset.AssetManager)1 OutputCapsule (com.jme3.export.OutputCapsule)1 TechniqueDefLogic (com.jme3.material.logic.TechniqueDefLogic)1 SceneProcessor (com.jme3.post.SceneProcessor)1 Caps (com.jme3.renderer.Caps)1 Renderer (com.jme3.renderer.Renderer)1 Bucket (com.jme3.renderer.queue.RenderQueue.Bucket)1 ShadowMode (com.jme3.renderer.queue.RenderQueue.ShadowMode)1 Control (com.jme3.scene.control.Control)1 Shader (com.jme3.shader.Shader)1