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:
authorNicholas Bishop <nicholasbishop@gmail.com>2010-10-18 06:43:53 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2010-10-18 06:43:53 +0400
commit08232350d5797302e3638e69ec78657d853976aa (patch)
treead5ff38236343cdcb5eee6d8c6711cb1b32a1912 /source/blender/blenlib/intern/math_geom.c
parent5b31d545dfae5ee3fd5f4a5d0e9497a1c7c2a86b (diff)
parenta6d62bf0db09ae2759fd45abb3af563fefc13690 (diff)
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r32200:32300
Diffstat (limited to 'source/blender/blenlib/intern/math_geom.c')
-rw-r--r--source/blender/blenlib/intern/math_geom.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 68b1feea632..2aec707b4ea 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -1647,6 +1647,25 @@ void perspective_m4(float mat[][4],float left, float right, float bottom, float
}
+/* translate a matrix created by orthographic_m4 or perspective_m4 in XY coords (used to jitter the view) */
+void window_translate_m4(float winmat[][4], float perspmat[][4], float x, float y)
+{
+ if(winmat[2][3] == -1.0f) {
+ /* in the case of a win-matrix, this means perspective always */
+ float v1[3]= {perspmat[0][0], perspmat[1][0], perspmat[2][0]};
+ float v2[3]= {perspmat[0][1], perspmat[1][1], perspmat[2][1]};
+ float len1= (1.0f / len_v3(v1));
+ float len2= (1.0f / len_v3(v2));
+
+ winmat[2][0] += len1 * winmat[0][0] * x;
+ winmat[2][1] += len2 * winmat[1][1] * y;
+ }
+ else {
+ winmat[3][0] += x;
+ winmat[3][1] += y;
+ }
+}
+
static void i_multmatrix(float icand[][4], float Vm[][4])
{
int row, col;