diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2011-11-02 20:02:01 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2011-11-02 20:02:01 +0400 |
commit | 42ce1d5943195ed0d83ed225f50b7e8614d085a5 (patch) | |
tree | 4b5fa5fbbd2a72f97d3708a113195917885b9914 /source/blender/editors | |
parent | bdc029a193affd1672da340ae0a8287e8c299356 (diff) |
Sculpt cleanup
Replace a use of bglMats in sculpt with ED_view3d_* functions().
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index d4df1628b83..c26a4d52a9e 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -208,7 +208,8 @@ typedef struct StrokeCache { int first_time; /* Beginning of stroke may do some things special */ - bglMats *mats; + /* from ED_view3d_ob_project_mat_get() */ + float projection_mat[4][4]; /* Clean this up! */ ViewContext *vc; @@ -678,7 +679,8 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3], } else if(ss->texcache) { float rotation = -mtex->rot; - float x, y, point_2d[3]; + float symm_point[3], point_2d[2]; + float x, y; float radius; /* if the active area is being applied for symmetry, flip it @@ -686,12 +688,13 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3], position in order to project it. This insures that the brush texture will be oriented correctly. */ - flip_coord(point_2d, point, ss->cache->mirror_symmetry_pass); + flip_coord(symm_point, point, ss->cache->mirror_symmetry_pass); if (ss->cache->radial_symmetry_pass) - mul_m4_v3(ss->cache->symm_rot_mat_inv, point_2d); + mul_m4_v3(ss->cache->symm_rot_mat_inv, symm_point); - projectf(ss->cache->mats, point_2d, point_2d); + ED_view3d_project_float(ss->cache->vc->ar, symm_point, point_2d, + ss->cache->projection_mat); /* if fixed mode, keep coordinates relative to mouse */ if(mtex->brush_map_mode == MTEX_MAP_MODE_FIXED) { @@ -2810,8 +2813,6 @@ static void sculpt_cache_free(StrokeCache *cache) { if(cache->face_norms) MEM_freeN(cache->face_norms); - if(cache->mats) - MEM_freeN(cache->mats); MEM_freeN(cache); } @@ -2910,8 +2911,8 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio cache->brush = brush; - cache->mats = MEM_callocN(sizeof(bglMats), "sculpt bglMats"); - view3d_get_transformation(vc->ar, vc->rv3d, vc->obact, cache->mats); + /* cache projection matrix */ + ED_view3d_ob_project_mat_get(cache->vc->rv3d, ob, cache->projection_mat); ED_view3d_global_to_vector(cache->vc->rv3d, cache->vc->rv3d->twmat[3], cache->true_view_normal); /* Initialize layer brush displacements and persistent coords */ |