[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59538] branches/soc-2013-viewport_fx/ source/blender: rest of changes needed for the raster shader ( still incomplete, but it compiles)
Jason Wilkins
Jason.A.Wilkins at gmail.com
Mon Aug 26 23:35:06 CEST 2013
Revision: 59538
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59538
Author: jwilkins
Date: 2013-08-26 21:35:06 +0000 (Mon, 26 Aug 2013)
Log Message:
-----------
rest of changes needed for the raster shader (still incomplete, but it compiles)
Modified Paths:
--------------
branches/soc-2013-viewport_fx/source/blender/blenkernel/BKE_pbvh.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/pbvh.c
branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/subsurf_ccg.c
branches/soc-2013-viewport_fx/source/blender/editors/animation/anim_markers.c
branches/soc-2013-viewport_fx/source/blender/editors/animation/keyframes_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c
branches/soc-2013-viewport_fx/source/blender/editors/gpencil/gpencil_paint.c
branches/soc-2013-viewport_fx/source/blender/editors/include/BIF_glutil.h
branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_icons.c
branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_panel.c
branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_widgets.c
branches/soc-2013-viewport_fx/source/blender/editors/mask/mask_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/physics/particle_edit.c
branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c
branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c
branches/soc-2013-viewport_fx/source/blender/editors/screen/screendump.c
branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_cursor.c
branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_image.c
branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_stroke.c
branches/soc-2013-viewport_fx/source/blender/editors/space_clip/clip_dopesheet_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/space_clip/clip_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/space_graph/graph_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/space_image/image_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/space_nla/nla_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/space_node/drawnode.c
branches/soc-2013-viewport_fx/source/blender/editors/space_node/node_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/space_sequencer/sequencer_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawarmature.c
branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawmesh.c
branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c
branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_ruler.c
branches/soc-2013-viewport_fx/source/blender/editors/transform/transform.c
branches/soc-2013-viewport_fx/source/blender/editors/transform/transform_constraints.c
branches/soc-2013-viewport_fx/source/blender/editors/util/ed_util.c
branches/soc-2013-viewport_fx/source/blender/editors/uvedit/uvedit_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/uvedit/uvedit_smart_stitch.c
branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt
branches/soc-2013-viewport_fx/source/blender/gpu/GPU_buffers.h
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_buffers.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_common.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_common.h
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_gl.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.h
branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_init_exit.c
Removed Paths:
-------------
branches/soc-2013-viewport_fx/source/blender/gpu/GPU_object.h
Modified: branches/soc-2013-viewport_fx/source/blender/blenkernel/BKE_pbvh.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/blenkernel/BKE_pbvh.h 2013-08-26 21:34:32 UTC (rev 59537)
+++ branches/soc-2013-viewport_fx/source/blender/blenkernel/BKE_pbvh.h 2013-08-26 21:35:06 UTC (rev 59538)
@@ -101,7 +101,7 @@
void BKE_pbvh_node_draw(PBVHNode *node, void *data);
void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
- int (*setMaterial)(int, void *attribs), int wireframe);
+ int (*setMaterial)(int, void *attribs), bool wireframe);
/* PBVH Access */
typedef enum {
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-26 21:34:32 UTC (rev 59537)
+++ branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c 2013-08-26 21:35:06 UTC (rev 59538)
@@ -449,11 +449,19 @@
if (cddm->pbvh && cddm->pbvh_draw &&
BKE_pbvh_type(cddm->pbvh) == PBVH_BMESH)
{
- BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, TRUE);
+ GPU_raster_begin();
+ gpuPolygonMode(GL_LINE);
+
+ BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, true);
+
+ gpuPolygonMode(GL_FILL);
+
+ GPU_raster_end();
+
return;
}
-
+
if (GPU_buffer_legacy(dm)) {
DEBUG_VBO("Using legacy code. cdDM_drawEdges\n");
gpuImmediateFormat_V3();
@@ -579,7 +587,7 @@
if (dm->numTessFaceData) {
float (*face_nors)[3] = (float(*)[3])CustomData_get_layer(&dm->faceData, CD_NORMAL);
- BKE_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors, setMaterial, FALSE);
+ BKE_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors, setMaterial, false);
}
return;
@@ -702,7 +710,7 @@
if (cddm->pbvh && cddm->pbvh_draw && BKE_pbvh_type(cddm->pbvh) == PBVH_BMESH) {
if (dm->numTessFaceData) {
GPU_set_tpage(NULL, false, false);
- BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, FALSE);
+ BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, false);
}
return;
@@ -1120,7 +1128,7 @@
draw_option = setDrawOptions(userData, orig);
if (draw_option == DM_DRAW_OPTION_STIPPLE) {
- gpuEnablePolygonStipple();
+ GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
gpuPolygonStipple(stipple_quarttone);
}
@@ -1152,7 +1160,7 @@
prevstart = i + 1;
if (draw_option == DM_DRAW_OPTION_STIPPLE)
- gpuDisablePolygonStipple();
+ GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
}
}
}
@@ -1331,7 +1339,7 @@
if (cddm->pbvh && cddm->pbvh_draw && BKE_pbvh_type(cddm->pbvh) == PBVH_BMESH) {
if (dm->numTessFaceData) {
setMaterial(1, &gattribs);
- BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, FALSE);
+ BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, false);
}
return;
@@ -1658,7 +1666,7 @@
if (cddm->pbvh && cddm->pbvh_draw && BKE_pbvh_type(cddm->pbvh) == PBVH_BMESH) {
if (dm->numTessFaceData) {
setMaterial(userData, 1, &gattribs);
- BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, FALSE);
+ BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, false);
}
return;
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-26 21:34:32 UTC (rev 59537)
+++ branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/editderivedmesh.c 2013-08-26 21:35:06 UTC (rev 59538)
@@ -488,7 +488,7 @@
if (poly_prev != GL_NOOP) gpuEnd();
poly_prev = GL_NOOP; /* force gpuBegin */
- gpuEnablePolygonStipple();
+ GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
gpuPolygonStipple(stipple_quarttone);
}
@@ -560,7 +560,7 @@
if (flush) {
gpuEnd();
- gpuDisablePolygonStipple();
+ GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
poly_prev = GL_TRIANGLES;
gpuBegin(GL_TRIANGLES);
Modified: branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/pbvh.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/pbvh.c 2013-08-26 21:34:32 UTC (rev 59537)
+++ branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/pbvh.c 2013-08-26 21:35:06 UTC (rev 59538)
@@ -1542,12 +1542,12 @@
typedef struct {
DMSetMaterial setMaterial;
- int wireframe;
+ bool wireframe;
} PBVHNodeDrawData;
void BKE_pbvh_node_draw(PBVHNode *node, void *data_v)
{
- PBVHNodeDrawData *data = data_v;
+ PBVHNodeDrawData *data = (PBVHNodeDrawData*)data_v;
#if 0
/* XXX: Just some quick code to show leaf nodes in different colors */
@@ -1566,11 +1566,8 @@
gpuColor3f(1, 0, 0);
#endif
- if (!(node->flag & PBVH_FullyHidden)) {
- GPU_draw_buffers(node->draw_buffers,
- data->setMaterial,
- data->wireframe);
- }
+ if ((node->flag & PBVH_FullyHidden) == 0)
+ GPU_draw_buffers(node->draw_buffers, data->setMaterial, data->wireframe);
}
typedef enum {
@@ -1639,7 +1636,7 @@
}
void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
- DMSetMaterial setMaterial, int wireframe)
+ DMSetMaterial setMaterial, bool wireframe)
{
PBVHNodeDrawData draw_data = {setMaterial, wireframe};
PBVHNode **nodes;
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-26 21:34:32 UTC (rev 59537)
+++ branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/subsurf_ccg.c 2013-08-26 21:35:06 UTC (rev 59538)
@@ -1756,7 +1756,7 @@
if (ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
if (dm->numTessFaceData) {
- BKE_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL, setMaterial, FALSE);
+ BKE_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL, setMaterial, false);
}
return;
Modified: branches/soc-2013-viewport_fx/source/blender/editors/animation/anim_markers.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/animation/anim_markers.c 2013-08-26 21:34:32 UTC (rev 59537)
+++ branches/soc-2013-viewport_fx/source/blender/editors/animation/anim_markers.c 2013-08-26 21:35:06 UTC (rev 59538)
@@ -371,8 +371,10 @@
if (flag & DRAW_MARKERS_LINES)
#endif
{
- setlinestyle(3);
+ GPU_raster_begin();
+ GPU_raster_set_line_style(3);
+
gpuColor4P(
(marker->flag & SELECT) ? CPACK_WHITE : CPACK_BLACK,
0.376f);
@@ -384,7 +386,9 @@
(xpos * xscale) + 0.5f,
(v2d->cur.ymax + 12.0f) * yscale);
- setlinestyle(0);
+ GPU_raster_set_line_style(0);
+
+ GPU_raster_end();
}
/* 5 px to offset icon to align properly, space / pixels corrects for zoom */
Modified: branches/soc-2013-viewport_fx/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/animation/keyframes_draw.c 2013-08-26 21:34:32 UTC (rev 59537)
+++ branches/soc-2013-viewport_fx/source/blender/editors/animation/keyframes_draw.c 2013-08-26 21:35:06 UTC (rev 59538)
@@ -559,9 +559,6 @@
gpuTranslate(x, y, 0.0f);
gpuScale(1.0f / xscale * hsize, hsize, 1.0f);
- /* anti-aliased lines for more consistent appearance */
- gpuEnableLineSmooth();
-
/* draw! */
if (ELEM(mode, KEYFRAME_SHAPE_INSIDE, KEYFRAME_SHAPE_BOTH)) {
/* interior - hardcoded colors (for selected and unselected only) */
@@ -595,7 +592,7 @@
}
break;
}
-
+
gpuBegin(GL_QUADS);
gpuVertex2fv(_unit_diamond_shape[0]);
gpuVertex2fv(_unit_diamond_shape[1]);
@@ -603,21 +600,28 @@
gpuVertex2fv(_unit_diamond_shape[3]);
gpuEnd();
}
-
+
if (ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH)) {
+ GPU_raster_begin();
+
+ /* anti-aliased lines for more consistent appearance */
+ GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_AA);
+
/* exterior - black frame */
gpuColor4P(CPACK_BLACK, alpha);
-
+
gpuBegin(GL_LINE_LOOP);
gpuVertex2fv(_unit_diamond_shape[0]);
gpuVertex2fv(_unit_diamond_shape[1]);
gpuVertex2fv(_unit_diamond_shape[2]);
gpuVertex2fv(_unit_diamond_shape[3]);
gpuEnd();
+
+ GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_AA);
+
+ GPU_raster_end();
}
-
- gpuDisableLineSmooth();
-
+
/* restore view transform */
gpuScale(xscale / hsize, 1.0f / hsize, 1.0f);
gpuTranslate(-x, -y, 0.0f);
Modified: branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c 2013-08-26 21:34:32 UTC (rev 59537)
+++ branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c 2013-08-26 21:35:06 UTC (rev 59538)
@@ -112,11 +112,13 @@
}
else {
float oldpressure = points[0].pressure;
-
+
+ GPU_raster_begin();
+
/* draw stroke curve */
- if (G.debug & G_DEBUG) setlinestyle(2);
+ if (G.debug & G_DEBUG) GPU_raster_set_line_style(2);
- glLineWidth(oldpressure * thickness);
+ gpuLineWidth(oldpressure * thickness);
gpuBegin(GL_LINE_STRIP);
for (i = 0, pt = points; i < totpoints && pt; i++, pt++) {
@@ -125,7 +127,7 @@
*/
if (fabsf(pt->pressure - oldpressure) > 0.2f) {
gpuEnd();
- glLineWidth(pt->pressure * thickness);
+ gpuLineWidth(pt->pressure * thickness);
gpuBegin(GL_LINE_STRIP);
/* need to roll-back one point to ensure that there are no gaps in the stroke */
@@ -143,9 +145,11 @@
gpuEnd();
/* reset for predictable OpenGL context */
- glLineWidth(1.0f);
+ gpuLineWidth(1.0f);
- if (G.debug & G_DEBUG) setlinestyle(0);
+ if (G.debug & G_DEBUG) GPU_raster_set_line_style(0);
+
+ GPU_raster_end();
}
}
@@ -209,7 +213,7 @@
*/
if (fabsf(pt->pressure - oldpressure) > 0.2f) {
gpuEnd();
- glLineWidth(pt->pressure * thickness);
+ gpuLineWidth(pt->pressure * thickness);
gpuBegin(GL_LINE_STRIP);
/* need to roll-back one point to ensure that there are no gaps in the stroke */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list