Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-01-14 18:33:52 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-05-18 17:45:38 +0300
commit342e12d6d92198bba8355562600a2f97bb45fed5 (patch)
treea5f1e10205e7d66e5c6672fb416883a04475782c /source/blender/blenkernel/BKE_subdiv_eval.h
parentf517b3a29568fd43b722973c7c46d3c358ba0dda (diff)
Subdiv: support interpolating orco coordinates in subdivision surfaces
This makes changes to the opensubdiv module to support additional vertex data besides the vertex position, that is smootly interpolated the same way. This is different than varying data which is interpolated linearly. Fixes T96596: wrong generated texture coordinates with GPU subdivision. In that bug lazy subdivision would not interpolate orcos. Later on, this implementation can also be used to remove the modifier stack mechanism where modifiers are evaluated a second time for orcos, which is messy and inefficient. But that's a more risky change, this is just the part to fix the bug in 3.2. Differential Revision: https://developer.blender.org/D14973
Diffstat (limited to 'source/blender/blenkernel/BKE_subdiv_eval.h')
-rw-r--r--source/blender/blenkernel/BKE_subdiv_eval.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_subdiv_eval.h b/source/blender/blenkernel/BKE_subdiv_eval.h
index a33140b721d..7673f18317a 100644
--- a/source/blender/blenkernel/BKE_subdiv_eval.h
+++ b/source/blender/blenkernel/BKE_subdiv_eval.h
@@ -15,6 +15,7 @@ extern "C" {
struct Mesh;
struct OpenSubdiv_EvaluatorCache;
+struct OpenSubdiv_EvaluatorSettings;
struct Subdiv;
typedef enum eSubdivEvaluatorType {
@@ -25,7 +26,8 @@ typedef enum eSubdivEvaluatorType {
/* Returns true if evaluator is ready for use. */
bool BKE_subdiv_eval_begin(struct Subdiv *subdiv,
eSubdivEvaluatorType evaluator_type,
- struct OpenSubdiv_EvaluatorCache *evaluator_cache);
+ struct OpenSubdiv_EvaluatorCache *evaluator_cache,
+ const struct OpenSubdiv_EvaluatorSettings *settings);
/* coarse_vertex_cos is an optional argument which allows to override coordinates of the coarse
* mesh. */
@@ -60,6 +62,13 @@ void BKE_subdiv_eval_limit_point_and_derivatives(struct Subdiv *subdiv,
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 smoothly interpolated vertex data (such as orco). */
+void BKE_subdiv_eval_vertex_data(struct Subdiv *subdiv,
+ const int ptex_face_index,
+ const float u,
+ const float v,
+ float r_vertex_data[]);
+
/* Evaluate face-varying layer (such as UV). */
void BKE_subdiv_eval_face_varying(struct Subdiv *subdiv,
int face_varying_channel,