Revision: 59512
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59512
Author:   jwilkins
Date:     2013-08-26 11:38:18 +0000 (Mon, 26 Aug 2013)
Log Message:
-----------
"raster" shader.  meaning a shading mode that handles stippling, anti-aliasing, 
and wire frame.  Incomplete.  Checking it so I can change locations.

Modified Paths:
--------------
    
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/interface/interface_icons.c
    branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.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_ruler.c
    branches/soc-2013-viewport_fx/source/blender/editors/uvedit/uvedit_draw.c
    branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic_shader.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_common.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_font_shader.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_gl.c
    
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_inline.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_pixels.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_pixels.h
    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/gpu/shaders/gpu_shader_basic_frag.glsl
    
branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_font_vert.glsl
    
branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_gesture.c
    
branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_init_exit.c
    
branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_operators.c
    
branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_playanim.c

Added Paths:
-----------
    
branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_raster_frag.glsl
    
branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_raster_uniforms.glsl
    
branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_raster_vert.glsl

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 09:59:51 UTC (rev 59511)
+++ 
branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/cdderivedmesh.c  
    2013-08-26 11:38:18 UTC (rev 59512)
@@ -1002,14 +1002,14 @@
                                unsigned char *cp = NULL;
 
                                if (draw_option == DM_DRAW_OPTION_STIPPLE) {
-                                       gpuEnablePolygonStipple();
+                                       GPU_aspect_enable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
                                        gpuPolygonStipple(stipple_quarttone);
                                }
 
                                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 */
+                               /* 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);
@@ -1061,7 +1061,7 @@
                                gpuEnd();
 
                                if (draw_option == DM_DRAW_OPTION_STIPPLE)
-                                       gpuDisablePolygonStipple();
+                                       GPU_aspect_disable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
                        }
                        
                        if (nors) nors += 3;

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 09:59:51 UTC (rev 59511)
+++ 
branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/editderivedmesh.c
    2013-08-26 11:38:18 UTC (rev 59512)
@@ -389,7 +389,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);
                                }
 
@@ -460,7 +460,7 @@
                                        gpuEnd();
                                        poly_prev = GL_NOOP; /* force gpuBegin 
*/
 
-                                       gpuDisablePolygonStipple();
+                                       GPU_aspect_disable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
                                }
                        }
                }

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 09:59:51 UTC (rev 59511)
+++ 
branches/soc-2013-viewport_fx/source/blender/blenkernel/intern/subsurf_ccg.c    
    2013-08-26 11:38:18 UTC (rev 59512)
@@ -2510,7 +2510,7 @@
 
                        if (draw_option != DM_DRAW_OPTION_SKIP) {
                                if (draw_option == DM_DRAW_OPTION_STIPPLE) {
-                                       gpuEnablePolygonStipple();
+                                       GPU_aspect_enable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
                                        gpuPolygonStipple(stipple_quarttone);
                                }
 
@@ -2589,7 +2589,7 @@
                                GPU_aspect_disable(GPU_ASPECT_BASIC, 
GPU_BASIC_SMOOTH);
 
                                if (draw_option == DM_DRAW_OPTION_STIPPLE)
-                                       gpuDisablePolygonStipple();
+                                       GPU_aspect_disable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
                        }
                }
        }

Modified: 
branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_icons.c
===================================================================
--- 
branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_icons.c
    2013-08-26 09:59:51 UTC (rev 59511)
+++ 
branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_icons.c
    2013-08-26 11:38:18 UTC (rev 59512)
@@ -1052,10 +1052,10 @@
        else {
                GPUpixels pixels = { w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect };
 
-               gpuPixelsBegin();
+               GPU_pixels_begin();
                gpuPixelPos2f(x, y);
                gpuPixels(&pixels);
-               gpuPixelsEnd();
+               GPU_pixels_end();
        }
 
        /* modulate color */

Modified: branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c        
2013-08-26 09:59:51 UTC (rev 59511)
+++ branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c        
2013-08-26 11:38:18 UTC (rev 59512)
@@ -144,59 +144,37 @@
        0x3f, 0xc0, 0x3f, 0xc0, 0x7f, 0x80, 0x7f, 0x80};
 
 
-//void fdrawbezier(float vec[4][3])
-//{
-//     float dist;
-//     float curve_res = 24, spline_step = 0.0f;
-//     
-//     dist = 0.5f * ABS(vec[0][0] - vec[3][0]);
-//     
-//     /* check direction later, for top sockets */
-//     vec[1][0] = vec[0][0] + dist;
-//     vec[1][1] = vec[0][1];
-//     
-//     vec[2][0] = vec[3][0] - dist;
-//     vec[2][1] = vec[3][1];
-//     /* we can reuse the dist variable here to increment the GL curve eval 
amount*/
-//     dist = 1.0f / curve_res;
-//     
-//     gpuColor3P(CPACK_BLACK);
-//     glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, vec[0]);
-//     gpuBegin(GL_LINE_STRIP);
-//     while (spline_step < 1.000001f) {
-//#if 0
-//             if (do_shaded)
-//                     UI_ThemeColorBlend(th_col1, th_col2, spline_step);
-//#endif
-//             glEvalCoord1f(spline_step);
-//             spline_step += dist;
-//     }
-//     gpuEnd();
-//}
-
-
 void fdrawcheckerboard(float x1, float y1, float x2, float y2)
 {
-       unsigned char col1[4] = {40, 40, 40}, col2[4] = {50, 50, 50};
+       static const unsigned char col1[4] = {40, 40, 40};
+       static const unsigned char col2[4] = {50, 50, 50};
 
-       GLubyte checker_stipple[32 * 32 / 8] = {
-               255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
-               255,  0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
-               0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
-               0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
-               255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
-               255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
-               0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
-               0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255};
-       
+       static const GLubyte checker_stipple[32 * 32 / 8] = {
+               255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 
255,   0, 255,   0,
+               255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 
255,   0, 255,   0,
+                 0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   
0, 255,   0, 255,
+                 0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   
0, 255,   0, 255,
+               255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 
255,   0, 255,   0,
+               255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 
255,   0, 255,   0,
+                 0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   
0, 255,   0, 255,
+                 0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   0, 255,   
0, 255,   0, 255
+       };
+
        gpuColor3ubv(col1);
        gpuSingleFilledRectf(x1, y1, x2, y2);
        gpuColor3ubv(col2);
 
-       gpuEnablePolygonStipple();
+       GPU_raster_begin();
+
+       GPU_aspect_enable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
        gpuPolygonStipple(checker_stipple);
+
        gpuSingleFilledRectf(x1, y1, x2, y2);
-       gpuDisablePolygonStipple();
+
+       GPU_aspect_disable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
+
+       GPU_raster_end();
 }
 
 /*
@@ -238,11 +216,11 @@
 void setlinestyle(int nr)
 {
        if (nr == 0) {
-               gpuDisableLineStipple();
+               GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_STIPPLE);
        }
        else {
-               
-               gpuEnableLineStipple();
+               GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_STIPPLE);
+
                if (U.pixelsize > 1.0f)
                        gpuLineStipple(nr, 0xCCCC);
                else
@@ -626,10 +604,10 @@
                {
                        GPUpixels pixels = { draw_w, draw_h, format, type, data 
};
 
-                       gpuPixelsBegin();
+                       GPU_pixels_begin();
                        gpuPixelPos2f(rast_x, rast_y);
                        gpuPixels(&pixels);
-                       gpuPixelsEnd();
+                       GPU_pixels_end();
                }
        }
 }

Modified: 
branches/soc-2013-viewport_fx/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- 
branches/soc-2013-viewport_fx/source/blender/editors/space_sequencer/sequencer_draw.c
       2013-08-26 09:59:51 UTC (rev 59511)
+++ 
branches/soc-2013-viewport_fx/source/blender/editors/space_sequencer/sequencer_draw.c
       2013-08-26 11:38:18 UTC (rev 59512)
@@ -256,18 +256,16 @@
        }
 }
 
-static void drawmeta_stipple(int value)
+static void drawmeta_stipple(bool value)
 {
        if (value) {
-               gpuEnablePolygonStipple();
+               GPU_aspect_enable(GPU_ASPECT_RASTER, GPU_RASTER_STIPPLE);
+
                gpuPolygonStipple(stipple_halftone);
-               
-               gpuEnableLineStipple();
                gpuLineStipple(1, 0x8888);
        }
        else {
-               gpuDisablePolygonStipple();
-               gpuDisableLineStipple();
+               GPU_aspect_disable(GPU_ASPECT_RASTER, GPU_RASTER_STIPPLE);
        }
 }
 
@@ -288,8 +286,10 @@
 
        glEnable(GL_BLEND);
 
+       GPU_raster_begin();
+
        if (seqm->flag & SEQ_MUTE)
-               drawmeta_stipple(1);
+               drawmeta_stipple(true);
 
        for (seq = seqm->seqbase.first; seq; seq = seq->next) {
                chan_min = min_ii(chan_min, seq->machine);
@@ -309,7 +309,7 @@
                        float y1_chan, y2_chan;
 
                        if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & 
SEQ_MUTE))
-                               drawmeta_stipple(1);
+                               drawmeta_stipple(true);
 
                        get_seq_color3ubv(scene, seq, col);
 
@@ -322,21 +322,25 @@
                        y1_chan = y1 + y_chan + (draw_height * 
SEQ_STRIP_OFSBOTTOM);
                        y2_chan = y1 + y_chan + (draw_height * 
SEQ_STRIP_OFSTOP);
 
+                       GPU_aspect_enable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON);
                        gpuSingleFilledRectf(x1_chan,  y1_chan, x2_chan,  
y2_chan);
+                       GPU_aspect_disable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON);
 
                        UI_GetColorPtrShade3ubv(col, col, -30);
                        gpuColor4ubv(col);
                        gpuSingleWireRectf(x1_chan,  y1_chan, x2_chan,  
y2_chan);
 
                        if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & 
SEQ_MUTE))
-                               drawmeta_stipple(0);
+                               drawmeta_stipple(false);
                }
        }
 
        if (seqm->flag & SEQ_MUTE)
-               drawmeta_stipple(0);
+               drawmeta_stipple(false);
        
        glDisable(GL_BLEND);
+
+       GPU_raster_end();
 }
 
 /* clamp handles to defined size in pixel space */
@@ -649,17 +653,16 @@
 {
        float ymid1, ymid2;
 
+       GPU_raster_begin();
+
        if (seq->flag & SEQ_MUTE) {
-               gpuEnablePolygonStipple();
+               GPU_aspect_enable(GPU_ASPECT_RASTER, 
GPU_RASTER_POLYGON|GPU_RASTER_STIPPLE);
                gpuPolygonStipple(stipple_halftone);
        }
 
        ymid1 = (y2 - y1) * 0.25f + y1;
        ymid2 = (y2 - y1) * 0.65f + y1;
 
-       // SSS Enable Smooth
-       GPU_aspect_enable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
-
        gpuBegin(GL_QUADS);
 
        if (seq->flag & SEQ_INVALID_EFFECT) { col[0] = 255; col[1] = 0; col[2] 
= 255; }
@@ -699,12 +702,11 @@
 
        gpuEnd();
 
-       // SSS Disable Smooth
-       GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_SMOOTH);
-
        if (seq->flag & SEQ_MUTE) {
-               gpuDisablePolygonStipple();

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to