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>2016-07-22 13:50:27 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-07-22 15:56:15 +0300
commit98970f71fe95e6b842582f5b71f3081798a8f54a (patch)
treedef0c6c64d87195a0a251315aafaf9f0b6523ea3 /intern/opensubdiv/opensubdiv_capi.cc
parent177c4aff8b4bf80f7faaebf43dffbab63b40a113 (diff)
OpenSubdiv: Get number of UVs from topology refiner
This allows us to store more than one UV layer in the UVs array.
Diffstat (limited to 'intern/opensubdiv/opensubdiv_capi.cc')
-rw-r--r--intern/opensubdiv/opensubdiv_capi.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/intern/opensubdiv/opensubdiv_capi.cc b/intern/opensubdiv/opensubdiv_capi.cc
index 8e0c7f937ef..9093fd87a44 100644
--- a/intern/opensubdiv/opensubdiv_capi.cc
+++ b/intern/opensubdiv/opensubdiv_capi.cc
@@ -164,7 +164,7 @@ static void interpolate_fvar_data(OpenSubdiv::Far::TopologyRefiner& refiner,
const int channel = 0;
/* TODO(sergey): Make it somehow more generic way. */
const int fvar_width = 2;
-
+ const int num_uvs = refiner.GetLevel(0).GetNumFVarValues(0) * 2;
int max_level = refiner.GetMaxLevel(),
num_values_max = refiner.GetLevel(max_level).GetNumFVarValues(channel),
num_values_total = refiner.GetNumFVarValuesTotal(channel);
@@ -177,7 +177,7 @@ static void interpolate_fvar_data(OpenSubdiv::Far::TopologyRefiner& refiner,
fvar_data.resize(num_values_max * fvar_width);
std::vector<FVarVertex> buffer(num_values_total - num_values_max);
FVarVertex *src = &buffer[0];
- memcpy(src, &uvs[0], uvs.size() * sizeof(float));
+ memcpy(src, &uvs[0], num_uvs * sizeof(float));
/* Defer the last level to treat separately with its alternate
* destination.
*/
@@ -192,7 +192,7 @@ static void interpolate_fvar_data(OpenSubdiv::Far::TopologyRefiner& refiner,
/* For adaptive we keep all levels. */
fvar_data.resize(num_values_total * fvar_width);
FVarVertex *src = reinterpret_cast<FVarVertex *>(&fvar_data[0]);
- memcpy(src, &uvs[0], uvs.size() * sizeof(float));
+ memcpy(src, &uvs[0], num_uvs * sizeof(float));
for (int level = 1; level <= max_level; ++level) {
FVarVertex *dst = src + refiner.GetLevel(level-1).GetNumFVarValues(channel);
primvar_refiner.InterpolateFaceVarying(level, src, dst, channel);