23 View view_edit_text = {
"view_edit_text"};
24 float view_dist = 0.0f;
30 bool enabled_ =
false;
38 text_selection_buf.clear();
39 text_cursor_buf.clear();
40 box_line_buf_.clear();
50 add_select(cu, ob_ref.
object->object_to_world());
51 add_cursor(cu, ob_ref.
object->object_to_world());
52 add_boxes(res, cu, ob_ref.
object->object_to_world());
65 auto &sub = ps_.sub(
"text_selection");
66 sub.state_set(default_state,
state.clipping_plane_count);
70 sub.push_constant(
"ucolor",
color);
72 auto &buf = text_selection_buf;
74 sub.bind_ssbo(
"matrix_buf", &buf);
80 auto &sub = ps_.sub(
"highlight_text_selection");
83 state.clipping_plane_count);
87 sub.push_constant(
"ucolor",
color);
89 auto &buf = text_selection_buf;
91 sub.bind_ssbo(
"matrix_buf", &buf);
97 auto &sub = ps_.sub(
"text_cursor");
98 sub.state_set(default_state,
state.clipping_plane_count);
100 sub.state_set(default_state,
state.clipping_plane_count);
103 sub.push_constant(
"ucolor",
color);
105 auto &buf = text_cursor_buf;
107 sub.bind_ssbo(
"matrix_buf", &buf);
108 sub.draw(shapes.
quad_solid.get(), buf.size());
113 auto &sub_pass = ps_.sub(
"text_boxes");
116 state.clipping_plane_count);
118 sub_pass.bind_ubo(
"globalsBlock", &res.
globals_buf);
119 box_line_buf_.end_sync(sub_pass);
132 manager.
submit(ps_, view_edit_text);
140 const float2 &origin = corners[0];
145 float4(half_size_y, 0.0f, 0.0f),
146 float4(0.0f, 0.0f, 1.0f, 0.0f),
147 float4(origin + half_size_x + half_size_y, 0.0f, 1.0f));
150 void add_select(
const Curve &cu,
const float4x4 &ob_to_world)
172 if (sb->
rot == 0.0f) {
174 box[1] =
float2(sb->
x + selboxw, sb->
y);
180 box[1] = mat[0] * selboxw +
float2(&sb->
x);
181 box[3] = mat[1] * sb->
h +
float2(&sb->
x);
183 v2_quad_corners_to_mat4(box, final_mat);
184 final_mat = ob_to_world * final_mat;
186 obj_mat.sync(final_mat);
187 text_selection_buf.append(obj_mat);
191 void add_cursor(
const Curve &cu,
const float4x4 &ob_to_world)
197 v2_quad_corners_to_mat4(cursor, mat);
199 ob_mat.sync(ob_to_world * mat);
200 text_cursor_buf.append(ob_mat);
203 void add_boxes(
const Resources &res,
const Curve &cu,
const float4x4 &ob_to_world)
205 for (
const int i : IndexRange(cu.
totbox)) {
207 const bool is_active = (i == (cu.
actbox - 1));
208 const float4 &
color = is_active ? res.theme_settings.color_active :
209 res.theme_settings.color_wire;
211 if ((tb.
w != 0.0f) || (tb.
h != 0.0f)) {
217 for (
const int j : IndexRange(4)) {
220 for (
const int j : IndexRange(4)) {
221 box_line_buf_.append(vecs[j], vecs[(j + 1) % 4], color);
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
@ TH_WIDGET_TEXT_HIGHLIGHT
@ TH_WIDGET_TEXT_SELECTION
void UI_GetThemeColor4fv(int colorid, float col[4])
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void submit(PassSimple &pass, View &view)
EditText(SelectionType selection_type)
void end_sync(Resources &res, const ShapeCache &shapes, const State &state)
void begin_sync(const State &state)
void edit_object_sync(const ObjectRef &ob_ref, const Resources &res)
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
ShaderPtr uniform_color_batch
@ DRW_STATE_DEPTH_GREATER_EQUAL
@ DRW_STATE_DEPTH_LESS_EQUAL
static float4x4 winmat_polygon_offset(float4x4 winmat, float view_dist, float offset)
select::SelectionType SelectionType
detail::Pass< command::DrawCommandBuf > PassSimple
MatT from_rotation(const RotationT &rotation)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
MatBase< float, 2, 2 > float2x2
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< float, 2 > float2
MatBase< float, 4, 2 > float4x2
MatBase< float, 4, 3 > float4x3
VecBase< float, 3 > float3
static void v2_quad_corners_to_mat4(const float corners[4][2], float r_mat[4][4])
struct EditFont * editfont
EditFontSelBox * selboxes
GPUUniformBuf * globals_buf
void select_bind(PassSimple &pass)