Clay Engine: support draw callbacks
This commit is contained in:
@@ -715,6 +715,8 @@ static void CLAY_view_draw(RenderEngine *UNUSED(engine), const bContext *context
|
||||
/* Start Drawing */
|
||||
DRW_draw_background();
|
||||
|
||||
DRW_draw_callbacks_pre_scene();
|
||||
|
||||
/* Pass 1 : Depth pre-pass */
|
||||
DRW_draw_pass(psl->depth_pass);
|
||||
DRW_draw_pass(psl->depth_pass_cull);
|
||||
@@ -730,6 +732,8 @@ static void CLAY_view_draw(RenderEngine *UNUSED(engine), const bContext *context
|
||||
/* At this point all shaded geometry should have been rendered and their depth written */
|
||||
DRW_draw_mode_overlays();
|
||||
|
||||
DRW_draw_callbacks_post_scene();
|
||||
|
||||
/* Always finish by this */
|
||||
DRW_state_reset();
|
||||
}
|
||||
|
||||
@@ -221,6 +221,9 @@ void DRW_mode_cache_finish(void);
|
||||
void DRW_draw_pass(DRWPass *pass);
|
||||
void DRW_draw_mode_overlays(void);
|
||||
|
||||
void DRW_draw_callbacks_pre_scene(void);
|
||||
void DRW_draw_callbacks_post_scene(void);
|
||||
|
||||
void DRW_state_reset(void);
|
||||
|
||||
/* Other */
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
#include "DNA_view3d_types.h"
|
||||
|
||||
#include "ED_space_api.h"
|
||||
|
||||
#include "GPU_batch.h"
|
||||
#include "GPU_draw.h"
|
||||
#include "GPU_extensions.h"
|
||||
@@ -1025,6 +1027,36 @@ void DRW_draw_pass(DRWPass *pass)
|
||||
}
|
||||
}
|
||||
|
||||
void DRW_draw_callbacks_pre_scene(void)
|
||||
{
|
||||
struct ARegion *ar = CTX_wm_region(DST.context);
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(DST.context);
|
||||
|
||||
/* This is temporary
|
||||
* waiting for the full matrix switch */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadMatrixf((float *)rv3d->winmat);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadMatrixf((float *)rv3d->viewmat);
|
||||
|
||||
ED_region_draw_cb_draw(DST.context, ar, REGION_DRAW_PRE_VIEW);
|
||||
}
|
||||
|
||||
void DRW_draw_callbacks_post_scene(void)
|
||||
{
|
||||
struct ARegion *ar = CTX_wm_region(DST.context);
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(DST.context);
|
||||
|
||||
/* This is temporary
|
||||
* waiting for the full matrix switch */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadMatrixf((float *)rv3d->winmat);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadMatrixf((float *)rv3d->viewmat);
|
||||
|
||||
ED_region_draw_cb_draw(DST.context, ar, REGION_DRAW_POST_VIEW);
|
||||
}
|
||||
|
||||
/* Reset state to not interfer with other UI drawcall */
|
||||
void DRW_state_reset(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user