diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-03 18:30:44 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-03 18:51:18 +0300 |
commit | 7667ad2d4e616ea0d412ac63e76c220a7106d065 (patch) | |
tree | ef6f86ffa9af39c52ba32346044957c743e33544 /source/blender/blenkernel/intern/subsurf_ccg.c | |
parent | e90fea72c1430d270ccf4b5c3880f7e25e35947e (diff) |
OpenSubdiv: Made it a modifier option to enable OSD for viewport
The idea of this commit is to make it so we can enable OpenSubdiv by default
for the release builds but keep it limited to the viewport only for a specific
meshes. This is a temporary solution for until all the needed features are
supported on the OpenSubdiv side.
Flag itself is done as a dedicated field in modifier DNA so we can easily
remove it in the future without ending up with some temporary flag hanging
around forever.
Diffstat (limited to 'source/blender/blenkernel/intern/subsurf_ccg.c')
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index cfc9c32e81e..019c3e58aa7 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -273,7 +273,6 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg } } -#ifndef WITH_OPENSUBDIV static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mpoly, struct MLoop *ml, int fi, CCGVertHDL *fverts) { UvMapVert *v, *nv; @@ -415,13 +414,12 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, return 1; } -#endif /* WITH_OPENSUBDIV */ #ifdef WITH_OPENSUBDIV -static void set_subsurf_ccg_uv(CCGSubSurf *ss, - DerivedMesh *dm, - DerivedMesh *result, - int layer_index) +static void UNUSED_FUNCTION(set_subsurf_osd_ccg_uv)(CCGSubSurf *ss, + DerivedMesh *dm, + DerivedMesh *result, + int layer_index) { CCGFace **faceMap; MTFace *tf; @@ -498,22 +496,9 @@ static void set_subsurf_ccg_uv(CCGSubSurf *ss, } MEM_freeN(faceMap); } +#endif /* WITH_OPENSUBDIV */ -static void set_subsurf_uv(CCGSubSurf *ss, - DerivedMesh *dm, - DerivedMesh *result, - int layer_index) -{ - if (!ccgSubSurf_needGrids(ss)) { - /* GPU backend is used, no need to evaluate UVs on CPU. */ - /* TODO(sergey): Think of how to support edit mode of UVs. */ - } - else { - set_subsurf_ccg_uv(ss, dm, result, layer_index); - } -} -#else /* WITH_OPENSUBDIV */ -static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result, int n) +static void set_subsurf_legacy_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result, int n) { CCGSubSurf *uvss; CCGFace **faceMap; @@ -593,7 +578,23 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result, ccgSubSurf_free(uvss); MEM_freeN(faceMap); } -#endif /* WITH_OPENSUBDIV */ + +static void set_subsurf_uv(CCGSubSurf *ss, + DerivedMesh *dm, + DerivedMesh *result, + int layer_index) +{ +#ifdef WITH_OPENSUBDIV + if (!ccgSubSurf_needGrids(ss)) { + /* GPU backend is used, no need to evaluate UVs on CPU. */ + /* TODO(sergey): Think of how to support edit mode of UVs. */ + } + else +#endif + { + set_subsurf_legacy_uv(ss, dm, result, layer_index); + } +} /* face weighting */ typedef struct FaceVertWeightEntry { @@ -797,9 +798,9 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, /* Reset all related descriptors if actual mesh topology changed or if * other evlauation-related settings changed. */ - ccgSubSurf_checkTopologyChanged(ss, dm); if (!ccgSubSurf_needGrids(ss)) { /* TODO(sergey): Use vertex coordinates and flat subdiv flag. */ + ccgSubSurf_checkTopologyChanged(ss, dm); ss_sync_osd_from_derivedmesh(ss, dm); } else |