[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59576] branches/soc-2013-viewport_fx: some fixes for drawing stipple with drawMappedFaces
Jason Wilkins
Jason.A.Wilkins at gmail.com
Wed Aug 28 00:33:32 CEST 2013
Revision: 59576
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59576
Author: jwilkins
Date: 2013-08-27 22:33:32 +0000 (Tue, 27 Aug 2013)
Log Message:
-----------
some fixes for drawing stipple with drawMappedFaces
Modified Paths:
--------------
branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_Context.h
branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c
branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/editderivedmesh.c
branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/subsurf_ccg.c
branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c
branches/soc-2013-viewport_fx/source/blender/editors/uvedit/uvedit_draw.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.h
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_safety.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_safety.h
branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_raster_vert.glsl
Modified: branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_Context.h
===================================================================
--- branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_Context.h 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_Context.h 2013-08-27 22:33:32 UTC (rev 59576)
@@ -106,7 +106,7 @@
#ifndef NDEBUG
#define GLEW_CHK(x) glew_chk((x), __FILE__, __LINE__, #x)
#else
-#define GLEW_CHK(x) glew_chk(x)
+#define GLEW_CHK(x) x
#endif
Modified: branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c 2013-08-27 22:33:32 UTC (rev 59576)
@@ -1010,18 +1010,22 @@
unsigned char *cp = NULL;
if (draw_option == DM_DRAW_OPTION_STIPPLE) {
+ GPU_raster_begin();
+
GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
gpuPolygonStipple(stipple_quarttone);
}
+ else {
+ // SSS Enable Smooth
+ GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
+ }
if (useColors && mcol)
cp = (unsigned char *)&mcol[i * 4];
/* normals are used to change shading, so choose smooth so smooth shading will work (XXX jwilkins: rewrote to say what I think was meant */
- // SSS Enable Smooth
- GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
-
gpuBegin(mf->v4 ? GL_QUADS : GL_TRIANGLES);
if (!drawSmooth) {
if (nors) {
@@ -1068,8 +1072,15 @@
gpuEnd();
- if (draw_option == DM_DRAW_OPTION_STIPPLE)
+ if (draw_option == DM_DRAW_OPTION_STIPPLE) {
GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
+ GPU_raster_end();
+ }
+ else {
+ // SSS Disable Smooth
+ GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
+ }
}
if (nors) nors += 3;
@@ -1128,7 +1139,10 @@
draw_option = setDrawOptions(userData, orig);
if (draw_option == DM_DRAW_OPTION_STIPPLE) {
+ GPU_raster_begin();
+
GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
gpuPolygonStipple(stipple_quarttone);
}
@@ -1159,8 +1173,11 @@
prevstart = i + 1;
- if (draw_option == DM_DRAW_OPTION_STIPPLE)
+ if (draw_option == DM_DRAW_OPTION_STIPPLE) {
GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
+ GPU_raster_end();
+ }
}
}
}
Modified: branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/editderivedmesh.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/editderivedmesh.c 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/editderivedmesh.c 2013-08-27 22:33:32 UTC (rev 59576)
@@ -389,7 +389,10 @@
if (poly_prev != GL_NOOP) gpuEnd();
poly_prev = GL_NOOP; /* force gpuBegin */
+ GPU_raster_begin();
+
GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
gpuPolygonStipple(stipple_quarttone);
}
@@ -461,6 +464,8 @@
poly_prev = GL_NOOP; /* force gpuBegin */
GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
+ GPU_raster_end();
}
}
}
@@ -488,7 +493,10 @@
if (poly_prev != GL_NOOP) gpuEnd();
poly_prev = GL_NOOP; /* force gpuBegin */
+ GPU_raster_begin();
+
GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
gpuPolygonStipple(stipple_quarttone);
}
@@ -562,6 +570,8 @@
GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+ GPU_raster_end();
+
poly_prev = GL_TRIANGLES;
gpuBegin(GL_TRIANGLES);
}
Modified: branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/subsurf_ccg.c 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/subsurf_ccg.c 2013-08-27 22:33:32 UTC (rev 59576)
@@ -2510,15 +2510,19 @@
if (draw_option != DM_DRAW_OPTION_SKIP) {
if (draw_option == DM_DRAW_OPTION_STIPPLE) {
+ GPU_raster_begin();
+
GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
gpuPolygonStipple(stipple_quarttone);
}
+ else {
+ /* normals are used to change shading, so choose smooth so smooth shading will work (XXX jwilkins: rewrote to say what I think was meant */
- /* normals are used to change shading, so choose smooth so smooth shading will work (XXX jwilkins: rewrote to say what I think was meant */
+ // SSS Enable Smooth
+ GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
+ }
- // SSS Enable Smooth
- GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
-
for (S = 0; S < numVerts; S++) {
CCGElem *faceGridData = (CCGElem*)ccgSubSurf_getFaceGridDataArray(ss, f, S);
if (drawSmooth) {
@@ -2585,11 +2589,15 @@
}
}
- // SSS Disable Smooth
- GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
+ if (draw_option == DM_DRAW_OPTION_STIPPLE) {
+ GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
- if (draw_option == DM_DRAW_OPTION_STIPPLE)
- GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+ GPU_raster_end();
+ }
+ else {
+ // SSS Disable Smooth
+ GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
+ }
}
}
}
Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c 2013-08-27 22:33:32 UTC (rev 59576)
@@ -2388,8 +2388,6 @@
data.orig_index_mf_to_mpoly = data.orig_index_mp_to_orig = NULL;
}
- GPU_raster_begin();
-
gpuImmediateFormat_C4_V3();
dm->drawMappedFaces(
@@ -2401,8 +2399,6 @@
0);
gpuImmediateUnformat();
-
- GPU_raster_end();
}
static DMDrawOption draw_dm_creases__setDrawOptions(void *userData, int index)
Modified: branches/soc-2013-viewport_fx/source/blender/editors/uvedit/uvedit_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/uvedit/uvedit_draw.c 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/source/blender/editors/uvedit/uvedit_draw.c 2013-08-27 22:33:32 UTC (rev 59576)
@@ -467,7 +467,6 @@
gpuImmediateFormat_C4_V2();
-
activetf = EDBM_mtexpoly_active_get(em, &efa_act, FALSE, FALSE); /* will be set to NULL if hidden */
activef = BM_active_face_get(bm, FALSE, FALSE);
ts = scene->toolsettings;
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c 2013-08-27 22:33:32 UTC (rev 59576)
@@ -74,8 +74,6 @@
GPUShader* gpushader[GPU_BASIC_OPTION_COMBINATIONS];
bool failed [GPU_BASIC_OPTION_COMBINATIONS];
GPUcommon common [GPU_BASIC_OPTION_COMBINATIONS];
-
- bool need_normals;
} BASIC_SHADER;
@@ -281,12 +279,7 @@
if (BASIC_SHADER.options & GPU_BASIC_LIGHTING) {
gpu_commit_light();
gpu_commit_material();
-
- BASIC_SHADER.need_normals = true; // Temporary hack. Should be solved outside of this file.
}
- else {
- BASIC_SHADER.need_normals = false; // Temporary hack. Should be solved outside of this file.
- }
GPU_CHECK_NO_ERROR();
}
@@ -308,8 +301,6 @@
glShadeModel(GL_FLAT);
#endif
- BASIC_SHADER.need_normals = false; // Temporary hack. Should be solved outside of this file.
-
GPU_CHECK_NO_ERROR();
}
@@ -317,7 +308,5 @@
bool GPU_basic_shader_needs_normals(void)
{
- return BASIC_SHADER.need_normals;
+ return BASIC_SHADER.options & GPU_BASIC_LIGHTING; // Temporary hack. Should be solved outside of this file.
}
-
-
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.h 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.h 2013-08-27 22:33:32 UTC (rev 59576)
@@ -54,6 +54,10 @@
+const char* gpuErrorString(GLenum err);
+
+
+
#if GPU_SAFETY
/* Define some useful, but potentially slow, checks for correct API usage. */
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.c 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.c 2013-08-27 22:33:32 UTC (rev 59576)
@@ -377,7 +377,7 @@
begun = false;
#endif
- // SSS End Pixels
+ // SSS End Raster
GPU_aspect_end();
// SSS Begin Basic
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_safety.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_safety.c 2013-08-27 22:13:11 UTC (rev 59575)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_safety.c 2013-08-27 22:33:32 UTC (rev 59576)
@@ -33,10 +33,13 @@
#if GPU_SAFETY
-#include <stdlib.h>
+#include "intern/gpu_glew.h"
+#include "intern/gpu_immediate.h"
+#include <stdio.h>
+
void gpu_check(const char* file, int line, const char* text)
{
GLboolean no_error = GL_TRUE;
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_safety.h
===================================================================
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list