diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-03-19 12:32:16 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-03-19 12:33:51 +0300 |
commit | b49dbb635af74db5359cfc6c14a00ef397725968 (patch) | |
tree | 5a3dca9f5fb359ca0c79742ab799f8b1d745b7b5 /source/blender/blenkernel/intern/subdiv_inline.h | |
parent | 53674fb255d92da4b18fa844130a58ea9b57ff9d (diff) |
Subdiv: Make Blender crease to OSD sharpness reusable
Makes it so conversion is centralized in a single place.
We might consider removing any conversion, passing value as-is which
will be easier for I/O scripts to match crease. The downside of that
would be loose of control range in certain qualities and values of
crease.
There shouldn't be any functional changes in this commit.
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_inline.h')
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_inline.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_inline.h b/source/blender/blenkernel/intern/subdiv_inline.h index f00c5cf7ff7..a51a33feb3d 100644 --- a/source/blender/blenkernel/intern/subdiv_inline.h +++ b/source/blender/blenkernel/intern/subdiv_inline.h @@ -104,4 +104,15 @@ BLI_INLINE void BKE_subdiv_rotate_grid_to_quad( } } +BLI_INLINE float BKE_subdiv_edge_crease_to_sharpness_f(float edge_crease) +{ + return edge_crease * edge_crease * 10.0f; +} + +BLI_INLINE float BKE_subdiv_edge_crease_to_sharpness_char(char edge_crease) +{ + const float edge_crease_f = edge_crease / 255.0f; + return BKE_subdiv_edge_crease_to_sharpness_f(edge_crease_f); +} + #endif /* __SUBDIV_INLINE_H__ */ |