@Override protected SphereProbeArea clone() throws CloneNotSupportedException { return new SphereProbeArea(center, radius); }
public void setAreaType(AreaType type){ switch (type){ case Spherical: area = new SphereProbeArea(Vector3f.ZERO, 1.0f); break; case OrientedBox: area = new OrientedBoxProbeArea(new Transform()); area.setCenter(position); break; } }
@Override public void write(JmeExporter ex) throws IOException { super.write(ex); OutputCapsule oc = ex.getCapsule(this); oc.write(shCoeffs, "shCoeffs", null); oc.write(prefilteredEnvMap, "prefilteredEnvMap", null); oc.write(position, "position", null); oc.write(area, "area", new SphereProbeArea(Vector3f.ZERO, 1.0f)); oc.write(ready, "ready", false); oc.write(nbMipMaps, "nbMipMaps", 0); }
@Override public void read(JmeImporter im) throws IOException { super.read(im); InputCapsule ic = im.getCapsule(this); prefilteredEnvMap = (TextureCubeMap) ic.readSavable("prefilteredEnvMap", null); position = (Vector3f) ic.readSavable("position", null); area = (ProbeArea)ic.readSavable("area", null); if(area == null) { // retro compat BoundingSphere bounds = (BoundingSphere) ic.readSavable("bounds", new BoundingSphere(1.0f, Vector3f.ZERO)); area = new SphereProbeArea(bounds.getCenter(), bounds.getRadius()); } area.setCenter(position); nbMipMaps = ic.readInt("nbMipMaps", 0); ready = ic.readBoolean("ready", false); Savable[] coeffs = ic.readSavableArray("shCoeffs", null); if (coeffs == null) { ready = false; logger.log(Level.WARNING, "LightProbe is missing parameters, it should be recomputed. Please use lightProbeFactory.updateProbe()"); } else { shCoeffs = new Vector3f[coeffs.length]; for (int i = 0; i < coeffs.length; i++) { shCoeffs[i] = (Vector3f) coeffs[i]; } } }