78 mat44[0] = ob_mat[0] * radius;
79 mat44[1] = ob_mat[1] * radius;
80 mat44[2] = ob_mat[2] * radius;
100 color_a = encode_2f_to_float(bone_color[0], bone_color[1]);
101 color_b = encode_2f_to_float(bone_color[2], bone_color[3]);
107 color_hint_a = encode_2f_to_float(hint_color[0], hint_color[1]);
108 color_hint_b = encode_2f_to_float(hint_color[2], hint_color[3]);
113 float encode_2f_to_float(
float a,
float b)
const
189 if (
rv3d ==
nullptr) {
333 struct BatchDeleter {
339 using BatchPtr = std::unique_ptr<gpu::Batch, BatchDeleter>;
420 gpu::VertBuf *vbo = GPU_vertbuf_create_with_format(T::format());
422 vbo->
data<
T>().copy_from(vector);
440 static StaticCache &get_static_cache()
443 static StaticCache static_cache;
452 const bool clipping_enabled_;
460 "overlay_viewer_attribute_pointcloud");
563 "overlay_wireframe_points_with_radius");
568 "overlay_volume_gridlines_flags");
571 "overlay_volume_gridlines_range");
573 "overlay_volume_velocity_streamline");
584 : selection_type_(selection_type), clipping_enabled_(clipping_enabled) {};
586 StaticShader shader_clippable(
const char *create_info_name);
587 StaticShader shader_selectable(
const char *create_info_name);
588 StaticShader shader_selectable_no_clip(
const char *create_info_name);
697 void init(
bool clipping_enabled)
786 this->depth_tx.
wrap(viewport_textures.
depth);
789 this->color_render_tx.
wrap(viewport_textures.
color);
791 this->render_fb = viewport_framebuffers.
default_fb;
792 this->render_in_front_fb = viewport_framebuffers.
in_front_fb;
796 if (
state.xray_enabled) {
798 this->xray_depth_tx.
acquire_2d(render_size, gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8);
799 this->depth_target_tx.
wrap(this->xray_depth_tx);
801 this->xray_depth_in_front_tx.
acquire_2d(render_size,
802 gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8);
803 this->depth_target_in_front_tx.
wrap(this->xray_depth_in_front_tx);
807 if (!this->depth_in_front_tx.
is_valid()) {
808 this->depth_in_front_alloc_tx.
acquire_2d(render_size,
809 gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8);
810 this->depth_in_front_tx.
wrap(this->depth_in_front_alloc_tx);
812 this->depth_target_tx.
wrap(this->depth_tx);
813 this->depth_target_in_front_tx.
wrap(this->depth_in_front_tx);
817 if (!this->color_overlay_tx.
is_valid()) {
819 this->color_overlay_alloc_tx.
acquire_2d(
int2(1, 1), gpu::TextureFormat::SRGBA_8_8_8_8);
820 this->color_render_alloc_tx.
acquire_2d(
int2(1, 1), gpu::TextureFormat::SRGBA_8_8_8_8);
822 this->color_overlay_tx.
wrap(this->color_overlay_alloc_tx);
823 this->color_render_tx.
wrap(this->color_render_alloc_tx);
825 this->line_tx.
acquire_2d(
int2(1, 1), gpu::TextureFormat::UNORM_8_8);
826 this->overlay_tx.
acquire_2d(
int2(1, 1), gpu::TextureFormat::SRGBA_8_8_8_8);
836 this->line_tx.
acquire_2d(render_size, gpu::TextureFormat::UNORM_8_8, usage);
837 this->overlay_tx.
acquire_2d(render_size, gpu::TextureFormat::SRGBA_8_8_8_8, usage);
868 this->xray_depth_in_front_tx.
release();
869 this->depth_in_front_alloc_tx.
release();
870 this->color_overlay_alloc_tx.
release();
871 this->color_render_alloc_tx.
release();
914 return theme.colors.wire;
918 return theme.colors.wire_edit;
920 return theme.colors.active_object;
922 return theme.colors.object_select;
924 return theme.colors.transform;
926 return theme.colors.speaker;
930 return theme.colors.empty;
932 return theme.colors.light;
934 return theme.colors.wire;
960 if (
state.scene->world) {
965 return state.v3d->shading.background_color;
1036 const float epsilon = max_dim * 1e-6f;
1038 if (dim[0] <= epsilon) {
1041 if (dim[1] <= epsilon) {
1044 if (dim[2] <= epsilon) {
1058 manager.
matrix_buf.current().get_or_resize(resource_id.index()).model;
1062 object_to_world.x_axis();
1064 object_to_world.y_axis();
1068 callback(
geom, resource_id);
General operations, lookup, etc. for blender objects.
#define GPU_BATCH_DISCARD_SAFE(batch)
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
void ensure(GPUAttachment depth=GPU_ATTACHMENT_NONE, GPUAttachment color1=GPU_ATTACHMENT_NONE, GPUAttachment color2=GPU_ATTACHMENT_NONE, GPUAttachment color3=GPU_ATTACHMENT_NONE, GPUAttachment color4=GPU_ATTACHMENT_NONE, GPUAttachment color5=GPU_ATTACHMENT_NONE, GPUAttachment color6=GPU_ATTACHMENT_NONE, GPUAttachment color7=GPU_ATTACHMENT_NONE, GPUAttachment color8=GPU_ATTACHMENT_NONE)
SwapChain< ObjectMatricesBuf, 2 > matrix_buf
bool is_active(const Object *active_object) const
IndexRange id_range() const
void append(const T &value)
bool acquire_2d(int2 extent, gpu::TextureFormat format, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, int mip_len=1)
void wrap(gpu::Texture *tex)
int3 size(int miplvl=0) const
const float3 & forward(int view_id=0) const
void draw_procedural(GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceIDRange res_id={}, uint custom_id=0)
void draw_expand(gpu::Batch *batch, GPUPrimType primitive_type, uint primitive_len, uint instance_len, uint vertex_len, uint vertex_first, ResourceIDRange res_id={}, uint custom_id=0)
void push_constant(const char *name, const float &data)
void bind_ssbo(const char *name, gpu::StorageBuf *buffer)
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceIDRange res_id={}, uint custom_id=0)
detail::PassBase< command::DrawCommandBuf > Sub
StaticShader attribute_viewer_curves
StaticShader wireframe_points
StaticShader mesh_edit_edge
StaticShader uv_edit_facedot
StaticShader mesh_edit_facedot
StaticShader paint_weight_fake_shading
static ShaderModule & module_get(SelectionType selection_type, bool clipping_enabled)
StaticShader wireframe_gsplat
StaticShader lattice_points
StaticShader attribute_viewer_pointcloud
StaticShader motion_path_vert
StaticShader armature_envelope_outline
StaticShader mesh_loop_normal
StaticShader uv_edit_edge
StaticShader pointcloud_points
StaticShader particle_edit_vert
StaticShader particle_hair
StaticShader armature_sphere_outline
StaticShader armature_degrees_of_freedom
StaticShader fluid_grid_lines_range
StaticShader armature_shape_fill
StaticShader extra_loose_points
StaticShader mesh_vert_normal_subdiv
StaticShader depth_pointcloud
StaticShader mesh_face_normal
StaticShader gsplat_points
StaticShader wireframe_points_with_radius
StaticShader legacy_curve_edit_points
StaticShader outline_detect
StaticShader armature_wire
StaticShader legacy_curve_edit_handles
StaticShader light_spot_cone
StaticShader paint_weight
StaticShader particle_shape
StaticShader mesh_loop_normal_subdiv
StaticShader outline_prepass_curves
StaticShader armature_stick
StaticShader legacy_curve_edit_wires
StaticShader armature_envelope_fill
StaticShader armature_sphere_fill
StaticShader anti_aliasing
StaticShader extra_ground_line
StaticShader mesh_edit_face
StaticShader lattice_wire
StaticShader image_plane_depth_bias
StaticShader curve_edit_handles
StaticShader motion_path_line
StaticShader fluid_velocity_needle
StaticShader particle_dot
StaticShader wireframe_curve
static void module_free()
StaticShader legacy_curve_edit_normals
StaticShader sculpt_curves_cage
StaticShader attribute_viewer_mesh
StaticShader armature_shape_wire_strip
StaticShader fluid_velocity_streamline
StaticShader paint_region_edge
StaticShader outline_prepass_gsplat
StaticShader outline_prepass_mesh
StaticShader uv_image_borders
StaticShader uv_brush_stencil
StaticShader depth_gsplat
StaticShader extra_wire_object
StaticShader attribute_viewer_gsplat
StaticShader paint_region_face
StaticShader mesh_edit_depth
StaticShader grid_grease_pencil
StaticShader curve_edit_points
StaticShader outline_prepass_wire
StaticShader mesh_face_normal_subdiv
StaticShader wireframe_mesh
StaticShader outline_prepass_pointcloud
StaticShader mesh_vert_normal
StaticShader uv_analysis_stretch_area
StaticShader paint_region_vert
StaticShader particle_edit_edge
StaticShader depth_mesh_conservative
StaticShader fluid_grid_lines_flat
StaticShader armature_shape_outline
StaticShader armature_shape_wire
StaticShader background_clip_bound
StaticShader uv_paint_mask
StaticShader grid_background
StaticShader uv_edit_face
StaticShader attribute_viewer_curve
StaticShader mesh_edit_vert
StaticShader sculpt_curves
StaticShader depth_grease_pencil
StaticShader background_fill
StaticShader uv_edit_vert
StaticShader uv_analysis_stretch_angle
StaticShader depth_curves
StaticShader mesh_edit_skin_root
StaticShader curve_edit_line
StaticShader uniform_color
StaticShader fluid_grid_lines_flags
StaticShader outline_prepass_gpencil
StaticShader fluid_velocity_mac
StaticShader mesh_analysis
StaticShader uv_wireframe
StaticShader paint_texture
BatchPtr light_point_lines
BatchPtr camera_volume_wire
BatchPtr camera_tria_wire
BatchPtr field_tube_limit
BatchPtr light_area_square_lines
BatchPtr bone_degrees_of_freedom_wire
BatchPtr bone_degrees_of_freedom
BatchPtr field_sphere_limit
BatchPtr light_icon_sun_rays
BatchPtr light_icon_inner_lines
BatchPtr light_area_disk_lines
BatchPtr bone_sphere_wire
BatchPtr lightprobe_planar
BatchPtr metaball_wire_circle
BatchPtr sphere_low_detail
BatchPtr light_spot_lines
BatchPtr light_icon_outer_lines
BatchPtr light_spot_volume
BatchPtr field_cone_limit
BatchPtr camera_distances
BatchPtr bone_octahedron_wire
BatchPtr bone_envelope_wire
void ensure_compile_async()
gpu::StaticShader StaticShader
select::SelectionType SelectionType
static bool is_from_dupli_or_set(const Object *ob)
T reduce_max(const VecBase< T, Size > &a)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
void get_color_3fv(int colorid, float col[3])
float get_value_f(int colorid)
void get_color_blend_shade_4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
@ V3D_OVERLAY_HIDE_OBJECT_ORIGINS
@ V3D_OVERLAY_SCULPT_SHOW_MASK
@ V3D_OVERLAY_FADE_INACTIVE
@ V3D_OVERLAY_VIEWER_ATTRIBUTE
@ V3D_OVERLAY_HIDE_MOTION_PATHS
@ V3D_OVERLAY_SCULPT_SHOW_FACE_SETS
@ V3D_OVERLAY_SCULPT_CURVES_CAGE
@ V3D_OVERLAY_VIEWER_ATTRIBUTE_TEXT
@ V3D_OVERLAY_HIDE_OBJECT_XTRAS
@ V3D_OVERLAY_SHOW_LIGHT_COLORS
@ V3D_OVERLAY_FACE_ORIENTATION
@ V3D_OVERLAY_BONE_SELECT
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
@ GPU_TEXTURE_USAGE_ATTACHMENT
BMesh const char void * data
void BKE_object_dimensions_get(const Object *ob, float r_vec[3])
@ V3D_SHADING_BACKGROUND_VIEWPORT
@ V3D_SHADING_BACKGROUND_WORLD
MINLINE float max_ff(float a, float b)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
std::optional< Bounds< float3 > > BKE_object_boundbox_get(const Object *ob)
void BKE_movieclip_free_gputexture(MovieClip *clip)
MINLINE float clamp_f(float value, float min, float max)
TokenType select(char char_value, char char_class, bool cond)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
DefaultTextureList * viewport_texture_list_get() const
DefaultFramebufferList * viewport_framebuffer_list_get() const
gpu::FrameBuffer * default_fb
gpu::FrameBuffer * in_front_fb
gpu::Texture * depth_in_front
gpu::Texture * color_overlay
void set_color(const float4 &bone_color)
BoneInstanceData()=default
BoneInstanceData(const float4x4 &ob_mat, const float3 &pos, const float radius, const float color[4])
void set_hint_color(const float4 &hint_color)
BoneInstanceData(const float4x4 &bone_mat, const float4 &bone_color, const float4 &hint_color)
BoneInstanceData(const float4x4 &bone_mat, const float4 &bone_color)
FunctionRef< void(gpu::Batch *geom, ResourceID handle)> Callback
void if_flat_axis_orthogonal_to_view(Manager &manager, const View &view, Callback callback) const
static int flat_axis_index_get(const ObjectRef &ob_ref)
ResourceHandleRange handle
void append(const float3 &start, const float3 &end, const float4 &color, select::ID select_id=select::SelectMap::select_invalid_id())
void append(const float3 &start, const float3 &end, const int color_id, select::ID select_id=select::SelectMap::select_invalid_id())
void end_sync(PassSimple::Sub &pass)
LinePrimitiveBuf(const SelectionType selection_type, const char *name=nullptr)
void end_sync(PassSimple::Sub &pass)
PointPrimitiveBuf(const SelectionType selection_type, const char *name=nullptr)
void append(const float3 &position, const int color_id, select::ID select_id)
void append(const float3 &position, const float4 &color, select::ID select_id=select::SelectMap::select_invalid_id())
Framebuffer overlay_line_in_front_fb
Framebuffer overlay_line_only_fb
float4 background_color_get(const State &state)
TextureRef depth_target_tx
Framebuffer overlay_color_only_fb
const float4 & object_wire_color(const ObjectRef &ob_ref, ThemeColorID theme_id) const
const float4 & object_wire_color(const ObjectRef &ob_ref, const State &state) const
TextureFromPool color_render_alloc_tx
Framebuffer overlay_output_color_only_fb
TextureRef depth_target_in_front_tx
Framebuffer overlay_output_fb
TextureFromPool xray_depth_tx
Vector< MovieClip * > bg_movie_clips
gpu::FrameBuffer * render_fb
ColorBand weight_ramp_copy
TextureFromPool overlay_tx
void begin_sync(int clipping_plane_count)
Framebuffer overlay_in_front_fb
void acquire(const DRWContext *draw_ctx, const State &state)
void update_theme_settings(const DRWContext *ctx, const State &state)
TextureRef color_render_tx
detail::SubPassVector< GreasePencilDepthPlane, 16 > depth_planes
gpu::FrameBuffer * render_in_front_fb
int64_t depth_planes_count
float4 object_background_blend_color(const ObjectRef &ob_ref, const State &state) const
TextureRef color_overlay_tx
TextureFromPool depth_in_front_alloc_tx
draw::UniformArrayBuffer< float4, 6 > clip_planes_buf
void init(bool clipping_enabled)
bool is_selection() const
TextureRef depth_in_front_tx
static float vertex_size_get()
float4 background_blend_color(ThemeColorID theme_id) const
const ShapeCache & shapes
TextureFromPool xray_depth_in_front_tx
ThemeColorID object_wire_theme_id(const ObjectRef &ob_ref, const State &state) const
TextureFromPool color_overlay_alloc_tx
draw::UniformBuffer< UniformData > globals_buf
Resources(const SelectionType selection_type_, const ShapeCache &shapes_)
void update_clip_planes(const State &state)
Framebuffer overlay_line_fb
void free_movieclips_textures()
ShapeInstanceBuf(const SelectionType selection_type, const char *name=nullptr)
void end_sync(PassSimple::Sub &pass, gpu::Batch *shape)
StorageVectorBuffer< ExtraInstanceData > data_buf
void append(const InstanceDataT &data, select::ID select_id)
void end_sync(PassSimple::Sub &pass, gpu::Batch *shape, GPUPrimType primitive_type, uint primitive_len)
const ViewLayer * view_layer
View::OffsetData offset_data_get() const
bool xray_enabled_and_not_wire
const SpaceLink * space_data
const Object * object_active
bool show_sculpt_curves_cage() const
bool show_bone_selection() const
bool is_space_node() const
bool is_viewport_image_render
bool show_sculpt_mask() const
bool show_object_origins() const
bool show_fade_inactive() const
const bToolRef * active_tool
bool show_sculpt_face_sets() const
bool show_wireframes() const
bool is_render_depth_available
eContextObjectMode ctx_mode
bool show_motion_paths() const
bool show_face_orientation() const
bool is_depth_only_drawing
bool show_light_colors() const
const RegionView3D * rv3d
bool show_attribute_viewer_text() const
bool show_attribute_viewer() const
bool is_space_v3d() const
bool is_space_image() const
GPU_VERTEX_FORMAT_FUNC(VertShaded, pos, vclass, nor)
GPU_VERTEX_FORMAT_FUNC(VertexBone, pos, vclass)
void end_sync(PassSimple::Sub &pass, GPUPrimType primitive)
select::SelectBuf select_buf
void append(const float3 &position, const float4 &color)
VertexPrimitiveBuf(const SelectionType selection_type, const char *name=nullptr)
StorageVectorBuffer< VertexData > data_buf
GPU_VERTEX_FORMAT_FUNC(VertexTriple, pos0, pos1, pos2)
GPU_VERTEX_FORMAT_FUNC(VertexWithColor, pos, color)
GPU_VERTEX_FORMAT_FUNC(Vertex, pos, vclass)
void select_append(ID select_id)
void select_bind(PassSimple::Sub &pass)
SelectBuf(const SelectionType selection_type)
const SelectionType selection_type
static const ID select_invalid_id()
SelectMap(const SelectionType selection_type)
const SelectionType selection_type
static constexpr VertAttrType type
static constexpr VertAttrType type