[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60338] branches/soc-2013-viewport_fx/ source/blender: Fixups for GPU_sprite.
Jason Wilkins
Jason.A.Wilkins at gmail.com
Mon Sep 23 18:11:27 CEST 2013
Revision: 60338
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60338
Author: jwilkins
Date: 2013-09-23 16:11:26 +0000 (Mon, 23 Sep 2013)
Log Message:
-----------
Fixups for GPU_sprite. Needed to make a distinction between "points" and "sprites"
Sprites are only drawn by the GPU_ASPECT_SPRITE, while points can be drawn by any aspect. Sprites can be round and, in the future they may be textured, while points have to be square and flat.
Modified Paths:
--------------
branches/soc-2013-viewport_fx/source/blender/editors/armature/reeb.c
branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c
branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/mask/mask_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/mesh/editmesh_knife.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_view3d/drawanimviz.c
branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawobject.c
branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawvolume.c
branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_draw.c
branches/soc-2013-viewport_fx/source/blender/editors/transform/transform.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/GPU_sprite.h
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_sprite.c
Modified: branches/soc-2013-viewport_fx/source/blender/editors/armature/reeb.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/armature/reeb.c 2013-09-23 15:47:53 UTC (rev 60337)
+++ branches/soc-2013-viewport_fx/source/blender/editors/armature/reeb.c 2013-09-23 16:11:26 UTC (rev 60338)
@@ -3343,7 +3343,7 @@
for (rg = GLOBAL_RG; rg->multi_level != i && rg->link_up; rg = rg->link_up) ;
}
- GPU_sprite_size(BIF_GetThemeValuef(TH_VERTEX_SIZE));
+ GPU_point_size(BIF_GetThemeValuef(TH_VERTEX_SIZE));
glDisable(GL_DEPTH_TEST);
@@ -3463,7 +3463,7 @@
glEnable(GL_DEPTH_TEST);
gpuLineWidth(1.0);
- GPU_sprite_size(1.0);
+ GPU_point_size(1);
}
#endif
Modified: branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c 2013-09-23 15:47:53 UTC (rev 60337)
+++ branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c 2013-09-23 16:11:26 UTC (rev 60338)
@@ -584,7 +584,7 @@
copy_v4_v4(color, gpl->color); // just for copying 4 array elements
copy_v4_v4(tcolor, gpl->color); // additional copy of color (for ghosting)
gpuColor4fv(color);
- GPU_sprite_size((float)(gpl->thickness + 2));
+ GPU_point_size((float)(gpl->thickness + 2));
/* apply xray layer setting */
if (gpl->flag & GP_LAYER_NO_XRAY) dflag |= GP_DRAWDATA_NO_XRAY;
@@ -668,7 +668,7 @@
/* restore initial gl conditions */
gpuLineWidth(1.0);
- GPU_sprite_size(1.0);
+ GPU_point_size(1);
gpuImmediateUnformat();
}
Modified: branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c 2013-09-23 15:47:53 UTC (rev 60337)
+++ branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c 2013-09-23 16:11:26 UTC (rev 60338)
@@ -1479,8 +1479,10 @@
/* the points, use aspect to make them visible on edges */
cmp = cuma->curve;
- GPU_sprite_size(3.0f);
+
+ GPU_sprite_size(3);
GPU_sprite_begin();
+
for (a = 0; a < cuma->totpoint; a++) {
if (cmp[a].flag & CUMA_SELECT)
UI_ThemeColor(TH_TEXT_HI);
@@ -1490,9 +1492,10 @@
fac[1] = rect->ymin + zoomy * (cmp[a].y - offsy);
GPU_sprite_2fv(fac);
}
+
GPU_sprite_end();
- GPU_sprite_size(1.0f);
-
+ GPU_sprite_size(1);
+
/* restore scissortest */
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
Modified: branches/soc-2013-viewport_fx/source/blender/editors/mask/mask_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/mask/mask_draw.c 2013-09-23 15:47:53 UTC (rev 60337)
+++ branches/soc-2013-viewport_fx/source/blender/editors/mask/mask_draw.c 2013-09-23 16:11:26 UTC (rev 60338)
@@ -158,7 +158,7 @@
/* TODO, add this to sequence editor */
hsize = 4; /* UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE); */
- GPU_sprite_size(hsize);
+ GPU_point_size(hsize);
mask_spline_color_get(masklay, spline, is_spline_sel, rgb_spline);
@@ -286,7 +286,7 @@
gpuEnd();
}
- GPU_sprite_size(1.0f);
+ GPU_point_size(1);
gpuImmediateUnformat();
}
Modified: branches/soc-2013-viewport_fx/source/blender/editors/mesh/editmesh_knife.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/mesh/editmesh_knife.c 2013-09-23 15:47:53 UTC (rev 60337)
+++ branches/soc-2013-viewport_fx/source/blender/editors/mesh/editmesh_knife.c 2013-09-23 16:11:26 UTC (rev 60338)
@@ -1060,7 +1060,7 @@
}
else if (kcd->curr.vert) {
gpuColor3ubv(kcd->colors.point);
- GPU_sprite_size(11);
+ GPU_point_size(11);
gpuBegin(GL_POINTS);
gpuVertex3fv(kcd->curr.cage);
@@ -1069,7 +1069,7 @@
if (kcd->curr.bmface) {
gpuColor3ubv(kcd->colors.curpoint);
- GPU_sprite_size(9);
+ GPU_point_size(9);
gpuBegin(GL_POINTS);
gpuVertex3fv(kcd->curr.cage);
@@ -1087,7 +1087,7 @@
/* draw any snapped verts first */
gpuColor4ubv(kcd->colors.point_a);
- GPU_sprite_size(11);
+ GPU_point_size(11);
gpuBegin(GL_POINTS);
lh = kcd->linehits;
for (i = 0; i < kcd->totlinehit; i++, lh++) {
@@ -1112,7 +1112,7 @@
/* now draw the rest */
gpuColor4ubv(kcd->colors.curpoint_a);
- GPU_sprite_size(7);
+ GPU_point_size(7);
gpuBegin(GL_POINTS);
lh = kcd->linehits;
for (i = 0; i < kcd->totlinehit; i++, lh++) {
@@ -1126,7 +1126,7 @@
BLI_mempool_iter iter;
KnifeEdge *kfe;
- gpuLineWidth(1.0);
+ gpuLineWidth(1.0f);
gpuBegin(GL_LINES);
BLI_mempool_iternew(kcd->kedges, &iter);
@@ -1148,7 +1148,7 @@
BLI_mempool_iter iter;
KnifeVert *kfv;
- GPU_sprite_size(5.0);
+ GPU_point_size(5);
gpuBegin(GL_POINTS);
BLI_mempool_iternew(kcd->kverts, &iter);
@@ -1168,6 +1168,8 @@
gpuImmediateUnformat();
+ GPU_point_size(1);
+
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_clip/clip_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_clip/clip_draw.c 2013-09-23 15:47:53 UTC (rev 60337)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_clip/clip_draw.c 2013-09-23 16:11:26 UTC (rev 60338)
@@ -408,7 +408,7 @@
UI_ThemeColor(TH_MARKER_OUTLINE);
if (TRACK_VIEW_SELECTED(sc, track)) {
- GPU_sprite_size(5.0f);
+ GPU_point_size(5);
gpuBegin(GL_POINTS);
for (i = a; i < b; i++) {
if (i != curindex) {
@@ -430,7 +430,7 @@
UI_ThemeColor(TH_PATH_BEFORE);
if (TRACK_VIEW_SELECTED(sc, track)) {
- GPU_sprite_size(3.0f);
+ GPU_point_size(3);
gpuBegin(GL_POINTS);
for (i = a; i < b; i++) {
if (i == count + 1) {
@@ -455,7 +455,8 @@
gpuVertex2f(path[i][0], path[i][1]);
}
gpuEnd();
- GPU_sprite_size(1.0f);
+
+ GPU_point_size(1);
}
static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
@@ -483,18 +484,13 @@
if (isect_point_quad_v2(p, marker->pattern_corners[0], marker->pattern_corners[1],
marker->pattern_corners[2], marker->pattern_corners[3]))
{
- if (tiny) {
- GPU_sprite_size(3.0f);
- }
- else {
- GPU_sprite_size(4.0f);
- }
+ GPU_point_size(tiny ? 3.0f : 4.0f);
gpuBegin(GL_POINTS);
gpuVertex2f(pos[0], pos[1]);
gpuEnd();
- GPU_sprite_size(1.0f);
+ GPU_point_size(1.0f);
}
else {
if (!tiny) {
@@ -615,14 +611,14 @@
marker->pattern_corners[2], marker->pattern_corners[3]))
{
if (!tiny)
- GPU_sprite_size(2.0f);
+ GPU_point_size(2);
gpuBegin(GL_POINTS);
gpuVertex2f(pos[0], pos[1]);
gpuEnd();
if (!tiny)
- GPU_sprite_size(1.0f);
+ GPU_point_size(1);
}
else {
gpuBegin(GL_LINES);
@@ -1157,8 +1153,9 @@
MovieTrackingObject *object = BKE_tracking_object_get_active(tracking);
float pos[4], vec[4], mat[4][4], aspy;
- glEnable(GL_POINT_SMOOTH);
- GPU_sprite_size(3.0f);
+ GPU_sprite_size(3);
+ GPU_aspect_enable(GPU_ASPECT_SPRITE, GPU_SPRITE_CIRCULAR);
+ GPU_sprite_begin();
aspy = 1.0f / clip->tracking.camera.pixel_aspect;
BKE_tracking_get_projection_matrix(tracking, object, framenr, width, height, mat);
@@ -1191,14 +1188,10 @@
else
gpuColor3P(CPACK_RED);
- gpuBegin(GL_POINTS);
-
if (undistort)
gpuVertex3f(pos[0] / width, pos[1] / (height * aspy), 0);
else
gpuVertex3f(npos[0] / width, npos[1] / (height * aspy), 0);
-
- gpuEnd();
}
}
}
@@ -1206,8 +1199,9 @@
track = track->next;
}
- GPU_sprite_size(1.0f);
- glDisable(GL_POINT_SMOOTH);
+ GPU_sprite_end();
+ GPU_aspect_disable(GPU_ASPECT_SPRITE, GPU_SPRITE_CIRCULAR);
+ GPU_sprite_size(1);
}
gpuPopMatrix();
@@ -1392,7 +1386,7 @@
gpuColor4fv(layer->color);
gpuLineWidth(layer->thickness);
- GPU_sprite_size((float)(layer->thickness + 2));
+ GPU_point_size((float)(layer->thickness + 2));
while (frame) {
bGPDstroke *stroke = frame->strokes.first;
@@ -1449,7 +1443,8 @@
}
gpuLineWidth(1.0f);
- GPU_sprite_size(1.0f);
+
+ GPU_point_size(1);
}
gpuPopMatrix();
Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_graph/graph_draw.c 2013-09-23 15:47:53 UTC (rev 60337)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_graph/graph_draw.c 2013-09-23 16:11:26 UTC (rev 60338)
@@ -113,16 +113,15 @@
GPU_raster_end();
- /* set size of vertices (non-adjustable for now) */
- GPU_sprite_size(2.0f);
-
/* for now, point color is fixed, and is white */
gpuColor3P(CPACK_WHITE);
- /* we use bgl points not standard gl points, to workaround vertex
+ /* we use sprites and not standard gl points, to workaround vertex
* drawing bugs that some drivers have (probably legacy ones only though)
*/
+ GPU_sprite_size(2); /* set size of vertices (non-adjustable for now) */
GPU_sprite_begin();
+
for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
/* only draw if visible
* - min/max here are fixed, not relative
@@ -132,9 +131,9 @@
GPU_sprite_2f(fed->time, fed->max);
}
}
+
GPU_sprite_end();
-
- GPU_sprite_size(1.0f);
+ GPU_sprite_size(1);
}
/* *************************** */
@@ -281,9 +280,8 @@
* and also to make sure in the case of overlapping points that the selected is always visible
* - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users)
*/
-
- GPU_sprite_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
-
+
+
/* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
if (do_handles) {
set_fcurve_vertex_color(fcu, 0);
@@ -292,15 +290,17 @@
set_fcurve_vertex_color(fcu, 1);
draw_fcurve_vertices_handles(fcu, sipo, v2d, 1, sel_handle_only);
}
-
+
+ GPU_sprite_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
+
/* draw keyframes over the handles */
set_fcurve_vertex_color(fcu, 0);
draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
set_fcurve_vertex_color(fcu, 1);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list