File tree Expand file tree Collapse file tree 8 files changed +19
-56
lines changed Expand file tree Collapse file tree 8 files changed +19
-56
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ function vtkOpenGLActor(publicAPI, model) {
132132
133133 publicAPI . opaquePass = ( prepass , renderPass ) => {
134134 if ( prepass ) {
135- model . openGLRenderWindow . enableDepthMask ( ) ;
135+ model . context . depthMask ( true ) ;
136136 publicAPI . activateTextures ( ) ;
137137 } else if ( model . activeTextures ) {
138138 for ( let index = 0 ; index < model . activeTextures . length ; index ++ ) {
@@ -144,7 +144,7 @@ function vtkOpenGLActor(publicAPI, model) {
144144 // Renders myself
145145 publicAPI . translucentPass = ( prepass , renderPass ) => {
146146 if ( prepass ) {
147- model . openGLRenderWindow . disableDepthMask ( ) ;
147+ model . context . depthMask ( false ) ;
148148 publicAPI . activateTextures ( ) ;
149149 } else if ( model . activeTextures ) {
150150 for ( let index = 0 ; index < model . activeTextures . length ; index ++ ) {
Original file line number Diff line number Diff line change @@ -17,8 +17,12 @@ function vtkOpenGLActor2D(publicAPI, model) {
1717 if ( ! model . renderable ) {
1818 return ;
1919 }
20+ model . openGLRenderWindow = publicAPI . getFirstAncestorOfType (
21+ 'vtkOpenGLRenderWindow'
22+ ) ;
2023 model . openGLRenderer =
2124 publicAPI . getFirstAncestorOfType ( 'vtkOpenGLRenderer' ) ;
25+ model . context = model . openGLRenderWindow . getContext ( ) ;
2226 publicAPI . prepareNodes ( ) ;
2327 publicAPI . addMissingNodes ( model . renderable . getTextures ( ) ) ;
2428 publicAPI . addMissingNode ( model . renderable . getMapper ( ) ) ;
@@ -84,9 +88,6 @@ function vtkOpenGLActor2D(publicAPI, model) {
8488 // Renders myself
8589 publicAPI . opaquePass = ( prepass , renderPass ) => {
8690 if ( prepass ) {
87- model . context = publicAPI
88- . getFirstAncestorOfType ( 'vtkOpenGLRenderWindow' )
89- . getContext ( ) ;
9091 model . context . depthMask ( true ) ;
9192 publicAPI . activateTextures ( ) ;
9293 } else {
@@ -100,9 +101,6 @@ function vtkOpenGLActor2D(publicAPI, model) {
100101 // Renders myself
101102 publicAPI . translucentPass = ( prepass , renderPass ) => {
102103 if ( prepass ) {
103- model . context = publicAPI
104- . getFirstAncestorOfType ( 'vtkOpenGLRenderWindow' )
105- . getContext ( ) ;
106104 model . context . depthMask ( false ) ;
107105 publicAPI . activateTextures ( ) ;
108106 } else {
Original file line number Diff line number Diff line change @@ -22,9 +22,12 @@ function vtkOpenGLImageSlice(publicAPI, model) {
2222 if ( ! model . renderable ) {
2323 return ;
2424 }
25-
25+ model . openGLRenderWindow = publicAPI . getFirstAncestorOfType (
26+ 'vtkOpenGLRenderWindow'
27+ ) ;
2628 model . openGLRenderer =
2729 publicAPI . getFirstAncestorOfType ( 'vtkOpenGLRenderer' ) ;
30+ model . context = model . openGLRenderWindow . getContext ( ) ;
2831 publicAPI . prepareNodes ( ) ;
2932 publicAPI . addMissingNode ( model . renderable . getMapper ( ) ) ;
3033 publicAPI . removeUnusedNodes ( ) ;
@@ -92,23 +95,13 @@ function vtkOpenGLImageSlice(publicAPI, model) {
9295 // Renders myself
9396 publicAPI . opaquePass = ( prepass , renderPass ) => {
9497 if ( prepass ) {
95- model . context = publicAPI
96- . getFirstAncestorOfType ( 'vtkOpenGLRenderWindow' )
97- . getContext ( ) ;
9898 model . context . depthMask ( true ) ;
9999 }
100100 } ;
101101
102102 // Renders myself
103103 publicAPI . translucentPass = ( prepass , renderPass ) => {
104- if ( prepass ) {
105- model . context = publicAPI
106- . getFirstAncestorOfType ( 'vtkOpenGLRenderWindow' )
107- . getContext ( ) ;
108- model . context . depthMask ( false ) ;
109- } else {
110- model . context . depthMask ( true ) ;
111- }
104+ model . context . depthMask ( ! prepass ) ;
112105 } ;
113106
114107 publicAPI . getKeyMatrices = ( ) => {
Original file line number Diff line number Diff line change @@ -273,16 +273,6 @@ export interface vtkOpenGLRenderWindow extends vtkOpenGLRenderWindowBase {
273273 */
274274 traverseAllPasses ( ) : void ;
275275
276- /**
277- *
278- */
279- disableDepthMask ( ) : void ;
280-
281- /**
282- *
283- */
284- enableDepthMask ( ) : void ;
285-
286276 /**
287277 *
288278 */
Original file line number Diff line number Diff line change @@ -1045,20 +1045,6 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
10451045 }
10461046 } ;
10471047
1048- publicAPI . disableDepthMask = ( ) => {
1049- if ( model . depthMaskEnabled ) {
1050- model . context . depthMask ( false ) ;
1051- model . depthMaskEnabled = false ;
1052- }
1053- } ;
1054-
1055- publicAPI . enableDepthMask = ( ) => {
1056- if ( ! model . depthMaskEnabled ) {
1057- model . context . depthMask ( true ) ;
1058- model . depthMaskEnabled = true ;
1059- }
1060- } ;
1061-
10621048 publicAPI . disableCullFace = ( ) => {
10631049 if ( model . cullFaceEnabled ) {
10641050 model . context . disable ( model . context . CULL_FACE ) ;
@@ -1116,7 +1102,6 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
11161102
11171103const DEFAULT_VALUES = {
11181104 cullFaceEnabled : false ,
1119- depthMaskEnabled : true ,
11201105 shaderCache : null ,
11211106 initialized : false ,
11221107 context : null ,
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ function vtkOpenGLRenderer(publicAPI, model) {
5959 if ( ! model . renderable . getPreserveDepthBuffer ( ) ) {
6060 gl . clearDepth ( 1.0 ) ;
6161 clearMask |= gl . DEPTH_BUFFER_BIT ;
62- gl . depthMask ( true ) ;
62+ model . context . depthMask ( true ) ;
6363 }
6464
6565 const ts = publicAPI . getTiledSizeAndOrigin ( ) ;
@@ -146,7 +146,7 @@ function vtkOpenGLRenderer(publicAPI, model) {
146146 if ( ! model . renderable . getPreserveDepthBuffer ( ) ) {
147147 gl . clearDepth ( 1.0 ) ;
148148 clearMask |= gl . DEPTH_BUFFER_BIT ;
149- gl . depthMask ( true ) ;
149+ model . context . depthMask ( true ) ;
150150 }
151151
152152 gl . colorMask ( true , true , true , true ) ;
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ function vtkOpenGLSkybox(publicAPI, model) {
4949 if ( prepass && ! model . openGLRenderer . getSelector ( ) ) {
5050 publicAPI . updateBufferObjects ( ) ;
5151
52- model . openGLRenderWindow . enableDepthMask ( ) ;
52+ model . context . depthMask ( true ) ;
5353
5454 model . openGLRenderWindow
5555 . getShaderCache ( )
Original file line number Diff line number Diff line change @@ -19,8 +19,12 @@ function vtkOpenGLVolume(publicAPI, model) {
1919 return ;
2020 }
2121 if ( prepass ) {
22+ model . openGLRenderWindow = publicAPI . getFirstAncestorOfType (
23+ 'vtkOpenGLRenderWindow'
24+ ) ;
2225 model . openGLRenderer =
2326 publicAPI . getFirstAncestorOfType ( 'vtkOpenGLRenderer' ) ;
27+ model . context = model . openGLRenderWindow . getContext ( ) ;
2428 publicAPI . prepareNodes ( ) ;
2529 publicAPI . addMissingNode ( model . renderable . getMapper ( ) ) ;
2630 publicAPI . removeUnusedNodes ( ) ;
@@ -58,14 +62,7 @@ function vtkOpenGLVolume(publicAPI, model) {
5862 if ( ! model . renderable || ! model . renderable . getVisibility ( ) ) {
5963 return ;
6064 }
61- if ( prepass ) {
62- model . context = publicAPI
63- . getFirstAncestorOfType ( 'vtkOpenGLRenderWindow' )
64- . getContext ( ) ;
65- model . context . depthMask ( false ) ;
66- } else {
67- model . context . depthMask ( true ) ;
68- }
65+ model . context . depthMask ( ! prepass ) ;
6966 } ;
7067
7168 publicAPI . getKeyMatrices = ( ) => {
You can’t perform that action at this time.
0 commit comments