forked from bartvdbraak/blender
OpenSubdiv: Properly support active UV layer in textured view
This commit is contained in:
parent
48c4b700dc
commit
ccd51bb922
@ -439,7 +439,10 @@ void bindProgram(OpenSubdiv_GLMesh *gl_mesh, int program)
|
|||||||
/* See notes below about why we use such values. */
|
/* See notes below about why we use such values. */
|
||||||
/* TOO(sergey): Get proper value for FVar width. */
|
/* TOO(sergey): Get proper value for FVar width. */
|
||||||
glUniform1i(glGetUniformLocation(program, "osd_fvar_count"), 2);
|
glUniform1i(glGetUniformLocation(program, "osd_fvar_count"), 2);
|
||||||
if (gl_mesh->fvar_data->channel_offsets.size() > 0 && g_active_uv_index >= 0) {
|
if (gl_mesh->fvar_data != NULL &&
|
||||||
|
gl_mesh->fvar_data->channel_offsets.size() > 0 &&
|
||||||
|
g_active_uv_index >= 0)
|
||||||
|
{
|
||||||
glUniform1i(glGetUniformLocation(program, "osd_active_uv_offset"),
|
glUniform1i(glGetUniformLocation(program, "osd_active_uv_offset"),
|
||||||
gl_mesh->fvar_data->channel_offsets[g_active_uv_index]);
|
gl_mesh->fvar_data->channel_offsets[g_active_uv_index]);
|
||||||
} else {
|
} else {
|
||||||
@ -624,7 +627,10 @@ static GLuint prepare_patchDraw(OpenSubdiv_GLMesh *gl_mesh,
|
|||||||
|
|
||||||
location = glGetUniformLocation(program, "osd_active_uv_offset");
|
location = glGetUniformLocation(program, "osd_active_uv_offset");
|
||||||
if (location != -1) {
|
if (location != -1) {
|
||||||
if (gl_mesh->fvar_data->channel_offsets.size() > 0 && g_active_uv_index >= 0) {
|
if (gl_mesh->fvar_data != NULL &&
|
||||||
|
gl_mesh->fvar_data->channel_offsets.size() > 0 &&
|
||||||
|
g_active_uv_index >= 0)
|
||||||
|
{
|
||||||
glUniform1i(location,
|
glUniform1i(location,
|
||||||
gl_mesh->fvar_data->channel_offsets[g_active_uv_index]);
|
gl_mesh->fvar_data->channel_offsets[g_active_uv_index]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3401,7 +3401,8 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
|
|||||||
|
|
||||||
#ifdef WITH_OPENSUBDIV
|
#ifdef WITH_OPENSUBDIV
|
||||||
if (ccgdm->useGpuBackend) {
|
if (ccgdm->useGpuBackend) {
|
||||||
if (UNLIKELY(ccgSubSurf_prepareGLMesh(ss, true, -1) == false)) {
|
const int active_uv_layer = CustomData_get_active_layer_index(&dm->loopData, CD_MLOOPUV);
|
||||||
|
if (UNLIKELY(ccgSubSurf_prepareGLMesh(ss, true, active_uv_layer) == false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (drawParams == NULL) {
|
if (drawParams == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user