diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_subdiv_eval.h')
-rw-r--r-- | source/blender/blenkernel/BKE_subdiv_eval.h | 95 |
1 files changed, 26 insertions, 69 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv_eval.h b/source/blender/blenkernel/BKE_subdiv_eval.h index 0b61e62c89c..23bcdcce276 100644 --- a/source/blender/blenkernel/BKE_subdiv_eval.h +++ b/source/blender/blenkernel/BKE_subdiv_eval.h @@ -30,16 +30,26 @@ extern "C" { #endif struct Mesh; +struct OpenSubdiv_EvaluatorCache; struct Subdiv; +typedef enum eSubdivEvaluatorType { + SUBDIV_EVALUATOR_TYPE_CPU, + SUBDIV_EVALUATOR_TYPE_GLSL_COMPUTE, +} eSubdivEvaluatorType; + /* Returns true if evaluator is ready for use. */ -bool BKE_subdiv_eval_begin(struct Subdiv *subdiv); +bool BKE_subdiv_eval_begin(struct Subdiv *subdiv, + eSubdivEvaluatorType evaluator_type, + struct OpenSubdiv_EvaluatorCache *evaluator_cache); /* coarse_vertex_cos is an optional argument which allows to override coordinates of the coarse * mesh. */ bool BKE_subdiv_eval_begin_from_mesh(struct Subdiv *subdiv, const struct Mesh *mesh, - const float (*coarse_vertex_cos)[3]); + const float (*coarse_vertex_cos)[3], + eSubdivEvaluatorType evaluator_type, + struct OpenSubdiv_EvaluatorCache *evaluator_cache); bool BKE_subdiv_eval_refine_from_mesh(struct Subdiv *subdiv, const struct Mesh *mesh, const float (*coarse_vertex_cos)[3]); @@ -55,33 +65,23 @@ void BKE_subdiv_eval_init_displacement(struct Subdiv *subdiv); /* Evaluate point at a limit surface, with optional derivatives and normal. */ void BKE_subdiv_eval_limit_point( - struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3]); + struct Subdiv *subdiv, int ptex_face_index, float u, float v, float r_P[3]); void BKE_subdiv_eval_limit_point_and_derivatives(struct Subdiv *subdiv, - const int ptex_face_index, - const float u, - const float v, + int ptex_face_index, + float u, + float v, float r_P[3], float r_dPdu[3], float r_dPdv[3]); -void BKE_subdiv_eval_limit_point_and_normal(struct Subdiv *subdiv, - const int ptex_face_index, - const float u, - const float v, - float r_P[3], - float r_N[3]); -void BKE_subdiv_eval_limit_point_and_short_normal(struct Subdiv *subdiv, - const int ptex_face_index, - const float u, - const float v, - float r_P[3], - short r_N[3]); +void BKE_subdiv_eval_limit_point_and_normal( + struct Subdiv *subdiv, int ptex_face_index, float u, float v, float r_P[3], float r_N[3]); /* Evaluate face-varying layer (such as UV). */ void BKE_subdiv_eval_face_varying(struct Subdiv *subdiv, - const int face_varying_channel, - const int ptex_face_index, - const float u, - const float v, + int face_varying_channel, + int ptex_face_index, + float u, + float v, float r_face_varying[2]); /* NOTE: Expects derivatives to be correct. @@ -91,59 +91,16 @@ void BKE_subdiv_eval_face_varying(struct Subdiv *subdiv, * Would be nice to have displacement evaluation function which does not require * knowing derivatives ahead of a time. */ void BKE_subdiv_eval_displacement(struct Subdiv *subdiv, - const int ptex_face_index, - const float u, - const float v, + int ptex_face_index, + float u, + float v, const float dPdu[3], const float dPdv[3], float r_D[3]); /* Evaluate point on a limit surface with displacement applied to it. */ void BKE_subdiv_eval_final_point( - struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3]); - -/* Patch queries at given resolution. - * - * Will evaluate patch at uniformly distributed (u, v) coordinates on a grid - * of given resolution, producing resolution^2 evaluation points. The order - * goes as u in rows, v in columns. */ - -void BKE_subdiv_eval_limit_patch_resolution_point(struct Subdiv *subdiv, - const int ptex_face_index, - const int resolution, - void *buffer, - const int offset, - const int stride); -void BKE_subdiv_eval_limit_patch_resolution_point_and_derivatives(struct Subdiv *subdiv, - const int ptex_face_index, - const int resolution, - void *point_buffer, - const int point_offset, - const int point_stride, - void *du_buffer, - const int du_offset, - const int du_stride, - void *dv_buffer, - const int dv_offset, - const int dv_stride); -void BKE_subdiv_eval_limit_patch_resolution_point_and_normal(struct Subdiv *subdiv, - const int ptex_face_index, - const int resolution, - void *point_buffer, - const int point_offset, - const int point_stride, - void *normal_buffer, - const int normal_offset, - const int normal_stride); -void BKE_subdiv_eval_limit_patch_resolution_point_and_short_normal(struct Subdiv *subdiv, - const int ptex_face_index, - const int resolution, - void *point_buffer, - const int point_offset, - const int point_stride, - void *normal_buffer, - const int normal_offset, - const int normal_stride); + struct Subdiv *subdiv, int ptex_face_index, float u, float v, float r_P[3]); #ifdef __cplusplus } |