Blender  V3.3
Classes
subdiv_foreach.c File Reference
#include "BKE_subdiv_foreach.h"
#include "atomic_ops.h"
#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BLI_bitmap.h"
#include "BLI_task.h"
#include "BKE_customdata.h"
#include "BKE_key.h"
#include "BKE_mesh.h"
#include "BKE_subdiv.h"
#include "BKE_subdiv_mesh.h"
#include "MEM_guardedalloc.h"

Go to the source code of this file.

Classes

struct  SubdivForeachTaskContext
 

Typedefs

Context which is passed to all threaded tasks
typedef struct SubdivForeachTaskContext SubdivForeachTaskContext
 

Functions

General helpers
BLI_INLINE int num_ptex_faces_per_poly_get (const MPoly *poly)
 
BLI_INLINE int num_edges_per_ptex_face_get (const int resolution)
 
BLI_INLINE int num_inner_edges_per_ptex_face_get (const int resolution)
 
BLI_INLINE int num_polys_per_ptex_get (const int resolution)
 
BLI_INLINE int ptex_face_resolution_get (const MPoly *poly, int resolution)
 
Threading helpers
static voidsubdiv_foreach_tls_alloc (SubdivForeachTaskContext *ctx)
 
static void subdiv_foreach_tls_free (SubdivForeachTaskContext *ctx, void *tls)
 
Initialization
static void subdiv_foreach_ctx_count (SubdivForeachTaskContext *ctx)
 
static void subdiv_foreach_ctx_init_offsets (SubdivForeachTaskContext *ctx)
 
static void subdiv_foreach_ctx_init (Subdiv *subdiv, SubdivForeachTaskContext *ctx)
 
static void subdiv_foreach_ctx_free (SubdivForeachTaskContext *ctx)
 
Vertex traversal process
static void subdiv_foreach_corner_vertices_regular_do (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly, SubdivForeachVertexFromCornerCb vertex_corner, bool check_usage)
 
static void subdiv_foreach_corner_vertices_regular (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_corner_vertices_special_do (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly, SubdivForeachVertexFromCornerCb vertex_corner, bool check_usage)
 
static void subdiv_foreach_corner_vertices_special (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_corner_vertices (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_every_corner_vertices_regular (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_every_corner_vertices_special (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_every_corner_vertices (SubdivForeachTaskContext *ctx, void *tls)
 
static void subdiv_foreach_edge_vertices_regular_do (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly, SubdivForeachVertexFromEdgeCb vertex_edge, bool check_usage)
 
static void subdiv_foreach_edge_vertices_regular (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_edge_vertices_special_do (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly, SubdivForeachVertexFromEdgeCb vertex_edge, bool check_usage)
 
static void subdiv_foreach_edge_vertices_special (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_edge_vertices (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_every_edge_vertices_regular (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_every_edge_vertices_special (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_every_edge_vertices (SubdivForeachTaskContext *ctx, void *tls)
 
static void subdiv_foreach_inner_vertices_regular (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_inner_vertices_special (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_inner_vertices (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_vertices (SubdivForeachTaskContext *ctx, void *tls, const int poly_index)
 
Edge traversal process
static int subdiv_foreach_edges_row (SubdivForeachTaskContext *ctx, void *tls, const int coarse_edge_index, const int start_subdiv_edge_index, const int start_vertex_index, const int num_edges_per_row)
 
static int subdiv_foreach_edges_column (SubdivForeachTaskContext *ctx, void *tls, const int coarse_start_edge_index, const int coarse_end_edge_index, const int start_subdiv_edge_index, const int start_vertex_index, const int num_edges_per_row)
 
static void subdiv_foreach_edges_all_patches_regular (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_edges_all_patches_special (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_edges_all_patches (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_edges (SubdivForeachTaskContext *ctx, void *tls, int poly_index)
 
static void subdiv_foreach_boundary_edges (SubdivForeachTaskContext *ctx, void *tls, int coarse_edge_index)
 
Loops traversal
static void rotate_indices (const int rot, int *a, int *b, int *c, int *d)
 
static void subdiv_foreach_loops_of_poly (SubdivForeachTaskContext *ctx, void *tls, int subdiv_loop_start_index, const int ptex_face_index, const int coarse_poly_index, const int coarse_corner_index, const int rotation, int v0, int e0, int v1, int e1, int v2, int e2, int v3, int e3, const float u, const float v, const float du, const float dv)
 
static int subdiv_foreach_loops_corner_index (const float u, const float v, const float du, const float dv)
 
static void subdiv_foreach_loops_regular (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_loops_special (SubdivForeachTaskContext *ctx, void *tls, const MPoly *coarse_poly)
 
static void subdiv_foreach_loops (SubdivForeachTaskContext *ctx, void *tls, int poly_index)
 
Polygons traverse process
static void subdiv_foreach_polys (SubdivForeachTaskContext *ctx, void *tls, int poly_index)
 
Loose elements traverse process
static void subdiv_foreach_loose_vertices_task (void *__restrict userdata, const int coarse_vertex_index, const TaskParallelTLS *__restrict tls)
 
static void subdiv_foreach_vertices_of_loose_edges_task (void *__restrict userdata, const int coarse_edge_index, const TaskParallelTLS *__restrict tls)
 
Subdivision process entry points
static void subdiv_foreach_single_geometry_vertices (SubdivForeachTaskContext *ctx, void *tls)
 
static void subdiv_foreach_mark_non_loose_geometry (SubdivForeachTaskContext *ctx)
 
static void subdiv_foreach_single_thread_tasks (SubdivForeachTaskContext *ctx)
 
static void subdiv_foreach_task (void *__restrict userdata, const int poly_index, const TaskParallelTLS *__restrict tls)
 
static void subdiv_foreach_boundary_edges_task (void *__restrict userdata, const int edge_index, const TaskParallelTLS *__restrict tls)
 
static void subdiv_foreach_free (const void *__restrict userdata, void *__restrict userdata_chunk)
 
bool BKE_subdiv_foreach_subdiv_geometry (Subdiv *subdiv, const SubdivForeachContext *context, const SubdivToMeshSettings *mesh_settings, const Mesh *coarse_mesh)
 

Typedef Documentation

◆ SubdivForeachTaskContext

Function Documentation

◆ BKE_subdiv_foreach_subdiv_geometry()

bool BKE_subdiv_foreach_subdiv_geometry ( Subdiv subdiv,
const SubdivForeachContext context,
const SubdivToMeshSettings mesh_settings,
const Mesh coarse_mesh 
)

◆ num_edges_per_ptex_face_get()

BLI_INLINE int num_edges_per_ptex_face_get ( const int  resolution)

◆ num_inner_edges_per_ptex_face_get()

BLI_INLINE int num_inner_edges_per_ptex_face_get ( const int  resolution)

◆ num_polys_per_ptex_get()

BLI_INLINE int num_polys_per_ptex_get ( const int  resolution)

◆ num_ptex_faces_per_poly_get()

BLI_INLINE int num_ptex_faces_per_poly_get ( const MPoly poly)

◆ ptex_face_resolution_get()

BLI_INLINE int ptex_face_resolution_get ( const MPoly poly,
int  resolution 
)

◆ rotate_indices()

static void rotate_indices ( const int  rot,
int *  a,
int *  b,
int *  c,
int *  d 
)
static

Definition at line 1027 of file subdiv_foreach.c.

References Freestyle::a, usdtokens::b(), Freestyle::c, and rot.

Referenced by subdiv_foreach_loops_of_poly().

◆ subdiv_foreach_boundary_edges()

static void subdiv_foreach_boundary_edges ( SubdivForeachTaskContext ctx,
void tls,
int  coarse_edge_index 
)
static

◆ subdiv_foreach_boundary_edges_task()

static void subdiv_foreach_boundary_edges_task ( void *__restrict  userdata,
const int  edge_index,
const TaskParallelTLS *__restrict  tls 
)
static

Definition at line 1837 of file subdiv_foreach.c.

References subdiv_foreach_boundary_edges().

Referenced by BKE_subdiv_foreach_subdiv_geometry().

◆ subdiv_foreach_corner_vertices()

static void subdiv_foreach_corner_vertices ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_corner_vertices_regular()

static void subdiv_foreach_corner_vertices_regular ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_corner_vertices_regular_do()

static void subdiv_foreach_corner_vertices_regular_do ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly,
SubdivForeachVertexFromCornerCb  vertex_corner,
bool  check_usage 
)
static

◆ subdiv_foreach_corner_vertices_special()

static void subdiv_foreach_corner_vertices_special ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_corner_vertices_special_do()

static void subdiv_foreach_corner_vertices_special_do ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly,
SubdivForeachVertexFromCornerCb  vertex_corner,
bool  check_usage 
)
static

◆ subdiv_foreach_ctx_count()

static void subdiv_foreach_ctx_count ( SubdivForeachTaskContext ctx)
static

◆ subdiv_foreach_ctx_free()

static void subdiv_foreach_ctx_free ( SubdivForeachTaskContext ctx)
static

◆ subdiv_foreach_ctx_init()

static void subdiv_foreach_ctx_init ( Subdiv subdiv,
SubdivForeachTaskContext ctx 
)
static

◆ subdiv_foreach_ctx_init_offsets()

static void subdiv_foreach_ctx_init_offsets ( SubdivForeachTaskContext ctx)
static

◆ subdiv_foreach_edge_vertices()

static void subdiv_foreach_edge_vertices ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_edge_vertices_regular()

static void subdiv_foreach_edge_vertices_regular ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_edge_vertices_regular_do()

static void subdiv_foreach_edge_vertices_regular_do ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly,
SubdivForeachVertexFromEdgeCb  vertex_edge,
bool  check_usage 
)
static

◆ subdiv_foreach_edge_vertices_special()

static void subdiv_foreach_edge_vertices_special ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_edge_vertices_special_do()

static void subdiv_foreach_edge_vertices_special_do ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly,
SubdivForeachVertexFromEdgeCb  vertex_edge,
bool  check_usage 
)
static

◆ subdiv_foreach_edges()

static void subdiv_foreach_edges ( SubdivForeachTaskContext ctx,
void tls,
int  poly_index 
)
static

◆ subdiv_foreach_edges_all_patches()

static void subdiv_foreach_edges_all_patches ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_edges_all_patches_regular()

static void subdiv_foreach_edges_all_patches_regular ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_edges_all_patches_special()

static void subdiv_foreach_edges_all_patches_special ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_edges_column()

static int subdiv_foreach_edges_column ( SubdivForeachTaskContext ctx,
void tls,
const int  coarse_start_edge_index,
const int  coarse_end_edge_index,
const int  start_subdiv_edge_index,
const int  start_vertex_index,
const int  num_edges_per_row 
)
static

◆ subdiv_foreach_edges_row()

static int subdiv_foreach_edges_row ( SubdivForeachTaskContext ctx,
void tls,
const int  coarse_edge_index,
const int  start_subdiv_edge_index,
const int  start_vertex_index,
const int  num_edges_per_row 
)
static

◆ subdiv_foreach_every_corner_vertices()

static void subdiv_foreach_every_corner_vertices ( SubdivForeachTaskContext ctx,
void tls 
)
static

◆ subdiv_foreach_every_corner_vertices_regular()

static void subdiv_foreach_every_corner_vertices_regular ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_every_corner_vertices_special()

static void subdiv_foreach_every_corner_vertices_special ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_every_edge_vertices()

static void subdiv_foreach_every_edge_vertices ( SubdivForeachTaskContext ctx,
void tls 
)
static

◆ subdiv_foreach_every_edge_vertices_regular()

static void subdiv_foreach_every_edge_vertices_regular ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_every_edge_vertices_special()

static void subdiv_foreach_every_edge_vertices_special ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_free()

static void subdiv_foreach_free ( const void *__restrict  userdata,
void *__restrict  userdata_chunk 
)
static

◆ subdiv_foreach_inner_vertices()

static void subdiv_foreach_inner_vertices ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_inner_vertices_regular()

static void subdiv_foreach_inner_vertices_regular ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_inner_vertices_special()

static void subdiv_foreach_inner_vertices_special ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_loops()

static void subdiv_foreach_loops ( SubdivForeachTaskContext ctx,
void tls,
int  poly_index 
)
static

◆ subdiv_foreach_loops_corner_index()

static int subdiv_foreach_loops_corner_index ( const float  u,
const float  v,
const float  du,
const float  dv 
)
static

Definition at line 1104 of file subdiv_foreach.c.

References v.

Referenced by subdiv_foreach_loops_regular().

◆ subdiv_foreach_loops_of_poly()

static void subdiv_foreach_loops_of_poly ( SubdivForeachTaskContext ctx,
void tls,
int  subdiv_loop_start_index,
const int  ptex_face_index,
const int  coarse_poly_index,
const int  coarse_corner_index,
const int  rotation,
int  v0,
int  e0,
int  v1,
int  e1,
int  v2,
int  e2,
int  v3,
int  e3,
const float  u,
const float  v,
const float  du,
const float  dv 
)
static

◆ subdiv_foreach_loops_regular()

static void subdiv_foreach_loops_regular ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_loops_special()

static void subdiv_foreach_loops_special ( SubdivForeachTaskContext ctx,
void tls,
const MPoly coarse_poly 
)
static

◆ subdiv_foreach_loose_vertices_task()

static void subdiv_foreach_loose_vertices_task ( void *__restrict  userdata,
const int  coarse_vertex_index,
const TaskParallelTLS *__restrict  tls 
)
static

◆ subdiv_foreach_mark_non_loose_geometry()

static void subdiv_foreach_mark_non_loose_geometry ( SubdivForeachTaskContext ctx)
static

◆ subdiv_foreach_polys()

static void subdiv_foreach_polys ( SubdivForeachTaskContext ctx,
void tls,
int  poly_index 
)
static

◆ subdiv_foreach_single_geometry_vertices()

static void subdiv_foreach_single_geometry_vertices ( SubdivForeachTaskContext ctx,
void tls 
)
static

◆ subdiv_foreach_single_thread_tasks()

static void subdiv_foreach_single_thread_tasks ( SubdivForeachTaskContext ctx)
static

◆ subdiv_foreach_task()

static void subdiv_foreach_task ( void *__restrict  userdata,
const int  poly_index,
const TaskParallelTLS *__restrict  tls 
)
static

◆ subdiv_foreach_tls_alloc()

static void* subdiv_foreach_tls_alloc ( SubdivForeachTaskContext ctx)
static

◆ subdiv_foreach_tls_free()

static void subdiv_foreach_tls_free ( SubdivForeachTaskContext ctx,
void tls 
)
static

◆ subdiv_foreach_vertices()

static void subdiv_foreach_vertices ( SubdivForeachTaskContext ctx,
void tls,
const int  poly_index 
)
static

◆ subdiv_foreach_vertices_of_loose_edges_task()

static void subdiv_foreach_vertices_of_loose_edges_task ( void *__restrict  userdata,
const int  coarse_edge_index,
const TaskParallelTLS *__restrict  tls 
)
static