44 float winmat[4][4], viewmat[4][4], viewinv[4][4];
60 const int size[2] = {(int)viewport_size[0], (
int)viewport_size[1]};
78 GPU_framebuffer_ensure_config(
80 {GPU_ATTACHMENT_TEXTURE(dtxl->depth), GPU_ATTACHMENT_TEXTURE(dtxl->color)});
83 {GPU_ATTACHMENT_TEXTURE(dtxl->depth), GPU_ATTACHMENT_NONE});
86 {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(dtxl->color)});
123 for (
int i = 0; i < pix_num; i++) {
124 if (rp->
rect[i] == 1.0f) {
128 rp->
rect[i] = rp->
rect[i] * 2.0f - 1.0f;
129 rp->
rect[i] = winmat[3][2] / (rp->
rect[i] + winmat[2][2]);
137 float range =
fabsf(far - near);
139 for (
int i = 0; i < pix_num; i++) {
140 if (rp->
rect[i] == 1.0f) {
144 rp->
rect[i] = rp->
rect[i] * range - near;
179 GPU_framebuffer_clear_depth(dfbl->
default_fb, 1.0f);
MINLINE int max_ii(int a, int b)
bool invert_m4_m4(float R[4][4], const float A[4][4])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
struct Depsgraph Depsgraph
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
#define RE_PASSNAME_COMBINED
void GPU_render_step(void)
bool GPU_framebuffer_check_valid(GPUFrameBuffer *fb, char err_out[256])
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
const Depsgraph * depsgraph
void DRW_curves_update(void)
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
void DRW_render_instance_buffer_finish(void)
const DRWContextState * DRW_context_state_get(void)
const float * DRW_viewport_size_get(void)
DefaultTextureList * DRW_viewport_texture_list_get(void)
void DRW_render_object_iter(void *vedata, RenderEngine *engine, struct Depsgraph *depsgraph, void(*callback)(void *vedata, Object *ob, RenderEngine *engine, struct Depsgraph *depsgraph))
float DRW_view_near_distance_get(const DRWView *view)
bool DRW_view_is_persp_get(const DRWView *view)
void DRW_view_winmat_get(const DRWView *view, float mat[4][4], bool inverse)
DRWView * DRW_view_create(const float viewmat[4][4], const float winmat[4][4], const float(*culling_viewmat)[4], const float(*culling_winmat)[4], DRWCallVisibilityFn *visibility_fn)
float DRW_view_far_distance_get(const DRWView *view)
void DRW_view_default_set(const DRWView *view)
void DRW_view_set_active(const DRWView *view)
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img GPU_RGBA16F
void RE_engine_report(RenderEngine *engine, int type, const char *msg)
bool RE_engine_test_break(RenderEngine *engine)
void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer, const char *name, int channels, const char *chanid, eNodeSocketDatatype type)
void GPU_framebuffer_read_color(GPUFrameBuffer *gpu_fb, int x, int y, int w, int h, int channels, int slot, eGPUDataFormat format, void *data)
void GPU_framebuffer_read_depth(GPUFrameBuffer *gpu_fb, int x, int y, int w, int h, eGPUDataFormat format, void *data)
void RE_GetCameraModelMatrix(const Render *re, const struct Object *camera, float r_modelmat[4][4])
struct Object * RE_GetCamera(Render *re)
void RE_GetCameraWindow(struct Render *re, const struct Object *camera, float r_winmat[4][4])
RenderPass * RE_pass_find_by_name(RenderLayer *rl, const char *name, const char *viewname)
const char * RE_GetActiveRenderView(Render *re)
struct Depsgraph * depsgraph
struct ViewLayer * view_layer
struct GPUFrameBuffer * depth_only_fb
struct GPUFrameBuffer * default_fb
struct GPUFrameBuffer * color_only_fb
struct GPUTexture * depth
struct GPUTexture * color
void workbench_private_data_alloc(WORKBENCH_StorageList *stl)
void workbench_update_world_ubo(WORKBENCH_PrivateData *wpd)
void workbench_draw_finish(void *UNUSED(ved))
void workbench_cache_populate(void *ved, Object *ob)
void workbench_cache_init(void *ved)
void workbench_engine_init(void *ved)
void workbench_cache_finish(void *ved)
void workbench_draw_sample(void *ved)
static bool workbench_render_framebuffers_init(void)
void workbench_render(void *ved, RenderEngine *engine, RenderLayer *render_layer, const rcti *rect)
static void workbench_render_cache(void *vedata, struct Object *ob, struct RenderEngine *UNUSED(engine), struct Depsgraph *UNUSED(depsgraph))
static void workbench_render_result_z(struct RenderLayer *rl, const char *viewname, const rcti *rect)
static void workbench_render_matrices_init(RenderEngine *engine, Depsgraph *depsgraph)
void workbench_render_update_passes(RenderEngine *engine, Scene *scene, ViewLayer *view_layer)