Here are the examples of the java api com.jme3.export.JmeExporter taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
115 Examples
19
Source : GISLodControl.java
with Apache License 2.0
from twak
with Apache License 2.0
from twak
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(trisPerPixel, "trisPerPixel", 1f);
oc.write(distTolerance, "distTolerance", 1f);
oc.write(numLevels, "numLevels", 0);
oc.write(numTris, "numTris", null);
}
19
Source : QuadXZ.java
with BSD 3-Clause "New" or "Revised" License
from TehLeo
with BSD 3-Clause "New" or "Revised" License
from TehLeo
@Override
public void write(JmeExporter e) throws IOException {
super.write(e);
OutputCapsule capsule = e.getCapsule(this);
capsule.write(width, "width", 0);
capsule.write(height, "height", 0);
}
19
Source : PhysicsHoverControl.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(enabled, "enabled", true);
oc.write(spatial, "spatial", null);
}
19
Source : TextureCubeMap.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter e) throws IOException {
super.write(e);
OutputCapsule capsule = e.getCapsule(this);
capsule.write(wrapS, "wrapS", WrapMode.EdgeClamp);
capsule.write(wrapT, "wrapT", WrapMode.EdgeClamp);
capsule.write(wrapR, "wrapR", WrapMode.EdgeClamp);
}
19
Source : Texture2D.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter e) throws IOException {
super.write(e);
OutputCapsule capsule = e.getCapsule(this);
capsule.write(wrapS, "wrapS", WrapMode.EdgeClamp);
capsule.write(wrapT, "wrapT", WrapMode.EdgeClamp);
}
19
Source : TerrainGrid.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule c = ex.getCapsule(this);
c.write(gridTileLoader, "terrainQuadGrid", null);
c.write(size, "size", 0);
c.write(patchSize, "patchSize", 0);
c.write(stepScale, "stepScale", null);
c.write(offset, "offset", null);
c.write(offsetAmount, "offsetAmount", 0);
c.write(material, "material", null);
}
19
Source : NormalRecalcControl.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(terrain, "terrain", null);
}
19
Source : SimpleLodThreshold.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.write(size, "size", 16);
oc.write(lodMultiplier, "lodMultiplier", 2);
}
19
Source : PerspectiveLodCalculator.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
public void write(JmeExporter ex) throws IOException {
}
19
Source : LodDistanceCalculatorFactory.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
public void write(JmeExporter ex) throws IOException {
OutputCapsule c = ex.getCapsule(this);
c.write(lodThreshold, "lodThreshold", null);
c.write(lodThresholdSize, "lodThresholdSize", 2);
}
19
Source : DistanceLodCalculator.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.write(size, "patchSize", 32);
oc.write(lodMultiplier, "lodMultiplier", 32);
}
19
Source : ImageTileLoader.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
public void write(JmeExporter ex) throws IOException {
// TODO: serialization
}
19
Source : AssetTileLoader.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
public void write(JmeExporter ex) throws IOException {
OutputCapsule c = ex.getCapsule(this);
c.write(replacedetPath, "replacedetPath", null);
c.write(name, "name", null);
}
19
Source : SpotLightShadowRenderer.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = (OutputCapsule) ex.getCapsule(this);
oc.write(zFarOverride, "zFarOverride", 0);
oc.write(light, "light", null);
oc.write(fadeInfo, "fadeInfo", null);
oc.write(fadeLength, "fadeLength", 0f);
}
19
Source : SpotLightShadowFilter.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(shadowRenderer, "shadowRenderer", null);
}
19
Source : PssmShadowFilter.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
}
19
Source : PointLightShadowRenderer.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = (OutputCapsule) ex.getCapsule(this);
oc.write(light, "light", null);
}
19
Source : DirectionalLightShadowRenderer.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = (OutputCapsule) ex.getCapsule(this);
oc.write(lambda, "lambda", 0.65f);
oc.write(zFarOverride, "zFarOverride", 0);
oc.write(light, "light", null);
oc.write(fadeInfo, "fadeInfo", null);
oc.write(fadeLength, "fadeLength", 0f);
}
19
Source : VariableMapping.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
/**
* jme seralization (not used)
*
* @param ex the exporter
* @throws IOException
*/
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = (OutputCapsule) ex.getCapsule(this);
oc.write(leftVariable, "leftVariable", null);
oc.write(rightVariable, "rightVariable", null);
oc.write(condition, "condition", "");
oc.write(leftSwizzling, "leftSwizzling", "");
oc.write(rightSwizzling, "rightSwizzling", "");
}
19
Source : ShaderNodeVariable.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
/**
* jme seralization (not used)
*
* @param ex the exporter
* @throws IOException
*/
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = (OutputCapsule) ex.getCapsule(this);
oc.write(name, "name", "");
oc.write(type, "type", "");
oc.write(nameSpace, "nameSpace", "");
oc.write(condition, "condition", null);
oc.write(shaderOutput, "shaderOutput", false);
oc.write(multiplicity, "multiplicity", null);
}
19
Source : ShaderNodeDefinition.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
/**
* jme seralization (not used)
*
* @param ex the exporter
* @throws IOException
*/
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = (OutputCapsule) ex.getCapsule(this);
oc.write(name, "name", "");
String[] str = new String[shadersLanguage.size()];
oc.write(shadersLanguage.toArray(str), "shadersLanguage", null);
oc.write(shadersPath.toArray(str), "shadersPath", null);
oc.write(type, "type", null);
oc.writeSavableArrayList((ArrayList) inputs, "inputs", new ArrayList<ShaderNodeVariable>());
oc.writeSavableArrayList((ArrayList) outputs, "inputs", new ArrayList<ShaderNodeVariable>());
}
19
Source : ShaderNode.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
/**
* jme seralization
*
* @param ex the exporter
* @throws IOException
*/
@Override
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = (OutputCapsule) ex.getCapsule(this);
oc.write(name, "name", "");
oc.write(definition, "definition", null);
oc.write(condition, "condition", null);
oc.writeSavableArrayList((ArrayList) inputMapping, "inputMapping", new ArrayList<VariableMapping>());
oc.writeSavableArrayList((ArrayList) outputMapping, "outputMapping", new ArrayList<VariableMapping>());
}
19
Source : ShaderKey.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(fragName, "fragment_name", null);
oc.write(vertLanguage, "language", null);
oc.write(fragLanguage, "frag_language", null);
}
19
Source : PQTorus.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter e) throws IOException {
super.write(e);
OutputCapsule capsule = e.getCapsule(this);
capsule.write(p, "p", 0);
capsule.write(q, "q", 0);
capsule.write(radius, "radius", 0);
capsule.write(width, "width", 0);
capsule.write(steps, "steps", 0);
capsule.write(radialSamples, "radialSamples", 0);
}
19
Source : Line.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule out = ex.getCapsule(this);
out.write(start, "startVertex", null);
out.write(end, "endVertex", null);
}
19
Source : Cylinder.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter e) throws IOException {
super.write(e);
OutputCapsule capsule = e.getCapsule(this);
capsule.write(axisSamples, "axisSamples", 0);
capsule.write(radialSamples, "radialSamples", 0);
capsule.write(radius, "radius", 0);
capsule.write(radius2, "radius2", 0);
capsule.write(height, "height", 0);
capsule.write(closed, "closed", false);
capsule.write(inverted, "inverted", false);
}
19
Source : AbstractBox.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter e) throws IOException {
super.write(e);
OutputCapsule capsule = e.getCapsule(this);
capsule.write(xExtent, "xExtent", 0);
capsule.write(yExtent, "yExtent", 0);
capsule.write(zExtent, "zExtent", 0);
capsule.write(center, "center", Vector3f.ZERO);
}
19
Source : LightNode.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
ex.getCapsule(this).write(lightControl, "lightControl", null);
}
19
Source : LightControl.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(controlDir, CONTROL_DIR_NAME, ControlDirection.SpatialToLight);
oc.write(light, LIGHT_NAME, null);
}
19
Source : AbstractControl.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.write(enabled, "enabled", true);
oc.write(spatial, "spatial", null);
}
19
Source : CameraNode.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
ex.getCapsule(this).write(camControl, "camControl", null);
}
19
Source : AssetLinkNode.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter e) throws IOException {
SafeArrayList<Spatial> childs = children;
children = new SafeArrayList<Spatial>(Spatial.clreplaced);
super.write(e);
OutputCapsule capsule = e.getCapsule(this);
capsule.writeSavableArrayList(replacedetLoaderKeys, "replacedetLoaderKeyList", null);
children = childs;
}
19
Source : RadialBlurFilter.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(sampleDist, "sampleDist", 1.0f);
oc.write(sampleStrength, "sampleStrength", 2.2f);
}
19
Source : LightScatteringFilter.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(lightPosition, "lightPosition", Vector3f.ZERO);
oc.write(nbSamples, "nbSamples", 50);
oc.write(blurStart, "blurStart", 0.02f);
oc.write(blurWidth, "blurWidth", 0.9f);
oc.write(lightDensity, "lightDensity", 1.4f);
oc.write(adaptative, "adaptative", true);
}
19
Source : FogFilter.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(fogColor, "fogColor", ColorRGBA.White.clone());
oc.write(fogDensity, "fogDensity", 0.7f);
oc.write(fogDistance, "fogDistance", 1000);
}
19
Source : FadeFilter.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(duration, "duration", 1);
}
19
Source : DepthOfFieldFilter.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(blurScale, "blurScale", 1f);
oc.write(focusDistance, "focusDistance", 50f);
oc.write(focusRange, "focusRange", 10f);
}
19
Source : ColorOverlayFilter.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(color, "color", ColorRGBA.White);
}
19
Source : BloomFilter.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(glowMode, "glowMode", GlowMode.Scene);
oc.write(blurScale, "blurScale", 1.5f);
oc.write(exposurePower, "exposurePower", 5.0f);
oc.write(exposureCutOff, "exposureCutOff", 0.0f);
oc.write(bloomIntensity, "bloomIntensity", 2.0f);
oc.write(downSamplingFactor, "downSamplingFactor", 1);
}
19
Source : Triangle.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
public void write(JmeExporter e) throws IOException {
e.getCapsule(this).write(pointa, "pointa", Vector3f.ZERO);
e.getCapsule(this).write(pointb, "pointb", Vector3f.ZERO);
e.getCapsule(this).write(pointc, "pointc", Vector3f.ZERO);
}
19
Source : ShaderGenerationInfo.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.writeSavableArrayList((ArrayList) attributes, "attributes", new ArrayList<ShaderNodeVariable>());
oc.writeSavableArrayList((ArrayList) vertexUniforms, "vertexUniforms", new ArrayList<ShaderNodeVariable>());
oc.writeSavableArrayList((ArrayList) varyings, "varyings", new ArrayList<ShaderNodeVariable>());
oc.writeSavableArrayList((ArrayList) fragmentUniforms, "fragmentUniforms", new ArrayList<ShaderNodeVariable>());
oc.writeSavableArrayList((ArrayList) fragmentGlobals, "fragmentGlobals", new ArrayList<ShaderNodeVariable>());
oc.write(vertexGlobal, "vertexGlobal", null);
}
19
Source : MatParamTexture.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(unit, "texture_unit", -1);
// For backwards compat
oc.write(texture, "texture", null);
}
19
Source : PointLight.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(position, "position", null);
oc.write(radius, "radius", 0f);
}
19
Source : DirectionalLight.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(direction, "direction", null);
}
19
Source : ChaseCamera.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
/**
* Write the camera
* @param ex the exporter
* @throws IOException
*/
public void write(JmeExporter ex) throws IOException {
throw new UnsupportedOperationException("remove ChaseCamera before saving");
}
19
Source : DOMOutputCapsule.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
/**
* Part of the jME XML IO system as introduced in the google code jmexml project.
*
* @author Kai Rabien (hevee) - original author of the code.google.com jmexml project
* @author Doug Daniels (dougnukem) - adjustments for jME 2.0 and Java 1.5
*/
public clreplaced DOMOutputCapsule implements OutputCapsule {
private static final String dataAttributeName = "data";
private Doreplacedent doc;
private Element currentElement;
private JmeExporter exporter;
private Map<Savable, Element> writtenSavables = new IdenreplacedyHashMap<Savable, Element>();
public DOMOutputCapsule(Doreplacedent doc, JmeExporter exporter) {
this.doc = doc;
this.exporter = exporter;
currentElement = null;
}
public Doreplacedent getDoc() {
return doc;
}
/**
* appends a new Element with the given name to currentElement, sets
* currentElement to be new Element, and returns the new Element as well
*/
private Element appendElement(String name) {
Element ret = doc.createElement(name);
if (currentElement == null) {
ret.setAttribute("format_version", Integer.toString(FormatVersion.VERSION));
doc.appendChild(ret);
} else {
currentElement.appendChild(ret);
}
currentElement = ret;
return ret;
}
private static String encodeString(String s) {
if (s == null) {
return null;
}
s = s.replaceAll("\\&", "&").replaceAll("\\\"", """).replaceAll("\\<", "<");
return s;
}
public void write(byte value, String name, byte defVal) throws IOException {
if (value == defVal) {
return;
}
currentElement.setAttribute(name, String.valueOf(value));
}
public void write(byte[] value, String name, byte[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (byte b : value) {
buf.append(b);
buf.append(" ");
}
// remove last space
buf.setLength(buf.length() - 1);
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
public void write(byte[][] value, String name, byte[][] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (byte[] bs : value) {
for (byte b : bs) {
buf.append(b);
buf.append(" ");
}
buf.append(" ");
}
// remove last spaces
buf.setLength(buf.length() - 2);
Element el = appendElement(name);
el.setAttribute("size_outer", String.valueOf(value.length));
el.setAttribute("size_inner", String.valueOf(value[0].length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
public void write(int value, String name, int defVal) throws IOException {
if (value == defVal) {
return;
}
currentElement.setAttribute(name, String.valueOf(value));
}
public void write(int[] value, String name, int[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
return;
}
if (Arrays.equals(value, defVal)) {
return;
}
for (int b : value) {
buf.append(b);
buf.append(" ");
}
// remove last space
buf.setLength(Math.max(0, buf.length() - 1));
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
public void write(int[][] value, String name, int[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
for (int i = 0; i < value.length; i++) {
int[] array = value[i];
write(array, "array_" + i, defVal == null ? null : defVal[i]);
}
currentElement = (Element) el.getParentNode();
}
public void write(float value, String name, float defVal) throws IOException {
if (value == defVal) {
return;
}
currentElement.setAttribute(name, String.valueOf(value));
}
public void write(float[] value, String name, float[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
if (value != null) {
for (float b : value) {
buf.append(b);
buf.append(" ");
}
// remove last space
buf.setLength(buf.length() - 1);
}
Element el = appendElement(name);
el.setAttribute("size", value == null ? "0" : String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
public void write(float[][] value, String name, float[][] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
for (float[] bs : value) {
for (float b : bs) {
buf.append(b);
buf.append(" ");
}
}
// remove last space
buf.setLength(buf.length() - 1);
Element el = appendElement(name);
el.setAttribute("size_outer", String.valueOf(value.length));
el.setAttribute("size_inner", String.valueOf(value[0].length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
public void write(double value, String name, double defVal) throws IOException {
if (value == defVal) {
return;
}
currentElement.setAttribute(name, String.valueOf(value));
}
public void write(double[] value, String name, double[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (double b : value) {
buf.append(b);
buf.append(" ");
}
// remove last space
buf.setLength(buf.length() - 1);
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
public void write(double[][] value, String name, double[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
for (int i = 0; i < value.length; i++) {
double[] array = value[i];
write(array, "array_" + i, defVal == null ? null : defVal[i]);
}
currentElement = (Element) el.getParentNode();
}
public void write(long value, String name, long defVal) throws IOException {
if (value == defVal) {
return;
}
currentElement.setAttribute(name, String.valueOf(value));
}
public void write(long[] value, String name, long[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (long b : value) {
buf.append(b);
buf.append(" ");
}
// remove last space
buf.setLength(buf.length() - 1);
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
public void write(long[][] value, String name, long[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
for (int i = 0; i < value.length; i++) {
long[] array = value[i];
write(array, "array_" + i, defVal == null ? null : defVal[i]);
}
currentElement = (Element) el.getParentNode();
}
public void write(short value, String name, short defVal) throws IOException {
if (value == defVal) {
return;
}
currentElement.setAttribute(name, String.valueOf(value));
}
public void write(short[] value, String name, short[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (short b : value) {
buf.append(b);
buf.append(" ");
}
// remove last space
buf.setLength(buf.length() - 1);
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
public void write(short[][] value, String name, short[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
for (int i = 0; i < value.length; i++) {
short[] array = value[i];
write(array, "array_" + i, defVal == null ? null : defVal[i]);
}
currentElement = (Element) el.getParentNode();
}
public void write(boolean value, String name, boolean defVal) throws IOException {
if (value == defVal) {
return;
}
currentElement.setAttribute(name, String.valueOf(value));
}
public void write(boolean[] value, String name, boolean[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (boolean b : value) {
buf.append(b);
buf.append(" ");
}
// remove last space
buf.setLength(Math.max(0, buf.length() - 1));
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
public void write(boolean[][] value, String name, boolean[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
for (int i = 0; i < value.length; i++) {
boolean[] array = value[i];
write(array, "array_" + i, defVal == null ? null : defVal[i]);
}
currentElement = (Element) el.getParentNode();
}
public void write(String value, String name, String defVal) throws IOException {
if (value == null || value.equals(defVal)) {
return;
}
currentElement.setAttribute(name, encodeString(value));
}
public void write(String[] value, String name, String[] defVal) throws IOException {
Element el = appendElement(name);
if (value == null) {
value = defVal;
}
el.setAttribute("size", String.valueOf(value.length));
for (int i = 0; i < value.length; i++) {
String b = value[i];
appendElement("String_" + i);
String val = encodeString(b);
currentElement.setAttribute("value", val);
currentElement = el;
}
currentElement = (Element) currentElement.getParentNode();
}
public void write(String[][] value, String name, String[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
for (int i = 0; i < value.length; i++) {
String[] array = value[i];
write(array, "array_" + i, defVal == null ? null : defVal[i]);
}
currentElement = (Element) el.getParentNode();
}
public void write(BitSet value, String name, BitSet defVal) throws IOException {
if (value == null || value.equals(defVal)) {
return;
}
StringBuilder buf = new StringBuilder();
for (int i = value.nextSetBit(0); i >= 0; i = value.nextSetBit(i + 1)) {
buf.append(i);
buf.append(" ");
}
buf.setLength(Math.max(0, buf.length() - 1));
currentElement.setAttribute(name, buf.toString());
}
public void write(Savable object, String name, Savable defVal) throws IOException {
if (object == null) {
return;
}
if (object.equals(defVal)) {
return;
}
Element old = currentElement;
Element el = writtenSavables.get(object);
String clreplacedName = null;
if (!object.getClreplaced().getName().equals(name)) {
clreplacedName = object.getClreplaced().getName();
}
try {
doc.createElement(name);
} catch (DOMException e) {
// Ridiculous fallback behavior.
// Would be far better to throw than to totally disregard the
// specified "name" and write a clreplaced name instead!
// (Besides the fact we are clobbering the managed .getClreplacedTag()).
name = "Object";
clreplacedName = object.getClreplaced().getName();
}
if (el != null) {
String refID = el.getAttribute("reference_ID");
if (refID.length() == 0) {
refID = object.getClreplaced().getName() + "@" + object.hashCode();
el.setAttribute("reference_ID", refID);
}
el = appendElement(name);
el.setAttribute("ref", refID);
} else {
el = appendElement(name);
// jME3 NEW: Append version number(s)
int[] versions = SavableClreplacedUtil.getSavableVersions(object.getClreplaced());
StringBuilder sb = new StringBuilder();
for (int i = 0; i < versions.length; i++) {
sb.append(versions[i]);
if (i != versions.length - 1) {
sb.append(", ");
}
}
el.setAttribute("savable_versions", sb.toString());
writtenSavables.put(object, el);
object.write(exporter);
}
if (clreplacedName != null) {
el.setAttribute("clreplaced", clreplacedName);
}
currentElement = old;
}
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.getClreplaced().getName(), null);
}
}
currentElement = old;
}
public void write(Savable[][] value, String name, Savable[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
el.setAttribute("size_outer", String.valueOf(value.length));
el.setAttribute("size_inner", String.valueOf(value[0].length));
for (Savable[] bs : value) {
for (Savable b : bs) {
write(b, b.getClreplaced().getSimpleName(), null);
}
}
currentElement = (Element) currentElement.getParentNode();
}
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.getClreplaced().getName(), null);
} else {
throw new ClreplacedCastException("Not a Savable instance: " + o);
}
}
currentElement = old;
}
public void writeSavableArrayListArray(ArrayList[] objects, String name, ArrayList[] defVal) throws IOException {
if (objects == null) {
return;
}
if (Arrays.equals(objects, defVal)) {
return;
}
Element old = currentElement;
Element el = appendElement(name);
el.setAttribute(XMLExporter.ATTRIBUTE_SIZE, String.valueOf(objects.length));
for (int i = 0; i < objects.length; i++) {
ArrayList o = objects[i];
if (o == null) {
Element before = currentElement;
appendElement("null");
currentElement = before;
} else {
StringBuilder buf = new StringBuilder("SavableArrayList_");
buf.append(i);
writeSavableArrayList(o, buf.toString(), null);
}
}
currentElement = old;
}
public void writeSavableArrayListArray2D(ArrayList[][] value, String name, ArrayList[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
int size = value.length;
el.setAttribute(XMLExporter.ATTRIBUTE_SIZE, String.valueOf(size));
for (int i = 0; i < size; i++) {
ArrayList[] vi = value[i];
writeSavableArrayListArray(vi, "SavableArrayListArray_" + i, null);
}
currentElement = (Element) el.getParentNode();
}
public void writeFloatBufferArrayList(ArrayList<FloatBuffer> array, String name, ArrayList<FloatBuffer> defVal) throws IOException {
if (array == null) {
return;
}
if (array.equals(defVal)) {
return;
}
Element el = appendElement(name);
el.setAttribute(XMLExporter.ATTRIBUTE_SIZE, String.valueOf(array.size()));
for (FloatBuffer o : array) {
write(o, XMLExporter.ELEMENT_FLOATBUFFER, null);
}
currentElement = (Element) el.getParentNode();
}
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();
}
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();
}
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();
}
public void write(FloatBuffer value, String name, FloatBuffer defVal) throws IOException {
if (value == null) {
return;
}
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.limit()));
StringBuilder buf = new StringBuilder();
int pos = value.position();
value.rewind();
int ctr = 0;
while (value.hasRemaining()) {
ctr++;
buf.append(value.get());
buf.append(" ");
}
if (ctr != value.limit())
throw new IOException("'" + name + "' buffer contention resulted in write data consistency. " + ctr + " values written when should have written " + value.limit());
buf.setLength(Math.max(0, buf.length() - 1));
value.position(pos);
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) el.getParentNode();
}
public void write(IntBuffer value, String name, IntBuffer defVal) throws IOException {
if (value == null) {
return;
}
if (value.equals(defVal)) {
return;
}
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.limit()));
StringBuilder buf = new StringBuilder();
int pos = value.position();
value.rewind();
int ctr = 0;
while (value.hasRemaining()) {
ctr++;
buf.append(value.get());
buf.append(" ");
}
if (ctr != value.limit())
throw new IOException("'" + name + "' buffer contention resulted in write data consistency. " + ctr + " values written when should have written " + value.limit());
buf.setLength(buf.length() - 1);
value.position(pos);
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) el.getParentNode();
}
public void write(ByteBuffer value, String name, ByteBuffer defVal) throws IOException {
if (value == null)
return;
if (value.equals(defVal))
return;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.limit()));
StringBuilder buf = new StringBuilder();
int pos = value.position();
value.rewind();
int ctr = 0;
while (value.hasRemaining()) {
ctr++;
buf.append(value.get());
buf.append(" ");
}
if (ctr != value.limit())
throw new IOException("'" + name + "' buffer contention resulted in write data consistency. " + ctr + " values written when should have written " + value.limit());
buf.setLength(buf.length() - 1);
value.position(pos);
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) el.getParentNode();
}
public void write(ShortBuffer value, String name, ShortBuffer defVal) throws IOException {
if (value == null) {
return;
}
if (value.equals(defVal)) {
return;
}
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.limit()));
StringBuilder buf = new StringBuilder();
int pos = value.position();
value.rewind();
int ctr = 0;
while (value.hasRemaining()) {
ctr++;
buf.append(value.get());
buf.append(" ");
}
if (ctr != value.limit())
throw new IOException("'" + name + "' buffer contention resulted in write data consistency. " + ctr + " values written when should have written " + value.limit());
buf.setLength(buf.length() - 1);
value.position(pos);
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) el.getParentNode();
}
public void write(Enum value, String name, Enum defVal) throws IOException {
if (value == defVal) {
return;
}
currentElement.setAttribute(name, String.valueOf(value));
}
public void writeByteBufferArrayList(ArrayList<ByteBuffer> array, String name, ArrayList<ByteBuffer> defVal) throws IOException {
if (array == null) {
return;
}
if (array.equals(defVal)) {
return;
}
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(array.size()));
for (ByteBuffer o : array) {
write(o, "ByteBuffer", null);
}
currentElement = (Element) el.getParentNode();
}
}
19
Source : EmitterSphereShape.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.write(center, "center", null);
oc.write(radius, "radius", 0);
}
19
Source : EmitterPointShape.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.write(point, "point", null);
}
19
Source : EmitterBoxShape.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.write(min, "min", null);
oc.write(len, "length", null);
}
19
Source : RadialParticleInfluencer.java
with Apache License 2.0
from neuroph
with Apache License 2.0
from neuroph
@Override
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule oc = ex.getCapsule(this);
oc.write(radialVelocity, "radialVelocity", 0f);
oc.write(origin, "origin", new Vector3f());
oc.write(horizontal, "horizontal", false);
}
See More Examples