Merge pull request #1085 from c64kernal/dev_dxgregoryfix

A few minor fixes for Gregory Patches in DirectX
This commit is contained in:
Barry Fowler 2019-04-01 11:01:35 -07:00 committed by GitHub
commit 886ec96eed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -1360,6 +1360,14 @@ OsdEvalPatchGregory(int3 patchParam, float2 UV, float3 cv[20],
bezcv[14].P = cv[11];
bezcv[15].P = cv[10];
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
for (int i=0; i < 16; ++i) {
bezcv[i].P1 = float3(0,0,0);
bezcv[i].P2 = float3(0,0,0);
bezcv[i].vSegments = float2(0,0);
}
#endif
OsdEvalPatchBezier(patchParam, UV, bezcv, P, dPu, dPv, N, dNu, dNv);
}
@ -1533,11 +1541,11 @@ OsdComputePerVertexGregory(int vID, float3 P, out OsdPerVertexGregory v)
v.e0 = float3(0,0,0);
v.e1 = float3(0,0,0);
for(int i=0; i<valence; ++i) {
int im = (i + valence -1) % valence;
e = 0.5f * (f[i] + f[im]);
v.e0 += cosfn(valence, i)*e;
v.e1 += sinfn(valence, i)*e;
for(int iv=0; iv<valence; ++iv) {
int im = (iv + valence -1) % valence;
e = 0.5f * (f[iv] + f[im]);
v.e0 += cosfn(valence, iv)*e;
v.e1 += sinfn(valence, iv)*e;
}
v.e0 *= ef[valence - 3];
v.e1 *= ef[valence - 3];

View File

@ -119,6 +119,9 @@ void ds_main_patches(
output.Nu = dNu;
output.Nv = dNv;
#endif
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
output.vSegments = float2(0,0);
#endif
output.patchCoord = OsdInterpolatePatchCoord(UV, patchParam);