diff options
author | Chien Yang <[email protected]> | 2007-03-21 22:54:08 +0000 |
---|---|---|
committer | Chien Yang <[email protected]> | 2007-03-21 22:54:08 +0000 |
commit | 9327277a80d538abf0fe638065a22b16be9be8bd (patch) | |
tree | bee4bc6043d6909a1bc117eed9dc15a2b6bd9ea0 /src/native/d3d | |
parent | 48f2ad8638b490854eebcfa07ea59b811189efd9 (diff) |
1) Implemented Issue 126 : Use OpenGL automatic mipmap generation
2) Fixed Issue 408 : Poor quality of auto-generated mipmaps
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@799 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native/d3d')
-rw-r--r-- | src/native/d3d/Attributes.cpp | 30 | ||||
-rw-r--r-- | src/native/d3d/Canvas3D.cpp | 4 | ||||
-rw-r--r-- | src/native/d3d/D3dUtil.cpp | 10 | ||||
-rw-r--r-- | src/native/d3d/D3dUtil.hpp | 3 |
4 files changed, 34 insertions, 13 deletions
diff --git a/src/native/d3d/Attributes.cpp b/src/native/d3d/Attributes.cpp index c3f6752..9540aac 100644 --- a/src/native/d3d/Attributes.cpp +++ b/src/native/d3d/Attributes.cpp @@ -2205,8 +2205,10 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DSubImage( jint width, jint height, jint dataType, - jobject data) + jobject data, + jboolean useAutoMipMap) { + /* Note: useAutoMipMap is not use for SubImage in the d3d pipe */ GetDevice(); if (d3dCtx->texUnitStage >= d3dCtx->bindTextureIdLen) { @@ -2284,7 +2286,8 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DImage( jint height, jint boundaryWidth, jint dataType, - jobject data) + jobject data, + jboolean useAutoMipMap) { GetDevice(); @@ -2322,7 +2325,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DImage( if (surf == NULL) { // Need to create surface surf = createTextureSurface(d3dCtx, numLevels, textureFormat, - width, height); + width, height, useAutoMipMap); if (surf == NULL) { return; @@ -2529,9 +2532,11 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DImage( jint depth, jint boundaryWidth, jint dataType, - jobject data) + jobject data, + jboolean useAutoMipMap) { - + /* Note: useAutoMipMap is not use instead numLevel will be use for d3d pipe */ + GetDevice(); if (d3dCtx->deviceInfo->maxTextureDepth <= 0) { @@ -2655,8 +2660,11 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DSubImage( jint height, jint depth, jint dataType, - jobject data) + jobject data, + jboolean useAutoMipMap) { + /* Note: useAutoMipMap is not use for SubImage in the d3d pipe */ + GetDevice(); if ((d3dCtx->deviceInfo->maxTextureDepth <= 0) || @@ -2853,8 +2861,11 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapSubImage( jint width, jint height, jint dataType, - jobject data) + jobject data, + jboolean useAutoMipMap) { + /* Note: useAutoMipMap is not use for SubImage in the d3d pipe */ + GetDevice(); if (d3dCtx->texUnitStage >= d3dCtx->bindTextureIdLen) { @@ -2934,8 +2945,11 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapImage( jint height, jint boundaryWidth, jint dataType, - jobject data) + jobject data, + jboolean useAutoMipMap) { + /* Note: useAutoMipMap is not use instead numLevel will be use for d3d pipe */ + GetDevice(); if (d3dCtx->texUnitStage >= d3dCtx->bindTextureIdLen) { diff --git a/src/native/d3d/Canvas3D.cpp b/src/native/d3d/Canvas3D.cpp index 699895b..80eeeb7 100644 --- a/src/native/d3d/Canvas3D.cpp +++ b/src/native/d3d/Canvas3D.cpp @@ -202,7 +202,7 @@ jboolean JNICALL Java_javax_media_j3d_NativePipeline_initTexturemapping( Java_javax_media_j3d_NativePipeline_updateTexture2DImage(env, texture, ctx, 1, 0, J3D_RGBA, 0, texWidth, - texHeight, 0, 0, NULL); + texHeight, 0, 0, NULL, JNI_FALSE); return (d3dCtx->textureTable[objectId] != NULL); } @@ -235,7 +235,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_texturemapping( Java_javax_media_j3d_NativePipeline_updateTexture2DSubImage( env, texture, ctx, 0, minX, minY, J3D_RGBA, format, minX, minY, rasWidth, maxX-minX, maxY-minY, IMAGE_DATA_TYPE_BYTE_ARRAY, - byteData); + byteData, JNI_FALSE); LPDIRECT3DTEXTURE9 surf = d3dCtx->textureTable[objectId]; diff --git a/src/native/d3d/D3dUtil.cpp b/src/native/d3d/D3dUtil.cpp index 2ee0e40..0cc0057 100644 --- a/src/native/d3d/D3dUtil.cpp +++ b/src/native/d3d/D3dUtil.cpp @@ -759,11 +759,13 @@ DWORD firstBit(DWORD mask) LPDIRECT3DTEXTURE9 createTextureSurface(D3dCtx *d3dCtx, jint numLevels, jint textureFormat, - jint width, jint height) + jint width, jint height, + jboolean useAutoMipMap) { LPDIRECT3DTEXTURE9 pTexture; D3DFORMAT format; HRESULT hr; + DWORD usage = 0; LPDIRECT3DDEVICE9 pDevice = d3dCtx->pDevice; D3dDeviceInfo *deviceInfo = d3dCtx->deviceInfo; @@ -775,10 +777,14 @@ LPDIRECT3DTEXTURE9 createTextureSurface(D3dCtx *d3dCtx, getTexWidthHeight(deviceInfo, &width, &height); format = getTexFormat(textureFormat); + if (useAutoMipMap) { + usage |= D3DUSAGE_AUTOGENMIPMAP; + } + // If format not support, the utility function will adjust the // calling parameters automatically hr = D3DXCreateTexture(d3dCtx->pDevice, width, height, - numLevels, 0, format, D3DPOOL_MANAGED, + numLevels, usage, format, D3DPOOL_MANAGED, &pTexture); if (FAILED(hr)) { diff --git a/src/native/d3d/D3dUtil.hpp b/src/native/d3d/D3dUtil.hpp index e1035cb..b1a7560 100644 --- a/src/native/d3d/D3dUtil.hpp +++ b/src/native/d3d/D3dUtil.hpp @@ -145,7 +145,8 @@ extern LPDIRECT3DTEXTURE9 createTextureSurface(D3dCtx *d3dCtx, jint numLevels, jint internalFormat, jint width, - jint height); + jint height, + jboolean useAutoMipMap); extern LPDIRECT3DVOLUMETEXTURE9 createVolumeTexture(D3dCtx *d3dCtx, |