aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/d3d
diff options
context:
space:
mode:
Diffstat (limited to 'src/native/d3d')
-rw-r--r--src/native/d3d/Canvas3D.cpp37
-rw-r--r--src/native/d3d/D3dCtx.hpp4
2 files changed, 27 insertions, 14 deletions
diff --git a/src/native/d3d/Canvas3D.cpp b/src/native/d3d/Canvas3D.cpp
index 8463b0d..010da46 100644
--- a/src/native/d3d/Canvas3D.cpp
+++ b/src/native/d3d/Canvas3D.cpp
@@ -302,18 +302,22 @@ void JNICALL Java_javax_media_j3d_NativePipeline_clear(
{
GetDevice();
-
+
+// TODO ACES: The d3dCtx->stencilEnable and d3dCtx->stencilWriteEnable flags
+// are not used in the rest of the code. They are never set to a value, and
+// they are not looked at by most of the code.
+
/* Java 3D always clears the Z-buffer */
- /* @TODO check same operation for stencil */
-
+
if (!d3dCtx->zWriteEnable) {
device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
- }
+ }
- // TODO KCR : Issue 239 - use clearStencil to decide whether to clear stencil
+ // Issue 239 - clear stencil, if requested
+ if (clearStencil) {
+ device->SetRenderState(D3DRS_STENCILENABLE, TRUE);
+ device->SetRenderState(D3DRS_STENCILWRITEMASK, ~0);
- /* clear stencil, if in used */
- if (d3dCtx->stencilWriteEnable ) {
// clear stencil and ZBuffer
HRESULT hr = device->Clear(0, NULL,
D3DCLEAR_STENCIL | D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
@@ -321,7 +325,16 @@ void JNICALL Java_javax_media_j3d_NativePipeline_clear(
if (hr == D3DERR_INVALIDCALL) {
printf("[Java3D] Error cleaning Canvas3D stencil & ZBuffer\n");
}
- // printf("canvas3D clear stencil & ZBuffer\n");
+ // printf("canvas3D clear stencil & ZBuffer\n");
+
+ // TODO: DO WE NEED TO RESTORE THE STENCIL ENABLE AND WRITE MASK???
+// if (!d3dCtx->stencilEnable) {
+// device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+// }
+// if (!d3dCtx->stencilWriteEnable) {
+// device->SetRenderState(D3DRS_STENCILWRITEMASK, 0);
+// }
+
}
else {
// clear ZBuffer only
@@ -332,15 +345,11 @@ void JNICALL Java_javax_media_j3d_NativePipeline_clear(
}
// 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
diff --git a/src/native/d3d/D3dCtx.hpp b/src/native/d3d/D3dCtx.hpp
index 4365119..96aea9f 100644
--- a/src/native/d3d/D3dCtx.hpp
+++ b/src/native/d3d/D3dCtx.hpp
@@ -137,6 +137,10 @@ public:
DWORD softwareVertexProcessing;
DWORD zWriteEnable;
DWORD zEnable;
+
+// TODO ACES: The following two stencil enable flags are not used
+// consistently throughout the pipeline. They are never set to a value,
+// and they are not looked at by most of the code.
DWORD stencilWriteEnable; // new on 1.4
DWORD stencilEnable; // new on 1.4