Removing @Override annotations from methods that implements interfaces (this will make the code Java 5 compatible).

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9331 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 13 years ago
parent 22edb7beb0
commit c4bf1b59a0
  1. 1
      engine/src/blender/com/jme3/scene/plugins/blender/BlenderLoader.java
  2. 4
      engine/src/blender/com/jme3/scene/plugins/blender/constraints/BlenderTrack.java
  3. 8
      engine/src/blender/com/jme3/scene/plugins/blender/materials/MaterialHelper.java
  4. 1
      engine/src/blender/com/jme3/scene/plugins/blender/textures/GeneratedTexture.java
  5. 2
      engine/src/blender/com/jme3/scene/plugins/blender/textures/TriangulatedTexture.java
  6. 1
      engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/AbstractTextureBlender.java
  7. 1
      engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderAWT.java
  8. 2
      engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderFactory.java
  9. 1
      engine/src/blender/com/jme3/scene/plugins/blender/textures/blending/TextureBlenderLuminance.java
  10. 32
      engine/src/blender/com/jme3/scene/plugins/blender/textures/generating/NoiseGenerator.java
  11. 7
      engine/src/blender/com/jme3/scene/plugins/blender/textures/generating/TextureGeneratorBlend.java
  12. 10
      engine/src/blender/com/jme3/scene/plugins/blender/textures/generating/TextureGeneratorMagic.java
  13. 3
      engine/src/blender/com/jme3/scene/plugins/blender/textures/generating/TextureGeneratorWood.java
  14. 4
      engine/src/blender/com/jme3/scene/plugins/blender/textures/io/AWTPixelInputOutput.java
  15. 4
      engine/src/blender/com/jme3/scene/plugins/blender/textures/io/DDSPixelInputOutput.java
  16. 4
      engine/src/blender/com/jme3/scene/plugins/blender/textures/io/LuminancePixelInputOutput.java

@ -74,7 +74,6 @@ public class BlenderLoader extends AbstractBlenderLoader {
/** The blocks read from the file. */ /** The blocks read from the file. */
protected List<FileBlockHeader> blocks; protected List<FileBlockHeader> blocks;
@Override
public Spatial load(AssetInfo assetInfo) throws IOException { public Spatial load(AssetInfo assetInfo) throws IOException {
try { try {
this.setup(assetInfo); this.setup(assetInfo);

@ -113,15 +113,12 @@ import com.jme3.util.TempVars;
} }
} }
@Override
public void write(JmeExporter ex) throws IOException { public void write(JmeExporter ex) throws IOException {
} }
@Override
public void read(JmeImporter im) throws IOException { public void read(JmeImporter im) throws IOException {
} }
@Override
public void setTime(float time, float weight, AnimControl control, public void setTime(float time, float weight, AnimControl control,
AnimChannel channel, TempVars vars) { AnimChannel channel, TempVars vars) {
if (boneTrack != null) { if (boneTrack != null) {
@ -131,7 +128,6 @@ import com.jme3.util.TempVars;
} }
} }
@Override
public float getLength() { public float getLength() {
return spatialTrack == null ? boneTrack.getLength() : spatialTrack return spatialTrack == null ? boneTrack.getLength() : spatialTrack
.getLength(); .getLength();

@ -101,10 +101,8 @@ public class MaterialHelper extends AbstractBlenderHelper {
super(blenderVersion, false); super(blenderVersion, false);
// setting alpha masks // setting alpha masks
alphaMasks.put(ALPHA_MASK_NONE, new IAlphaMask() { alphaMasks.put(ALPHA_MASK_NONE, new IAlphaMask() {
@Override
public void setImageSize(int width, int height) {} public void setImageSize(int width, int height) {}
@Override
public byte getAlpha(float x, float y) { public byte getAlpha(float x, float y) {
return (byte) 255; return (byte) 255;
} }
@ -113,13 +111,11 @@ public class MaterialHelper extends AbstractBlenderHelper {
private float r; private float r;
private float[] center; private float[] center;
@Override
public void setImageSize(int width, int height) { public void setImageSize(int width, int height) {
r = Math.min(width, height) * 0.5f; r = Math.min(width, height) * 0.5f;
center = new float[] { width * 0.5f, height * 0.5f }; center = new float[] { width * 0.5f, height * 0.5f };
} }
@Override
public byte getAlpha(float x, float y) { public byte getAlpha(float x, float y) {
float d = FastMath.abs(FastMath.sqrt((x - center[0]) * (x - center[0]) + (y - center[1]) * (y - center[1]))); float d = FastMath.abs(FastMath.sqrt((x - center[0]) * (x - center[0]) + (y - center[1]) * (y - center[1])));
return (byte) (d >= r ? 0 : 255); return (byte) (d >= r ? 0 : 255);
@ -129,13 +125,11 @@ public class MaterialHelper extends AbstractBlenderHelper {
private float r; private float r;
private float[] center; private float[] center;
@Override
public void setImageSize(int width, int height) { public void setImageSize(int width, int height) {
r = Math.min(width, height) * 0.5f; r = Math.min(width, height) * 0.5f;
center = new float[] { width * 0.5f, height * 0.5f }; center = new float[] { width * 0.5f, height * 0.5f };
} }
@Override
public byte getAlpha(float x, float y) { public byte getAlpha(float x, float y) {
float d = FastMath.abs(FastMath.sqrt((x - center[0]) * (x - center[0]) + (y - center[1]) * (y - center[1]))); float d = FastMath.abs(FastMath.sqrt((x - center[0]) * (x - center[0]) + (y - center[1]) * (y - center[1])));
return (byte) (d >= r ? 0 : -255.0f * d / r + 255.0f); return (byte) (d >= r ? 0 : -255.0f * d / r + 255.0f);
@ -145,13 +139,11 @@ public class MaterialHelper extends AbstractBlenderHelper {
private float r; private float r;
private float[] center; private float[] center;
@Override
public void setImageSize(int width, int height) { public void setImageSize(int width, int height) {
r = Math.min(width, height) * 0.5f; r = Math.min(width, height) * 0.5f;
center = new float[] { width * 0.5f, height * 0.5f }; center = new float[] { width * 0.5f, height * 0.5f };
} }
@Override
public byte getAlpha(float x, float y) { public byte getAlpha(float x, float y) {
float d = FastMath.abs(FastMath.sqrt((x - center[0]) * (x - center[0]) + (y - center[1]) * (y - center[1]))) / r; float d = FastMath.abs(FastMath.sqrt((x - center[0]) * (x - center[0]) + (y - center[1]) * (y - center[1]))) / r;
return d >= 1.0f ? 0 : (byte) ((-FastMath.sqrt((2.0f - d) * d) + 1.0f) * 255.0f); return d >= 1.0f ? 0 : (byte) ((-FastMath.sqrt((2.0f - d) * d) + 1.0f) * 255.0f);

@ -104,7 +104,6 @@ import com.jme3.texture.Texture;
Vector3f[] uvsArray = uvs.toArray(new Vector3f[uvs.size()]); Vector3f[] uvsArray = uvs.toArray(new Vector3f[uvs.size()]);
BoundingBox boundingBox = UVCoordinatesGenerator.getBoundingBox(geometries); BoundingBox boundingBox = UVCoordinatesGenerator.getBoundingBox(geometries);
Set<TriangleTextureElement> triangleTextureElements = new TreeSet<TriangleTextureElement>(new Comparator<TriangleTextureElement>() { Set<TriangleTextureElement> triangleTextureElements = new TreeSet<TriangleTextureElement>(new Comparator<TriangleTextureElement>() {
@Override
public int compare(TriangleTextureElement o1, TriangleTextureElement o2) { public int compare(TriangleTextureElement o1, TriangleTextureElement o2) {
return o1.faceIndex - o2.faceIndex; return o1.faceIndex - o2.faceIndex;
} }

@ -68,7 +68,6 @@ import com.jme3.util.BufferUtils;
public TriangulatedTexture(Texture2D texture2d, List<Vector2f> uvs, BlenderContext blenderContext) { public TriangulatedTexture(Texture2D texture2d, List<Vector2f> uvs, BlenderContext blenderContext) {
maxTextureSize = blenderContext.getBlenderKey().getMaxTextureSize(); maxTextureSize = blenderContext.getBlenderKey().getMaxTextureSize();
faceTextures = new TreeSet<TriangleTextureElement>(new Comparator<TriangleTextureElement>() { faceTextures = new TreeSet<TriangleTextureElement>(new Comparator<TriangleTextureElement>() {
@Override
public int compare(TriangleTextureElement o1, TriangleTextureElement o2) { public int compare(TriangleTextureElement o1, TriangleTextureElement o2) {
return o1.faceIndex - o2.faceIndex; return o1.faceIndex - o2.faceIndex;
} }
@ -209,7 +208,6 @@ import com.jme3.util.BufferUtils;
// sorting the parts by their height (from highest to the lowest) // sorting the parts by their height (from highest to the lowest)
List<TriangleTextureElement> list = new ArrayList<TriangleTextureElement>(faceTextures); List<TriangleTextureElement> list = new ArrayList<TriangleTextureElement>(faceTextures);
Collections.sort(list, new Comparator<TriangleTextureElement>() { Collections.sort(list, new Comparator<TriangleTextureElement>() {
@Override
public int compare(TriangleTextureElement o1, TriangleTextureElement o2) { public int compare(TriangleTextureElement o1, TriangleTextureElement o2) {
return o2.image.getHeight() - o1.image.getHeight(); return o2.image.getHeight() - o1.image.getHeight();
} }

@ -100,7 +100,6 @@ import com.jme3.scene.plugins.blender.materials.MaterialHelper;
} }
} }
@Override
public void copyBlendingData(TextureBlender textureBlender) { public void copyBlendingData(TextureBlender textureBlender) {
if(textureBlender instanceof AbstractTextureBlender) { if(textureBlender instanceof AbstractTextureBlender) {
this.flag = ((AbstractTextureBlender) textureBlender).flag; this.flag = ((AbstractTextureBlender) textureBlender).flag;

@ -39,7 +39,6 @@ public class TextureBlenderAWT extends AbstractTextureBlender {
super(flag, negateTexture, blendType, materialColor, color, blendFactor); super(flag, negateTexture, blendType, materialColor, color, blendFactor);
} }
@Override
public Image blend(Image image, Image baseImage, BlenderContext blenderContext) { public Image blend(Image image, Image baseImage, BlenderContext blenderContext) {
float[] pixelColor = new float[] { color[0], color[1], color[2], 1.0f }; float[] pixelColor = new float[] { color[0], color[1], color[2], 1.0f };
Format format = image.getFormat(); Format format = image.getFormat();

@ -100,12 +100,10 @@ public class TextureBlenderFactory {
case LTC: case LTC:
LOGGER.log(Level.WARNING, "Image type not yet supported for blending: {0}. Returning a blender that does not change the texture.", format); LOGGER.log(Level.WARNING, "Image type not yet supported for blending: {0}. Returning a blender that does not change the texture.", format);
return new TextureBlender() { return new TextureBlender() {
@Override
public Image blend(Image image, Image baseImage, BlenderContext blenderContext) { public Image blend(Image image, Image baseImage, BlenderContext blenderContext) {
return image; return image;
} }
@Override
public void copyBlendingData(TextureBlender textureBlender) { public void copyBlendingData(TextureBlender textureBlender) {
} }
}; };

@ -33,7 +33,6 @@ public class TextureBlenderLuminance extends AbstractTextureBlender {
super(flag, negateTexture, blendType, materialColor, color, blendFactor); super(flag, negateTexture, blendType, materialColor, color, blendFactor);
} }
@Override
public Image blend(Image image, Image baseImage, BlenderContext blenderContext) { public Image blend(Image image, Image baseImage, BlenderContext blenderContext) {
Format format = image.getFormat(); Format format = image.getFormat();
ByteBuffer data = image.getData(0); ByteBuffer data = image.getData(0);

@ -122,50 +122,42 @@ import java.util.logging.Logger;
static { static {
noiseFunctions.put(Integer.valueOf(0), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(0), new NoiseFunction() {
// originalBlenderNoise // originalBlenderNoise
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
return NoiseFunctions.originalBlenderNoise(x, y, z); return NoiseFunctions.originalBlenderNoise(x, y, z);
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
return 2.0f * NoiseFunctions.originalBlenderNoise(x, y, z) - 1.0f; return 2.0f * NoiseFunctions.originalBlenderNoise(x, y, z) - 1.0f;
} }
}); });
noiseFunctions.put(Integer.valueOf(1), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(1), new NoiseFunction() {
// orgPerlinNoise // orgPerlinNoise
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
return 0.5f + 0.5f * NoiseFunctions.noise3Perlin(x, y, z); return 0.5f + 0.5f * NoiseFunctions.noise3Perlin(x, y, z);
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
return NoiseFunctions.noise3Perlin(x, y, z); return NoiseFunctions.noise3Perlin(x, y, z);
} }
}); });
noiseFunctions.put(Integer.valueOf(2), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(2), new NoiseFunction() {
// newPerlin // newPerlin
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
return 0.5f + 0.5f * NoiseFunctions.newPerlin(x, y, z); return 0.5f + 0.5f * NoiseFunctions.newPerlin(x, y, z);
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
return this.execute(x, y, z); return this.execute(x, y, z);
} }
}); });
noiseFunctions.put(Integer.valueOf(3), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(3), new NoiseFunction() {
// voronoi_F1 // voronoi_F1
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
return da[0]; return da[0];
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
@ -174,14 +166,12 @@ import java.util.logging.Logger;
}); });
noiseFunctions.put(Integer.valueOf(4), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(4), new NoiseFunction() {
// voronoi_F2 // voronoi_F2
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
return da[1]; return da[1];
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
@ -190,14 +180,12 @@ import java.util.logging.Logger;
}); });
noiseFunctions.put(Integer.valueOf(5), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(5), new NoiseFunction() {
// voronoi_F3 // voronoi_F3
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
return da[2]; return da[2];
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
@ -206,14 +194,12 @@ import java.util.logging.Logger;
}); });
noiseFunctions.put(Integer.valueOf(6), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(6), new NoiseFunction() {
// voronoi_F4 // voronoi_F4
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
return da[3]; return da[3];
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
@ -222,14 +208,12 @@ import java.util.logging.Logger;
}); });
noiseFunctions.put(Integer.valueOf(7), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(7), new NoiseFunction() {
// voronoi_F1F2 // voronoi_F1F2
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
return da[1] - da[0]; return da[1] - da[0];
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
float[] da = new float[4], pa = new float[12]; float[] da = new float[4], pa = new float[12];
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0); NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
@ -238,13 +222,11 @@ import java.util.logging.Logger;
}); });
noiseFunctions.put(Integer.valueOf(8), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(8), new NoiseFunction() {
// voronoi_Cr // voronoi_Cr
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
float t = 10 * noiseFunctions.get(Integer.valueOf(7)).execute(x, y, z);// voronoi_F1F2 float t = 10 * noiseFunctions.get(Integer.valueOf(7)).execute(x, y, z);// voronoi_F1F2
return t > 1.0f ? 1.0f : t; return t > 1.0f ? 1.0f : t;
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
float t = 10.0f * noiseFunctions.get(Integer.valueOf(7)).execute(x, y, z);// voronoi_F1F2 float t = 10.0f * noiseFunctions.get(Integer.valueOf(7)).execute(x, y, z);// voronoi_F1F2
return t > 1.0f ? 1.0f : 2.0f * t - 1.0f; return t > 1.0f ? 1.0f : 2.0f * t - 1.0f;
@ -252,7 +234,6 @@ import java.util.logging.Logger;
}); });
noiseFunctions.put(Integer.valueOf(14), new NoiseFunction() { noiseFunctions.put(Integer.valueOf(14), new NoiseFunction() {
// cellNoise // cellNoise
@Override
public float execute(float x, float y, float z) { public float execute(float x, float y, float z) {
int xi = (int) Math.floor(x); int xi = (int) Math.floor(x);
int yi = (int) Math.floor(y); int yi = (int) Math.floor(y);
@ -262,7 +243,6 @@ import java.util.logging.Logger;
return (n * (n * n * 15731 + 789221) + 1376312589) / 4294967296.0f; return (n * (n * n * 15731 + 789221) + 1376312589) / 4294967296.0f;
} }
@Override
public float executeSigned(float x, float y, float z) { public float executeSigned(float x, float y, float z) {
return 2.0f * this.execute(x, y, z) - 1.0f; return 2.0f * this.execute(x, y, z) - 1.0f;
} }
@ -274,28 +254,24 @@ import java.util.logging.Logger;
static { static {
distanceFunctions.put(Integer.valueOf(0), new DistanceFunction() { distanceFunctions.put(Integer.valueOf(0), new DistanceFunction() {
// real distance // real distance
@Override
public float execute(float x, float y, float z, float e) { public float execute(float x, float y, float z, float e) {
return (float) Math.sqrt(x * x + y * y + z * z); return (float) Math.sqrt(x * x + y * y + z * z);
} }
}); });
distanceFunctions.put(Integer.valueOf(1), new DistanceFunction() { distanceFunctions.put(Integer.valueOf(1), new DistanceFunction() {
// distance squared // distance squared
@Override
public float execute(float x, float y, float z, float e) { public float execute(float x, float y, float z, float e) {
return x * x + y * y + z * z; return x * x + y * y + z * z;
} }
}); });
distanceFunctions.put(Integer.valueOf(2), new DistanceFunction() { distanceFunctions.put(Integer.valueOf(2), new DistanceFunction() {
// manhattan/taxicab/cityblock distance // manhattan/taxicab/cityblock distance
@Override
public float execute(float x, float y, float z, float e) { public float execute(float x, float y, float z, float e) {
return FastMath.abs(x) + FastMath.abs(y) + FastMath.abs(z); return FastMath.abs(x) + FastMath.abs(y) + FastMath.abs(z);
} }
}); });
distanceFunctions.put(Integer.valueOf(3), new DistanceFunction() { distanceFunctions.put(Integer.valueOf(3), new DistanceFunction() {
// Chebychev // Chebychev
@Override
public float execute(float x, float y, float z, float e) { public float execute(float x, float y, float z, float e) {
x = FastMath.abs(x); x = FastMath.abs(x);
y = FastMath.abs(y); y = FastMath.abs(y);
@ -306,7 +282,6 @@ import java.util.logging.Logger;
}); });
distanceFunctions.put(Integer.valueOf(4), new DistanceFunction() { distanceFunctions.put(Integer.valueOf(4), new DistanceFunction() {
// Minkovsky, preset exponent 0.5 (MinkovskyH) // Minkovsky, preset exponent 0.5 (MinkovskyH)
@Override
public float execute(float x, float y, float z, float e) { public float execute(float x, float y, float z, float e) {
float d = (float) (Math.sqrt(FastMath.abs(x)) + Math.sqrt(FastMath.abs(y)) + Math.sqrt(FastMath.abs(z))); float d = (float) (Math.sqrt(FastMath.abs(x)) + Math.sqrt(FastMath.abs(y)) + Math.sqrt(FastMath.abs(z)));
return d * d; return d * d;
@ -314,7 +289,6 @@ import java.util.logging.Logger;
}); });
distanceFunctions.put(Integer.valueOf(5), new DistanceFunction() { distanceFunctions.put(Integer.valueOf(5), new DistanceFunction() {
// Minkovsky, preset exponent 0.25 (Minkovsky4) // Minkovsky, preset exponent 0.25 (Minkovsky4)
@Override
public float execute(float x, float y, float z, float e) { public float execute(float x, float y, float z, float e) {
x *= x; x *= x;
y *= y; y *= y;
@ -324,7 +298,6 @@ import java.util.logging.Logger;
}); });
distanceFunctions.put(Integer.valueOf(6), new DistanceFunction() { distanceFunctions.put(Integer.valueOf(6), new DistanceFunction() {
// Minkovsky, general case // Minkovsky, general case
@Override
public float execute(float x, float y, float z, float e) { public float execute(float x, float y, float z, float e) {
return (float) Math.pow(Math.pow(FastMath.abs(x), e) + Math.pow(FastMath.abs(y), e) + Math.pow(FastMath.abs(z), e), 1.0f / e); return (float) Math.pow(Math.pow(FastMath.abs(x), e) + Math.pow(FastMath.abs(y), e) + Math.pow(FastMath.abs(z), e), 1.0f / e);
} }
@ -335,7 +308,6 @@ import java.util.logging.Logger;
static { static {
musgraveFunctions.put(Integer.valueOf(TEX_MFRACTAL), new MusgraveFunction() { musgraveFunctions.put(Integer.valueOf(TEX_MFRACTAL), new MusgraveFunction() {
@Override
public float execute(MusgraveData musgraveData, float x, float y, float z) { public float execute(MusgraveData musgraveData, float x, float y, float z) {
float rmd, value = 1.0f, pwr = 1.0f, pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h); float rmd, value = 1.0f, pwr = 1.0f, pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h);
NoiseFunction abstractNoiseFunc = noiseFunctions.get(Integer.valueOf(musgraveData.noisebasis)); NoiseFunction abstractNoiseFunc = noiseFunctions.get(Integer.valueOf(musgraveData.noisebasis));
@ -359,7 +331,6 @@ import java.util.logging.Logger;
}); });
musgraveFunctions.put(Integer.valueOf(TEX_RIDGEDMF), new MusgraveFunction() { musgraveFunctions.put(Integer.valueOf(TEX_RIDGEDMF), new MusgraveFunction() {
@Override
public float execute(MusgraveData musgraveData, float x, float y, float z) { public float execute(MusgraveData musgraveData, float x, float y, float z) {
float result, signal, weight; float result, signal, weight;
float pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h); float pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h);
@ -396,7 +367,6 @@ import java.util.logging.Logger;
}); });
musgraveFunctions.put(Integer.valueOf(TEX_HYBRIDMF), new MusgraveFunction() { musgraveFunctions.put(Integer.valueOf(TEX_HYBRIDMF), new MusgraveFunction() {
@Override
public float execute(MusgraveData musgraveData, float x, float y, float z) { public float execute(MusgraveData musgraveData, float x, float y, float z) {
float result, signal, weight, rmd; float result, signal, weight, rmd;
float pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h); float pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h);
@ -434,7 +404,6 @@ import java.util.logging.Logger;
}); });
musgraveFunctions.put(Integer.valueOf(TEX_FBM), new MusgraveFunction() { musgraveFunctions.put(Integer.valueOf(TEX_FBM), new MusgraveFunction() {
@Override
public float execute(MusgraveData musgraveData, float x, float y, float z) { public float execute(MusgraveData musgraveData, float x, float y, float z) {
float rmd, value = 0.0f, pwr = 1.0f, pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h); float rmd, value = 0.0f, pwr = 1.0f, pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h);
@ -460,7 +429,6 @@ import java.util.logging.Logger;
}); });
musgraveFunctions.put(Integer.valueOf(TEX_HTERRAIN), new MusgraveFunction() { musgraveFunctions.put(Integer.valueOf(TEX_HTERRAIN), new MusgraveFunction() {
@Override
public float execute(MusgraveData musgraveData, float x, float y, float z) { public float execute(MusgraveData musgraveData, float x, float y, float z) {
float value, increment, rmd; float value, increment, rmd;
float pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h); float pwHL = (float) Math.pow(musgraveData.lacunarity, -musgraveData.h);

@ -46,20 +46,17 @@ public final class TextureGeneratorBlend extends TextureGenerator {
private static final IntensityFunction INTENSITY_FUNCTION[] = new IntensityFunction[7]; private static final IntensityFunction INTENSITY_FUNCTION[] = new IntensityFunction[7];
static { static {
INTENSITY_FUNCTION[0] = new IntensityFunction() {//Linear: stype = 0 (TEX_LIN) INTENSITY_FUNCTION[0] = new IntensityFunction() {//Linear: stype = 0 (TEX_LIN)
@Override
public float getIntensity(float x, float y, float z) { public float getIntensity(float x, float y, float z) {
return (1.0f + x) * 0.5f; return (1.0f + x) * 0.5f;
} }
}; };
INTENSITY_FUNCTION[1] = new IntensityFunction() {//Quad: stype = 1 (TEX_QUAD) INTENSITY_FUNCTION[1] = new IntensityFunction() {//Quad: stype = 1 (TEX_QUAD)
@Override
public float getIntensity(float x, float y, float z) { public float getIntensity(float x, float y, float z) {
float result = (1.0f + x) * 0.5f; float result = (1.0f + x) * 0.5f;
return result * result; return result * result;
} }
}; };
INTENSITY_FUNCTION[2] = new IntensityFunction() {//Ease: stype = 2 (TEX_EASE) INTENSITY_FUNCTION[2] = new IntensityFunction() {//Ease: stype = 2 (TEX_EASE)
@Override
public float getIntensity(float x, float y, float z) { public float getIntensity(float x, float y, float z) {
float result = (1.0f + x) * 0.5f; float result = (1.0f + x) * 0.5f;
if (result <= 0.0f) { if (result <= 0.0f) {
@ -72,27 +69,23 @@ public final class TextureGeneratorBlend extends TextureGenerator {
} }
}; };
INTENSITY_FUNCTION[3] = new IntensityFunction() {//Diagonal: stype = 3 (TEX_DIAG) INTENSITY_FUNCTION[3] = new IntensityFunction() {//Diagonal: stype = 3 (TEX_DIAG)
@Override
public float getIntensity(float x, float y, float z) { public float getIntensity(float x, float y, float z) {
return (2.0f + x + y) * 0.25f; return (2.0f + x + y) * 0.25f;
} }
}; };
INTENSITY_FUNCTION[4] = new IntensityFunction() {//Sphere: stype = 4 (TEX_SPHERE) INTENSITY_FUNCTION[4] = new IntensityFunction() {//Sphere: stype = 4 (TEX_SPHERE)
@Override
public float getIntensity(float x, float y, float z) { public float getIntensity(float x, float y, float z) {
float result = 1.0f - (float) Math.sqrt(x * x + y * y + z * z); float result = 1.0f - (float) Math.sqrt(x * x + y * y + z * z);
return result < 0.0f ? 0.0f : result; return result < 0.0f ? 0.0f : result;
} }
}; };
INTENSITY_FUNCTION[5] = new IntensityFunction() {//Halo: stype = 5 (TEX_HALO) INTENSITY_FUNCTION[5] = new IntensityFunction() {//Halo: stype = 5 (TEX_HALO)
@Override
public float getIntensity(float x, float y, float z) { public float getIntensity(float x, float y, float z) {
float result = 1.0f - (float) Math.sqrt(x * x + y * y + z * z); float result = 1.0f - (float) Math.sqrt(x * x + y * y + z * z);
return result <= 0.0f ? 0.0f : result * result; return result <= 0.0f ? 0.0f : result * result;
} }
}; };
INTENSITY_FUNCTION[6] = new IntensityFunction() {//Radial: stype = 6 (TEX_RAD) INTENSITY_FUNCTION[6] = new IntensityFunction() {//Radial: stype = 6 (TEX_RAD)
@Override
public float getIntensity(float x, float y, float z) { public float getIntensity(float x, float y, float z) {
return (float) Math.atan2(y, x) * FastMath.INV_TWO_PI + 0.5f; return (float) Math.atan2(y, x) * FastMath.INV_TWO_PI + 0.5f;
} }

@ -45,61 +45,51 @@ public class TextureGeneratorMagic extends TextureGenerator {
private static NoiseDepthFunction[] noiseDepthFunctions = new NoiseDepthFunction[10]; private static NoiseDepthFunction[] noiseDepthFunctions = new NoiseDepthFunction[10];
static { static {
noiseDepthFunctions[0] = new NoiseDepthFunction() { noiseDepthFunctions[0] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[1] = -(float) Math.cos(xyz[0] - xyz[1] + xyz[2]) * turbulence; xyz[1] = -(float) Math.cos(xyz[0] - xyz[1] + xyz[2]) * turbulence;
} }
}; };
noiseDepthFunctions[1] = new NoiseDepthFunction() { noiseDepthFunctions[1] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[0] = (float) Math.cos(xyz[0] - xyz[1] - xyz[2]) * turbulence; xyz[0] = (float) Math.cos(xyz[0] - xyz[1] - xyz[2]) * turbulence;
} }
}; };
noiseDepthFunctions[2] = new NoiseDepthFunction() { noiseDepthFunctions[2] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[2] = (float) Math.sin(-xyz[0] - xyz[1] - xyz[2]) * turbulence; xyz[2] = (float) Math.sin(-xyz[0] - xyz[1] - xyz[2]) * turbulence;
} }
}; };
noiseDepthFunctions[3] = new NoiseDepthFunction() { noiseDepthFunctions[3] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[0] = -(float) Math.cos(-xyz[0] + xyz[1] - xyz[2]) * turbulence; xyz[0] = -(float) Math.cos(-xyz[0] + xyz[1] - xyz[2]) * turbulence;
} }
}; };
noiseDepthFunctions[4] = new NoiseDepthFunction() { noiseDepthFunctions[4] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[1] = -(float) Math.sin(-xyz[0] + xyz[1] + xyz[2]) * turbulence; xyz[1] = -(float) Math.sin(-xyz[0] + xyz[1] + xyz[2]) * turbulence;
} }
}; };
noiseDepthFunctions[5] = new NoiseDepthFunction() { noiseDepthFunctions[5] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[1] = -(float) Math.cos(-xyz[0] + xyz[1] + xyz[2]) * turbulence; xyz[1] = -(float) Math.cos(-xyz[0] + xyz[1] + xyz[2]) * turbulence;
} }
}; };
noiseDepthFunctions[6] = new NoiseDepthFunction() { noiseDepthFunctions[6] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[0] = (float) Math.cos(xyz[0] + xyz[1] + xyz[2]) * turbulence; xyz[0] = (float) Math.cos(xyz[0] + xyz[1] + xyz[2]) * turbulence;
} }
}; };
noiseDepthFunctions[7] = new NoiseDepthFunction() { noiseDepthFunctions[7] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[2] = (float) Math.sin(xyz[0] + xyz[1] - xyz[2]) * turbulence; xyz[2] = (float) Math.sin(xyz[0] + xyz[1] - xyz[2]) * turbulence;
} }
}; };
noiseDepthFunctions[8] = new NoiseDepthFunction() { noiseDepthFunctions[8] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[0] = -(float) Math.cos(-xyz[0] - xyz[1] + xyz[2]) * turbulence; xyz[0] = -(float) Math.cos(-xyz[0] - xyz[1] + xyz[2]) * turbulence;
} }
}; };
noiseDepthFunctions[9] = new NoiseDepthFunction() { noiseDepthFunctions[9] = new NoiseDepthFunction() {
@Override
public void compute(float[] xyz, float turbulence) { public void compute(float[] xyz, float turbulence) {
xyz[1] = -(float) Math.sin(xyz[0] - xyz[1] + xyz[2]) * turbulence; xyz[1] = -(float) Math.sin(xyz[0] - xyz[1] + xyz[2]) * turbulence;
} }

@ -93,14 +93,12 @@ public class TextureGeneratorWood extends TextureGenerator {
static { static {
waveformFunctions[0] = new WaveForm() {// sinus (TEX_SIN) waveformFunctions[0] = new WaveForm() {// sinus (TEX_SIN)
@Override
public float execute(float x) { public float execute(float x) {
return 0.5f + 0.5f * (float) Math.sin(x); return 0.5f + 0.5f * (float) Math.sin(x);
} }
}; };
waveformFunctions[1] = new WaveForm() {// saw (TEX_SAW) waveformFunctions[1] = new WaveForm() {// saw (TEX_SAW)
@Override
public float execute(float x) { public float execute(float x) {
int n = (int) (x * FastMath.INV_TWO_PI); int n = (int) (x * FastMath.INV_TWO_PI);
x -= n * FastMath.TWO_PI; x -= n * FastMath.TWO_PI;
@ -112,7 +110,6 @@ public class TextureGeneratorWood extends TextureGenerator {
}; };
waveformFunctions[2] = new WaveForm() {// triangle (TEX_TRI) waveformFunctions[2] = new WaveForm() {// triangle (TEX_TRI)
@Override
public float execute(float x) { public float execute(float x) {
return 1.0f - 2.0f * FastMath.abs((float) Math.floor(x * FastMath.INV_TWO_PI + 0.5f) - x * FastMath.INV_TWO_PI); return 1.0f - 2.0f * FastMath.abs((float) Math.floor(x * FastMath.INV_TWO_PI + 0.5f) - x * FastMath.INV_TWO_PI);
} }

@ -8,7 +8,6 @@ import com.jme3.texture.Image;
* @author Marcin Roguski (Kaelthas) * @author Marcin Roguski (Kaelthas)
*/ */
/*package*/ class AWTPixelInputOutput implements PixelInputOutput { /*package*/ class AWTPixelInputOutput implements PixelInputOutput {
@Override
public void read(Image image, TexturePixel pixel, int index) { public void read(Image image, TexturePixel pixel, int index) {
byte r,g,b,a; byte r,g,b,a;
switch(image.getFormat()) {//TODO: add other formats switch(image.getFormat()) {//TODO: add other formats
@ -36,13 +35,11 @@ import com.jme3.texture.Image;
pixel.fromARGB8(a, r, g, b); pixel.fromARGB8(a, r, g, b);
} }
@Override
public void read(Image image, TexturePixel pixel, int x, int y) { public void read(Image image, TexturePixel pixel, int x, int y) {
int index = (y * image.getWidth() + x) * (image.getFormat().getBitsPerPixel() >> 3); int index = (y * image.getWidth() + x) * (image.getFormat().getBitsPerPixel() >> 3);
this.read(image, pixel, index); this.read(image, pixel, index);
} }
@Override
public void write(Image image, TexturePixel pixel, int index) { public void write(Image image, TexturePixel pixel, int index) {
switch(image.getFormat()) { switch(image.getFormat()) {
case RGBA8: case RGBA8:
@ -67,7 +64,6 @@ import com.jme3.texture.Image;
} }
} }
@Override
public void write(Image image, TexturePixel pixel, int x, int y) { public void write(Image image, TexturePixel pixel, int x, int y) {
int index = (y * image.getWidth() + x) * (image.getFormat().getBitsPerPixel() >> 3); int index = (y * image.getWidth() + x) * (image.getFormat().getBitsPerPixel() >> 3);
this.write(image, pixel, index); this.write(image, pixel, index);

@ -14,12 +14,10 @@ import com.jme3.texture.Image;
* @author Marcin Roguski (Kaelthas) * @author Marcin Roguski (Kaelthas)
*/ */
/*package*/ class DDSPixelInputOutput implements PixelInputOutput { /*package*/ class DDSPixelInputOutput implements PixelInputOutput {
@Override
public void read(Image image, TexturePixel pixel, int index) { public void read(Image image, TexturePixel pixel, int index) {
throw new UnsupportedOperationException("Cannot get the DXT pixel by index because not every index contains the pixel color!"); throw new UnsupportedOperationException("Cannot get the DXT pixel by index because not every index contains the pixel color!");
} }
@Override
public void read(Image image, TexturePixel pixel, int x, int y) { public void read(Image image, TexturePixel pixel, int x, int y) {
int xTexetlIndex = x % image.getWidth() >> 2; int xTexetlIndex = x % image.getWidth() >> 2;
int yTexelIndex = y % image.getHeight() >> 2; int yTexelIndex = y % image.getHeight() >> 2;
@ -162,12 +160,10 @@ import com.jme3.texture.Image;
pixel.alpha = alpha; pixel.alpha = alpha;
} }
@Override
public void write(Image image, TexturePixel pixel, int index) { public void write(Image image, TexturePixel pixel, int index) {
throw new UnsupportedOperationException("Cannot put the DXT pixel by index because not every index contains the pixel color!"); throw new UnsupportedOperationException("Cannot put the DXT pixel by index because not every index contains the pixel color!");
} }
@Override
public void write(Image image, TexturePixel pixel, int x, int y) { public void write(Image image, TexturePixel pixel, int x, int y) {
throw new UnsupportedOperationException("Writing to DDS texture pixel by pixel is not yet supported!"); throw new UnsupportedOperationException("Writing to DDS texture pixel by pixel is not yet supported!");
} }

@ -8,24 +8,20 @@ import com.jme3.texture.Image;
* @author Marcin Roguski (Kaelthas) * @author Marcin Roguski (Kaelthas)
*/ */
/*package*/ class LuminancePixelInputOutput implements PixelInputOutput { /*package*/ class LuminancePixelInputOutput implements PixelInputOutput {
@Override
public void read(Image image, TexturePixel pixel, int index) { public void read(Image image, TexturePixel pixel, int index) {
byte intensity = image.getData(0).get(index); byte intensity = image.getData(0).get(index);
pixel.fromIntensity(intensity); pixel.fromIntensity(intensity);
} }
@Override
public void read(Image image, TexturePixel pixel, int x, int y) { public void read(Image image, TexturePixel pixel, int x, int y) {
int index = y * image.getWidth() + x; int index = y * image.getWidth() + x;
this.read(image, pixel, index); this.read(image, pixel, index);
} }
@Override
public void write(Image image, TexturePixel pixel, int index) { public void write(Image image, TexturePixel pixel, int index) {
image.getData(0).put(index, pixel.getInt()); image.getData(0).put(index, pixel.getInt());
} }
@Override
public void write(Image image, TexturePixel pixel, int x, int y) { public void write(Image image, TexturePixel pixel, int x, int y) {
int index = y * image.getWidth() + x; int index = y * image.getWidth() + x;
this.write(image, pixel, index); this.write(image, pixel, index);

Loading…
Cancel
Save