32 if (
format.attr_len == 0) {
60 fac = (fac -
min) * minmax_irange;
62 CLAMP(fac, 0.0f, 1.0f);
78 const float minmax_irange = 1.0f / (
max -
min);
93 for (
int i = 0; i < f->
len; i++, l_index++) {
94 r_overhang[l_index] = fac;
100 for (
int mp_index = 0, l_index = 0; mp_index < mr->
poly_len; mp_index++, mp++) {
103 for (
int i = 0; i < mp->
totloop; i++, l_index++) {
104 r_overhang[l_index] = fac;
117 if (uv[0] + uv[1] > 1.0f) {
118 uv[0] = 1.0f - uv[0];
119 uv[1] = 1.0f - uv[1];
129 fac = (fac -
min) * minmax_irange;
131 CLAMP(fac, 0.0f, 1.0f);
141 const float eps_offset = 0.00002f;
149 const float minmax_irange = 1.0f / (
max -
min);
151 float jit_ofs[32][2];
158 for (
int j = 0; j < samples; j++) {
167 struct BMLoop *(*looptris)[3] = em->looptris;
168 for (
int i = 0; i < mr->
tri_len; i++) {
169 BMLoop **ltri = looptris[i];
171 const float *
cos[3] = {
181 for (
int j = 0; j < samples; j++) {
182 float dist = face_dists[index];
187 if (f_hit && dist < face_dists[index]) {
188 float angle_fac =
fabsf(
190 angle_fac = 1.0f - angle_fac;
191 angle_fac = angle_fac * angle_fac * angle_fac;
192 angle_fac = 1.0f - angle_fac;
194 if (dist < face_dists[index]) {
195 face_dists[index] = dist;
208 for (
int i = 0; i <
f->
len; i++, l_index++) {
209 r_thickness[l_index] = fac;
218 for (
int i = 0; i < mr->
tri_len; i++, mlooptri++) {
219 const int index = mlooptri->
poly;
228 for (
int j = 0; j < samples; j++) {
234 hit.
dist = face_dists[index];
237 hit.
dist < face_dists[index]) {
239 angle_fac = 1.0f - angle_fac;
240 angle_fac = angle_fac * angle_fac * angle_fac;
241 angle_fac = 1.0f - angle_fac;
242 hit.
dist /= angle_fac;
243 if (hit.
dist < face_dists[index]) {
244 face_dists[index] = hit.
dist;
251 for (
int mp_index = 0, l_index = 0; mp_index < mr->
poly_len; mp_index++, mp++) {
252 float fac = face_dists[mp_index];
254 for (
int i = 0; i < mp->
totloop; i++, l_index++) {
255 r_thickness[l_index] = fac;
286 int verts_shared = 0;
292 if (verts_shared >= 2) {
305 for (
int l_index = 0; l_index < mr->
loop_len; l_index++) {
306 r_intersect[l_index] = -1.0f;
319 for (
int i = 0; i < overlap_len; i++) {
324 for (
int j = 0; j < 2; j++) {
325 BMFace *f_hit = f_hit_pair[j];
328 for (
int k = 0; k < f_hit->
len; k++, l_index++) {
329 r_intersect[l_index] = 1.0f;
351 for (
int i = 0; i < overlap_len; i++) {
352 const MPoly *f_hit_pair[2] = {
356 for (
int j = 0; j < 2; j++) {
357 const MPoly *f_hit = f_hit_pair[j];
359 for (
int k = 0; k < f_hit->
totloop; k++, l_index++) {
360 r_intersect[l_index] = 1.0f;
372 fac = (fac -
min) * minmax_irange;
373 CLAMP(fac, 0.0f, 1.0f);
388 const float minmax_irange = 1.0f / (
max -
min);
414 const float *no_face;
426 if (
dot_v3v3(no_face, no_corner) < 0.0f) {
431 }
while ((l_iter = l_iter->
next) != l_first);
436 for (
int i = 0; i < f->
len; i++, l_index++) {
437 r_distort[l_index] = fac;
443 for (
int mp_index = 0, l_index = 0; mp_index < mr->
poly_len; mp_index++, mp++) {
450 for (
int i = 1; i <= mp->
totloop; i++) {
460 if (
dot_v3v3(f_no, no_corner) < 0.0f) {
469 for (
int i = 0; i < mp->
totloop; i++, l_index++) {
470 r_distort[l_index] = fac;
480 fac = (fac -
min) * minmax_irange;
481 CLAMP(fac, 0.0f, 1.0f);
496 const float minmax_irange = 1.0f / (
max -
min);
523 }
while ((l_iter = l_iter->
next) != l_first);
532 for (
int mp_index = 0; mp_index < mr->
poly_len; mp_index++, mp++) {
533 for (
int i = 0; i < mp->
totloop; i++) {
541 if (!value_is_init) {
546 if (*pval !=
nullptr) {
548 const float *f2_no =
static_cast<const float *
>(*pval);
558 float *col1 = &vert_angles[l_curr->
v];
559 float *col2 = &vert_angles[l_next->v];
571 float *col1 = &vert_angles[
v1];
572 float *col2 = &vert_angles[
v2];
581 for (
int l_index = 0; l_index < mr->
loop_len; l_index++, ml++) {
typedef float(TangentPoint)[2]
BVHTree * BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data, const struct Mesh *mesh, BVHCacheType bvh_cache_type, int tree_type)
struct BMFace * BKE_bmbvh_ray_cast(BMBVHTree *tree, const float co[3], const float dir[3], float radius, float *r_dist, float r_hitout[3], float r_cagehit[3])
void BKE_bmbvh_free(BMBVHTree *tree)
struct BVHTreeOverlap * BKE_bmbvh_overlap_self(const BMBVHTree *bmtree, unsigned int *r_overlap_tot)
BMBVHTree * BKE_bmbvh_new_from_editmesh(struct BMEditMesh *em, int flag, const float(*cos_cage)[3], bool cos_cage_free)
void BKE_editmesh_cache_ensure_poly_normals(struct BMEditMesh *em, struct EditMeshData *emd)
void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP free_value)
BLI_INLINE void BLI_edgehashIterator_getKey(EdgeHashIterator *ehi, unsigned int *r_v0, unsigned int *r_v1)
EdgeHashIterator * BLI_edgehashIterator_new(EdgeHash *eh) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
bool BLI_edgehash_ensure_p(EdgeHash *eh, unsigned int v0, unsigned int v1, void ***r_val) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void BLI_edgehashIterator_step(EdgeHashIterator *ehi)
void BLI_edgehashIterator_free(EdgeHashIterator *ehi)
BLI_INLINE void * BLI_edgehashIterator_getValue(EdgeHashIterator *ehi)
BLI_INLINE bool BLI_edgehashIterator_isDone(const EdgeHashIterator *ehi)
EdgeHash * BLI_edgehash_new_ex(const char *info, unsigned int nentries_reserve)
void BLI_jitter_init(float(*jitarr)[2], int num)
BVHTreeOverlap * BLI_bvhtree_overlap(const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_num, BVHTree_OverlapCallback callback, void *userdata)
float BLI_bvhtree_get_epsilon(const BVHTree *tree)
int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
MINLINE float max_ff(float a, float b)
bool is_edge_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
bool isect_tri_tri_v3(const float t_a0[3], const float t_a1[3], const float t_a2[3], const float t_b0[3], const float t_b1[3], const float t_b2[3], float r_i1[3], float r_i2[3])
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void mul_transposed_mat3_m4_v3(const float M[4][4], float r[3])
float mat4_to_scale(const float M[4][4])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void copy_vn_fl(float *array_tar, int size, float val)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v3(float r[3])
MINLINE void clamp_v2(float vec[2], float min, float max)
MINLINE void zero_v3(float r[3])
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
void interp_v3_v3v3v3_uv(float p[3], const float v1[3], const float v2[3], const float v3[3], const float uv[2])
#define SCE_STATVIS_INTERSECT
#define SCE_STATVIS_THICKNESS
#define SCE_STATVIS_SHARP
#define SCE_STATVIS_DISTORT
#define SCE_STATVIS_OVERHANG
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
struct GPUVertBuf GPUVertBuf
void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len)
#define GPU_vertbuf_init_with_format(verts, format)
void * GPU_vertbuf_get_data(const GPUVertBuf *verts)
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
#define BM_FACE_FIRST_LOOP(p)
#define BM_elem_index_get(ele)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
float BM_loop_calc_face_normal_safe(const BMLoop *l, float r_normal[3])
float BM_loop_calc_face_normal_safe_vcos(const BMLoop *l, const float normal_fallback[3], float const (*vertexCos)[3], float r_normal[3])
float BM_edge_calc_face_angle_signed(const BMEdge *e)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
static void statvis_calc_distort(const MeshRenderData *mr, float *r_distort)
static void statvis_calc_thickness(const MeshRenderData *mr, float *r_thickness)
static void axis_from_enum_v3(float v[3], const char axis)
static void statvis_calc_overhang(const MeshRenderData *mr, float *r_overhang)
static void statvis_calc_sharp(const MeshRenderData *mr, float *r_sharp)
BLI_INLINE float distort_remap(float fac, float min, float UNUSED(max), float minmax_irange)
static void extract_analysis_iter_finish_mesh(const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *buf, void *UNUSED(data))
static void statvis_calc_intersect(const MeshRenderData *mr, float *r_intersect)
static void uv_from_jitter_v2(float uv[2])
BLI_INLINE float sharp_remap(float fac, float min, float UNUSED(max), float minmax_irange)
constexpr MeshExtract create_extractor_mesh_analysis()
BLI_INLINE float overhang_remap(float fac, float min, float max, float minmax_irange)
static bool bvh_overlap_cb(void *userdata, int index_a, int index_b, int UNUSED(thread))
static void extract_mesh_analysis_init(const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *buf, void *UNUSED(tls_data))
BLI_INLINE float thickness_remap(float fac, float min, float max, float minmax_irange)
struct BMLoop *(* looptris)[3]
BVHTree_RayCastCallback raycast_callback
GPUVertBuf * mesh_analysis
eMRExtractType extract_type
const float(* poly_normals)[3]
const float(* bm_poly_normals)[3]
const float(* bm_vert_coords)[3]
const ToolSettings * toolsettings
const MLoopTri * mlooptri