[Bf-blender-cvs] [2d82d98] temp_viewport_fx_merge: Matrix module: substitution WIP.

Antony Riakiotakis noreply at git.blender.org
Wed Apr 1 20:54:55 CEST 2015


Commit: 2d82d9866935e1d6cd6e0f6c9b5f93fedec8d41c
Author: Antony Riakiotakis
Date:   Wed Apr 1 20:27:37 2015 +0200
Branches: temp_viewport_fx_merge
https://developer.blender.org/rB2d82d9866935e1d6cd6e0f6c9b5f93fedec8d41c

Matrix module: substitution WIP.

Warning - don't open blender up or it will hang your computer

===================================================================

M	source/blender/blenfont/intern/blf.c
M	source/blender/editors/animation/anim_draw.c
M	source/blender/editors/animation/anim_markers.c
M	source/blender/editors/animation/keyframes_draw.c
M	source/blender/editors/armature/editarmature_sketch.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/interface/view2d.c
M	source/blender/editors/mask/mask_draw.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/mesh/editmesh_loopcut.c
M	source/blender/editors/physics/particle_edit.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/screen/screendump.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/sculpt_uv.c
M	source/blender/editors/space_clip/clip_dopesheet_draw.c
M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_clip/clip_graph_draw.c
M	source/blender/editors/space_clip/clip_utils.c
M	source/blender/editors/space_clip/space_clip.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/editors/space_time/space_time.c
M	source/blender/editors/space_view3d/drawanimviz.c
M	source/blender/editors/space_view3d/drawarmature.c
M	source/blender/editors/space_view3d/drawmesh.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/drawsimdebug.c
M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_select.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_constraints.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/transform/transform_manipulator.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/editors/uvedit/uvedit_draw.c
M	source/blender/gpu/intern/gpu_draw.c
M	source/blender/gpu/intern/gpu_extensions.c
M	source/blender/windowmanager/intern/wm_gesture.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/intern/wm_playanim.c
M	source/blender/windowmanager/intern/wm_subwindow.c
M	source/gameengine/Ketsji/BL_Texture.cpp
M	source/gameengine/Ketsji/KX_BlenderMaterial.cpp
M	source/gameengine/Ketsji/KX_Dome.cpp
M	source/gameengine/Rasterizer/CMakeLists.txt
M	source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
M	source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

===================================================================

diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 127826f..eec3981 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -56,6 +56,8 @@
 #include "blf_internal_types.h"
 #include "blf_internal.h"
 
+#include "GPU_matrix.h"
+
 /* Max number of font in memory.
  * Take care that now every font have a glyph cache per size/dpi,
  * so we don't need load the same font with different size, just
@@ -505,23 +507,23 @@ static void blf_draw__start(FontBLF *font, GLint *mode, GLint *param)
 	/* Save the current matrix mode. */
 	glGetIntegerv(GL_MATRIX_MODE, mode);
 
-	glMatrixMode(GL_TEXTURE);
-	glPushMatrix();
-	glLoadIdentity();
+	gpuMatrixMode(GL_TEXTURE);
+	gpuPushMatrix();
+	gpuLoadIdentity();
 
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
+	gpuMatrixMode(GL_MODELVIEW);
+	gpuPushMatrix();
 
 	if (font->flags & BLF_MATRIX)
-		glMultMatrixd((GLdouble *)&font->m);
+		gpuMultMatrixd((GLdouble *)&font->m);
 
-	glTranslatef(font->pos[0], font->pos[1], font->pos[2]);
+	gpuTranslate(font->pos[0], font->pos[1], font->pos[2]);
 
 	if (font->flags & BLF_ASPECT)
-		glScalef(font->aspect[0], font->aspect[1], font->aspect[2]);
+		gpuScale(font->aspect[0], font->aspect[1], font->aspect[2]);
 
 	if (font->flags & BLF_ROTATION)  /* radians -> degrees */
-		glRotatef(font->angle * (float)(180.0 / M_PI), 0.0f, 0.0f, 1.0f);
+		gpuRotateAxis(font->angle * (float)(180.0 / M_PI), 'Z');
 
 	if (font->shadow || font->blur)
 		glGetFloatv(GL_CURRENT_COLOR, font->orig_col);
@@ -541,14 +543,14 @@ static void blf_draw__end(GLint mode, GLint param)
 	if (param != GL_MODULATE)
 		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param);
 
-	glMatrixMode(GL_TEXTURE);
-	glPopMatrix();
+	gpuMatrixMode(GL_TEXTURE);
+	gpuPopMatrix();
 
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
+	gpuMatrixMode(GL_MODELVIEW);
+	gpuPopMatrix();
 
 	if (mode != GL_MODELVIEW)
-		glMatrixMode(mode);
+		gpuMatrixMode(mode);
 
 	glDisable(GL_BLEND);
 	glDisable(GL_TEXTURE_2D);
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index c0ac42f..7fcf74f 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -53,6 +53,8 @@
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
+#include "GPU_matrix.h"
+
 /* *************************************************** */
 /* CURRENT FRAME DRAWING */
 
@@ -66,7 +68,7 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const
 	
 	/* because the frame number text is subject to the same scaling as the contents of the view */
 	UI_view2d_scale_get(v2d, &xscale, &yscale);
-	glScalef(1.0f / xscale, 1.0f, 1.0f);
+	gpuScale(1.0f / xscale, 1.0f, 1.0f);
 	
 	/* get timecode string 
 	 *	- padding on str-buf passed so that it doesn't sit on the frame indicator
@@ -95,7 +97,7 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const
 	UI_fontstyle_draw_simple(fstyle, x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr);
 	
 	/* restore view transform */
-	glScalef(xscale, 1.0, 1.0);
+	gpuScale(xscale, 1.0, 1.0);
 }
 
 /* General call for drawing current frame indicator in animation editor */
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 140b7e0..163617b 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -71,6 +71,8 @@
 #include "ED_transform.h"
 #include "ED_types.h"
 
+#include "GPU_matrix.h"
+
 /* ************* Marker API **************** */
 
 /* helper function for getting the list of markers to work on */
@@ -440,7 +442,7 @@ void ED_markers_draw(const bContext *C, int flag)
 	/* no time correction for framelen! space is drawn with old values */
 	ypixels = BLI_rcti_size_y(&v2d->mask);
 	UI_view2d_scale_get(v2d, &xscale, &yscale);
-	glScalef(1.0f / xscale, 1.0f, 1.0f);
+	gpuScale(1.0f / xscale, 1.0f, 1.0f);
 
 	/* x-bounds with offset for text (adjust for long string, avoid checking string width) */
 	font_width_max = (10 * UI_DPI_FAC) / xscale;
@@ -463,7 +465,7 @@ void ED_markers_draw(const bContext *C, int flag)
 		}
 	}
 
-	glScalef(xscale, 1.0f, 1.0f);
+	gpuScale(xscale, 1.0f, 1.0f);
 }
 
 /* ************************ Marker Wrappers API ********************* */
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 9e38dd5..56d5e37 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -58,6 +58,8 @@
 #include "ED_anim_api.h"
 #include "ED_keyframes_draw.h"
 
+#include "GPU_matrix.h"
+
 /* *************************** Keyframe Processing *************************** */
 
 /* ActKeyColumns (Keyframe Columns) ------------------------------------------ */
@@ -488,8 +490,8 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
 	hsize -= 0.5f * key_type;
 	
 	/* adjust view transform before starting */
-	glTranslatef(x, y, 0.0f);
-	glScalef(1.0f / xscale * hsize, hsize, 1.0f);
+	gpuTranslate(x, y, 0.0f);
+	gpuScale(1.0f / xscale * hsize, hsize, 1.0f);
 	
 	/* anti-aliased lines for more consistent appearance */
 	glEnable(GL_LINE_SMOOTH);
@@ -553,8 +555,8 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
 	glDisable(GL_LINE_SMOOTH);
 	
 	/* restore view transform */
-	glScalef(xscale / hsize, 1.0f / hsize, 1.0f);
-	glTranslatef(-x, -y, 0.0f);
+	gpuScale(xscale / hsize, 1.0f / hsize, 1.0f);
+	gpuTranslate(-x, -y, 0.0f);
 }
 
 static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, float ypos, short channelLocked)
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 4c0445f..600b409 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -53,6 +53,7 @@
 
 #include "GPU_select.h"
 #include "GPU_primitives.h"
+#include "GPU_matrix.h"
 
 typedef int (*GestureDetectFct)(bContext *, SK_Gesture *, SK_Sketch *);
 typedef void (*GestureApplyFct)(bContext *, SK_Gesture *, SK_Sketch *);
@@ -437,7 +438,7 @@ static float sk_clampPointSize(SK_Point *pt, float size)
 
 static void sk_drawPoint(struct GPUprim3 *prim, SK_Point *pt, float size)
 {
-	glTranslatef(pt->p[0], pt->p[1], pt->p[2]);
+	gpuTranslate(pt->p[0], pt->p[1], pt->p[2]);
 	gpuDrawSphere(prim, sk_clampPointSize(pt, size));
 	//GLU gluSphere(quad, sk_clampPointSize(pt, size), 8, 8);
 }
@@ -457,7 +458,7 @@ static void sk_drawEdge(struct GPUprim3 *prim, SK_Point *pt0, SK_Point *pt1, flo
 
 	angle = angle_normalized_v3v3(vec2, vec1);
 
-	glRotatef(angle * (float)(180.0 / M_PI) + 180.0f, axis[0], axis[1], axis[2]);
+	gpuRotateVector(angle * (float)(180.0 / M_PI) + 180.0f, axis);
 
 	gpuDrawCylinder(prim, sk_clampPointSize(pt1, size), sk_clampPointSize(pt0, size), length);
 	//GLU Cylinder(quad, sk_clampPointSize(pt1, size), sk_clampPointSize(pt0, size), length, 8, 8);
@@ -468,7 +469,7 @@ static void sk_drawNormal(struct GPUprim3 *prim, SK_Point *pt, float size, float
 	float vec2[3] = {0, 0, 1}, axis[3];
 	float angle;
 	
-	glPushMatrix();
+	gpuPushMatrix();
 
 	cross_v3_v3v3(axis, vec2, pt->no);
 
@@ -478,14 +479,14 @@ static void sk_drawNormal(struct GPUprim3 *prim, SK_Point *pt, float size, float
 
 	angle = angle_normalized_v3v3(vec2, pt->no);
 
-	glRotatef(angle * (float)(180.0 / M_PI), axis[0], axis[1], axis[2]);
+	gpuRotateVector(angle * (float)(180.0 / M_PI), axis);
 
 	glColor3f(0, 1, 1);
 
 	gpuDrawCylinder(prim, sk_clampPointSize(pt, size), 0, sk_clampPointSize(pt, height));
 	//GLU Cylinder(quad, sk_clampPointSize(pt, size), 0, sk_clampPointSize(pt, height), 10, 2);
 
-	glPopMatrix();
+	gpuPopMatrix();
 }
 
 static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int end)
@@ -498,7 +499,7 @@ static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int
 		GPU_select_load_id(id);
 
 		for (i = 0; i < stk->nb_points; i++) {
-			glPushMatrix();
+			gpuPushMatrix();
 
 			sk_drawPoint(&prim, stk->points + i, 0.1);
 
@@ -506,7 +507,7 @@ static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int
 				sk_drawEdge(&prim, stk->points + i - 1, stk->points + i, 0.1);
 			}
 
-			glPopMatrix();
+			gpuPopMatrix();
 		}
 
 	}
@@ -520,7 +521,7 @@ static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int
 		for (i = 0; i < stk->nb_points; i++) {
 			SK_Point *pt = stk->points + i;
 
-			glPushMatrix();
+			gpuPushMatrix();
 
 			if (pt->type == PT_EXACT) {
 				glColor3f(0, 0, 0);
@@ -544,7 +545,7 @@ static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int
 				sk_drawEdge(&prim, pt - 1, pt, 0.1);
 			}
 
-			glPopMatrix();
+			gpuPopMatrix();
 
 			add_v3_v3(rgb, d_rgb);
 		}
@@ -568,14 +569,14 @@ static void drawSubdividedStrokeBy(ToolSettings *toolsettings, BArcIterator *ite
 	while (index != -1) {
 		SK_Point *pt = stk->points + index;
 
-		glPushMatrix();
+		gpuPushMatrix();
 
 		glColor3f(0, 1, 0);
 		sk_drawPoint(&prim, pt, 0.15);
 
 		sk_drawNormal(&prim, pt, 0.05, 0.9);
 
-		glPopMatrix();
+		gpuPopMatrix();
 
 		copy_v3_v3(head, tail);
 		bone_start = index; // start next bone from current index
@@ -2059,7 +2060,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
 			if (last != NULL) {
 				struct GPUprim3 prim = GPU_PRIM_LOFI_SOLID;
 
-				glPushMatrix();
+				gpuPushMatrix();
 
 				glEnable(GL_BLEND);
 				glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -2081,7 +2082,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
 
 				glDisable(GL_BLEND);
 
-				glPopMatrix();
+				gpuPopMatrix();
 			}
 		}
 	}
@@ -2107,10 +2108,10 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
 			index = (index >> 5) & 7;
 
 			glColor3fv(colors[index]);
-			glPushMatrix();
-			glTranslatef(p->p[0], p->p[1], p->p[2]);
+			gpuPushMatrix();
+			gpuTranslate(p->p[0], p->p[1], p->p[2]);
 			gpuDra

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list