|
31 | 31 | */ |
32 | 32 | package com.jme3.post.filters; |
33 | 33 |
|
| 34 | +import java.io.IOException; |
| 35 | + |
34 | 36 | import com.jme3.asset.AssetManager; |
| 37 | +import com.jme3.export.InputCapsule; |
| 38 | +import com.jme3.export.JmeExporter; |
| 39 | +import com.jme3.export.JmeImporter; |
| 40 | +import com.jme3.export.OutputCapsule; |
35 | 41 | import com.jme3.material.Material; |
36 | 42 | import com.jme3.math.ColorRGBA; |
37 | 43 | import com.jme3.post.Filter; |
38 | | -import com.jme3.post.Filter.Pass; |
39 | 44 | import com.jme3.renderer.RenderManager; |
40 | 45 | import com.jme3.renderer.Renderer; |
41 | 46 | import com.jme3.renderer.ViewPort; |
@@ -109,8 +114,6 @@ protected void initFilter(AssetManager manager, RenderManager renderManager, Vie |
109 | 114 | protected void cleanUpFilter(Renderer r) { |
110 | 115 | normalPass.cleanup(r); |
111 | 116 | } |
112 | | - |
113 | | - |
114 | 117 |
|
115 | 118 | /** |
116 | 119 | * Return the depth sensitivity<br> |
@@ -196,7 +199,6 @@ public void setEdgeWidth(float edgeWidth) { |
196 | 199 | if (material != null) { |
197 | 200 | material.setFloat("EdgeWidth", edgeWidth); |
198 | 201 | } |
199 | | - |
200 | 202 | } |
201 | 203 |
|
202 | 204 | /** |
@@ -261,4 +263,30 @@ public void setEdgeColor(ColorRGBA edgeColor) { |
261 | 263 | material.setColor("EdgeColor", edgeColor); |
262 | 264 | } |
263 | 265 | } |
| 266 | + |
| 267 | + @Override |
| 268 | + public void write(JmeExporter ex) throws IOException { |
| 269 | + super.write(ex); |
| 270 | + OutputCapsule oc = ex.getCapsule(this); |
| 271 | + oc.write(edgeWidth, "edgeWidth", 1.0f); |
| 272 | + oc.write(edgeIntensity, "edgeIntensity", 1.0f); |
| 273 | + oc.write(normalThreshold, "normalThreshold", 0.5f); |
| 274 | + oc.write(depthThreshold, "depthThreshold", 0.1f); |
| 275 | + oc.write(normalSensitivity, "normalSensitivity", 1.0f); |
| 276 | + oc.write(depthSensitivity, "depthSensitivity", 10.0f); |
| 277 | + oc.write(edgeColor, "edgeColor", ColorRGBA.Black); |
| 278 | + } |
| 279 | + |
| 280 | + @Override |
| 281 | + public void read(JmeImporter im) throws IOException { |
| 282 | + super.read(im); |
| 283 | + InputCapsule ic = im.getCapsule(this); |
| 284 | + edgeWidth = ic.readFloat("edgeWidth", 1.0f); |
| 285 | + edgeIntensity = ic.readFloat("edgeIntensity", 1.0f); |
| 286 | + normalThreshold = ic.readFloat("normalThreshold", 0.5f); |
| 287 | + depthThreshold = ic.readFloat("depthThreshold", 0.1f); |
| 288 | + normalSensitivity = ic.readFloat("normalSensitivity", 1.0f); |
| 289 | + depthSensitivity = ic.readFloat("depthSensitivity", 10.0f); |
| 290 | + edgeColor = (ColorRGBA) ic.readSavable("edgeColor", ColorRGBA.Black.clone()); |
| 291 | + } |
264 | 292 | } |
0 commit comments