Cleanup: Sculpt, use C++ vector types in internal types

Only converted value types in the structures.

The pointer values are left unchanged as it requires more careful look
to avoid possible alignment mismatch.

Function arguments are left unchanged as well.

Only float[3] is converted as the float[4] will likely need to be
converted to some C++ rotation class. And float[4][4] often did not
compile when change is only done in the header.

Pull Request: https://projects.blender.org/blender/blender/pulls/114636
This commit is contained in:
Sergey Sharybin 2023-11-09 10:05:24 +01:00 committed by Sergey Sharybin
parent fdbf235ba3
commit c3609ec435
2 changed files with 56 additions and 56 deletions

View File

@ -273,13 +273,13 @@ struct SculptVertexPaintGeomMap {
/** Pose Brush IK Chain. */
struct SculptPoseIKChainSegment {
float orig[3];
float head[3];
blender::float3 orig;
blender::float3 head;
float initial_orig[3];
float initial_head[3];
blender::float3 initial_orig;
blender::float3 initial_head;
float len;
float scale[3];
blender::float3 scale;
float rot[4];
float *weights;
@ -293,7 +293,7 @@ struct SculptPoseIKChainSegment {
struct SculptPoseIKChain {
SculptPoseIKChainSegment *segments;
int tot_segments;
float grab_delta_offset[3];
blender::float3 grab_delta_offset;
};
/* Cloth Brush */
@ -380,8 +380,8 @@ struct SculptClothSimulation {
};
struct SculptPersistentBase {
float co[3];
float no[3];
blender::float3 co;
blender::float3 no;
float disp;
};
@ -438,8 +438,8 @@ struct SculptBoundary {
/* Stores the initial positions of the pivot and boundary initial vertex as they may be deformed
* during the brush action. This allows to use them as a reference positions and vectors for some
* brush effects. */
float initial_vertex_position[3];
float initial_pivot_position[3];
blender::float3 initial_vertex_position;
blender::float3 initial_pivot_position;
/* Maximum number of topology steps that were calculated from the boundary. */
int max_propagation_steps;
@ -461,8 +461,8 @@ struct SculptBoundary {
/* Twist Deform type. */
struct {
float rotation_axis[3];
float pivot_position[3];
blender::float3 rotation_axis;
blender::float3 pivot_position;
} twist;
};
@ -649,17 +649,17 @@ struct SculptSession {
*/
bool draw_faded_cursor;
float cursor_radius;
float cursor_location[3];
float cursor_normal[3];
float cursor_sampled_normal[3];
float cursor_view_normal[3];
blender::float3 cursor_location;
blender::float3 cursor_normal;
blender::float3 cursor_sampled_normal;
blender::float3 cursor_view_normal;
/* For Sculpt trimming gesture tools, initial ray-cast data from the position of the mouse
* when
* the gesture starts (intersection with the surface and if they ray hit the surface or not).
*/
float gesture_initial_location[3];
float gesture_initial_normal[3];
blender::float3 gesture_initial_location;
blender::float3 gesture_initial_normal;
bool gesture_initial_hit;
/* TODO(jbakker): Replace rv3d and v3d with ViewContext */
@ -672,7 +672,7 @@ struct SculptSession {
int preview_vert_count;
/* Pose Brush Preview */
float pose_origin[3];
blender::float3 pose_origin;
SculptPoseIKChain *pose_ik_chain_preview;
/* Boundary Brush Preview */
@ -682,17 +682,17 @@ struct SculptSession {
SculptFakeNeighbors fake_neighbors;
/* Transform operator */
float pivot_pos[3];
blender::float3 pivot_pos;
float pivot_rot[4];
float pivot_scale[3];
blender::float3 pivot_scale;
float init_pivot_pos[3];
blender::float3 init_pivot_pos;
float init_pivot_rot[4];
float init_pivot_scale[3];
blender::float3 init_pivot_scale;
float prev_pivot_pos[3];
blender::float3 prev_pivot_pos;
float prev_pivot_rot[4];
float prev_pivot_scale[3];
blender::float3 prev_pivot_scale;
struct {
struct {
@ -745,7 +745,7 @@ struct SculptSession {
* Last used painting canvas key.
*/
char *last_paint_canvas_key;
float last_normal[3];
blender::float3 last_normal;
int last_automasking_settings_hash;
uchar last_automask_stroke_id;

View File

@ -77,9 +77,9 @@ enum SculptUpdateType {
};
struct SculptCursorGeometryInfo {
float location[3];
float normal[3];
float active_vertex_co[3];
blender::float3 location;
blender::float3 normal;
blender::float3 active_vertex_co;
};
#define SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY 256
@ -227,7 +227,7 @@ struct SculptUndoNode {
SculptUndoNodeGeometry geometry_bmesh_enter;
/* pivot */
float pivot_pos[3];
blender::float3 pivot_pos;
float pivot_rot[4];
/* Sculpt Face Sets */
@ -244,7 +244,7 @@ struct SculptUndoNode {
struct SculptRakeData {
float follow_dist;
float follow_co[3];
blender::float3 follow_co;
float angle;
};
@ -252,7 +252,7 @@ struct SculptRakeData {
struct SculptBrushTest {
float radius_squared;
float radius;
float location[3];
blender::float3 location;
float dist;
ePaintSymmetryFlags mirror_symmetry_pass;
@ -375,7 +375,7 @@ struct FilterCache {
float *normal_factor;
float *edge_factor;
float *prev_mask;
float mask_expand_initial_co[3];
blender::float3 mask_expand_initial_co;
int new_face_set;
int *prev_face_set;
@ -386,8 +386,8 @@ struct FilterCache {
/* Auto-masking. */
AutomaskingCache *automasking;
float initial_normal[3];
float view_normal[3];
blender::float3 initial_normal;
blender::float3 view_normal;
/* Pre-smoothed colors used by sharpening. Colors are HSL. */
float (*pre_smoothed_color)[4];
@ -404,19 +404,19 @@ struct FilterCache {
struct StrokeCache {
/* Invariants */
float initial_radius;
float scale[3];
blender::float3 scale;
int flag;
float clip_tolerance[3];
blender::float3 clip_tolerance;
float clip_mirror_mtx[4][4];
float initial_mouse[2];
/* Variants */
float radius;
float radius_squared;
float true_location[3];
float true_last_location[3];
float location[3];
float last_location[3];
blender::float3 true_location;
blender::float3 true_last_location;
blender::float3 location;
blender::float3 last_location;
float stroke_distance;
/* Used for alternating between deformation in brushes that need to apply different ones to
@ -461,8 +461,8 @@ struct StrokeCache {
const Brush *brush;
float special_rotation;
float grab_delta[3], grab_delta_symmetry[3];
float old_grab_location[3], orig_grab_location[3];
blender::float3 grab_delta, grab_delta_symmetry;
blender::float3 old_grab_location, orig_grab_location;
/* screen-space rotation defined by mouse motion */
float rake_rotation[4], rake_rotation_symmetry[4];
@ -477,14 +477,14 @@ struct StrokeCache {
int symmetry;
ePaintSymmetryFlags
mirror_symmetry_pass; /* The symmetry pass we are currently on between 0 and 7. */
float true_view_normal[3];
float view_normal[3];
blender::float3 true_view_normal;
blender::float3 view_normal;
/* sculpt_normal gets calculated by calc_sculpt_normal(), then the
* sculpt_normal_symm gets updated quickly with the usual symmetry
* transforms */
float sculpt_normal[3];
float sculpt_normal_symm[3];
blender::float3 sculpt_normal;
blender::float3 sculpt_normal_symm;
/* Used for area texture mode, local_mat gets calculated by
* calc_brush_local_mat() and used in sculpt_apply_texture().
@ -495,10 +495,10 @@ struct StrokeCache {
* displacement in area plane mode. */
float brush_local_mat_inv[4][4];
float plane_offset[3]; /* used to shift the plane around when doing tiled strokes */
blender::float3 plane_offset; /* used to shift the plane around when doing tiled strokes */
int tile_pass;
float last_center[3];
blender::float3 last_center;
int radial_symmetry_pass;
float symm_rot_mat[4][4];
float symm_rot_mat_inv[4][4];
@ -506,7 +506,7 @@ struct StrokeCache {
/* Accumulate mode. Note: inverted for SCULPT_TOOL_DRAW_SHARP. */
bool accum;
float anchored_location[3];
blender::float3 anchored_location;
/* Paint Brush. */
struct {
@ -532,10 +532,10 @@ struct StrokeCache {
/* Cloth brush */
SculptClothSimulation *cloth_sim;
float initial_location[3];
float true_initial_location[3];
float initial_normal[3];
float true_initial_normal[3];
blender::float3 initial_location;
blender::float3 true_initial_location;
blender::float3 initial_normal;
blender::float3 true_initial_normal;
/* Boundary brush */
SculptBoundary *boundaries[PAINT_SYMM_AREAS];
@ -558,8 +558,8 @@ struct StrokeCache {
float plane_trim_squared;
bool supports_gravity;
float true_gravity_direction[3];
float gravity_direction[3];
blender::float3 true_gravity_direction;
blender::float3 gravity_direction;
/* Auto-masking. */
AutomaskingCache *automasking;