sculpt: add grab mode

This commit is contained in:
luboslenco
2026-07-11 16:07:22 +02:00
parent 394029483b
commit a0e13782bf
5 changed files with 93 additions and 30 deletions
+11 -8
View File
@@ -173,6 +173,9 @@ vec2_t uniforms_ext_vec2_link(object_t *object, material_data_t *mat, char *link
else if (string_equals(link, "_clone_delta")) {
return (vec2_t){g_context->clone_delta_x, g_context->clone_delta_y};
}
else if (string_equals(link, "_grab_start")) {
return (vec2_t){g_context->grab_start_x, g_context->grab_start_y};
}
else if (string_equals(link, "_texpaint_size")) {
return (vec2_t){config_get_texture_res_x(), config_get_texture_res_y()};
}
@@ -202,10 +205,10 @@ vec4_t uniforms_ext_vec3_link(object_t *object, material_data_t *mat, char *link
// Discard first paint for directional brush (no prev position yet)
bool allow_paint = g_context->prev_paint_vec_x > 0 && g_context->prev_paint_vec_y > 0 &&
(g_context->prev_paint_vec_x != g_context->paint_vec.x || g_context->prev_paint_vec_y != g_context->paint_vec.y);
f32 x = g_context->paint_vec.x;
f32 y = g_context->paint_vec.y;
f32 lastx = g_context->prev_paint_vec_x;
f32 lasty = g_context->prev_paint_vec_y;
f32 x = g_context->paint_vec.x;
f32 y = g_context->paint_vec.y;
f32 lastx = g_context->prev_paint_vec_x;
f32 lasty = g_context->prev_paint_vec_y;
if (g_context->paint2d) {
x = uniforms_ext_vec2d(x);
lastx = uniforms_ext_vec2d(lastx);
@@ -311,10 +314,10 @@ mat4_t uniforms_ext_mat4_link(object_t *object, material_data_t *mat, char *link
transform_t *t = object->transform;
mat4_t W = t->world;
vec4_t axes[3] = {
vec4_norm((vec4_t){W.m00, W.m10, W.m20, 0.0}),
vec4_norm((vec4_t){W.m01, W.m11, W.m21, 0.0}),
vec4_norm((vec4_t){W.m02, W.m12, W.m22, 0.0}),
};
vec4_norm((vec4_t){W.m00, W.m10, W.m20, 0.0}),
vec4_norm((vec4_t){W.m01, W.m11, W.m21, 0.0}),
vec4_norm((vec4_t){W.m02, W.m12, W.m22, 0.0}),
};
f32 scale[3] = {t->scale.x, t->scale.y, t->scale.z};
mat4_t F = mat4_identity();
for (i32 i = 0; i < 3; ++i) {