[Libreoffice-commits] core.git: Branch 'feature/opengl-canvas-rework' - 2 commits - basegfx/Library_basegfx.mk basegfx/source include/basegfx
Michael Jaumann
meta_dev at yahoo.com
Tue Nov 4 00:21:21 PST 2014
basegfx/Library_basegfx.mk | 3 -
basegfx/source/tools/canvastools.cxx | 69 ++++++++++++++++++++++++++++++++++
include/basegfx/tools/canvastools.hxx | 12 +++++
3 files changed, 82 insertions(+), 2 deletions(-)
New commits:
commit 6a45c27ba42e8e51a427a90a3fc745f149b948d8
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Tue Nov 4 08:18:40 2014 +0000
wrappers for bdhommatrix/affinematrix ->glm::mat4
Change-Id: I0ff0b5ed82bbe9dc0ed264b71f6cea5a72809aff
diff --git a/basegfx/source/tools/canvastools.cxx b/basegfx/source/tools/canvastools.cxx
index f59f447..c578e16 100644
--- a/basegfx/source/tools/canvastools.cxx
+++ b/basegfx/source/tools/canvastools.cxx
@@ -334,6 +334,41 @@ namespace basegfx
return output;
}
+ glm::mat4 glmMatrixFromAffineMatrix( const ::com::sun::star::geometry::AffineMatrix2D& input )
+ {
+ // ensure last row is [0,0,1] (and optimized away)
+ glm::mat4 output;
+ output[0][0] = input.m00;
+ output[1][0] = input.m01;
+ output[2][0] = input.m02;
+ output[0][1] = input.m10;
+ output[1][1] = input.m11;
+ output[2][1] = input.m12;
+
+ return output;
+ }
+
+ glm::mat4 glmMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& input )
+ {
+ glm::mat4 output;
+ output[0][0] = input.m00;
+ output[1][0] = input.m01;
+ output[2][0] = input.m02;
+ output[3][0] = input.m03;
+
+ output[0][1] = input.m10;
+ output[1][1] = input.m11;
+ output[2][1] = input.m12;
+ output[3][1] = input.m13;
+
+ output[0][2] = input.m20;
+ output[1][2] = input.m21;
+ output[2][2] = input.m22;
+ output[3][2] = input.m23;
+
+ return output;
+ }
+
::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& input )
{
::basegfx::B3DHomMatrix output;
@@ -369,6 +404,40 @@ namespace basegfx
return output;
}
+ glm::mat4 glmMatFromHomMatrix( const ::basegfx::B2DHomMatrix& input)
+ {
+ glm::mat4 output;
+ output[0][0] = input.get(0,0);
+ output[1][0] = input.get(0,1);
+ output[2][0] = input.get(0,2);
+ output[0][1] = input.get(1,0);
+ output[1][1] = input.get(1,1);
+ output[2][1] = input.get(1,2);
+
+ return output;
+ }
+
+ glm::mat4 glmMatFromHomMatrix3d( const ::basegfx::B3DHomMatrix& input)
+ {
+ glm::mat4 output;
+ output[0][0] = input.get(0,0);
+ output[1][0] = input.get(0,1);
+ output[2][0] = input.get(0,2);
+ output[3][0] = input.get(0,3);
+
+ output[0][1] = input.get(1,0);
+ output[1][1] = input.get(1,1);
+ output[2][1] = input.get(1,2);
+ output[3][1] = input.get(1,3);
+
+ output[0][2] = input.get(2,0);
+ output[1][2] = input.get(2,1);
+ output[2][2] = input.get(2,2);
+ output[3][2] = input.get(2,3);
+
+ return output;
+ }
+
geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D(
geometry::AffineMatrix3D& output,
const ::basegfx::B3DHomMatrix& input)
diff --git a/include/basegfx/tools/canvastools.hxx b/include/basegfx/tools/canvastools.hxx
index c678805..2a3030a 100644
--- a/include/basegfx/tools/canvastools.hxx
+++ b/include/basegfx/tools/canvastools.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <basegfx/basegfxdllapi.h>
+#include <glm/glm.hpp>
namespace com { namespace sun { namespace star { namespace geometry
@@ -128,12 +129,21 @@ namespace basegfx
BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix&
homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& transform,
const ::com::sun::star::geometry::AffineMatrix2D& matrix );
+ BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix
+ homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix );
- BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix );
+
+
+ BASEGFX_DLLPUBLIC glm::mat4 glmMatrixFromAffineMatrix( const ::com::sun::star::geometry::AffineMatrix2D& matrix );
+
+ BASEGFX_DLLPUBLIC glm::mat4 glmMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix );
BASEGFX_DLLPUBLIC ::com::sun::star::geometry::Matrix2D&
matrixFromHomMatrix( ::com::sun::star::geometry::Matrix2D& matrix,
const ::basegfx::B2DHomMatrix& transform);
+ BASEGFX_DLLPUBLIC glm::mat4 glmMatFromHomMatrix( const ::basegfx::B2DHomMatrix& input);
+
+ BASEGFX_DLLPUBLIC glm::mat4 glmMatFromHomMatrix3d( const ::basegfx::B3DHomMatrix& input);
// Geometry conversions
commit 7743dd1c32452e9baa2293f7d6c69bc8b7bcc253
Author: Michael Jaumann <meta_dev at yahoo.com>
Date: Tue Nov 4 08:14:06 2014 +0000
add glmmatrixtools to makefile
Change-Id: I4d4edd81c4115963557afc35029f10818218688e
diff --git a/basegfx/Library_basegfx.mk b/basegfx/Library_basegfx.mk
index ac5878a..95ba931 100644
--- a/basegfx/Library_basegfx.mk
+++ b/basegfx/Library_basegfx.mk
@@ -39,7 +39,8 @@ $(eval $(call gb_Library_add_exception_objects,basegfx,\
basegfx/source/matrix/b2dhommatrix \
basegfx/source/matrix/b2dhommatrixtools \
basegfx/source/matrix/b3dhommatrix \
- basegfx/source/numeric/ftools \
+ basegfx/source/glm_matrix/b2dglmmatrixtools \
+ basegfx/source/numeric/ftools \
basegfx/source/pixel/bpixel \
basegfx/source/point/b2dpoint \
basegfx/source/point/b2ipoint \
More information about the Libreoffice-commits
mailing list