aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/share
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/share')
-rw-r--r--src/classes/share/javax/media/j3d/Canvas3D.java12
-rw-r--r--src/classes/share/javax/media/j3d/ImageComponentRetained.java30
-rw-r--r--src/classes/share/javax/media/j3d/NativePipeline.java14
-rw-r--r--src/classes/share/javax/media/j3d/NoopPipeline.java5
-rw-r--r--src/classes/share/javax/media/j3d/Pipeline.java4
5 files changed, 42 insertions, 23 deletions
diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java
index 62b0463..0758803 100644
--- a/src/classes/share/javax/media/j3d/Canvas3D.java
+++ b/src/classes/share/javax/media/j3d/Canvas3D.java
@@ -4503,7 +4503,7 @@ public class Canvas3D extends Canvas {
mapMaxY = 1.0f - ((float) winCoord.y / (float) winHeight);
textureFillRaster(ctx, texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha, raster.image.useBilinearFilter());
}
@@ -4622,7 +4622,7 @@ public class Canvas3D extends Canvas {
// System.err.println("Java 3D : mapMinX " + mapMinX + " mapMinY " + mapMinY +
// " mapMaxX " + mapMaxX + " mapMaxY " + mapMaxY);
textureFillBackground(ctx, texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, bg.image.useBilinearFilter());
}
@@ -5050,15 +5050,15 @@ public class Canvas3D extends Canvas {
}
void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter) {
Pipeline.getPipeline().textureFillBackground(ctx, texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, useBiliearFilter);
}
void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBiliearFilter) {
Pipeline.getPipeline().textureFillRaster(ctx, texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha, useBiliearFilter);
}
void executeRasterDepth(Context ctx, float posX, float posY, float posZ,
diff --git a/src/classes/share/javax/media/j3d/ImageComponentRetained.java b/src/classes/share/javax/media/j3d/ImageComponentRetained.java
index c0e6e8a..93f477a 100644
--- a/src/classes/share/javax/media/j3d/ImageComponentRetained.java
+++ b/src/classes/share/javax/media/j3d/ImageComponentRetained.java
@@ -48,6 +48,8 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
static final int TYPE_INT_RGB = 0x100;
static final int TYPE_INT_ARGB = 0x200;
+ static final int IMAGE_SIZE_512X512 = 262144;
+
enum ImageFormatType {
TYPE_UNKNOWN,
TYPE_BYTE_BGR,
@@ -308,6 +310,14 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
}
return imageData;
}
+
+ boolean useBilinearFilter() {
+ if(imageDataPowerOfTwo != null) {
+ return true;
+ }
+
+ return false;
+ }
boolean isImageTypeSupported() {
return imageTypeIsSupported;
@@ -1778,9 +1788,11 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
}
void evaluateExtNonPowerOfTwo(int ext) {
-
- int npotWidth;
- int npotHeight;
+ // Only need to enforce for Raster or Background.
+ if(!enforceNonPowerOfTwoSupport) {
+ return;
+ }
+
// If npotSupported is false, a copy power of two image has been created
// so we don't have to check again.
if(!npotSupported) {
@@ -1798,8 +1810,10 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
// NPOT is unsupported, set flag to false.
npotSupported = false;
+ int npotWidth;
+ int npotHeight;
// Always scale up if image size is smaller 512*512.
- if((width * height) < 262144) {
+ if((width * height) < IMAGE_SIZE_512X512) {
npotWidth = getCeilPowerOf2(width);
npotHeight = getCeilPowerOf2(height);
} else {
@@ -1807,7 +1821,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
npotHeight = getClosestPowerOf2(height);
}
-// System.err.println("width " + width + " height " + height + " npotWidth " + npotWidth + " npotHeight " + npotHeight);
+ // System.err.println("width " + width + " height " + height + " npotWidth " + npotWidth + " npotHeight " + npotHeight);
float xScale = (float)npotWidth/(float)width;
float yScale = (float)npotHeight/(float)height;
@@ -1840,10 +1854,12 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
AffineTransform at = AffineTransform.getScaleInstance(xScale,
yScale);
+
powerOfTwoATOp = new AffineTransformOp(at,
- AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
- BufferedImage scaledImg = powerOfTwoATOp.filter((BufferedImage)ri, null);
+ AffineTransformOp.TYPE_BILINEAR);
+ BufferedImage scaledImg = powerOfTwoATOp.filter((BufferedImage)ri, null);
+
imageDataPowerOfTwo = createRenderedImageDataObject(null, npotWidth, npotHeight);
// Since ri is created from imageData, it's imageType is supported.
copySupportedImageToImageData(scaledImg, 0, imageDataPowerOfTwo);
diff --git a/src/classes/share/javax/media/j3d/NativePipeline.java b/src/classes/share/javax/media/j3d/NativePipeline.java
index 0eeffc9..bc3f7f4 100644
--- a/src/classes/share/javax/media/j3d/NativePipeline.java
+++ b/src/classes/share/javax/media/j3d/NativePipeline.java
@@ -3060,21 +3060,23 @@ class NativePipeline extends Pipeline {
}
native void textureFillBackground(long ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY);
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter);
void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter) {
textureFillBackground(unbox(ctx), texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, useBiliearFilter);
}
native void textureFillRaster(long ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha);
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha,
+ boolean useBiliearFilter);
void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha,
+ boolean useBiliearFilter) {
textureFillRaster(unbox(ctx), texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha, useBiliearFilter);
}
native void executeRasterDepth(long ctx, float posX, float posY, float posZ,
diff --git a/src/classes/share/javax/media/j3d/NoopPipeline.java b/src/classes/share/javax/media/j3d/NoopPipeline.java
index 03303d9..53c2756 100644
--- a/src/classes/share/javax/media/j3d/NoopPipeline.java
+++ b/src/classes/share/javax/media/j3d/NoopPipeline.java
@@ -1373,12 +1373,13 @@ class NoopPipeline extends Pipeline {
}
void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter) {
}
void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha,
+ boolean useBiliearFilter) {
}
diff --git a/src/classes/share/javax/media/j3d/Pipeline.java b/src/classes/share/javax/media/j3d/Pipeline.java
index 4df8fdb..9d05e0a 100644
--- a/src/classes/share/javax/media/j3d/Pipeline.java
+++ b/src/classes/share/javax/media/j3d/Pipeline.java
@@ -1288,10 +1288,10 @@ abstract class Pipeline {
abstract void clear(Context ctx, float r, float g, float b);
abstract void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY);
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter);
abstract void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha);
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBiliearFilter);
abstract void executeRasterDepth(Context ctx, float posX, float posY, float posZ,
int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, int depthWidth, int depthHeight,