diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-11-01 13:06:00 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-11-01 17:20:50 +0300 |
commit | 34ec716352a96fa967a8fa656fec3cad8b2e4a99 (patch) | |
tree | 74701a31a4c5e6fac3e19f96862a245a3f6a3cb1 /source/blender/blenkernel/intern/subdiv_inline.h | |
parent | 9d5edf2d39c73b50dfbdcd10f32e89435c95dcc9 (diff) |
Subdiv: Cleanup, deduplicate some code
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_inline.h')
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_inline.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_inline.h b/source/blender/blenkernel/intern/subdiv_inline.h new file mode 100644 index 00000000000..c9e924ced82 --- /dev/null +++ b/source/blender/blenkernel/intern/subdiv_inline.h @@ -0,0 +1,48 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2018 by Blender Foundation. + * All rights reserved. + * + * Contributor(s): Sergey Sharybin. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/blenkernel/intern/subdiv_inline.h + * \ingroup bke + */ + +#ifndef __BKE_SUBDIV_INLINE_H__ +#define __BKE_SUBDIV_INLINE_H__ + +#include "BKE_subdiv.h" + +BLI_INLINE void BKE_subdiv_ptex_face_uv_to_grid_uv( + const float ptex_u, const float ptex_v, + float *r_grid_u, float *r_grid_v) +{ + *r_grid_u = 1.0f - ptex_v; + *r_grid_v = 1.0f - ptex_u; +} + +BLI_INLINE int BKE_subdiv_grid_size_from_level(const int level) +{ + return (1 << (level - 1)) + 1; +} + +#endif /* __BKE_SUBDIV_INLINE_H__ */ |