aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2006-10-24 23:38:26 +0000
committerChien Yang <[email protected]>2006-10-24 23:38:26 +0000
commitd073500495277164924b158e784a476d4e6c2777 (patch)
tree9961fe4b8ada87c6f7a866a5910c5ddae7198258 /src/classes
parent4f8003817e06190d1c9609d94209c591d436f238 (diff)
Fixed issue 368 : Background texture doesn't work on system with no NPOT support
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@726 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/share/javax/media/j3d/Canvas3D.java29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java
index 1b85eed..62b0463 100644
--- a/src/classes/share/javax/media/j3d/Canvas3D.java
+++ b/src/classes/share/javax/media/j3d/Canvas3D.java
@@ -4441,7 +4441,7 @@ public class Canvas3D extends Canvas {
void textureFill(RasterRetained raster, Point2d winCoord,
float mapZ, float alpha) {
-
+
int winWidth = canvasViewCache.getCanvasWidth();
int winHeight = canvasViewCache.getCanvasHeight();
@@ -4456,8 +4456,9 @@ public class Canvas3D extends Canvas {
Dimension rasterSize = new Dimension();
raster.getSize(rasterSize);
-
- // System.err.println("rasterSrcOffset " + rasterSrcOffset + " rasterSize " + rasterSize);
+
+// System.err.println("rasterImageWidth " + rasterImageWidth + " rasterImageHeight " + rasterImageHeight);
+// System.err.println("rasterSrcOffset " + rasterSrcOffset + " rasterSize " + rasterSize);
int rasterMinX = rasterSrcOffset.x;
int rasterMaxX = rasterSrcOffset.x + rasterSize.width;
@@ -4508,13 +4509,10 @@ public class Canvas3D extends Canvas {
void textureFill(BackgroundRetained bg, int winWidth, int winHeight) {
- ImageComponentRetained.ImageData imageData =
- bg.image.getImageData(bg.texture.isUseAsRaster());
-
- int maxX = imageData.getWidth();
- int maxY = imageData.getHeight();
- int width = bg.image.width;
- int height = bg.image.height;
+ final int maxX = bg.image.width;
+ final int maxY = bg.image.height;
+
+// System.err.println("maxX " + maxX + " maxY " + maxY);
float xzoom = (float)winWidth / maxX;
float yzoom = (float)winHeight / maxY;
@@ -4522,7 +4520,7 @@ public class Canvas3D extends Canvas {
float texMinU = 0, texMinV = 0, texMaxU = 0, texMaxV = 0, adjustV = 0;
float mapMinX = 0, mapMinY = 0, mapMaxX = 0, mapMaxY = 0;
float halfWidth = 0, halfHeight = 0;
- int i = 0, j = 0;
+
switch (bg.imageScaleMode) {
case Background.SCALE_NONE:
texMinU = 0.0f;
@@ -4584,12 +4582,11 @@ public class Canvas3D extends Canvas {
mapMaxY = 1.0f;
break;
case Background.SCALE_REPEAT:
- i = winWidth/width;
- j = winHeight/height;
+
texMinU = 0.0f;
- texMinV = (float)(j + 1) - yzoom;
+ texMinV = - yzoom;
texMaxU = xzoom;
- texMaxV = (float)(j + 1);
+ texMaxV = 0.0f;
mapMinX = -1.0f;
mapMinY = -1.0f;
mapMaxX = 1.0f;
@@ -4622,6 +4619,8 @@ public class Canvas3D extends Canvas {
break;
}
+// System.err.println("Java 3D : mapMinX " + mapMinX + " mapMinY " + mapMinY +
+// " mapMaxX " + mapMaxX + " mapMaxY " + mapMaxY);
textureFillBackground(ctx, texMinU, texMaxU, texMinV, texMaxV,
mapMinX, mapMaxX, mapMinY, mapMaxY);