[Bf-blender-cvs] [913ad6c] opensubdiv-modifier: hack up simple subdivisions in

Sergey Sharybin noreply at git.blender.org
Mon May 12 20:09:07 CEST 2014


Commit: 913ad6c7abfbdc35eb52d3c3a598df9860c2f184
Author: Sergey Sharybin
Date:   Mon May 12 11:20:16 2014 +0200
https://developer.blender.org/rB913ad6c7abfbdc35eb52d3c3a598df9860c2f184

hack up simple subdivisions in

Currently it'll still use legacy subsurf code.

===================================================================

M	intern/opensubdiv/opensubdiv_gpu_capi.cc
M	source/blender/blenkernel/intern/subsurf_ccg.c

===================================================================

diff --git a/intern/opensubdiv/opensubdiv_gpu_capi.cc b/intern/opensubdiv/opensubdiv_gpu_capi.cc
index 680944e..294db51 100644
--- a/intern/opensubdiv/opensubdiv_gpu_capi.cc
+++ b/intern/opensubdiv/opensubdiv_gpu_capi.cc
@@ -430,7 +430,7 @@ void openSubdiv_osdGLMeshDisplay(OpenSubdiv_GLMesh *gl_mesh)
 		GLuint program = bindProgram(mesh, patch, gl_mesh->level);
 		GLuint diffuseColor = glGetUniformLocation(program, "diffuseColor");
 
-		glProgramUniform4f(program, diffuseColor, 0.4f, 0.4f, 0.8f, 1);
+		glProgramUniform4f(program, diffuseColor, 0.8f, 0.8f, 0.8f, 1);
 
 		GLuint uniformGregoryQuadOffsetBase =
 			glGetUniformLocation(program, "GregoryQuadOffsetBase");
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index aabdf21..25b90c1 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1651,12 +1651,6 @@ static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
 
 static void ccgDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdges)
 {
-#ifdef WITH_OPENSUBDIV
-	/* TODO(sergey): Support edge drawing. */
-	(void) dm;
-	(void) drawLooseEdges;
-	(void) drawAllEdges;
-#else
 	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	CCGKey key;
@@ -1665,6 +1659,16 @@ static void ccgDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEd
 	int gridSize = ccgSubSurf_getGridSize(ss);
 	int useAging;
 
+#ifdef WITH_OPENSUBDIV
+	if (!ccgSubSurf_getSimpleSubdiv(ss)) {
+		/* TODO(sergey): Support edge drawing. */
+		(void) dm;
+		(void) drawLooseEdges;
+		(void) drawAllEdges;
+		return;
+	}
+#endif
+
 	CCG_key_top_level(&key, ss);
 	ccgdm_pbvh_update(ccgdm);
 
@@ -1726,7 +1730,6 @@ static void ccgDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEd
 			}
 		}
 	}
-#endif
 }
 
 static void ccgDM_drawLooseEdges(DerivedMesh *dm)
@@ -1773,16 +1776,6 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
 {
 	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
-
-#ifdef WITH_OPENSUBDIV
-	/* TODO(sergey): This optiosn are totally ignored for now. */
-	(void) partial_redraw_planes;
-	(void) fast;
-	(void) setMaterial;
-
-	ccgSubSurf_prepareGLMesh(ss);
-	ccgSubSurf_drawGLMesh(ss);
-#else
 	CCGKey key;
 	short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL);
 	int gridSize = ccgSubSurf_getGridSize(ss);
@@ -1792,6 +1785,18 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
 	int i, totface = ccgSubSurf_getNumFaces(ss);
 	int drawcurrent = 0, matnr = -1, shademodel = -1;
 
+#ifdef WITH_OPENSUBDIV
+	if (!ccgSubSurf_getSimpleSubdiv(ss)) {
+		(void) partial_redraw_planes;
+		(void) fast;
+		(void) setMaterial;
+
+		ccgSubSurf_prepareGLMesh(ss);
+		ccgSubSurf_drawGLMesh(ss);
+		return;
+	}
+#endif
+
 	CCG_key_top_level(&key, ss);
 	ccgdm_pbvh_update(ccgdm);
 
@@ -1903,7 +1908,6 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
 			}
 		}
 	}
-#endif
 }
 
 static void ccgdm_draw_attrib_vertex(DMVertexAttribs *attribs, int a, int index, int vert)
@@ -3944,8 +3948,9 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
 			bool use_gpu_backend = false;
 
 #ifdef WITH_OPENSUBDIV
-			use_gpu_backend = (flags & SUBSURF_USE_GPU_BACKEND) != 0;
-
+			if (!useSimple) {
+				use_gpu_backend = (flags & SUBSURF_USE_GPU_BACKEND) != 0;
+			}
 #endif
 
 			if (smd->mCache && (flags & SUBSURF_IS_FINAL_CALC)) {




More information about the Bf-blender-cvs mailing list