42 BoundsInstanceBuf box = {selection_type_,
"bound_box"};
43 BoundsInstanceBuf sphere = {selection_type_,
"bound_sphere"};
44 BoundsInstanceBuf cylinder = {selection_type_,
"bound_cylinder"};
45 BoundsInstanceBuf cone = {selection_type_,
"bound_cone"};
46 BoundsInstanceBuf capsule_body = {selection_type_,
"bound_capsule_body"};
47 BoundsInstanceBuf capsule_cap = {selection_type_,
"bound_capsule_cap"};
55 call_buffers_.box.clear();
56 call_buffers_.sphere.clear();
57 call_buffers_.cylinder.clear();
58 call_buffers_.cone.clear();
59 call_buffers_.capsule_body.clear();
60 call_buffers_.capsule_cap.clear();
68 const Object *ob = ob_ref.object;
69 const bool from_dupli = is_from_dupli_or_set(ob);
75 const bool show_extras = !from_dupli &&
state.show_extras();
79 const bool draw_bounds = has_bounds && ((ob->
dt ==
OB_BOUNDBOX) ||
83 auto add_bounds_ex = [&](
const float3 center,
const float3 size,
const char bound_type) {
84 const float4x4 object_mat{ob->object_to_world().ptr()};
85 const select::ID select_id = res.select_id(ob_ref);
89 scale.location() = center;
91 call_buffers_.box.append(
data, select_id);
96 scale.location() = center;
98 call_buffers_.sphere.append(
data, select_id);
104 scale.location() = center;
106 call_buffers_.cylinder.append(
data, select_id);
114 std::swap(mat[1], mat[2]);
117 call_buffers_.cone.append(
data, select_id);
123 mat.
location().z = center.z + std::max(0.0f, size.z - size.x);
125 call_buffers_.capsule_cap.append(
data, select_id);
127 mat.
location().z = center.z - std::max(0.0f, size.z - size.x);
128 data.object_to_world = object_mat * mat;
129 call_buffers_.capsule_cap.append(
data, select_id);
130 mat.
z_axis().z = std::max(0.0f, size.z * 2.0f - size.x * 2.0f);
131 data.object_to_world = object_mat * mat;
132 call_buffers_.capsule_body.append(
data, select_id);
138 auto add_bounds = [&](
const bool around_origin,
const char bound_type) {
139 const std::optional<blender::Bounds<float3>> bounds_opt =
146 add_bounds_ex(center, size, bound_type);
216 state.clipping_plane_count);
217 ps_.shader_set(res.shaders->extra_shape.get());
220 res.select_bind(ps_);
222 call_buffers_.box.end_sync(ps_, res.shapes.cube.get());
223 call_buffers_.sphere.end_sync(ps_, res.shapes.empty_sphere.get());
224 call_buffers_.cylinder.end_sync(ps_, res.shapes.cylinder.get());
225 call_buffers_.cone.end_sync(ps_, res.shapes.empty_cone.get());
226 call_buffers_.capsule_body.end_sync(ps_, res.shapes.capsule_body.get());
227 call_buffers_.capsule_cap.end_sync(ps_, res.shapes.capsule_cap.get());
233 manager.submit(ps_, view);
Types and defines for representing Rigid Body entities.
#define BLI_assert_unreachable()
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
void begin_sync(Resources &, const State &) final
Bounds(const SelectionType selection_type)
void end_sync(Resources &res, const State &state) final
void object_sync(Manager &, const ObjectRef &ob_ref, Resources &res, const State &state) final
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
float3x3 scale(float3x3 mat, float2 scale)
select::SelectionType SelectionType
detail::Pass< command::DrawCommandBuf > PassSimple
T reduce_max(const VecBase< T, Size > &a)
T midpoint(const T &a, const T &b)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
T max(const T &a, const T &b)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
bool BKE_mball_is_basis(const Object *ob)
void BKE_curve_texspace_ensure(Curve *cu)
T & DRW_object_get_data_for_drawing(const Object &object)
BMesh const char void * data
void BKE_mesh_texspace_ensure(Mesh *mesh)
@ DRW_STATE_DEPTH_LESS_EQUAL
std::optional< Bounds< float3 > > BKE_object_evaluated_geometry_bounds(const Object *ob)
ID_Type GS(const char *name)
std::optional< Bounds< float3 > > BKE_object_boundbox_get(const Object *ob)
float texspace_location[3]
float texspace_location[3]
eObject_DrawExtraFlag dtx
bke::ObjectRuntime * runtime
struct RigidBodyOb * rigidbody_object
eObject_BoundType boundtype
GeometrySet * geometry_set_eval