diff options
author | Ton Roosendaal <ton@blender.org> | 2004-09-25 17:42:31 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-09-25 17:42:31 +0400 |
commit | 6f074f6f461066777f5d7546882c44d8ba0288db (patch) | |
tree | 895be0ba83b83da3e1a8aee7c228dcb29ba121b2 /source/blender/src/glutil.c | |
parent | cfe9a9575526458412d50cc6122fdde1d66dd4d2 (diff) |
Two nice workflow improvements;
- Zbuffer clipped selection
Based on same algos as for drawing (blender polygon offset) vertices, edges
and faces now are clipped for draw and selection when Zbuffer is used.
Note that it works for endpoint vertices of edges, and for facecenters.
Also works for border and circle-select
- Optimal draw subsurfs
This now draws optimal with faces and edges selected/unselected, hiding the
original 'cage' (mesh) completely.
TODO: edge select, which still uses original (invisible) edge.
http://www.blender3d.org/cms/Mesh_editing_rewrite.425.0.html
Diffstat (limited to 'source/blender/src/glutil.c')
-rw-r--r-- | source/blender/src/glutil.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/src/glutil.c b/source/blender/src/glutil.c index 568c660208c..2bf802f0fcc 100644 --- a/source/blender/src/glutil.c +++ b/source/blender/src/glutil.c @@ -477,4 +477,42 @@ void bglEnd(void) } +/* *************** glPolygonOffset hack ************* */ + +/* dist is only for ortho now... */ +void bglPolygonOffset(float dist) +{ + static float winmat[16], offset=0.0; + + if(dist!=0.0) { + float offs; + + // glEnable(GL_POLYGON_OFFSET_FILL); + // glPolygonOffset(-1.0, -1.0); + + /* hack below is to mimic polygon offset */ + glMatrixMode(GL_PROJECTION); + glGetFloatv(GL_PROJECTION_MATRIX, (float *)winmat); + + if(winmat[15]>0.5) offs= 0.00005*dist; // ortho tweaking + else offs= 0.001; // should be clipping value or so... + + winmat[14]-= offs; + offset+= offs; + + glLoadMatrixf(winmat); + glMatrixMode(GL_MODELVIEW); + } + else { + + glMatrixMode(GL_PROJECTION); + winmat[14]+= offset; + offset= 0.0; + glLoadMatrixf(winmat); + glMatrixMode(GL_MODELVIEW); + } +} + + + |