33 switch (evaluator_type) {
81 const float (*coarse_vertex_cos)[3])
91 for (
int poly_index = 0; poly_index <
mesh->
totpoly; poly_index++) {
92 const MPoly *poly = &mpoly[poly_index];
100 int manifold_vertex_count = 0;
101 for (
int vertex_index = 0, manifold_vertex_index = 0; vertex_index <
mesh->
totvert;
106 const float *vertex_co;
107 if (coarse_vertex_cos !=
NULL) {
108 vertex_co = coarse_vertex_cos[vertex_index];
111 const MVert *vertex = &mvert[vertex_index];
112 vertex_co = vertex->
co;
115 manifold_vertex_index++;
116 manifold_vertex_count++;
134 const int face_index,
147 const int num_face_vertices = topology_refiner->
getNumFaceVertices(topology_refiner, face_index);
149 topology_refiner, face_index, layer_index);
150 for (
int vertex_index = 0; vertex_index < num_face_vertices; vertex_index++, mluv++) {
158 const int layer_index)
162 const int num_faces = topology_refiner->
getNumFaces(topology_refiner);
165 const int num_fvar_values = topology_refiner->
getNumFVarValues(topology_refiner, layer_index);
193 if (orco || cloth_orco) {
196 const int num_verts = topology_refiner->
getNumVertices(topology_refiner);
198 if (orco && cloth_orco) {
200 for (
int i = 0; i < num_verts; i++) {
212 else if (cloth_orco) {
213 evaluator->
setVertexData(evaluator, cloth_orco[0], 0, num_verts);
227 const float (*coarse_vertex_cos)[3],
241 const float (*coarse_vertex_cos)[3])
252 for (
int layer_index = 0; layer_index < num_uv_layers; layer_index++) {
281 Subdiv *subdiv,
const int ptex_face_index,
const float u,
const float v,
float r_P[3])
287 const int ptex_face_index,
307 if (r_dPdu !=
NULL && r_dPdv !=
NULL) {
311 u * 0.999f + 0.0005f,
312 v * 0.999f + 0.0005f,
321 const int ptex_face_index,
327 float dPdu[3], dPdv[3];
334 Subdiv *subdiv,
const int ptex_face_index,
const float u,
const float v,
float r_vertex_data[])
340 const int face_varying_channel,
341 const int ptex_face_index,
344 float r_face_varying[2])
347 subdiv->
evaluator, face_varying_channel, ptex_face_index, u,
v, r_face_varying);
351 const int ptex_face_index,
367 Subdiv *subdiv,
const int ptex_face_index,
const float u,
const float v,
float r_P[3])
370 float dPdu[3], dPdv[3],
D[3];
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
int CustomData_number_of_layers(const struct CustomData *data, int type)
bool CustomData_has_layer(const struct CustomData *data, int type)
void * CustomData_get_layer_n(const struct CustomData *data, int type, int n)
void * CustomData_get_layer(const struct CustomData *data, int type)
@ SUBDIV_STATS_EVALUATOR_REFINE
@ SUBDIV_STATS_EVALUATOR_CREATE
void BKE_subdiv_stats_end(SubdivStats *stats, eSubdivStatsValue value)
void BKE_subdiv_stats_reset(SubdivStats *stats, eSubdivStatsValue value)
void BKE_subdiv_stats_begin(SubdivStats *stats, eSubdivStatsValue value)
@ SUBDIV_EVALUATOR_TYPE_GPU
@ SUBDIV_EVALUATOR_TYPE_CPU
#define BLI_assert_msg(a, msg)
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
#define BLI_BITMAP_TEST_BOOL(_bitmap, _index)
MINLINE float normalize_v3(float r[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE bool equals_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
OpenSubdiv_Evaluator * openSubdiv_createEvaluatorFromTopologyRefiner(OpenSubdiv_TopologyRefiner *topology_refiner, eOpenSubdivEvaluator evaluator_type, OpenSubdiv_EvaluatorCache *evaluator_cache)
ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
@ OPENSUBDIV_EVALUATOR_GPU
@ OPENSUBDIV_EVALUATOR_CPU
OpenSubdiv_TopologyRefiner * topology_refiner
void(* setVertexData)(struct OpenSubdiv_Evaluator *evaluator, const float *data, const int start_vertex_index, const int num_vertices)
void(* setCoarsePositions)(struct OpenSubdiv_Evaluator *evaluator, const float *positions, const int start_vertex_index, const int num_vertices)
void(* evaluateLimit)(struct OpenSubdiv_Evaluator *evaluator, const int ptex_face_index, float face_u, float face_v, float P[3], float dPdu[3], float dPdv[3])
void(* setFaceVaryingData)(struct OpenSubdiv_Evaluator *evaluator, const int face_varying_channel, const float *face_varying_data, const int start_vertex_index, const int num_vertices)
void(* evaluateVertexData)(struct OpenSubdiv_Evaluator *evaluator, const int ptex_face_index, float face_u, float face_v, float data[])
void(* evaluateFaceVarying)(struct OpenSubdiv_Evaluator *evaluator, const int face_varying_channel, const int ptex_face_index, float face_u, float face_v, float face_varying[2])
void(* refine)(struct OpenSubdiv_Evaluator *evaluator)
void(* setSettings)(struct OpenSubdiv_Evaluator *evaluator, const OpenSubdiv_EvaluatorSettings *settings)
int(* getNumFaceVertices)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int face_index)
int(* getNumFVarValues)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int channel)
const int *(* getFaceFVarValueIndices)(const struct OpenSubdiv_TopologyRefiner *topology_refiner, const int face_index, const int channel)
int(* getNumFaces)(const struct OpenSubdiv_TopologyRefiner *topology_refiner)
int(* getNumVertices)(const struct OpenSubdiv_TopologyRefiner *topology_refiner)
void(* initialize)(struct SubdivDisplacement *displacement)
void(* eval_displacement)(struct SubdivDisplacement *displacement, int ptex_face_index, float u, float v, const float dPdu[3], const float dPdv[3], float r_D[3])
struct SubdivDisplacement * displacement_evaluator
struct OpenSubdiv_TopologyRefiner * topology_refiner
struct OpenSubdiv_Evaluator * evaluator
void BKE_subdiv_eval_limit_point(Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3])
struct FaceVaryingDataFromUVContext FaceVaryingDataFromUVContext
void BKE_subdiv_eval_init_displacement(Subdiv *subdiv)
bool BKE_subdiv_eval_begin(Subdiv *subdiv, eSubdivEvaluatorType evaluator_type, OpenSubdiv_EvaluatorCache *evaluator_cache, const OpenSubdiv_EvaluatorSettings *settings)
static void set_face_varying_data_from_uv(Subdiv *subdiv, const Mesh *mesh, const MLoopUV *mloopuv, const int layer_index)
void BKE_subdiv_eval_displacement(Subdiv *subdiv, const int ptex_face_index, const float u, const float v, const float dPdu[3], const float dPdv[3], float r_D[3])
static void set_vertex_data_from_orco(Subdiv *subdiv, const Mesh *mesh)
bool BKE_subdiv_eval_begin_from_mesh(Subdiv *subdiv, const Mesh *mesh, const float(*coarse_vertex_cos)[3], eSubdivEvaluatorType evaluator_type, OpenSubdiv_EvaluatorCache *evaluator_cache)
void BKE_subdiv_eval_face_varying(Subdiv *subdiv, const int face_varying_channel, const int ptex_face_index, const float u, const float v, float r_face_varying[2])
bool BKE_subdiv_eval_refine_from_mesh(Subdiv *subdiv, const Mesh *mesh, const float(*coarse_vertex_cos)[3])
void BKE_subdiv_eval_final_point(Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3])
void BKE_subdiv_eval_vertex_data(Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_vertex_data[])
static void get_mesh_evaluator_settings(OpenSubdiv_EvaluatorSettings *settings, const Mesh *mesh)
static void set_face_varying_data_from_uv_task(void *__restrict userdata, const int face_index, const TaskParallelTLS *__restrict UNUSED(tls))
static eOpenSubdivEvaluator opensubdiv_evalutor_from_subdiv_evaluator_type(eSubdivEvaluatorType evaluator_type)
void BKE_subdiv_eval_limit_point_and_normal(Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3], float r_N[3])
static void set_coarse_positions(Subdiv *subdiv, const Mesh *mesh, const float(*coarse_vertex_cos)[3])
void BKE_subdiv_eval_limit_point_and_derivatives(Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3], float r_dPdu[3], float r_dPdv[3])
BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z)