本文整理汇总了Java中com.jme3.export.Savable类的典型用法代码示例。如果您正苦于以下问题:Java Savable类的具体用法?Java Savable怎么用?Java Savable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Savable类属于com.jme3.export包,在下文中一共展示了Savable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import com.jme3.export.Savable; //导入依赖的package包/类
public void read(JmeImporter im) throws IOException {
InputCapsule input = im.getCapsule(this);
Savable[] boneRootsAsSav = input.readSavableArray("rootBones", null);
rootBones = new Bone[boneRootsAsSav.length];
System.arraycopy(boneRootsAsSav, 0, rootBones, 0, boneRootsAsSav.length);
Savable[] boneListAsSavable = input.readSavableArray("boneList", null);
boneList = new Bone[boneListAsSavable.length];
System.arraycopy(boneListAsSavable, 0, boneList, 0, boneListAsSavable.length);
createSkinningMatrices();
for (Bone rootBone : rootBones) {
rootBone.update();
rootBone.setBindingPose();
}
}
示例2: read
import com.jme3.export.Savable; //导入依赖的package包/类
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);
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);
//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);
}
示例3: read
import com.jme3.export.Savable; //导入依赖的package包/类
public void read(JmeImporter im) throws IOException {
InputCapsule in = im.getCapsule(this);
meshBound = (BoundingVolume) in.readSavable("modelBound", null);
vertCount = in.readInt("vertCount", -1);
elementCount = in.readInt("elementCount", -1);
maxNumWeights = in.readInt("max_num_weights", -1);
mode = in.readEnum("mode", Mode.class, Mode.Triangles);
elementLengths = in.readIntArray("elementLengths", null);
modeStart = in.readIntArray("modeStart", null);
collisionTree = (BIHTree) in.readSavable("collisionTree", null);
elementLengths = in.readIntArray("elementLengths", null);
modeStart = in.readIntArray("modeStart", null);
pointSize = in.readFloat("pointSize", 1f);
// in.readStringSavableMap("buffers", null);
buffers = (IntMap<VertexBuffer>) in.readIntSavableMap("buffers", null);
for (Entry<VertexBuffer> entry : buffers){
buffersList.add(entry.getValue());
}
Savable[] lodLevelsSavable = in.readSavableArray("lodLevels", null);
if (lodLevelsSavable != null) {
lodLevels = new VertexBuffer[lodLevelsSavable.length];
System.arraycopy( lodLevelsSavable, 0, lodLevels, 0, lodLevels.length);
}
}
示例4: write
import com.jme3.export.Savable; //导入依赖的package包/类
public void write(Savable[] objects, String name, Savable[] defVal) throws IOException {
if (objects == null) {
return;
}
if (Arrays.equals(objects, defVal)) {
return;
}
Element old = currentElement;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(objects.length));
for (int i = 0; i < objects.length; i++) {
Savable o = objects[i];
if(o == null){
//renderStateList has special loading code, so we can leave out the null values
if(!name.equals("renderStateList")){
Element before = currentElement;
appendElement("null");
currentElement = before;
}
}else{
write(o, o.getClass().getName(), null);
}
}
currentElement = old;
}
示例5: writeSavableArrayList
import com.jme3.export.Savable; //导入依赖的package包/类
public void writeSavableArrayList(ArrayList array, String name, ArrayList defVal) throws IOException {
if (array == null) {
return;
}
if (array.equals(defVal)) {
return;
}
Element old = currentElement;
Element el = appendElement(name);
currentElement = el;
el.setAttribute(XMLExporter.ATTRIBUTE_SIZE, String.valueOf(array.size()));
for (Object o : array) {
if(o == null) {
continue;
}
else if (o instanceof Savable) {
Savable s = (Savable) o;
write(s, s.getClass().getName(), null);
} else {
throw new ClassCastException("Not a Savable instance: " + o);
}
}
currentElement = old;
}
示例6: writeSavableMap
import com.jme3.export.Savable; //导入依赖的package包/类
public void writeSavableMap(Map<? extends Savable, ? extends Savable> map, String name, Map<? extends Savable, ? extends Savable> defVal) throws IOException {
if (map == null) {
return;
}
if (map.equals(defVal)) {
return;
}
Element stringMap = appendElement(name);
Iterator<? extends Savable> keyIterator = map.keySet().iterator();
while(keyIterator.hasNext()) {
Savable key = keyIterator.next();
Element mapEntry = appendElement(XMLExporter.ELEMENT_MAPENTRY);
write(key, XMLExporter.ELEMENT_KEY, null);
Savable value = map.get(key);
write(value, XMLExporter.ELEMENT_VALUE, null);
currentElement = stringMap;
}
currentElement = (Element) stringMap.getParentNode();
}
示例7: writeStringSavableMap
import com.jme3.export.Savable; //导入依赖的package包/类
public void writeStringSavableMap(Map<String, ? extends Savable> map, String name, Map<String, ? extends Savable> defVal) throws IOException {
if (map == null) {
return;
}
if (map.equals(defVal)) {
return;
}
Element stringMap = appendElement(name);
Iterator<String> keyIterator = map.keySet().iterator();
while(keyIterator.hasNext()) {
String key = keyIterator.next();
Element mapEntry = appendElement("MapEntry");
mapEntry.setAttribute("key", key);
Savable s = map.get(key);
write(s, "Savable", null);
currentElement = stringMap;
}
currentElement = (Element) stringMap.getParentNode();
}
示例8: writeIntSavableMap
import com.jme3.export.Savable; //导入依赖的package包/类
public void writeIntSavableMap(IntMap<? extends Savable> map, String name, IntMap<? extends Savable> defVal) throws IOException {
if (map == null) {
return;
}
if (map.equals(defVal)) {
return;
}
Element stringMap = appendElement(name);
for(Entry<? extends Savable> entry : map) {
int key = entry.getKey();
Element mapEntry = appendElement("MapEntry");
mapEntry.setAttribute("key", Integer.toString(key));
Savable s = entry.getValue();
write(s, "Savable", null);
currentElement = stringMap;
}
currentElement = (Element) stringMap.getParentNode();
}
示例9: readSavableMap
import com.jme3.export.Savable; //导入依赖的package包/类
public Map<? extends Savable, ? extends Savable> readSavableMap(String name, Map<? extends Savable, ? extends Savable> defVal) throws IOException {
Map<Savable, Savable> ret;
Element tempEl;
if (name != null) {
tempEl = findChildElement(currentElem, name);
} else {
tempEl = currentElem;
}
ret = new HashMap<Savable, Savable>();
NodeList nodes = tempEl.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node n = nodes.item(i);
if (n instanceof Element && n.getNodeName().equals("MapEntry")) {
Element elem = (Element) n;
currentElem = elem;
Savable key = readSavable(XMLExporter.ELEMENT_KEY, null);
Savable val = readSavable(XMLExporter.ELEMENT_VALUE, null);
ret.put(key, val);
}
}
currentElem = (Element) tempEl.getParentNode();
return ret;
}
示例10: readSavableArray2D
import com.jme3.export.Savable; //导入依赖的package包/类
public Savable[][] readSavableArray2D(String name, Savable[][] defVal)
throws IOException {
BinaryClassField field = cObj.nameFields.get(name);
if (field == null ||!fieldData.containsKey(field.alias))
return defVal;
Object[][] values = (Object[][]) fieldData.get(field.alias);
if (values instanceof ID[][]) {
Savable[][] savables = new Savable[values.length][];
for (int i = 0; i < values.length; i++) {
if (values[i] != null) {
savables[i] = resolveIDs(values[i]);
} else savables[i] = null;
}
values = savables;
fieldData.put(field.alias, values);
}
return (Savable[][]) values;
}
示例11: readSavableArray3D
import com.jme3.export.Savable; //导入依赖的package包/类
public Savable[][][] readSavableArray3D(String name, Savable[][][] defVal)
throws IOException {
BinaryClassField field = cObj.nameFields.get(name);
if (field == null || !fieldData.containsKey(field.alias))
return defVal;
Object[][][] values = (Object[][][]) fieldData.get(field.alias);
if (values instanceof ID[][][]) {
Savable[][][] savables = new Savable[values.length][][];
for (int i = 0; i < values.length; i++) {
if (values[i] != null) {
savables[i] = new Savable[values[i].length][];
for (int j = 0; j < values[i].length; j++) {
savables[i][j] = resolveIDs(values[i][j]);
}
} else savables[i] = null;
}
fieldData.put(field.alias, savables);
return savables;
} else
return defVal;
}
示例12: readSavableArrayListArray
import com.jme3.export.Savable; //导入依赖的package包/类
public ArrayList[] readSavableArrayListArray(String name, ArrayList[] defVal)
throws IOException {
BinaryClassField field = cObj.nameFields.get(name);
if (field == null || !fieldData.containsKey(field.alias))
return defVal;
Object value = fieldData.get(field.alias);
if (value instanceof ID[][]) {
// read 2D Savable array and convert to ArrayList array
Savable[][] savables = readSavableArray2D(name, null);
if (savables != null) {
ArrayList[] arrayLists = new ArrayList[savables.length];
for (int i = 0; i < savables.length; i++) {
arrayLists[i] = savableArrayListFromArray(savables[i]);
}
value = arrayLists;
} else
value = defVal;
fieldData.put(field.alias, value);
}
return (ArrayList[]) value;
}
示例13: readSavableArrayListArray2D
import com.jme3.export.Savable; //导入依赖的package包/类
public ArrayList[][] readSavableArrayListArray2D(String name,
ArrayList[][] defVal) throws IOException {
BinaryClassField field = cObj.nameFields.get(name);
if (field == null || !fieldData.containsKey(field.alias))
return defVal;
Object value = fieldData.get(field.alias);
if (value instanceof ID[][][]) {
// read 3D Savable array and convert to 2D ArrayList array
Savable[][][] savables = readSavableArray3D(name, null);
if (savables != null && savables.length > 0) {
ArrayList[][] arrayLists = new ArrayList[savables.length][];
for (int i = 0; i < savables.length; i++) {
arrayLists[i] = new ArrayList[savables[i].length];
for (int j = 0; j < savables[i].length; j++) {
arrayLists[i][j] = savableArrayListFromArray(savables[i][j]);
}
}
value = arrayLists;
} else
value = defVal;
fieldData.put(field.alias, value);
}
return (ArrayList[][]) value;
}
示例14: readStringSavableMap
import com.jme3.export.Savable; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Map<String, ? extends Savable> readStringSavableMap(String name, Map<String, ? extends Savable> defVal)
throws IOException {
BinaryClassField field = cObj.nameFields.get(name);
if (field == null || !fieldData.containsKey(field.alias))
return defVal;
Object value = fieldData.get(field.alias);
if (value instanceof StringIDMap) {
// read Savable array and convert to Map values
StringIDMap in = (StringIDMap) value;
Savable[] values = resolveIDs(in.values);
value = stringSavableMapFromKV(in.keys, values);
fieldData.put(field.alias, value);
}
return (Map<String, Savable>) value;
}
示例15: readIntSavableMap
import com.jme3.export.Savable; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public IntMap<? extends Savable> readIntSavableMap(String name, IntMap<? extends Savable> defVal)
throws IOException {
BinaryClassField field = cObj.nameFields.get(name);
if (field == null || !fieldData.containsKey(field.alias))
return defVal;
Object value = fieldData.get(field.alias);
if (value instanceof IntIDMap) {
// read Savable array and convert to Map values
IntIDMap in = (IntIDMap) value;
Savable[] values = resolveIDs(in.values);
value = intSavableMapFromKV(in.keys, values);
fieldData.put(field.alias, value);
}
return (IntMap<Savable>) value;
}