@@ -32,6 +32,8 @@ static int fov;
3232
3333static int ne_main_screen = 1 ; // 1 = top, 0 = bottom
3434
35+ static NE_BufferingMode ne_depth_buffering_mode = NE_ZBUFFERING ; // Z_BUFFERING by default
36+
3537static uint32_t ne_dma_enabled = 0 ;
3638static uint32_t ne_dma_src = 0 ;
3739static uint32_t ne_dma_dst = 0 ;
@@ -245,6 +247,8 @@ static void ne_init_registers(void)
245247 GFX_FLUSH = 0 ;
246248 GFX_FLUSH = 0 ;
247249
250+ ne_depth_buffering_mode = NE_ZBUFFERING ; // Set default Z-buffering
251+
248252 NE_MainScreenSetOnTop ();
249253 lcdMainOnTop ();
250254
@@ -314,6 +318,16 @@ void NE_UpdateInput(void)
314318 touchRead (& ne_input .touch );
315319}
316320
321+ void NE_SetDepthBufferingMode (NE_BufferingMode mode )
322+ {
323+ ne_depth_buffering_mode = mode ;
324+ }
325+
326+ NE_BufferingMode NE_GetDepthBufferingMode (void )
327+ {
328+ return ne_depth_buffering_mode ;
329+ }
330+
317331int NE_Init3D (void )
318332{
319333 NE_End ();
@@ -622,7 +636,7 @@ void NE_Process(NE_Voidfunc drawscene)
622636 NE_AssertPointer (drawscene , "NULL function pointer" );
623637 drawscene ();
624638
625- GFX_FLUSH = GL_TRANS_MANUALSORT ;
639+ GFX_FLUSH = GL_TRANS_MANUALSORT | ne_depth_buffering_mode ;
626640}
627641
628642void NE_ProcessArg (NE_VoidArgfunc drawscene , void * arg )
@@ -632,7 +646,7 @@ void NE_ProcessArg(NE_VoidArgfunc drawscene, void *arg)
632646 NE_AssertPointer (drawscene , "NULL function pointer" );
633647 drawscene (arg );
634648
635- GFX_FLUSH = GL_TRANS_MANUALSORT ;
649+ GFX_FLUSH = GL_TRANS_MANUALSORT | ne_depth_buffering_mode ;
636650}
637651
638652static void ne_process_dual_3d_common_start (void )
@@ -688,7 +702,7 @@ static void ne_process_dual_3d_common_start(void)
688702
689703static void ne_process_dual_3d_common_end (void )
690704{
691- GFX_FLUSH = GL_TRANS_MANUALSORT ;
705+ GFX_FLUSH = GL_TRANS_MANUALSORT | ne_depth_buffering_mode ;
692706
693707 NE_Screen ^= 1 ;
694708}
@@ -768,7 +782,7 @@ static void ne_process_dual_3d_fb_common_start(void)
768782
769783static void ne_process_dual_3d_fb_common_end (void )
770784{
771- GFX_FLUSH = GL_TRANS_MANUALSORT ;
785+ GFX_FLUSH = GL_TRANS_MANUALSORT | ne_depth_buffering_mode ;
772786
773787 NE_Screen ^= 1 ;
774788}
@@ -937,7 +951,7 @@ static void ne_process_dual_3d_dma_common_start(void)
937951
938952static void ne_process_dual_3d_dma_common_end (void )
939953{
940- GFX_FLUSH = GL_TRANS_MANUALSORT ;
954+ GFX_FLUSH = GL_TRANS_MANUALSORT | ne_depth_buffering_mode ;
941955
942956 NE_Screen ^= 1 ;
943957
0 commit comments