OpenSubdiv: Initial support of UV maps in material shading mode

This commit is contained in:
2016-07-22 16:12:03 +02:00
parent b2f91d8acf
commit 9c63878085
6 changed files with 53 additions and 13 deletions

View File

@@ -853,11 +853,14 @@ static char *code_generate_geometry(ListBase *nodes, bool use_opensubdiv)
for (input = node->inputs.first; input; input = input->next) {
if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
if (input->attribtype == CD_MTFACE) {
/* NOTE: For now we are using varying on purpose,
* otherwise we are not able to write to the varying.
*/
BLI_dynstr_appendf(ds, "%s %s var%d%s;\n",
GLEW_VERSION_3_0 ? "in" : "varying",
"varying",
GPU_DATATYPE_STR[input->type],
input->attribid,
GLEW_VERSION_3_0 ? "[]" : "");
"");
BLI_dynstr_appendf(ds, "uniform int fvar%d_offset;\n",
input->attribid);
}
@@ -872,11 +875,12 @@ static char *code_generate_geometry(ListBase *nodes, bool use_opensubdiv)
for (input = node->inputs.first; input; input = input->next) {
if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
if (input->attribtype == CD_MTFACE) {
BLI_dynstr_appendf(ds,
"\t// INTERP_FACE_VARYING_2(var%d, "
"fvar%d_offset, st);\n",
input->attribid,
input->attribid);
BLI_dynstr_appendf(
ds,
"\tINTERP_FACE_VARYING_2(var%d, "
"int(texelFetch(FVarDataOffsetBuffer, fvar%d_offset).r), st);\n",
input->attribid,
input->attribid);
}
}
}