29 if (
format.attr_len == 0) {
39 if (
area >= FLT_EPSILON && uvarea >= FLT_EPSILON) {
48 return (ratio > 1.0f) ? (1.0f / ratio) : ratio;
56 float tot_area = 0.0f, tot_uv_area = 0.0f;
69 tot_uv_area += uvarea;
77 for (
int mp_index = 0; mp_index < mr->
poly_len; mp_index++, mp++) {
81 tot_uv_area += uvarea;
86 r_tot_area = tot_area;
87 r_tot_uv_area = tot_uv_area;
96 float *area_ratio =
static_cast<float *
>(
MEM_mallocN(
sizeof(
float) * mr->
poly_len, __func__));
107 for (
int i = 0; i < efa->
len; i++, l_index++) {
108 loop_stretch[l_index] = area_ratio[f];
115 for (
int mp_index = 0, l_index = 0; mp_index < mr->
poly_len; mp_index++, mp++) {
116 for (
int i = 0; i < mp->
totloop; i++, l_index++) {
117 loop_stretch[l_index] = area_ratio[mp_index];
135 if (
format.attr_len == 0) {
void * CustomData_get_layer(const struct CustomData *data, int type)
int CustomData_get_offset(const struct CustomData *data, int type)
float BKE_mesh_calc_poly_uv_area(const struct MPoly *mpoly, const struct MLoopUV *uv_array)
float BKE_mesh_calc_poly_area(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray)
void GPU_vertbuf_discard(GPUVertBuf *)
struct GPUVertBuf GPUVertBuf
GPUVertBuf * GPU_vertbuf_calloc(void)
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)
void GPU_vertbuf_init_build_on_device(GPUVertBuf *verts, GPUVertFormat *format, uint v_len)
Read Guarded memory(de)allocation.
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
float BM_face_calc_area_uv(const BMFace *f, int cd_loop_uv_offset)
float BM_face_calc_area(const BMFace *f)
void draw_subdiv_build_edituv_stretch_area_buffer(const DRWSubdivCache *cache, GPUVertBuf *coarse_data, GPUVertBuf *subdiv_data)
ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
BLI_INLINE float area_ratio_to_stretch(float ratio, float tot_ratio)
static void extract_edituv_stretch_area_finish(const MeshRenderData *mr, MeshBatchCache *cache, void *buf, void *UNUSED(data))
static void extract_edituv_stretch_area_init_subdiv(const DRWSubdivCache *subdiv_cache, const MeshRenderData *mr, MeshBatchCache *cache, void *buffer, void *UNUSED(data))
BLI_INLINE float area_ratio_get(float area, float uvarea)
static void compute_area_ratio(const MeshRenderData *mr, float *r_area_ratio, float &r_tot_area, float &r_tot_uv_area)
static void extract_edituv_stretch_area_init(const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *buf, void *UNUSED(tls_data))
constexpr MeshExtract create_extractor_edituv_stretch_area()
GPUVertBuf * edituv_stretch_area
eMRExtractType extract_type