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
This commit is contained in:
parent
22edb7beb0
commit
c4bf1b59a0
@ -74,7 +74,6 @@ public class BlenderLoader extends AbstractBlenderLoader {
|
||||
/** The blocks read from the file. */
|
||||
protected List<FileBlockHeader> blocks;
|
||||
|
||||
@Override
|
||||
public Spatial load(AssetInfo assetInfo) throws IOException {
|
||||
try {
|
||||
this.setup(assetInfo);
|
||||
|
@ -113,15 +113,12 @@ import com.jme3.util.TempVars;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JmeExporter ex) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(JmeImporter im) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTime(float time, float weight, AnimControl control,
|
||||
AnimChannel channel, TempVars vars) {
|
||||
if (boneTrack != null) {
|
||||
@ -131,7 +128,6 @@ import com.jme3.util.TempVars;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLength() {
|
||||
return spatialTrack == null ? boneTrack.getLength() : spatialTrack
|
||||
.getLength();
|
||||
|
@ -101,10 +101,8 @@ public class MaterialHelper extends AbstractBlenderHelper {
|
||||
super(blenderVersion, false);
|
||||
// setting alpha masks
|
||||
alphaMasks.put(ALPHA_MASK_NONE, new IAlphaMask() {
|
||||
@Override
|
||||
public void setImageSize(int width, int height) {}
|
||||
|
||||
@Override
|
||||
public byte getAlpha(float x, float y) {
|
||||
return (byte) 255;
|
||||
}
|
||||
@ -113,13 +111,11 @@ public class MaterialHelper extends AbstractBlenderHelper {
|
||||
private float r;
|
||||
private float[] center;
|
||||
|
||||
@Override
|
||||
public void setImageSize(int width, int height) {
|
||||
r = Math.min(width, height) * 0.5f;
|
||||
center = new float[] { width * 0.5f, height * 0.5f };
|
||||
}
|
||||
|
||||
@Override
|
||||
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])));
|
||||
return (byte) (d >= r ? 0 : 255);
|
||||
@ -129,13 +125,11 @@ public class MaterialHelper extends AbstractBlenderHelper {
|
||||
private float r;
|
||||
private float[] center;
|
||||
|
||||
@Override
|
||||
public void setImageSize(int width, int height) {
|
||||
r = Math.min(width, height) * 0.5f;
|
||||
center = new float[] { width * 0.5f, height * 0.5f };
|
||||
}
|
||||
|
||||
@Override
|
||||
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])));
|
||||
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[] center;
|
||||
|
||||
@Override
|
||||
public void setImageSize(int width, int height) {
|
||||
r = Math.min(width, height) * 0.5f;
|
||||
center = new float[] { width * 0.5f, height * 0.5f };
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
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()]);
|
||||
BoundingBox boundingBox = UVCoordinatesGenerator.getBoundingBox(geometries);
|
||||
Set<TriangleTextureElement> triangleTextureElements = new TreeSet<TriangleTextureElement>(new Comparator<TriangleTextureElement>() {
|
||||
@Override
|
||||
public int compare(TriangleTextureElement o1, TriangleTextureElement o2) {
|
||||
return o1.faceIndex - o2.faceIndex;
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ import com.jme3.util.BufferUtils;
|
||||
public TriangulatedTexture(Texture2D texture2d, List<Vector2f> uvs, BlenderContext blenderContext) {
|
||||
maxTextureSize = blenderContext.getBlenderKey().getMaxTextureSize();
|
||||
faceTextures = new TreeSet<TriangleTextureElement>(new Comparator<TriangleTextureElement>() {
|
||||
@Override
|
||||
public int compare(TriangleTextureElement o1, TriangleTextureElement o2) {
|
||||
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)
|
||||
List<TriangleTextureElement> list = new ArrayList<TriangleTextureElement>(faceTextures);
|
||||
Collections.sort(list, new Comparator<TriangleTextureElement>() {
|
||||
@Override
|
||||
public int compare(TriangleTextureElement o1, TriangleTextureElement o2) {
|
||||
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) {
|
||||
if(textureBlender instanceof AbstractTextureBlender) {
|
||||
this.flag = ((AbstractTextureBlender) textureBlender).flag;
|
||||
|
@ -39,7 +39,6 @@ public class TextureBlenderAWT extends AbstractTextureBlender {
|
||||
super(flag, negateTexture, blendType, materialColor, color, blendFactor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image blend(Image image, Image baseImage, BlenderContext blenderContext) {
|
||||
float[] pixelColor = new float[] { color[0], color[1], color[2], 1.0f };
|
||||
Format format = image.getFormat();
|
||||
|
@ -100,12 +100,10 @@ public class TextureBlenderFactory {
|
||||
case LTC:
|
||||
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() {
|
||||
@Override
|
||||
public Image blend(Image image, Image baseImage, BlenderContext blenderContext) {
|
||||
return image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyBlendingData(TextureBlender textureBlender) {
|
||||
}
|
||||
};
|
||||
|
@ -33,7 +33,6 @@ public class TextureBlenderLuminance extends AbstractTextureBlender {
|
||||
super(flag, negateTexture, blendType, materialColor, color, blendFactor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image blend(Image image, Image baseImage, BlenderContext blenderContext) {
|
||||
Format format = image.getFormat();
|
||||
ByteBuffer data = image.getData(0);
|
||||
|
@ -122,50 +122,42 @@ import java.util.logging.Logger;
|
||||
static {
|
||||
noiseFunctions.put(Integer.valueOf(0), new NoiseFunction() {
|
||||
// originalBlenderNoise
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
return NoiseFunctions.originalBlenderNoise(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
return 2.0f * NoiseFunctions.originalBlenderNoise(x, y, z) - 1.0f;
|
||||
}
|
||||
});
|
||||
noiseFunctions.put(Integer.valueOf(1), new NoiseFunction() {
|
||||
// orgPerlinNoise
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
return 0.5f + 0.5f * NoiseFunctions.noise3Perlin(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
return NoiseFunctions.noise3Perlin(x, y, z);
|
||||
}
|
||||
});
|
||||
noiseFunctions.put(Integer.valueOf(2), new NoiseFunction() {
|
||||
// newPerlin
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
return 0.5f + 0.5f * NoiseFunctions.newPerlin(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
return this.execute(x, y, z);
|
||||
}
|
||||
});
|
||||
noiseFunctions.put(Integer.valueOf(3), new NoiseFunction() {
|
||||
// voronoi_F1
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
|
||||
return da[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
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() {
|
||||
// voronoi_F2
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
|
||||
return da[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
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() {
|
||||
// voronoi_F3
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
|
||||
return da[2];
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
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() {
|
||||
// voronoi_F4
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
|
||||
return da[3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
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() {
|
||||
// voronoi_F1F2
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
NoiseFunctions.voronoi(x, y, z, da, pa, 1, 0);
|
||||
return da[1] - da[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
float[] da = new float[4], pa = new float[12];
|
||||
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() {
|
||||
// voronoi_Cr
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
float t = 10 * noiseFunctions.get(Integer.valueOf(7)).execute(x, y, z);// voronoi_F1F2
|
||||
return t > 1.0f ? 1.0f : t;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
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;
|
||||
@ -252,7 +234,6 @@ import java.util.logging.Logger;
|
||||
});
|
||||
noiseFunctions.put(Integer.valueOf(14), new NoiseFunction() {
|
||||
// cellNoise
|
||||
@Override
|
||||
public float execute(float x, float y, float z) {
|
||||
int xi = (int) Math.floor(x);
|
||||
int yi = (int) Math.floor(y);
|
||||
@ -262,7 +243,6 @@ import java.util.logging.Logger;
|
||||
return (n * (n * n * 15731 + 789221) + 1376312589) / 4294967296.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float executeSigned(float x, float y, float z) {
|
||||
return 2.0f * this.execute(x, y, z) - 1.0f;
|
||||
}
|
||||
@ -274,28 +254,24 @@ import java.util.logging.Logger;
|
||||
static {
|
||||
distanceFunctions.put(Integer.valueOf(0), new DistanceFunction() {
|
||||
// real distance
|
||||
@Override
|
||||
public float execute(float x, float y, float z, float e) {
|
||||
return (float) Math.sqrt(x * x + y * y + z * z);
|
||||
}
|
||||
});
|
||||
distanceFunctions.put(Integer.valueOf(1), new DistanceFunction() {
|
||||
// distance squared
|
||||
@Override
|
||||
public float execute(float x, float y, float z, float e) {
|
||||
return x * x + y * y + z * z;
|
||||
}
|
||||
});
|
||||
distanceFunctions.put(Integer.valueOf(2), new DistanceFunction() {
|
||||
// manhattan/taxicab/cityblock distance
|
||||
@Override
|
||||
public float execute(float x, float y, float z, float e) {
|
||||
return FastMath.abs(x) + FastMath.abs(y) + FastMath.abs(z);
|
||||
}
|
||||
});
|
||||
distanceFunctions.put(Integer.valueOf(3), new DistanceFunction() {
|
||||
// Chebychev
|
||||
@Override
|
||||
public float execute(float x, float y, float z, float e) {
|
||||
x = FastMath.abs(x);
|
||||
y = FastMath.abs(y);
|
||||
@ -306,7 +282,6 @@ import java.util.logging.Logger;
|
||||
});
|
||||
distanceFunctions.put(Integer.valueOf(4), new DistanceFunction() {
|
||||
// Minkovsky, preset exponent 0.5 (MinkovskyH)
|
||||
@Override
|
||||
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)));
|
||||
return d * d;
|
||||
@ -314,7 +289,6 @@ import java.util.logging.Logger;
|
||||
});
|
||||
distanceFunctions.put(Integer.valueOf(5), new DistanceFunction() {
|
||||
// Minkovsky, preset exponent 0.25 (Minkovsky4)
|
||||
@Override
|
||||
public float execute(float x, float y, float z, float e) {
|
||||
x *= x;
|
||||
y *= y;
|
||||
@ -324,7 +298,6 @@ import java.util.logging.Logger;
|
||||
});
|
||||
distanceFunctions.put(Integer.valueOf(6), new DistanceFunction() {
|
||||
// Minkovsky, general case
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
@ -335,7 +308,6 @@ import java.util.logging.Logger;
|
||||
static {
|
||||
musgraveFunctions.put(Integer.valueOf(TEX_MFRACTAL), new MusgraveFunction() {
|
||||
|
||||
@Override
|
||||
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);
|
||||
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() {
|
||||
|
||||
@Override
|
||||
public float execute(MusgraveData musgraveData, float x, float y, float z) {
|
||||
float result, signal, weight;
|
||||
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() {
|
||||
|
||||
@Override
|
||||
public float execute(MusgraveData musgraveData, float x, float y, float z) {
|
||||
float result, signal, weight, rmd;
|
||||
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() {
|
||||
|
||||
@Override
|
||||
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);
|
||||
|
||||
@ -460,7 +429,6 @@ import java.util.logging.Logger;
|
||||
});
|
||||
musgraveFunctions.put(Integer.valueOf(TEX_HTERRAIN), new MusgraveFunction() {
|
||||
|
||||
@Override
|
||||
public float execute(MusgraveData musgraveData, float x, float y, float z) {
|
||||
float value, increment, rmd;
|
||||
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];
|
||||
static {
|
||||
INTENSITY_FUNCTION[0] = new IntensityFunction() {//Linear: stype = 0 (TEX_LIN)
|
||||
@Override
|
||||
public float getIntensity(float x, float y, float z) {
|
||||
return (1.0f + x) * 0.5f;
|
||||
}
|
||||
};
|
||||
INTENSITY_FUNCTION[1] = new IntensityFunction() {//Quad: stype = 1 (TEX_QUAD)
|
||||
@Override
|
||||
public float getIntensity(float x, float y, float z) {
|
||||
float result = (1.0f + x) * 0.5f;
|
||||
return result * result;
|
||||
}
|
||||
};
|
||||
INTENSITY_FUNCTION[2] = new IntensityFunction() {//Ease: stype = 2 (TEX_EASE)
|
||||
@Override
|
||||
public float getIntensity(float x, float y, float z) {
|
||||
float result = (1.0f + x) * 0.5f;
|
||||
if (result <= 0.0f) {
|
||||
@ -72,27 +69,23 @@ public final class TextureGeneratorBlend extends TextureGenerator {
|
||||
}
|
||||
};
|
||||
INTENSITY_FUNCTION[3] = new IntensityFunction() {//Diagonal: stype = 3 (TEX_DIAG)
|
||||
@Override
|
||||
public float getIntensity(float x, float y, float z) {
|
||||
return (2.0f + x + y) * 0.25f;
|
||||
}
|
||||
};
|
||||
INTENSITY_FUNCTION[4] = new IntensityFunction() {//Sphere: stype = 4 (TEX_SPHERE)
|
||||
@Override
|
||||
public float getIntensity(float x, float y, float z) {
|
||||
float result = 1.0f - (float) Math.sqrt(x * x + y * y + z * z);
|
||||
return result < 0.0f ? 0.0f : result;
|
||||
}
|
||||
};
|
||||
INTENSITY_FUNCTION[5] = new IntensityFunction() {//Halo: stype = 5 (TEX_HALO)
|
||||
@Override
|
||||
public float getIntensity(float x, float y, float z) {
|
||||
float result = 1.0f - (float) Math.sqrt(x * x + y * y + z * z);
|
||||
return result <= 0.0f ? 0.0f : result * result;
|
||||
}
|
||||
};
|
||||
INTENSITY_FUNCTION[6] = new IntensityFunction() {//Radial: stype = 6 (TEX_RAD)
|
||||
@Override
|
||||
public float getIntensity(float x, float y, float z) {
|
||||
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];
|
||||
static {
|
||||
noiseDepthFunctions[0] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[1] = -(float) Math.cos(xyz[0] - xyz[1] + xyz[2]) * turbulence;
|
||||
}
|
||||
};
|
||||
noiseDepthFunctions[1] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[0] = (float) Math.cos(xyz[0] - xyz[1] - xyz[2]) * turbulence;
|
||||
}
|
||||
};
|
||||
noiseDepthFunctions[2] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[2] = (float) Math.sin(-xyz[0] - xyz[1] - xyz[2]) * turbulence;
|
||||
}
|
||||
};
|
||||
noiseDepthFunctions[3] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[0] = -(float) Math.cos(-xyz[0] + xyz[1] - xyz[2]) * turbulence;
|
||||
}
|
||||
};
|
||||
noiseDepthFunctions[4] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[1] = -(float) Math.sin(-xyz[0] + xyz[1] + xyz[2]) * turbulence;
|
||||
}
|
||||
};
|
||||
noiseDepthFunctions[5] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[1] = -(float) Math.cos(-xyz[0] + xyz[1] + xyz[2]) * turbulence;
|
||||
}
|
||||
};
|
||||
noiseDepthFunctions[6] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[0] = (float) Math.cos(xyz[0] + xyz[1] + xyz[2]) * turbulence;
|
||||
}
|
||||
};
|
||||
noiseDepthFunctions[7] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[2] = (float) Math.sin(xyz[0] + xyz[1] - xyz[2]) * turbulence;
|
||||
}
|
||||
};
|
||||
noiseDepthFunctions[8] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[0] = -(float) Math.cos(-xyz[0] - xyz[1] + xyz[2]) * turbulence;
|
||||
}
|
||||
};
|
||||
noiseDepthFunctions[9] = new NoiseDepthFunction() {
|
||||
@Override
|
||||
public void compute(float[] xyz, float turbulence) {
|
||||
xyz[1] = -(float) Math.sin(xyz[0] - xyz[1] + xyz[2]) * turbulence;
|
||||
}
|
||||
|
@ -93,14 +93,12 @@ public class TextureGeneratorWood extends TextureGenerator {
|
||||
static {
|
||||
waveformFunctions[0] = new WaveForm() {// sinus (TEX_SIN)
|
||||
|
||||
@Override
|
||||
public float execute(float x) {
|
||||
return 0.5f + 0.5f * (float) Math.sin(x);
|
||||
}
|
||||
};
|
||||
waveformFunctions[1] = new WaveForm() {// saw (TEX_SAW)
|
||||
|
||||
@Override
|
||||
public float execute(float x) {
|
||||
int n = (int) (x * FastMath.INV_TWO_PI);
|
||||
x -= n * FastMath.TWO_PI;
|
||||
@ -112,7 +110,6 @@ public class TextureGeneratorWood extends TextureGenerator {
|
||||
};
|
||||
waveformFunctions[2] = new WaveForm() {// triangle (TEX_TRI)
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import com.jme3.texture.Image;
|
||||
* @author Marcin Roguski (Kaelthas)
|
||||
*/
|
||||
/*package*/ class AWTPixelInputOutput implements PixelInputOutput {
|
||||
@Override
|
||||
public void read(Image image, TexturePixel pixel, int index) {
|
||||
byte r,g,b,a;
|
||||
switch(image.getFormat()) {//TODO: add other formats
|
||||
@ -36,13 +35,11 @@ import com.jme3.texture.Image;
|
||||
pixel.fromARGB8(a, r, g, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Image image, TexturePixel pixel, int x, int y) {
|
||||
int index = (y * image.getWidth() + x) * (image.getFormat().getBitsPerPixel() >> 3);
|
||||
this.read(image, pixel, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Image image, TexturePixel pixel, int index) {
|
||||
switch(image.getFormat()) {
|
||||
case RGBA8:
|
||||
@ -67,7 +64,6 @@ import com.jme3.texture.Image;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Image image, TexturePixel pixel, int x, int y) {
|
||||
int index = (y * image.getWidth() + x) * (image.getFormat().getBitsPerPixel() >> 3);
|
||||
this.write(image, pixel, index);
|
||||
|
@ -14,12 +14,10 @@ import com.jme3.texture.Image;
|
||||
* @author Marcin Roguski (Kaelthas)
|
||||
*/
|
||||
/*package*/ class DDSPixelInputOutput implements PixelInputOutput {
|
||||
@Override
|
||||
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!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Image image, TexturePixel pixel, int x, int y) {
|
||||
int xTexetlIndex = x % image.getWidth() >> 2;
|
||||
int yTexelIndex = y % image.getHeight() >> 2;
|
||||
@ -162,12 +160,10 @@ import com.jme3.texture.Image;
|
||||
pixel.alpha = alpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
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!");
|
||||
}
|
||||
|
||||
@Override
|
||||
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!");
|
||||
}
|
||||
|
@ -8,24 +8,20 @@ import com.jme3.texture.Image;
|
||||
* @author Marcin Roguski (Kaelthas)
|
||||
*/
|
||||
/*package*/ class LuminancePixelInputOutput implements PixelInputOutput {
|
||||
@Override
|
||||
public void read(Image image, TexturePixel pixel, int index) {
|
||||
byte intensity = image.getData(0).get(index);
|
||||
pixel.fromIntensity(intensity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Image image, TexturePixel pixel, int x, int y) {
|
||||
int index = y * image.getWidth() + x;
|
||||
this.read(image, pixel, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Image image, TexturePixel pixel, int index) {
|
||||
image.getData(0).put(index, pixel.getInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Image image, TexturePixel pixel, int x, int y) {
|
||||
int index = y * image.getWidth() + x;
|
||||
this.write(image, pixel, index);
|
||||
|
Loading…
x
Reference in New Issue
Block a user