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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-08-03 15:50:31 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-08-03 15:50:31 +0300
commit8d945bf3cbf0daf8d77ca47d111cc707d41c315a (patch)
tree32132c0293e93a50e878c8318d697e50ff886abc /source/blender/blenkernel/intern/subsurf_ccg.c
parent3a9897f8cee9884b0a38c54fec99ecfb75fbb0d9 (diff)
OpenSubdiv: More proper loop for UV map evaluation on CPU
This is just updating code from our side, actual evaluation is still disabled because it doesn't support face farying data evaluation.
Diffstat (limited to 'source/blender/blenkernel/intern/subsurf_ccg.c')
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 32cded7f2a3..71e14eba690 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -461,27 +461,35 @@ static void set_subsurf_ccg_uv(CCGSubSurf *ss,
for (S = 0; S < numVerts; S++) {
for (y = 0; y < gridFaces; y++) {
for (x = 0; x < gridFaces; x++) {
- float grid_u = ((float)(x)) / (gridSize - 1),
- grid_v = ((float)(y)) / (gridSize - 1);
- float uv[2];
- /* TODO(sergey): Evaluator all 4 corners. */
- ccgSubSurf_evaluatorFVarUV(ss,
- index,
- S,
- grid_u, grid_v,
- uv);
+ const int delta[4][2] = {{0, 0},
+ {0, 1},
+ {1, 1},
+ {1, 0}};
+ float uv[4][2];
+ int i;
+ for (i = 0; i < 4; i++) {
+ const int dx = delta[i][0],
+ dy = delta[i][1];
+ const float grid_u = ((float)(x + dx)) / (gridSize - 1),
+ grid_v = ((float)(y + dy)) / (gridSize - 1);
+ ccgSubSurf_evaluatorFVarUV(ss,
+ index,
+ S,
+ grid_u, grid_v,
+ uv[i]);
+ }
if (tf) {
- copy_v2_v2(tf->uv[0], uv);
- copy_v2_v2(tf->uv[1], uv);
- copy_v2_v2(tf->uv[2], uv);
- copy_v2_v2(tf->uv[3], uv);
+ copy_v2_v2(tf->uv[0], uv[0]);
+ copy_v2_v2(tf->uv[1], uv[1]);
+ copy_v2_v2(tf->uv[2], uv[2]);
+ copy_v2_v2(tf->uv[3], uv[3]);
tf++;
}
if (mluv) {
- copy_v2_v2(mluv[0].uv, uv);
- copy_v2_v2(mluv[1].uv, uv);
- copy_v2_v2(mluv[2].uv, uv);
- copy_v2_v2(mluv[3].uv, uv);
+ copy_v2_v2(mluv[0].uv, uv[0]);
+ copy_v2_v2(mluv[1].uv, uv[1]);
+ copy_v2_v2(mluv[2].uv, uv[2]);
+ copy_v2_v2(mluv[3].uv, uv[3]);
mluv += 4;
}
}