diff options
author | Kevin Rushforth <[email protected]> | 2006-09-29 18:04:13 +0000 |
---|---|---|
committer | Kevin Rushforth <[email protected]> | 2006-09-29 18:04:13 +0000 |
commit | 908d0fbb2ea26226165cd42f12abf0d27e4a3f53 (patch) | |
tree | 0258d2293efab8f4eafba39a528a3d2eedd0c3cb /src/native/d3d | |
parent | 0661a22dd9278b20856b13b08ff22d248119cf6b (diff) |
Merged dev-1_5 branch back to MAIN trunk
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@701 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native/d3d')
-rw-r--r-- | src/native/d3d/Attributes.cpp | 661 | ||||
-rw-r--r-- | src/native/d3d/Canvas3D.cpp | 432 | ||||
-rw-r--r-- | src/native/d3d/D3dCtx.cpp | 5 | ||||
-rw-r--r-- | src/native/d3d/D3dDriverInfo.cpp | 2 | ||||
-rw-r--r-- | src/native/d3d/D3dImageComponent.hpp | 7 | ||||
-rw-r--r-- | src/native/d3d/D3dUtil.cpp | 58 | ||||
-rw-r--r-- | src/native/d3d/D3dUtil.hpp | 1 | ||||
-rw-r--r-- | src/native/d3d/GeometryArrayRetained.cpp | 531 | ||||
-rw-r--r-- | src/native/d3d/GraphicsContext3D.cpp | 18 | ||||
-rw-r--r-- | src/native/d3d/Lights.cpp | 12 | ||||
-rw-r--r-- | src/native/d3d/NativeAPIInfo.c | 23 | ||||
-rw-r--r-- | src/native/d3d/NativeWSInfo.cpp | 92 | ||||
-rw-r--r-- | src/native/d3d/RasterRetained.cpp | 255 | ||||
-rw-r--r-- | src/native/d3d/build-windows-amd64-vc.xml | 64 | ||||
-rw-r--r-- | src/native/d3d/build-windows-i586-vc.xml | 4 |
15 files changed, 906 insertions, 1259 deletions
diff --git a/src/native/d3d/Attributes.cpp b/src/native/d3d/Attributes.cpp index a55c13f..8461c66 100644 --- a/src/native/d3d/Attributes.cpp +++ b/src/native/d3d/Attributes.cpp @@ -73,7 +73,7 @@ BOOL isLinePatternMessOutput = false; BOOL isTexBorderMessOutput = false; extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_LinearFogRetained_update( +void JNICALL Java_javax_media_j3d_NativePipeline_updateLinearFog( JNIEnv *env, jobject obj, jlong ctx, @@ -104,7 +104,7 @@ void JNICALL Java_javax_media_j3d_LinearFogRetained_update( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_ExponentialFogRetained_update( +void JNICALL Java_javax_media_j3d_NativePipeline_updateExponentialFog( JNIEnv *env, jobject obj, jlong ctx, @@ -129,7 +129,7 @@ void JNICALL Java_javax_media_j3d_ExponentialFogRetained_update( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_ModelClipRetained_update( +void JNICALL Java_javax_media_j3d_NativePipeline_updateModelClip( JNIEnv *env, jobject obj, jlong ctx, @@ -164,7 +164,7 @@ void JNICALL Java_javax_media_j3d_ModelClipRetained_update( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setModelViewMatrix( +void JNICALL Java_javax_media_j3d_NativePipeline_setModelViewMatrix( JNIEnv * env, jobject obj, jlong ctx, @@ -206,7 +206,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setModelViewMatrix( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setProjectionMatrix( +void JNICALL Java_javax_media_j3d_NativePipeline_setProjectionMatrix( JNIEnv * env, jobject obj, jlong ctx, @@ -291,7 +291,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setProjectionMatrix( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setViewport( +void JNICALL Java_javax_media_j3d_NativePipeline_setViewport( JNIEnv *env, jobject obj, jlong ctx, @@ -313,7 +313,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setViewport( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setSceneAmbient( +void JNICALL Java_javax_media_j3d_NativePipeline_setSceneAmbient( JNIEnv *env, jobject obj, jlong ctx, @@ -333,7 +333,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setSceneAmbient( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setLightEnables( +void JNICALL Java_javax_media_j3d_NativePipeline_setLightEnables( JNIEnv *env, jobject obj, jlong ctx, @@ -351,7 +351,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setLightEnables( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setLightingEnable( +void JNICALL Java_javax_media_j3d_NativePipeline_setLightingEnable( JNIEnv *env, jobject obj, jlong ctx, @@ -365,7 +365,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setLightingEnable( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_disableFog( +void JNICALL Java_javax_media_j3d_NativePipeline_disableFog( JNIEnv *env, jobject obj, jlong ctx) @@ -375,7 +375,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_disableFog( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_disableModelClip( +void JNICALL Java_javax_media_j3d_NativePipeline_disableModelClip( JNIEnv *env, jobject obj, jlong ctx) @@ -491,7 +491,7 @@ DWORD getDepthFunc(jint func) extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_resetRenderingAttributes( +void JNICALL Java_javax_media_j3d_NativePipeline_resetRenderingAttributes( JNIEnv *env, jobject obj, jlong ctx, @@ -535,7 +535,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetRenderingAttributes( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_RenderingAttributesRetained_updateNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updateRenderingAttributes( JNIEnv *env, jobject obj, jlong ctx, @@ -670,7 +670,7 @@ void JNICALL Java_javax_media_j3d_RenderingAttributesRetained_updateNative( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_resetPolygonAttributes( +void JNICALL Java_javax_media_j3d_NativePipeline_resetPolygonAttributes( JNIEnv *env, jobject obj, jlong ctx) @@ -687,7 +687,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetPolygonAttributes( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_PolygonAttributesRetained_updateNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updatePolygonAttributes( JNIEnv *env, jobject obj, jlong ctx, @@ -782,7 +782,7 @@ void printDepthFunc(jint func) */ extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_resetLineAttributes( +void JNICALL Java_javax_media_j3d_NativePipeline_resetLineAttributes( JNIEnv *env, jobject obj, jlong ctx) @@ -807,7 +807,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetLineAttributes( // Note that some graphics card don't support it. // In this case use RGB Emulation. extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_LineAttributesRetained_updateNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updateLineAttributes( JNIEnv *env, jobject obj, jlong ctx, @@ -877,7 +877,7 @@ void JNICALL Java_javax_media_j3d_LineAttributesRetained_updateNative( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_resetPointAttributes( +void JNICALL Java_javax_media_j3d_NativePipeline_resetPointAttributes( JNIEnv *env, jobject obj, jlong ctx) @@ -891,7 +891,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetPointAttributes( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_PointAttributesRetained_updateNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updatePointAttributes( JNIEnv *env, jobject obj, jlong ctx, @@ -919,7 +919,7 @@ void JNICALL Java_javax_media_j3d_PointAttributesRetained_updateNative( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_resetTexCoordGeneration( +void JNICALL Java_javax_media_j3d_NativePipeline_resetTexCoordGeneration( JNIEnv *env, jobject obj, jlong ctx) @@ -947,7 +947,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetTexCoordGeneration( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TexCoordGenerationRetained_updateNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexCoordGeneration( JNIEnv *env, jobject obj, jlong ctx, @@ -1110,7 +1110,7 @@ void JNICALL Java_javax_media_j3d_TexCoordGenerationRetained_updateNative( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_resetTextureAttributes( +void JNICALL Java_javax_media_j3d_NativePipeline_resetTextureAttributes( JNIEnv *env, jobject obj, jlong ctx) @@ -1143,7 +1143,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetTextureAttributes( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureAttributes( JNIEnv *env, jobject obj, jlong ctx, @@ -1408,54 +1408,54 @@ void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateNative( } -// This procedure is invoked after Blend2Pass to restore the original value -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureAttributesRetained_restoreBlend1Pass( - JNIEnv *env, - jobject obj, - jlong ctx) -{ - GetDevice(); +// // This procedure is invoked after Blend2Pass to restore the original value +// extern "C" JNIEXPORT +// void JNICALL Java_javax_media_j3d_NativePipeline_restoreBlend1Pass( +// JNIEnv *env, +// jobject obj, +// jlong ctx) +// { +// GetDevice(); - device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); - device->SetTextureStageState(0, D3DTSS_COLORARG1, - D3DTA_TEXTURE|D3DTA_COMPLEMENT); - device->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT); +// device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); +// device->SetTextureStageState(0, D3DTSS_COLORARG1, +// D3DTA_TEXTURE|D3DTA_COMPLEMENT); +// device->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT); - device->SetRenderState(D3DRS_SRCBLEND, - d3dCtx->srcBlendFunc); - device->SetRenderState(D3DRS_DESTBLEND, - d3dCtx->dstBlendFunc); - device->SetRenderState(D3DRS_ALPHABLENDENABLE, - d3dCtx->blendEnable); -} +// device->SetRenderState(D3DRS_SRCBLEND, +// d3dCtx->srcBlendFunc); +// device->SetRenderState(D3DRS_DESTBLEND, +// d3dCtx->dstBlendFunc); +// device->SetRenderState(D3DRS_ALPHABLENDENABLE, +// d3dCtx->blendEnable); +// } -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateBlend2Pass( - JNIEnv *env, - jobject obj, - jlong ctx) -{ - GetDevice(); - device->GetRenderState(D3DRS_SRCBLEND, - &d3dCtx->srcBlendFunc); - device->GetRenderState(D3DRS_DESTBLEND, - &d3dCtx->dstBlendFunc); - device->GetRenderState(D3DRS_ALPHABLENDENABLE, - &d3dCtx->blendEnable); +// extern "C" JNIEXPORT +// void JNICALL Java_javax_media_j3d_NativePipeline_updateBlend2Pass( +// JNIEnv *env, +// jobject obj, +// jlong ctx) +// { +// GetDevice(); +// device->GetRenderState(D3DRS_SRCBLEND, +// &d3dCtx->srcBlendFunc); +// device->GetRenderState(D3DRS_DESTBLEND, +// &d3dCtx->dstBlendFunc); +// device->GetRenderState(D3DRS_ALPHABLENDENABLE, +// &d3dCtx->blendEnable); - device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); - device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); - device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); - device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); - device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); - device->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR); -} +// device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); +// device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); +// device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); +// device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); +// device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); +// device->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR); +// } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateCombinerNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updateCombiner( JNIEnv *env, jobject obj, jlong ctx, @@ -1524,7 +1524,7 @@ void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateCombinerNative } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateTextureColorTableNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureColorTable( JNIEnv *env, jobject obj, jlong ctx, @@ -1537,7 +1537,7 @@ void JNICALL Java_javax_media_j3d_TextureAttributesRetained_updateTextureColorTa extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_updateMaterial( +void JNICALL Java_javax_media_j3d_NativePipeline_updateMaterialColor( JNIEnv *env, jobject obj, jlong ctx, @@ -1569,7 +1569,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_updateMaterial( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_MaterialRetained_updateNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updateMaterial( JNIEnv *env, jobject obj, jlong ctx, @@ -1661,7 +1661,7 @@ void JNICALL Java_javax_media_j3d_MaterialRetained_updateNative( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_resetTransparency( +void JNICALL Java_javax_media_j3d_NativePipeline_resetTransparency( JNIEnv *env, jobject obj, jlong ctx, @@ -1690,7 +1690,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetTransparency( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TransparencyAttributesRetained_updateNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTransparencyAttributes( JNIEnv *env, jobject tr, jlong ctx, @@ -1736,7 +1736,7 @@ void JNICALL Java_javax_media_j3d_TransparencyAttributesRetained_updateNative( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_resetColoringAttributes( +void JNICALL Java_javax_media_j3d_NativePipeline_resetColoringAttributes( JNIEnv *env, jobject obj, jlong ctx, @@ -1761,7 +1761,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetColoringAttributes( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_ColoringAttributesRetained_updateNative( +void JNICALL Java_javax_media_j3d_NativePipeline_updateColoringAttributes( JNIEnv *env, jobject obj, jlong ctx, @@ -1799,9 +1799,9 @@ void JNICALL Java_javax_media_j3d_ColoringAttributesRetained_updateNative( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_resetTextureNative( +void JNICALL Java_javax_media_j3d_NativePipeline_resetTextureNative( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint texUnitIndex) { @@ -1841,9 +1841,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_resetTextureNative( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_bindTexture( +void JNICALL Java_javax_media_j3d_NativePipeline_bindTexture2D( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint objectId, jboolean enable) @@ -1893,9 +1893,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_bindTexture( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureFilterModes( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DFilterModes( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint minFilter, jint magFilter) @@ -1960,9 +1960,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureFilterModes( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureLodRange( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DLodRange( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint baseLevel, jint maximumLevel, @@ -1971,11 +1971,10 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureLodRange( { } - extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureLodOffset( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DLodOffset( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jfloat lodOffsetS, jfloat lodOffsetT, @@ -1985,7 +1984,7 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureLodOffset( } void updateTextureBoundary(JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint boundaryModeS, jint boundaryModeT, @@ -2083,9 +2082,9 @@ void updateTextureBoundary(JNIEnv *env, } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureBoundary( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DBoundary( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint boundaryModeS, jint boundaryModeT, @@ -2094,7 +2093,7 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureBoundary( jfloat boundaryBlue, jfloat boundaryAlpha) { - updateTextureBoundary(env, texture, ctx, boundaryModeS, + updateTextureBoundary(env, obj, ctx, boundaryModeS, boundaryModeT, -1, boundaryRed, boundaryGreen, boundaryBlue, boundaryAlpha); @@ -2103,9 +2102,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureBoundary( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureSharpenFunc( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DSharpenFunc( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint numPts, jfloatArray pts) @@ -2113,9 +2112,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureSharpenFunc( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureFilter4Func( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DFilter4Func( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint numPts, jfloatArray pts) @@ -2156,9 +2155,9 @@ void updateTextureAnisotropicFilter( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureAnisotropicFilter( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DAnisotropicFilter( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jfloat degree) { @@ -2167,9 +2166,9 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureAnisotropicFilter extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureAnisotropicFilter( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DAnisotropicFilter( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jfloat degree) { @@ -2182,9 +2181,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureAnisotropicFilt } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureAnisotropicFilter( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapAnisotropicFilter( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jfloat degree) { @@ -2193,21 +2192,22 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureAnisotropi extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureSubImage( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DSubImage( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint level, jint xoffset, jint yoffset, - jint internalFormat, - jint storedFormat, + jint textureFormat, + jint imageFormat, jint imgXOffset, jint imgYOffset, jint tilew, jint width, jint height, - jbyteArray image) + jint dataType, + jobject data) { GetDevice(); @@ -2232,44 +2232,60 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureSubImage( return; } + // TODO --- Need to re-write. Chien + void *imageObjPtr; + + /* Need to support INT, and NIO buffers -- Chien */ + + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + imageObjPtr = (void *) env->GetPrimitiveArrayCritical((jarray)data, NULL); + } + else { + imageObjPtr = (void *)env->GetDirectBufferAddress(data); + } + // update Image data - if (storedFormat != FORMAT_USHORT_GRAY) { - jbyte *byteData = (jbyte *) env->GetPrimitiveArrayCritical(image, NULL); - copyDataToSurface(storedFormat, internalFormat, xoffset, yoffset, + if (imageFormat != IMAGE_FORMAT_USHORT_GRAY) { + jbyte *byteData = (jbyte *) imageObjPtr; + copyDataToSurface(imageFormat, textureFormat, xoffset, yoffset, imgXOffset, imgYOffset, width, height, tilew, byteData, surf, level); - env->ReleasePrimitiveArrayCritical(image, byteData, 0); - } else { + /* jshort *shortData = (jshort *) env->GetPrimitiveArrayCritical(image, NULL); - copyDataToSurface(storedFormat, internalFormat, xoffset, yoffset, + copyDataToSurface(imageFormat, textureFormat, xoffset, yoffset, imgXOffset, imgYOffset, width, height, tilew, shortData, surf, level); env->ReleasePrimitiveArrayCritical(image, shortData, 0); + */ + } + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + env->ReleasePrimitiveArrayCritical((jarray)data, imageObjPtr, 0); } } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureImage( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture2DImage( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint numLevels, jint level, - jint internalFormat, - jint format, + jint textureFormat, + jint imageFormat, jint width, jint height, jint boundaryWidth, - jbyteArray imageYup) + jint dataType, + jobject data) { GetDevice(); - - if (d3dCtx->texUnitStage >= d3dCtx->bindTextureIdLen) { if (debug) { printf("Internal Error: texUnitState %d, bindTextureIDLen %d\n", @@ -2304,7 +2320,7 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureImage( if (surf == NULL) { // Need to create surface - surf = createTextureSurface(d3dCtx, numLevels, internalFormat, + surf = createTextureSurface(d3dCtx, numLevels, textureFormat, width, height); if (surf == NULL) { @@ -2326,99 +2342,48 @@ void JNICALL Java_javax_media_j3d_TextureRetained_updateTextureImage( return; } + // TODO --- Need to re-write. Chien // update Image data - if (imageYup != NULL) { - if (format != FORMAT_USHORT_GRAY) { - jbyte *byteData = (jbyte *) env->GetPrimitiveArrayCritical(imageYup, NULL); - copyDataToSurface(format, internalFormat, 0, 0, 0, 0, + if (data != NULL) { + void *imageObjPtr; + + /* Need to support INT, and NIO buffers -- Chien */ + + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + imageObjPtr = (void *) env->GetPrimitiveArrayCritical((jarray)data, NULL); + } + else { + imageObjPtr = (void *)env->GetDirectBufferAddress(data); + } + + if (imageFormat != IMAGE_FORMAT_USHORT_GRAY) { + jbyte *byteData = (jbyte *) imageObjPtr; + copyDataToSurface(imageFormat, textureFormat, 0, 0, 0, 0, width, height, width, byteData, surf, level); - env->ReleasePrimitiveArrayCritical(imageYup, byteData, 0); - } else { + /* jshort *shortData = (jshort *) env->GetPrimitiveArrayCritical(imageYup, NULL); - copyDataToSurface(format, internalFormat, 0, 0, 0, 0, + copyDataToSurface(imageFormat, textureFormat, 0, 0, 0, 0, width, height, width, shortData, surf, level); env->ReleasePrimitiveArrayCritical(imageYup, shortData, 0); + */ } - } - + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + env->ReleasePrimitiveArrayCritical((jarray)data, imageObjPtr, 0); + } + } device->SetTexture(d3dCtx->texUnitStage, surf); } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture2DRetained_bindTexture( +void JNICALL Java_javax_media_j3d_NativePipeline_bindTexture3D( JNIEnv *env, - jobject texture, - jlong ctx, - jint objectId, - jboolean enable) -{ - Java_javax_media_j3d_TextureRetained_bindTexture(env, texture, - ctx, objectId, enable); -} - -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture2DRetained_updateTextureSubImage( - JNIEnv *env, - jobject texture, - jlong ctx, - jint level, - jint xoffset, - jint yoffset, - jint internalFormat, - jint storedFormat, - jint imgXOffset, - jint imgYOffset, - jint tilew, - jint width, - jint height, - jbyteArray image) -{ - Java_javax_media_j3d_TextureRetained_updateTextureSubImage( - env, texture, ctx, level, xoffset, yoffset, internalFormat, - storedFormat, imgXOffset, imgYOffset, tilew, width, height, image); -} - -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture2DRetained_updateTextureImage( - JNIEnv *env, - jobject texture, - jlong ctx, - jint numLevels, - jint level, - jint internalFormat, - jint format, - jint width, - jint height, - jint boundaryWidth, - jbyteArray imageYup) -{ - Java_javax_media_j3d_TextureRetained_updateTextureImage(env, texture, - ctx, numLevels, level, internalFormat, format, - width, height, boundaryWidth, imageYup); -} - - -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture2DRetained_updateDetailTextureParameters( - JNIEnv *env, - jobject texture, - jlong ctx, - jint detailTextureMode, - jint detailTextureLevel, - jint numPts, - jfloatArray funcPts) -{ - // Not support -} - -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture3DRetained_bindTexture( - JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint objectId, jboolean enable) @@ -2471,9 +2436,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_bindTexture( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureFilterModes( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DFilterModes( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint minFilter, jint magFilter) @@ -2481,15 +2446,15 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureFilterModes( GetCtx(); if (d3dCtx->deviceInfo->maxTextureDepth > 0) { - Java_javax_media_j3d_TextureRetained_updateTextureFilterModes( - env, texture, ctx, minFilter, magFilter); + Java_javax_media_j3d_NativePipeline_updateTexture2DFilterModes( + env, obj, ctx, minFilter, magFilter); } } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureLodRange( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DLodRange( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint baseLevel, jint maximumLevel, @@ -2501,9 +2466,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureLodRange( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureLodOffset( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DLodOffset( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jfloat lodOffsetS, jfloat lodOffsetT, @@ -2514,9 +2479,9 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureLodOffset( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureBoundary( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DBoundary( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint boundaryModeS, jint boundaryModeT, @@ -2532,7 +2497,7 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureBoundary( if (d3dCtx->deviceInfo->maxTextureDepth > 0) { updateTextureBoundary( - env, texture, ctx, + env, obj, ctx, boundaryModeS, boundaryModeT, boundaryModeR, @@ -2546,19 +2511,20 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureBoundary( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureImage( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DImage( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint numLevels, jint level, - jint internalFormat, - jint format, + jint textureFormat, + jint imageFormat, jint width, jint height, jint depth, jint boundaryWidth, - jbyteArray imageYup) + jint dataType, + jobject data) { GetDevice(); @@ -2600,7 +2566,7 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureImage( } if (surf == NULL) { - surf = createVolumeTexture(d3dCtx, numLevels, internalFormat, + surf = createVolumeTexture(d3dCtx, numLevels, textureFormat, width, height, depth); if (surf == NULL) { return; @@ -2621,21 +2587,40 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureImage( return; } + // TODO --- Need to re-write. Chien // update Image data - if (imageYup != NULL) { - if (format != FORMAT_USHORT_GRAY) { - jbyte *byteData = (jbyte *) env->GetPrimitiveArrayCritical(imageYup, NULL); - copyDataToVolume(format, internalFormat, 0, 0, 0, 0, 0, 0, + if (data != NULL) { + void *imageObjPtr; + + /* Need to support INT, and NIO buffers -- Chien */ + + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + imageObjPtr = (void *) env->GetPrimitiveArrayCritical((jarray)data, NULL); + } + else { + imageObjPtr = (void *)env->GetDirectBufferAddress(data); + } + + if (imageFormat != IMAGE_FORMAT_USHORT_GRAY) { + jbyte *byteData = (jbyte *) imageObjPtr; + copyDataToVolume(imageFormat, textureFormat, 0, 0, 0, 0, 0, 0, width, height, depth, width, height, byteData, surf, level); - env->ReleasePrimitiveArrayCritical(imageYup, byteData, 0); } else { + /* jshort *shortData = (jshort *) env->GetPrimitiveArrayCritical(imageYup, NULL); - copyDataToVolume(format, internalFormat, 0, 0, 0, 0, 0, 0, + copyDataToVolume(imageFormat, textureFormat, 0, 0, 0, 0, 0, 0, width, height, depth, width, height, shortData, surf, level); env->ReleasePrimitiveArrayCritical(imageYup, shortData, 0); + */ + } + + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + env->ReleasePrimitiveArrayCritical((jarray)data, imageObjPtr, 0); } } device->SetTexture(d3dCtx->texUnitStage, surf); @@ -2643,16 +2628,16 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureImage( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureSubImage( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DSubImage( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint level, jint xoffset, jint yoffset, jint zoffset, - jint internalFormat, - jint storedFormat, + jint textureFormat, + jint imageFormat, jint imgXOffset, jint imgYOffset, jint imgZOffset, @@ -2661,7 +2646,8 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureSubImage( jint width, jint height, jint depth, - jbyteArray image) + jint dataType, + jobject data) { GetDevice(); @@ -2687,32 +2673,49 @@ void JNICALL Java_javax_media_j3d_Texture3DRetained_updateTextureSubImage( return; } + // TODO --- Need to re-write. Chien + void *imageObjPtr; + + /* Need to support INT, and NIO buffers -- Chien */ + + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + imageObjPtr = (void *) env->GetPrimitiveArrayCritical((jarray)data, NULL); + } + else { + imageObjPtr = (void *)env->GetDirectBufferAddress(data); + } + // update Image data - if (storedFormat != FORMAT_USHORT_GRAY) { - jbyte *byteData = (jbyte *) env->GetPrimitiveArrayCritical(image, NULL); - copyDataToVolume(storedFormat, internalFormat, xoffset, + if (imageFormat != IMAGE_FORMAT_USHORT_GRAY) { + jbyte *byteData = (jbyte *) imageObjPtr; + copyDataToVolume(imageFormat, textureFormat, xoffset, yoffset, zoffset, imgXOffset, imgYOffset, imgZOffset, width, height, depth, tilew, tileh, byteData, surf, level); - env->ReleasePrimitiveArrayCritical(image, byteData, 0); - } else { + /* jshort *shortData = (jshort *) env->GetPrimitiveArrayCritical(image, NULL); - copyDataToVolume(storedFormat, internalFormat, xoffset, + copyDataToVolume(imageFormat, textureFormat, xoffset, yoffset, zoffset, imgXOffset, imgYOffset, imgZOffset, width, height, depth, tilew, tileh, shortData, surf, level); env->ReleasePrimitiveArrayCritical(image, shortData, 0); + */ + } + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + env->ReleasePrimitiveArrayCritical((jarray)data, imageObjPtr, 0); } } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_bindTexture( +void JNICALL Java_javax_media_j3d_NativePipeline_bindTextureCubeMap( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint objectId, jboolean enable) @@ -2764,22 +2767,22 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_bindTexture( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureFilterModes( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapFilterModes( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint minFilter, jint magFilter) { - Java_javax_media_j3d_TextureRetained_updateTextureFilterModes(env, - texture, ctx, minFilter, magFilter); + Java_javax_media_j3d_NativePipeline_updateTexture2DFilterModes(env, + obj, ctx, minFilter, magFilter); } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureLodRange( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapLodRange( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint baseLevel, jint maximumLevel, @@ -2791,9 +2794,9 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureLodRange( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureLodOffset( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapLodOffset( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jfloat lodOffsetS, jfloat lodOffsetT, @@ -2804,9 +2807,9 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureLodOffset( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureBoundary( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapBoundary( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint boundaryModeS, jint boundaryModeT, @@ -2815,7 +2818,7 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureBoundary( jfloat boundaryBlue, jfloat boundaryAlpha) { - updateTextureBoundary(env, texture, ctx, boundaryModeS, + updateTextureBoundary(env, obj, ctx, boundaryModeS, boundaryModeT, -1, boundaryRed, boundaryGreen, boundaryBlue, boundaryAlpha); @@ -2823,22 +2826,23 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureBoundary( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureSubImage( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapSubImage( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint face, jint level, jint xoffset, jint yoffset, - jint internalFormat, - jint storedFormat, + jint textureFormat, + jint imageFormat, jint imgXOffset, jint imgYOffset, jint tilew, jint width, jint height, - jbyteArray image) + jint dataType, + jobject data) { GetDevice(); @@ -2863,43 +2867,63 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureSubImage( return; } + // TODO --- Need to re-write. Chien + void *imageObjPtr; + + /* Need to support INT, and NIO buffers -- Chien */ + + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + imageObjPtr = (void *) env->GetPrimitiveArrayCritical((jarray)data, NULL); + } + else { + imageObjPtr = (void *)env->GetDirectBufferAddress(data); + } + // update Image data - if (storedFormat != FORMAT_USHORT_GRAY) { - jbyte *byteData = (jbyte *) env->GetPrimitiveArrayCritical(image, NULL); - copyDataToCubeMap(storedFormat, internalFormat, + if (imageFormat != IMAGE_FORMAT_USHORT_GRAY) { + jbyte *byteData = (jbyte *) imageObjPtr; + copyDataToCubeMap(imageFormat, textureFormat, xoffset, yoffset, imgXOffset, imgYOffset, width, height, tilew, byteData, surf, level, face); - env->ReleasePrimitiveArrayCritical(image, byteData, 0); } else { + /* jshort *shortData = (jshort *) env->GetPrimitiveArrayCritical(image, NULL); - copyDataToCubeMap(storedFormat, internalFormat, + copyDataToCubeMap(imageFormat, textureFormat, xoffset, yoffset, imgXOffset, imgYOffset, width, height, tilew, shortData, surf, level, face); env->ReleasePrimitiveArrayCritical(image, shortData, 0); + */ } + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + env->ReleasePrimitiveArrayCritical((jarray)data, imageObjPtr, 0); + } + } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureImage( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapImage( JNIEnv *env, - jobject texture, + jobject obj, jlong ctx, jint face, jint numLevels, jint level, - jint internalFormat, - jint format, + jint textureFormat, + jint imageFormat, jint width, jint height, jint boundaryWidth, - jbyteArray imageYup) + jint dataType, + jobject data) { GetDevice(); @@ -2937,7 +2961,7 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureImage( if (surf == NULL) { // Need to create surface - surf = createCubeMapTexture(d3dCtx, numLevels, internalFormat, + surf = createCubeMapTexture(d3dCtx, numLevels, textureFormat, width, height); if (surf == NULL) { return; @@ -2958,22 +2982,41 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureImage( return; } + // TODO --- Need to re-write. Chien // update Image data - if (imageYup != NULL) { - if (format != FORMAT_USHORT_GRAY) { - jbyte *byteData = (jbyte *) env->GetPrimitiveArrayCritical(imageYup, NULL); - copyDataToCubeMap(format, internalFormat, 0, 0, 0, 0, + if (data != NULL) { + void *imageObjPtr; + + /* Need to support INT, and NIO buffers -- Chien */ + + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + imageObjPtr = (void *) env->GetPrimitiveArrayCritical((jarray)data, NULL); + } + else { + imageObjPtr = (void *)env->GetDirectBufferAddress(data); + } + + if (imageFormat != IMAGE_FORMAT_USHORT_GRAY) { + jbyte *byteData = (jbyte *) imageObjPtr; + copyDataToCubeMap(imageFormat, textureFormat, 0, 0, 0, 0, width, height, width, byteData, surf, level, face); - env->ReleasePrimitiveArrayCritical(imageYup, byteData, 0); } else { + /* jshort *shortData = (jshort *) env->GetPrimitiveArrayCritical(imageYup, NULL); - copyDataToCubeMap(format, internalFormat, 0, 0, 0, 0, + copyDataToCubeMap(imageFormat, textureFormat, 0, 0, 0, 0, width, height, width, shortData, surf, level, face); env->ReleasePrimitiveArrayCritical(imageYup, shortData, 0); + */ + } + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || + (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + env->ReleasePrimitiveArrayCritical((jarray)data, imageObjPtr, 0); } + } device->SetTexture(d3dCtx->texUnitStage, surf); @@ -2981,34 +3024,7 @@ void JNICALL Java_javax_media_j3d_TextureCubeMapRetained_updateTextureImage( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_DetailTextureImage_bindTexture( - JNIEnv *env, - jobject texture, - jlong ctx, - jint objectId) -{ - // NOT SUPPORTED -} - -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_DetailTextureImage_updateTextureImage( - JNIEnv *env, - jobject texture, - jlong ctx, - jint numLevels, - jint level, - jint internalFormat, - jint format, - jint width, - jint height, - jint boundaryWidth, - jbyteArray imageYup) -{ - // NOT SUPPORTED -} - -extern "C" JNIEXPORT -jboolean JNICALL Java_javax_media_j3d_Canvas3D_decal1stChildSetup( +jboolean JNICALL Java_javax_media_j3d_NativePipeline_decal1stChildSetup( JNIEnv *env, jobject obj, jlong ctx) @@ -3030,7 +3046,7 @@ jboolean JNICALL Java_javax_media_j3d_Canvas3D_decal1stChildSetup( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_decalNthChildSetup( +void JNICALL Java_javax_media_j3d_NativePipeline_decalNthChildSetup( JNIEnv *env, jobject obj, jlong ctx) @@ -3052,7 +3068,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_decalNthChildSetup( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_decalReset( +void JNICALL Java_javax_media_j3d_NativePipeline_decalReset( JNIEnv *env, jobject obj, jlong ctx, @@ -3069,7 +3085,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_decalReset( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_ctxUpdateEyeLightingEnable( +void JNICALL Java_javax_media_j3d_NativePipeline_ctxUpdateEyeLightingEnable( JNIEnv *env, jobject obj, jlong ctx, @@ -3080,7 +3096,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_ctxUpdateEyeLightingEnable( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_activeTextureUnit( +void JNICALL Java_javax_media_j3d_NativePipeline_activeTextureUnit( JNIEnv *env, jobject obj, jlong ctx, @@ -3097,7 +3113,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_activeTextureUnit( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_TextureUnitStateRetained_updateTextureUnitState( +void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureUnitState( JNIEnv *env, jobject obj, jlong ctx, @@ -3120,7 +3136,7 @@ void JNICALL Java_javax_media_j3d_TextureUnitStateRetained_updateTextureUnitStat } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setDepthFunc( +void JNICALL Java_javax_media_j3d_NativePipeline_setDepthFunc( JNIEnv * env, jobject obj, jlong ctx, @@ -3140,7 +3156,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setDepthFunc( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setBlendColor( +void JNICALL Java_javax_media_j3d_NativePipeline_setBlendColor( JNIEnv *env, jobject obj, jlong ctx, @@ -3154,7 +3170,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setBlendColor( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setBlendFunc( +void JNICALL Java_javax_media_j3d_NativePipeline_setBlendFunc( JNIEnv * env, jobject obj, jlong ctx, @@ -3171,7 +3187,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setBlendFunc( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setFogEnableFlag( +void JNICALL Java_javax_media_j3d_NativePipeline_setFogEnableFlag( JNIEnv * env, jobject obj, jlong ctx, @@ -3183,7 +3199,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setFogEnableFlag( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_updateSeparateSpecularColorEnable( +void JNICALL Java_javax_media_j3d_NativePipeline_updateSeparateSpecularColorEnable( JNIEnv *env, jobject obj, jlong ctx, @@ -3191,39 +3207,18 @@ void JNICALL Java_javax_media_j3d_Canvas3D_updateSeparateSpecularColorEnable( { } -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_updateTexUnitStateMap( - JNIEnv *env, - jobject obj, - jlong ctx, - jint numActiveTexUnit, - jintArray texUnitStateMapArray) -{ - if ((texUnitStateMapArray != NULL) && (numActiveTexUnit > 0)) { - GetDevice(); - - jint* texUnitStateMap = (jint *) env->GetPrimitiveArrayCritical( - texUnitStateMapArray, NULL); - int genMode; - int ts; - for (int i = 0; i < numActiveTexUnit; i++) { - genMode = setTextureStage(d3dCtx, device, i, texUnitStateMap[i]); - if (genMode != TEX_GEN_AUTO) { - ts = d3dCtx->texStride[i]; - if (ts == 0) { - /* - In multiTexture case when no tex defined in non object - linear mode. - */ - ts = d3dCtx->texCoordFormat[i]; - } - } else { - ts = d3dCtx->texCoordFormat[i]; - } - setTexTransformStageFlag(d3dCtx, device, i, ts, genMode); - } - env->ReleasePrimitiveArrayCritical(texUnitStateMapArray, - texUnitStateMap, 0); - } +// Fix issue 221 : Temporary stub until Cg is implemented +/* + * Class: javax_media_j3d_NativePipeline + * Method: loadNativeCgLibrary + * Signature: ([Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL +Java_javax_media_j3d_NativePipeline_loadNativeCgLibrary( + JNIEnv *env, + jobject thiz, + jobjectArray libpath) +{ + return JNI_FALSE; } diff --git a/src/native/d3d/Canvas3D.cpp b/src/native/d3d/Canvas3D.cpp index faeafbf..ba9c918 100644 --- a/src/native/d3d/Canvas3D.cpp +++ b/src/native/d3d/Canvas3D.cpp @@ -14,7 +14,7 @@ extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setDrawActive( +void JNICALL Java_javax_media_j3d_NativePipeline_setDrawActive( JNIEnv *env, jobject obj, jint fd) @@ -24,7 +24,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setDrawActive( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_widSync( +void JNICALL Java_javax_media_j3d_NativePipeline_widSync( JNIEnv *env, jobject obj, jint fd, @@ -36,7 +36,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_widSync( extern "C" JNIEXPORT -jboolean JNICALL Java_javax_media_j3d_Canvas3D_useSharedCtx( +jboolean JNICALL Java_javax_media_j3d_NativePipeline_useSharedCtx( JNIEnv *env, jobject obj) { @@ -46,12 +46,12 @@ jboolean JNICALL Java_javax_media_j3d_Canvas3D_useSharedCtx( extern "C" JNIEXPORT -jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext( +jlong JNICALL Java_javax_media_j3d_NativePipeline_createNewContext( JNIEnv *env, jobject obj, + jobject cv, jlong display, - jint window, - jint vid, + jlong window, jlong fbConfigListPtr, jlong sharedCtx, jboolean isSharedCtx, @@ -59,10 +59,11 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext( jboolean glslLibraryAvailable, jboolean cgLibraryAvailable) { - HWND hwnd = WindowFromDC(reinterpret_cast<HDC>(jlong(window))); + HWND hwnd = WindowFromDC(reinterpret_cast<HDC>(window)); lock(); - D3dCtx* ctx = new D3dCtx(env, obj, hwnd, offScreen, vid); + int vid = 0; // TODO: get needed info from fbConfigListPtr + D3dCtx* ctx = new D3dCtx(env, cv, hwnd, offScreen, vid); if (ctx == NULL) { printf("%s", getErrorMessage(OUTOFMEMORY)); unlock(); @@ -71,11 +72,11 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext( if (offScreen) { - jclass cls = (jclass) env->GetObjectClass(obj); + jclass cls = (jclass) env->GetObjectClass(cv); jfieldID fieldId = env->GetFieldID(cls, "offScreenCanvasSize", "Ljava/awt/Dimension;"); - jobject dimObj = env->GetObjectField(obj, fieldId); + jobject dimObj = env->GetObjectField(cv, fieldId); if (dimObj == NULL) { // user invoke queryProperties() @@ -92,7 +93,7 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext( } } - if (!ctx->initialize(env, obj)) + if (!ctx->initialize(env, cv)) { delete ctx; unlock(); @@ -106,12 +107,12 @@ jlong JNICALL Java_javax_media_j3d_Canvas3D_createNewContext( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext( +void JNICALL Java_javax_media_j3d_NativePipeline_createQueryContext( JNIEnv *env, jobject obj, + jobject cv, jlong display, - jint window, - jint vid, + jlong window, jlong fbConfigListPtr, jboolean offScreen, jint width, @@ -119,7 +120,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext( jboolean glslLibraryAvailable, jboolean cgLibraryAvailable) { - HWND hwnd = WindowFromDC(reinterpret_cast<HDC>(jlong(window))); + HWND hwnd = WindowFromDC(reinterpret_cast<HDC>(window)); lock(); // always use offscreen for property since it @@ -128,7 +129,8 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext( // instead of current window width/height to create // context. - D3dCtx* ctx = new D3dCtx(env, obj, hwnd, true, vid); + int vid = 0; // TODO: get needed info from fbConfigListPtr + D3dCtx* ctx = new D3dCtx(env, cv, hwnd, true, vid); if (ctx == NULL) { printf("%s", getErrorMessage(OUTOFMEMORY)); unlock(); @@ -138,18 +140,18 @@ void JNICALL Java_javax_media_j3d_Canvas3D_createQueryContext( ctx->offScreenWidth = width; ctx->offScreenHeight = height; - ctx->initialize(env, obj); + ctx->initialize(env, cv); delete ctx; unlock(); } extern "C" JNIEXPORT -jboolean JNICALL Java_javax_media_j3d_Canvas3D_useCtx( +jboolean JNICALL Java_javax_media_j3d_NativePipeline_useCtx( JNIEnv *env, - jclass cl, + jobject obj, jlong ctx, jlong display, - jint window) + jlong window) { return JNI_TRUE; // D3D doesn't have notation of current context @@ -157,7 +159,7 @@ jboolean JNICALL Java_javax_media_j3d_Canvas3D_useCtx( extern "C" JNIEXPORT -jint JNICALL Java_javax_media_j3d_Canvas3D_getNumCtxLights( +jint JNICALL Java_javax_media_j3d_NativePipeline_getNumCtxLights( JNIEnv *env, jobject obj, jlong ctx) @@ -173,43 +175,8 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_getNumCtxLights( return nlight; } - extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_composite( - JNIEnv *env, - jobject obj, - jlong ctx, - jint px, - jint py, - jint minX, - jint minY, - jint maxX, - jint maxY, - jint rasWidth, - jbyteArray imageYdown, - jint winWidth, - jint winHeight) - -{ - GetDevice(); - - // However we use the following texturemapping function instead - // so this will not invoke. - if (d3dCtx->backSurface == NULL) { - device->GetBackBuffer(0,0, D3DBACKBUFFER_TYPE_MONO,//iSwapChain is 0 - &d3dCtx->backSurface); - } - jbyte *byteData = (jbyte *) (env->GetPrimitiveArrayCritical( - imageYdown, NULL)); - compositeDataToSurface(px, py, - minX, minY, maxX-minX, maxY-minY, - rasWidth, - byteData, d3dCtx->backSurface); - env->ReleasePrimitiveArrayCritical(imageYdown, byteData, 0); -} - -extern "C" JNIEXPORT -jboolean JNICALL Java_javax_media_j3d_Canvas3D_initTexturemapping( +jboolean JNICALL Java_javax_media_j3d_NativePipeline_initTexturemapping( JNIEnv *env, jobject texture, jlong ctx, @@ -225,24 +192,29 @@ jboolean JNICALL Java_javax_media_j3d_Canvas3D_initTexturemapping( (d3dCtx->textureTable[objectId] != NULL)) { // delete the previous texture reference // when canvas resize - Java_javax_media_j3d_Canvas3D_freeTexture(env, + Java_javax_media_j3d_NativePipeline_freeTexture(env, NULL, ctx, objectId); } - Java_javax_media_j3d_TextureRetained_bindTexture( + Java_javax_media_j3d_NativePipeline_bindTexture2D( env, texture, ctx, objectId, TRUE); - Java_javax_media_j3d_TextureRetained_updateTextureImage( - env, texture, ctx, 1, 0, J3D_RGBA, 0, texWidth, texHeight, 0, NULL); - + /* TODO : This need to rewrite -- Chien. */ + /* + Java_javax_media_j3d_NativePipeline_updateTexture2DImage( + env, texture, ctx, 1, 0, J3D_RGBA, 0, texWidth, texHeight, 0, NULL); + */ + Java_javax_media_j3d_NativePipeline_updateTexture2DImage(env, texture, ctx, 1, 0, + J3D_RGBA, 0, texWidth, + texHeight, 0, 0, NULL); return (d3dCtx->textureTable[objectId] != NULL); } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_texturemapping( +void JNICALL Java_javax_media_j3d_NativePipeline_texturemapping( JNIEnv *env, jobject texture, jlong ctx, @@ -263,13 +235,14 @@ void JNICALL Java_javax_media_j3d_Canvas3D_texturemapping( { GetDevice(); - Java_javax_media_j3d_TextureRetained_bindTexture( + Java_javax_media_j3d_NativePipeline_bindTexture2D( env, texture, ctx, objectId, TRUE); - - Java_javax_media_j3d_Texture2DRetained_updateTextureSubImage( + // TODO --- Need to re-write. Chien + Java_javax_media_j3d_NativePipeline_updateTexture2DSubImage( env, texture, ctx, 0, minX, minY, J3D_RGBA, format, - minX, minY, rasWidth, maxX-minX, maxY-minY, imageYdown); + minX, minY, rasWidth, maxX-minX, maxY-minY, IMAGE_DATA_TYPE_BYTE_ARRAY, + imageYdown); LPDIRECT3DTEXTURE9 surf = d3dCtx->textureTable[objectId]; @@ -312,7 +285,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_texturemapping( minX, minY, maxX, maxY, maxX - minX, maxY - minY, false); - Java_javax_media_j3d_TextureRetained_bindTexture( + Java_javax_media_j3d_NativePipeline_bindTexture2D( env, texture, ctx, objectId, FALSE); device->SetRenderState(D3DRS_ALPHABLENDENABLE, blendEnable); @@ -325,19 +298,142 @@ void JNICALL Java_javax_media_j3d_Canvas3D_texturemapping( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_clear( - JNIEnv *env, - jobject obj, - jlong ctx, - jfloat r, - jfloat g, - jfloat b, - jint winWidth, - jint winHeight, - jobject pa2d, - jint imageScaleMode, - jbyteArray pixels_obj) +void JNICALL Java_javax_media_j3d_NativePipeline_clear( + JNIEnv *env, + jobject obj, + jlong ctx, + jfloat r, + jfloat g, + jfloat b) +{ + + GetDevice(); + + /* Java 3D always clears the Z-buffer */ + /* @TODO check same operation for stencil */ + + if (!d3dCtx->zWriteEnable) { + device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); + } + + /* clear stencil, if in used */ + if (d3dCtx->stencilWriteEnable ) { + // clear stencil and ZBuffer + HRESULT hr = device->Clear(0, NULL, + D3DCLEAR_STENCIL | D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, + D3DCOLOR_COLORVALUE(r, g, b, 1.0f), 1.0, 0); + if (hr == D3DERR_INVALIDCALL) { + printf("[Java3D] Error cleaning Canvas3D stencil & ZBuffer\n"); + } + // printf("canvas3D clear stencil & ZBuffer\n"); + } + else { + // clear ZBuffer only + HRESULT hr = device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, + D3DCOLOR_COLORVALUE(r, g, b, 1.0f), 1.0, 0); + if (hr == D3DERR_INVALIDCALL) { + printf("[Java3D] Error cleaning Canvas3D ZBuffer\n"); + } + // printf("canvas3D clear ZBuffer\n"); + } + + if (!d3dCtx->zWriteEnable) { + device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); + } + // disable stencil + if (d3dCtx->stencilEnable && !d3dCtx->stencilWriteEnable) { + device->SetRenderState(D3DRS_STENCILENABLE, FALSE); + } + +} + +extern "C" JNIEXPORT +void JNICALL Java_javax_media_j3d_NativePipeline_textureFill( + JNIEnv *env, + jobject obj, + jlong ctx, + jfloat texMinU, + jfloat texMaxU, + jfloat texMinV, + jfloat texMaxV, + jfloat mapMinX, + jfloat mapMaxX, + jfloat mapMinY, + jfloat mapMaxY) +{ + GetDevice(); + /* printf("Canvas3D.textureFill()\n"); */ + /* TODO : Implement textureFill() */ + printf("[Java3D] D3D : textureFill is not implemented yet.\n"); + + +} + +extern "C" JNIEXPORT +void JNICALL Java_javax_media_j3d_NativePipeline_textureFillRaster(JNIEnv *env, + jobject obj, + jlong ctx, + jfloat texMinU, + jfloat texMaxU, + jfloat texMinV, + jfloat texMaxV, + jfloat mapMinX, + jfloat mapMaxX, + jfloat mapMinY, + jfloat mapMaxY, + jfloat mapZ, + jfloat alpha) +{ + GetDevice(); + /* printf("Canvas3D.textureFillRaster()\n"); */ + /* TODO : Implement textureFillRaster() */ + printf("[Java3D] D3D : textureFillRaster is not implemented yet.\n"); + +} + + +JNIEXPORT +void JNICALL Java_javax_media_j3d_NativePipeline_executeRasterDepth(JNIEnv *env, + jobject obj, + jlong ctx, + jfloat posX, + jfloat posY, + jfloat posZ, + jint srcOffsetX, + jint srcOffsetY, + jint rasterWidth, + jint rasterHeight, + jint depthWidth, + jint depthHeight, + jint depthFormat, + jobject depthData) +{ + GetDevice(); + /* printf("Canvas3D.executeRasterDepth()\n"); */ + /* TODO : Implement executeRasterDepth() */ + printf("[Java3D] D3D : executeRasterDepth is not implemented yet.\n"); + +} + +/* TODO : This method will be replaced by clear() and textureFill() */ +extern "C" JNIEXPORT +void JNICALL Java_javax_media_j3d_NativePipeline_textureclear( + JNIEnv *env, + jobject obj, + jlong ctx, + jint maxX, + jint maxY, + jfloat r, + jfloat g, + jfloat b, + jint winWidth, + jint winHeight, + jint objectId, + jint imageScaleMode, + jobject pa2d, + jboolean update) { + GetDevice(); @@ -371,15 +467,10 @@ void JNICALL Java_javax_media_j3d_Canvas3D_clear( // printf("canvas3D clear ZBuffer\n"); } - + if (pa2d) { - jclass pa2d_class = env->GetObjectClass(pa2d); /* - jfieldID id = env->GetFieldID(pa2d_class, "surfaceDirty", "I"); - if (env->GetIntField(pa2d, id) == NOTLIVE) { - return; - } - */ + jclass pa2d_class = env->GetObjectClass(pa2d); // It is possible that (1) Another user thread will free this // image. (2) Another Renderer thread in case of multiple screen // will invoke clear() at the same time. @@ -392,6 +483,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_clear( D3dImageComponent *d3dImage = D3dImageComponent::find(&BackgroundImageList, d3dCtx, hashCode); + id = env->GetFieldID(pa2d_class, "imageYup", "[B"); + jbyteArray pixels_obj = (jbyteArray) env->GetObjectField(pa2d, id); + id = env->GetFieldID(pa2d_class, "width", "I"); int width = env->GetIntField(pa2d, id); id = env->GetFieldID(pa2d_class, "height", "I"); @@ -523,25 +617,24 @@ void JNICALL Java_javax_media_j3d_Canvas3D_clear( device->SetRenderState(D3DRS_STENCILENABLE, d3dCtx->stencilWriteEnable); } unlockBackground(); + */ } else { - if (!d3dCtx->zWriteEnable) { - device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); - } - // disable stencil - if (d3dCtx->stencilEnable && !d3dCtx->stencilWriteEnable) { - device->SetRenderState(D3DRS_STENCILENABLE, FALSE); - } - } - + if (!d3dCtx->zWriteEnable) { + device->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); + } + // disable stencil + if (d3dCtx->stencilEnable && !d3dCtx->stencilWriteEnable) { + device->SetRenderState(D3DRS_STENCILENABLE, FALSE); + } + } } - extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setRenderMode( +void JNICALL Java_javax_media_j3d_NativePipeline_setRenderMode( JNIEnv *env, jobject obj, jlong ctx, @@ -554,7 +647,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setRenderMode( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_clearAccum( +void JNICALL Java_javax_media_j3d_NativePipeline_clearAccum( JNIEnv *env, jobject obj, jlong ctx) @@ -566,7 +659,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_clearAccum( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_accum( +void JNICALL Java_javax_media_j3d_NativePipeline_accum( JNIEnv *env, jobject obj, jlong ctx, @@ -577,7 +670,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_accum( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_accumReturn( +void JNICALL Java_javax_media_j3d_NativePipeline_accumReturn( JNIEnv *env, jobject obj, jlong ctx) @@ -587,7 +680,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_accumReturn( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setDepthBufferWriteEnable( +void JNICALL Java_javax_media_j3d_NativePipeline_setDepthBufferWriteEnable( JNIEnv *env, jobject obj, jlong ctx, @@ -632,12 +725,13 @@ VOID freePointerList() extern "C" JNIEXPORT -jint JNICALL Java_javax_media_j3d_Canvas3D_swapBuffers( +jint JNICALL Java_javax_media_j3d_NativePipeline_swapBuffers( JNIEnv *env, jobject obj, + jobject cv, jlong ctx, jlong display, - jint win) + jlong window) { GetDevice2(); @@ -655,7 +749,7 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_swapBuffers( printf("Buffer swap error %s, try Reset() the surface... \n", DXGetErrorString9(hr)); } - retCode = d3dCtx->resetSurface(env, obj); + retCode = d3dCtx->resetSurface(env, cv); GetDevice2(); hr = device->Present(NULL, NULL, NULL, NULL); if (FAILED(hr)) { @@ -674,7 +768,7 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_swapBuffers( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_syncRender( +void JNICALL Java_javax_media_j3d_NativePipeline_syncRender( JNIEnv *env, jobject obj, jlong ctx, @@ -685,7 +779,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_syncRender( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_newDisplayList( +void JNICALL Java_javax_media_j3d_NativePipeline_newDisplayList( JNIEnv *env, jobject obj, jlong ctx, @@ -737,7 +831,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_newDisplayList( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_endDisplayList( +void JNICALL Java_javax_media_j3d_NativePipeline_endDisplayList( JNIEnv *env, jobject obj, jlong ctx) @@ -748,7 +842,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_endDisplayList( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_callDisplayList( +void JNICALL Java_javax_media_j3d_NativePipeline_callDisplayList( JNIEnv *env, jobject obj, jlong ctx, @@ -785,9 +879,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_callDisplayList( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_freeDisplayList( +void JNICALL Java_javax_media_j3d_NativePipeline_freeDisplayList( JNIEnv *env, - jclass cl, + jobject obj, jlong ctx, jint id) { @@ -810,9 +904,9 @@ void JNICALL Java_javax_media_j3d_Canvas3D_freeDisplayList( has been deleted by java garbage collector. */ extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_freeTexture( +void JNICALL Java_javax_media_j3d_NativePipeline_freeTexture( JNIEnv *env, - jclass cls, + jobject obj, jlong ctx, jint id) { @@ -839,28 +933,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_freeTexture( extern "C" JNIEXPORT -jboolean JNICALL Java_javax_media_j3d_Canvas3D_isTexture3DAvailable( - JNIEnv *env, - jobject obj, - jlong ctx) -{ - return JNI_FALSE; -} - - -extern "C" JNIEXPORT -jint JNICALL Java_javax_media_j3d_Canvas3D_getTextureColorTableSize( - JNIEnv *env, - jobject obj, - jlong ctx) -{ - // Not support by D3D - return 0; -} - - -extern "C" JNIEXPORT -jint JNICALL Java_javax_media_j3d_Canvas3D_getTextureUnitCount( +jint JNICALL Java_javax_media_j3d_NativePipeline_getTextureUnitCount( JNIEnv *env, jobject obj, jlong ctx) @@ -871,12 +944,12 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_getTextureUnitCount( extern "C" JNIEXPORT -jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer( +jlong JNICALL Java_javax_media_j3d_NativePipeline_createOffScreenBuffer( JNIEnv *env, jobject obj, + jobject cv, jlong ctx, jlong display, - jint window, jlong fbConfigListPtr, jint width, jint height) @@ -890,18 +963,18 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_createOffScreenBuffer( GetCtx2(); d3dCtx->d3dPresent.BackBufferWidth = width; d3dCtx->d3dPresent.BackBufferHeight = height; - return SUCCEEDED(d3dCtx->resetSurface(env, obj)); + return SUCCEEDED(d3dCtx->resetSurface(env, cv)); } } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_destroyContext( +void JNICALL Java_javax_media_j3d_NativePipeline_destroyContext( JNIEnv *env, - jclass cl, + jobject obj, jlong display, - jint window, + jlong window, jlong ctx) { GetDevice(); @@ -911,36 +984,45 @@ void JNICALL Java_javax_media_j3d_Canvas3D_destroyContext( delete d3dCtx; unlock(); - Java_javax_media_j3d_Renderer_D3DCleanUp(env, cl); + Java_javax_media_j3d_NativePipeline_cleanupRenderer(env, obj); } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_destroyOffScreenBuffer( +void JNICALL Java_javax_media_j3d_NativePipeline_destroyOffScreenBuffer( JNIEnv *env, jobject obj, + jobject cv, jlong ctx, jlong display, jlong fbConfigListPtr, - jint window) + jlong window) { // do nothing, since the old buffer will destory // in createOffScreenBuffer + + // TODO : this means that we will hold onto the last off-screen buffer; + // we should clean this up at some point } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_readOffScreenBuffer( +void JNICALL Java_javax_media_j3d_NativePipeline_readOffScreenBuffer( JNIEnv *env, jobject obj, + jobject cv, jlong ctx, jint format, + jint dataType, + jobject data, jint width, jint height) { + void *imageObjPtr; + GetDevice(); - if (format == FORMAT_USHORT_GRAY) { - printf("[Java 3D] readOffScreenBuffer not support FORMAT_USHORT_GRAY\n"); + if (format == IMAGE_FORMAT_USHORT_GRAY) { + printf("[Java 3D] readOffScreenBuffer not support IMAGE_FORMAT_USHORT_GRAY\n"); return; } @@ -954,32 +1036,43 @@ void JNICALL Java_javax_media_j3d_Canvas3D_readOffScreenBuffer( } } - jclass cv_class = env->GetObjectClass(obj); + /* TODO : Need to re-write --- Chien. */ + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + imageObjPtr = (void *)env->GetPrimitiveArrayCritical((jarray)data, NULL); + + /* TODO : Can't assume it is a byte array */ + copyDataFromSurface(format, 0, 0, width, height, (jbyte *)imageObjPtr, + d3dCtx->backSurface); + + + } + else { + imageObjPtr = (void *)env->GetDirectBufferAddress(data); + + /* TODO --- Do something .... */ + } - jfieldID byteData_field = env->GetFieldID(cv_class, "byteBuffer", "[B"); - jbyteArray byteData_array = (jbyteArray) env->GetObjectField(obj, byteData_field); - jbyte *byteData = (jbyte *) env->GetPrimitiveArrayCritical( - byteData_array, NULL); - copyDataFromSurface(format, 0, 0, width, height, byteData, - d3dCtx->backSurface); - env->ReleasePrimitiveArrayCritical(byteData_array, byteData, 0); - return; + if((dataType == IMAGE_DATA_TYPE_BYTE_ARRAY) || (dataType == IMAGE_DATA_TYPE_INT_ARRAY)) { + env->ReleasePrimitiveArrayCritical((jarray)data, imageObjPtr, 0); + } + return; } extern "C" JNIEXPORT -jint JNICALL Java_javax_media_j3d_Canvas3D_resizeD3DCanvas( +jint JNICALL Java_javax_media_j3d_NativePipeline_resizeD3DCanvas( JNIEnv *env, jobject obj, + jobject cv, jlong ctx) { int status; GetCtx2(); lock(); - status = d3dCtx->resize(env, obj); + status = d3dCtx->resize(env, cv); unlock(); return status; @@ -987,16 +1080,17 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_resizeD3DCanvas( extern "C" JNIEXPORT -jint JNICALL Java_javax_media_j3d_Canvas3D_toggleFullScreenMode( +jint JNICALL Java_javax_media_j3d_NativePipeline_toggleFullScreenMode( JNIEnv *env, jobject obj, + jobject cv, jlong ctx) { int status; GetCtx2(); lock(); - status = d3dCtx->toggleMode(!d3dCtx->bFullScreen, env, obj); + status = d3dCtx->toggleMode(!d3dCtx->bFullScreen, env, cv); unlock(); if (status == RECREATEDFAIL) { return RECREATEDDRAW; @@ -1005,7 +1099,7 @@ jint JNICALL Java_javax_media_j3d_Canvas3D_toggleFullScreenMode( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_setFullSceneAntialiasing( +void JNICALL Java_javax_media_j3d_NativePipeline_setFullSceneAntialiasing( JNIEnv *env, jobject obj, jlong ctx, @@ -1019,7 +1113,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_setFullSceneAntialiasing( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Renderer_D3DCleanUp( +void JNICALL Java_javax_media_j3d_NativePipeline_cleanupRenderer( JNIEnv *env, jobject obj) { @@ -1035,24 +1129,26 @@ void JNICALL Java_javax_media_j3d_Renderer_D3DCleanUp( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_ImageComponent2DRetained_freeD3DSurface( +void JNICALL Java_javax_media_j3d_NativePipeline_freeD3DSurface( JNIEnv *env, + jobject obj, jobject image, jint hashCode) { - + /* lockImage(); D3dImageComponent::remove(&RasterList, hashCode); unlockImage(); lockBackground(); D3dImageComponent::remove(&BackgroundImageList, hashCode); unlockBackground(); + */ } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_beginScene( +void JNICALL Java_javax_media_j3d_NativePipeline_beginScene( JNIEnv *env, jobject obj, jlong ctx) @@ -1063,7 +1159,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_beginScene( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_Canvas3D_endScene( +void JNICALL Java_javax_media_j3d_NativePipeline_endScene( JNIEnv *env, jobject obj, jlong ctx) @@ -1074,7 +1170,7 @@ void JNICALL Java_javax_media_j3d_Canvas3D_endScene( extern "C" JNIEXPORT -jboolean JNICALL Java_javax_media_j3d_Canvas3D_validGraphicsMode( +jboolean JNICALL Java_javax_media_j3d_NativePipeline_validGraphicsMode( JNIEnv *env, jobject obj) { @@ -1082,4 +1178,4 @@ jboolean JNICALL Java_javax_media_j3d_Canvas3D_validGraphicsMode( EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devMode); return (devMode.dmBitsPerPel > 8); -}
\ No newline at end of file +} diff --git a/src/native/d3d/D3dCtx.cpp b/src/native/d3d/D3dCtx.cpp index 32776c4..8ad3b2f 100644 --- a/src/native/d3d/D3dCtx.cpp +++ b/src/native/d3d/D3dCtx.cpp @@ -65,6 +65,7 @@ D3dCtx::D3dCtx(JNIEnv* env, jobject obj, HWND _hwnd, BOOL _offScreen, zWriteEnable = TRUE; zEnable = TRUE; + // TODO: THIS NEEDS TO BE REDONE WITH INFO FROM THE FBCONFIG PTR // this is the pixelFormat return from NativeConfigTemplate. minZDepth = vid & 0x3fffffff; if (vid & 0x80000000) @@ -269,6 +270,7 @@ VOID D3dCtx::releaseTexture() cubeMapTableLen = 0; unlockSurfaceList(); + /* lockImage(); D3dImageComponent::remove(&RasterList, this); unlockImage(); @@ -276,6 +278,7 @@ VOID D3dCtx::releaseTexture() lockBackground(); D3dImageComponent::remove(&BackgroundImageList, this); unlockBackground(); + */ // free list0 freeList(); @@ -346,8 +349,10 @@ VOID D3dCtx::releaseVB() VOID D3dCtx::release() { + /* D3dImageComponent::removeAll(&BackgroundImageList); D3dImageComponent::removeAll(&RasterList); + */ releaseTexture(); SafeFree(bindTextureId); bindTextureIdLen = 0; diff --git a/src/native/d3d/D3dDriverInfo.cpp b/src/native/d3d/D3dDriverInfo.cpp index fdad7a9..57d7b8a 100644 --- a/src/native/d3d/D3dDriverInfo.cpp +++ b/src/native/d3d/D3dDriverInfo.cpp @@ -362,8 +362,10 @@ VOID D3dDriverInfo::initialize(JNIEnv *env) D3dCtx::setImplicitMultisamplingProperty(env); + /* RasterList.init(); BackgroundImageList.init(); + */ // Setup Global constant Ambient light ambientLight.Type = D3DLIGHT_DIRECTIONAL; diff --git a/src/native/d3d/D3dImageComponent.hpp b/src/native/d3d/D3dImageComponent.hpp index fef2ed8..8226d30 100644 --- a/src/native/d3d/D3dImageComponent.hpp +++ b/src/native/d3d/D3dImageComponent.hpp @@ -46,7 +46,8 @@ public: static VOID removeAll(D3dImageComponent *list); }; -extern D3dImageComponent RasterList; -extern D3dImageComponent BackgroundImageList; - +/* + extern D3dImageComponent RasterList; + extern D3dImageComponent BackgroundImageList; +*/ #endif diff --git a/src/native/d3d/D3dUtil.cpp b/src/native/d3d/D3dUtil.cpp index 236827a..12ff9d6 100644 --- a/src/native/d3d/D3dUtil.cpp +++ b/src/native/d3d/D3dUtil.cpp @@ -966,8 +966,8 @@ void copyDataFromSurface(jint internalFormat, (yoffset*lockedRect.Pitch); - if ((internalFormat == FORMAT_BYTE_RGBA) || - (internalFormat == FORMAT_BYTE_RGB)) { + if ((internalFormat == IMAGE_FORMAT_BYTE_RGBA) || + (internalFormat == IMAGE_FORMAT_BYTE_RGB)) { dstPitch = subWidth << 2; destRow += (subHeight-1)*dstPitch; @@ -1208,7 +1208,7 @@ void copyDataFromSurface(jint internalFormat, } } } - } else if (internalFormat == FORMAT_BYTE_LA) { + } else if (internalFormat == IMAGE_FORMAT_BYTE_LA) { int gshift = firstBit(ddpf.dwGBitMask) + ucountBits(ddpf.dwGBitMask) - 8; int ashift = firstBit(ddpf.dwRGBAlphaBitMask) + @@ -1370,7 +1370,7 @@ void copyDataFromSurface(jint internalFormat, } } - } else if (internalFormat == FORMAT_BYTE_GRAY) { + } else if (internalFormat == IMAGE_FORMAT_BYTE_GRAY) { int gshift = firstBit(ddpf.dwGBitMask) + ucountBits(ddpf.dwGBitMask) - 8; dstPitch = subWidth; @@ -1482,7 +1482,7 @@ void copyDataFromSurface(jint internalFormat, } } else { - // FORMAT_USHORT_GRAY + // IMAGE_FORMAT_USHORT_GRAY printf("[Java 3D] copyDataFromSurface: Format not support %d\n", internalFormat); } @@ -8997,7 +8997,7 @@ void copyDataToSurface(jint storedFormat, } int offset = tilew*imgYOffset + imgXOffset; switch (storedFormat) { - case FORMAT_BYTE_RGBA : + case IMAGE_FORMAT_BYTE_RGBA : // This is the one we use when byReference = false copyDataToSurfaceRGBA(internalFormat, &ddpf, (unsigned char *) lockedRect.pBits, @@ -9006,7 +9006,7 @@ void copyDataToSurface(jint storedFormat, xoffset, yoffset, xlimit, ylimit, tilew); break; - case FORMAT_BYTE_RGB: + case IMAGE_FORMAT_BYTE_RGB: copyDataToSurfaceRGB(internalFormat, &ddpf, (unsigned char *) lockedRect.pBits, lockedRect.Pitch, @@ -9014,7 +9014,7 @@ void copyDataToSurface(jint storedFormat, xoffset, yoffset, xlimit, ylimit, tilew); break; - case FORMAT_BYTE_ABGR: + case IMAGE_FORMAT_BYTE_ABGR: copyDataToSurfaceABGR(internalFormat, &ddpf, (unsigned char *) lockedRect.pBits, lockedRect.Pitch, @@ -9022,7 +9022,7 @@ void copyDataToSurface(jint storedFormat, xoffset, yoffset, xlimit, ylimit, tilew); break; - case FORMAT_BYTE_BGR: + case IMAGE_FORMAT_BYTE_BGR: copyDataToSurfaceBGR(internalFormat, &ddpf, (unsigned char *) lockedRect.pBits, lockedRect.Pitch, @@ -9030,7 +9030,7 @@ void copyDataToSurface(jint storedFormat, xoffset, yoffset, xlimit, ylimit, tilew); break; - case FORMAT_BYTE_LA: + case IMAGE_FORMAT_BYTE_LA: copyDataToSurfaceLA(internalFormat, &ddpf, (unsigned char *) lockedRect.pBits, lockedRect.Pitch, @@ -9038,7 +9038,7 @@ void copyDataToSurface(jint storedFormat, xoffset, yoffset, xlimit, ylimit, tilew); break; - case FORMAT_BYTE_GRAY: + case IMAGE_FORMAT_BYTE_GRAY: copyDataToSurfaceGray(internalFormat, &ddpf, (unsigned char *) lockedRect.pBits, lockedRect.Pitch, @@ -10839,7 +10839,7 @@ void copyDataToVolume(jint storedFormat, switch (storedFormat) { - case FORMAT_BYTE_RGBA : + case IMAGE_FORMAT_BYTE_RGBA : // This is the one we use when byReference = false data += (imgOffset << 2); srcSlicePitch <<= 2; @@ -10857,7 +10857,7 @@ void copyDataToVolume(jint storedFormat, } break; - case FORMAT_BYTE_RGB: + case IMAGE_FORMAT_BYTE_RGB: data += (imgOffset*3); srcSlicePitch *= 3; @@ -10873,7 +10873,7 @@ void copyDataToVolume(jint storedFormat, data += srcSlicePitch; } break; - case FORMAT_BYTE_ABGR: + case IMAGE_FORMAT_BYTE_ABGR: data += (imgOffset << 2); srcSlicePitch <<= 2; @@ -10889,7 +10889,7 @@ void copyDataToVolume(jint storedFormat, data += srcSlicePitch; } break; - case FORMAT_BYTE_BGR: + case IMAGE_FORMAT_BYTE_BGR: data += (imgOffset*3); srcSlicePitch *= 3; @@ -10905,7 +10905,7 @@ void copyDataToVolume(jint storedFormat, data += srcSlicePitch; } break; - case FORMAT_BYTE_LA: + case IMAGE_FORMAT_BYTE_LA: data += (imgOffset << 1); srcSlicePitch <<= 1; @@ -10921,7 +10921,7 @@ void copyDataToVolume(jint storedFormat, data += srcSlicePitch; } break; - case FORMAT_BYTE_GRAY: + case IMAGE_FORMAT_BYTE_GRAY: data += imgOffset; for (i = zoffset; i < zlimit; i++) { @@ -11044,17 +11044,17 @@ LPDIRECT3DTEXTURE9 createSurfaceFromImage(JNIEnv *env, switch (internalFormat) { - case FORMAT_BYTE_RGBA: + case IMAGE_FORMAT_BYTE_RGBA: internalFormat = J3D_RGBA; break; - case FORMAT_BYTE_RGB: + case IMAGE_FORMAT_BYTE_RGB: internalFormat = J3D_RGB; break; - case FORMAT_BYTE_LA: + case IMAGE_FORMAT_BYTE_LA: internalFormat = LUMINANCE_ALPHA; break; - case FORMAT_BYTE_GRAY: - case FORMAT_USHORT_GRAY: + case IMAGE_FORMAT_BYTE_GRAY: + case IMAGE_FORMAT_USHORT_GRAY: internalFormat = LUMINANCE; break; default: @@ -11073,7 +11073,7 @@ LPDIRECT3DTEXTURE9 createSurfaceFromImage(JNIEnv *env, } if (imageYdown != NULL) { - if (storedFormat != FORMAT_USHORT_GRAY) { + if (storedFormat != IMAGE_FORMAT_USHORT_GRAY) { jbyte *byteData = (jbyte *) (env->GetPrimitiveArrayCritical( imageYdown, NULL)); copyDataToSurface(storedFormat, internalFormat, 0, 0, 0, 0, @@ -11367,7 +11367,7 @@ void copyDataToCubeMap(jint storedFormat, int offset = tilew*imgYOffset + imgXOffset; switch (storedFormat) { - case FORMAT_BYTE_RGBA : + case IMAGE_FORMAT_BYTE_RGBA : // This is the one we use when byReference = false if ((face == D3DCUBEMAP_FACE_NEGATIVE_Y) || (face == D3DCUBEMAP_FACE_POSITIVE_Y)) { @@ -11391,7 +11391,7 @@ void copyDataToCubeMap(jint storedFormat, xlimit, ylimit, tilew); } break; - case FORMAT_BYTE_RGB: + case IMAGE_FORMAT_BYTE_RGB: if ((face == D3DCUBEMAP_FACE_NEGATIVE_Y) || (face == D3DCUBEMAP_FACE_POSITIVE_Y)) { copyDataToSurfaceRGB(internalFormat, &ddpf, @@ -11410,7 +11410,7 @@ void copyDataToCubeMap(jint storedFormat, xlimit, ylimit, tilew); } break; - case FORMAT_BYTE_ABGR: + case IMAGE_FORMAT_BYTE_ABGR: if ((face == D3DCUBEMAP_FACE_NEGATIVE_Y) || (face == D3DCUBEMAP_FACE_POSITIVE_Y)) { copyDataToSurfaceABGR(internalFormat, &ddpf, @@ -11429,7 +11429,7 @@ void copyDataToCubeMap(jint storedFormat, xlimit, ylimit, tilew); } break; - case FORMAT_BYTE_BGR: + case IMAGE_FORMAT_BYTE_BGR: if ((face == D3DCUBEMAP_FACE_NEGATIVE_Y) || (face == D3DCUBEMAP_FACE_POSITIVE_Y)) { copyDataToSurfaceBGR(internalFormat, &ddpf, @@ -11448,7 +11448,7 @@ void copyDataToCubeMap(jint storedFormat, xlimit, ylimit, tilew); } break; - case FORMAT_BYTE_LA: + case IMAGE_FORMAT_BYTE_LA: if ((face == D3DCUBEMAP_FACE_NEGATIVE_Y) || (face == D3DCUBEMAP_FACE_POSITIVE_Y)) { copyDataToSurfaceLA(internalFormat, &ddpf, @@ -11467,7 +11467,7 @@ void copyDataToCubeMap(jint storedFormat, xlimit, ylimit, tilew); } break; - case FORMAT_BYTE_GRAY: + case IMAGE_FORMAT_BYTE_GRAY: if ((face == D3DCUBEMAP_FACE_NEGATIVE_Y) || (face == D3DCUBEMAP_FACE_POSITIVE_Y)) { copyDataToSurfaceGray(internalFormat, &ddpf, diff --git a/src/native/d3d/D3dUtil.hpp b/src/native/d3d/D3dUtil.hpp index 0117e47..c0961a4 100644 --- a/src/native/d3d/D3dUtil.hpp +++ b/src/native/d3d/D3dUtil.hpp @@ -142,7 +142,6 @@ extern VOID unlockSurfaceList(); extern VOID freeSurface(LPDIRECT3DBASETEXTURE9 surf); extern VOID freePointer(void* surf); extern VOID freePointerList(); -extern VOID setWindowCallback(HWND topHwnd, HWND hwnd); extern char* getErrorMessage(int idx); extern HWND getTopWindow(HWND hwnd); diff --git a/src/native/d3d/GeometryArrayRetained.cpp b/src/native/d3d/GeometryArrayRetained.cpp index fcafd4b..2d947a7 100644 --- a/src/native/d3d/GeometryArrayRetained.cpp +++ b/src/native/d3d/GeometryArrayRetained.cpp @@ -3195,7 +3195,6 @@ void setTextureCoordPointers(JNIEnv *env, D3dCtx* d3dCtx, LPDIRECT3DDEVICE9 device, D3DDRAWPRIMITIVESTRIDEDDATA *strideData, - jint pass, jint texoff, jint texStride, jint ts, @@ -3204,7 +3203,6 @@ void setTextureCoordPointers(JNIEnv *env, jint texCoordMapLength, jintArray texUnitOffset, jint numActiveTexUnit, - jintArray tunitstatemap, DWORD* vertexFormat, // Used by executeGeometryArray() & // executeIndexedGeometryArray() only @@ -3216,7 +3214,6 @@ void setTextureCoordPointers(JNIEnv *env, jintArray texindices) { - jint *texUnitStateMap = NULL; jint *texCoordSetMapOffset = NULL; jint *initialTexIndices = NULL; jint *texCoordSetMap = NULL; @@ -3226,6 +3223,9 @@ void setTextureCoordPointers(JNIEnv *env, BOOL nonVAGeom = (verts != NULL); int texSetInVB = 0; + // TODO : + int pass = -1; + /* * In case of automatic texture generation, * (vformat & GA_TEXTURE_COORDINATE) may equal to zero so we @@ -3256,259 +3256,167 @@ void setTextureCoordPointers(JNIEnv *env, initialTexIndices = (jint *) env->GetPrimitiveArrayCritical(texindices, NULL); } - if (pass >= 0) { - /* - * Single texture coordinate used or in multi-pass mode. - * In multi-pass mode, texture stage 0 is set so we - * should not use - * setTextureStage(d3dCtx, device, 0, pass); - */ - - genMode = setTextureStage(d3dCtx, device, 0, 0); - -#ifdef TEXDEBUG - printf("*** Single Pass *** %d, nonVAGeom %d, buildDL %d, numActiveTexUnit, texCoordMapLength %d, texDef %d, genMode %d \n", pass, nonVAGeom, (d3dCtx->currDisplayListID > 0), numActiveTexUnit, texCoordMapLength, textureDefined, genMode); -#endif - - if ((texCoordMapLength > 0) && - (pass < texCoordMapLength)) { - offsetOrTexset = (nonVAGeom ? - texCoordSetMapOffset[pass] : texCoordSetMap[pass]); - } else { - // TexUnitState is not used or disable, - // so by default we use texUnitIndex 0 - offsetOrTexset = 0; - } - - if (genMode != TEX_OBJ_LINEAR) { - // Only Object Linear Mode will not use DisplayList at - // all. That mean genMode must be correctly set before - // enter this Geometry execute() function/ - // In non displaylist mode genMode may not set correctly - // when so we can't rely on it. - if (textureDefined) { - if (offsetOrTexset != -1) { - if (nonVAGeom) { - // In executeGeometryArray() or executeIndexedGeometryArray() - strideData->textureCoordsPtr[0] = - &verts[texoff + offsetOrTexset]; - } else if (initialTexIndices != NULL) { - // executeGeometryArrayVA() - strideData->textureCoordsPtr[0] = - &(texCoordPointer[offsetOrTexset][initialTexIndices[offsetOrTexset]*texStride]); - } else { // executeIndexedGeometryArrayVA() - strideData->textureCoordsPtr[0] = - &(texCoordPointer[offsetOrTexset][0]); - } - - strideData->textureCoordsStride[0] = texStride; - *vertexFormat |= (TexFormatSizeTable[ts] << 16); - d3dCtx->texSetUsed = 1; - strideData->texCoordPosition[0] = offsetOrTexset; - d3dCtx->texStride[0] = ts; - setTexTransformStageFlag(d3dCtx, device, 0, ts, genMode); -#ifdef TEXDEBUG - printf("[pass 0] Non Object Linear, texDefined, ts=%d\n", ts); -#endif - } - } else { - // may be automatic texture generation used - // TexSetUsed remain unchange i.e. 0 since we will not - // allocate VB space for texture coords. - setTexTransformStageFlag(d3dCtx, device, 0, - d3dCtx->texCoordFormat[0], genMode); -#ifdef TEXDEBUG - printf("[pass 0] Non Object Linear, No texDefined, ts=%d\n", - d3dCtx->texCoordFormat[0]); -#endif - } - } else { - // Automatic texture generation Object Linear - // strideData->textureCoordsPtr[0] & - // strideData->textureCoordsStride[0] - // are not use in VertexBuffer texture copy so - // it doesn't matter to set them using default. - setDefaultTextureCoordPointers(d3dCtx, strideData, - vertexFormat, - d3dCtx->texCoordFormat[0], - genMode, 0); - setTexTransformStageFlag(d3dCtx, device, 0, - d3dCtx->texCoordFormat[0], genMode); - d3dCtx->texSetUsed = 1; -#ifdef TEXDEBUG - printf("[pass 0] Object Linear, ts=%d\n", d3dCtx->texCoordFormat[0]); -#endif - } - texSetInVB = d3dCtx->texSetUsed; - - } else { - // DisplayList is used for multiple texture single pass mode - // Or when go through the VertexArray in OGL, pass = -1 - int tus; + // DisplayList is used for multiple texture single pass mode + // Or when go through the VertexArray in OGL, pass = -1 + int tus; #ifdef TEXDEBUG - printf("*** Multiple Pass *** %d, nonVAGeom %d, buildDL %d, numActiveTexUnit %d, texCoordMapLength %d, texDef %d\n", pass, + printf("*** Multiple Pass *** %d, nonVAGeom %d, buildDL %d, numActiveTexUnit %d, texCoordMapLength %d, texDef %d\n", pass, nonVAGeom, (d3dCtx->currDisplayListID > 0), numActiveTexUnit, texCoordMapLength, textureDefined); #endif - if (tunitstatemap != NULL) { - texUnitStateMap = (jint *) env->GetPrimitiveArrayCritical(tunitstatemap, NULL); - } - for (textureUnitIndex = 0; textureUnitIndex < numActiveTexUnit; - textureUnitIndex++) { - tus = (texUnitStateMap != NULL ? - texUnitStateMap[textureUnitIndex]: textureUnitIndex); + for (textureUnitIndex = 0; textureUnitIndex < numActiveTexUnit; + textureUnitIndex++) { - if (d3dCtx->currDisplayListID > 0) { - genMode = setTextureStage(d3dCtx, device, - textureUnitIndex, tus); - } else { - // This happen when we switch from displayList to - // vertexArray mode. The displayList is already - // built with 1-1 mapping so we can't use the - // textureUnitIndex Mapping - genMode = setTextureStage(d3dCtx, device, - textureUnitIndex, - textureUnitIndex); - } + tus = textureUnitIndex; + + if (d3dCtx->currDisplayListID > 0) { + genMode = setTextureStage(d3dCtx, device, + textureUnitIndex, tus); + } else { + // This happen when we switch from displayList to + // vertexArray mode. The displayList is already + // built with 1-1 mapping so we can't use the + // textureUnitIndex Mapping + genMode = setTextureStage(d3dCtx, device, + textureUnitIndex, + textureUnitIndex); + } #ifdef TEXDEBUG - printf("[pass %d] genMode %d, tus %d\n", textureUnitIndex, - genMode, tus); -#endif - if (genMode != TEX_OBJ_LINEAR) { - if (textureDefined) { - if (tus < texCoordMapLength) { - offsetOrTexset = (nonVAGeom ? - texCoordSetMapOffset[tus]:texCoordSetMap[tus]); - - if (offsetOrTexset != -1) { - if (nonVAGeom) { - strideData->textureCoordsPtr[textureUnitIndex] = - &verts[texoff + offsetOrTexset]; - } else if (initialTexIndices != NULL) { - strideData->textureCoordsPtr[textureUnitIndex] = - &(texCoordPointer[offsetOrTexset][initialTexIndices[offsetOrTexset]*texStride]); - } else { - strideData->textureCoordsPtr[textureUnitIndex] = - &(texCoordPointer[offsetOrTexset][0]); - } - strideData->textureCoordsStride[textureUnitIndex] = texStride; - strideData->texCoordPosition[textureUnitIndex] - = offsetOrTexset; - *vertexFormat |= (TexFormatSizeTable[ts] << (textureUnitIndex*2 + 16)); - d3dCtx->texStride[textureUnitIndex] = ts; - setTexTransformStageFlag(d3dCtx, device, - textureUnitIndex, - ts, genMode); - texSetInVB++; -#ifdef TEXDEBUG - printf("[pass %d] Non Object Linear, texDefined, ts=%d, tus %d\n", textureUnitIndex, ts, tus); + printf("[pass %d] genMode %d, tus %d\n", textureUnitIndex, + genMode, tus); #endif + if (genMode != TEX_OBJ_LINEAR) { + if (textureDefined) { + if (tus < texCoordMapLength) { + offsetOrTexset = (nonVAGeom ? + texCoordSetMapOffset[tus]:texCoordSetMap[tus]); + + if (offsetOrTexset != -1) { + if (nonVAGeom) { + strideData->textureCoordsPtr[textureUnitIndex] = + &verts[texoff + offsetOrTexset]; + } else if (initialTexIndices != NULL) { + strideData->textureCoordsPtr[textureUnitIndex] = + &(texCoordPointer[offsetOrTexset][initialTexIndices[offsetOrTexset]*texStride]); } else { - // This texture status is disable, this - // should not happen in D3D since - // TextureBin always compact unused state - // - unless when DisplayList is build and - // automatic texture generation - // used. Since if DL use - // updateAttributes() not yet invoke to - // set genMode correctly. - if (debug && (d3dCtx->currDisplayListID <= 0)) { - printf("[Java3D] TextureBin not compact textureUnitState correctly, numActiveTex %d, disableUnit %d, current mapped Texture Unit %d\n", numActiveTexUnit, tus, textureUnitIndex); - } - setDefaultTextureCoordPointers(d3dCtx, strideData, - vertexFormat, ts, - genMode, - textureUnitIndex); - setTexTransformStageFlag(d3dCtx, device, - textureUnitIndex, - ts, genMode); - texSetInVB++; + strideData->textureCoordsPtr[textureUnitIndex] = + &(texCoordPointer[offsetOrTexset][0]); + } + strideData->textureCoordsStride[textureUnitIndex] = texStride; + strideData->texCoordPosition[textureUnitIndex] + = offsetOrTexset; + *vertexFormat |= (TexFormatSizeTable[ts] << (textureUnitIndex*2 + 16)); + d3dCtx->texStride[textureUnitIndex] = ts; + setTexTransformStageFlag(d3dCtx, device, + textureUnitIndex, + ts, genMode); + texSetInVB++; #ifdef TEXDEBUG - printf("[pass %d] Non Object Linear, texDefined, ts=%d\n", textureUnitIndex, ts); + printf("[pass %d] Non Object Linear, texDefined, ts=%d, tus %d\n", textureUnitIndex, ts, tus); #endif - } } else { - // Internal error, should not happen. - if (debug) { - printf("[Java3D] TextureCoordMapLength length %d, is smaller than texture unit %d, map texture unit %d\n", texCoordMapLength, tus, textureUnitIndex); + // This texture status is disable, this + // should not happen in D3D since + // TextureBin always compact unused state + // - unless when DisplayList is build and + // automatic texture generation + // used. Since if DL use + // updateAttributes() not yet invoke to + // set genMode correctly. + if (debug && (d3dCtx->currDisplayListID <= 0)) { + printf("[Java3D] TextureBin not compact textureUnitState correctly, numActiveTex %d, disableUnit %d, current mapped Texture Unit %d\n", numActiveTexUnit, tus, textureUnitIndex); } setDefaultTextureCoordPointers(d3dCtx, strideData, vertexFormat, ts, - TEX_GEN_INVALID, + genMode, textureUnitIndex); setTexTransformStageFlag(d3dCtx, device, - textureUnitIndex, ts, - genMode); - + textureUnitIndex, + ts, genMode); texSetInVB++; #ifdef TEXDEBUG - printf("[pass %d] Non Object Linear, texDefined, offset/texset = -1, ts=%d\n", textureUnitIndex, ts); + printf("[pass %d] Non Object Linear, texDefined, ts=%d\n", textureUnitIndex, ts); #endif } } else { - // May be in automatically texture coordinate - // generation mode. - // May have trouble if automatically texture - // coordinate not used. Note that we pass ts = 0 - // so that copyVertexToVB() will not inc. the - // stride for this unused tex stage. - - // It is also the case in buildGA() case when - // numActiveTexUnit is 1 by default even though - // texture is not used. - /* - if ((d3dCtx->currDisplayListID <= 0) && - (genMode == TEX_GEN_NONE)) { - // application error, use default TexCoord - setDefaultTextureCoordPointers(d3dCtx, strideData, - vertexFormat, - ts, - TEX_GEN_NONE, - textureUnitIndex); - texSetInVB++; - } - */ - + // Internal error, should not happen. + if (debug) { + printf("[Java3D] TextureCoordMapLength length %d, is smaller than texture unit %d, map texture unit %d\n", texCoordMapLength, tus, textureUnitIndex); + } setDefaultTextureCoordPointers(d3dCtx, strideData, - vertexFormat, - 0, - // This must be < 0 - TEX_GEN_AUTO, + vertexFormat, ts, + TEX_GEN_INVALID, textureUnitIndex); - setTexTransformStageFlag(d3dCtx, device, textureUnitIndex, - d3dCtx->texCoordFormat[textureUnitIndex], genMode); - - + setTexTransformStageFlag(d3dCtx, device, + textureUnitIndex, ts, + genMode); + + texSetInVB++; #ifdef TEXDEBUG - printf("[pass %d] Non Object Linear, No texDefined, ts=0\n", textureUnitIndex); + printf("[pass %d] Non Object Linear, texDefined, offset/texset = -1, ts=%d\n", textureUnitIndex, ts); #endif } } else { - // Automatic Texture generation Object Linear is used + // May be in automatically texture coordinate + // generation mode. + // May have trouble if automatically texture + // coordinate not used. Note that we pass ts = 0 + // so that copyVertexToVB() will not inc. the + // stride for this unused tex stage. + + // It is also the case in buildGA() case when + // numActiveTexUnit is 1 by default even though + // texture is not used. + /* + if ((d3dCtx->currDisplayListID <= 0) && + (genMode == TEX_GEN_NONE)) { + // application error, use default TexCoord + setDefaultTextureCoordPointers(d3dCtx, strideData, + vertexFormat, + ts, + TEX_GEN_NONE, + textureUnitIndex); + texSetInVB++; + } + */ + setDefaultTextureCoordPointers(d3dCtx, strideData, vertexFormat, - d3dCtx->texCoordFormat[textureUnitIndex], - genMode, + 0, + // This must be < 0 + TEX_GEN_AUTO, textureUnitIndex); setTexTransformStageFlag(d3dCtx, device, textureUnitIndex, d3dCtx->texCoordFormat[textureUnitIndex], genMode); - texSetInVB++; + + #ifdef TEXDEBUG - printf("[pass %d] Object Linear, No texDefined, ts=%d\n", textureUnitIndex, d3dCtx->texCoordFormat[textureUnitIndex]); + printf("[pass %d] Non Object Linear, No texDefined, ts=0\n", textureUnitIndex); #endif } - } - d3dCtx->texSetUsed = numActiveTexUnit; + } else { + // Automatic Texture generation Object Linear is used + setDefaultTextureCoordPointers(d3dCtx, strideData, + vertexFormat, + d3dCtx->texCoordFormat[textureUnitIndex], + genMode, + textureUnitIndex); + setTexTransformStageFlag(d3dCtx, device, textureUnitIndex, + d3dCtx->texCoordFormat[textureUnitIndex], genMode); + texSetInVB++; #ifdef TEXDEBUG - printf("No of texSetInVB %d, numActiveTexUnit %d\n", - texSetInVB, numActiveTexUnit); + printf("[pass %d] Object Linear, No texDefined, ts=%d\n", textureUnitIndex, d3dCtx->texCoordFormat[textureUnitIndex]); #endif - if (texUnitStateMap != NULL) { - env->ReleasePrimitiveArrayCritical(tunitstatemap, texUnitStateMap, NULL); } } + d3dCtx->texSetUsed = numActiveTexUnit; +#ifdef TEXDEBUG + printf("No of texSetInVB %d, numActiveTexUnit %d\n", + texSetInVB, numActiveTexUnit); +#endif + if (texCoordSetMapOffset != NULL) { env->ReleasePrimitiveArrayCritical(texUnitOffset, @@ -3540,7 +3448,6 @@ void executeGeometryArrayVA( jboolean isNonUniformScale, jboolean modAlpha, float alpha, - jboolean multiScreen, jboolean ignoreVertexColors, jint vcount, jint vformat, @@ -3553,11 +3460,9 @@ void executeGeometryArrayVA( jbyte* bclrs, jint initialNormalIndex, jfloat* norms, - int pass, // or texUnitIndex int texCoordMapLength, jintArray tcoordsetmap, jint numActiveTexUnit, - jintArray tunitstatemap, jintArray texindices, jint texStride, jfloat** texCoordPointer, @@ -3645,13 +3550,12 @@ void executeGeometryArrayVA( // setup texture pointer setTextureCoordPointers(env, d3dCtx, device, &strideData, - pass, 0, texStride, ts, + 0, texStride, ts, textureDefined, tcoordsetmap, texCoordMapLength, NULL, numActiveTexUnit, - tunitstatemap, &vertexFormat, NULL, texCoordPointer, texindices); @@ -3688,14 +3592,13 @@ void executeGeometryArrayVA( /* execute geometry array with java array format */ extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffer( +void JNICALL Java_javax_media_j3d_NativePipeline_executeVABuffer( JNIEnv *env, jobject obj, jlong ctxInfo, jobject geo, jint geo_type, jboolean isNonUniformScale, - jboolean multiScreen, jboolean ignoreVertexColors, jint vcount, jint vformat, @@ -3712,11 +3615,9 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffer( jintArray vertexAttrSizes, jintArray vertexAttrIndices, jobjectArray vertexAttrData, - jint pass, jint texCoordMapLength, jintArray tcoordsetmap, jint numActiveTexUnit, - jintArray tunitstatemap, jintArray texindices, jint texStride, jobjectArray texCoords, @@ -3788,13 +3689,13 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffer( } executeGeometryArrayVA(env, obj, ctxInfo, geo, geo_type, - isNonUniformScale, false, 0, multiScreen, ignoreVertexColors, + isNonUniformScale, false, 0, ignoreVertexColors, vcount, vformat, vdefined, initialCoordIndex, fverts, dverts, initialColorIndex, fclrs, bclrs, initialNormalIndex, norms, - pass, texCoordMapLength, - tcoordsetmap,numActiveTexUnit, tunitstatemap, + texCoordMapLength, + tcoordsetmap,numActiveTexUnit, texindices,texStride,texCoordPointer, NULL, NULL, cdirty); @@ -3806,14 +3707,13 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVABuffer( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVA( +void JNICALL Java_javax_media_j3d_NativePipeline_executeVA( JNIEnv *env, jobject obj, jlong ctxInfo, jobject geo, jint geo_type, jboolean isNonUniformScale, - jboolean multiScreen, jboolean ignoreVertexColors, jint vcount, jint vformat, @@ -3829,12 +3729,10 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVA( jint vertexAttrCount, jintArray vertexAttrSizes, jintArray vertexAttrIndices, - jobjectArray vertexAttrData, - jint pass, + jobjectArray vertexAttrData, jint texCoordMapLength, jintArray tcoordsetmap, jint numActiveTexUnit, - jintArray tunitstatemap, jintArray texindices, jint texStride, jobjectArray texCoords, @@ -3899,12 +3797,12 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVA( } executeGeometryArrayVA(env, obj, ctxInfo, geo, geo_type, isNonUniformScale, false, 0, - multiScreen, ignoreVertexColors, + ignoreVertexColors, vcount, vformat, vdefined, initialCoordIndex, fverts, dverts, initialColorIndex, fclrs, bclrs, initialNormalIndex, - norms, pass, texCoordMapLength, - tcoordsetmap,numActiveTexUnit, tunitstatemap, + norms, texCoordMapLength, + tcoordsetmap,numActiveTexUnit, texindices,texStride,texCoordPointer, NULL, NULL, cdirty); @@ -3936,57 +3834,38 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeVA( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_setGlobalAlpha( - JNIEnv *env, - jobject obj, - jlong ctx, - jfloat alpha) -{ - // not use in D3D -} - - -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_disableGlobalAlpha( +void JNICALL Java_javax_media_j3d_NativePipeline_disableGlobalAlpha( JNIEnv *env, jobject obj, jlong ctx, + jobject geo, jint vformat, jboolean useAlpha, jboolean ignoreVertexColors) { - // not use in D3D + // not used in D3D } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_setVertexFormat( +void JNICALL Java_javax_media_j3d_NativePipeline_setVertexFormat( JNIEnv *env, jobject obj, jlong ctxInfo, + jobject geo, jint vformat, jboolean useAlpha, jboolean ignoreVertexColors) { - // not use in D3D + // not used in D3D } -extern "C" JNIEXPORT -jboolean JNICALL Java_javax_media_j3d_GeometryArrayRetained_globalAlphaSUN - (JNIEnv *env, jobject obj, jlong ctx) -{ - return JNI_FALSE; -} - - - void executeGeometryArray(JNIEnv *env, jobject obj, jlong ctx, jobject geo, jint geo_type, jboolean isNonUniformScale, jboolean modAlpha, // buildGA, should alpha be mode jfloat alpha, - jboolean multiScreen, jboolean ignoreVertexColors, jint startVIndex, jint vcount, jint vformat, jint texCoordSetCount, @@ -3994,8 +3873,7 @@ void executeGeometryArray(JNIEnv *env, jint texCoordMapLength, jintArray texUnitOffset, jint numActiveTexUnit, - jintArray tunitstatemap, - jfloat* verts, jfloatArray carray, jint pass, + jfloat* verts, jfloatArray carray, jdoubleArray xform, jdoubleArray nxform, jint cDirty, jboolean useAlpha) // Should alpha be sent down @@ -4108,13 +3986,12 @@ void executeGeometryArray(JNIEnv *env, // setup texture pointer setTextureCoordPointers(env, d3dCtx, device, &strideData, - pass, texoff, stride, ts, + texoff, stride, ts, (vformat & GA_TEXTURE_COORDINATE), NULL, texCoordMapLength, texUnitOffset, numActiveTexUnit, - tunitstatemap, &vertexFormat, verts, NULL, NULL); @@ -4151,12 +4028,12 @@ void executeGeometryArray(JNIEnv *env, /* - * Class: javax_media_j3d_GeometryArrayRetained + * Class: javax_media_j3d_NativePipeline * Method: buildGA * Signature: (JLjavax/media/j3d/GeometryArrayRetained;IZZFZIIII[II[II[I[D[D[F)V */ extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGA(JNIEnv *env, +void JNICALL Java_javax_media_j3d_NativePipeline_buildGA(JNIEnv *env, jobject obj, jlong ctx, jobject geo, jint geo_type, jboolean isNonUniformScale, jboolean updateAlpha, float alpha, @@ -4193,7 +4070,6 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGA(JNIEnv *env, obj, ctx, geo, geo_type, isNonUniformScale, updateAlpha, alpha, - false, ignoreVertexColors, startVIndex, vcount, @@ -4203,9 +4079,7 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGA(JNIEnv *env, texCoordMapLength, texUnitOffset, texCoordMapLength, - NULL, verts, NULL, - -1, xform, nxform, javax_media_j3d_GeometryArrayRetained_VERTEX_CHANGED, false); @@ -4216,20 +4090,17 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGA(JNIEnv *env, extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_execute(JNIEnv *env, +void JNICALL Java_javax_media_j3d_NativePipeline_execute(JNIEnv *env, jobject obj, jlong ctx,jobject geo, jint geo_type, jboolean isNonUniformScale, jboolean useAlpha, - jboolean multiScreen, jboolean ignoreVertexColors, jint startVIndex, jint vcount, jint vformat, jint texCoordSetCount, jintArray texCoordSetMapArray, jint texCoordMapLength, jintArray texUnitOffset, - jint numActiveTexUnit, - jintArray tunitstatemap, - jint vertexAttrCount, jintArray vertexAttrSizes, - jfloatArray varray, jfloatArray carray, - jint texUnitIndex, jint cDirty) + jint numActiveTexUnit, + jint vertexAttrCount, jintArray vertexAttrSizes, + jfloatArray varray, jfloatArray carray, jint cDirty) { jfloat *verts = NULL; @@ -4244,13 +4115,12 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_execute(JNIEnv *env, executeGeometryArray(env, obj, ctx, geo, geo_type, isNonUniformScale, false, - 0, multiScreen, - ignoreVertexColors, startVIndex, + 0, ignoreVertexColors, startVIndex, vcount, vformat, texCoordSetCount, texCoordSetMapArray, texCoordMapLength, texUnitOffset, - numActiveTexUnit, tunitstatemap, - verts, carray, texUnitIndex, NULL, NULL, cDirty,useAlpha); + numActiveTexUnit, + verts, carray, NULL, NULL, cDirty,useAlpha); env->ReleasePrimitiveArrayCritical( varray, verts, 0); @@ -4259,10 +4129,9 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_execute(JNIEnv *env, /* interleaved data with nio buffer as data format */ extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeInterleavedBuffer(JNIEnv *env, +void JNICALL Java_javax_media_j3d_NativePipeline_executeInterleavedBuffer(JNIEnv *env, jobject obj, jlong ctx, jobject geo, jint geo_type, - jboolean isNonUniformScale, jboolean useAlpha, - jboolean multiScreen, + jboolean isNonUniformScale, jboolean useAlpha, jboolean ignoreVertexColors, jint startVIndex, jint vcount, jint vformat, @@ -4270,9 +4139,7 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeInterleavedBuffer jintArray texCoordSetMapArray, jint texCoordMapLength, jintArray texUnitOffset, jint numActiveTexUnit, - jintArray tunitstatemap, - jobject varray, jfloatArray carray, - jint texUnitIndex, jint cDirty) { + jobject varray, jfloatArray carray, jint cDirty) { jfloat *verts = NULL; @@ -4289,20 +4156,22 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_executeInterleavedBuffer executeGeometryArray(env, obj, ctx, geo, geo_type, isNonUniformScale, false, - 0, multiScreen, - ignoreVertexColors, startVIndex, + 0, ignoreVertexColors, startVIndex, vcount, vformat, texCoordSetCount, texCoordSetMapArray, texCoordMapLength, texUnitOffset, - numActiveTexUnit, tunitstatemap, - verts, carray, texUnitIndex, NULL, NULL, cDirty,useAlpha); + numActiveTexUnit, + verts, carray, NULL, NULL, cDirty,useAlpha); } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_freeD3DArray - (JNIEnv *env, jobject geo, jboolean deleteVB) +void JNICALL Java_javax_media_j3d_NativePipeline_freeD3DArray( + JNIEnv *env, + jobject obj, + jobject geo, + jboolean deleteVB) { lockGeometry(); @@ -4340,7 +4209,6 @@ void executeIndexedGeometryArray(JNIEnv *env, jboolean isNonUniformScale, jboolean modAlpha, // buildGA, should alpha be mode jfloat alpha, - jboolean multiScreen, jboolean ignoreVertexColors, jint vcount, jint vformat, @@ -4349,8 +4217,7 @@ void executeIndexedGeometryArray(JNIEnv *env, jint texCoordMapLength, jintArray texUnitOffset, jint numActiveTexUnit, - jintArray tunitstatemap, - jfloat* verts, jfloatArray carray, jint pass, + jfloat* verts, jfloatArray carray, jdoubleArray xform, jdoubleArray nxform, jint cDirty, jboolean useAlpha, @@ -4463,13 +4330,12 @@ void executeIndexedGeometryArray(JNIEnv *env, // setup texture pointer setTextureCoordPointers(env, d3dCtx, device, &strideData, - pass, texoff, stride, ts, + texoff, stride, ts, (vformat & GA_TEXTURE_COORDINATE), NULL, texCoordMapLength, texUnitOffset, numActiveTexUnit, - tunitstatemap, &vertexFormat, verts, NULL, NULL); @@ -4514,12 +4380,11 @@ void executeIndexedGeometryArray(JNIEnv *env, extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometry( +void JNICALL Java_javax_media_j3d_NativePipeline_executeIndexedGeometry( JNIEnv *env, jobject obj, jlong ctx, jobject geo, jint geo_type, jboolean isNonUniformScale, jboolean useAlpha, - jboolean multiScreen, jboolean ignoreVertexColors, jint initialIndexIndex, jint indexCount, @@ -4530,9 +4395,7 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo jintArray texCoordSetMapArray, jint texCoordMapLength, jintArray texUnitOffset, jint numActiveTexUnit, - jintArray tunitstatemap, - jfloatArray varray, jfloatArray carray, - jint texUnitIndex, jint cDirty, + jfloatArray varray, jfloatArray carray, jint cDirty, jintArray indexCoord) { jfloat *verts = NULL; @@ -4547,7 +4410,7 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo executeIndexedGeometryArray(env, obj, ctx, geo, geo_type, isNonUniformScale, - false, 0, multiScreen, + false, 0, ignoreVertexColors, vcount, vformat, texCoordSetCount, @@ -4555,10 +4418,8 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo texCoordMapLength, texUnitOffset, numActiveTexUnit, - tunitstatemap, verts, carray, - texUnitIndex, NULL, NULL, cDirty, useAlpha, @@ -4570,12 +4431,11 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometryBuffer( +void JNICALL Java_javax_media_j3d_NativePipeline_executeIndexedGeometryBuffer( JNIEnv *env, jobject obj, jlong ctx, jobject geo, jint geo_type, jboolean isNonUniformScale, jboolean useAlpha, - jboolean multiScreen, jboolean ignoreVertexColors, jint initialIndexIndex, jint indexCount, @@ -4584,9 +4444,8 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo jintArray texCoordSetMapArray, jint texCoordMapLength, jintArray texUnitOffset, jint numActiveTexUnit, - jintArray tunitstatemap, jobject varray, jfloatArray carray, - jint texUnitIndex, jint cDirty, + jint cDirty, jintArray indexCoord) { jfloat *verts = NULL; @@ -4601,7 +4460,7 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo executeIndexedGeometryArray(env, obj, ctx, geo, geo_type, isNonUniformScale, - false, 0, multiScreen, + false, 0, ignoreVertexColors, vcount, vformat, texCoordSetCount, @@ -4609,10 +4468,8 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo texCoordMapLength, texUnitOffset, numActiveTexUnit, - tunitstatemap, verts, carray, - texUnitIndex, NULL, NULL, cDirty, useAlpha, @@ -4623,7 +4480,7 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_buildIndexedGeometry( +void JNICALL Java_javax_media_j3d_NativePipeline_buildIndexedGeometry( JNIEnv *env, jobject obj, jlong ctx, jobject geo, jint geo_type, @@ -4661,7 +4518,6 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_buildIndexedGeome executeIndexedGeometryArray(env, obj, ctx, geo, geo_type, isNonUniformScale, updateAlpha, alpha, - false, ignoreVertexColors, vertexCount, vformat, @@ -4669,10 +4525,9 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_buildIndexedGeome texCoordSetMapArray, texCoordMapLength, texUnitOffset, - texCoordMapLength, - NULL, + texCoordMapLength, verts, - NULL, -1, + NULL, xform, nxform, javax_media_j3d_GeometryArrayRetained_VERTEX_CHANGED| javax_media_j3d_GeometryArrayRetained_INDEX_CHANGED, @@ -4694,7 +4549,6 @@ void executeIndexedGeometryArrayVA( jobject geo, jint geo_type, jboolean isNonUniformScale, - jboolean multiScreen, jboolean ignoreVertexColors, jint initialIndexIndex, jint indexCount, @@ -4705,12 +4559,10 @@ void executeIndexedGeometryArrayVA( jdouble* dverts, jfloat* fclrs, jbyte* bclrs, - jfloat* norms, - jint pass, + jfloat* norms, jint texCoordMapLength, jintArray tcoordsetmap, jint numActiveTexUnit, - jintArray tunitstatemap, jint texStride, jfloat** texCoordPointer, jint cDirty, @@ -4789,14 +4641,13 @@ void executeIndexedGeometryArrayVA( // setup texture pointer setTextureCoordPointers(env, d3dCtx, device, &strideData, - pass, 0, + 0, texStride, ts, textureDefined, tcoordsetmap, texCoordMapLength, NULL, numActiveTexUnit, - tunitstatemap, &vertexFormat, NULL, texCoordPointer, NULL); @@ -4816,14 +4667,13 @@ void executeIndexedGeometryArrayVA( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometryVA( +void JNICALL Java_javax_media_j3d_NativePipeline_executeIndexedGeometryVA( JNIEnv *env, jobject obj, jlong ctx, jobject geo, jint geo_type, jboolean isNonUniformScale, - jboolean multiScreen, jboolean ignoreVertexColors, jint initialIndexIndex, jint indexCount, @@ -4838,11 +4688,9 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo jint vertexAttrCount, jintArray vertexAttrSizes, jobjectArray vertexAttrData, - jint pass, jint texCoordMapLength, jintArray tcoordsetmap, jint numActiveTexUnit, - jintArray tunitstatemap, jint texStride, jobjectArray texCoords, jint cDirty, @@ -4914,7 +4762,6 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo geo, geo_type, isNonUniformScale, - multiScreen, ignoreVertexColors, initialIndexIndex, indexCount, @@ -4926,11 +4773,9 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo fclrs, bclrs, norms, - pass, texCoordMapLength, tcoordsetmap, numActiveTexUnit, - tunitstatemap, texStride, texCoordPointer, cDirty, @@ -4963,14 +4808,13 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeometryVABuffer( +void JNICALL Java_javax_media_j3d_NativePipeline_executeIndexedGeometryVABuffer( JNIEnv *env, jobject obj, jlong ctx, jobject geo, jint geo_type, jboolean isNonUniformScale, - jboolean multiScreen, jboolean ignoreVertexColors, jint initialIndexIndex, jint indexCount, @@ -4985,11 +4829,9 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo jint vertexAttrCount, jintArray vertexAttrSizes, jobjectArray vertexAttrData, - jint pass, jint texCoordMapLength, jintArray tcoordsetmap, jint numActiveTexUnit, - jintArray tunitstatemap, jint texStride, jobjectArray texCoords, jint cDirty, @@ -5067,7 +4909,6 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo geo, geo_type, isNonUniformScale, - multiScreen, ignoreVertexColors, initialIndexIndex, indexCount, @@ -5079,11 +4920,9 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo fclrs, bclrs, norms, - pass, texCoordMapLength, tcoordsetmap, numActiveTexUnit, - tunitstatemap, texStride, texCoordPointer, cDirty, @@ -5097,7 +4936,7 @@ void JNICALL Java_javax_media_j3d_IndexedGeometryArrayRetained_executeIndexedGeo } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForBuffer( +void JNICALL Java_javax_media_j3d_NativePipeline_buildGAForBuffer( JNIEnv *env, jobject obj, jlong ctx, @@ -5181,12 +5020,12 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForBuffer( executeGeometryArrayVA(env, obj, ctx, geo, geo_type, isNonUniformScale, updateAlpha, alpha, - false, ignoreVertexColors, + ignoreVertexColors, vcount, vformat, vdefined, initialCoordIndex, fverts, dverts, initialColorIndex, fclrs, bclrs, initialNormalIndex, - norms, -1, texCoordMapLength, - tcoordsetmap,texCoordMapLength, NULL, + norms, texCoordMapLength, + tcoordsetmap,texCoordMapLength, texindices,texStride,texCoordPointer, xform, nxform, javax_media_j3d_GeometryArrayRetained_VERTEX_CHANGED); @@ -5194,13 +5033,13 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForBuffer( /* execute geometry array with java array format */ /* - * Class: javax_media_j3d_GeometryArrayRetained + * Class: javax_media_j3d_NativePipeline * Method: buildGAForByRef * Signature: (JLjavax/media/j3d/GeometryArrayRetained;IZZFZIIII[F[DI[F[BI[FI[I[I[[FI[I[II[Ljava/lang/Object;[D[D)V */ extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForByRef( +void JNICALL Java_javax_media_j3d_NativePipeline_buildGAForByRef( JNIEnv *env, jobject obj, jlong ctx, @@ -5294,12 +5133,12 @@ void JNICALL Java_javax_media_j3d_GeometryArrayRetained_buildGAForByRef( executeGeometryArrayVA(env, obj, ctx, geo, geo_type, isNonUniformScale, updateAlpha, alpha, - false, ignoreVertexColors, + ignoreVertexColors, vcount, vformat, vdefined, initialCoordIndex, fverts, dverts, initialColorIndex, fclrs, bclrs, initialNormalIndex, - norms, -1, texCoordMapLength, - tcoordsetmap,texCoordMapLength, NULL, + norms, texCoordMapLength, + tcoordsetmap,texCoordMapLength, texindices,texStride,texCoordPointer, xform, nxform, javax_media_j3d_GeometryArrayRetained_VERTEX_CHANGED); diff --git a/src/native/d3d/GraphicsContext3D.cpp b/src/native/d3d/GraphicsContext3D.cpp index 427cd33..22ead53 100644 --- a/src/native/d3d/GraphicsContext3D.cpp +++ b/src/native/d3d/GraphicsContext3D.cpp @@ -13,7 +13,21 @@ #include "StdAfx.h" extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_GraphicsContext3D_readRasterNative( +void JNICALL Java_javax_media_j3d_NativePipeline_readRaster( + JNIEnv *env, jobject obj, jlong ctx, + jint type, jint xOffset, jint yOffset, + jint wRaster, jint hRaster, jint hCanvas, + jint imageDataType, + jint imageFormat, jobject imageBuffer, + jint depthFormat, jobject depthBuffer) +{ + printf("[Java3D] D3D : readRaster is not implemented yet.\n"); + +} + +#if 0 +extern "C" JNIEXPORT +void JNICALL Java_javax_media_j3d_NativePipeline_readRasterNative( JNIEnv *env, jobject obj, jlong ctx, jint type, jint xOffset, jint yOffset, jint wRaster, jint hRaster, jint hCanvas, jint format, @@ -152,3 +166,5 @@ void JNICALL Java_javax_media_j3d_GraphicsContext3D_readRasterNative( } } } + +#endif diff --git a/src/native/d3d/Lights.cpp b/src/native/d3d/Lights.cpp index 270e52a..5d0f030 100644 --- a/src/native/d3d/Lights.cpp +++ b/src/native/d3d/Lights.cpp @@ -15,9 +15,9 @@ #define D3DLIGHT_RANGE_MAX sqrt(FLT_MAX) extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_DirectionalLightRetained_updateLight( +void JNICALL Java_javax_media_j3d_NativePipeline_updateDirectionalLight( JNIEnv *env, - jobject light, + jobject obj, jlong ctx, jint lightSlot, jfloat red, @@ -56,9 +56,9 @@ void JNICALL Java_javax_media_j3d_DirectionalLightRetained_updateLight( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_PointLightRetained_updateLight( +void JNICALL Java_javax_media_j3d_NativePipeline_updatePointLight( JNIEnv *env, - jobject light, + jobject obj, jlong ctx, jint lightSlot, jfloat red, @@ -99,9 +99,9 @@ void JNICALL Java_javax_media_j3d_PointLightRetained_updateLight( extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_SpotLightRetained_updateLight( +void JNICALL Java_javax_media_j3d_NativePipeline_updateSpotLight( JNIEnv *env, - jobject light, + jobject obj, jlong ctx, jint lightSlot, jfloat red, diff --git a/src/native/d3d/NativeAPIInfo.c b/src/native/d3d/NativeAPIInfo.c deleted file mode 100644 index b5a5bde..0000000 --- a/src/native/d3d/NativeAPIInfo.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * $RCSfile$ - * - * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. - * - * Use is subject to license terms. - * - * $Revision$ - * $Date$ - * $State$ - */ - -#include <jni.h> - -#include "javax_media_j3d_MasterControl.h" -#include "javax_media_j3d_NativeAPIInfo.h" - -JNIEXPORT -jint JNICALL Java_javax_media_j3d_NativeAPIInfo_getRenderingAPI( - JNIEnv *env, jobject obj) -{ - return (jint)javax_media_j3d_MasterControl_RENDER_DIRECT3D; -} diff --git a/src/native/d3d/NativeWSInfo.cpp b/src/native/d3d/NativeWSInfo.cpp deleted file mode 100644 index e1af6e5..0000000 --- a/src/native/d3d/NativeWSInfo.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * $RCSfile$ - * - * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. - * - * Use is subject to license terms. - * - * $Revision$ - * $Date$ - * $State$ - */ - -#include "StdAfx.h" - - - -#ifdef STRICT -typedef WNDPROC PROC_TYPE; -#else -typedef FARPROC PROC_TYPE; -#endif - - -static PROC_TYPE g_lpDefWindowProcChild; -static long oldWindowHandle = 0; - -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_NativeWSInfo_subclass( - JNIEnv * env, - jobject obj, - jint hwnd) -{ - // For some reason, setting the callback before - // setCooperative level will cause setCooperative level - // to hang when start in fullscreen mode - // So we delay it later. -} - -// Handle child move request -static LRESULT CALLBACK canvas3dWndProcChild( - HWND hwnd, - UINT message, - WPARAM wParam, - LPARAM lParam) -{ - /* - switch (message) { - case WM_NCPAINT: - // handle switch mode from 256 back to >= 16 bits color mode - DWORD status; - if (hSema != NULL) { - status = WaitForSingleObject(hSema, 0); - if (status == WAIT_OBJECT_0) { - // This prevent deadlock, otherwise the window event - // thread will hangs if lock already acquired - // during window resize/toggle. - D3dCtx *ctx = findCtx(hwnd); - if (ctx != NULL) { - ctx->retryRestoreSurface = true; - } - unlock(); - } - } - break; - } - */ - return CallWindowProc(g_lpDefWindowProcChild, hwnd, message, - wParam, lParam); -} - - -VOID setWindowCallback(HWND topHwnd, HWND hwnd) -{ - // For some reasons, setting proc for the same handle - // will crash the application. So we work around this - // by checking the old window handle before setting the - // new one. - // long newWindowHandle; - /* - if (oldWindowHandle == 0) { - oldWindowHandle = GetWindowLong((HWND) hwnd, GWL_WNDPROC); - } - - newWindowHandle = GetWindowLong((HWND) hwnd, GWL_WNDPROC); - if (newWindowHandle == oldWindowHandle) { - g_lpDefWindowProcChild = (PROC_TYPE) - SetWindowLong((HWND) hwnd, GWL_WNDPROC, - (LONG) canvas3dWndProcChild); - } - */ -} - diff --git a/src/native/d3d/RasterRetained.cpp b/src/native/d3d/RasterRetained.cpp deleted file mode 100644 index 9cd3750..0000000 --- a/src/native/d3d/RasterRetained.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* - * $RCSfile$ - * - * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. - * - * Use is subject to license terms. - * - * $Revision$ - * $Date$ - * $State$ - */ - -#include "StdAfx.h" - -D3dImageComponent RasterList; -D3dImageComponent BackgroundImageList; - -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_RasterRetained_execute(JNIEnv *env, - jobject obj, jlong ctx, jobject geo, - jboolean updateAlpha, jfloat alpha, - jint type, jint w_raster, jint h_raster, - jint x_offset, jint y_offset, jfloat x, jfloat y, jfloat z, - jbyteArray imageYdown) -{ - jfieldID id; - int width, height; - int hashCode; - D3DVERTEX worldCoord; - D3DTLVERTEX screenCoord; - - GetDevice(); - - int startx = x_offset; - int starty = y_offset; - int endx = x_offset + w_raster; - int endy = y_offset + h_raster; - - jclass geo_class = env->GetObjectClass(geo); - - if ((type == javax_media_j3d_Raster_RASTER_COLOR) || - (type == javax_media_j3d_Raster_RASTER_COLOR_DEPTH)) { - - int alphaChanged = 0; // used so we can get alpha data from - // JNI before using it so we can use - // GetPrimitiveArrayCritical - - id = env->GetFieldID(geo_class, "image", - "Ljavax/media/j3d/ImageComponent2DRetained;"); - jobject image = env->GetObjectField(geo, id); - - - jclass image_class = env->GetObjectClass(image); - - if (image_class == NULL) { - return; - } - /* - id = env->GetFieldID(image_class, "surfaceDirty", "I"); - if (env->GetIntField(image, id) == NOTLIVE) { - return; - } - */ - id = env->GetFieldID(image_class, "width", "I"); - width = env->GetIntField(image, id); - id = env->GetFieldID(image_class, "height", "I"); - height = env->GetIntField(image, id); - - id = env->GetFieldID(image_class, "hashId", "I"); - hashCode = env->GetIntField(image, id); - - // clipping - if (startx > width) { - startx = width; - } else if (startx < 0) { - startx = 0; - } - if (starty > height) { - starty = height; - } else if (starty < 0) { - starty = 0; - } - if (endx > width) { - endx = width; - } else if (endx < 0) { - endx = 0; - } - if (endy > height) { - endy = height; - } else if (endy < 0) { - endy = 0; - } - - // raster position is upper left corner, default for Java3D - // ImageComponent currently has the data reverse in Y - worldCoord.x = x; - worldCoord.y = y; - worldCoord.z = z; - - lockImage(); - - D3dImageComponent* d3dImage = - D3dImageComponent::find(&RasterList, d3dCtx, hashCode); - - LPDIRECT3DTEXTURE9 surf = NULL ; - - if ((d3dImage == NULL) || (d3dImage->surf == NULL)) { - - surf = createSurfaceFromImage(env, image, ctx, - width, height, imageYdown); - - if (surf == NULL) { - if (d3dImage != NULL) { - D3dImageComponent::remove(&RasterList, d3dImage); - } - unlockImage(); - return; - } - if (d3dImage == NULL) { - d3dImage = D3dImageComponent::add(&RasterList, d3dCtx, hashCode, surf); - - if (d3dImage == NULL) { - return; - } - - } else { - d3dImage->surf = surf; - } - } - - d3dCtx->transform(&worldCoord, &screenCoord); - if ((screenCoord.sz >= 0) && (screenCoord.sz <= 1)) { - screenCoord.sx -= 0.5f; - screenCoord.sy -= 0.5f; - drawTextureRect(d3dCtx, device, d3dImage->surf, screenCoord, - startx, starty, endx, endy, - endx - startx, endy - starty, false); - } - unlockImage(); - - } - - if ((type == javax_media_j3d_Raster_RASTER_DEPTH) || - (type == javax_media_j3d_Raster_RASTER_COLOR_DEPTH)) { - id = env->GetFieldID(geo_class, "depthComponent", - "Ljavax/media/j3d/DepthComponentRetained;"); - - jobject depth = env->GetObjectField(geo, id); - jclass depth_class = env->GetObjectClass(depth); - - if (depth_class == NULL) { - return; - } - id = env->GetFieldID(depth_class, "type", "I"); - int depth_type = env->GetIntField(depth, id); - id = env->GetFieldID(depth_class, "width", "I"); - width = env->GetIntField(depth, id); - id = env->GetFieldID(depth_class, "height", "I"); - height = env->GetIntField(depth, id); - - - - // clipping - if (startx > width) { - startx = width; - } else if (startx < 0) { - startx = 0; - } - if (starty > height) { - starty = height; - } else if (starty < 0) { - starty = 0; - } - if (endx > width) { - endx = width; - } else if (endx < 0) { - endx = 0; - } - if (endy > height) { - endy = height; - } else if (endy < 0) { - endy = 0; - } - - int h = endy - starty; - int w = endx - startx; - - // raster position is upper left corner, default for Java3D - // ImageComponent currently has the data reverse in Y - if ((h > 0) && (w > 0)) { - worldCoord.x = x; - worldCoord.y = y; - worldCoord.z = z; - - d3dCtx->transform(&worldCoord, &screenCoord); - - if (d3dCtx->depthStencilSurface == NULL) { - HRESULT hr = - device->GetDepthStencilSurface(&d3dCtx->depthStencilSurface); - if (FAILED(hr)) { - if (debug) { - printf("[Java3D] Fail to get depth stencil surface %s\n", - DXGetErrorString9(hr)); - } - return; - } - } - - if (depth_type == javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_INT) { - id = env->GetFieldID(depth_class, "depthData","[I"); - jintArray intData_array = (jintArray) env->GetObjectField(depth, id); - jint * intData = (jint *) env->GetPrimitiveArrayCritical( - intData_array, NULL); - copyDepthToSurface(d3dCtx, - device, - (int)(screenCoord.sx), - (int)(screenCoord.sy), - x_offset, y_offset, - w, h,width, height, - intData, d3dCtx->depthStencilSurface); - env->ReleasePrimitiveArrayCritical(intData_array, - intData, 0); - } else { // javax_media_j3d_DepthComponentRetained_DEPTH_COMPONENT_TYPE_FLOAT - - id = env->GetFieldID(depth_class, "depthData","[F"); - jfloatArray floatData_array = (jfloatArray) - env->GetObjectField(depth, id); - - jfloat *floatData = (jfloat *) env->GetPrimitiveArrayCritical( - floatData_array, NULL); - copyDepthToSurface(d3dCtx, - device, - (jint)(screenCoord.sx), - (jint)(screenCoord.sy), - x_offset, y_offset, - w, h, width, height, - floatData, d3dCtx->depthStencilSurface); - env->ReleasePrimitiveArrayCritical(floatData_array, - floatData, 0); - } - } - } -} - - - -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_RasterRetained_executeTiled(JNIEnv *env, - jobject obj, jlong ctx, jobject geo, - jint format, jint w_raster, jint h_raster, - jint x_offset, jint y_offset, jint deltaw, jint deltah, - jfloat x, jfloat y, jfloat z, jbyteArray tile) -{ - // This is is not used by both OGL and D3D -} diff --git a/src/native/d3d/build-windows-amd64-vc.xml b/src/native/d3d/build-windows-amd64-vc.xml new file mode 100644 index 0000000..7182711 --- /dev/null +++ b/src/native/d3d/build-windows-amd64-vc.xml @@ -0,0 +1,64 @@ +<?xml version="1.0"?> + +<!-- +/* + * $RCSfile$ + * + * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. + * + * Use is subject to license terms. + * + * $Revision$ + * $Date$ + * $State$ + */ + --> + +<!-- Win64 ant file for d3d renderer --> +<project name="Java 3D" default="compile"> + + <target name="compile"> + + <echo message="Executing 64 bit native renderer build [${bldType}]"/> + + <!-- Create the build directories for amd64 --> + <mkdir dir="${build}/${platform}/${bldType}/native/d3d/objs"/> + <mkdir dir="${build}/${platform}/${bldType}/bin"/> + + <property name="javaInclude" + location="${java.home}/../include"/> + + <property name="javaWin32Include" + location="${java.home}/../include/win32"/> + + <property name="oglsrc" location="${src}/native/ogl"/> + <property name="d3dsrc" location="${src}/native/d3d"/> + + <!-- Compile the c source files--> + <exec dir="${build}/${platform}/${bldType}/native/d3d/objs" executable="cl"> + <arg line="-Ox -O2 -Ob2 -Os -Oi -GT -GL /nologo -wd4996 -I"${javaInclude}" -I"${javaWin32Include}" -I"${src}/native/ogl" -I"${javahCoreTarget}" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "J3DDX90PORT_EXPORTS" /D "WIN32" /D "D3D" /D "J3D_BUILDVERTICES" /D "NVIDIA_DEBUG" /FD /EHsc /MT /Fp"J3dDX90Port.pch" /W2 /c /TP "${oglsrc}/DrawingSurfaceObjectAWT.c" "${oglsrc}/MasterControl.c" "${d3dsrc}/D3dVertexBuffer.cpp" "${d3dsrc}/D3dDisplayList.cpp" "${d3dsrc}/D3dDriverInfo.cpp" "${d3dsrc}/D3dDeviceInfo.cpp" "${d3dsrc}/D3dCtx.cpp" "${d3dsrc}/D3dUtil.cpp" "${d3dsrc}/D3dImageComponent.cpp" "${d3dsrc}/GeometryArrayRetained.cpp" "${d3dsrc}/Canvas3D.cpp" "${d3dsrc}/GraphicsContext3D.cpp" "${d3dsrc}/Attributes.cpp" "${d3dsrc}/Lights.cpp" "${d3dsrc}/NativeConfigTemplate3D.cpp" "/> + </exec> + + + <!-- Create the library file--> + <exec dir="${build}/${platform}/${bldType}/native/d3d/objs" executable="link"> + <arg line="/OUT:"j3dcore-d3d.dll" /nologo -DLL -DELAYLOAD:jawt.dll -IMPLIB:"j3dcore-d3d.lib" -LTCG /ignore:4089 ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib DelayImp.lib Attributes.obj Canvas3D.obj D3dCtx.obj D3dDeviceInfo.obj D3dDisplayList.obj D3dDriverInfo.obj D3dImageComponent.obj D3dUtil.obj D3dVertexBuffer.obj DrawingSurfaceObjectAWT.obj GeometryArrayRetained.obj GraphicsContext3D.obj Lights.obj MasterControl.obj NativeConfigTemplate3D.obj ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib -LIBPATH:"${java.home}\..\lib" jawt.lib"/> + </exec> + + <!-- Copy the copyright library file --> + <copy file="${build}/${platform}/${bldType}/native/d3d/objs/j3dcore-d3d.dll" + todir="${build}/${platform}/${bldType}/bin"/> + + </target> + + <target name="dist"> + <!-- Create the distribution directory --> + <mkdir dir="${dist}/${platform}/bin"/> + + <!-- Copy the library files --> + <copy file="${build}/${platform}/opt/bin/j3dcore-d3d.dll" + todir="${dist}/${platform}/bin"/> + + </target> + +</project> diff --git a/src/native/d3d/build-windows-i586-vc.xml b/src/native/d3d/build-windows-i586-vc.xml index a1ad3b0..f432e0b 100644 --- a/src/native/d3d/build-windows-i586-vc.xml +++ b/src/native/d3d/build-windows-i586-vc.xml @@ -36,13 +36,13 @@ <!-- Compile the c source files--> <exec dir="${build}/${platform}/${bldType}/native/d3d/objs" executable="cl"> - <arg line="-Ox -Og -O2 -Ob2 -Os -Oi -GT -GL /nologo -I"${javaInclude}" -I"${javaWin32Include}" -I"${src}/native/ogl" -I"${javahCoreTarget}" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "J3DDX90PORT_EXPORTS" /D "WIN32" /D "D3D" /D "J3D_BUILDVERTICES" /D "NVIDIA_DEBUG" /FD /EHsc /MT /Fp"J3dDX90Port.pch" /W2 /c /TP "${oglsrc}/DrawingSurfaceObjectAWT.c" "${oglsrc}/MasterControl.c" "${d3dsrc}/D3dVertexBuffer.cpp" "${d3dsrc}/D3dDisplayList.cpp" "${d3dsrc}/D3dDriverInfo.cpp" "${d3dsrc}/D3dDeviceInfo.cpp" "${d3dsrc}/D3dCtx.cpp" "${d3dsrc}/D3dUtil.cpp" "${d3dsrc}/D3dImageComponent.cpp" "${d3dsrc}/GeometryArrayRetained.cpp" "${d3dsrc}/Canvas3D.cpp" "${d3dsrc}/GraphicsContext3D.cpp" "${d3dsrc}/Attributes.cpp" "${d3dsrc}/Lights.cpp" "${d3dsrc}/NativeConfigTemplate3D.cpp" "${d3dsrc}/NativeWSInfo.cpp" "${d3dsrc}/NativeAPIInfo.c" "${d3dsrc}/RasterRetained.cpp" "/> + <arg line="-Ox -Og -O2 -Ob2 -Os -Oi -GT -GL /nologo -I"${javaInclude}" -I"${javaWin32Include}" -I"${src}/native/ogl" -I"${javahCoreTarget}" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "J3DDX90PORT_EXPORTS" /D "WIN32" /D "D3D" /D "J3D_BUILDVERTICES" /D "NVIDIA_DEBUG" /FD /EHsc /MT /Fp"J3dDX90Port.pch" /W2 /c /TP "${oglsrc}/DrawingSurfaceObjectAWT.c" "${oglsrc}/MasterControl.c" "${d3dsrc}/D3dVertexBuffer.cpp" "${d3dsrc}/D3dDisplayList.cpp" "${d3dsrc}/D3dDriverInfo.cpp" "${d3dsrc}/D3dDeviceInfo.cpp" "${d3dsrc}/D3dCtx.cpp" "${d3dsrc}/D3dUtil.cpp" "${d3dsrc}/D3dImageComponent.cpp" "${d3dsrc}/GeometryArrayRetained.cpp" "${d3dsrc}/Canvas3D.cpp" "${d3dsrc}/GraphicsContext3D.cpp" "${d3dsrc}/Attributes.cpp" "${d3dsrc}/Lights.cpp" "${d3dsrc}/NativeConfigTemplate3D.cpp" "/> </exec> <!-- Create the library file--> <exec dir="${build}/${platform}/${bldType}/native/d3d/objs" executable="link"> - <arg line="/OUT:"j3dcore-d3d.dll" /nologo -DLL -DELAYLOAD:jawt.dll -IMPLIB:"j3dcore-d3d.lib" -MACHINE:X86 -LTCG /ignore:4089 ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib DelayImp.lib Attributes.obj Canvas3D.obj D3dCtx.obj D3dDeviceInfo.obj D3dDisplayList.obj D3dDriverInfo.obj D3dImageComponent.obj D3dUtil.obj D3dVertexBuffer.obj DrawingSurfaceObjectAWT.obj GeometryArrayRetained.obj GraphicsContext3D.obj Lights.obj MasterControl.obj NativeAPIInfo.obj NativeConfigTemplate3D.obj NativeWSInfo.obj RasterRetained.obj ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib -LIBPATH:"${java.home}\..\lib" jawt.lib"/> + <arg line="/OUT:"j3dcore-d3d.dll" /nologo -DLL -DELAYLOAD:jawt.dll -IMPLIB:"j3dcore-d3d.lib" -MACHINE:X86 -LTCG /ignore:4089 ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib DelayImp.lib Attributes.obj Canvas3D.obj D3dCtx.obj D3dDeviceInfo.obj D3dDisplayList.obj D3dDriverInfo.obj D3dImageComponent.obj D3dUtil.obj D3dVertexBuffer.obj DrawingSurfaceObjectAWT.obj GeometryArrayRetained.obj GraphicsContext3D.obj Lights.obj MasterControl.obj NativeConfigTemplate3D.obj ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib -LIBPATH:"${java.home}\..\lib" jawt.lib"/> </exec> <!-- Copy the copyright library file --> |