diff options
Diffstat (limited to 'src/native/d3d')
-rw-r--r-- | src/native/d3d/Canvas3D.cpp | 44 | ||||
-rw-r--r-- | src/native/d3d/D3dUtil.cpp | 6 | ||||
-rw-r--r-- | src/native/d3d/GraphicsContext3D.cpp | 2 |
3 files changed, 40 insertions, 12 deletions
diff --git a/src/native/d3d/Canvas3D.cpp b/src/native/d3d/Canvas3D.cpp index dbe7042..ea84d95 100644 --- a/src/native/d3d/Canvas3D.cpp +++ b/src/native/d3d/Canvas3D.cpp @@ -352,7 +352,8 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground( jfloat mapMinX, jfloat mapMaxX, jfloat mapMinY, - jfloat mapMaxY) + jfloat mapMaxY, + jboolean useBilinearFilter) { DWORD alphaTest, alphaBlend, cull, zBuffer, @@ -398,12 +399,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground( d3dCtx->texUnitStage, d3dCtx->bindTextureIdLen); } return; - } - - device->SetTextureStageState(tus, - D3DTSS_TEXCOORDINDEX, - D3DTSS_TCI_PASSTHRU); - + } if (d3dCtx->texTransformSet[tus]) { device->GetTransform((D3DTRANSFORMSTATETYPE) @@ -415,6 +411,24 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground( &identityMatrix); } + // TextureStage will be restore by caller. + device->SetTextureStageState(tus, + D3DTSS_TEXCOORDINDEX, + D3DTSS_TCI_PASSTHRU); + + /* Setup filter mode if needed */ + if(useBilinearFilter) { + /* fprintf(stderr, "Background : use bilinear filter\n"); */ + device->SetSamplerState (tus, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); + device->SetSamplerState (tus, D3DSAMP_MIPFILTER, D3DTEXF_POINT); + device->SetSamplerState (tus, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); + } + /* For debugging only + else { + fprintf(stderr, "Background : Not use bilinear filter\n"); + } + */ + device->GetTransform(D3DTS_PROJECTION, &ptm); device->GetTransform(D3DTS_WORLD, &wtm); device->GetTransform(D3DTS_VIEW, &vtm); @@ -526,7 +540,8 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillRaster(JNIEnv *env, jfloat mapMinY, jfloat mapMaxY, jfloat mapZ, - jfloat alpha) + jfloat alpha, + jboolean useBilinearFilter) { DWORD cull, lighting; @@ -558,6 +573,19 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillRaster(JNIEnv *env, device->SetTextureStageState(tus, D3DTSS_ALPHAOP, D3DTOP_MODULATE); device->SetTextureStageState(tus, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); device->SetTextureStageState(tus, D3DTSS_ALPHAARG2, D3DTA_CURRENT); + + /* Setup filter mode if needed */ + if(useBilinearFilter) { + /* fprintf(stderr, "Raster : use bilinear filter\n"); */ + device->SetSamplerState (tus, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); + device->SetSamplerState (tus, D3DSAMP_MIPFILTER, D3DTEXF_POINT); + device->SetSamplerState (tus, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); + } + /* For debugging only + else { + fprintf(stderr, "Raster : Not use bilinear filter\n"); + } + */ device->GetTransform(D3DTS_PROJECTION, &ptm); device->GetTransform(D3DTS_WORLD, &wtm); diff --git a/src/native/d3d/D3dUtil.cpp b/src/native/d3d/D3dUtil.cpp index 6b5c1df..55e6ded 100644 --- a/src/native/d3d/D3dUtil.cpp +++ b/src/native/d3d/D3dUtil.cpp @@ -941,7 +941,7 @@ void copyDataFromSurface(jint imageFormat, dstPitch = subWidth << 2; destRow += (subHeight-1)*dstPitch; - printf("[Java 3D] copyDataFromSurface: (1) %d\n", ddpf.dwRGBBitCount); + /* printf("[Java 3D] copyDataFromSurface: (1) %d\n", ddpf.dwRGBBitCount); */ if ((ddpf.dwRGBBitCount == 32) && (ddpf.dwRBitMask == 0xff0000) && @@ -1044,14 +1044,14 @@ void copyDataFromSurface(jint imageFormat, destRow -= dstPitch; } } else if (ddpf.dwRGBBitCount <= 8) { - printf("[Java 3D] copyDataFromSurface: Format on (8 bits or less surface) not support %d\n", imageFormat); + /* printf("[Java 3D] copyDataFromSurface: Format on (8 bits or less surface) not support %d\n", imageFormat); */ } } } else if ((imageFormat == IMAGE_FORMAT_BYTE_RGBA) || (imageFormat == IMAGE_FORMAT_BYTE_RGB) || (imageFormat == IMAGE_FORMAT_INT_BGR)) { - printf("[Java 3D] copyDataFromSurface: (2) %d\n", ddpf.dwRGBBitCount); + /* printf("[Java 3D] copyDataFromSurface: (2) %d\n", ddpf.dwRGBBitCount); */ dstPitch = subWidth << 2; destRow += (subHeight-1)*dstPitch; diff --git a/src/native/d3d/GraphicsContext3D.cpp b/src/native/d3d/GraphicsContext3D.cpp index 3b4f018..052e80e 100644 --- a/src/native/d3d/GraphicsContext3D.cpp +++ b/src/native/d3d/GraphicsContext3D.cpp @@ -26,7 +26,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_readRaster( GetDevice(); - printf("[GraphicsContext3D] readRaster ...\n"); + /* printf("[GraphicsContext3D] readRaster ...\n"); */ if ((type & javax_media_j3d_Raster_RASTER_COLOR) != 0) { |