Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-04-13 11:00:19 +0300
committerMike Erwin <significant.bit@gmail.com>2017-04-13 11:00:19 +0300
commit1c426d5b6cf70dc4bf84b3bdc494b4543d68c715 (patch)
treeec57aaf0cc299b9d60d0ddda920e2fc87e5fd080 /source/blender/gpu/GPU_matrix.h
parentfae01c3a54f1122341404e88e41ef9bf275af1d6 (diff)
OpenGL: implement 2D with 4x4 matrices
... even though 3x3 feels better. This is a compromise to get core profile up & running sooner. Eventually I'd like to finish the original 3x3 plans, but this commit will let us get on with other tasks. External API stays (almost) the same. Our GLSL shaders can use this without any changes. Part of T49450 and T51164
Diffstat (limited to 'source/blender/gpu/GPU_matrix.h')
-rw-r--r--source/blender/gpu/GPU_matrix.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h
index 07e4ff80f57..8643dee3408 100644
--- a/source/blender/gpu/GPU_matrix.h
+++ b/source/blender/gpu/GPU_matrix.h
@@ -45,6 +45,12 @@ extern "C" {
* we convert all code to use the API in this file. */
#define SUPPORT_LEGACY_MATRIX 1
+/* implement 2D parts with 4x4 matrices, even though 3x3 feels better
+ * this is a compromise to get core profile up & running sooner
+ * external API stays (almost) the same
+ */
+#define MATRIX_2D_4x4 1
+
void gpuMatrixInit(void); /* called by system -- make private? */
@@ -95,8 +101,12 @@ void gpuLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY,
/* 2D ModelView Matrix */
+#if MATRIX_2D_4x4
+void gpuMultMatrix2D(const float m[4][4]);
+#else
void gpuLoadMatrix2D(const float m[3][3]);
void gpuMultMatrix2D(const float m[3][3]);
+#endif
void gpuTranslate2f(float x, float y);
void gpuTranslate2fv(const float vec[2]);
@@ -173,8 +183,12 @@ bool gpuMatricesDirty(void); /* since last bind */
# define gpuLoadProjectionMatrix3D(x) gpuLoadProjectionMatrix3D((const float (*)[4])(x))
+# if MATRIX_2D_4x4
+# define gpuMultMatrix2D(x) gpuMultMatrix2D((const float (*)[4])(x))
+# else
# define gpuMultMatrix2D(x) gpuMultMatrix2D((const float (*)[3])(x))
# define gpuLoadMatrix2D(x) gpuLoadMatrix2D((const float (*)[3])(x))
+# endif
# define gpuGetModelViewMatrix3D(x) gpuGetModelViewMatrix3D((float (*)[4])(x))
# define gpuGetProjectionMatrix3D(x) gpuGetProjectionMatrix3D((float (*)[4])(x))