summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Jaumann <meta_dev@yahoo.com>2014-11-04 08:18:40 +0000
committerMichael Jaumann <meta_dev@yahoo.com>2015-03-02 12:42:53 +0000
commit4edf67cdb555285cfc85deb811fbbda3553fc841 (patch)
tree2b553e0fa93b72b98f64cf845996408f0003df8b
parente95240946c615bd7ebc3bcd6335ab93704734939 (diff)
fdo#86190 glmwrappers for bdhommatrix/affinematrix
Conflicts: include/basegfx/tools/canvastools.hxx Change-Id: I0ff0b5ed82bbe9dc0ed264b71f6cea5a72809aff
-rw-r--r--.gitignore9
-rw-r--r--basegfx/Library_basegfx.mk6
-rw-r--r--basegfx/source/tools/glm_canvastools.cxx112
-rw-r--r--canvas/Library_oglcanvas.mk1
-rw-r--r--include/basegfx/tools/canvastools.hxx12
-rw-r--r--include/basegfx/tools/glm_canvastools.hxx49
6 files changed, 177 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index b1e7a5ba9beb..92f2a56ed32c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,6 +56,9 @@
/AUTHORS
/MAINTAINERS
+#lhm stuff
+build-lhm.sh
+
# make tags
/tags
@@ -109,3 +112,9 @@ xcuserdata
# gdb config
/.gdbinit
/.gdb_history
+
+#ctags
+/canvas/.tags
+/canvas/.tags_sorted_by_file
+/extras/source/gallery/gallery_system/sg1.sdv
+
diff --git a/basegfx/Library_basegfx.mk b/basegfx/Library_basegfx.mk
index 95ba931ba049..7fd55419ae30 100644
--- a/basegfx/Library_basegfx.mk
+++ b/basegfx/Library_basegfx.mk
@@ -9,7 +9,10 @@
$(eval $(call gb_Library_Library,basegfx))
-$(eval $(call gb_Library_use_external,basegfx,boost_headers))
+$(eval $(call gb_Library_use_externals,basegfx, \
+ boost_headers \
+ glm_headers \
+))
$(eval $(call gb_Library_set_precompiled_header,basegfx,$(SRCDIR)/basegfx/inc/pch/precompiled_basegfx))
@@ -70,6 +73,7 @@ $(eval $(call gb_Library_add_exception_objects,basegfx,\
basegfx/source/raster/rasterconvert3d \
basegfx/source/tools/b2dclipstate \
basegfx/source/tools/canvastools \
+ basegfx/source/tools/glm_canvastools \
basegfx/source/tools/gradienttools \
basegfx/source/tools/keystoplerp \
basegfx/source/tools/numbertools \
diff --git a/basegfx/source/tools/glm_canvastools.cxx b/basegfx/source/tools/glm_canvastools.cxx
new file mode 100644
index 000000000000..e4a390740199
--- /dev/null
+++ b/basegfx/source/tools/glm_canvastools.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <com/sun/star/geometry/AffineMatrix2D.hpp>
+#include <com/sun/star/geometry/AffineMatrix3D.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/tools/glm_canvastools.hxx>
+#include <limits>
+
+using namespace ::com::sun::star;
+
+namespace basegfx
+{
+
+ namespace unotools
+ {
+ namespace
+ {
+
+
+ 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;
+ }
+
+
+ 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;
+ }
+ } // namespace bgfxtools
+
+} // namespace canvas
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/Library_oglcanvas.mk b/canvas/Library_oglcanvas.mk
index fcdb9ac7eb01..8655defea922 100644
--- a/canvas/Library_oglcanvas.mk
+++ b/canvas/Library_oglcanvas.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_Library_use_externals,oglcanvas,\
boost_headers \
glew \
mesa_headers \
+ glm_headers \
))
ifeq ($(strip $(OS)),MACOSX)
diff --git a/include/basegfx/tools/canvastools.hxx b/include/basegfx/tools/canvastools.hxx
index 2a3030a0f328..c1143fc43193 100644
--- a/include/basegfx/tools/canvastools.hxx
+++ b/include/basegfx/tools/canvastools.hxx
@@ -23,7 +23,6 @@
#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
@@ -129,21 +128,12 @@ namespace basegfx
BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix&
homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& transform,
const ::com::sun::star::geometry::AffineMatrix2D& matrix );
- BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix
+ 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
diff --git a/include/basegfx/tools/glm_canvastools.hxx b/include/basegfx/tools/glm_canvastools.hxx
new file mode 100644
index 000000000000..e9b7b4375a13
--- /dev/null
+++ b/include/basegfx/tools/glm_canvastools.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEGFX_TOOLS_GLM_CANVASTOOLS_HXX
+#define INCLUDED_BASEGFX_TOOLS_GLM_CANVASTOOLS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <basegfx/basegfxdllapi.h>
+#include <glm/glm.hpp>
+
+
+namespace basegfx
+{
+
+
+ namespace unotools
+ {
+
+ 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 glm::mat4 glmMatFromHomMatrix( const ::basegfx::B2DHomMatrix& input);
+
+ BASEGFX_DLLPUBLIC glm::mat4 glmMatFromHomMatrix3d( const ::basegfx::B3DHomMatrix& input);
+
+ }
+}
+
+#endif // INCLUDED_BASEGFX_TOOLS_GLM_CANVASTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */