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);
}
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);
}
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);
}
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;
}
Aggregations