139 is_object_data_visible =
false;
147 if (is_object_data_visible) {
155 emitter_handle = handle;
160 emitter_handle = handle;
215 draw_callback(
opaque_ps.gbuffer_in_front_ps_);
228 bool show_missing_texture =
false)
231 int material_index =
resources.material_buf.size() - 1;
233 if (show_missing_texture && (!
texture || !
texture->gpu.texture)) {
238 mesh_pass.get_subpass(eGeometryType::MESH, texture).draw(batch, handle, material_index);
244 bool has_transparent_material =
false;
249 gpu::Batch **batches;
260 if (batches[i] ==
nullptr) {
264 int material_slot = i;
266 has_transparent_material = has_transparent_material || mat.is_transparent();
296 has_transparent_material = has_transparent_material || mat.is_transparent();
321 mat.base_color =
batch.debug_color();
336 mat.base_color =
batch.debug_color();
350 int material_index =
resources.material_buf.size() - 1;
353 PassMain::Sub &pass =
354 mesh_pass.get_subpass(eGeometryType::POINTCLOUD).sub(
"Point Cloud SubPass");
355 gpu::Batch *batch = point_cloud_sub_pass_setup(pass, ob_ref.object);
356 pass.draw(batch, handle, material_index);
376 int material_index =
resources.material_buf.size() - 1;
379 PassMain::Sub &pass =
380 mesh_pass.get_subpass(eGeometryType::CURVES, &texture).sub(
"Hair SubPass");
381 pass.push_constant(
"emitter_object_id", int(emitter_handle.raw));
382 gpu::Batch *batch = hair_sub_pass_setup(pass, scene_state.scene, ob_ref.object, psys, md);
383 pass.draw(batch, handle, material_index);
394 int material_index =
resources.material_buf.size() - 1;
397 PassMain::Sub &pass = mesh_pass.get_subpass(eGeometryType::CURVES).sub(
"Curves SubPass");
398 gpu::Batch *batch = curves_sub_pass_setup(pass, scene_state.scene, ob_ref.object);
399 pass.draw(batch, handle, material_index);
404 GPUTexture *depth_tx,
405 GPUTexture *depth_in_front_tx,
414 bool needs_depth_in_front = !
transparent_ps.accumulation_in_front_ps_.is_empty() ||
415 (!
opaque_ps.gbuffer_in_front_ps_.is_empty() &&
417 resources.depth_in_front_tx.wrap(needs_depth_in_front ? depth_in_front_tx :
nullptr);
418 if (!needs_depth_in_front ||
opaque_ps.gbuffer_in_front_ps_.is_empty()) {
463 GPUTexture *depth_tx,
464 GPUTexture *depth_in_front_tx,
475 GPUTexture *depth_tx,
476 GPUTexture *depth_in_front_tx,
602 if (dtxl->
color ==
nullptr) {
621 {GPU_ATTACHMENT_TEXTURE(dtxl->depth), GPU_ATTACHMENT_TEXTURE(dtxl->color)});
624 {GPU_ATTACHMENT_TEXTURE(dtxl->depth), GPU_ATTACHMENT_NONE});
627 {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(dtxl->color)});
635 const char *viewname,
655 const char *viewname,
681 z = winmat[3][2] / (
z + winmat[2][2]);
689 float range =
fabsf(far - near);
696 z =
z * range - near;
746 auto workbench_render_cache =
struct Material * BKE_material_default_empty(void)
struct Material * BKE_object_material_get_eval(struct Object *ob, short act)
bool BKE_modifier_is_enabled(const Scene *scene, ModifierData *md, int required_mode)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
General operations, lookup, etc. for blender objects.
A BVH for high poly meshes.
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
@ eModifierType_ParticleSystem
#define RE_PASSNAME_COMBINED
@ V3D_SHADING_TEXTURE_COLOR
@ V3D_SHADING_VERTEX_COLOR
@ V3D_SHADING_MATERIAL_COLOR
@ V3D_SHADING_OBJECT_COLOR
@ V3D_SHADING_RANDOM_COLOR
@ V3D_SHADING_SINGLE_COLOR
char DRWViewportEmptyList
#define DRW_VIEWPORT_DATA_SIZE(ty)
eGPUBackendType GPU_backend_get_type()
bool GPU_framebuffer_check_valid(GPUFrameBuffer *framebuffer, char err_out[256])
#define GPU_ATTACHMENT_TEXTURE(_texture)
void GPU_framebuffer_clear_depth_stencil(GPUFrameBuffer *fb, float clear_depth, uint clear_stencil)
void GPU_framebuffer_read_depth(GPUFrameBuffer *framebuffer, int x, int y, int width, int height, eGPUDataFormat data_format, void *r_data)
#define GPU_ATTACHMENT_NONE
void GPU_framebuffer_multi_clear(GPUFrameBuffer *framebuffer, const float(*clear_colors)[4])
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
void GPU_framebuffer_read_color(GPUFrameBuffer *framebuffer, int x, int y, int width, int height, int channels, int slot, eGPUDataFormat data_format, void *r_data)
#define GPU_framebuffer_ensure_config(_fb,...)
GPUTexture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
@ GPU_TEXTURE_USAGE_GENERAL
Contains defines and structs used throughout the imbuf module.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object instance
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
ResourceHandle resource_handle(const ObjectRef &ref, float inflate_bounds=0.0f)
A running instance of the engine.
void draw(Manager &manager, GPUTexture *depth_tx, GPUTexture *depth_in_front_tx, GPUTexture *color_tx)
void draw_image_render(Manager &manager, GPUTexture *depth_tx, GPUTexture *depth_in_front_tx, GPUTexture *color_tx, RenderEngine *engine=nullptr)
Material get_material(ObjectRef ob_ref, eV3DShadingColorType color_type, int slot=0)
void init(Object *camera_ob=nullptr)
TransparentDepthPass transparent_depth_ps
void draw_viewport(Manager &manager, GPUTexture *depth_tx, GPUTexture *depth_in_front_tx, GPUTexture *color_tx)
void draw_to_mesh_pass(ObjectRef &ob_ref, bool is_transparent, F draw_callback)
TransparentPass transparent_ps
void curves_sync(Manager &manager, ObjectRef &ob_ref, const ObjectState &object_state)
GPUMaterial ** get_dummy_gpu_materials(int material_count)
AntiAliasingPass anti_aliasing_ps
void draw_mesh(ObjectRef &ob_ref, Material &material, gpu::Batch *batch, ResourceHandle handle, const MaterialTexture *texture=nullptr, bool show_missing_texture=false)
void object_sync(Manager &manager, ObjectRef &ob_ref)
void sculpt_sync(ObjectRef &ob_ref, ResourceHandle handle, const ObjectState &object_state)
void mesh_sync(ObjectRef &ob_ref, ResourceHandle handle, const ObjectState &object_state)
Vector< GPUMaterial * > dummy_gpu_materials
void hair_sync(Manager &manager, ObjectRef &ob_ref, ResourceHandle emitter_handle, const ObjectState &object_state, ParticleSystem *psys, ModifierData *md)
void point_cloud_sync(Manager &manager, ObjectRef &ob_ref, const ObjectState &object_state)
local_group_size(16, 16) .push_constant(Type texture
blender::gpu::Batch * DRW_cache_object_surface_get(Object *ob)
blender::gpu::Batch * DRW_cache_mesh_surface_sculptcolors_get(Object *ob)
blender::gpu::Batch * DRW_cache_mesh_surface_vertpaint_get(Object *ob)
blender::gpu::Batch ** DRW_cache_object_surface_material_get(Object *ob, GPUMaterial **gpumat_array, uint gpumat_array_len)
int DRW_cache_object_material_count_get(const Object *ob)
blender::gpu::Batch * DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
blender::gpu::Batch ** DRW_cache_mesh_surface_texpaint_get(Object *ob)
blender::draw::Manager * DRW_manager_get()
Object * DRW_object_get_dupli_parent(const Object *)
bool DRW_state_is_viewport_image_render()
DefaultFramebufferList * DRW_viewport_framebuffer_list_get()
const float * DRW_viewport_size_get()
bool DRW_object_is_renderable(const Object *ob)
void DRW_render_instance_buffer_finish()
int DRW_object_visibility_in_active_context(const Object *ob)
bool DRW_state_is_scene_render()
bool DRW_object_is_visible_psys_in_active_context(const Object *object, const ParticleSystem *psys)
DefaultTextureList * DRW_viewport_texture_list_get()
void DRW_render_to_image(RenderEngine *engine, Depsgraph *depsgraph)
const DRWContextState * DRW_context_state_get()
DupliObject * DRW_object_get_dupli(const Object *)
void DRW_viewport_request_redraw()
void DRW_render_object_iter(void *vedata, RenderEngine *engine, Depsgraph *depsgraph, void(*callback)(void *vedata, Object *ob, RenderEngine *engine, Depsgraph *depsgraph))
const DRWView * DRW_view_default_get()
float DRW_view_near_distance_get(const DRWView *view)
bool DRW_view_is_persp_get(const DRWView *view)
float DRW_view_far_distance_get(const DRWView *view)
void DRW_view_default_set(const DRWView *view)
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)
void DRW_view_set_active(const DRWView *view)
#define SCULPT_DEBUG_DRAW
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
struct @157336070235062372277311340362362342103123126032::@262166344314164341202215145112231240022370055142 batch
BLI_INLINE float fb(float length, float L)
void RE_GetCameraModelMatrix(const Render *re, const Object *camera, float r_modelmat[4][4])
void RE_GetCameraWindow(Render *re, const Object *camera, float r_winmat[4][4])
Object * RE_GetCamera(Render *re)
void RE_engine_report(RenderEngine *engine, int type, const char *msg)
bool RE_engine_test_break(RenderEngine *engine)
void RE_engine_register_pass(RenderEngine *engine, Scene *scene, ViewLayer *view_layer, const char *name, int channels, const char *chanid, eNodeSocketDatatype type)
pbvh::Tree * pbvh_get(Object &object)
Bounds< float3 > bounds_get(const Tree &pbvh)
Vector< SculptBatch > sculpt_batches_get(const Object *ob, SculptBatchFeature features)
@ SCULPT_BATCH_VERTEX_COLOR
CartesianBasis invert(const CartesianBasis &basis)
T midpoint(const T &a, const T &b)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 3 > float3
vertex_in(0, Type::VEC2, "pos") .push_constant(Type ratio draw_mesh
RenderPass * RE_pass_find_by_name(RenderLayer *rl, const char *name, const char *viewname)
const char * RE_GetActiveRenderView(Render *re)
GPUFrameBuffer * depth_only_fb
GPUFrameBuffer * color_only_fb
GPUFrameBuffer * default_fb
GPUTexture * depth_in_front
struct FluidDomainSettings * domain
ImBufFloatBuffer float_buffer
DrawEngineType * engine_type
DRWViewportEmptyList * psl
DRWViewportEmptyList * stl
workbench::Instance * instance
DRWViewportEmptyList * txl
DRWViewportEmptyList * fbl
const c_style_mat & ptr() const
DupliObject * dupli_object
bool use_per_material_batches
MaterialTexture image_paint_override
eV3DShadingColorType color_type
bool show_missing_texture
bool reset_taa_next_sample
static void workbench_draw_scene(void *vedata)
DrawEngineType draw_engine_workbench
static void workbench_cache_init(void *vedata)
RenderEngineType DRW_engine_viewport_workbench_type
static void workbench_render_update_passes(RenderEngine *engine, Scene *scene, ViewLayer *view_layer)
static void workbench_id_update(void *vedata, ID *id)
static void workbench_instance_free(void *instance)
static void workbench_engine_init(void *vedata)
static void workbench_view_update(void *vedata)
static void write_render_z_output(RenderLayer *layer, const char *viewname, GPUFrameBuffer *fb, const rcti *rect, const float4x4 &winmat)
static void workbench_render_to_image(void *vedata, RenderEngine *engine, RenderLayer *layer, const rcti *rect)
static void workbench_cache_finish(void *vedata)
static void write_render_color_output(RenderLayer *layer, const char *viewname, GPUFrameBuffer *fb, const rcti *rect)
static bool workbench_render_framebuffers_init()
static const DrawEngineDataSize workbench_data_size
static void workbench_engine_free()
static void workbench_cache_populate(void *vedata, Object *object)