summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-07-16 22:58:53 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-07-17 02:59:19 +0200
commit026e2623f7f498432e6dc970fb06145dfc77dc45 (patch)
tree22229b7aab2fff3c4f4f12f856e55494dc7fb565
parent13660d4b311501d80b3e1a9541fb7db80cc42f87 (diff)
remove the GL based 3D charts
Change-Id: Ia578c71ae70aa0a85b49fa50138edf90f961b1e9 Reviewed-on: https://gerrit.libreoffice.org/57533 Tested-by: Jenkins Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--Repository.mk3
-rwxr-xr-xbin/check-elf-dynamic-objects2
-rwxr-xr-xbin/update_pch1
-rw-r--r--chart2/IwyuFilter_chart2.yaml12
-rw-r--r--chart2/Library_chartcontroller.mk2
-rw-r--r--chart2/Library_chartcore.mk17
-rw-r--r--chart2/Library_chartopengl.mk64
-rw-r--r--chart2/Module_chart2.mk6
-rw-r--r--chart2/Package_opengl.mk41
-rw-r--r--chart2/inc/ChartModel.hxx15
-rw-r--r--chart2/inc/ChartView.hxx10
-rw-r--r--chart2/inc/bitmaps.hlst2
-rw-r--r--chart2/inc/pch/precompiled_chartopengl.cxx12
-rw-r--r--chart2/inc/pch/precompiled_chartopengl.hxx36
-rw-r--r--chart2/inc/strings.hrc2
-rw-r--r--chart2/inc/unonames.hxx1
-rw-r--r--chart2/opengl/backgroundFragmentShader.glsl19
-rw-r--r--chart2/opengl/backgroundVertexShader.glsl23
-rw-r--r--chart2/opengl/commonFragmentShader.glsl20
-rw-r--r--chart2/opengl/commonVertexShader.glsl23
-rw-r--r--chart2/opengl/debugFragmentShader.glsl19
-rw-r--r--chart2/opengl/debugVertexShader.glsl21
-rw-r--r--chart2/opengl/pickingFragmentShader.glsl24
-rw-r--r--chart2/opengl/pickingVertexShader.glsl28
-rw-r--r--chart2/opengl/renderTextureFragmentShader.glsl21
-rw-r--r--chart2/opengl/renderTextureVertexShader.glsl21
-rw-r--r--chart2/opengl/screenTextFragmentShader.glsl23
-rw-r--r--chart2/opengl/screenTextVertexShader.glsl21
-rw-r--r--chart2/opengl/shape3DFragmentShader.glsl112
-rw-r--r--chart2/opengl/shape3DFragmentShaderBatch.glsl108
-rw-r--r--chart2/opengl/shape3DFragmentShaderBatchScroll.glsl112
-rw-r--r--chart2/opengl/shape3DFragmentShaderV300.glsl93
-rw-r--r--chart2/opengl/shape3DVertexShader.glsl32
-rw-r--r--chart2/opengl/shape3DVertexShaderBatch.glsl36
-rw-r--r--chart2/opengl/shape3DVertexShaderBatchScroll.glsl41
-rw-r--r--chart2/opengl/shape3DVertexShaderV300.glsl36
-rw-r--r--chart2/opengl/symbolFragmentShader.glsl101
-rw-r--r--chart2/opengl/symbolVertexShader.glsl23
-rw-r--r--chart2/opengl/textFragmentShader.glsl23
-rw-r--r--chart2/opengl/textFragmentShaderBatch.glsl24
-rw-r--r--chart2/opengl/textVertexShader.glsl22
-rw-r--r--chart2/opengl/textVertexShaderBatch.glsl24
-rw-r--r--chart2/source/chartcore.component5
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx11
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx10
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx136
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.hxx38
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx19
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.hxx1
-rw-r--r--chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx57
-rw-r--r--chart2/source/controller/dialogs/GL3DBarChartDialogController.hxx36
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx53
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hxx2
-rw-r--r--chart2/source/controller/inc/ChartWindow.hxx1
-rw-r--r--chart2/source/controller/main/ChartController.cxx4
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx52
-rw-r--r--chart2/source/inc/FastPropertyIdRanges.hxx1
-rw-r--r--chart2/source/inc/servicenames_charttypes.hxx1
-rw-r--r--chart2/source/model/main/ChartModel.cxx26
-rw-r--r--chart2/source/model/template/ChartTypeManager.cxx16
-rw-r--r--chart2/source/model/template/GL3DBarChartType.cxx166
-rw-r--r--chart2/source/model/template/GL3DBarChartType.hxx58
-rw-r--r--chart2/source/model/template/GL3DBarChartTypeTemplate.cxx195
-rw-r--r--chart2/source/model/template/GL3DBarChartTypeTemplate.hxx62
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx1503
-rw-r--r--chart2/source/view/inc/3DChartObjects.hxx159
-rw-r--r--chart2/source/view/inc/AbstractShapeFactory.hxx9
-rw-r--r--chart2/source/view/inc/GL3DBarChart.hxx210
-rw-r--r--chart2/source/view/inc/GL3DPlotterBase.hxx35
-rw-r--r--chart2/source/view/inc/GL3DRenderer.hxx491
-rw-r--r--chart2/source/view/inc/OpenglShapeFactory.hxx206
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx8
-rw-r--r--chart2/source/view/inc/StaticGeometry.h135
-rw-r--r--chart2/source/view/main/3DChartObjects.cxx234
-rw-r--r--chart2/source/view/main/AbstractShapeFactory.cxx60
-rw-r--r--chart2/source/view/main/ChartView.cxx250
-rw-r--r--chart2/source/view/main/DummyXShape.cxx1099
-rw-r--r--chart2/source/view/main/DummyXShape.hxx402
-rw-r--r--chart2/source/view/main/GL3DPlotterBase.cxx18
-rw-r--r--chart2/source/view/main/GL3DRenderer.cxx2600
-rw-r--r--chart2/source/view/main/OpenGLRender.cxx1024
-rw-r--r--chart2/source/view/main/OpenGLRender.hxx192
-rw-r--r--chart2/source/view/main/OpenglShapeFactory.cxx504
-rw-r--r--chart2/uiconfig/ui/tp_ChartType.ui27
-rw-r--r--compilerplugins/clang/constantparam.booleans.results16
-rw-r--r--compilerplugins/clang/constantparam.numbers.results20
-rw-r--r--compilerplugins/clang/singlevalfields.results3
-rw-r--r--compilerplugins/clang/unusedenumconstants.writeonly.results12
-rw-r--r--compilerplugins/clang/unusedfields.only-used-in-constructor.results10
-rw-r--r--compilerplugins/clang/unusedfields.untouched.results10
-rw-r--r--compilerplugins/clang/unusedfields.writeonly.results8
-rw-r--r--embeddedobj/source/general/docholder.cxx3
-rw-r--r--icon-themes/breeze/chart2/res/gl3dbar_roundrect.pngbin1606 -> 0 bytes
-rw-r--r--icon-themes/breeze/chart2/res/typegl3dbar_16.pngbin372 -> 0 bytes
-rw-r--r--icon-themes/breeze_dark/chart2/res/gl3dbar_roundrect.pngbin1602 -> 0 bytes
-rw-r--r--icon-themes/breeze_dark/chart2/res/typegl3dbar_16.pngbin377 -> 0 bytes
-rw-r--r--icon-themes/breeze_svg/chart2/res/gl3dbar_roundrect.svg1
-rw-r--r--icon-themes/breeze_svg/chart2/res/typegl3dbar_16.svg10
-rw-r--r--icon-themes/colibre/chart2/res/gl3dbar_roundrect.pngbin1224 -> 0 bytes
-rw-r--r--icon-themes/colibre/chart2/res/typegl3dbar_16.pngbin561 -> 0 bytes
-rw-r--r--icon-themes/colibre_svg/chart2/res/gl3dbar_roundrect.svg1
-rw-r--r--icon-themes/colibre_svg/chart2/res/typegl3dbar_16.svg1
-rw-r--r--icon-themes/elementary/chart2/res/gl3dbar_roundrect.pngbin1718 -> 0 bytes
-rw-r--r--icon-themes/elementary/chart2/res/typegl3dbar_16.pngbin553 -> 0 bytes
-rw-r--r--icon-themes/elementary_svg/chart2/res/gl3dbar_roundrect.svg1
-rw-r--r--icon-themes/elementary_svg/chart2/res/typegl3dbar_16.svg1
-rw-r--r--icon-themes/karasa_jaga/chart2/res/gl3dbar_roundrect.pngbin2404 -> 0 bytes
-rw-r--r--icon-themes/karasa_jaga/chart2/res/typegl3dbar_16.pngbin553 -> 0 bytes
-rw-r--r--include/svtools/embedhlp.hxx2
-rw-r--r--include/svx/charthelper.hxx3
-rw-r--r--include/svx/svdoole2.hxx1
-rw-r--r--include/xmloff/xmltoken.hxx2
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/chart2/X3DChartWindowProvider.idl33
-rw-r--r--offapi/com/sun/star/chart2/XChartDocument.idl4
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx1
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx1
-rw-r--r--sfx2/source/view/ipclient.cxx6
-rw-r--r--sfx2/source/view/viewsh.cxx3
-rwxr-xr-xsolenv/bin/native-code.py1
-rw-r--r--solenv/clang-format/blacklist24
-rw-r--r--svtools/source/misc/embedhlp.cxx25
-rw-r--r--svx/source/sdr/contact/viewobjectcontact.cxx8
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx3
-rw-r--r--svx/source/svdraw/charthelper.cxx31
-rw-r--r--svx/source/svdraw/svdoole2.cxx17
-rw-r--r--sw/source/core/doc/notxtfrm.cxx5
-rw-r--r--xmloff/source/chart/PropertyMap.hxx3
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx9
-rw-r--r--xmloff/source/chart/SchXMLTools.hxx1
-rw-r--r--xmloff/source/core/xmltoken.cxx2
-rw-r--r--xmloff/source/token/tokens.txt2
132 files changed, 13 insertions, 11664 deletions
diff --git a/Repository.mk b/Repository.mk
index e8e5af6e81f8..3907ee680922 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -345,9 +345,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
canvastools \
chartcore \
chartcontroller \
- $(if $(ENABLE_HEADLESS),, \
- chartopengl \
- ) \
$(call gb_Helper_optional,OPENCL,clew) \
$(if $(filter $(OS),WNT),,cmdmail) \
cppcanvas \
diff --git a/bin/check-elf-dynamic-objects b/bin/check-elf-dynamic-objects
index f5e4b0e0d4e1..0c5ca1e37487 100755
--- a/bin/check-elf-dynamic-objects
+++ b/bin/check-elf-dynamic-objects
@@ -152,7 +152,7 @@ local file="$1"
*/libdesktop_detectorlo.so|*/ui-previewer|*/oosplash|*/gengal.bin)
whitelist="${whitelist} ${x11whitelist}"
;;
- */libvclplug_genlo.so|*/libchartcorelo.so|*/libavmediaogl.so|*/libOGLTranslo.so|*/liboglcanvaslo.so|*/libchartopengllo.so)
+ */libvclplug_genlo.so|*/libchartcorelo.so|*/libavmediaogl.so|*/libOGLTranslo.so|*/liboglcanvaslo.so)
whitelist="${whitelist} ${x11whitelist} ${openglwhitelist}"
;;
*/libvcllo.so)
diff --git a/bin/update_pch b/bin/update_pch
index 9b04e4cd4470..8d0c1599056a 100755
--- a/bin/update_pch
+++ b/bin/update_pch
@@ -47,7 +47,6 @@ DEFAULTS = \
'basic.sb' : ( 2, EXCLUDE, EXCLUDE, INCLUDE), # 10.7
'chart2.chartcontroller' : ( 6, EXCLUDE, INCLUDE, INCLUDE), # 18.4
'chart2.chartcore' : ( 3, EXCLUDE, EXCLUDE, INCLUDE), # 22.5
- 'chart2.chartopengl' : (12, EXCLUDE, EXCLUDE, EXCLUDE), # 5.3
'comphelper.comphelper' : ( 4, EXCLUDE, INCLUDE, INCLUDE), # 7.6
'configmgr.configmgr' : ( 6, EXCLUDE, INCLUDE, INCLUDE), # 6.0
'connectivity.ado' : ( 2, EXCLUDE, EXCLUDE, EXCLUDE), # 6.4
diff --git a/chart2/IwyuFilter_chart2.yaml b/chart2/IwyuFilter_chart2.yaml
index f95dad4807b7..9566f7cf9a15 100644
--- a/chart2/IwyuFilter_chart2.yaml
+++ b/chart2/IwyuFilter_chart2.yaml
@@ -348,18 +348,6 @@ blacklist:
chart2/source/view/inc/Linear3DTransformation.hxx:
# base class has to be a complete type
- com/sun/star/chart2/XTransformation.hpp
- chart2/source/view/inc/GL3DRenderer.hxx:
- # base class has to be a complete type
- - boost/shared_array.hpp
- - map
- - vector
- chart2/source/view/inc/GL3DBarChart.hxx:
- # base class has to be a complete type
- - deque
- - memory
- - vector
- - GL3DPlotterBase.hxx
- - vcl/idle.hxx
chart2/source/view/inc/VLineProperties.hxx:
# base class has to be a complete type
- com/sun/star/uno/Reference.h
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 7c0cc90a1d14..ae8535e5fa3c 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -75,7 +75,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty \
chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties \
chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty \
- chart2/source/controller/chartapiwrapper/WrappedGL3DProperties \
chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty \
chart2/source/controller/chartapiwrapper/WrappedScaleProperty \
chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties \
@@ -88,7 +87,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty \
chart2/source/controller/dialogs/ChangingResource \
chart2/source/controller/dialogs/ChartTypeDialogController \
- chart2/source/controller/dialogs/GL3DBarChartDialogController \
chart2/source/controller/dialogs/DataBrowser \
chart2/source/controller/dialogs/DataBrowserModel \
chart2/source/controller/dialogs/DialogModel \
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 69d4c0552636..bed8c218d79b 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -23,17 +23,10 @@ $(eval $(call gb_Library_add_defs,chartcore,\
-DOOO_DLLIMPLEMENTATION_CHARTVIEW \
))
-ifeq ($(SYSTEM_GLM),TRUE)
-$(eval $(call gb_Library_add_defs,chartcore,\
- -DGLM_ENABLE_EXPERIMENTAL \
-))
-endif
-
$(eval $(call gb_Library_set_precompiled_header,chartcore,$(SRCDIR)/chart2/inc/pch/precompiled_chartcore))
$(eval $(call gb_Library_use_externals,chartcore,\
boost_headers \
- glm_headers \
))
ifeq ($(ENABLE_HEADLESS),)
@@ -125,14 +118,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
chart2/source/view/main/VTitle \
chart2/source/view/main/VButton \
))
-ifeq ($(ENABLE_HEADLESS),)
-$(eval $(call gb_Library_add_exception_objects,chartcore,\
- chart2/source/view/main/3DChartObjects \
- chart2/source/view/main/GL3DPlotterBase \
- chart2/source/view/main/GL3DRenderer \
- chart2/source/view/charttypes/GL3DBarChart \
-))
-endif
# model pieces ...
$(eval $(call gb_Library_add_exception_objects,chartcore,\
@@ -172,8 +157,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
chart2/source/model/template/ColumnLineDataInterpreter \
chart2/source/model/template/DataInterpreter \
chart2/source/model/template/FilledNetChartType \
- chart2/source/model/template/GL3DBarChartType \
- chart2/source/model/template/GL3DBarChartTypeTemplate \
chart2/source/model/template/LineChartType \
chart2/source/model/template/LineChartTypeTemplate \
chart2/source/model/template/NetChartType \
diff --git a/chart2/Library_chartopengl.mk b/chart2/Library_chartopengl.mk
deleted file mode 100644
index 8b5a22c4ab66..000000000000
--- a/chart2/Library_chartopengl.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-$(eval $(call gb_Library_Library,chartopengl))
-
-$(eval $(call gb_Library_set_include,chartopengl,\
- -I$(SRCDIR)/chart2/inc \
- -I$(SRCDIR)/chart2/source/model/inc \
- -I$(SRCDIR)/chart2/source/view/inc \
- -I$(SRCDIR)/chart2/source/inc \
- $$(INCLUDE) \
-))
-
-$(eval $(call gb_Library_set_precompiled_header,chartopengl,$(SRCDIR)/chart2/inc/pch/precompiled_chartopengl))
-
-$(eval $(call gb_Library_use_externals,chartopengl,\
- boost_headers \
- glm_headers \
- epoxy \
-))
-
-$(eval $(call gb_Library_use_sdk_api,chartopengl))
-
-$(eval $(call gb_Library_use_libraries,chartopengl,\
- basegfx \
- chartcore \
- comphelper \
- cppu \
- cppuhelper \
- drawinglayer \
- editeng \
- fwe \
- i18nlangtag \
- sal \
- sfx \
- svl \
- svt \
- svxcore \
- tl \
- tk \
- ucbhelper \
- utl \
- vcl \
-))
-
-$(eval $(call gb_Library_add_exception_objects,chartopengl,\
- chart2/source/view/main/OpenglShapeFactory \
- chart2/source/view/main/DummyXShape \
- chart2/source/view/main/OpenGLRender \
-))
-
-ifeq ($(SYSTEM_GLM),TRUE)
-$(eval $(call gb_Library_add_defs,chartopengl,\
- -DGLM_ENABLE_EXPERIMENTAL \
-))
-endif
-
-# vim: set noet sw=4 ts=4:
diff --git a/chart2/Module_chart2.mk b/chart2/Module_chart2.mk
index c044d016a91a..8576bf560f50 100644
--- a/chart2/Module_chart2.mk
+++ b/chart2/Module_chart2.mk
@@ -14,12 +14,6 @@ $(eval $(call gb_Module_add_targets,chart2,\
Library_chartcore \
UIConfig_chart2 \
))
-ifeq ($(ENABLE_HEADLESS),)
-$(eval $(call gb_Module_add_targets,chart2,\
- Library_chartopengl \
- Package_opengl \
- ))
-endif
$(eval $(call gb_Module_add_l10n_targets,chart2,\
AllLangMoTarget_chart \
diff --git a/chart2/Package_opengl.mk b/chart2/Package_opengl.mk
deleted file mode 100644
index aa12a9578366..000000000000
--- a/chart2/Package_opengl.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-$(eval $(call gb_Package_Package,chart2_opengl_shader,$(SRCDIR)/chart2/opengl))
-
-$(eval $(call gb_Package_add_files,chart2_opengl_shader,$(LIBO_ETC_FOLDER)/opengl,\
- backgroundFragmentShader.glsl \
- backgroundVertexShader.glsl \
- commonFragmentShader.glsl \
- commonVertexShader.glsl \
- debugFragmentShader.glsl \
- debugVertexShader.glsl \
- pickingVertexShader.glsl \
- pickingFragmentShader.glsl \
- symbolFragmentShader.glsl \
- symbolVertexShader.glsl \
- textFragmentShader.glsl \
- textVertexShader.glsl \
- screenTextFragmentShader.glsl \
- screenTextVertexShader.glsl \
- shape3DFragmentShader.glsl \
- shape3DVertexShader.glsl \
- renderTextureVertexShader.glsl \
- renderTextureFragmentShader.glsl \
- shape3DFragmentShaderBatch.glsl \
- shape3DVertexShaderBatch.glsl \
- shape3DFragmentShaderV300.glsl \
- shape3DVertexShaderV300.glsl \
- textFragmentShaderBatch.glsl \
- textVertexShaderBatch.glsl \
- shape3DFragmentShaderBatchScroll.glsl \
- shape3DVertexShaderBatchScroll.glsl \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index 880cebccedbf..dcf21fc02130 100644
--- a/chart2/inc/ChartModel.hxx
+++ b/chart2/inc/ChartModel.hxx
@@ -46,7 +46,6 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
-#include <com/sun/star/chart2/X3DChartWindowProvider.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp>
@@ -68,7 +67,6 @@ namespace com { namespace sun { namespace star { namespace frame { class XModel;
namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
class SvNumberFormatter;
-class OpenGLWindow;
namespace chart
{
@@ -100,7 +98,6 @@ typedef cppu::WeakImplHelper<
,css::document::XDocumentPropertiesSupplier
,css::chart2::data::XDataSource
,css::document::XUndoManagerSupplier
- ,css::chart2::X3DChartWindowProvider
,css::util::XUpdatable
,css::qa::XDumper
>
@@ -371,8 +368,6 @@ public:
virtual void SAL_CALL createDefaultChart() override;
- virtual sal_Bool SAL_CALL isOpenGLChart() override;
-
// ____ XDataReceiver (public API) ____
virtual void SAL_CALL
attachDataProvider( const css::uno::Reference< css::chart2::data::XDataProvider >& xProvider ) override;
@@ -450,9 +445,6 @@ public:
// ____ XDataSource ____ allows access to the currently used data and data ranges
virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() override;
- // X3DChartWindowProvider
- virtual void SAL_CALL setWindow( sal_uInt64 nWindowPtr ) override;
-
// XUpdatable
virtual void SAL_CALL update() override;
@@ -475,16 +467,9 @@ public:
void removeDataProviders();
-#if HAVE_FEATURE_OPENGL
- OpenGLWindow* getOpenGLWindow() { return mpOpenGLWindow;}
-#endif
-
private:
sal_Int32 mnStart;
sal_Int32 mnEnd;
-#if HAVE_FEATURE_OPENGL
- VclPtr<OpenGLWindow> mpOpenGLWindow;
-#endif
};
} // namespace chart
diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx
index 0736062c201e..9d71af8c8eab 100644
--- a/chart2/inc/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -54,8 +54,6 @@ namespace chart {
class VCoordinateSystem;
class DrawModelWrapper;
class VDataSeries;
-class GL3DPlotterBase;
-class GL2DRenderer;
struct CreateShapeParam2D;
struct TimeBasedInfo
@@ -96,7 +94,6 @@ class ChartView : public ::cppu::WeakImplHelper<
, public ExplicitValueProvider
, private SfxListener
{
- friend class GL2DRenderer;
private:
void init();
@@ -182,14 +179,11 @@ public:
virtual OUString SAL_CALL dump() override;
void setViewDirty();
- void updateOpenGLWindow();
private: //methods
void createShapes();
void createShapes2D( const css::awt::Size& rPageSize );
bool createAxisTitleShapes2D( CreateShapeParam2D& rParam, const css::awt::Size& rPageSize );
- void createShapes3D();
- bool isReal3DChart();
void getMetaFile( const css::uno::Reference< css::io::XOutputStream >& xOutStream
, bool bUseHighContrast );
SdrPage* getSdrPage();
@@ -201,8 +195,6 @@ private: //methods
void impl_updateView( bool bCheckLockedCtrler = true );
- void render();
-
css::awt::Rectangle impl_createDiagramAndContent( const CreateShapeParam2D& rParam, const css::awt::Size& rPageSize );
DECL_LINK( UpdateTimeBased, Timer*, void );
@@ -255,10 +247,8 @@ private: //member
css::awt::Rectangle m_aResultingDiagramRectangleExcludingAxes;
- std::shared_ptr<GL3DPlotterBase> m_pGL3DPlotter;
TimeBasedInfo maTimeBased;
osl::Mutex maTimeMutex;
- std::unique_ptr<GL2DRenderer> mp2DRenderer;
};
}
diff --git a/chart2/inc/bitmaps.hlst b/chart2/inc/bitmaps.hlst
index 4e8a3109a5c4..3274c7fa7c9e 100644
--- a/chart2/inc/bitmaps.hlst
+++ b/chart2/inc/bitmaps.hlst
@@ -20,9 +20,7 @@
#define BMP_TYPE_STOCK "chart2/res/typestock_16.png"
#define BMP_TYPE_COLUMN_LINE "chart2/res/typecolumnline_16.png"
#define BMP_TYPE_BUBBLE "chart2/res/typebubble_16.png"
-#define BMP_TYPE_GL3D_BAR "chart2/res/typegl3dbar_16.png"
#define BMP_BUBBLE_1 "chart2/res/bubble_52x60.png"
-#define BMP_GL3D_BAR_ROUNDRECT "chart2/res/gl3dbar_roundrect.png"
#define BMP_AREAS_2D "chart2/res/areas_52x60.png"
#define BMP_AREAS_2D_1 "chart2/res/areaspiled_52x60.png"
#define BMP_AREAS_2D_3 "chart2/res/areasfull_52x60.png"
diff --git a/chart2/inc/pch/precompiled_chartopengl.cxx b/chart2/inc/pch/precompiled_chartopengl.cxx
deleted file mode 100644
index 985b84c0a382..000000000000
--- a/chart2/inc/pch/precompiled_chartopengl.cxx
+++ /dev/null
@@ -1,12 +0,0 @@
-/* -*- 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/.
- */
-
-#include "precompiled_chartopengl.hxx"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/inc/pch/precompiled_chartopengl.hxx b/chart2/inc/pch/precompiled_chartopengl.hxx
deleted file mode 100644
index e34013354c75..000000000000
--- a/chart2/inc/pch/precompiled_chartopengl.hxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- 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 has been autogenerated by update_pch.sh. It is possible to edit it
- manually (such as when an include file has been moved/renamed/removed). All such
- manual changes will be rewritten by the next run of update_pch.sh (which presumably
- also fixes all possible problems, so it's usually better to use it).
-
- Generated on 2017-09-20 22:51:46 using:
- ./bin/update_pch chart2 chartopengl --cutoff=12 --exclude:system --exclude:module --exclude:local
-
- If after updating build fails, use the following command to locate conflicting headers:
- ./bin/update_pch_bisect ./chart2/inc/pch/precompiled_chartopengl.hxx "make chart2.build" --find-conflicts
-*/
-
-#include <ostream>
-#include <osl/interlck.h>
-#include <osl/mutex.hxx>
-#include <osl/thread.hxx>
-#include <rtl/instance.hxx>
-#include <rtl/math.hxx>
-#include <rtl/ref.hxx>
-#include <rtl/stringutils.hxx>
-#include <rtl/textenc.h>
-#include <rtl/ustring.h>
-#include <sal/config.h>
-#include <sal/log.hxx>
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/inc/strings.hrc b/chart2/inc/strings.hrc
index e4a1844d1f18..e2eb6085f8f0 100644
--- a/chart2/inc/strings.hrc
+++ b/chart2/inc/strings.hrc
@@ -184,8 +184,6 @@
#define STR_FILLED NC_("STR_FILLED", "Filled")
#define STR_TYPE_BUBBLE NC_("STR_TYPE_BUBBLE", "Bubble")
#define STR_BUBBLE_1 NC_("STR_BUBBLE_1", "Bubble Chart")
-#define STR_TYPE_GL3D_BAR NC_("STR_TYPE_GL3D_BAR", "GL3D Bar")
-#define STR_GL3D_BAR NC_("STR_GL3D_BAR", "GL3D Bar Chart")
#define STR_INVALID_NUMBER NC_("STR_INVALID_NUMBER", "Numbers are required. Check your input.")
#define STR_STEP_GT_ZERO NC_("STR_STEP_GT_ZERO", "The major interval requires a positive number. Check your input.")
diff --git a/chart2/inc/unonames.hxx b/chart2/inc/unonames.hxx
index 44c3bf67d3cb..ba8011431809 100644
--- a/chart2/inc/unonames.hxx
+++ b/chart2/inc/unonames.hxx
@@ -11,7 +11,6 @@
#define INCLUDED_CHART2_INC_UNONAMES_HXX
#define CHART_UNONAME_SORT_BY_XVALUES "SortByXValues"
-#define CHART_UNONAME_ROUNDED_EDGE "RoundedEdge"
#define CHART_UNONAME_SPLINE_TYPE "SplineType"
#define CHART_UNONAME_SPLINE_ORDER "SplineOrder"
#define CHART_UNONAME_SPLINE_RESOLUTION "SplineResolution"
diff --git a/chart2/opengl/backgroundFragmentShader.glsl b/chart2/opengl/backgroundFragmentShader.glsl
deleted file mode 100644
index d602b21a3488..000000000000
--- a/chart2/opengl/backgroundFragmentShader.glsl
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec4 fragmentColor;
-
-void main()
-{
- gl_FragColor = fragmentColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/backgroundVertexShader.glsl b/chart2/opengl/backgroundVertexShader.glsl
deleted file mode 100644
index bf7937cafffd..000000000000
--- a/chart2/opengl/backgroundVertexShader.glsl
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec3 vPosition;
-uniform mat4 MVP;
-in vec4 vColor;
-out vec4 fragmentColor;
-
-void main()
-{
- gl_Position = MVP * vec4(vPosition, 1);
- fragmentColor = vColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/commonFragmentShader.glsl b/chart2/opengl/commonFragmentShader.glsl
deleted file mode 100644
index bb2482b4a57b..000000000000
--- a/chart2/opengl/commonFragmentShader.glsl
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec4 fragmentColor;
-out vec4 actualColor;
-
-void main()
-{
- actualColor = fragmentColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/commonVertexShader.glsl b/chart2/opengl/commonVertexShader.glsl
deleted file mode 100644
index 145d4db2fcae..000000000000
--- a/chart2/opengl/commonVertexShader.glsl
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec3 vPosition;
-uniform mat4 MVP;
-uniform vec4 vColor;
-out vec4 fragmentColor;
-
-void main()
-{
- gl_Position = MVP * vec4(vPosition, 1);
- fragmentColor = vColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/debugFragmentShader.glsl b/chart2/opengl/debugFragmentShader.glsl
deleted file mode 100644
index 92b005edc862..000000000000
--- a/chart2/opengl/debugFragmentShader.glsl
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec4 fragmentColor;
-
-void main()
-{
- gl_FragColor = vec4(1.0, 1.0, 0.0, 0.5);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/debugVertexShader.glsl b/chart2/opengl/debugVertexShader.glsl
deleted file mode 100644
index a542da88b911..000000000000
--- a/chart2/opengl/debugVertexShader.glsl
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec3 vPosition;
-uniform vec4 vColor;
-out vec4 fragmentColor;
-
-void main()
-{
- gl_Position = vec4(vPosition, 1);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/pickingFragmentShader.glsl b/chart2/opengl/pickingFragmentShader.glsl
deleted file mode 100644
index 6262216a6d77..000000000000
--- a/chart2/opengl/pickingFragmentShader.glsl
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-uniform float minCoordX;
-in vec3 positionWorldspace;
-in vec4 fragmentColor;
-out vec4 actualColor;
-
-void main()
-{
- if (positionWorldspace.x <= minCoordX)
- discard;
- actualColor = fragmentColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/pickingVertexShader.glsl b/chart2/opengl/pickingVertexShader.glsl
deleted file mode 100644
index 9dc5a1463a23..000000000000
--- a/chart2/opengl/pickingVertexShader.glsl
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec3 vPosition;
-uniform mat4 MVP;
-uniform mat4 M;
-uniform vec4 vColor;
-uniform float minCoordX;
-uniform float maxCoordX;
-out vec4 fragmentColor;
-out vec3 positionWorldspace;
-void main()
-{
- positionWorldspace = (M * vec4(vPosition,1)).xyz;
- positionWorldspace.x = clamp(positionWorldspace.x, minCoordX, maxCoordX);
- gl_Position = MVP * vec4(vPosition, 1);
- fragmentColor = vColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/renderTextureFragmentShader.glsl b/chart2/opengl/renderTextureFragmentShader.glsl
deleted file mode 100644
index 52dfde821a7d..000000000000
--- a/chart2/opengl/renderTextureFragmentShader.glsl
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-uniform sampler2D RenderTex;
-in vec2 vTexCoord;
-out vec4 actualColor;
-
-void main()
-{
- actualColor = vec4(texture(RenderTex, vTexCoord).rgb, 1.0);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/renderTextureVertexShader.glsl b/chart2/opengl/renderTextureVertexShader.glsl
deleted file mode 100644
index b9307fb32527..000000000000
--- a/chart2/opengl/renderTextureVertexShader.glsl
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec4 vPosition;
-in vec2 texCoord;
-out vec2 vTexCoord;
-void main()
-{
- gl_Position = vPosition;
- vTexCoord = texCoord;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/screenTextFragmentShader.glsl b/chart2/opengl/screenTextFragmentShader.glsl
deleted file mode 100644
index f60b54fd4248..000000000000
--- a/chart2/opengl/screenTextFragmentShader.glsl
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec2 vTexCoord;
-uniform sampler2D TextTex;
-uniform vec4 textColor;
-out vec4 actualColor;
-void main()
-{
- vec3 color = texture2D(TextTex, vTexCoord).rgb;
- actualColor = ((1.0 - color.r) == 0.0) ? vec4(0.0, 0.0, 0.0, textColor.a) :
- vec4(textColor.rgb, 1.0);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/screenTextVertexShader.glsl b/chart2/opengl/screenTextVertexShader.glsl
deleted file mode 100644
index b0ab221cb032..000000000000
--- a/chart2/opengl/screenTextVertexShader.glsl
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec3 vPosition;
-in vec2 texCoord;
-out vec2 vTexCoord;
-void main()
-{
- gl_Position = vec4(vPosition, 1);
- vTexCoord = texCoord;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/shape3DFragmentShader.glsl b/chart2/opengl/shape3DFragmentShader.glsl
deleted file mode 100644
index 5c1614ce3252..000000000000
--- a/chart2/opengl/shape3DFragmentShader.glsl
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- 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/.
- */
-
-#version 330 core
-#define MAX_LIGHT_NUM 8
-
-in vec3 positionWorldspace;
-in vec3 normalCameraspace;
-uniform mat4 V;
-out vec4 actualColor;
-struct MaterialParameters
-{
- vec4 ambient;
- vec4 diffuse;
- vec4 specular;
- vec4 materialColor;
-
- int twoSidesLighting;
- float shininess;
- float pad;
- float pad1;
-};
-
-layout(std140) uniform GlobalMaterialParameters
-{
- MaterialParameters matralParameter;
-}Material;
-
-struct LightSource
-{
- vec4 lightColor;
- vec4 positionWorldspace;
- float lightPower;
- float pad1;
- float pad2;
- float pad3;
-};
-
-layout(std140) uniform GlobalLights
-{
- int lightNum;
- vec4 ambient;
- LightSource light[MAX_LIGHT_NUM];
-} Lights;
-
-void main()
-{
- vec3 colorTotal = vec3(0.0f, 0.0f, 0.0f);
-
- vec3 vertexPositionCameraspace = (V * vec4(positionWorldspace,1)).xyz;
-
- vec3 MaterialDiffuseColor = Material.matralParameter.materialColor.rgb;
-
- vec3 normalDirectionCameraspace = normalCameraspace;
- vec3 eyeDirectionCameraspace = normalize(vec3(0, 0, 0) - vertexPositionCameraspace);
- float attenuation = 1.0;
- int i = 0;
- vec3 lightDirectionCameraspace;
- vec3 vertexToLightSource;
-
- vec3 lightAmbient = Lights.ambient.rgb *
- MaterialDiffuseColor *
- Material.matralParameter.ambient.rgb
- * 5.0;
-
- if ((Material.matralParameter.twoSidesLighting == 1) && (!gl_FrontFacing))
- {
- normalDirectionCameraspace = -normalDirectionCameraspace;
- }
- for (i = 0; i < Lights.lightNum; i++)
- {
- float LightPower = Lights.light[i].lightPower;
- lightDirectionCameraspace = normalize((V * Lights.light[i].positionWorldspace).xyz);
-
- float cosTheta = clamp(dot(normalDirectionCameraspace,lightDirectionCameraspace), 0,1);
- vec3 lightDiffuse = LightPower *
- attenuation *
- Lights.light[i].lightColor.rgb *
- MaterialDiffuseColor *
- Material.matralParameter.diffuse.rgb *
- cosTheta;
-
- vec3 specularReflection;
- if (dot(normalDirectionCameraspace, lightDirectionCameraspace) < 0)
- {
- specularReflection = vec3(0.0, 0.0, 0.0);
- }
- else
- {
- vec3 R = reflect(-lightDirectionCameraspace,normalDirectionCameraspace);
- float cosAlpha = clamp(dot(eyeDirectionCameraspace, R), 0,1);
- specularReflection = attenuation *
- LightPower *
- Lights.light[i].lightColor.rgb *
- Material.matralParameter.specular.rgb *
- MaterialDiffuseColor *
- pow(max(0.0, cosAlpha), Material.matralParameter.shininess);
- }
- colorTotal += lightDiffuse + specularReflection;
-
- }
- colorTotal += lightAmbient;
- actualColor = vec4(colorTotal, 1.0);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/shape3DFragmentShaderBatch.glsl b/chart2/opengl/shape3DFragmentShaderBatch.glsl
deleted file mode 100644
index e2a096155bc2..000000000000
--- a/chart2/opengl/shape3DFragmentShaderBatch.glsl
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- 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/.
- */
-
-#version 330 core
-#define MAX_LIGHT_NUM 8
-
-in vec3 positionWorldspace;
-in vec3 normalCameraspace;
-in vec4 fragBarColor;
-uniform mat4 V;
-out vec4 actualColor;
-struct MaterialParameters
-{
- vec4 ambient;
- vec4 diffuse;
- vec4 specular;
- vec4 materialColor;
-
- int twoSidesLighting;
- float shininess;
- float pad;
- float pad1;
-};
-
-layout(std140) uniform GlobalMaterialParameters
-{
- MaterialParameters matralParameter;
-}Material;
-
-struct LightSource
-{
- vec4 lightColor;
- vec4 positionWorldspace;
- float lightPower;
- float pad1;
- float pad2;
- float pad3;
-};
-
-layout(std140) uniform GlobalLights
-{
- int lightNum;
- vec4 ambient;
- LightSource light[MAX_LIGHT_NUM];
-} Lights;
-
-void main()
-{
- vec3 colorTotal = vec3(0.0f, 0.0f, 0.0f);
-
- vec3 vertexPositionCameraspace = (V * vec4(positionWorldspace,1)).xyz;
-
- vec3 MaterialDiffuseColor = fragBarColor.rgb;
-
- vec3 normalDirectionCameraspace = normalCameraspace;
- vec3 eyeDirectionCameraspace = normalize(vec3(0, 0, 0) - vertexPositionCameraspace);
- float attenuation = 1.0;
- int i = 0;
- vec3 lightDirectionCameraspace;
- vec3 vertexToLightSource;
-
- vec3 lightAmbient = Lights.ambient.rgb *
- MaterialDiffuseColor *
- Material.matralParameter.ambient.rgb;
-
- for (i = 0; i < Lights.lightNum; i++)
- {
- float LightPower = Lights.light[i].lightPower;
- lightDirectionCameraspace = normalize((V * Lights.light[i].positionWorldspace).xyz);
-
- float cosTheta = clamp(dot(normalDirectionCameraspace,lightDirectionCameraspace), 0,1);
- vec3 lightDiffuse = LightPower *
- attenuation *
- Lights.light[i].lightColor.rgb *
- MaterialDiffuseColor *
- Material.matralParameter.diffuse.rgb *
- cosTheta;
-
- vec3 specularReflection;
- if (dot(normalDirectionCameraspace, lightDirectionCameraspace) < 0)
- {
- specularReflection = vec3(0.0, 0.0, 0.0);
- }
- else
- {
- vec3 R = reflect(-lightDirectionCameraspace,normalDirectionCameraspace);
- float cosAlpha = clamp(dot(eyeDirectionCameraspace, R), 0,1);
- specularReflection = attenuation *
- LightPower *
- Lights.light[i].lightColor.rgb *
- Material.matralParameter.specular.rgb *
- MaterialDiffuseColor *
- pow(max(0.0, cosAlpha), Material.matralParameter.shininess);
- }
- colorTotal += lightDiffuse + specularReflection;
-
- }
- colorTotal += lightAmbient;
- actualColor = vec4(colorTotal, 1.0);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/shape3DFragmentShaderBatchScroll.glsl b/chart2/opengl/shape3DFragmentShaderBatchScroll.glsl
deleted file mode 100644
index a4686a31e26a..000000000000
--- a/chart2/opengl/shape3DFragmentShaderBatchScroll.glsl
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- 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/.
- */
-
-#version 330 core
-#define MAX_LIGHT_NUM 8
-
-in vec3 positionWorldspace;
-in vec3 normalCameraspace;
-in vec4 fragBarColor;
-uniform mat4 V;
-uniform int undraw;
-uniform float minCoordX;
-out vec4 actualColor;
-struct MaterialParameters
-{
- vec4 ambient;
- vec4 diffuse;
- vec4 specular;
- vec4 materialColor;
-
- int twoSidesLighting;
- float shininess;
- float pad;
- float pad1;
-};
-
-layout(std140) uniform GlobalMaterialParameters
-{
- MaterialParameters matralParameter;
-}Material;
-
-struct LightSource
-{
- vec4 lightColor;
- vec4 positionWorldspace;
- float lightPower;
- float pad1;
- float pad2;
- float pad3;
-};
-
-layout(std140) uniform GlobalLights
-{
- int lightNum;
- vec4 ambient;
- LightSource light[MAX_LIGHT_NUM];
-} Lights;
-
-void main()
-{
- if ((positionWorldspace.x <= minCoordX) && (undraw == 1))
- discard;
- vec3 colorTotal = vec3(0.0f, 0.0f, 0.0f);
-
- vec3 vertexPositionCameraspace = (V * vec4(positionWorldspace,1)).xyz;
-
- vec3 MaterialDiffuseColor = fragBarColor.rgb;
-
- vec3 normalDirectionCameraspace = normalCameraspace;
- vec3 eyeDirectionCameraspace = normalize(vec3(0, 0, 0) - vertexPositionCameraspace);
- float attenuation = 1.0;
- int i = 0;
- vec3 lightDirectionCameraspace;
- vec3 vertexToLightSource;
-
- vec3 lightAmbient = Lights.ambient.rgb *
- MaterialDiffuseColor *
- Material.matralParameter.ambient.rgb;
-
- for (i = 0; i < Lights.lightNum; i++)
- {
- float LightPower = Lights.light[i].lightPower;
- lightDirectionCameraspace = normalize((V * Lights.light[i].positionWorldspace).xyz);
-
- float cosTheta = clamp(dot(normalDirectionCameraspace,lightDirectionCameraspace), 0,1);
- vec3 lightDiffuse = LightPower *
- attenuation *
- Lights.light[i].lightColor.rgb *
- MaterialDiffuseColor *
- Material.matralParameter.diffuse.rgb *
- cosTheta;
-
- vec3 specularReflection;
- if (dot(normalDirectionCameraspace, lightDirectionCameraspace) < 0)
- {
- specularReflection = vec3(0.0, 0.0, 0.0);
- }
- else
- {
- vec3 R = reflect(-lightDirectionCameraspace,normalDirectionCameraspace);
- float cosAlpha = clamp(dot(eyeDirectionCameraspace, R), 0,1);
- specularReflection = attenuation *
- LightPower *
- Lights.light[i].lightColor.rgb *
- Material.matralParameter.specular.rgb *
- MaterialDiffuseColor *
- pow(max(0.0, cosAlpha), Material.matralParameter.shininess);
- }
- colorTotal += lightDiffuse + specularReflection;
-
- }
- colorTotal += lightAmbient;
- actualColor = vec4(colorTotal, 1.0);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/shape3DFragmentShaderV300.glsl b/chart2/opengl/shape3DFragmentShaderV300.glsl
deleted file mode 100644
index 9a8ddeaa9b54..000000000000
--- a/chart2/opengl/shape3DFragmentShaderV300.glsl
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-#define MAX_LIGHT_NUM 8
-
-in vec3 positionWorldspace;
-in vec3 normalCameraspace;
-
-uniform mat4 V;
-uniform vec4 materialAmbient;
-uniform vec4 materialDiffuse;
-uniform vec4 materialSpecular;
-uniform vec4 materialColor;
-uniform int twoSidesLighting;
-uniform float materialShininess;
-uniform vec4 lightColor[MAX_LIGHT_NUM];
-uniform vec4 lightPosWorldspace[MAX_LIGHT_NUM];
-uniform float lightPower[MAX_LIGHT_NUM];
-uniform int lightNum;
-uniform vec4 lightAmbient;
-uniform int undraw;
-uniform float minCoordX;
-
-void main()
-{
- if ((positionWorldspace.x <= minCoordX) && (undraw == 1))
- discard;
- vec3 colorTotal = vec3(0.0f, 0.0f, 0.0f);
-
- vec3 vertexPositionCameraspace = (V * vec4(positionWorldspace,1)).xyz;
-
- vec3 MaterialDiffuseColor = materialColor.rgb;
-
- vec3 normalDirectionCameraspace = normalCameraspace;
- vec3 eyeDirectionCameraspace = normalize(vec3(0, 0, 0) - vertexPositionCameraspace);
- float attenuation = 1.0;
- int i = 0;
- vec3 lightDirectionCameraspace;
- vec3 vertexToLightSource;
-
- vec3 totalAmbient = lightAmbient.rgb *
- MaterialDiffuseColor *
- materialAmbient.rgb;
-
- if ((twoSidesLighting == 1) && (!gl_FrontFacing))
- {
- normalDirectionCameraspace = -normalDirectionCameraspace;
- }
- for (i = 0; i < lightNum; i++)
- {
- float LightPower = lightPower[i];
- lightDirectionCameraspace = normalize((V * lightPosWorldspace[i]).xyz);
-
- float cosTheta = clamp(dot(normalDirectionCameraspace,lightDirectionCameraspace), 0,1);
- vec3 lightDiffuse = LightPower *
- attenuation *
- lightColor[i].rgb *
- MaterialDiffuseColor *
- materialDiffuse.rgb *
- cosTheta;
-
- vec3 specularReflection;
- if (dot(normalDirectionCameraspace, lightDirectionCameraspace) < 0)
- {
- specularReflection = vec3(0.0, 0.0, 0.0);
- }
- else
- {
- vec3 R = reflect(-lightDirectionCameraspace,normalDirectionCameraspace);
- float cosAlpha = clamp(dot(eyeDirectionCameraspace, R), 0,1);
- specularReflection = attenuation *
- LightPower *
- lightColor[i].rgb *
- materialSpecular.rgb *
- MaterialDiffuseColor *
- pow(max(0.0, cosAlpha), materialShininess);
- }
- colorTotal += lightDiffuse + specularReflection;
-
- }
- colorTotal += totalAmbient;
- gl_FragColor = vec4(colorTotal, 1.0);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/shape3DVertexShader.glsl b/chart2/opengl/shape3DVertexShader.glsl
deleted file mode 100644
index 9b763c968e15..000000000000
--- a/chart2/opengl/shape3DVertexShader.glsl
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- 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/.
- */
-
-#version 330 core
-
-in vec3 vertexPositionModelspace;
-in vec3 vertexNormalModelspace;
-
-out vec3 positionWorldspace;
-out vec3 normalCameraspace;
-
-uniform mat4 P;
-uniform mat4 M;
-uniform mat4 V;
-uniform mat3 normalMatrix;
-
-void main()
-{
- positionWorldspace = (M * vec4(vertexPositionModelspace,1)).xyz;
-
- gl_Position = P * V * vec4(positionWorldspace,1);
-
- normalCameraspace = normalize(mat3(V) * normalMatrix * vertexNormalModelspace);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/shape3DVertexShaderBatch.glsl b/chart2/opengl/shape3DVertexShaderBatch.glsl
deleted file mode 100644
index 46a91a23a86b..000000000000
--- a/chart2/opengl/shape3DVertexShaderBatch.glsl
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- 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/.
- */
-
-#version 330 core
-
-in vec3 vertexPositionModelspace;
-in vec3 vertexNormalModelspace;
-in mat4 M;
-in mat3 normalMatrix;
-in vec4 barColor;
-
-out vec3 positionWorldspace;
-out vec3 normalCameraspace;
-out vec4 fragBarColor;
-
-uniform mat4 P;
-uniform mat4 V;
-
-void main()
-{
- gl_Position = P * V * M * vec4(vertexPositionModelspace,1);
-
- positionWorldspace = (M * vec4(vertexPositionModelspace,1)).xyz;
-
- normalCameraspace = normalize(mat3(V) * normalMatrix * vertexNormalModelspace);
-
- fragBarColor = barColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/shape3DVertexShaderBatchScroll.glsl b/chart2/opengl/shape3DVertexShaderBatchScroll.glsl
deleted file mode 100644
index 2caff6e8d4d3..000000000000
--- a/chart2/opengl/shape3DVertexShaderBatchScroll.glsl
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- 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/.
- */
-
-#version 330 core
-
-in vec3 vertexPositionModelspace;
-in vec3 vertexNormalModelspace;
-in mat4 M;
-in mat3 normalMatrix;
-in vec4 barColor;
-
-out vec3 positionWorldspace;
-out vec3 normalCameraspace;
-out vec4 fragBarColor;
-
-uniform mat4 P;
-uniform mat4 V;
-uniform mat4 transMatrix;
-uniform float minCoordX;
-uniform float maxCoordX;
-
-void main()
-{
- positionWorldspace = (transMatrix * M * vec4(vertexPositionModelspace,1)).xyz;
-
- positionWorldspace.x = clamp(positionWorldspace.x, minCoordX, maxCoordX);
-
- gl_Position = P * V * vec4(positionWorldspace,1);
-
- normalCameraspace = normalize(mat3(V) * normalMatrix * vertexNormalModelspace);
-
- fragBarColor = barColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/shape3DVertexShaderV300.glsl b/chart2/opengl/shape3DVertexShaderV300.glsl
deleted file mode 100644
index c5072fd0b55e..000000000000
--- a/chart2/opengl/shape3DVertexShaderV300.glsl
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec3 vertexPositionModelspace;
-in vec3 vertexNormalModelspace;
-
-out vec3 positionWorldspace;
-out vec3 normalCameraspace;
-
-uniform mat4 P;
-uniform mat4 M;
-uniform mat4 V;
-uniform mat3 normalMatrix;
-uniform float minCoordX;
-uniform float maxCoordX;
-
-void main()
-{
- positionWorldspace = (M * vec4(vertexPositionModelspace,1)).xyz;
-
- positionWorldspace.x = clamp(positionWorldspace.x, minCoordX, maxCoordX);
-
- gl_Position = P * V * vec4(positionWorldspace,1);
-
- normalCameraspace = normalize(mat3(V) * normalMatrix * vertexNormalModelspace);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/symbolFragmentShader.glsl b/chart2/opengl/symbolFragmentShader.glsl
deleted file mode 100644
index f9b6dfa9b71a..000000000000
--- a/chart2/opengl/symbolFragmentShader.glsl
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec4 fragmentColor;
-uniform int shape;
-
-void main()
-{
- vec2 p = gl_PointCoord * 2.0 - vec2(1.0); // (0,0) in the center
- if(shape == 0)
- {
- }
- else if(shape == 1) //diamond
- {
- if (abs(p.x) + abs(p.y) > 1)
- discard;
- }
- else if(shape == 2) // arrow
- {
- if(p.y < 0 && (abs(p.x) + abs(p.y)) > 1)
- discard;
- else if(p.y > 0 && abs(p.x) > 0.5)
- discard;
- }
- else if(shape == 3) //arrow up
- {
- if(p.y > 0 && (abs(p.x) + abs(p.y)) > 1)
- discard;
- else if(p.y < 0 && abs(p.x) > 0.5)
- discard;
- }
- else if(shape == 4) // arrow right
- {
- if(p.x > 0 && (abs(p.x) + abs(p.y)) > 1)
- discard;
- else if(p.x < 0 && abs(p.y) > 0.5)
- discard;
- }
- else if(shape == 5) // arrow left
- {
- if(p.x < 0 && (abs(p.x) + abs(p.y)) > 1)
- discard;
- else if(p.x > 0 && abs(p.y) > 0.5)
- discard;
- }
- else if(shape == 6) // hour glass
- {
- if(abs(p.x) < abs(p.y))
- discard;
- }
- else if(shape == 7) // bow tie
- {
- if(abs(p.y) < abs(p.x))
- discard;
- }
- else if(shape == 8) // circle
- {
- if(dot(p.x, p.y) > 1)
- discard;
- }
- else if(shape == 9) // star
- {
- if(sqrt(abs(p.x))+sqrt(abs(p.y)) > 1)
- discard;
- }
- else if(shape == 10) // X
- {
- if(abs(abs(p.x) - abs(p.y)) > 0.2)
- discard;
- }
- else if(shape == 11) // Plus
- {
- if(abs(p.x) > 0.2 && abs(p.y) > 0.2)
- discard;
- }
- else if(shape == 12) // asterisk
- {
- }
- else if(shape == 13) // horizontal bar
- {
- if(abs(p.y) > 0.2)
- discard;
- }
- else if(shape == 14) // vertical bar
- {
- if(abs(p.x) > 0.2)
- discard;
- }
-
- gl_FragColor = fragmentColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/symbolVertexShader.glsl b/chart2/opengl/symbolVertexShader.glsl
deleted file mode 100644
index c5603b5e79d1..000000000000
--- a/chart2/opengl/symbolVertexShader.glsl
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec3 vPosition;
-uniform mat4 MVP;
-uniform vec4 vColor;
-out vec4 fragmentColor;
-
-void main()
-{
- gl_Position = MVP * vec4(vPosition, 1);
- fragmentColor = vColor;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/textFragmentShader.glsl b/chart2/opengl/textFragmentShader.glsl
deleted file mode 100644
index 16be8c6ae0f0..000000000000
--- a/chart2/opengl/textFragmentShader.glsl
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-uniform sampler2D TextTex;
-in vec2 vTexCoord;
-out vec4 actualColor;
-
-
-void main()
-{
- vec3 color = texture(TextTex, vTexCoord).rgb;
- actualColor = vec4(color, 1.0 - color.r);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/textFragmentShaderBatch.glsl b/chart2/opengl/textFragmentShaderBatch.glsl
deleted file mode 100644
index c97812bd0879..000000000000
--- a/chart2/opengl/textFragmentShaderBatch.glsl
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- 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/.
- */
-
-#version 330 core
-
-#extension GL_EXT_texture_array : enable
-
-uniform sampler2DArray texArray;
-in vec3 vTexCoord;
-
-out vec4 actualColor;
-void main()
-{
- vec3 color = texture(texArray, vTexCoord.xyz).rgb;
- actualColor = vec4(color, 1.0 - color.r);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/textVertexShader.glsl b/chart2/opengl/textVertexShader.glsl
deleted file mode 100644
index 351da30b5f79..000000000000
--- a/chart2/opengl/textVertexShader.glsl
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -*- 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/.
- */
-
-#version 150 core
-
-in vec3 vPosition;
-uniform mat4 MVP;
-in vec2 texCoord;
-out vec2 vTexCoord;
-void main()
-{
- gl_Position = MVP * vec4(vPosition, 1);
- vTexCoord = texCoord;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/textVertexShaderBatch.glsl b/chart2/opengl/textVertexShaderBatch.glsl
deleted file mode 100644
index d5ae4967d345..000000000000
--- a/chart2/opengl/textVertexShaderBatch.glsl
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- 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/.
- */
-
-#version 330 core
-
-in vec3 vPosition;
-in vec3 texCoord;
-
-out vec3 vTexCoord;
-uniform mat4 MVP;
-
-void main()
-{
- gl_Position = MVP * vec4(vPosition, 1);
- vTexCoord = texCoord;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/chartcore.component b/chart2/source/chartcore.component
index 45c87f93d633..f58ba98ba3ac 100644
--- a/chart2/source/chartcore.component
+++ b/chart2/source/chartcore.component
@@ -122,11 +122,6 @@
<service name="com.sun.star.chart2.BubbleChartType"/>
<service name="com.sun.star.chart2.ChartType"/>
</implementation>
- <implementation name="com.sun.star.comp.chart.GL3DBarChartType"
- constructor="com_sun_star_comp_chart_GL3DBarChartType_get_implementation">
- <service name="com.sun.star.chart2.GL3DBarChartType"/>
- <service name="com.sun.star.chart2.ChartType"/>
- </implementation>
<implementation name="com.sun.star.comp.chart.CandleStickChartType"
constructor="com_sun_star_comp_chart_CandleStickChartType_get_implementation">
<service name="com.sun.star.beans.PropertySet"/>
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 5a80655bae99..7b91382525ab 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -91,7 +91,6 @@ enum eServiceType
SERVICE_NAME_STOCK_DIAGRAM,
SERVICE_NAME_XY_DIAGRAM,
SERVICE_NAME_BUBBLE_DIAGRAM,
- SERVICE_NAME_GL3DBAR_DIAGRAM,
SERVICE_NAME_DASH_TABLE,
SERVICE_NAME_GARDIENT_TABLE,
@@ -120,7 +119,6 @@ tServiceNameMap & lcl_getStaticServiceNameMap()
{"com.sun.star.chart.StockDiagram", SERVICE_NAME_STOCK_DIAGRAM},
{"com.sun.star.chart.XYDiagram", SERVICE_NAME_XY_DIAGRAM},
{"com.sun.star.chart.BubbleDiagram", SERVICE_NAME_BUBBLE_DIAGRAM},
- {"com.sun.star.chart.GL3DBarDiagram", SERVICE_NAME_GL3DBAR_DIAGRAM},
{"com.sun.star.drawing.DashTable", SERVICE_NAME_DASH_TABLE},
{"com.sun.star.drawing.GradientTable", SERVICE_NAME_GARDIENT_TABLE},
@@ -1167,15 +1165,6 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
bCreateDiagram = true;
}
break;
- case SERVICE_NAME_GL3DBAR_DIAGRAM:
- if( xManagerFact.is())
- {
- xTemplate.set(
- xManagerFact->createInstance("com.sun.star.chart2.template.GL3DBar"),
- uno::UNO_QUERY );
- bCreateDiagram = true;
- }
- break;
case SERVICE_NAME_DASH_TABLE:
case SERVICE_NAME_GARDIENT_TABLE:
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 1d72050806ab..1a4dbfc8cb5f 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -38,7 +38,6 @@
#include "WrappedSplineProperties.hxx"
#include "WrappedStockProperties.hxx"
#include "WrappedSceneProperty.hxx"
-#include "WrappedGL3DProperties.hxx"
#include <RelativePositionHelper.hxx>
#include <ControllerLockGuard.hxx>
#include <ModifyListenerHelper.hxx>
@@ -426,7 +425,6 @@ private:
WrappedSplineProperties::addProperties( aProperties );
WrappedStockProperties::addProperties( aProperties );
WrappedAutomaticPositionProperties::addProperties( aProperties );
- WrappedGL3DProperties::addProperties(aProperties);
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
@@ -480,9 +478,6 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
{
const OUString aName( rTemplateServiceName.copy( aPrefix.getLength()));
- if (aName.indexOf("GL3DBar") != -1)
- return OUString("com.sun.star.chart.GL3DBarDiagram");
-
// "Area" "StackedArea" "PercentStackedArea" "ThreeDArea"
// "StackedThreeDArea" "PercentStackedThreeDArea"
if( aName.indexOf( "Area" ) != -1 )
@@ -556,8 +551,8 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap()
{"com.sun.star.chart2.FilledNetChartType", "com.sun.star.chart.FilledNetDiagram"},
{"com.sun.star.chart2.NetChartType", "com.sun.star.chart.NetDiagram"},
{"com.sun.star.chart2.CandleStickChartType", "com.sun.star.chart.StockDiagram"},
- {"com.sun.star.chart2.BubbleChartType", "com.sun.star.chart.BubbleDiagram"},
- {"com.sun.star.chart2.GL3DBarChartType", "com.sun.star.chart.GL3DBarDiagram"}};
+ {"com.sun.star.chart2.BubbleChartType", "com.sun.star.chart.BubbleDiagram"}
+ };
return g_aChartTypeNameMap;
}
@@ -1859,7 +1854,6 @@ const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties()
WrappedSplineProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
WrappedStockProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
- WrappedGL3DProperties::addWrappedProperties(aWrappedProperties, m_spChart2ModelContact);
aWrappedProperties.push_back( new WrappedDataRowSourceProperty( m_spChart2ModelContact ) );
aWrappedProperties.push_back( new WrappedStackingProperty( StackMode::YStacked,m_spChart2ModelContact ) );
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx
deleted file mode 100644
index eab0ec631580..000000000000
--- a/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- 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/.
- */
-
-#include "WrappedGL3DProperties.hxx"
-#include "Chart2ModelContact.hxx"
-#include <FastPropertyIdRanges.hxx>
-#include <unonames.hxx>
-#include <WrappedProperty.hxx>
-#include <DiagramHelper.hxx>
-
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/chart2/XDiagram.hpp>
-
-using namespace com::sun::star;
-
-namespace chart { namespace wrapper {
-
-namespace {
-
-enum
-{
- PROP_GL3DCHARTTYPE_ROUNDED_EDGE = FAST_PROPERTY_ID_START_GL_3D
-};
-
-class WrappedGL3DProperty : public WrappedProperty
-{
- uno::Any maDefault;
- std::shared_ptr<Chart2ModelContact> mpModelContact;
-
-private:
- uno::Reference<chart2::XChartType> getChartType() const
- {
- uno::Reference<chart2::XDiagram> xDiagram = mpModelContact->getChart2Diagram();
- uno::Sequence<uno::Reference<chart2::XChartType> > aCTs =
- DiagramHelper::getChartTypesFromDiagram(xDiagram);
-
- for (sal_Int32 i = 0; i < aCTs.getLength(); ++i)
- {
- uno::Reference<chart2::XChartType> xThisCT = aCTs[i];
- if (xThisCT->getChartType() == "com.sun.star.chart2.GL3DBarChartType")
- // Found the right chart type.
- return xThisCT;
- }
-
- return uno::Reference<chart2::XChartType>();
- }
-
-public:
- WrappedGL3DProperty( const OUString& rInName, const OUString& rOutName, const uno::Any& rDefault, const std::shared_ptr<Chart2ModelContact>& pContact ) :
- WrappedProperty(rInName, rOutName), maDefault(rDefault), mpModelContact(pContact) {}
-
- virtual uno::Any getPropertyValue( const uno::Reference<beans::XPropertySet>& /*xInnerPS*/ ) const override
- {
- uno::Reference<chart2::XChartType> xCT = getChartType();
- if (!xCT.is())
- return uno::Any();
-
- try
- {
- uno::Reference<beans::XPropertySet> xPS(xCT, uno::UNO_QUERY_THROW);
- return xPS->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE);
- }
- catch ( const uno::Exception& ) {}
-
- return uno::Any();
- };
-
- virtual void setPropertyValue(
- const uno::Any& rOutValue, const uno::Reference<beans::XPropertySet>& /*xInnerPS*/ ) const override
- {
- uno::Reference<chart2::XChartType> xCT = getChartType();
- if (!xCT.is())
- return;
-
- try
- {
- uno::Reference<beans::XPropertySet> xPS(xCT, uno::UNO_QUERY_THROW);
- return xPS->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, rOutValue);
- }
- catch ( const uno::Exception& ) {}
- }
-
- virtual void setPropertyToDefault( const uno::Reference<beans::XPropertyState>& /*xInnerPropState*/ ) const override
- {
- uno::Reference<chart2::XChartType> xCT = getChartType();
- if (!xCT.is())
- return;
-
- try
- {
- uno::Reference<beans::XPropertySet> xPS(xCT, uno::UNO_QUERY_THROW);
- return xPS->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, maDefault);
- }
- catch ( const uno::Exception& ) {}
- }
-
- virtual uno::Any getPropertyDefault( const uno::Reference<beans::XPropertyState>& /*xInnerPS*/ ) const override
- {
- return maDefault;
- }
-
- virtual beans::PropertyState getPropertyState( const uno::Reference<beans::XPropertyState>& /*xInnerPS*/ ) const override
- {
- return beans::PropertyState_DIRECT_VALUE;
- }
-};
-
-}
-
-void WrappedGL3DProperties::addProperties( std::vector<css::beans::Property> & rOutProps )
-{
- rOutProps.emplace_back(
- CHART_UNONAME_ROUNDED_EDGE,
- PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
- cppu::UnoType<bool>::get(),
- beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT
- );
-}
-
-void WrappedGL3DProperties::addWrappedProperties(
- std::vector<WrappedProperty*>& rList, const std::shared_ptr<Chart2ModelContact>& pChart2ModelContact )
-{
- rList.push_back(
- new WrappedGL3DProperty(
- CHART_UNONAME_ROUNDED_EDGE, CHART_UNONAME_ROUNDED_EDGE, uno::Any(false), pChart2ModelContact));
-}
-
-}}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.hxx
deleted file mode 100644
index 39ced85e215c..000000000000
--- a/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.hxx
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDGL3DPROPERTIES_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_WRAPPEDGL3DPROPERTIES_HXX
-
-#include <memory>
-#include <vector>
-
-#include <com/sun/star/beans/Property.hpp>
-
-namespace chart {
-
-class WrappedProperty;
-
-namespace wrapper {
-
-class Chart2ModelContact;
-
-class WrappedGL3DProperties
-{
-public:
- static void addProperties( std::vector<css::beans::Property> & rOutProps );
- static void addWrappedProperties(
- std::vector<WrappedProperty*>& rList, const std::shared_ptr<Chart2ModelContact>& pChart2ModelContact );
-};
-
-}}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index c87b765b0a8e..2a158f8a7297 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -159,12 +159,6 @@ ChartTypeParameter ChartTypeDialogController::getChartTypeParameterForService(
//not all templates need to support Geometry3D
ex.Context.is();//to have debug information without compilation warnings
}
-
- try
- {
- xTemplateProps->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= aRet.mbRoundedEdge;
- }
- catch ( const uno::Exception& ) {}
}
return aRet;
}
@@ -302,14 +296,6 @@ uno::Reference< XChartTypeTemplate > ChartTypeDialogController::getCurrentTempla
try
{
- xTemplateProps->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, uno::Any(rParameter.mbRoundedEdge));
- }
- catch ( const uno::Exception& )
- {
- }
-
- try
- {
setTemplateProperties( xTemplateProps );
}
catch( const uno::Exception & )
@@ -380,11 +366,6 @@ bool ChartTypeDialogController::shouldShow_SortByXValuesResourceGroup() const
return false;
}
-bool ChartTypeDialogController::shouldShow_GL3DResourceGroup() const
-{
- return false;
-}
-
void ChartTypeDialogController::showExtraControls( VclBuilderContainer* /*pParent*/ )
{
}
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
index 1e3830e981f9..af880d115a53 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
@@ -101,7 +101,6 @@ public:
virtual bool shouldShow_SplineControl() const;
virtual bool shouldShow_GeometryControl() const;
virtual bool shouldShow_SortByXValuesResourceGroup() const;
- virtual bool shouldShow_GL3DResourceGroup() const;
virtual void showExtraControls(VclBuilderContainer* pParent);
virtual void hideExtraControls() const;
diff --git a/chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx b/chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx
deleted file mode 100644
index a1f568ae083d..000000000000
--- a/chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- 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/.
- */
-
-#include "GL3DBarChartDialogController.hxx"
-#include <strings.hrc>
-#include <bitmaps.hlst>
-#include <ResId.hxx>
-#include <svtools/valueset.hxx>
-
-namespace chart {
-
-GL3DBarChartDialogController::GL3DBarChartDialogController() {}
-
-GL3DBarChartDialogController::~GL3DBarChartDialogController() {}
-
-bool GL3DBarChartDialogController::shouldShow_GL3DResourceGroup() const
-{
- return true;
-}
-
-OUString GL3DBarChartDialogController::getName()
-{
- return SchResId(STR_TYPE_GL3D_BAR);
-}
-
-Image GL3DBarChartDialogController::getImage()
-{
- return Image(BitmapEx(BMP_TYPE_GL3D_BAR));
-}
-
-const tTemplateServiceChartTypeParameterMap&
-GL3DBarChartDialogController::getTemplateMap() const
-{
- static tTemplateServiceChartTypeParameterMap aMap{
- {"com.sun.star.chart2.template.GL3DBar", ChartTypeParameter(1)},
- {"com.sun.star.chart2.template.GL3DBarRoundedRectangle", ChartTypeParameter(2)}};
- return aMap;
-}
-
-void GL3DBarChartDialogController::fillSubTypeList(
- ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ )
-{
- rSubTypeList.Clear();
- rSubTypeList.InsertItem(1, Image(BitmapEx(BMP_GL3D_BAR_ROUNDRECT)));
-
- rSubTypeList.SetItemText(1, SchResId(STR_GL3D_BAR));
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/GL3DBarChartDialogController.hxx b/chart2/source/controller/dialogs/GL3DBarChartDialogController.hxx
deleted file mode 100644
index 2d5d0a66b15b..000000000000
--- a/chart2/source/controller/dialogs/GL3DBarChartDialogController.hxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_GL3DBARCHARTDIALOGCONTROLLER_HXX
-#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_GL3DBARCHARTDIALOGCONTROLLER_HXX
-
-#include "ChartTypeDialogController.hxx"
-
-namespace chart {
-
-class GL3DBarChartDialogController : public ChartTypeDialogController
-{
-public:
- GL3DBarChartDialogController();
- virtual ~GL3DBarChartDialogController() override;
-
- virtual bool shouldShow_GL3DResourceGroup() const override;
-
- virtual OUString getName() override;
- virtual Image getImage() override;
- virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override;
-
- virtual void fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter ) override;
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 79a66e74034d..13e81edf86ed 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -24,7 +24,6 @@
#include <DiagramHelper.hxx>
#include "res_BarGeometry.hxx"
#include <ControllerLockGuard.hxx>
-#include "GL3DBarChartDialogController.hxx"
#include <unonames.hxx>
#include <svtools/controldims.hxx>
@@ -261,48 +260,6 @@ IMPL_LINK_NOARG(StackingResourceGroup, StackingEnableHdl, CheckBox&, void)
m_pChangeListener->stateChanged(this);
}
-class GL3DResourceGroup : public ChangingResource
-{
-public:
- explicit GL3DResourceGroup( VclBuilderContainer* pWindow );
-
- void showControls( bool bShow );
- void fillControls( const ChartTypeParameter& rParam );
- void fillParameter( ChartTypeParameter& rParam );
-
-private:
- DECL_LINK( SettingChangedHdl, CheckBox&, void );
-private:
- VclPtr<CheckBox> m_pCB_RoundedEdge;
-};
-
-GL3DResourceGroup::GL3DResourceGroup( VclBuilderContainer* pWindow )
-{
- pWindow->get(m_pCB_RoundedEdge, "rounded-edge");
- m_pCB_RoundedEdge->SetToggleHdl( LINK(this, GL3DResourceGroup, SettingChangedHdl) );
-}
-
-void GL3DResourceGroup::showControls( bool bShow )
-{
- m_pCB_RoundedEdge->Show(bShow);
-}
-
-void GL3DResourceGroup::fillControls( const ChartTypeParameter& rParam )
-{
- m_pCB_RoundedEdge->Check(rParam.mbRoundedEdge);
-}
-
-void GL3DResourceGroup::fillParameter( ChartTypeParameter& rParam )
-{
- rParam.mbRoundedEdge = m_pCB_RoundedEdge->IsChecked();
-}
-
-IMPL_LINK_NOARG( GL3DResourceGroup, SettingChangedHdl, CheckBox&, void )
-{
- if (m_pChangeListener)
- m_pChangeListener->stateChanged(this);
-}
-
class SplinePropertiesDialog : public weld::GenericDialogController
{
public:
@@ -662,7 +619,6 @@ ChartTypeTabPage::ChartTypeTabPage(vcl::Window* pParent
, m_pSplineResourceGroup( new SplineResourceGroup(this) )
, m_pGeometryResourceGroup( new GeometryResourceGroup( this ) )
, m_pSortByXValuesResourceGroup( new SortByXValuesResourceGroup( this ) )
- , m_pGL3DResourceGroup(new GL3DResourceGroup(this))
, m_xChartModel( xChartModel )
, m_aChartTypeDialogControllerList(0)
, m_pCurrentMainType(nullptr)
@@ -728,8 +684,6 @@ ChartTypeTabPage::ChartTypeTabPage(vcl::Window* pParent
m_aChartTypeDialogControllerList.emplace_back(new CombiColumnLineChartDialogController() );
SvtMiscOptions aOpts;
- if ( aOpts.IsExperimentalMode() )
- m_aChartTypeDialogControllerList.emplace_back(new GL3DBarChartDialogController());
for (auto const& elem : m_aChartTypeDialogControllerList)
{
@@ -742,7 +696,6 @@ ChartTypeTabPage::ChartTypeTabPage(vcl::Window* pParent
m_pSplineResourceGroup->setChangeListener( this );
m_pGeometryResourceGroup->setChangeListener( this );
m_pSortByXValuesResourceGroup->setChangeListener( this );
- m_pGL3DResourceGroup->setChangeListener(this);
}
ChartTypeTabPage::~ChartTypeTabPage()
@@ -761,7 +714,6 @@ void ChartTypeTabPage::dispose()
m_pSplineResourceGroup.reset();
m_pGeometryResourceGroup.reset();
m_pSortByXValuesResourceGroup.reset();
- m_pGL3DResourceGroup.reset();
m_pFT_ChooseType.clear();
m_pMainTypeList.clear();
m_pSubTypeList.clear();
@@ -777,7 +729,6 @@ ChartTypeParameter ChartTypeTabPage::getCurrentParamter() const
m_pSplineResourceGroup->fillParameter( aParameter );
m_pGeometryResourceGroup->fillParameter( aParameter );
m_pSortByXValuesResourceGroup->fillParameter( aParameter );
- m_pGL3DResourceGroup->fillParameter(aParameter);
return aParameter;
}
@@ -902,8 +853,6 @@ void ChartTypeTabPage::showAllControls( ChartTypeDialogController& rTypeControll
m_pGeometryResourceGroup->showControls( bShow );
bShow = rTypeController.shouldShow_SortByXValuesResourceGroup();
m_pSortByXValuesResourceGroup->showControls( bShow );
- bShow = rTypeController.shouldShow_GL3DResourceGroup();
- m_pGL3DResourceGroup->showControls(bShow);
rTypeController.showExtraControls(this);
}
@@ -920,7 +869,6 @@ void ChartTypeTabPage::fillAllControls( const ChartTypeParameter& rParameter, bo
m_pSplineResourceGroup->fillControls( rParameter );
m_pGeometryResourceGroup->fillControls( rParameter );
m_pSortByXValuesResourceGroup->fillControls( rParameter );
- m_pGL3DResourceGroup->fillControls(rParameter);
m_nChangingCalls--;
}
@@ -981,7 +929,6 @@ void ChartTypeTabPage::initializePage()
m_pSplineResourceGroup->showControls( false );
m_pGeometryResourceGroup->showControls( false );
m_pSortByXValuesResourceGroup->showControls( false );
- m_pGL3DResourceGroup->showControls(false);
}
}
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx
index 2be2646761c0..8da17cb9781e 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.hxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.hxx
@@ -43,7 +43,6 @@ class SplineResourceGroup;
class GeometryResourceGroup;
class ChartTypeParameter;
class SortByXValuesResourceGroup;
-class GL3DResourceGroup;
class ChartTypeTabPage final : public ResourceChangeListener, public svt::OWizardPage, public ChartTypeTemplateProvider
{
@@ -82,7 +81,6 @@ private:
std::unique_ptr<SplineResourceGroup> m_pSplineResourceGroup;
std::unique_ptr<GeometryResourceGroup> m_pGeometryResourceGroup;
std::unique_ptr<SortByXValuesResourceGroup> m_pSortByXValuesResourceGroup;
- std::unique_ptr<GL3DResourceGroup> m_pGL3DResourceGroup;
css::uno::Reference< css::chart2::XChartDocument > m_xChartModel;
diff --git a/chart2/source/controller/inc/ChartWindow.hxx b/chart2/source/controller/inc/ChartWindow.hxx
index e4020c64e114..dc754a3651c9 100644
--- a/chart2/source/controller/inc/ChartWindow.hxx
+++ b/chart2/source/controller/inc/ChartWindow.hxx
@@ -82,7 +82,6 @@ private:
ChartController* m_pWindowController;
bool m_bInPaint;
VclPtr<vcl::Window> m_pViewShellWindow;
- VclPtr<vcl::Window> m_pOpenGLWindow;
void adjustHighContrastMode();
};
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index c42390ad9b53..b0c27a4e6a43 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -796,10 +796,6 @@ void SAL_CALL ChartController::dispose()
//--release all resources and references
{
- uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(getModel(), uno::UNO_QUERY);
- if(x3DWindowProvider.is())
- x3DWindowProvider->setWindow(0);
-
uno::Reference< util::XModeChangeBroadcaster > xViewBroadcaster( m_xChartView, uno::UNO_QUERY );
if( xViewBroadcaster.is() )
xViewBroadcaster->removeModeChangeListener(this);
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index a0f7c31de47d..0453a6ed48d3 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -23,10 +23,8 @@
#include <uiobject.hxx>
#include <vcl/help.hxx>
-#include <vcl/openglwin.hxx>
#include <vcl/settings.hxx>
#include <config_features.h>
-#include <com/sun/star/chart2/X3DChartWindowProvider.hpp>
#include <sfx2/ipclient.hxx>
#include <sfx2/viewsh.hxx>
@@ -58,11 +56,6 @@ ChartWindow::ChartWindow( ChartController* pController, vcl::Window* pParent, Wi
, m_pWindowController( pController )
, m_bInPaint(false)
, m_pViewShellWindow( nullptr )
-#if HAVE_FEATURE_OPENGL
- , m_pOpenGLWindow(VclPtr<OpenGLWindow>::Create(this, false))
-#else
- , m_pOpenGLWindow(nullptr)
-#endif
{
set_id("chart_window");
SetHelpId( HID_SCH_WIN_DOCUMENT );
@@ -73,17 +66,6 @@ ChartWindow::ChartWindow( ChartController* pController, vcl::Window* pParent, Wi
EnableRTL( false );
if( pParent )
pParent->EnableRTL( false );// #i96215# necessary for a correct position of the context menu in rtl mode
-
- if( m_pOpenGLWindow )
- {
- m_pOpenGLWindow->Show();
- uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(pController->getModel(), uno::UNO_QUERY_THROW);
- sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow.get());
- x3DWindowProvider->setWindow(nWindowPtr);
- uno::Reference<util::XUpdatable> const xUpdatable(x3DWindowProvider,
- uno::UNO_QUERY_THROW);
- xUpdatable->update();
- }
}
ChartWindow::~ChartWindow()
@@ -93,15 +75,6 @@ ChartWindow::~ChartWindow()
void ChartWindow::dispose()
{
- if (m_pWindowController && m_pWindowController->getModel().is())
- {
- uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(m_pWindowController->getModel(), uno::UNO_QUERY_THROW);
- x3DWindowProvider->setWindow(0);
- uno::Reference<util::XUpdatable> const xUpdatable(x3DWindowProvider,
- uno::UNO_QUERY_THROW);
- xUpdatable->update();
- }
- m_pOpenGLWindow.disposeAndClear();
m_pViewShellWindow.clear();
vcl::Window::dispose();
}
@@ -122,11 +95,7 @@ void ChartWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
return;
m_bInPaint = true;
- if (m_pOpenGLWindow && m_pOpenGLWindow->IsVisible())
- {
- m_pOpenGLWindow->Paint(rRenderContext, rRect);
- }
- else if (m_pWindowController)
+ if (m_pWindowController)
{
m_pWindowController->execute_Paint(rRenderContext, rRect);
}
@@ -173,9 +142,6 @@ void ChartWindow::Resize()
m_pWindowController->execute_Resize();
else
Window::Resize();
-
- if( m_pOpenGLWindow )
- m_pOpenGLWindow->SetSizePixel(GetSizePixel());
}
void ChartWindow::Activate()
@@ -293,40 +259,24 @@ void ChartWindow::adjustHighContrastMode()
void ChartWindow::ForceInvalidate()
{
vcl::Window::Invalidate();
- if(m_pOpenGLWindow)
- {
- m_pOpenGLWindow->Invalidate();
- }
}
void ChartWindow::Invalidate( InvalidateFlags nFlags )
{
if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
return;
vcl::Window::Invalidate( nFlags );
- if(m_pOpenGLWindow)
- {
- m_pOpenGLWindow->Invalidate( nFlags );
- }
}
void ChartWindow::Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags )
{
if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
return;
vcl::Window::Invalidate( rRect, nFlags );
- if(m_pOpenGLWindow)
- {
- m_pOpenGLWindow->Invalidate( rRect, nFlags );
- }
}
void ChartWindow::Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags )
{
if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
return;
vcl::Window::Invalidate( rRegion, nFlags );
- if(m_pOpenGLWindow)
- {
- m_pOpenGLWindow->Invalidate( rRegion, nFlags );
- }
}
void ChartWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
diff --git a/chart2/source/inc/FastPropertyIdRanges.hxx b/chart2/source/inc/FastPropertyIdRanges.hxx
index d848babacde1..a2572c5117fc 100644
--- a/chart2/source/inc/FastPropertyIdRanges.hxx
+++ b/chart2/source/inc/FastPropertyIdRanges.hxx
@@ -41,7 +41,6 @@ enum FastPropertyIdRanges
FAST_PROPERTY_ID_START_CHART_STOCK_PROP = FAST_PROPERTY_ID_START + 16000,
FAST_PROPERTY_ID_START_CHART_AUTOPOSITION_PROP = FAST_PROPERTY_ID_START + 17000,
FAST_PROPERTY_ID_START_SCALE_TEXT_PROP = FAST_PROPERTY_ID_START + 18000,
- FAST_PROPERTY_ID_START_GL_3D = FAST_PROPERTY_ID_START + 19000
};
} // namespace chart
diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx
index 6fc24d10b789..9a1ee83db019 100644
--- a/chart2/source/inc/servicenames_charttypes.hxx
+++ b/chart2/source/inc/servicenames_charttypes.hxx
@@ -31,7 +31,6 @@ namespace chart {
#define CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET "com.sun.star.chart2.FilledNetChartType"
#define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK "com.sun.star.chart2.CandleStickChartType"
#define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE "com.sun.star.chart2.BubbleChartType"
-#define CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR "com.sun.star.chart2.GL3DBarChartType"
} //namespace chart
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 4eabcba9560c..2560796e6c61 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -35,8 +35,6 @@
#include <ModifyListenerHelper.hxx>
#include <svx/charthelper.hxx>
-#include <vcl/openglwin.hxx>
-
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart2/data/XPivotTableDataProvider.hpp>
@@ -114,9 +112,6 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
"com.sun.star.xml.NamespaceMap", "com.sun.star.comp.chart.XMLNameSpaceMap" ), uno::UNO_QUERY)
, mnStart(0)
, mnEnd(0)
-#if HAVE_FEATURE_OPENGL
- , mpOpenGLWindow(nullptr)
-#endif
{
osl_atomic_increment(&m_refCount);
{
@@ -158,9 +153,6 @@ ChartModel::ChartModel( const ChartModel & rOther )
, m_xInternalDataProvider( rOther.m_xInternalDataProvider )
, mnStart(rOther.mnStart)
, mnEnd(rOther.mnEnd)
-#if HAVE_FEATURE_OPENGL
- , mpOpenGLWindow(nullptr)
-#endif
{
osl_atomic_increment(&m_refCount);
{
@@ -946,11 +938,6 @@ void SAL_CALL ChartModel::createDefaultChart()
insertDefaultChart();
}
-sal_Bool SAL_CALL ChartModel::isOpenGLChart()
-{
- return ChartHelper::isGL3DDiagram(m_xDiagram);
-}
-
// ____ XTitled ____
uno::Reference< chart2::XTitle > SAL_CALL ChartModel::getTitleObject()
{
@@ -1309,16 +1296,6 @@ void ChartModel::setTimeBasedRange(sal_Int32 nStart, sal_Int32 nEnd)
mbTimeBased = true;
}
-void ChartModel::setWindow( const sal_uInt64 nWindowPtr )
-{
-#if HAVE_FEATURE_OPENGL
- OpenGLWindow* pWindow = reinterpret_cast<OpenGLWindow*>(nWindowPtr);
- mpOpenGLWindow = pWindow;
-#else
- (void)nWindowPtr;
-#endif
-}
-
void ChartModel::update()
{
if(!mxChartView.is())
@@ -1327,9 +1304,6 @@ void ChartModel::update()
}
mxChartView->setViewDirty();
mxChartView->update();
-#if HAVE_FEATURE_OPENGL
- mxChartView->updateOpenGLWindow();
-#endif
}
bool ChartModel::isDataFromSpreadsheet()
diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx
index 6028279d8b35..44684adb2c6c 100644
--- a/chart2/source/model/template/ChartTypeManager.cxx
+++ b/chart2/source/model/template/ChartTypeManager.cxx
@@ -32,9 +32,6 @@
#include "NetChartTypeTemplate.hxx"
#include "BubbleChartTypeTemplate.hxx"
#include <config_features.h>
-#if HAVE_FEATURE_OPENGL
-#include "GL3DBarChartTypeTemplate.hxx"
-#endif
#include <cppuhelper/component_context.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
@@ -123,8 +120,6 @@ enum TemplateId
TEMPLATE_STOCKVOLUMELOWHIGHCLOSE,
TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE,
TEMPLATE_BUBBLE,
- TEMPLATE_GL3DBAR,
- TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE,
// TEMPLATE_SURFACE,
// TEMPLATE_ADDIN,
TEMPLATE_NOT_FOUND = 0xffff
@@ -199,8 +194,6 @@ const tTemplateMapType & lcl_DefaultChartTypeMap()
{"com.sun.star.chart2.template.StockVolumeLowHighClose", TEMPLATE_STOCKVOLUMELOWHIGHCLOSE},
{"com.sun.star.chart2.template.StockVolumeOpenLowHighClose", TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE},
{"com.sun.star.chart2.template.Bubble", TEMPLATE_BUBBLE},
- {"com.sun.star.chart2.template.GL3DBar", TEMPLATE_GL3DBAR},
- {"com.sun.star.chart2.template.GL3DBarRoundedRectangle", TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE},
// {"com.sun.star.chart2.template.Surface", TEMPLATE_SURFACE},
// {"com.sun.star.chart2.template.Addin", TEMPLATE_ADDIN},
};
@@ -530,16 +523,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance(
case TEMPLATE_BUBBLE:
xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier ));
break;
-#if HAVE_FEATURE_OPENGL
- case TEMPLATE_GL3DBAR:
- xTemplate.set(new GL3DBarChartTypeTemplate(m_xContext, aServiceSpecifier));
- break;
- case TEMPLATE_GL3DBAR_ROUNDED_RECTANGLE:
- xTemplate.set(new GL3DBarChartTypeTemplate(m_xContext, aServiceSpecifier));
- break;
-#else
default: break;
-#endif
// case TEMPLATE_SURFACE:
// case TEMPLATE_ADDIN:
// break;
diff --git a/chart2/source/model/template/GL3DBarChartType.cxx b/chart2/source/model/template/GL3DBarChartType.cxx
deleted file mode 100644
index 34f7a516307c..000000000000
--- a/chart2/source/model/template/GL3DBarChartType.cxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- 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/.
- */
-
-#include "GL3DBarChartType.hxx"
-#include <servicenames_charttypes.hxx>
-#include <PropertyHelper.hxx>
-#include <unonames.hxx>
-#include <cppuhelper/supportsservice.hxx>
-
-#include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-using namespace com::sun::star;
-
-namespace chart {
-
-namespace {
-
-enum
-{
- PROP_GL3DCHARTTYPE_ROUNDED_EDGE
-};
-
-struct DefaultsInitializer
-{
- tPropertyValueMap* operator()()
- {
- static tPropertyValueMap aStaticDefaults;
-
- if (aStaticDefaults.empty())
- addDefaults(aStaticDefaults);
-
- return &aStaticDefaults;
- }
-private:
-
- static void addDefaults( tPropertyValueMap & rOutMap )
- {
- PropertyHelper::setPropertyValueDefault(rOutMap, PROP_GL3DCHARTTYPE_ROUNDED_EDGE, false);
- }
-};
-
-struct Defaults : public rtl::StaticAggregate<tPropertyValueMap, DefaultsInitializer> {};
-
-struct InfoHelperInitializer
-{
- cppu::OPropertyArrayHelper* operator()()
- {
- static cppu::OPropertyArrayHelper aHelper(getProperties());
- return &aHelper;
- }
-
- static uno::Sequence<beans::Property> getProperties()
- {
- uno::Sequence<beans::Property> aRet(1);
-
- aRet[0] = beans::Property(
- CHART_UNONAME_ROUNDED_EDGE,
- PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
- cppu::UnoType<bool>::get(),
- beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT);
-
- return aRet;
- }
-};
-
-struct InfoHelper : public rtl::StaticAggregate<cppu::OPropertyArrayHelper, InfoHelperInitializer> {};
-
-struct ChartTypeInfoInitializer
-{
- uno::Reference<beans::XPropertySetInfo>* operator()()
- {
- static uno::Reference<beans::XPropertySetInfo> xPropertySetInfo;
-
- if (!xPropertySetInfo.is())
- xPropertySetInfo = cppu::OPropertySetHelper::createPropertySetInfo(*InfoHelper::get());
-
- return &xPropertySetInfo;
- }
-};
-
-struct ChartTypeInfo : public rtl::StaticAggregate<uno::Reference<beans::XPropertySetInfo>, ChartTypeInfoInitializer> {};
-
-}
-
-GL3DBarChartType::GL3DBarChartType()
-{
-}
-
-GL3DBarChartType::GL3DBarChartType( const GL3DBarChartType& rOther ) :
- ChartType(rOther)
-{
-}
-
-GL3DBarChartType::~GL3DBarChartType() {}
-
-OUString SAL_CALL GL3DBarChartType::getImplementationName()
-{
- return OUString("com.sun.star.comp.chart.GL3DBarChartType");
-}
-
-sal_Bool SAL_CALL GL3DBarChartType::supportsService( const OUString& rServiceName )
-{
- return cppu::supportsService(this, rServiceName);
-}
-
-css::uno::Sequence< OUString > SAL_CALL GL3DBarChartType::getSupportedServiceNames()
-{
- return {
- CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR,
- "com.sun.star.chart2.ChartType",
- "com.sun.star.beans.PropertySet" };
-}
-
-OUString SAL_CALL GL3DBarChartType::getChartType()
-{
- return OUString(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR);
-}
-
-uno::Sequence<OUString> GL3DBarChartType::getSupportedPropertyRoles()
-{
- uno::Sequence< OUString > aPropRoles { "FillColor" };
-
- return aPropRoles;
-}
-
-css::uno::Reference<css::util::XCloneable>
-GL3DBarChartType::createClone()
-{
- return uno::Reference<util::XCloneable>(new GL3DBarChartType(*this));
-}
-
-css::uno::Any GL3DBarChartType::GetDefaultValue( sal_Int32 nHandle ) const
-{
- const tPropertyValueMap& rDefaults = *Defaults::get();
- tPropertyValueMap::const_iterator it = rDefaults.find(nHandle);
- return it == rDefaults.end() ? uno::Any() : it->second;
-}
-
-cppu::IPropertyArrayHelper& GL3DBarChartType::getInfoHelper()
-{
- return *InfoHelper::get();
-}
-
-css::uno::Reference<css::beans::XPropertySetInfo> GL3DBarChartType::getPropertySetInfo()
-{
- return *ChartTypeInfo::get();
-}
-
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
-com_sun_star_comp_chart_GL3DBarChartType_get_implementation(css::uno::XComponentContext * /*context*/,
- css::uno::Sequence<css::uno::Any> const &)
-{
- return cppu::acquire(new ::chart::GL3DBarChartType);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/GL3DBarChartType.hxx b/chart2/source/model/template/GL3DBarChartType.hxx
deleted file mode 100644
index 09bacd33c803..000000000000
--- a/chart2/source/model/template/GL3DBarChartType.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_GL3DBARCHARTTYPE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_GL3DBARCHARTTYPE_HXX
-
-#include "ChartType.hxx"
-
-namespace chart {
-
-/**
- * Chart type that represents 3 dimensional data content in 3D space using
- * OpenGL.
- */
-class GL3DBarChartType final : public ChartType
-{
-public:
- explicit GL3DBarChartType();
- virtual ~GL3DBarChartType() override;
-
- virtual css::uno::Sequence< OUString > SAL_CALL
- getSupportedPropertyRoles() override;
- virtual OUString SAL_CALL
- getImplementationName() override;
- virtual sal_Bool SAL_CALL
- supportsService( const OUString& ServiceName ) override;
- virtual css::uno::Sequence< OUString > SAL_CALL
- getSupportedServiceNames() override;
-
-private:
- GL3DBarChartType( const GL3DBarChartType& rOther );
-
- virtual OUString SAL_CALL getChartType() override;
-
- virtual css::uno::Reference<css::util::XCloneable> SAL_CALL
- createClone() override;
-
- // OPropertySet
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
-
- virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
-
- // XPropertySet
- virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL
- getPropertySetInfo() override;
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
deleted file mode 100644
index ba7022da71b5..000000000000
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
+++ /dev/null
@@ -1,195 +0,0 @@
-/* -*- 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/.
- */
-
-#include "GL3DBarChartTypeTemplate.hxx"
-#include "GL3DBarChartType.hxx"
-
-#include <servicenames_charttypes.hxx>
-#include <PropertyHelper.hxx>
-#include <DiagramHelper.hxx>
-#include <unonames.hxx>
-
-#include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <tools/diagnose_ex.h>
-
-using namespace com::sun::star;
-
-namespace chart {
-
-namespace {
-
-enum
-{
- PROP_GL3DCHARTTYPE_ROUNDED_EDGE
-};
-
-struct DefaultsInitializer
-{
- tPropertyValueMap* operator()()
- {
- static tPropertyValueMap aStaticDefaults;
-
- if (aStaticDefaults.empty())
- addDefaults(aStaticDefaults);
-
- return &aStaticDefaults;
- }
-private:
-
- static void addDefaults( tPropertyValueMap & rOutMap )
- {
- PropertyHelper::setPropertyValueDefault(rOutMap, PROP_GL3DCHARTTYPE_ROUNDED_EDGE, false);
- }
-};
-
-struct Defaults : public rtl::StaticAggregate<tPropertyValueMap, DefaultsInitializer> {};
-
-struct InfoHelperInitializer
-{
- cppu::OPropertyArrayHelper* operator()()
- {
- static cppu::OPropertyArrayHelper aHelper(getProperties());
- return &aHelper;
- }
-
- static uno::Sequence<beans::Property> getProperties()
- {
- uno::Sequence<beans::Property> aRet(1);
-
- aRet[0] = beans::Property(
- CHART_UNONAME_ROUNDED_EDGE,
- PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
- cppu::UnoType<bool>::get(),
- beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT);
-
- return aRet;
- }
-};
-
-struct InfoHelper : public rtl::StaticAggregate<cppu::OPropertyArrayHelper, InfoHelperInitializer> {};
-
-struct ChartTypeInfoInitializer
-{
- uno::Reference<beans::XPropertySetInfo>* operator()()
- {
- static uno::Reference<beans::XPropertySetInfo> xPropertySetInfo;
-
- if (!xPropertySetInfo.is())
- xPropertySetInfo = cppu::OPropertySetHelper::createPropertySetInfo(*InfoHelper::get());
-
- return &xPropertySetInfo;
- }
-};
-
-struct ChartTypeInfo : public rtl::StaticAggregate<uno::Reference<beans::XPropertySetInfo>, ChartTypeInfoInitializer> {};
-
-}
-
-GL3DBarChartTypeTemplate::GL3DBarChartTypeTemplate(
- const uno::Reference<uno::XComponentContext>& xContext, const OUString& rServiceName ) :
- property::OPropertySet(m_aMutex),
- ChartTypeTemplate(xContext, rServiceName) {}
-
-GL3DBarChartTypeTemplate::~GL3DBarChartTypeTemplate() {}
-
-uno::Reference<chart2::XChartType> GL3DBarChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
-{
- uno::Reference<chart2::XChartType> xResult;
-
- try
- {
- uno::Reference<lang::XMultiServiceFactory> xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW);
-
- xResult.set(xFact->createInstance(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR), uno::UNO_QUERY_THROW);
-
- uno::Reference<beans::XPropertySet> xCTProp(xResult, uno::UNO_QUERY);
- if (xCTProp.is())
- {
- xCTProp->setPropertyValue(
- CHART_UNONAME_ROUNDED_EDGE, getFastPropertyValue(PROP_GL3DCHARTTYPE_ROUNDED_EDGE));
- }
- }
- catch (const uno::Exception &)
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
-}
-
-sal_Bool SAL_CALL GL3DBarChartTypeTemplate::matchesTemplate(
- const css::uno::Reference<css::chart2::XDiagram>& xDiagram,
- sal_Bool bAdaptProperties )
-{
- bool bResult = ChartTypeTemplate::matchesTemplate(xDiagram, bAdaptProperties);
-
- if (bResult && bAdaptProperties)
- {
- uno::Reference<chart2::XChartType> xChartType = DiagramHelper::getChartTypeByIndex(xDiagram, 0);
- uno::Reference<beans::XPropertySet> xPS(xChartType, uno::UNO_QUERY);
- if (xPS.is())
- {
- setFastPropertyValue_NoBroadcast(
- PROP_GL3DCHARTTYPE_ROUNDED_EDGE, xPS->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE));
- }
- }
-
- return bResult;
-}
-
-uno::Reference<chart2::XChartType>
-GL3DBarChartTypeTemplate::getChartTypeForNewSeries( const uno::Sequence<uno::Reference<chart2::XChartType> >& /*xOldChartTypes*/ )
-{
- uno::Reference<chart2::XChartType> xResult;
-
- try
- {
- rtl::Reference<GL3DBarChartType> chart(new GL3DBarChartType());
- bool bVal = false;
- getFastPropertyValue(PROP_GL3DCHARTTYPE_ROUNDED_EDGE) >>= bVal;
- chart->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, uno::Any(bVal));
- xResult = chart.get();
- }
- catch (const uno::Exception &)
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
-}
-
-sal_Bool GL3DBarChartTypeTemplate::supportsCategories()
-{
- return false;
-}
-
-css::uno::Any GL3DBarChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
-{
- const tPropertyValueMap& rDefaults = *Defaults::get();
- tPropertyValueMap::const_iterator it = rDefaults.find(nHandle);
- return it == rDefaults.end() ? uno::Any() : it->second;
-}
-
-cppu::IPropertyArrayHelper& GL3DBarChartTypeTemplate::getInfoHelper()
-{
- return *InfoHelper::get();
-}
-
-css::uno::Reference<css::beans::XPropertySetInfo> GL3DBarChartTypeTemplate::getPropertySetInfo()
-{
- return *ChartTypeInfo::get();
-}
-
-IMPLEMENT_FORWARD_XINTERFACE2(GL3DBarChartTypeTemplate, ChartTypeTemplate, OPropertySet)
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
deleted file mode 100644
index 3b24ecebf2f9..000000000000
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_GL3DBARCHARTTYPETEMPLATE_HXX
-#define INCLUDED_CHART2_SOURCE_MODEL_TEMPLATE_GL3DBARCHARTTYPETEMPLATE_HXX
-
-#include <MutexContainer.hxx>
-#include "ChartTypeTemplate.hxx"
-#include <OPropertySet.hxx>
-
-#include <comphelper/uno3.hxx>
-
-namespace chart {
-
-class GL3DBarChartTypeTemplate :
- public MutexContainer, public property::OPropertySet, public ChartTypeTemplate
-{
-public:
-
- DECLARE_XINTERFACE()
-
- GL3DBarChartTypeTemplate(
- const css::uno::Reference<
- css::uno::XComponentContext>& xContext,
- const OUString& rServiceName );
-
- virtual ~GL3DBarChartTypeTemplate() override;
-
- virtual css::uno::Reference<css::chart2::XChartType> getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
-
- // XChartTypeTemplate
-
- virtual sal_Bool SAL_CALL matchesTemplate(
- const css::uno::Reference<css::chart2::XDiagram>& xDiagram,
- sal_Bool bAdaptProperties ) override;
-
- virtual css::uno::Reference<css::chart2::XChartType> SAL_CALL
- getChartTypeForNewSeries( const css::uno::Sequence<css::uno::Reference<css::chart2::XChartType> >& xOldChartTypes ) override;
-
- virtual sal_Bool SAL_CALL supportsCategories() override;
-
- // OPropertySet
- virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override;
-
- virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
-
- // XPropertySet
- virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL
- getPropertySetInfo() override;
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
deleted file mode 100644
index 644b168798e5..000000000000
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ /dev/null
@@ -1,1503 +0,0 @@
-/* -*- 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/.
- */
-
-#include <GL3DBarChart.hxx>
-#include <vcl/opengl/OpenGLContext.hxx>
-#include <vcl/idle.hxx>
-#include <epoxy/gl.h>
-
-#include <cmath>
-#include <glm/glm.hpp>
-#include <glm/gtx/transform.hpp>
-
-#include <3DChartObjects.hxx>
-#include <GL3DRenderer.hxx>
-#include <ExplicitCategoriesProvider.hxx>
-#include <DataSeriesHelper.hxx>
-#include <VDataSeries.hxx>
-#include <salhelper/thread.hxx>
-
-#include <osl/time.h>
-#ifdef _WIN32
-#if !defined WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#endif
-#include <memory>
-#include <o3tl/make_unique.hxx>
-
-#define CALC_POS_EVENT_ID 1
-#define SHAPE_START_ID 10
-#define FPS_TIME 500
-#define DATAUPDATE_FPS_TIME 1000
-#define HISTORY_NUM 51
-#define COLUMNSIZE 25
-#define SHOW_VALUE_COUNT 15
-#define SHOW_SCROLL_TEXT_DISTANCE 1000
-#define FLY_THRESHOLD 20
-#define DISPLAY_BARS_NUM 3
-
-
-using namespace com::sun::star;
-
-namespace chart {
-
-const size_t STEPS = 200;
-const size_t STEPS_UPDATE = 100;
-namespace {
-
-const float TEXT_HEIGHT = 10.0f;
-float DEFAULT_CAMERA_HEIGHT = 500.0f;
-const sal_uInt32 ID_STEP = 10;
-
-const float BAR_SIZE_X = 30.0f;
-const float BAR_SIZE_Y = 5.0f;
-const float BAR_DISTANCE_X = 5.0f;
-const float BAR_DISTANCE_Y = 5.0;
-
-float calculateTextWidth(const OUString& rText)
-{
- return rText.getLength() * 10;
-}
-
-double findMaxValue(const std::vector<std::unique_ptr<VDataSeries> >& rDataSeriesContainer)
-{
- double nMax = 0.0;
- for (const std::unique_ptr<VDataSeries>& rDataSeries : rDataSeriesContainer)
- {
- sal_Int32 nPointCount = rDataSeries->getTotalPointCount();
- for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex)
- {
- double nVal = rDataSeries->getYValue(nIndex);
- nMax = std::max(nMax, nVal);
- }
- }
- return nMax;
-}
-
-class SharedResourceAccess
-{
-private:
- osl::Condition& mrCond2;
-
-public:
-
- SharedResourceAccess(osl::Condition& rCond1, osl::Condition& rCond2):
- mrCond2(rCond2)
- {
- rCond1.set();
- }
-
- ~SharedResourceAccess()
- {
- mrCond2.set();
- }
-};
-
-}
-
-class RenderThread : public salhelper::Thread
-{
-public:
- explicit RenderThread(GL3DBarChart* pChart);
-
-protected:
-
- void renderFrame();
- GL3DBarChart* mpChart;
-};
-
-RenderThread::RenderThread(GL3DBarChart* pChart):
- salhelper::Thread("RenderThread"),
- mpChart(pChart)
-{
-}
-
-void RenderThread::renderFrame()
-{
- if(!mpChart->mbValidContext)
- return;
-
- mpChart->mpWindow->getContext().makeCurrent();
- mpChart->renderFrame();
- // FIXME: SwapBuffers can take a considerable time, it'd be
- // nice if we didn't hold the chart mutex while doing that.
- mpChart->mpWindow->getContext().swapBuffers();
- mpChart->mpWindow->getContext().resetCurrent();
-}
-
-class RenderOneFrameThread : public RenderThread
-{
-public:
- explicit RenderOneFrameThread(GL3DBarChart* pChart):
- RenderThread(pChart)
- {}
-
-protected:
-
- virtual void execute() override;
-};
-
-void RenderOneFrameThread::execute()
-{
- osl::MutexGuard aGuard(mpChart->maMutex);
- renderFrame();
-}
-
-class RenderAnimationThread : public RenderThread
-{
-public:
- RenderAnimationThread(GL3DBarChart* pChart, const glm::vec3& rStartPos, const glm::vec3& rEndPos,
- const sal_Int32 nSteps):
- RenderThread(pChart),
- maStartPos(rStartPos),
- maEndPos(rEndPos),
- mnSteps(nSteps)
- {
- }
-
-protected:
-
- virtual void execute() override;
-
-private:
- glm::vec3 maStartPos;
- glm::vec3 maEndPos;
- sal_Int32 mnSteps;
-
-};
-
-void RenderAnimationThread::execute()
-{
- osl::MutexGuard aGuard(mpChart->maMutex);
- glm::vec3 aStep = (maEndPos - maStartPos)/static_cast<float>(mnSteps);
- for(sal_Int32 i = 0; i < mnSteps; ++i)
- {
- mpChart->maCameraPosition += aStep;
- mpChart->mpCamera->setPosition(mpChart->maCameraPosition);
- /*
- mpChart->maCameraDirection += mpChart->maStepDirection;
- mpChart->mpCamera->setDirection(mpChart->maCameraDirection);
- */
- renderFrame();
- }
- mpChart->mpRenderer->ReleaseScreenTextShapes();
-}
-
-class RenderBenchMarkThread : public RenderThread
-{
-public:
- explicit RenderBenchMarkThread(GL3DBarChart * pChart)
- : RenderThread(pChart)
- , mbAutoFlyExecuting(false)
- , mbExecuting(false)
- , mbNeedFlyBack(false)
- , mnStep(0)
- , mnStepsTotal(0)
- {
- osl_getSystemTime(&maClickFlyBackStartTime);
- osl_getSystemTime(&maClickFlyBackEndTime);
- }
-protected:
- virtual void execute() override;
-private:
- void ProcessMouseEvent();
- void MoveCamera();
- void MoveCameraToBar();
- void MoveToBar();
- void MoveToSelectedBar();
- void MoveToDefault();
- void MoveToCorner();
- void ProcessScroll();
- void UpdateScreenText();
- void ProcessClickFlyBack();
- void AutoMoveToBar();
-private:
- bool mbAutoFlyExecuting;
- bool mbExecuting;
- bool mbNeedFlyBack;
- glm::vec3 maStep;
- glm::vec3 maStepDirection;
- glm::mat4 maMatrixStep;
- size_t mnStep;
- size_t mnStepsTotal;
- TimeValue maClickFlyBackStartTime;
- TimeValue maClickFlyBackEndTime;
- glm::vec3 maTargetPosition;
- glm::vec3 maTargetDirection;
-};
-
-void RenderBenchMarkThread::MoveCamera()
-{
- if(mnStep < mnStepsTotal)
- {
- ++mnStep;
- mpChart->maCameraPosition += maStep;
- mpChart->mpCamera->setPosition(mpChart->maCameraPosition);
- mpChart->maCameraDirection += maStepDirection;
- mpChart->mpCamera->setDirection(mpChart->maCameraDirection);
- }
- else
- {
- mnStep = 0;
- mbExecuting = false;
- mbAutoFlyExecuting = false;
- mbNeedFlyBack = false;
- mpChart->maRenderEvent = EVENT_NONE;
- }
-}
-
-void RenderBenchMarkThread::MoveCameraToBar()
-{
- if(mnStep < mnStepsTotal)
- {
- ++mnStep;
- mpChart->mpRenderer->AddMatrixDiff(maMatrixStep);
- }
- else
- {
- mpChart->maCameraPosition = maTargetPosition;
- mpChart->maCameraDirection = maTargetDirection;
- mpChart->mpCamera->setPosition(maTargetPosition);
- mpChart->mpCamera->setDirection(maTargetDirection);
- mpChart->mpRenderer->ResetMatrixDiff();
- mnStep = 0;
- mbExecuting = false;
- mbAutoFlyExecuting = false;
- mbNeedFlyBack = true;
- osl_getSystemTime(&maClickFlyBackStartTime);
- osl_getSystemTime(&maClickFlyBackEndTime);
- mpChart->maRenderEvent = EVENT_SHOW_SELECT;
- }
-}
-
-
-void RenderBenchMarkThread::MoveToDefault()
-{
- if ((mpChart->maCameraPosition == mpChart->maDefaultCameraDirection) &&
- (mpChart->maCameraDirection == mpChart->maDefaultCameraDirection))
- {
- mnStep = 0;
- mbExecuting = false;
- mpChart->maRenderEvent = EVENT_NONE;
- return;
- }
- if (!mbExecuting)
- {
- mpChart->mpRenderer->EndClick();
- mnStep = 0;
- mnStepsTotal = STEPS;
- maStep = (mpChart->maDefaultCameraPosition - mpChart->maCameraPosition)/static_cast<float>(mnStepsTotal);
- maStepDirection = (mpChart->maDefaultCameraDirection - mpChart->maCameraDirection)/static_cast<float>(mnStepsTotal);
- mbExecuting = true;
- }
- MoveCamera();
-}
-
-void RenderBenchMarkThread::MoveToBar()
-{
- if (!mbExecuting)
- {
- mpChart->mnSelectBarId = mpChart->barIdAtPosition(mpChart->maClickPos);
-
- std::map<sal_uInt32, const GL3DBarChart::BarInformation>::const_iterator itr = mpChart->maBarMap.find(mpChart->mnSelectBarId);
- if(itr == mpChart->maBarMap.end())
- {
- mpChart->mnSelectBarId = mpChart->mnPreSelectBarId;
- mpChart->maRenderEvent = mpChart->maPreRenderEvent;
- mpChart->maClickCond.set();
- return;
- }
- mpChart->mpRenderer->EndClick();
- const GL3DBarChart::BarInformation& rBarInfo = itr->second;
- mnStep = 0;
- mnStepsTotal = STEPS;
- maTargetPosition = rBarInfo.maPos;
- maTargetPosition.z += 240;
- maTargetPosition.x += BAR_SIZE_X / 2.0f;
- maTargetDirection = rBarInfo.maPos;
- maTargetDirection.x += BAR_SIZE_X / 2.0f;
- maTargetDirection.y += BAR_SIZE_Y / 2.0f;
- maTargetPosition.y = maTargetDirection.y - 240;
- maMatrixStep = mpChart->mpRenderer->GetDiffOfTwoCameras(mpChart->maCameraPosition, maTargetPosition, mpChart->maCameraDirection, maTargetDirection)/static_cast<float>(mnStepsTotal);
- mpChart->maClickCond.set();
- mbExecuting = true;
- mbNeedFlyBack = false;
- mpChart->mpRenderer->StartClick(mpChart->mnSelectBarId);
- }
- MoveCameraToBar();
-}
-
-void RenderBenchMarkThread::MoveToSelectedBar()
-{
- mpChart->mnSelectBarId = mpChart->mnUpdateBarId;
- std::map<sal_uInt32, const GL3DBarChart::BarInformation>::const_iterator itr = mpChart->maBarMap.find(mpChart->mnSelectBarId);
- if(itr == mpChart->maBarMap.end())
- {
- mpChart->mnSelectBarId = mpChart->mnPreSelectBarId;
- mpChart->maRenderEvent = mpChart->maPreRenderEvent;
- mpChart->maClickCond.set();
- return;
- }
- mpChart->mpRenderer->EndClick();
- const GL3DBarChart::BarInformation& rBarInfo = itr->second;
- mnStep = 0;
- mnStepsTotal = STEPS_UPDATE;
- maTargetPosition = rBarInfo.maPos;
- maTargetPosition.z += 240;
- maTargetPosition.x += BAR_SIZE_X / 2.0f;
- maTargetDirection = rBarInfo.maPos;
- maTargetDirection.x += BAR_SIZE_X / 2.0f;
- maTargetDirection.y += BAR_SIZE_Y / 2.0f;
- maTargetPosition.y = maTargetDirection.y - 240;
- maMatrixStep = mpChart->mpRenderer->GetDiffOfTwoCameras( maTargetPosition, maTargetDirection)/static_cast<float>(mnStepsTotal);
- mpChart->maClickCond.set();
- mbExecuting = true;
- mbNeedFlyBack = false;
- mpChart->mpRenderer->StartClick(mpChart->mnSelectBarId);
- mpChart->maRenderEvent = EVENT_CLICK;
-}
-
-void RenderBenchMarkThread::AutoMoveToBar()
-{
- if (!mbAutoFlyExecuting)
- {
- mpChart->mpRenderer->EndClick();
- std::map<sal_uInt32, const GL3DBarChart::BarInformation>::const_iterator itr = mpChart->maBarMap.find(mpChart->mnSelectBarId);
- if(itr == mpChart->maBarMap.end())
- {
- mpChart->maRenderEvent = EVENT_NONE;
- return;
- }
- const GL3DBarChart::BarInformation& rBarInfo = itr->second;
- mnStep = 0;
- mnStepsTotal = STEPS;
- maTargetPosition = rBarInfo.maPos;
- maTargetPosition.z += 240;
- maTargetPosition.x += BAR_SIZE_X / 2.0f;
- maTargetDirection = rBarInfo.maPos;
- maTargetDirection.x += BAR_SIZE_X / 2.0f;
- maTargetDirection.y += BAR_SIZE_Y / 2.0f;
- maTargetPosition.y = maTargetDirection.y - 240;
- maMatrixStep = mpChart->mpRenderer->GetDiffOfTwoCameras(mpChart->maCameraPosition, maTargetPosition, mpChart->maCameraDirection, maTargetDirection)/static_cast<float>(mnStepsTotal);
- mpChart->mpRenderer->StartClick(mpChart->mnSelectBarId);
- mbAutoFlyExecuting = true;
- mbNeedFlyBack = false;
- }
- MoveCameraToBar();
-}
-
-void RenderBenchMarkThread::MoveToCorner()
-{
- if (!mbExecuting)
- {
- mpChart->mpRenderer->EndClick();
- mnStep = 0;
- mnStepsTotal = STEPS;
- maStep = (mpChart->getCornerPosition(mpChart->mnCornerId) - mpChart->maCameraPosition) / float(mnStepsTotal);
- maStepDirection = (glm::vec3(mpChart->mnMaxX/2.0f, mpChart->mnMaxY/2.0f, 0) - mpChart->maCameraDirection)/ float(mnStepsTotal);
- mbExecuting = true;
- }
- MoveCamera();
-}
-
-void RenderBenchMarkThread::ProcessScroll()
-{
- //will add other process later
- mpChart->mpRenderer->EndClick();
- mnStep = 0;
- mnStepsTotal = STEPS;
- mpChart->maRenderEvent = EVENT_SHOW_SCROLL;
-}
-
-void RenderBenchMarkThread::ProcessClickFlyBack()
-{
- if (!mbNeedFlyBack)
- return;
- osl_getSystemTime(&maClickFlyBackEndTime);
- int nDeltaMs = GL3DBarChart::calcTimeInterval(maClickFlyBackStartTime, maClickFlyBackEndTime);
- if(nDeltaMs >= 10000)
- {
- mpChart->maRenderEvent = EVENT_MOVE_TO_DEFAULT;
- }
-}
-
-void RenderBenchMarkThread::ProcessMouseEvent()
-{
- ProcessClickFlyBack();
- if (mpChart->maRenderEvent == EVENT_SELECTBAR_UPDEDATE)
- {
- MoveToSelectedBar();
- }
- else if (mpChart->maRenderEvent == EVENT_CLICK)
- {
- MoveToBar();
- }
- else if (mpChart->maRenderEvent == EVENT_MOVE_TO_DEFAULT)
- {
- MoveToDefault();
- }
- else if ((mpChart->maRenderEvent == EVENT_DRAG_LEFT) || (mpChart->maRenderEvent == EVENT_DRAG_RIGHT))
- {
- MoveToCorner();
- }
- else if (mpChart->maRenderEvent == EVENT_SCROLL)
- {
- ProcessScroll();
- }
- else if (mpChart->maRenderEvent == EVENT_AUTO_FLY)
- {
- AutoMoveToBar();
- }
-
-}
-
-void RenderBenchMarkThread::UpdateScreenText()
-{
- if (mpChart->mbScreenTextNewRender)
- {
- mpChart->mpWindow->getContext().makeCurrent();
- mpChart->mpRenderer->ReleaseScreenTextTexture();
- for(std::unique_ptr<opengl3D::Renderable3DObject>& aObj : mpChart->maScreenTextShapes)
- {
- aObj->render();
- }
- mpChart->mbScreenTextNewRender = false;
- mpChart->mpWindow->getContext().resetCurrent();
- }
-}
-
-void RenderBenchMarkThread::execute()
-{
- while (true)
- {
- {
- osl::MutexGuard aGuard(mpChart->maMutex);
- mpChart->maCond2.reset();
- if (mpChart->mbRenderDie)
- break;
- UpdateScreenText();
- ProcessMouseEvent();
- renderFrame();
- mpChart->miFrameCount++;
- }
- if (mpChart->maCond1.check())
- {
- mpChart->maCond1.reset();
- mpChart->maCond2.wait();
- }
- }
-}
-
-GL3DBarChart::GL3DBarChart(
- const css::uno::Reference<css::chart2::XChartType>& xChartType,
- OpenGLWindow* pWindow) :
- mxChartType(xChartType),
- mpRenderer(new opengl3D::OpenGL3DRenderer()),
- mpWindow(pWindow),
- mpCamera(nullptr),
- mbValidContext(true),
- mpTextCache(new opengl3D::TextCache),
- mnMaxX(0),
- mnMaxY(0),
- mnDistance(0.0),
- mnCornerId(0),
- mbNeedsNewRender(true),
- mbCameraInit(false),
- mbRenderDie(false),
- maRenderEvent(EVENT_NONE),
- maPreRenderEvent(EVENT_NONE),
- mnSelectBarId(0),
- mnPreSelectBarId(0),
- miScrollRate(0),
- mbScrollFlg(false),
- maIdle("chart2 view GL3DBarChart"),
- mbScreenTextNewRender(false),
- maFPS(OUString("Render FPS: 0")),
- maDataUpdateFPS(OUString("Data Update FPS: 0")),
- miFrameCount(0),
- miDataUpdateCounter(0),
- mnColorRate(0),
- mbBenchMarkMode(false),
- mnHistoryCounter(0),
- mnBarsInRow(0),
- mbAutoFly(false),
- mnUpdateBarId(0)
-{
- maFPSRenderStartTime.Seconds = maFPSRenderStartTime.Nanosec = 0;
- maFPSRenderEndTime.Seconds = maFPSRenderEndTime.Nanosec = 0;
- maDataUpdateStartTime.Seconds = maDataUpdateStartTime.Nanosec = 0;
- maDataUpdateEndTime.Seconds = maDataUpdateEndTime.Nanosec = 0;
-
- static const char *aBenchMark = getenv("UNLOCK_FPS_MODE");
- if (aBenchMark)
- {
- mbBenchMarkMode = atoi(aBenchMark);
- }
- if (mbBenchMarkMode)
- {
- static const char *scrollFrame = getenv("SCROLL_RATE");
- if (scrollFrame)
- {
- miScrollRate = atoi(scrollFrame);
- if (miScrollRate > 0)
- {
- mbScrollFlg = true;
- mpRenderer->SetScroll();
- }
- }
- char *aAutoFly = getenv("AUTO_FLY");
- if (aAutoFly)
- {
- mbAutoFly = atoi(aAutoFly);
- }
- maIdle.SetPriority(TaskPriority::REPAINT);
- maIdle.SetInvokeHandler(LINK(this, GL3DBarChart, UpdateTimerHdl));
- maIdle.SetDebugName( "charttypes::GL3DBarChart maIdle" );
- maIdle.Start();
- osl_getSystemTime(&maFPSRenderStartTime);
- osl_getSystemTime(&maFPSRenderEndTime);
- osl_getSystemTime(&maDataUpdateStartTime);
- osl_getSystemTime(&maDataUpdateEndTime);
- }
- Size aSize = mpWindow->GetSizePixel();
- mpRenderer->SetSize(aSize);
- mpWindow->setRenderer(this);
- mpWindow->getContext().makeCurrent();
- mpRenderer->init();
- mpWindow->getContext().resetCurrent();
-}
-
-GL3DBarChart::BarInformation::BarInformation(const glm::vec3& rPos, float nVal):
- maPos(rPos),
- mnVal(nVal)
-{
-}
-
-GL3DBarChart::~GL3DBarChart()
-{
- if (mbBenchMarkMode)
- {
- SharedResourceAccess aResGuard(maCond1, maCond2);
- osl::MutexGuard aGuard(maMutex);
- mbRenderDie = true;
- }
-
- joinRenderThread();
-
- if (mbValidContext)
- {
- mpWindow->setRenderer(nullptr);
- mpWindow->getContext().makeCurrent();
- mpRenderer.reset();
- mpWindow->getContext().resetCurrent();
- }
-}
-
-void GL3DBarChart::create3DShapes(const std::vector<std::unique_ptr<VDataSeries> >& rDataSeriesContainer,
- ExplicitCategoriesProvider& rCatProvider)
-{
- SharedResourceAccess aResGuard(maCond1, maCond2);
- osl::MutexGuard aGuard(maMutex);
- if(mnSelectBarId)
- {
- int nSelectBarId = mnSelectBarId;
- int nPreSelectBarId = nSelectBarId;
- nSelectBarId -= 10;
- sal_uInt32 nSelectRow = (nSelectBarId - SHAPE_START_ID) / ID_STEP / (mnBarsInRow + 1);
- sal_uInt32 nPreSelectRow = (nPreSelectBarId - SHAPE_START_ID) / ID_STEP / (mnBarsInRow + 1);
- if(nSelectRow == nPreSelectRow)
- {
- std::map<sal_uInt32, const GL3DBarChart::BarInformation>::const_iterator itr = maBarMap.find(nSelectBarId);
- if((maRenderEvent == EVENT_CLICK || maRenderEvent == EVENT_SHOW_SELECT || maRenderEvent == EVENT_AUTO_FLY)&&(itr != maBarMap.end()))
- {
- mnUpdateBarId = nSelectBarId;
- maRenderEvent = EVENT_SELECTBAR_UPDEDATE;
- }
- }
- }
- mpRenderer->ReleaseShapes();
- // Each series of data flows from left to right, and multiple series are
- // stacked vertically along y axis.
-
- sal_uInt32 nId = SHAPE_START_ID;
- float nXEnd = 0.0;
- float nYPos = 0.0;
-
- const Color aSeriesColor[] = {
- COL_RED, COL_GREEN, COL_YELLOW, COL_BROWN, COL_BLUE
- };
-
- maCategories.clear();
- maSeriesNames.clear();
- maSeriesNames.reserve(rDataSeriesContainer.size());
- maBarMap.clear();
- maShapes.clear();
- if (mbBenchMarkMode)
- {
- mnColorRate = 0;
- }
- maShapes.push_back(o3tl::make_unique<opengl3D::Camera>(mpRenderer.get()));
- mpCamera = static_cast<opengl3D::Camera*>(maShapes.back().get());
-
- sal_Int32 nSeriesIndex = 0;
- sal_Int32 nMaxPointCount = 0;
- double nMaxVal = findMaxValue(rDataSeriesContainer)/100;
- if (rDataSeriesContainer.empty())
- {
- mnBarsInRow = 0;
- }
- else
- {
- const VDataSeries& rFirstRow = *rDataSeriesContainer.begin()->get();
- mnBarsInRow = rFirstRow.getTotalPointCount();
- }
- for (const std::unique_ptr<VDataSeries>& rDataSeries : rDataSeriesContainer)
- {
- nYPos = nSeriesIndex * (BAR_SIZE_Y + BAR_DISTANCE_Y) + BAR_DISTANCE_Y;
-
- sal_Int32 nPointCount = rDataSeries->getTotalPointCount();
- nMaxPointCount = std::max(nMaxPointCount, nPointCount);
-
- bool bMappedFillProperty = rDataSeries->hasPropertyMapping("FillColor");
-
- // Create series name text object.
- OUString aSeriesName =
- DataSeriesHelper::getDataSeriesLabel(
- rDataSeries->getModel(), mxChartType->getRoleOfSequenceForSeriesLabel());
-
- maSeriesNames.push_back(aSeriesName);
-
- if(!aSeriesName.isEmpty())
- {
- maShapes.push_back(o3tl::make_unique<opengl3D::Text>(mpRenderer.get(),
- *mpTextCache, aSeriesName, nId));
- nId += ID_STEP;
- opengl3D::Text* p = static_cast<opengl3D::Text*>(maShapes.back().get());
- glm::vec3 aTopLeft, aTopRight, aBottomRight;
- aTopRight.x = -BAR_DISTANCE_Y;
- aTopRight.y = nYPos + BAR_DISTANCE_Y;
- aTopLeft.x = calculateTextWidth(aSeriesName) * -1.0 - BAR_DISTANCE_Y;
- aTopLeft.y = nYPos + BAR_DISTANCE_Y;
- aBottomRight = aTopRight;
- aBottomRight.y -= TEXT_HEIGHT;
- p->setPosition(aTopLeft, aTopRight, aBottomRight);
- }
-
- Color nColor = aSeriesColor[nSeriesIndex % SAL_N_ELEMENTS(aSeriesColor)];
- for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex)
- {
- if(bMappedFillProperty)
- {
- double nPropVal = rDataSeries->getValueByProperty(nIndex, "FillColor");
- if(!rtl::math::isNan(nPropVal))
- nColor = Color(static_cast<sal_uInt32>(nPropVal));
- }
-
- float nVal = rDataSeries->getYValue(nIndex);
- if (rtl::math::isNan(nVal))
- continue;
-
- float nXPos = nIndex * (BAR_SIZE_X + BAR_DISTANCE_X) + BAR_DISTANCE_X;
-
- glm::mat4 aScaleMatrix = glm::scale(glm::vec3(BAR_SIZE_X, BAR_SIZE_Y, float(nVal/nMaxVal)));
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(nXPos, nYPos, 0.0f));
- glm::mat4 aBarPosition = aTranslationMatrix * aScaleMatrix;
-
- maBarMap.insert(std::pair<sal_uInt32, BarInformation>(nId,
- BarInformation(glm::vec3(nXPos, nYPos, float(nVal/nMaxVal)),
- nVal)));
- recordBarHistory(nId, nVal);
- if (mbBenchMarkMode)
- {
- auto it = maBarColorMap.find(nId);
- if (it == maBarColorMap.end())
- {
- maBarColorMap[nId] = nColor;
- }
- else
- {
- if(mbAutoFly)
- processAutoFly(nId, nColor);
- }
- }
- maShapes.push_back(o3tl::make_unique<opengl3D::Bar>(mpRenderer.get(), aBarPosition, nColor, nId));
- nId += ID_STEP;
- }
-
- float nThisXEnd = nPointCount * (BAR_SIZE_X + BAR_DISTANCE_X);
- if (nXEnd < nThisXEnd)
- nXEnd = nThisXEnd;
-
- ++nSeriesIndex;
- }
-
- nYPos += BAR_SIZE_Y + BAR_DISTANCE_Y;
-
- // X axis
- maShapes.push_back(o3tl::make_unique<opengl3D::Line>(mpRenderer.get(), nId));
- nId += ID_STEP;
- opengl3D::Line* pAxis = static_cast<opengl3D::Line*>(maShapes.back().get());
- glm::vec3 aBegin;
- aBegin.y = nYPos;
- glm::vec3 aEnd = aBegin;
- aEnd.x = mbBenchMarkMode ? (mbScrollFlg ? nXEnd - BAR_SIZE_X : nXEnd) : nXEnd;
- pAxis->setPosition(aBegin, aEnd);
- pAxis->setLineColor(COL_BLUE);
-
- // Y axis
- maShapes.push_back(o3tl::make_unique<opengl3D::Line>(mpRenderer.get(), nId));
- nId += ID_STEP;
- pAxis = static_cast<opengl3D::Line*>(maShapes.back().get());
- aBegin.x = aBegin.y = 0;
- aEnd = aBegin;
- aEnd.y = nYPos;
- pAxis->setPosition(aBegin, aEnd);
- pAxis->setLineColor(COL_BLUE);
-
- // Chart background.
- maShapes.push_back(o3tl::make_unique<opengl3D::Rectangle>(mpRenderer.get(), nId));
- nId += ID_STEP;
- opengl3D::Rectangle* pRect = static_cast<opengl3D::Rectangle*>(maShapes.back().get());
- glm::vec3 aTopLeft;
- glm::vec3 aTopRight = aTopLeft;
- aTopRight.x = mbBenchMarkMode ? (mbScrollFlg ? nXEnd - BAR_SIZE_X : nXEnd + 2 * BAR_DISTANCE_X) : (nXEnd + 2 * BAR_DISTANCE_X);
- glm::vec3 aBottomRight = aTopRight;
- aBottomRight.y = nYPos;
- pRect->setPosition(aTopLeft, aTopRight, aBottomRight);
- pRect->setFillColor(COL_BLACK);
- pRect->setLineColor(COL_BLUE);
- if (mbScrollFlg)
- mpRenderer->SetSceneEdge(BAR_DISTANCE_X - 0.001f, aTopRight.x - BAR_DISTANCE_X);
- else
- mpRenderer->SetSceneEdge(-0.001f, aTopRight.x);
- // Create category texts along X-axis at the bottom.
- uno::Sequence<OUString> aCats = rCatProvider.getSimpleCategories();
- for (sal_Int32 i = 0; i < aCats.getLength(); ++i)
- {
- if (mbBenchMarkMode && mbScrollFlg && (i + 1 == aCats.getLength()))
- break;
- maCategories.push_back(aCats[i]);
- if(aCats[i].isEmpty())
- continue;
-
- float nXPos = i * (BAR_SIZE_X + BAR_DISTANCE_X);
-
- maShapes.push_back(o3tl::make_unique<opengl3D::Text>(mpRenderer.get(), *mpTextCache,
- aCats[i], nId));
- nId += ID_STEP;
- opengl3D::Text* p = static_cast<opengl3D::Text*>(maShapes.back().get());
- aTopLeft.x = nXPos + TEXT_HEIGHT + 0.5 * BAR_SIZE_X;
- aTopLeft.y = nYPos + calculateTextWidth(aCats[i]) + 0.5 * BAR_DISTANCE_Y;
- aTopRight = aTopLeft;
- aTopRight.y = nYPos + 0.5* BAR_DISTANCE_Y;
- aBottomRight.x = nXPos;
- aBottomRight.y = nYPos + 0.5 * BAR_DISTANCE_Y;
- p->setPosition(aTopLeft, aTopRight, aBottomRight);
-
- // create shapes on other side as well
-
- maShapes.push_back(o3tl::make_unique<opengl3D::Text>(mpRenderer.get(), *mpTextCache,
- aCats[i], nId));
- nId += ID_STEP;
- p = static_cast<opengl3D::Text*>(maShapes.back().get());
- aTopLeft.x = nXPos + TEXT_HEIGHT + 0.5 * BAR_SIZE_X;
- aTopLeft.y = - 0.5 * BAR_DISTANCE_Y;
- aTopRight = aTopLeft;
- aTopRight.y = -calculateTextWidth(aCats[i]) - 0.5* BAR_DISTANCE_Y;
- aBottomRight.x = nXPos;
- aBottomRight.y = -calculateTextWidth(aCats[i]) - 0.5 * BAR_DISTANCE_Y;
- p->setPosition(aTopLeft, aTopRight, aBottomRight);
- }
-
- mnMaxX = nMaxPointCount * (BAR_SIZE_X + BAR_DISTANCE_X) + 40;
- mnMaxY = nSeriesIndex * (BAR_SIZE_Y + BAR_DISTANCE_Y) + 40;
- if (!mbCameraInit)
- {
- mnDistance = std::sqrt(mnMaxX * mnMaxX + mnMaxY * mnMaxY + DEFAULT_CAMERA_HEIGHT * DEFAULT_CAMERA_HEIGHT);
- maDefaultCameraDirection = glm::vec3(mnMaxX * 0.4, mnMaxY * 0.35, 0);
- maDefaultCameraPosition = glm::vec3(maDefaultCameraDirection.x, maDefaultCameraDirection.y - mnDistance, DEFAULT_CAMERA_HEIGHT * 2);
- mnCornerId = 0;
- mbCameraInit = true;
- float pi = 3.1415926f;
- float nAngleX = -pi / 6.5f;
- float nAngleZ = -pi / 8.0f;
- glm::mat4 aDefaultRotateMatrix = glm::eulerAngleYXZ(0.0f, nAngleX, nAngleZ);
- maDefaultCameraPosition = glm::vec3(aDefaultRotateMatrix * glm::vec4(maDefaultCameraPosition, 1.0f));
- maCameraPosition = maDefaultCameraPosition;
- maCameraDirection = maDefaultCameraDirection;
- mpCamera->setPosition(maCameraPosition);
- mpCamera->setDirection(maCameraDirection);
- }
- else
- {
- mpCamera->setPosition(maCameraPosition);
- mpCamera->setDirection(maCameraDirection);
- }
- if (mbBenchMarkMode && (!mpRenderThread.is()))
- {
- //if scroll the bars, set the speed and distance first
- if (mbScrollFlg)
- {
- mpRenderer->SetScrollSpeed((BAR_SIZE_X + BAR_DISTANCE_X) / static_cast<float>(miScrollRate));
- mpRenderer->SetScrollDistance(BAR_SIZE_X + BAR_DISTANCE_X);
- }
- spawnRenderThread(new RenderBenchMarkThread(this));
- }
- miDataUpdateCounter++;
- mnHistoryCounter++;
- mbNeedsNewRender = true;
-}
-
-void GL3DBarChart::joinRenderThread()
-{
- if(mpRenderThread.is())
- {
- // FIXME: badly want to assert that we don't
- // hold the mutex here ... but can't API-wise.
- mpRenderThread->join();
- }
-}
-
-void GL3DBarChart::spawnRenderThread(RenderThread *pThread)
-{
- joinRenderThread(); // not holding maMutex
-
- osl::MutexGuard aGuard(maMutex);
-
- Size aSize = mpWindow->GetSizePixel();
- mpWindow->getContext().setWinSize(aSize);
- mpRenderThread.set(pThread);
- mpWindow->getContext().resetCurrent();
- mpRenderThread->launch();
-}
-
-void GL3DBarChart::update()
-{
- if (mbBenchMarkMode)
- return;
- spawnRenderThread(new RenderOneFrameThread(this));
-}
-
-void GL3DBarChart::moveToDefault()
-{
- if(mbBenchMarkMode)
- {
- // add correct handling here!!
- if ((maRenderEvent != EVENT_NONE) && (maRenderEvent != EVENT_SHOW_SCROLL) &&
- (maRenderEvent != EVENT_AUTO_FLY) && (maRenderEvent != EVENT_SHOW_SELECT))
- return;
-
- {
- SharedResourceAccess aResGuard(maCond1, maCond2);
- osl::MutexGuard aGuard(maMutex);
- maRenderEvent = EVENT_MOVE_TO_DEFAULT;
- }
- return;
- }
-
- spawnRenderThread(new RenderAnimationThread(this, maCameraPosition, maDefaultCameraPosition, STEPS));
-
- /*
- * TODO: moggi: add to thread
- glm::vec3 maTargetDirection = maDefaultCameraDirection;
- maStepDirection = (maTargetDirection - maCameraDirection)/((float)mnStepsTotal);
- */
-}
-
-sal_uInt32 GL3DBarChart::barIdAtPosition(const Point& rPos)
-{
- sal_uInt32 nId = 5;
- {
- osl::MutexGuard aGuard(maMutex);
- mpWindow->getContext().makeCurrent();
- mpRenderer->SetPickingMode(true);
- renderFrame();
- nId = sal_uInt32(mpRenderer->GetPixelColorFromPoint(rPos.X(), rPos.Y()));
- mpRenderer->SetPickingMode(false);
- mpWindow->getContext().resetCurrent();
- }
- return nId;
-}
-
-void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
-{
- if (nButtons == MOUSE_RIGHT)
- {
- moveToDefault();
- return;
- }
-
- if(nButtons != MOUSE_LEFT)
- return;
-
- if (mbBenchMarkMode)
- {
- // add correct handling here !!
- if ((maRenderEvent != EVENT_NONE) && (maRenderEvent != EVENT_SHOW_SCROLL) &&
- (maRenderEvent != EVENT_AUTO_FLY) && (maRenderEvent != EVENT_SHOW_SELECT))
- return;
-
- {
- SharedResourceAccess aResGuard(maCond1, maCond2);
- osl::MutexGuard aGuard(maMutex);
- maClickPos = rPos;
- mnPreSelectBarId = mnSelectBarId;
- maPreRenderEvent = maRenderEvent;
- maRenderEvent = EVENT_CLICK;
- maClickCond.reset();
- }
- maClickCond.wait();
- return;
- }
-
- sal_uInt32 nId = barIdAtPosition(rPos);
-
- std::map<sal_uInt32, const BarInformation>::const_iterator itr =
- maBarMap.find(nId);
-
- if(itr == maBarMap.end())
- return;
-
- const BarInformation& rBarInfo = itr->second;
-
- {
- osl::MutexGuard aGuard(maMutex);
- mpWindow->getContext().makeCurrent();
- glm::vec3 aTextPos = glm::vec3(rBarInfo.maPos.x + BAR_SIZE_X / 2.0f,
- rBarInfo.maPos.y + BAR_SIZE_Y / 2.0f,
- rBarInfo.maPos.z);
- maShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache,
- "Value: " + OUString::number(rBarInfo.mnVal), glm::vec4(0.0f, 0.0f, 1.0f, 1.0f), CALC_POS_EVENT_ID));
- opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(maShapes.back().get());
- pScreenText->setPosition(glm::vec2(-0.9f, 0.9f), glm::vec2(-0.6f, 0.8f), aTextPos);
- pScreenText->render();
- mpWindow->getContext().resetCurrent();
- }
-
- glm::vec3 aTargetPosition = rBarInfo.maPos;
- aTargetPosition.z += 240;
- aTargetPosition.y += BAR_SIZE_Y / 2.0f;
-
- spawnRenderThread(new RenderAnimationThread(this, maCameraPosition,
- aTargetPosition, STEPS));
-
- /*
- * TODO: moggi: add to thread
- glm::vec3 maTargetDirection = rBarInfo.maPos;
- maTargetDirection.x += BAR_SIZE_X / 2.0f;
- maTargetDirection.y += BAR_SIZE_Y / 2.0f;
-
- maStepDirection = (maTargetDirection - maCameraDirection)/((float)mnStepsTotal);
- */
-}
-
-void GL3DBarChart::render()
-{
- if (mbBenchMarkMode)
- return;
-
- update();
-}
-
-void GL3DBarChart::renderFrame()
-{
- Size aSize = mpWindow->GetSizePixel();
- mpRenderer->SetSize(aSize);
- if(mbNeedsNewRender)
- {
- mpRenderer->ReleaseTextTexture();
- for(std::unique_ptr<opengl3D::Renderable3DObject>& aObj : maShapes)
- {
- aObj->render();
- }
- }
- else
- {
- mpCamera->render();
- }
- mpRenderer->ProcessUnrenderedShape(mbNeedsNewRender);
- mbNeedsNewRender = false;
-}
-
-void GL3DBarChart::mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 )
-{
- long nDirection = rEndPos.X() - rStartPos.X();
- SharedResourceAccess aResGuard(maCond1, maCond2);
- osl::ClearableGuard<osl::Mutex> aGuard(maMutex);
- if ((maRenderEvent == EVENT_NONE) || (maRenderEvent == EVENT_SHOW_SCROLL) ||
- (maRenderEvent == EVENT_AUTO_FLY) || (maRenderEvent == EVENT_SHOW_SELECT))
- maRenderEvent = nDirection > 0 ? EVENT_DRAG_RIGHT : EVENT_DRAG_LEFT;
- bool bMove = false;
- if(nDirection < 0)
- {
- mnCornerId = (mnCornerId + 1) % 4;
- bMove = true;
- }
- else if(nDirection > 0)
- {
- mnCornerId = mnCornerId - 1;
- if(mnCornerId < 0)
- mnCornerId = 3;
- bMove = true;
- }
-
- if (bMove)
- {
- aGuard.clear();
- moveToCorner();
- }
-}
-
-glm::vec3 GL3DBarChart::getCornerPosition(sal_Int8 nId)
-{
- float pi = 3.1415926f;
- switch(nId)
- {
- case 0:
- {
- return glm::vec3(mnMaxX / 2 - mnDistance * std::sin(pi / 4), mnMaxY / 2 - mnDistance * std::cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
- }
- break;
- case 1:
- {
- return glm::vec3(mnMaxX / 2 + mnDistance * std::sin(pi / 4), mnMaxY / 2 - mnDistance * std::cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
- }
- break;
- case 2:
- {
- return glm::vec3(mnMaxX / 2 + mnDistance * std::sin(pi / 4), mnMaxY / 2 + mnDistance * std::cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
- }
- break;
- case 3:
- {
- return glm::vec3(mnMaxX / 2 - mnDistance * std::sin(pi / 4), mnMaxY / 2 + mnDistance * std::cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2);
- }
- break;
- default:
- assert(false);
- }
- return maDefaultCameraPosition;
-}
-
-void GL3DBarChart::moveToCorner()
-{
- if(mbBenchMarkMode)
- {
- // add correct handling here!!
- return;
- }
-
- spawnRenderThread(new RenderAnimationThread(this, maCameraPosition,
- getCornerPosition(mnCornerId), STEPS));
-
- // TODO: moggi: add to thread
- // maStepDirection = (glm::vec3(mnMaxX/2.0f, mnMaxY/2.0f, 0) - maCameraDirection)/ float(mnStepsTotal);
-}
-
-void GL3DBarChart::scroll(long nDelta)
-{
- {
- SharedResourceAccess aResGuard(maCond1, maCond2);
- osl::MutexGuard aGuard(maMutex);
- if ((maRenderEvent != EVENT_NONE) && (maRenderEvent != EVENT_SHOW_SCROLL) &&
- (maRenderEvent != EVENT_AUTO_FLY) && (maRenderEvent != EVENT_SHOW_SELECT))
- return;
- glm::vec3 aDir = glm::normalize(maCameraPosition - maCameraDirection);
- maCameraPosition -= (static_cast<float>(nDelta)/10) * aDir;
- mpCamera->setPosition(maCameraPosition);
- if(mbBenchMarkMode)
- {
- maVectorNearest.clear();
- getNearestBars(maVectorNearest);
- maRenderEvent = EVENT_SCROLL;
- }
- }
-
- update();
-}
-
-void GL3DBarChart::contextDestroyed()
-{
- SharedResourceAccess aResGuard(maCond1, maCond2);
- osl::MutexGuard aGuard(maMutex);
- mpWindow->getContext().makeCurrent();
- mpRenderer.reset();
- mpWindow->getContext().resetCurrent();
- mbValidContext = false;
-}
-
-float GL3DBarChart::addScreenTextShape(OUString &nStr, const glm::vec2& rLeftOrRightTop, float nTextHeight, bool bLeftTopFlag,
- const glm::vec4& rColor, const glm::vec3& rPos, sal_uInt32 nEvent)
-{
- maScreenTextShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache, nStr, rColor, nEvent));
- const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(nStr);
- float nRectWidth = static_cast<float>(rTextCache.maSize.Width()) / static_cast<float>(rTextCache.maSize.Height()) * nTextHeight / 2.0f;
- opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(maScreenTextShapes.back().get());
- if (bLeftTopFlag)
- pScreenText->setPosition(rLeftOrRightTop, glm::vec2(rLeftOrRightTop.x + nRectWidth, rLeftOrRightTop.y - nTextHeight), rPos);
- else
- pScreenText->setPosition(glm::vec2(rLeftOrRightTop.x - nRectWidth, rLeftOrRightTop.y), glm::vec2(rLeftOrRightTop.x, rLeftOrRightTop.y - nTextHeight), rPos);
- return nRectWidth;
-}
-
-void GL3DBarChart::updateRenderFPS()
-{
- int nDeltaMs = calcTimeInterval(maFPSRenderStartTime, maFPSRenderEndTime);
- if(nDeltaMs >= FPS_TIME)
- {
- osl_getSystemTime(&maFPSRenderEndTime);
- nDeltaMs = calcTimeInterval(maFPSRenderStartTime, maFPSRenderEndTime);
- int iFPS = miFrameCount * 1000 / nDeltaMs;
- maFPS = OUString::number(iFPS);
- miFrameCount = 0;
- osl_getSystemTime(&maFPSRenderStartTime);
- }
- osl_getSystemTime(&maFPSRenderEndTime);
- OUString aFPS = "Render FPS: ";
- addScreenTextShape(aFPS, glm::vec2(-0.77f, 0.99f), 0.07f, false, glm::vec4(0.0f, 1.0f, 1.0f, 0.0f));
- addScreenTextShape(maFPS, glm::vec2(-0.77f, 0.99f), 0.07f, true,
- glm::vec4(1.0f, 0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f));
-}
-
-int GL3DBarChart::calcTimeInterval(TimeValue const &startTime, TimeValue const &endTime)
-{
- TimeValue aTime;
- aTime.Seconds = endTime.Seconds - startTime.Seconds - 1;
- aTime.Nanosec = 1000000000 + endTime.Nanosec - startTime.Nanosec;
- aTime.Seconds += aTime.Nanosec / 1000000000;
- aTime.Nanosec %= 1000000000;
- return aTime.Seconds * 1000+aTime.Nanosec / 1000000;
-}
-
-void GL3DBarChart::updateScreenText()
-{
- SharedResourceAccess aResGuard(maCond1, maCond2);
- osl::MutexGuard aGuard(maMutex);
- maScreenTextShapes.clear();
- mpRenderer->ReleaseScreenTextShapes();
- updateRenderFPS();
- updateDataUpdateFPS();
- updateClickEvent();
- updateScroll();
- mbScreenTextNewRender = true;
-}
-
-void GL3DBarChart::updateDataUpdateFPS()
-{
- int nDeltaMs = calcTimeInterval(maDataUpdateStartTime, maDataUpdateEndTime);
- if(nDeltaMs >= DATAUPDATE_FPS_TIME)
- {
- int iFPS = miDataUpdateCounter * 1000 / nDeltaMs;
- if (iFPS)
- {
- maDataUpdateFPS = OUString::number(iFPS);
- }
- else
- {
- float fFPS = static_cast<float>(miDataUpdateCounter) * 1000 / static_cast<float>(nDeltaMs);
- maDataUpdateFPS = OUString::number(fFPS);
- }
- miDataUpdateCounter = 0;
- osl_getSystemTime(&maDataUpdateStartTime);
- }
- osl_getSystemTime(&maDataUpdateEndTime);
- OUString aDataUpdateFPS = "Data Update Rate: ";
- addScreenTextShape(aDataUpdateFPS, glm::vec2(-0.77, 0.92f), 0.07f, false, glm::vec4(0.0f, 1.0f, 1.0f, 0.0f));
- addScreenTextShape(maDataUpdateFPS, glm::vec2(-0.77f, 0.92f), 0.07f, true, glm::vec4(1.0f, 0.0f, 0.0f, 0.0f));
-}
-
-void GL3DBarChart::recordBarHistory(sal_uInt32 nBarID, float nVal)
-{
- std::deque<float>& aList = maBarHistory[nBarID];
- if(aList.size() == HISTORY_NUM)
- aList.pop_front();
- aList.push_back(nVal);
-}
-
-void GL3DBarChart::getNeighborBarID(sal_uInt32 nSelectBarId, sal_uInt32 *pNeighborBarId)
-{
- sal_uInt32 nSelectRow = (nSelectBarId - SHAPE_START_ID) / ID_STEP / (mnBarsInRow + 1);
- for (sal_Int32 i = 0; i < DISPLAY_BARS_NUM; i++)
- {
- pNeighborBarId[i] = nSelectBarId + (i - DISPLAY_BARS_NUM / 2) * ID_STEP;
- if (pNeighborBarId[i] == nSelectBarId)
- continue;
- if ((pNeighborBarId[i] - SHAPE_START_ID) / ID_STEP / (mnBarsInRow + 1) != nSelectRow)
- pNeighborBarId[i] = 0;
- }
-}
-
-void GL3DBarChart::addMovementScreenText(sal_uInt32 nBarId)
-{
- if (nBarId == 0)
- return;
- std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(nBarId);
- if (itr == maBarMap.end())
- return;
- const BarInformation& rBarInfo = itr->second;
- glm::vec3 aTextPos = glm::vec3(rBarInfo.maPos.x + BAR_SIZE_X / 2.0f,
- rBarInfo.maPos.y + BAR_SIZE_Y / 2.0f,
- rBarInfo.maPos.z);
- OUString aBarValue = "Value: " + OUString::number(rBarInfo.mnVal);
- maScreenTextShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), CALC_POS_EVENT_ID, true));
- const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue);
- float nRectWidth = static_cast<float>(rTextCache.maSize.Width()) / static_cast<float>(rTextCache.maSize.Height()) * 0.024;
- opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(maScreenTextShapes.back().get());
- pScreenText->setPosition(glm::vec2(-nRectWidth / 2, 0.03f), glm::vec2(nRectWidth / 2, -0.03f), aTextPos);
-}
-
-void GL3DBarChart::updateClickEvent()
-{
- if (maRenderEvent == EVENT_CLICK || maRenderEvent == EVENT_AUTO_FLY || maRenderEvent == EVENT_SHOW_SELECT)
- {
- std::deque<float>& aList = maBarHistory[mnSelectBarId];
- sal_uInt32 nIdex = 0;
- sal_uInt32 nBarIdArray[DISPLAY_BARS_NUM] = {0};
- OUString aTitle;
- OUString aBarValue;
- float nXCoordStart, nYCoordStart, nTextWidth, nMaxXCoord = 0.0f, nMinXCoord = 1.0f, nMaxHight = 0.0f;
- //write title
- if (aList.size() > 1)
- {
- aTitle = "Time ";
- nTextWidth = addScreenTextShape(aTitle, glm::vec2(0.875, 0.99f), 0.07f, false, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f));
- nMinXCoord = std::min(nMinXCoord, 0.875f - nTextWidth);
- aTitle = " Value";
- nTextWidth = addScreenTextShape(aTitle, glm::vec2(0.875f, 0.99f), 0.07f, true, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f));
- nMaxXCoord = std::max(nMaxXCoord, 0.875f + nTextWidth);
- }
- if (aList.size() > COLUMNSIZE)
- {
- aTitle = "Time ";
- nTextWidth = addScreenTextShape(aTitle, glm::vec2(0.55f, 0.99f), 0.07f, false, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f));
- nMinXCoord = std::min(nMinXCoord, 0.55f - nTextWidth);
- aTitle = " Value";
- nTextWidth = addScreenTextShape(aTitle, glm::vec2(0.55f, 0.99f), 0.07f, true, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f));
- nMaxXCoord = std::max(nMaxXCoord, 0.55f + nTextWidth);
- }
- getNeighborBarID(mnSelectBarId, nBarIdArray);
- for (auto const& elem : aList)
- {
- if (nIdex + 1 < aList.size())
- {
- aTitle = "[Time:" + OUString::number((mnHistoryCounter - aList.size() + nIdex)) + "]: ";
- if (nIdex == 0)
- {
- aTitle = "Most Recent" + aTitle;
- }
- if (aList.size() <= COLUMNSIZE)
- {
- nXCoordStart = 0.875f;
- nYCoordStart = (nIdex + 1) * 0.07f;
- }
- else
- {
- nXCoordStart = nIdex < COLUMNSIZE ? 0.55f : 0.875f;
- nYCoordStart = nIdex < COLUMNSIZE ? (nIdex + 1) * 0.07f : (nIdex - 24) * 0.07f;
- }
- nMaxHight = std::max(nMaxHight, nYCoordStart + 0.07f);
- nTextWidth = addScreenTextShape(aTitle, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f, false, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f));
- nMinXCoord = std::min(nMinXCoord, nXCoordStart - nTextWidth);
- aBarValue = OUString::number(elem);
- nTextWidth = addScreenTextShape(aBarValue, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f, true, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f));
- nMaxXCoord = std::max(nMaxXCoord, nXCoordStart + nTextWidth);
- }
- nIdex++;
- }
- for (unsigned int i : nBarIdArray)
- {
- addMovementScreenText(i);
- }
- //add translucent back ground
- aTitle = " ";
- maScreenTextShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache, aTitle, glm::vec4(0.0f, 0.0f, 0.0f, 0.5f), 0));
- opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(maScreenTextShapes.back().get());
- pScreenText->setPosition(glm::vec2(nMinXCoord, 0.99f), glm::vec2(nMaxXCoord, 0.99f - nMaxHight), glm::vec3(0.0, 0.0, 0.0));
- }
-}
-
-float GL3DBarChart::calcScrollDistance(const glm::mat4& rMVP, const glm::vec3& rPos)
-{
- glm::vec4 aScreenPos = rMVP * glm::vec4(rPos, 1.0);
- glm::vec3 aActualPos = glm::vec3(aScreenPos.x / aScreenPos.w, aScreenPos.y / aScreenPos.w, 0.0);
- return glm::length(aActualPos);
-}
-
-void GL3DBarChart::calcDistance(std::vector<sal_uInt32> & rVectorNearest)
-{
- int i =0;
- glm::mat4 aProjection = mpRenderer->GetProjectionMatrix();
- glm::mat4 aView = mpRenderer->GetViewMatrix();
- glm::mat4 aScale = mpRenderer->GetGlobalScaleMatrix();
- glm::mat4 aMVP = aProjection * aView * aScale;
- for (auto const& elem : maBarMap)
- {
- sal_uInt32 nId = elem.first;
- if(i < SHOW_VALUE_COUNT)
- {
- rVectorNearest.push_back(nId);
- i++;
- }
- maDistanceMap[nId] = calcScrollDistance(aMVP, glm::vec3(elem.second.maPos.x + BAR_SIZE_X / 2.0f,
- elem.second.maPos.y + BAR_SIZE_Y / 2.0f,
- elem.second.maPos.z));
- }
-}
-
-void GL3DBarChart::initDistanceHeap(std::vector<sal_uInt32> &rVectorNearest)
-{
- for(int i= (rVectorNearest.size()-2)/2; i>= 0; i--)
- {
- keepHeap(rVectorNearest, i);
- }
-}
-
-void GL3DBarChart::keepHeap(std::vector<sal_uInt32> &rVectorNearest, int nIndex)
-{
- size_t nParentIndex = nIndex;
- while(nParentIndex < rVectorNearest.size())
- {
- size_t nLeftIndex = nParentIndex * 2 + 1;
- size_t nRightIndex = nLeftIndex +1;
- if(nLeftIndex >= rVectorNearest.size())
- break;
- size_t nFarthestIndex = nLeftIndex;
- float nFarthest = maDistanceMap[rVectorNearest[nLeftIndex]];
- if(nRightIndex < rVectorNearest.size())
- {
- float nRight = maDistanceMap[rVectorNearest[nRightIndex]];
- if(nRight > nFarthest)
- {
- nFarthest = nRight;
- nFarthestIndex = nRightIndex;
- }
- }
- float nParent = maDistanceMap[rVectorNearest[nParentIndex]];
- if(nParent >= nFarthest)
- break;
- else
- {
- swapVector(nParentIndex , nFarthestIndex, rVectorNearest);
- nParentIndex = nFarthestIndex;
- }
- }
-
-}
-
-void GL3DBarChart::swapVector(int i, int j, std::vector<sal_uInt32> &rVectorNearest)
-{
- sal_uInt32 nTmp = rVectorNearest[i];
- rVectorNearest[i] = rVectorNearest[j];
- rVectorNearest[j] = nTmp;
-}
-
-void GL3DBarChart::getNearestBars(std::vector<sal_uInt32> &rVectorNearest)
-{
- calcDistance(rVectorNearest);
- initDistanceHeap(rVectorNearest);
- int i = 0;
- for (auto const& elem : maDistanceMap)
- {
- ++i;
- if(i <= SHOW_VALUE_COUNT)
- continue;
- float nDistance = elem.second;
- float nHeaphead = maDistanceMap[rVectorNearest[0]];
- if(nDistance < nHeaphead)
- {
- rVectorNearest[0] = elem.first;
- keepHeap(rVectorNearest, 0);
- }
- }
-}
-
-void GL3DBarChart::updateScroll()
-{
- if ((maRenderEvent == EVENT_SCROLL) || (maRenderEvent == EVENT_SHOW_SCROLL))
- {
- float fMinDistance = 0.0f;
- std::vector<BarInformation> aBarInfoList;
- for(sal_uInt32 i : maVectorNearest)
- {
- //get bar height position
- std::map<sal_uInt32, const BarInformation>::const_iterator itr = maBarMap.find(i);
- const BarInformation& rBarInfo = itr->second;
- aBarInfoList.push_back(rBarInfo);
- glm::vec3 aPos = rBarInfo.maPos;
- fMinDistance = (fMinDistance == 0.0f) ? glm::length(aPos - maCameraPosition) :
- std::min(glm::length(aPos - maCameraPosition), fMinDistance);
- }
-
- if (fMinDistance <= SHOW_SCROLL_TEXT_DISTANCE)
- {
- //update scroll value
- for(BarInformation & i : aBarInfoList)
- {
- OUString aBarValue = "Value: " + OUString::number(i.mnVal);
- maScreenTextShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), CALC_POS_EVENT_ID, true));
- const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue);
- float nRectWidth = static_cast<float>(rTextCache.maSize.Width()) / static_cast<float>(rTextCache.maSize.Height()) * 0.024;
- glm::vec3 aTextPos = glm::vec3(i.maPos.x + BAR_SIZE_X / 2.0f,
- i.maPos.y + BAR_SIZE_Y / 2.0f,
- i.maPos.z);
- opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(maScreenTextShapes.back().get());
- pScreenText->setPosition(glm::vec2(-nRectWidth / 2, 0.03f), glm::vec2(nRectWidth / 2, -0.03f), aTextPos);
- }
- }
- }
-}
-
-void GL3DBarChart::processAutoFly(sal_uInt32 nId, Color nColor)
-{
- //record the color
- Color nPreColor = maBarColorMap[nId];
- maBarColorMap[nId] = nColor;
- //if has manul event, just record the color and process manul event first
- if (maRenderEvent != EVENT_NONE)
- {
- return;
- }
- //calc the percentage of color change
- int nColorRate = (sal_uInt32(nColor) - sal_uInt32(nPreColor)) * 100 / sal_uInt32(nPreColor);
- nColorRate = abs(nColorRate);
- if (nColorRate >= FLY_THRESHOLD)
- {
- maRenderEvent = EVENT_AUTO_FLY;
- mnSelectBarId = nColorRate > mnColorRate ? nId : mnSelectBarId;
- mnPreSelectBarId = mnSelectBarId;
- mnColorRate = std::max(nColorRate, mnColorRate);
- }
-}
-
-IMPL_LINK_NOARG(GL3DBarChart, UpdateTimerHdl, Timer *, void)
-{
- updateScreenText();
- maIdle.Start();
-}
-
-void GL3DBarChart::setOpenGLWindow(OpenGLWindow* pWindow)
-{
- if (mpWindow.get() != pWindow)
- {
- mpWindow = pWindow;
- Size aSize = mpWindow->GetSizePixel();
- mpRenderer->SetSize(aSize);
- mpWindow->setRenderer(this);
- mpWindow->getContext().makeCurrent();
- mpRenderer->init();
- mpWindow->getContext().resetCurrent();
- mbValidContext = true;
- }
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/3DChartObjects.hxx b/chart2/source/view/inc/3DChartObjects.hxx
deleted file mode 100644
index 15c0b22c3c9c..000000000000
--- a/chart2/source/view/inc/3DChartObjects.hxx
+++ /dev/null
@@ -1,159 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_3DCHARTOBJECTS_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_3DCHARTOBJECTS_HXX
-
-#include <glm/glm.hpp>
-#include <tools/color.hxx>
-
-#include "GL3DRenderer.hxx"
-
-#include <boost/shared_array.hpp>
-
-#include <map>
-
-namespace chart {
-
-namespace opengl3D {
-
-struct TextCacheItem
-{
- TextCacheItem(sal_uInt8 *pPixels, ::Size aSize)
- : maSize(aSize), maPixels(pPixels)
- {
- }
- ::Size maSize;
- boost::shared_array<sal_uInt8> maPixels;
-};
-
-class TextCache
-{
-public:
- const TextCacheItem &getText(OUString const & rText, bool bIs3dText = false);
-private:
- typedef std::map<OUString const, TextCacheItem> TextCacheType;
-
- TextCacheType m_TextCache;
-};
-
-class Renderable3DObject
-{
-public:
- Renderable3DObject(OpenGL3DRenderer* pRenderer, sal_uInt32 nId);
-
- virtual ~Renderable3DObject() {};
-
- virtual void render();
-
-protected:
- OpenGL3DRenderer* mpRenderer;
- sal_uInt32 mnUniqueId;
-};
-
-class Bar : public Renderable3DObject
-{
-public:
- Bar(OpenGL3DRenderer* pRenderer, const glm::mat4& rPosition, Color nColor, sal_uInt32 nId);
-
- virtual void render() override;
-private:
- glm::mat4 maPos;
- Color maColor; // RGBA fill color
-};
-
-class Line : public Renderable3DObject
-{
-public:
- Line(OpenGL3DRenderer* pRenderer, sal_uInt32 nId);
-
- virtual void render() override;
-
- void setPosition(const glm::vec3& rBegin, const glm::vec3& rEnd);
- void setLineColor(const Color& rColor);
-
-private:
- glm::vec3 maPosBegin;
- glm::vec3 maPosEnd;
- Color maLineColor; // RGBA line color
-};
-
-class Text : public Renderable3DObject
-{
-public:
- Text(OpenGL3DRenderer* pRenderer, TextCache& rTextCache, const OUString& rStr, sal_uInt32 nId);
- virtual void render() override;
-
- void setPosition(const glm::vec3& rTopLeft, const glm::vec3& rTopRight, const glm::vec3& rBottomRight);
-
-private:
- TextCacheItem maText;
- glm::vec3 maTopLeft;
- glm::vec3 maTopRight;
- glm::vec3 maBottomRight;
-};
-
-class ScreenText : public Renderable3DObject
-{
-public:
- ScreenText(OpenGL3DRenderer* pRenderer, TextCache& rTextCache,
- const OUString& rStr, const glm::vec4& rColor, sal_uInt32 nId, bool bIs3dText = false);
-
- virtual void render() override;
- void setPosition(const glm::vec2& rTopLeft, const glm::vec2& rBottomRight,
- const glm::vec3& r3DPos);
-
-private:
- TextCacheItem maText;
- glm::vec2 maTopLeft;
- glm::vec2 maBottomRight;
- glm::vec3 ma3DPos;
- glm::vec4 maColor;
-};
-
-class Rectangle : public Renderable3DObject
-{
-public:
- Rectangle(OpenGL3DRenderer* pRenderer, sal_uInt32 nId);
- virtual void render() override;
-
- void setPosition(const glm::vec3& rTopLeft, const glm::vec3& rTopRight, const glm::vec3& rBottomRight);
- void setFillColor(const Color& rColor);
- void setLineColor(const Color& rColor);
-
-private:
- glm::vec3 maTopLeft;
- glm::vec3 maTopRight;
- glm::vec3 maBottomRight;
- Color maColor; // RGBA fill color
- Color maLineColor; // RGBA line color
-};
-
-class Camera : public Renderable3DObject
-{
-public:
- Camera(OpenGL3DRenderer* pRenderer);
- virtual void render() override;
-
- void setPosition(const glm::vec3& rPos);
- void setDirection(const glm::vec3& rPos);
-
-private:
- glm::vec3 maPos;
- glm::vec3 maUp;
- glm::vec3 maDirection;
-};
-
-}
-
-}
-
-#endif // INCLUDED_CHART2_SOURCE_VIEW_INC_3DCHARTOBJECTS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
index bc276de6fa0f..5aa0d9bfeb68 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -18,7 +18,6 @@
#include <rtl/ustring.hxx>
-class OpenGLWindow;
namespace chart { struct VLineProperties; }
namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
namespace com { namespace sun { namespace star { namespace chart2 { class XFormattedString; } } } }
@@ -238,14 +237,6 @@ public:
virtual void setPageSize( css::uno::Reference < css::drawing::XShapes > xChartShapes, const css::awt::Size& rSize ) = 0;
- /**
- * Only necessary for stateless implementations
- */
- virtual void render(css::uno::Reference< css::drawing::XShapes > xRootShape, bool bInitOpenGL) = 0;
-
- virtual bool preRender(css::uno::Reference< css::drawing::XShapes > xRootShape, OpenGLWindow* pWindow) = 0;
- virtual void postRender(OpenGLWindow* pWindow) = 0;
-
virtual void clearPage(css::uno::Reference< css::drawing::XShapes > xRootShape) = 0;
static css::uno::Reference< css::drawing::XShapes >
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
deleted file mode 100644
index bb31428d7db1..000000000000
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ /dev/null
@@ -1,210 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DBARCHART_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DBARCHART_HXX
-
-#include "GL3DPlotterBase.hxx"
-
-#include <deque>
-#include <memory>
-#include <vector>
-
-#include <glm/glm.hpp>
-
-#include <vcl/idle.hxx>
-#include <vcl/openglwin.hxx>
-
-#include <rtl/ref.hxx>
-
-#include <osl/conditn.hxx>
-
-namespace com { namespace sun { namespace star { namespace chart2 { class XChartType; } } } }
-class Timer;
-
-namespace chart {
-
-class ExplicitCategoriesProvider;
-
-namespace opengl3D {
-
-class Renderable3DObject;
-class OpenGL3DRenderer;
-class TextCache;
-class Camera;
-
-}
-
-enum RenderEventType
-{
- EVENT_NONE,
- EVENT_CLICK,
- EVENT_MOVE_TO_DEFAULT,
- EVENT_DRAG_LEFT,
- EVENT_DRAG_RIGHT,
- EVENT_SCROLL,
- EVENT_SHOW_SCROLL,
- EVENT_SHOW_SELECT,
- EVENT_AUTO_FLY,
- EVENT_SELECTBAR_UPDEDATE
-};
-
-class RenderThread;
-class RenderOneFrameThread;
-class RenderAnimationThread;
-
-class GL3DBarChart : public GL3DPlotterBase, public IRenderer
-{
- friend class RenderThread;
- friend class RenderOneFrameThread;
- friend class RenderAnimationThread;
- friend class RenderBenchMarkThread;
-public:
- GL3DBarChart(
- const css::uno::Reference<css::chart2::XChartType>& xChartType,
- OpenGLWindow* pContext);
-
- virtual ~GL3DBarChart() override;
-
- virtual void create3DShapes(const std::vector<std::unique_ptr<VDataSeries>>& rDataSeries,
- ExplicitCategoriesProvider& rCatProvider) override;
-
- virtual void render() override;
-
- /// Render one frame of the 3D bar chart.
- void renderFrame();
-
- virtual void update() override;
-
- /// Draw to the framebuffer context, and provide the ID of the bar that the user has clicked.
- sal_uInt32 barIdAtPosition(const Point& rPos);
- virtual void clickedAt(const Point& rPos, sal_uInt16 nButtons) override;
-
- virtual void mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 nButtons) override;
- virtual void scroll(long nDelta) override;
- virtual void contextDestroyed() override;
-
- void setOpenGLWindow(OpenGLWindow* pWindow);
-
-private:
-
- void spawnRenderThread(RenderThread *pThread);
- void joinRenderThread();
- void moveToCorner();
- void moveToDefault();
- glm::vec3 getCornerPosition(sal_Int8 nCornerId);
- void updateScreenText();
- void updateRenderFPS();
- void updateDataUpdateFPS();
- DECL_LINK(UpdateTimerHdl, Timer*, void);
- static int calcTimeInterval(TimeValue const &startTime, TimeValue const &endTime);
- float addScreenTextShape(OUString &nStr, const glm::vec2& rLeftOrRightTop, float nTextHeight, bool bLeftTopFlag,
- const glm::vec4& rColor,
- const glm::vec3& rPos = glm::vec3(0.0f, 0.0f, 0.0f),
- sal_uInt32 nEvent = 0);
- void recordBarHistory(sal_uInt32 nBarID, float nVal);
- void updateClickEvent();
- void calcDistance(std::vector<sal_uInt32> &vectorNearest);
- static float calcScrollDistance(const glm::mat4 &mvp, const glm::vec3& rPos);
- void initDistanceHeap(std::vector<sal_uInt32> &vectorNearest);
- void keepHeap(std::vector<sal_uInt32> &vectorNearest, int index);
- static void swapVector(int i, int j, std::vector<sal_uInt32> &vectorNearest);
- void getNearestBars(std::vector<sal_uInt32> &vectorNearest);
- void updateScroll();
- void processAutoFly(sal_uInt32 nId, Color nColor);
- void getNeighborBarID(sal_uInt32 nSelectBarId, sal_uInt32 *pNeighborBarId);
- void addMovementScreenText(sal_uInt32 nBarId);
- css::uno::Reference<css::chart2::XChartType> mxChartType;
- std::vector<std::unique_ptr<opengl3D::Renderable3DObject> > maShapes;
-
- std::unique_ptr<opengl3D::OpenGL3DRenderer> mpRenderer;
- VclPtr<OpenGLWindow> mpWindow;
-
- opengl3D::Camera* mpCamera;
- bool mbValidContext;
-
- std::unique_ptr<opengl3D::TextCache> mpTextCache;
-
- glm::vec3 maCameraPosition;
- glm::vec3 maCameraDirection;
-
- glm::vec3 maDefaultCameraPosition;
- glm::vec3 maDefaultCameraDirection;
-
- float mnMaxX;
- float mnMaxY;
- float mnDistance;
- /**
- * 0 = corner at (0,0,0);
- * numbering counter clockwise
- */
- sal_Int8 mnCornerId;
-
- std::vector<OUString> maCategories;
- std::vector<OUString> maSeriesNames;
- struct BarInformation
- {
- glm::vec3 maPos;
- float mnVal;
-
- BarInformation(const glm::vec3& rPos, float nVal);
- };
-
- std::map<sal_uInt32, const BarInformation> maBarMap;
- bool mbNeedsNewRender;
- bool mbCameraInit;
-
- osl::Mutex maMutex;
- rtl::Reference<RenderThread> mpRenderThread;
- bool mbRenderDie;
- ::osl::Condition maClickCond;
- RenderEventType maRenderEvent;
- RenderEventType maPreRenderEvent;
- sal_uInt32 mnSelectBarId;
- sal_uInt32 mnPreSelectBarId;
- Point maClickPos;
- sal_uInt32 miScrollRate;
- bool mbScrollFlg;
- Idle maIdle;
- bool mbScreenTextNewRender;
- std::vector<std::unique_ptr<opengl3D::Renderable3DObject>> maScreenTextShapes;
- OUString maFPS;
- OUString maDataUpdateFPS;
- sal_uInt32 miFrameCount;
- sal_uInt32 miDataUpdateCounter;
- TimeValue maFPSRenderStartTime;
- TimeValue maFPSRenderEndTime;
- TimeValue maDataUpdateStartTime;
- TimeValue maDataUpdateEndTime;
- std::map<sal_uInt32, std::deque<float> > maBarHistory;
- std::vector<sal_uInt32> maVectorNearest;
- std::map<sal_uInt32, float> maDistanceMap;
- std::map<sal_uInt32, Color> maBarColorMap;
- int mnColorRate;
- bool mbBenchMarkMode;
- sal_uInt32 mnHistoryCounter;
- sal_uInt32 mnBarsInRow;
- bool mbAutoFly;
- sal_Int32 mnUpdateBarId;
-
- // these form a pair:
- // main thread sets condition 1 and waits until it can take the mutex
- // render thread checks condition 1 before taking the mutex and waits in case it
- // is set until condition 2 is set
- //
- // only necessary for the benchmark mode
- osl::Condition maCond1;
- osl::Condition maCond2;
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/GL3DPlotterBase.hxx b/chart2/source/view/inc/GL3DPlotterBase.hxx
deleted file mode 100644
index 33c5deda360d..000000000000
--- a/chart2/source/view/inc/GL3DPlotterBase.hxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DPLOTTERBASE_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DPLOTTERBASE_HXX
-
-#include <vector>
-#include <memory>
-
-namespace chart {
-
-class ExplicitCategoriesProvider;
-class VDataSeries;
-
-class GL3DPlotterBase
-{
-public:
- virtual ~GL3DPlotterBase();
-
- virtual void create3DShapes(const std::vector<std::unique_ptr<VDataSeries> >& rDataSeries,
- ExplicitCategoriesProvider& rCatProvider) = 0;
- virtual void render() = 0;
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
deleted file mode 100644
index 2fcef5c309e5..000000000000
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ /dev/null
@@ -1,491 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DRENDERER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DRENDERER_HXX
-
-#include <glm/glm.hpp>
-#include <glm/gtx/transform.hpp>
-#include <glm/gtx/euler_angles.hpp>
-#include <glm/gtx/quaternion.hpp>
-
-#include <boost/shared_array.hpp>
-#include <tools/gen.hxx>
-#include <tools/color.hxx>
-#include <string.h>
-
-#include <epoxy/gl.h>
-
-#include <vector>
-#include <map>
-
-namespace chart {
-
-namespace opengl3D {
-
-const auto maxLights = 8;
-
-struct PosVecf3
-{
- float x;
- float y;
- float z;
-};
-
-typedef std::vector <glm::vec3> Vertices3D;
-typedef std::vector <glm::vec3> Normals3D;
-
-// fields must match definition in GLSL shader file
-struct MaterialParameters
-{
- glm::vec4 ambient;
- glm::vec4 diffuse;
- glm::vec4 specular;
- glm::vec4 materialColor;
-
- bool twoSidesLighting;
- float shininess;
- float pad;
- float pad1;
-};
-
-// fields must match definition in GLSL shader file
-struct LightSource
-{
- glm::vec4 lightColor;
- glm::vec4 positionWorldspace;
- float lightPower;
- float pad1;
- float pad2;
- float pad3;
-};
-
-struct GlobalLights
-{
- int lightNum;
- glm::vec4 ambient;
- LightSource light[maxLights];
-};
-
-struct Polygon3DInfo
-{
- bool lineOnly;
- float lineWidth;
- bool twoSidesLighting;
- long fillStyle;
- glm::vec4 polygonColor;
- glm::vec4 id;
- Vertices3D *vertices;
- Normals3D *normals;
- std::vector <Vertices3D *> verticesList;
- std::vector <Normals3D *> normalsList;
- MaterialParameters material;
-};
-
-struct Extrude3DInfo
-{
- bool rounded;
- bool twoSidesLighting;
- glm::vec4 extrudeColor;
- glm::vec4 id;
- sal_uInt32 orgID;
- float xScale;
- float yScale;
- float zScale;
- float xTransform;
- float yTransform;
- float zTransform;
- glm::mat4 rotation;
- MaterialParameters material;
- int startIndex[5];
- int size[5];
- int reverse;
-};
-
-struct CameraInfo
-{
- glm::vec3 cameraPos;
- glm::vec3 cameraOrg;
- glm::vec3 cameraUp;
-
- CameraInfo():
- cameraUp(glm::vec3(0, 0, 1)) {}
-};
-
-struct RoundBarMesh
-{
- float topThreshold;
- float bottomThreshold;
- int iMeshStartIndices;
- int iMeshSizes;
- int iElementStartIndices[5];
- int iElementSizes[5];
-};
-
-struct PackedVertex{
- glm::vec3 position;
- glm::vec3 normal;
- bool operator<(const PackedVertex& that) const{
- return memcmp(this, &that, sizeof(PackedVertex))>0;
- };
-};
-
-struct TextInfo
-{
- glm::vec4 id;
- sal_uInt32 uniqueId;
- GLuint texture;
- float vertex[12];
- glm::vec3 pos;
- glm::vec4 textColor;
-};
-
-struct TextureArrayInfo
-{
- size_t subTextureNum;
- int textureArrayWidth;
- int textureArrayHeight;
- GLuint textureID;
-
- TextureArrayInfo();
-};
-
-struct TextInfoBatch
-{
- size_t batchNum;
- std::vector<glm::vec4> idList;
- std::vector<TextureArrayInfo> texture;
- std::vector<glm::vec3> vertexList;
- std::vector<glm::vec3> textureCoordList;
-};
-
-struct BatchBarInfo
-{
- std::vector <glm::mat4> modelMatrixList;
- std::vector <glm::mat3> normalMatrixList;
- std::vector <glm::vec4> colorList;
- std::map<sal_uInt32, unsigned int> mapId2Color;
- glm::vec4 selectBarColor;
-};
-
-class OpenGL3DRenderer
-{
-public:
- OpenGL3DRenderer();
- ~OpenGL3DRenderer();
-
- void init();
- void Set3DSenceInfo(Color color, bool twoSidesLighting = true);
- void SetLightInfo(bool lightOn, Color color, const glm::vec4& direction);
- void AddShapePolygon3DObject(Color color, bool lineOnly, Color lineColor,
- long fillStyle, sal_uInt32 specular, sal_uInt32 nUniqueId);
- void EndAddShapePolygon3DObject();
- void AddPolygon3DObjectNormalPoint(float x, float y, float z);
- void EndAddPolygon3DObjectNormalPoint();
- void AddPolygon3DObjectPoint(float x, float y, float z);
- void EndAddPolygon3DObjectPoint();
- void AddShape3DExtrudeObject(bool roundedCorner, Color color, sal_uInt32 specular, const glm::mat4& modelMatrix, sal_uInt32 nUniqueId);
- void EndAddShape3DExtrudeObject();
- void SetSize(const Size& rSize);
- void SetCameraInfo(const glm::vec3& pos, const glm::vec3& direction, const glm::vec3& up);
- void CreateTextTexture(const boost::shared_array<sal_uInt8> &bitmapBuf,
- const ::Size& rSizePixels,
- const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
- const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
- sal_uInt32 nUniqueId);
- void CreateScreenTextTexture(const boost::shared_array<sal_uInt8> &bitmapBuf,
- const ::Size& rSizePixels, const glm::vec2& vTopLeft,
- const glm::vec2& vBottomRight, const glm::vec3& vPos, const glm::vec4& vScreenTextColor,
- sal_uInt32 nUniqueId);
- void ProcessUnrenderedShape(bool bNewScene);
-
- void SetPickingMode(bool bPickingMode);
-
- Color GetPixelColorFromPoint(long nX, long nY);
-
- void ReleaseShapes();
- void ReleaseScreenTextShapes();
- void ReleaseTextTexture();
- void ReleaseScreenTextTexture();
- void StartClick(sal_uInt32 selectID);
- void EndClick();
- void SetScroll();
- void SetScrollSpeed(float scrollSpeed);
- void SetScrollDistance(float scrollDistance);
- void SetSceneEdge(float minCoordX, float maxCoordX);
- const glm::mat4& GetProjectionMatrix();
- const glm::mat4& GetViewMatrix();
- const glm::mat4& GetGlobalScaleMatrix();
- glm::mat4 GetDiffOfTwoCameras(const glm::vec3& rBeginPos, const glm::vec3& rEndPos, const glm::vec3& rBeginDirection, const glm::vec3& rEndDirection);
- glm::mat4 GetDiffOfTwoCameras(const glm::vec3& rEndPos, const glm::vec3& rEndDirection);
- void AddMatrixDiff(const glm::mat4& aMat);
- void ResetMatrixDiff();
-private:
- void MoveModelf( const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale);
-
- static void ClearBuffer();
- void RenderPolygon3DObject();
- void RenderLine3D(const Polygon3DInfo &polygon);
- void RenderPolygon3D(const Polygon3DInfo &polygon);
- void Init3DUniformBlock();
- void Update3DUniformBlock();
- void RenderExtrude3DObject();
- //add for text
- void RenderTextShape();
- void RenderScreenTextShape();
- void RenderExtrudeSurface(const Extrude3DInfo& extrude3D);
- void RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D);
- void RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D);
- void RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D);
- void RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D, int surIndex);
- void AddVertexData(GLuint vertexBuf);
- void AddNormalData(GLuint normalBuf);
- void AddIndexData(GLuint indexBuf);
- void RenderNonRoundedBar(const Extrude3DInfo& extrude3D);
- static bool GetSimilarVertexIndex(PackedVertex const & packed,
- std::map<PackedVertex,unsigned short> & VertexToOutIndex,
- unsigned short & result
- );
- static void SetVertex(PackedVertex const &packed,
- std::map<PackedVertex,unsigned short> &VertexToOutIndex,
- std::vector<glm::vec3> &vertex,
- std::vector<glm::vec3> &normal,
- std::vector<unsigned short> &indeices);
- void CreateActualRoundedCube(float fRadius, int iSubDivY, int iSubDivZ, float width, float height, float depth);
- static int GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, std::vector<glm::vec3> &normals, float fRadius, int iSubDivY,
- int iSubDivZ, float width, float height, float depth);
- void CreateSceneBoxView();
-
- void ReleasePolygonShapes();
- void ReleaseExtrude3DShapes();
- void ReleaseTextShapes();
- void ReleaseBatchBarInfo();
- void GetBatchBarsInfo();
- void GetBatchTopAndFlatInfo(const Extrude3DInfo &extrude3D);
- void GetBatchMiddleInfo(const Extrude3DInfo &extrude3D);
- void InitBatch3DUniformBlock();
- void UpdateBatch3DUniformBlock();
- void RenderBatchBars(bool bNewScene);
- void RenderTextShapeBatch();
- void ReleaseTextShapesBatch();
- void CreateTextTextureSingle(const boost::shared_array<sal_uInt8> &bitmapBuf,
- const ::Size& rSizePixels,
- const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
- const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
- sal_uInt32 nUniqueId);
- void CreateTextTextureBatch(const boost::shared_array<sal_uInt8> &bitmapBuf,
- const ::Size& rSizePixels,
- const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
- const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
- sal_uInt32 nUniqueId);
- void SetHighLightBar(BatchBarInfo &barInfo);
- void DisableHighLightBar(BatchBarInfo &barInfo);
- void CalcScrollMoveMatrix(bool bNewScene);
-private:
-
- struct ShaderResources
- {
- bool m_b330Support;
- bool m_bScrollFlag;
- // 3DProID
- GLint m_3DProID;
- GLint m_3DProjectionID;
- GLint m_3DViewID;
- GLint m_3DModelID;
- GLint m_3DNormalMatrixID;
- GLint m_3DVertexID;
- GLint m_3DNormalID;
- GLint m_3DMinCoordXID;
- GLint m_3DMaxCoordXID;
- GLint m_3DUndrawID;
- //300 version;
- GLint m_3DMaterialAmbientID;
- GLint m_3DMaterialDiffuseID;
- GLint m_3DMaterialSpecularID;
- GLint m_3DMaterialColorID;
- GLint m_3DMaterialTwoSidesID;
- GLint m_3DMaterialShininessID;
- GLint m_3DLightColorID;
- GLint m_3DLightPosID;
- GLint m_3DLightPowerID;
- GLint m_3DLightNumID;
- GLint m_3DLightAmbientID;
-
- // TextProID
- GLint m_TextProID;
- GLint m_TextMatrixID;
- GLint m_TextVertexID;
- GLint m_TextTexCoordID;
- GLint m_TextTexID;
-
- // ScreenTextProID
- GLint m_ScreenTextProID;
- GLint m_ScreenTextVertexID;
- GLint m_ScreenTextTexCoordID;
- GLint m_ScreenTextTexID;
- GLint m_ScreenTextColorID;
-
- // CommonProID
- GLint m_CommonProID;
- GLint m_2DVertexID;
- GLint m_2DColorID;
- GLint m_MatrixID;
-
- // Batch render
- GLint m_3DBatchProID;
- GLint m_3DBatchProjectionID;
- GLint m_3DBatchViewID;
- GLint m_3DBatchModelID;
- GLint m_3DBatchNormalMatrixID;
- GLint m_3DBatchVertexID;
- GLint m_3DBatchNormalID;
- GLint m_3DBatchColorID;
- GLint m_3DBatchTransMatrixID;
- GLint m_3DBatchMinCoordXID;
- GLint m_3DBatchMaxCoordXID;
- GLint m_3DBatchUndrawID;
-
- //Batch render text
- bool mbTexBatchSupport;
- GLint m_BatchTextProID;
- GLint m_BatchTextMatrixID;
- GLint m_BatchTextVertexID;
- GLint m_BatchTextTexCoordID;
- GLint m_BatchTextTexID;
-
- ShaderResources();
- ~ShaderResources();
-
- void LoadShaders();
- };
-
- struct PickingShaderResources
- {
- // CommonProID
- GLint m_CommonProID;
- GLint m_2DVertexID;
- GLint m_2DColorID;
- GLint m_MatrixID;
- GLint m_ModelID;
- GLint m_MinCoordXID;
- GLint m_MaxCoordXID;
- PickingShaderResources();
- ~PickingShaderResources();
-
- void LoadShaders();
- };
-
- ShaderResources maResources;
- PickingShaderResources maPickingResources;
-
- // Model matrix : an identity matrix (model will be at the origin
- glm::mat4 m_Model;
-
- sal_Int32 m_iWidth;
-
- sal_Int32 m_iHeight;
-
- GlobalLights m_LightsInfo;
-
- CameraInfo m_CameraInfo;
-
- Polygon3DInfo m_Polygon3DInfo;
-
- std::vector <Polygon3DInfo> m_Polygon3DInfoList;
-
- glm::mat4 m_3DProjection;
-
- glm::mat4 m_3DView;
-
- glm::mat4 m_3DMVP;
-
- GLuint m_3DUBOBuffer;
-
- GLint m_3DActualSizeLight;
-
- GLuint m_NormalBuffer;
-
- GLuint m_VertexBuffer;
-
- Extrude3DInfo m_Extrude3DInfo;
-
- std::vector <Extrude3DInfo> m_Extrude3DList;
-
- GLuint m_CubeVertexBuf;
-
- GLuint m_CubeElementBuf;
-
- GLuint m_CubeNormalBuf;
-
- GLuint m_BoundBox;
- GLuint m_BoundBoxNormal;
- // add for text
- std::vector <TextInfo> m_TextInfoList;
- std::vector <TextInfo> m_ScreenTextInfoList;
- GLuint m_TextTexCoordBuf;
- GLuint m_TextTexCoordBufBatch;
-
- std::vector<glm::vec3> m_Vertices;
-
- std::vector<glm::vec3> m_Normals;
-
- std::vector<unsigned short> m_Indices;
-
- RoundBarMesh m_RoundBarMesh;
-
- GLuint m_RenderVertexBuf;
-
- GLuint m_RenderTexCoordBuf;
-
- float m_fViewAngle;
-
- bool mbPickingMode;
-
- GLuint mnPickingFbo;
- GLuint mnPickingRboDepth;
- GLuint mnPickingRboColor;
-
- BatchBarInfo m_BarSurface[3];
- GLuint m_BatchModelMatrixBuf;
- GLuint m_BatchNormalMatrixBuf;
- GLuint m_BatchColorBuf;
- MaterialParameters m_Batchmaterial;
- GLuint m_Batch3DUBOBuffer;
- GLint m_Batch3DActualSizeLight;
-
- glm::mat4 m_GlobalScaleMatrix;
- TextInfoBatch m_TextInfoBatch;
- //for 3.0 version
- int m_iLightNum;
- glm::vec4 m_Ambient;
- glm::vec4 m_LightColor[maxLights];
- glm::vec4 m_PositionWorldspace[maxLights];
- float m_fLightPower[maxLights];
- //for 3.0 end
- std::vector<GLuint> m_Texturelist;
- std::vector<GLuint> m_ScreenTexturelist;
- bool m_bHighLighting;
- sal_uInt32 m_uiSelectID;
- float m_fScrollSpeed;
- float m_fScrollDistance;
- float m_fMinCoordX;
- float m_fMaxCoordX;
- float m_fCurDistance;
- glm::mat4 m_ScrollMoveMatrix;
- bool m_bUndrawFlag;
- glm::mat4 m_matDiff;
-};
-
-}
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx b/chart2/source/view/inc/OpenglShapeFactory.hxx
deleted file mode 100644
index 7963068ce79e..000000000000
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_OPENGLSHAPEFACTORY_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_OPENGLSHAPEFACTORY_HXX
-
-#include "AbstractShapeFactory.hxx"
-
-namespace chart {
-
-namespace opengl {
-
-// This class is stateless!!!!!
-// Don't add member variables
-class OpenglShapeFactory : public chart::AbstractShapeFactory
-{
-public:
-
- virtual css::uno::Reference< css::drawing::XShapes >
- createGroup2D(
- const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const OUString& aName = OUString() ) override;
-
- virtual css::uno::Reference< css::drawing::XShapes >
- createGroup3D(
- const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const OUString& aName = OUString() ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createCube( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::Position3D& rPosition
- , const css::drawing::Direction3D& rSize
- , sal_Int32 nRotateZAngleHundredthDegree
- , const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
- , const tPropertyNameMap& rPropertyNameMap
- , bool bRounded = false) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createCylinder( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::Position3D& rPosition
- , const css::drawing::Direction3D& rSize
- , sal_Int32 nRotateZAngleHundredthDegree ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createPyramid( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::Position3D& rPosition
- , const css::drawing::Direction3D& rSize
- , double fTopHeight
- , bool bRotateZ
- , const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
- , const tPropertyNameMap& rPropertyNameMap) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createCone( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::Position3D& rPosition
- , const css::drawing::Direction3D& rSize
- , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createPieSegment2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
- , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
- , const css::drawing::Direction3D& rOffset
- , const css::drawing::HomogenMatrix& rUnitCircleToScene ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createPieSegment( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
- , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
- , const css::drawing::Direction3D& rOffset
- , const css::drawing::HomogenMatrix& rUnitCircleToScene
- , double fDepth ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createStripe( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const Stripe& rStripe
- , const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
- , const tPropertyNameMap& rPropertyNameMap
- , bool bDoubleSided
- , short nRotatedTexture = 0 //0 to 7 are the different possibilities
- , bool bFlatNormals=true ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createArea3D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::PolyPolygonShape3D& rPolyPolygon
- , double fDepth) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createArea2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::PolyPolygonShape3D& rPolyPolygon) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createSymbol2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::Position3D& rPos
- , const css::drawing::Direction3D& rSize
- , sal_Int32 nStandardSymbol
- , sal_Int32 nBorderColor
- , sal_Int32 nFillColor ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createGraphic2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::Position3D& rPos
- , const css::drawing::Direction3D& rSize
- , const css::uno::Reference< css::graphic::XGraphic >& xGraphic ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createLine2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::PointSequenceSequence& rPoints
- , const VLineProperties* pLineProperties = nullptr ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createLine ( const css::uno::Reference< css::drawing::XShapes >& xTarget,
- const css::awt::Size& rSize, const css::awt::Point& rPosition ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createLine3D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::PolyPolygonShape3D& rPoints
- , const VLineProperties& rLineProperties ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createCircle2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::drawing::Position3D& rPos
- , const css::drawing::Direction3D& rSize ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createCircle( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::awt::Size& rSize
- , const css::awt::Point& rPosition ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createText( const css::uno::Reference< css::drawing::XShapes >& xTarget2D
- , const OUString& rText
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues
- , const css::uno::Any& rATransformation
- ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createText( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , const css::uno::Sequence< OUString >& rTextParagraphs
- , const css::uno::Sequence< tNameSequence >& rParaPropNames
- , const css::uno::Sequence< tAnySequence >& rParaPropValues
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues
- , const css::uno::Any& rATransformation ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createText( const css::uno::Reference< css::drawing::XShapes >& xTarget
- , css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues
- , const css::uno::Any& rATransformation ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createText( const css::uno::Reference< css::drawing::XShapes >& xTarget2D,
- const css::awt::Size& rSize,
- const css::awt::Point& rPosition,
- css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString,
- const css::uno::Reference< css::beans::XPropertySet > & xTextProperties,
- double nRotation, const OUString& aName ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createInvisibleRectangle(
- const css::uno::Reference<
- css::drawing::XShapes >& xTarget
- , const css::awt::Size& rSize ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createRectangle(
- const css::uno::Reference< css::drawing::XShapes >& xTarget,
- const css::awt::Size& rSize,
- const css::awt::Point& rPosition,
- const tNameSequence& rPropNames,
- const tAnySequence& rPropValues,
- StackPosition ePos = Top ) override;
-
- virtual css::uno::Reference< css::drawing::XShape >
- createRectangle(
- const css::uno::Reference< css::drawing::XShapes >& xTarget ) override;
-
- virtual css::uno::Reference< css::drawing::XShapes >
- getOrCreateChartRootShape( const css::uno::Reference< css::drawing::XDrawPage>& xPage ) override;
-
- virtual void setPageSize( css::uno::Reference < css::drawing::XShapes > xChartShapes, const css::awt::Size& rSize ) override;
-
- virtual void render(css::uno::Reference< css::drawing::XShapes > xDrawPage, bool bInitOpenGL) override;
-
- virtual bool preRender(css::uno::Reference< css::drawing::XShapes > xRootShape, OpenGLWindow* pWindow) override;
- virtual void postRender(OpenGLWindow* pWindow) override;
-
- virtual void clearPage(css::uno::Reference< css::drawing::XShapes > xDrawPage) override;
-};
-
-}
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index ec1080732142..459908531e71 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -227,14 +227,6 @@ public:
virtual void setPageSize( css::uno::Reference < css::drawing::XShapes > xChartShapes, const css::awt::Size& rSize ) override;
- /**
- * not necessary right now
- */
- virtual void render(css::uno::Reference< css::drawing::XShapes >, bool ) override {}
-
- virtual bool preRender(css::uno::Reference< css::drawing::XShapes >, OpenGLWindow*) override { return true; }
- virtual void postRender(OpenGLWindow*) override {}
-
virtual void clearPage(css::uno::Reference< css::drawing::XShapes > ) override {}
private:
diff --git a/chart2/source/view/inc/StaticGeometry.h b/chart2/source/view/inc/StaticGeometry.h
deleted file mode 100644
index 525b15b20e26..000000000000
--- a/chart2/source/view/inc/StaticGeometry.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_STATICGEOMETRY_H
-#define INCLUDED_CHART2_SOURCE_VIEW_INC_STATICGEOMETRY_H
-
-#define TOP_SURFACE 0
-#define MIDDLE_SURFACE 1
-#define FLAT_BOTTOM_SURFACE 2
-#define BOTTOM_SURFACE 3
-#define FLAT_TOP_SURFACE 4
-
-static GLfloat boundBox[] = {
- 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 1.0f, 1.0f,//1
-
- 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 1.0f,
- 0.0f, 1.0f, 0.0f,//2
-
- 1.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,//3
-
- 1.0f, 1.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f,//4
-
- 1.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,//5
-
- 1.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 0.0f,//6
-
- 1.0f, 1.0f, 1.0f,
- 1.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,//7
-
- 1.0f, 1.0f, 1.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 1.0f,//8
-
- 0.0f, 1.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 1.0f, 0.0f, 1.0f,//9
-
- 1.0f, 1.0f, 1.0f,
- 0.0f, 1.0f, 1.0f,
- 1.0f, 0.0f, 1.0f,//10
-
- 1.0f, 1.0f, 1.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 1.0f, 0.0f,//11
-
- 1.0f, 0.0f, 0.0f,
- 1.0f, 1.0f, 1.0f,
- 1.0f, 0.0f, 1.0f//12
-};
-
-static const GLfloat boundBoxNormal[] = {
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,//1
-
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,//2
-
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,//3
-
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,
- 0.0f, 0.0f, -1.0f,//4
-
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f,- 1.0f, 0.0f,//5
-
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,
- 0.0f, -1.0f, 0.0f,//6
-
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,//7
-
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,//8
-
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,//9
-
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f,//10
-
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,//11
-
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f,
- 1.0f, 0.0f, 0.0f//12
-};
-
-static GLfloat coordReverseVertices[] = {
- 0.0f, 1.0f,
- 1.0f, 1.0f,
- 1.0f, 0.0f,
- 0.0f, 0.0f,
-};
-
-static GLfloat squareVertices[] = {
- -1.0f, -1.0f, -1.0,
- 1.0f, -1.0f, -1.0,
- 1.0f, 1.0f, -1.0,
- -1.0f, 1.0f, -1.0
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx
deleted file mode 100644
index 538308bfd539..000000000000
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- 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/.
- */
-
-#include <3DChartObjects.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/svapp.hxx>
-#include <sal/log.hxx>
-
-#include <vcl/opengl/GLMHelper.hxx>
-#include <vcl/opengl/OpenGLHelper.hxx>
-#include <vcl/bitmapaccess.hxx>
-
-namespace chart {
-
-namespace opengl3D {
-
-Renderable3DObject::Renderable3DObject(OpenGL3DRenderer* pRenderer, sal_uInt32 nId):
- mpRenderer(pRenderer),
- mnUniqueId(nId)
-{
-}
-
-void Renderable3DObject::render()
-{
- (void) mnUniqueId;
-}
-
-Bar::Bar(OpenGL3DRenderer* pRenderer, const glm::mat4& rPosition, Color aColor, sal_uInt32 nId)
- : Renderable3DObject(pRenderer, nId)
- , maPos(rPosition)
- , maColor(aColor)
-{
- SAL_INFO("chart2.3dopengl", rPosition);
-}
-
-void Bar::render()
-{
- mpRenderer->AddShape3DExtrudeObject(true/*RoundedCorners*/, maColor, 0xFFFFFF, maPos, mnUniqueId);
- mpRenderer->EndAddShape3DExtrudeObject();
-}
-
-Line::Line(OpenGL3DRenderer* pRenderer, sal_uInt32 nId):
- Renderable3DObject(pRenderer, nId)
-{
-}
-
-void Line::render()
-{
- mpRenderer->AddShapePolygon3DObject(Color(0), true, maLineColor, 0, 0, mnUniqueId);
- mpRenderer->AddPolygon3DObjectPoint(maPosBegin.x, maPosBegin.y, maPosBegin.z);
- mpRenderer->AddPolygon3DObjectPoint(maPosEnd.x, maPosEnd.y, maPosEnd.z);
- mpRenderer->EndAddPolygon3DObjectPoint();
- mpRenderer->EndAddShapePolygon3DObject();
-}
-
-void Line::setPosition(const glm::vec3& rBegin, const glm::vec3& rEnd)
-{
- maPosBegin = rBegin;
- maPosEnd = rEnd;
-}
-
-void Line::setLineColor(const Color& rColor)
-{
- maLineColor = rColor;
-}
-
-const TextCacheItem& TextCache::getText(OUString const & rText, bool bIs3dText)
-{
- TextCacheType::const_iterator const itr = m_TextCache.find(rText);
- if (itr != m_TextCache.end())
- return itr->second;
-
- ScopedVclPtrInstance< VirtualDevice > pDevice(*Application::GetDefaultDevice(),
- DeviceFormat::DEFAULT, DeviceFormat::DEFAULT);
- vcl::Font aFont;
- if(bIs3dText)
- aFont = vcl::Font("Brillante St",Size(0,0));
- else
- aFont = pDevice->GetFont();
- aFont.SetFontSize(Size(0, 96));
- aFont.SetColor(COL_GREEN);
- pDevice->SetFont(aFont);
- pDevice->Erase();
-
- pDevice->SetOutputSize(Size(pDevice->GetTextWidth(rText), pDevice->GetTextHeight()));
- pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
- pDevice->DrawText(Point(0,0), rText);
-
- BitmapEx aText(pDevice->GetBitmapEx(Point(0,0), pDevice->GetOutputSize()));
- Bitmap aBitmap (aText.GetBitmap());
- BitmapReadAccess *pAcc = aBitmap.AcquireReadAccess();
- sal_uInt8 *buf = reinterpret_cast<sal_uInt8 *>(pAcc->GetBuffer());
- long nBmpWidth = aText.GetSizePixel().Width();
- long nBmpHeight = aText.GetSizePixel().Height();
- sal_uInt8* pBitmapBuf(new sal_uInt8[3* nBmpWidth * nBmpHeight]);
- memcpy(pBitmapBuf, buf, 3* nBmpWidth * nBmpHeight);
- m_TextCache.insert(std::make_pair(rText, TextCacheItem(pBitmapBuf, aText.GetSizePixel())));
- Bitmap::ReleaseAccess(pAcc);
- return m_TextCache.find(rText)->second;
-}
-
-Text::Text(OpenGL3DRenderer* pRenderer, TextCache& rTextCache, const OUString& rStr, sal_uInt32 nId):
- Renderable3DObject(pRenderer, nId),
- maText(rTextCache.getText(rStr))
-{
-}
-
-void Text::render()
-{
- glm::vec3 dir2 = maTopRight - maTopLeft;
- glm::vec3 bottomLeft = maBottomRight - dir2;
- mpRenderer->CreateTextTexture(maText.maPixels, maText.maSize,
- maTopLeft, maTopRight, maBottomRight, bottomLeft,
- mnUniqueId);
-}
-
-void Text::setPosition(const glm::vec3& rTopLeft, const glm::vec3& rTopRight, const glm::vec3& rBottomRight)
-{
- maTopLeft = rTopLeft;
- maTopRight = rTopRight;
- maBottomRight = rBottomRight;
-}
-
-ScreenText::ScreenText(OpenGL3DRenderer* pRenderer, TextCache& rTextCache,
- const OUString& rStr, const glm::vec4& rColor, sal_uInt32 nId, bool bIs3dText):
- Renderable3DObject(pRenderer, nId),
- maText(rTextCache.getText(rStr,bIs3dText)),
- maColor(rColor)
-{
-}
-
-void ScreenText::setPosition(const glm::vec2& rTopLeft, const glm::vec2& rBottomRight,
- const glm::vec3& r3DPos)
-{
- maTopLeft = rTopLeft;
- maBottomRight = rBottomRight;
- ma3DPos = r3DPos;
-}
-
-void ScreenText::render()
-{
- mpRenderer->CreateScreenTextTexture(maText.maPixels, maText.maSize,
- maTopLeft, maBottomRight, ma3DPos, maColor,
- mnUniqueId);
-}
-
-Rectangle::Rectangle(OpenGL3DRenderer* pRenderer, sal_uInt32 nId):
- Renderable3DObject(pRenderer, nId)
-{
-}
-
-void Rectangle::render()
-{
- glm::vec3 dir1 = maBottomRight - maTopLeft;
- glm::vec3 dir2 = maTopRight - maTopLeft;
- glm::vec3 normal = glm::normalize(glm::cross(dir1, dir2));
- mpRenderer->AddShapePolygon3DObject(maColor, false, Color(0), 1, 0xFFFFFF, mnUniqueId);
- glm::vec3 bottomLeft = maBottomRight - dir2;
- //set polygon points and normals
- mpRenderer->AddPolygon3DObjectPoint(maBottomRight.x, maBottomRight.y, maBottomRight.z);
- mpRenderer->AddPolygon3DObjectNormalPoint(normal.x, normal.y, normal.z);
- mpRenderer->AddPolygon3DObjectPoint(maTopRight.x, maTopRight.y, maTopRight.z);
- mpRenderer->AddPolygon3DObjectNormalPoint(normal.x, normal.y, normal.z);
- mpRenderer->AddPolygon3DObjectPoint(maTopLeft.x, maTopLeft.y, maTopLeft.z);
- mpRenderer->AddPolygon3DObjectNormalPoint(normal.x, normal.y, normal.z);
- mpRenderer->AddPolygon3DObjectPoint(bottomLeft.x, bottomLeft.y, bottomLeft.z);
- mpRenderer->AddPolygon3DObjectNormalPoint(normal.x, normal.y, normal.z);
- mpRenderer->EndAddPolygon3DObjectPoint();
- mpRenderer->EndAddPolygon3DObjectNormalPoint();
- mpRenderer->EndAddShapePolygon3DObject();
- //we should render the edge if the edge color is different from the fill color
- if (maColor != maLineColor)
- {
- mpRenderer->AddShapePolygon3DObject(Color(0), true, maLineColor, 0, 0xFFFFFF, mnUniqueId);
- mpRenderer->AddPolygon3DObjectPoint(maBottomRight.x, maBottomRight.y, maBottomRight.z);
- mpRenderer->AddPolygon3DObjectPoint(maTopRight.x, maTopRight.y, maTopRight.z);
- mpRenderer->AddPolygon3DObjectPoint(maTopLeft.x, maTopLeft.y, maTopLeft.z);
- mpRenderer->AddPolygon3DObjectPoint(bottomLeft.x, bottomLeft.y, bottomLeft.z);
- mpRenderer->EndAddPolygon3DObjectPoint();
- mpRenderer->EndAddShapePolygon3DObject();
- }
-}
-
-void Rectangle::setPosition(const glm::vec3& rTopLeft, const glm::vec3& rTopRight, const glm::vec3& rBottomRight)
-{
- maTopLeft = rTopLeft;
- maTopRight = rTopRight;
- maBottomRight = rBottomRight;
-}
-
-void Rectangle::setFillColor(const Color& rColor)
-{
- maColor = rColor;
-}
-
-void Rectangle::setLineColor(const Color& rColor)
-{
- maLineColor = rColor;
-}
-
-Camera::Camera(OpenGL3DRenderer* pRenderer):
- Renderable3DObject(pRenderer, 0),
- maPos(10,-50,20),
- maUp(0, 0, 1),
- maDirection(glm::vec3(0,0,0))
-{
-}
-
-void Camera::render()
-{
- mpRenderer->SetCameraInfo(maPos, maDirection, maUp);
-}
-
-void Camera::setPosition(const glm::vec3& rPos)
-{
- maPos = rPos;
-}
-
-void Camera::setDirection(const glm::vec3& rDir)
-{
- maDirection = rDir;
-}
-
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/AbstractShapeFactory.cxx b/chart2/source/view/main/AbstractShapeFactory.cxx
index 58b3a9695e6b..df2516ab82f2 100644
--- a/chart2/source/view/main/AbstractShapeFactory.cxx
+++ b/chart2/source/view/main/AbstractShapeFactory.cxx
@@ -45,7 +45,6 @@
#include <osl/module.hxx>
-#include <OpenglShapeFactory.hxx>
#include <ShapeFactory.hxx>
#include <config_features.h>
@@ -54,41 +53,6 @@ using namespace com::sun::star;
namespace chart {
-namespace {
-
-typedef opengl::OpenglShapeFactory* (*getOpenglShapeFactory_)(void);
-
-#if HAVE_FEATURE_UI
-
-#ifndef DISABLE_DYNLOADING
-
-void thisModule() {}
-
-osl::Module* getOpenGLModule()
-{
- static osl::Module aModule;
- if (aModule.is())
- // Already loaded.
- return &aModule;
-
- OUString aLibName(SVLIBRARY("chartopengl"));
- bool bLoaded = aModule.loadRelative(&thisModule, aLibName);
- if (!bLoaded)
- bLoaded = aModule.load(aLibName);
-
- return bLoaded ? &aModule : nullptr;
-}
-
-#endif
-
-#endif
-
-}
-
-#ifdef DISABLE_DYNLOADING
-extern "C" opengl::OpenglShapeFactory* getOpenglShapeFactory();
-#endif
-
AbstractShapeFactory* AbstractShapeFactory::getOrCreateShapeFactory(const uno::Reference< lang::XMultiServiceFactory>& xFactory)
{
static AbstractShapeFactory* pShapeFactory = nullptr;
@@ -96,30 +60,6 @@ AbstractShapeFactory* AbstractShapeFactory::getOrCreateShapeFactory(const uno::R
if (pShapeFactory)
return pShapeFactory;
-#if HAVE_FEATURE_UI
- if(getenv("CHART_DUMMY_FACTORY") && !Application::IsHeadlessModeEnabled())
- {
-#ifndef DISABLE_DYNLOADING
- osl::Module* pModule = getOpenGLModule();
- if(pModule)
- {
- oslGenericFunction fn = pModule->getFunctionSymbol("getOpenglShapeFactory");
- if(fn)
- {
-
- pShapeFactory = reinterpret_cast<getOpenglShapeFactory_>(fn)();
- pShapeFactory->m_xShapeFactory = xFactory;
- }
- }
-#elif defined(IOS) || defined(ANDROID) // Library_chartopengl is not portable enough yet
- pShapeFactory = NULL;
-#else
- pShapeFactory = getOpenglShapeFactory();
- pShapeFactory->m_xShapeFactory = xFactory;
-#endif
- }
-#endif
-
if (!pShapeFactory)
pShapeFactory = new ShapeFactory(xFactory);
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 566f84244c72..a15d6d020afb 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -51,9 +51,6 @@
#include <ExplicitCategoriesProvider.hxx>
#include <defines.hxx>
#include <unonames.hxx>
-#if HAVE_FEATURE_OPENGL
-#include <GL3DBarChart.hxx>
-#endif
#include <editeng/frmdiritem.hxx>
#include <rtl/uuid.h>
#include <tools/globname.hxx>
@@ -70,10 +67,6 @@
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
#include <svx/unofill.hxx>
-#include <vcl/openglwin.hxx>
-#if HAVE_FEATURE_OPENGL
-#include <vcl/opengl/OpenGLContext.hxx>
-#endif
#include <drawinglayer/XShapeDumper.hxx>
#include <time.h>
@@ -1056,102 +1049,6 @@ struct CreateShapeParam2D
mbUseFixedInnerSize(false) {}
};
-class GL2DRenderer : public IRenderer
-{
-public:
- explicit GL2DRenderer(ChartView* pView);
- virtual ~GL2DRenderer() override;
-
- virtual void update() override;
- virtual void clickedAt(const Point& rPos, sal_uInt16 nButton) override;
- virtual void mouseDragMove(const Point& rBegin, const Point& rEnd, sal_uInt16 nButton) override;
- virtual void scroll(long nDelta) override;
- virtual void contextDestroyed() override;
-
-#if HAVE_FEATURE_OPENGL
- const OpenGLWindow* getOpenGLWindow() const;
- void updateOpenGLWindow();
-#endif
-private:
- ChartView* mpView;
- bool mbContextDestroyed;
-#if HAVE_FEATURE_OPENGL
- VclPtr<OpenGLWindow> mpWindow;
-#endif
-};
-
-GL2DRenderer::GL2DRenderer(ChartView* pView)
- : mpView(pView)
- , mbContextDestroyed(false)
-#if HAVE_FEATURE_OPENGL
- , mpWindow(mpView->mrChartModel.getOpenGLWindow())
-#endif
-{
-}
-
-GL2DRenderer::~GL2DRenderer()
-{
-#if HAVE_FEATURE_OPENGL
- SolarMutexGuard g;
- if(!mbContextDestroyed && mpWindow)
- mpWindow->setRenderer(nullptr);
- mpWindow.reset();
-#endif
-}
-
-void GL2DRenderer::update()
-{
- mpView->update();
- mpView->render();
-}
-
-void GL2DRenderer::clickedAt(const Point&, sal_uInt16 )
-{
-}
-
-void GL2DRenderer::mouseDragMove(const Point& , const Point& , sal_uInt16 )
-{
-}
-
-void GL2DRenderer::scroll(long )
-{
-}
-
-void GL2DRenderer::contextDestroyed()
-{
- mbContextDestroyed = true;
-}
-
-#if HAVE_FEATURE_OPENGL
-
-const OpenGLWindow* GL2DRenderer::getOpenGLWindow() const
-{
- return mpWindow;
-}
-
-void GL2DRenderer::updateOpenGLWindow()
-{
- if(mbContextDestroyed)
- return;
-
- OpenGLWindow* pWindow = mpView->mrChartModel.getOpenGLWindow();
- if(pWindow != mpWindow)
- {
- if(mpWindow)
- {
- mpWindow->setRenderer(nullptr);
- }
-
- if(pWindow)
- {
- pWindow->setRenderer(this);
- }
- }
- mpWindow = pWindow;
-}
-
-#endif
-
const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId()
{
return theExplicitValueProviderUnoTunnelId::get().getSeq();
@@ -1193,7 +1090,6 @@ ChartView::ChartView(
, m_nScaleYDenominator(1)
, m_bSdrViewIsInEditMode(false)
, m_aResultingDiagramRectangleExcludingAxes(0,0,0,0)
- , mp2DRenderer(new GL2DRenderer(this))
{
init();
}
@@ -2577,19 +2473,6 @@ void ChartView::impl_refreshAddIn()
}
}
-/**
- * Is it a real 3D chart with a true 3D scene or a 3D chart in a 2D scene.
- */
-bool ChartView::isReal3DChart()
-{
- uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
-#if HAVE_FEATURE_OPENGL
- return ChartHelper::isGL3DDiagram(xDiagram);
-#else
- return false;
-#endif
-}
-
static const char* envChartDummyFactory = getenv("CHART_DUMMY_FACTORY");
void ChartView::createShapes()
@@ -2630,24 +2513,6 @@ void ChartView::createShapes()
}
pShapeFactory->setPageSize(mxRootShape, aPageSize);
pShapeFactory->clearPage(mxRootShape);
-#if HAVE_FEATURE_OPENGL
-#if HAVE_FEATURE_DESKTOP
- if(isReal3DChart())
- {
- createShapes3D();
- return;
- }
- else
- {
- m_pGL3DPlotter.reset();
-
- // hide OpenGL window for now in normal charts
- OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
- if(pWindow && !envChartDummyFactory)
- pWindow->Show(false);
- }
-#endif
-#endif
createShapes2D(aPageSize);
@@ -2664,27 +2529,6 @@ void ChartView::createShapes()
}
}
-void ChartView::render()
-{
-#if HAVE_FEATURE_OPENGL
- if(!isReal3DChart())
- {
- AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
- OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
- if(pWindow)
- pWindow->setRenderer(mp2DRenderer.get());
- bool bRender = pShapeFactory->preRender(mxRootShape, pWindow);
- if(bRender)
- {
- pShapeFactory->render(mxRootShape, pWindow != mp2DRenderer->getOpenGLWindow());
- pShapeFactory->postRender(pWindow);
- }
- }
-#else
- (void) this;
-#endif
-}
-
// util::XEventListener (base of XCloseListener)
void SAL_CALL ChartView::disposing( const lang::EventObject& /* rSource */ )
{
@@ -2721,11 +2565,6 @@ void ChartView::impl_updateView( bool bCheckLockedCtrler )
//create chart view
{
-#if HAVE_FEATURE_OPENGL
- OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
- if (pWindow && ChartHelper::isGL3DDiagram(mrChartModel.getFirstDiagram()))
- pWindow->Initialize();
-#endif
m_bViewDirty = false;
m_bViewUpdatePending = false;
createShapes();
@@ -3234,8 +3073,6 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
//cleanup: remove all empty group shapes to avoid grey border lines:
lcl_removeEmptyGroupShapes( mxRootShape );
- render();
-
if(maTimeBased.bTimeBased && maTimeBased.nFrame % 60 == 0)
{
// create copy of the data for next frame
@@ -3309,93 +3146,6 @@ bool ChartView::createAxisTitleShapes2D( CreateShapeParam2D& rParam, const css::
return true;
}
-void ChartView::createShapes3D()
-{
-#if HAVE_FEATURE_OPENGL
- OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
- if(!pWindow)
- return;
-
- if( pWindow->GetSizePixel().Width() == 0 || pWindow->GetSizePixel().Height() == 0 )
- {
- awt::Size aPageSize = mrChartModel.getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
- Size aSize = pWindow->LogicToPixel(Size(aPageSize.Width, aPageSize.Height), MapMode(MapUnit::Map100thMM));
- pWindow->SetSizePixel(aSize);
- }
- pWindow->Show();
- uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
- uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
- if( !xCooSysContainer.is())
- return;
-
- uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
-
- if (aCooSysList.getLength() != 1)
- // Supporting multiple coordinates in a truly 3D chart (which implies
- // it's a Cartesian coordinate system) is a bit of a challenge, if not
- // impossible.
- return;
-
- uno::Reference<XCoordinateSystem> xCooSys( aCooSysList[0] );
-
- //iterate through all chart types in the current coordinate system
- uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
- OSL_ASSERT( xChartTypeContainer.is());
- if( !xChartTypeContainer.is() )
- return;
-
- uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
- if (aChartTypeList.getLength() != 1)
- // Likewise, we can't really support multiple chart types here.
- return;
-
- uno::Reference< XChartType > xChartType( aChartTypeList[0] );
-
- if (!m_pGL3DPlotter)
- {
- m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, pWindow));
- }
- else
- {
- GL3DBarChart* pChart = dynamic_cast<GL3DBarChart*>(m_pGL3DPlotter.get());
- if (pChart)
- pChart->setOpenGLWindow(pWindow);
- }
-
- uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
- OSL_ASSERT( xDataSeriesContainer.is());
- if( !xDataSeriesContainer.is() )
- return;
-
- std::vector<std::unique_ptr<VDataSeries> > aDataSeries;
- uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
- for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
- {
- uno::Reference< XDataSeries > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
- if(!xDataSeries.is())
- continue;
-
- aDataSeries.push_back(o3tl::make_unique<VDataSeries>(xDataSeries));
- }
-
- std::unique_ptr<ExplicitCategoriesProvider> pCatProvider(new ExplicitCategoriesProvider(xCooSys, mrChartModel));
-
- m_pGL3DPlotter->create3DShapes(aDataSeries, *pCatProvider);
-
- m_pGL3DPlotter->render();
-#endif
-}
-
-#if HAVE_FEATURE_OPENGL
-
-void ChartView::updateOpenGLWindow()
-{
- if(!isReal3DChart())
- mp2DRenderer->updateOpenGLWindow();
-}
-
-#endif
-
} //namespace chart
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
deleted file mode 100644
index e7ebaf102a44..000000000000
--- a/chart2/source/view/main/DummyXShape.cxx
+++ /dev/null
@@ -1,1099 +0,0 @@
-/* -*- 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/.
- */
-#include "DummyXShape.hxx"
-
-#include <string>
-#include <vector>
-#include <iostream>
-#include <fstream>
-#include <algorithm>
-#include <stdlib.h>
-#include <string.h>
-
-#include <CommonConverters.hxx>
-
-#include <rtl/ustring.hxx>
-#include <sal/log.hxx>
-
-#include <vcl/window.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/svapp.hxx>
-#include <tools/gen.hxx>
-#include <cppuhelper/supportsservice.hxx>
-#include <cppuhelper/implbase.hxx>
-#include <editeng/unoprnms.hxx>
-#include <vcl/unohelp.hxx>
-
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/matrix/b3dhommatrix.hxx>
-
-#include <com/sun/star/beans/Property.hpp>
-
-#include <com/sun/star/awt/XBitmap.hpp>
-
-#define ENABLE_DEBUG_PROPERTIES 0
-
-using namespace com::sun::star;
-
-using namespace std;
-
-namespace chart {
-
-namespace dummy {
-
-#if 0
-
-std::ostream& operator<<(std::ostream& rStrm, const awt::Point& rPoint)
-{
- rStrm << rPoint.X << "," << rPoint.Y;
- return rStrm;
-}
-
-std::ostream& operator<<(std::ostream& rStrm, const awt::Size& rSize)
-{
- rStrm << rSize.Width << "," << rSize.Height;
- return rStrm;
-}
-
-#endif
-
-bool TextCache::hasEntry(const TextCacheKey& rKey)
-{
- return maCache.find(rKey) != maCache.end();
-}
-
-BitmapEx& TextCache::getBitmap(const TextCacheKey& rKey)
-{
- return maCache.find(rKey)->second;
-}
-
-void TextCache::insertBitmap(const TextCacheKey& rKey, const BitmapEx& rBitmap)
-{
- maCache.insert(std::pair<TextCacheKey, BitmapEx>(rKey, rBitmap));
-}
-
-class DummyPropertySetInfo : public cppu::WeakImplHelper<
- css::beans::XPropertySetInfo >
-{
-public:
- explicit DummyPropertySetInfo(const std::map<OUString, uno::Any>& rProps ):
- mrProperties(rProps) {}
-
- virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& rName ) override;
-
- virtual beans::Property SAL_CALL getPropertyByName( const OUString& rName ) override;
-
- virtual uno::Sequence< beans::Property > SAL_CALL getProperties() override;
-
-private:
- const std::map<OUString, uno::Any>& mrProperties;
-};
-
-sal_Bool SAL_CALL DummyPropertySetInfo::hasPropertyByName( const OUString& rName )
-{
- return mrProperties.find(rName) != mrProperties.end();
-}
-
-beans::Property SAL_CALL DummyPropertySetInfo::getPropertyByName( const OUString& rName )
-{
- beans::Property aRet;
- if(mrProperties.find(rName) == mrProperties.end())
- throw beans::UnknownPropertyException();
-
- std::map<OUString, uno::Any>::const_iterator itr = mrProperties.find(rName);
- aRet.Name = rName;
- aRet.Type = itr->second.getValueType();
-
- return aRet;
-}
-
-uno::Sequence< beans::Property > SAL_CALL DummyPropertySetInfo::getProperties()
-{
- uno::Sequence< beans::Property > aRet(mrProperties.size());
-
- size_t i = 0;
- for (auto const& property : mrProperties)
- {
- beans::Property aProp;
-
- aProp.Name = property.first;
- aProp.Type = property.second.getValueType();
- aRet[i++] = aProp;
- }
- return aRet;
-}
-
-namespace {
-
-struct PrintProperties
-{
-#if ENABLE_DEBUG_PROPERTIES
- void operator()(const std::pair<OUString, uno::Any>& rProp)
- {
- SAL_INFO("chart2.opengl.properties", "Property: " << rProp.first);
- }
-#else
- void operator()(const std::pair<OUString, uno::Any>&)
- {
- }
-#endif
-};
-
-void debugProperties(std::map<OUString, uno::Any>& rProperties)
-{
- for_each(rProperties.begin(), rProperties.end(), PrintProperties());
-}
-
-}
-
-DummyXShape::DummyXShape()
-{
-}
-
-OUString SAL_CALL DummyXShape::getName()
-{
- return maName;
-}
-
-void SAL_CALL DummyXShape::setName( const OUString& rName )
-{
- maName = rName;
-}
-
-awt::Point SAL_CALL DummyXShape::getPosition()
-{
- return maPosition;
-}
-
-void SAL_CALL DummyXShape::setPosition( const awt::Point& rPoint )
-{
- maPosition = rPoint;
-}
-
-awt::Size SAL_CALL DummyXShape::getSize()
-{
- return maSize;
-}
-
-void SAL_CALL DummyXShape::setSize( const awt::Size& rSize )
-{
- maSize = rSize;
-}
-
-OUString SAL_CALL DummyXShape::getShapeType()
-{
- return OUString("dummy shape");
-}
-
-uno::Reference< beans::XPropertySetInfo > SAL_CALL DummyXShape::getPropertySetInfo()
-{
- return new DummyPropertySetInfo(maProperties);
-}
-
-void SAL_CALL DummyXShape::setPropertyValue( const OUString& rName, const uno::Any& rValue)
-{
- SAL_INFO("chart2", "DummyXShape::setProperty: " << rName << " Any");
- maProperties[rName] = rValue;
- if(rName == "Transformation")
- {
- SAL_INFO("chart2.opengl", "Transformation");
- }
-}
-
-uno::Any SAL_CALL DummyXShape::getPropertyValue( const OUString& rName )
-{
- SAL_INFO("chart2.opengl", "DummyXShape::getPropertyValue: " << rName);
- std::map<OUString, uno::Any>::iterator itr = maProperties.find(rName);
- if(itr != maProperties.end())
- return itr->second;
-
- return uno::Any();
-}
-
-void SAL_CALL DummyXShape::addPropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& )
-{
-}
-
-void SAL_CALL DummyXShape::removePropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& )
-{
-}
-
-void SAL_CALL DummyXShape::addVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& )
-{
-}
-
-void SAL_CALL DummyXShape::removeVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& )
-{
-}
-
-void SAL_CALL DummyXShape::setPropertyValues( const uno::Sequence< OUString >& rNames,
- const uno::Sequence< uno::Any >& rValues)
-{
- size_t n = std::min<size_t>(rNames.getLength(), rValues.getLength());
- for(size_t i = 0; i < n; ++i)
- {
- maProperties[rNames[i]] = rValues[i];
- }
-}
-
-uno::Sequence< uno::Any > SAL_CALL DummyXShape::getPropertyValues(
- const uno::Sequence< OUString >& rNames)
-{
- uno::Sequence< uno::Any > aValues(rNames.getLength());
- for(sal_Int32 i = 0; i < rNames.getLength(); ++i)
- {
- OUString aName = rNames[i];
-
- std::map<OUString, uno::Any>::iterator itr = maProperties.find(aName);
- if(itr != maProperties.end())
- aValues[i] = itr->second;
- }
- return aValues;
-}
-
-void SAL_CALL DummyXShape::addPropertiesChangeListener( const uno::Sequence< OUString >& , const uno::Reference< beans::XPropertiesChangeListener >& )
-{
-}
-
-void SAL_CALL DummyXShape::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& )
-{
-}
-
-void SAL_CALL DummyXShape::firePropertiesChangeEvent( const uno::Sequence< OUString >& ,
- const uno::Reference< beans::XPropertiesChangeListener >& )
-{
-}
-
-OUString SAL_CALL DummyXShape::getImplementationName()
-{
- return OUString("DummyXShape");
-}
-
-namespace {
-
-uno::Sequence< OUString > const & listSupportedServices()
-{
- static const uno::Sequence< OUString > aSupportedServices{
- "com.sun.star.drawing.Shape",
- "com.sun.star.container.Named",
- "com.sun.star.beans.PropertySet"};
- return aSupportedServices;
-}
-
-}
-
-uno::Sequence< OUString > SAL_CALL DummyXShape::getSupportedServiceNames()
-{
- return listSupportedServices();
-}
-
-sal_Bool SAL_CALL DummyXShape::supportsService( const OUString& rServiceName )
-{
- return cppu::supportsService(this, rServiceName);
-}
-
-uno::Reference< uno::XInterface > SAL_CALL DummyXShape::getParent()
-{
- return mxParent;
-}
-
-void SAL_CALL DummyXShape::setParent( const uno::Reference< uno::XInterface >& xParent )
-{
- mxParent = xParent;
-}
-
-void DummyXShape::render()
-{
- SAL_WARN("chart2.opengl", "maybe a missing implementation in a subclass?");
-}
-
-namespace {
-
-void setProperties( const uno::Reference< beans::XPropertySet > & xPropSet, const tPropertyNameMap& rPropertyNameMap,
- std::map<OUString, uno::Any>& rTargetMap)
-{
- tNameSequence aNames;
- tAnySequence aValues;
- PropertyMapper::getMultiPropertyLists( aNames, aValues,
- xPropSet, rPropertyNameMap );
-
- sal_Int32 nSize = std::min(aNames.getLength(), aValues.getLength());
- for(sal_Int32 i = 0; i < nSize; ++i)
- {
- rTargetMap[aNames[i]] = aValues[i];
- }
-}
-
-void setProperties( const tNameSequence& rNames, const tAnySequence& rValues,
- std::map<OUString, uno::Any>& rTargetMap)
-{
- sal_Int32 nSize = std::min(rNames.getLength(), rValues.getLength());
- for(sal_Int32 i = 0; i < nSize; ++i)
- {
- rTargetMap[rNames[i]] = rValues[i];
- }
-}
-
-}
-
-DummyCube::DummyCube(const drawing::Position3D &rPos, const drawing::Direction3D& rSize,
- const uno::Reference< beans::XPropertySet > & xPropSet,
- const tPropertyNameMap& rPropertyNameMap )
-{
- setPosition(Position3DToAWTPoint(rPos));
- setSize(Direction3DToAWTSize(rSize));
- setProperties(xPropSet, rPropertyNameMap, maProperties);
-}
-
-DummyCylinder::DummyCylinder(const drawing::Position3D& rPos, const drawing::Direction3D& rSize )
-{
- setPosition(Position3DToAWTPoint(rPos));
- setSize(Direction3DToAWTSize(rSize));
-}
-
-DummyPyramid::DummyPyramid(const drawing::Position3D& rPos, const drawing::Direction3D& rSize,
- const uno::Reference< beans::XPropertySet > & xPropSet,
- const tPropertyNameMap& rPropertyNameMap)
-{
- setPosition(Position3DToAWTPoint(rPos));
- setSize(Direction3DToAWTSize(rSize));
- setProperties(xPropSet, rPropertyNameMap, maProperties);
-}
-
-DummyCone::DummyCone(const drawing::Position3D& rPos, const drawing::Direction3D& rSize)
-{
- setPosition(Position3DToAWTPoint(rPos));
- setSize(Direction3DToAWTSize(rSize));
-}
-
-DummyPieSegment2D::DummyPieSegment2D(double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree,
- double fUnitCircleInnerRadius, double fUnitCircleOuterRadius,
- const drawing::Direction3D& rOffset, const drawing::HomogenMatrix& rUnitCircleToScene):
- mfUnitCircleStartAngleDegree(fUnitCircleStartAngleDegree),
- mfUnitCircleWidthAngleDegree(fUnitCircleWidthAngleDegree),
- mfUnitCircleInnerRadius(fUnitCircleInnerRadius),
- mfUnitCircleOuterRadius(fUnitCircleOuterRadius),
- maOffset(rOffset),
- maUnitCircleToScene(rUnitCircleToScene)
-{
-}
-
-void DummyPieSegment2D::render()
-{
- SAL_INFO("chart2.opengl", "render DummyPieSegment2D");
- DummyChart* pChart = getRootShape();
-
- while(mfUnitCircleWidthAngleDegree>360)
- mfUnitCircleWidthAngleDegree -= 360.0;
- while(mfUnitCircleWidthAngleDegree<0)
- mfUnitCircleWidthAngleDegree += 360.0;
-
- pChart->m_GLRender.GeneratePieSegment2D(mfUnitCircleInnerRadius, mfUnitCircleOuterRadius,
- mfUnitCircleStartAngleDegree, mfUnitCircleWidthAngleDegree);
-
- sal_uInt8 nAlpha = 255;
- std::map<OUString, uno::Any>::const_iterator itr = maProperties.find(UNO_NAME_FILL_TRANSPARENCE);
- if(itr != maProperties.end())
- {
- nAlpha = 255 - itr->second.get<sal_Int32>();
- }
-
- itr = maProperties.find(UNO_NAME_FILLCOLOR);
- if(itr != maProperties.end())
- {
- sal_Int32 nColor = itr->second.get<sal_Int32>();
- pChart->m_GLRender.SetColor(nColor, nAlpha);
- }
-
- float nSize = std::max<float>(maUnitCircleToScene.Line1.Column1, maUnitCircleToScene.Line2.Column2);
- pChart->m_GLRender.RenderPieSegment2DShape(nSize, maUnitCircleToScene.Line1.Column4 + maOffset.DirectionX,
- maUnitCircleToScene.Line2.Column4 + maOffset.DirectionY);
-
-}
-
-DummyStripe::DummyStripe(const uno::Reference< beans::XPropertySet > & xPropSet,
- const tPropertyNameMap& rPropertyNameMap )
-{
- setProperties(xPropSet, rPropertyNameMap, maProperties);
-}
-
-DummyArea2D::DummyArea2D(const drawing::PointSequenceSequence& rShape):
- maShapes(rShape)
-{
-}
-
-void DummyArea2D::render()
-{
- SAL_INFO("chart2.opengl", "render DummyArea2D");
- DummyChart* pChart = getRootShape();
- sal_Int32 nPointssCount = maShapes.getLength();
- for(sal_Int32 i = 0; i < nPointssCount; i++)
- {
- const css::uno::Sequence<css::awt::Point>& points = maShapes[i];
- sal_Int32 nPointsCount = points.getLength();
- for(sal_Int32 j = 0; j < nPointsCount; j++)
- {
- const css::awt::Point& p = points[j];
- pChart->m_GLRender.SetArea2DShapePoint(static_cast<float>(p.X), static_cast<float>(p.Y), nPointsCount);
- }
- }
-
- std::map<OUString, uno::Any>::const_iterator itr = maProperties.find(UNO_NAME_FILLCOLOR);
- if(itr != maProperties.end())
- {
- sal_Int32 nColor = itr->second.get<sal_Int32>();
- pChart->m_GLRender.SetColor(nColor, 255);
- }
-
- pChart->m_GLRender.RenderArea2DShape();
-}
-
-DummySymbol2D::DummySymbol2D(const drawing::Position3D& rPos, const drawing::Direction3D& rSize,
- sal_Int32 nStandardSymbol, sal_Int32 nFillColor):
- mnStandardSymbol(nStandardSymbol),
- mnFillColor(nFillColor)
-{
- setPosition(Position3DToAWTPoint(rPos));
- setSize(Direction3DToAWTSize(rSize));
-}
-
-void DummySymbol2D::render()
-{
- DummyChart* pChart = getRootShape();
-
- pChart->m_GLRender.SetColor(mnFillColor, 255);
-
- pChart->m_GLRender.RenderSymbol2DShape(maPosition.X, maPosition.Y, mnStandardSymbol);
-}
-
-DummyCircle::DummyCircle(const awt::Point& rPos, const awt::Size& rSize)
-{
- setPosition(rPos);
- setSize(rSize);
-}
-
-void DummyCircle::render()
-{
- SAL_INFO("chart2.opengl", "render DummyCircle");
- debugProperties(maProperties);
- DummyChart* pChart = getRootShape();
-
- sal_uInt8 nAlpha = 255;
- std::map<OUString, uno::Any>::const_iterator itr = maProperties.find("FillTransparence");
- if(itr != maProperties.end())
- {
- sal_Int32 nTrans = itr->second.get<sal_Int32>()/100.0*255;
- nAlpha = 255 - static_cast<sal_uInt8>(nTrans & 0xFF);
-
- if(nAlpha == 0)
- return;
- }
-
- itr = maProperties.find("FillColor");
- if(itr != maProperties.end())
- {
- sal_Int32 nColor = itr->second.get<sal_Int32>();
- pChart->m_GLRender.SetColor(nColor, nAlpha);
- }
- else
- SAL_WARN("chart2.opengl", "missing color");
-
- pChart->m_GLRender.Bubble2DShapePoint(maPosition.X, maPosition.Y,
- maSize.Width, maSize.Height);
- pChart->m_GLRender.RenderBubble2FBO();
-}
-
-namespace {
-
-void setProperties( const VLineProperties& rLineProperties, std::map<OUString, uno::Any>& rTargetProps )
-{
- //Transparency
- if(rLineProperties.Transparence.hasValue())
- rTargetProps.insert(std::pair<OUString, uno::Any>(
- UNO_NAME_LINETRANSPARENCE, rLineProperties.Transparence));
-
- //LineStyle
- if(rLineProperties.LineStyle.hasValue())
- rTargetProps.insert(std::pair<OUString, uno::Any>(
- UNO_NAME_LINESTYLE, rLineProperties.LineStyle));
-
- //LineWidth
- if(rLineProperties.Width.hasValue())
- rTargetProps.insert(std::pair<OUString, uno::Any>(
- UNO_NAME_LINEWIDTH, rLineProperties.Width));
-
- //LineColor
- if(rLineProperties.Color.hasValue())
- rTargetProps.insert(std::pair<OUString, uno::Any>(
- UNO_NAME_LINECOLOR, rLineProperties.Color));
-
- //LineDashName
- if(rLineProperties.DashName.hasValue())
- rTargetProps.insert(std::pair<OUString, uno::Any>(
- "LineDashName", rLineProperties.DashName));
-}
-
-}
-
-DummyLine3D::DummyLine3D(const VLineProperties& rLineProperties)
-{
- setProperties(rLineProperties, maProperties);
-}
-
-DummyLine2D::DummyLine2D(const drawing::PointSequenceSequence& rPoints, const VLineProperties* pLineProperties):
- maPoints(rPoints)
-{
- if(pLineProperties)
- setProperties(*pLineProperties, maProperties);
-}
-
-DummyLine2D::DummyLine2D(const awt::Size& rSize, const awt::Point& rPosition)
-{
- setPosition(rPosition);
- setSize(rSize);
-}
-
-void DummyLine2D::render()
-{
- SAL_INFO("chart2.opengl", "rendering line 2D");
- debugProperties(maProperties);
- DummyChart* pChart = getRootShape();
-
- //add style and transparency
- std::map< OUString, uno::Any >::const_iterator itr = maProperties.find(UNO_NAME_LINESTYLE);
- if (itr != maProperties.end())
- {
- uno::Any cow = itr->second;
- drawing::LineStyle nStyle = cow.get<drawing::LineStyle>();
- if (nStyle == drawing::LineStyle_NONE)
- {
- // nothing to render
- return;
- }
- }
-
- sal_uInt8 nAlpha = 255;
- itr = maProperties.find("LineTransparence");
- if(itr != maProperties.end())
- {
- uno::Any al = itr->second;
- nAlpha = 255 - al.get<sal_Int32>();
- }
-
- itr = maProperties.find(UNO_NAME_LINECOLOR);
- if(itr != maProperties.end())
- {
- //set line color
- uno::Any co = itr->second;
- sal_Int32 nColorValue = co.get<sal_Int32>();
- SAL_INFO("chart2.opengl", "line colorvalue = " << nColorValue);
- sal_uInt8 R = (nColorValue & 0x00FF0000) >> 16;
- sal_uInt8 G = (nColorValue & 0x0000FF00) >> 8;
- sal_uInt8 B = (nColorValue & 0x000000FF);
- pChart->m_GLRender.SetLine2DColor(R, G, B, nAlpha);
-
- SAL_INFO("chart2.opengl", "line colorvalue = " << nColorValue << ", R = " << static_cast<int>(R) << ", G = " << static_cast<int>(G) << ", B = " << static_cast<int>(B));
- }
- else
- SAL_WARN("chart2.opengl", "no line color set");
-
- //set line width
- itr = maProperties.find(UNO_NAME_LINEWIDTH);
- if(itr != maProperties.end())
- {
- uno::Any cow = itr->second;
- sal_Int32 nWidth = cow.get<sal_Int32>();
- pChart->m_GLRender.SetLine2DWidth(nWidth);
-
- SAL_INFO("chart2.opengl", "width = " << nWidth);
- }
- else
- SAL_WARN("chart2.opengl", "no line width set");
-
- sal_Int32 pointsscount = maPoints.getLength();
- for(sal_Int32 i = 0; i < pointsscount; i++)
- {
- css::uno::Sequence<css::awt::Point>& points = maPoints[i];
- sal_Int32 pointscount = points.getLength();
- for(sal_Int32 j = 0; j < pointscount; j++)
- {
- css::awt::Point& p = points[j];
- pChart->m_GLRender.SetLine2DShapePoint(static_cast<float>(p.X), static_cast<float>(p.Y), pointscount);
- }
-
- }
- pChart->m_GLRender.RenderLine2FBO();
-
-}
-
-DummyRectangle::DummyRectangle()
-{
-}
-
-DummyRectangle::DummyRectangle(const awt::Size& rSize)
-{
- setSize(rSize);
-}
-
-DummyRectangle::DummyRectangle(const awt::Size& rSize, const awt::Point& rPoint, const tNameSequence& rNames,
- const tAnySequence& rValues)
-{
- setSize(rSize);
- setPosition(rPoint);
- setProperties(rNames, rValues, maProperties);
-}
-
-void DummyRectangle::render()
-{
- SAL_INFO("chart2.opengl", "render DummyRectangle");
- debugProperties(maProperties);
- DummyChart* pChart = getRootShape();
- std::map< OUString, uno::Any >::const_iterator itr = maProperties.find("Invisible");
- if(itr != maProperties.end())
- {
- return;
- }
-
- bool bFill = true;
- drawing::FillStyle eStyle = drawing::FillStyle_NONE;
- itr = maProperties.find("FillStyle");
- if(itr != maProperties.end())
- {
- eStyle = itr->second.get<drawing::FillStyle>();
- if(eStyle == drawing::FillStyle_NONE)
- {
- bFill = false;
- }
- }
-
- itr = maProperties.find("FillColor");
- if(itr != maProperties.end())
- {
- uno::Any co = itr->second;
- Color nColorValue(co.get<sal_Int32>());
- //here FillStyle works for background color and gradients
- pChart->m_GLRender.SetBackGroundColor(nColorValue, nColorValue, eStyle);
- }
-
- bool bBorder = true;
- itr = maProperties.find(UNO_NAME_LINESTYLE);
- if (itr != maProperties.end())
- {
- uno::Any cow = itr->second;
- drawing::LineStyle nStyle = cow.get<drawing::LineStyle>();
- if (nStyle == drawing::LineStyle_NONE)
- {
- bBorder = false;
- }
- }
-
- //TODO: moggi: correct handling of gradients
- itr = maProperties.find("FillTransparenceGradientName");
- if (itr != maProperties.end())
- {
- uno::Any co = itr->second;
- rtl::OUString aGradientValue = co.get<rtl::OUString>();
- if (aGradientValue.endsWith("1"))
- {
- pChart->m_GLRender.SetChartTransparencyGradient(1);
- }
- }
- pChart->m_GLRender.RectangleShapePoint(maPosition.X, maPosition.Y, maSize.Width, maSize.Height);
- pChart->m_GLRender.RenderRectangleShape(bBorder, bFill);
-}
-
-namespace {
-
-struct FontAttribSetter
-{
- explicit FontAttribSetter(vcl::Font& rFont):
- mrFont(rFont) {}
-
- void operator()(const std::pair<OUString, uno::Any>& rProp)
- {
- const OUString& rPropName = rProp.first;
- if(rPropName == "CharFontName")
- {
- OUString aName = rProp.second.get<OUString>();
- mrFont.SetFamilyName(aName);
- }
- else if(rPropName == "CharColor")
- {
- sal_Int32 nColor = rProp.second.get<sal_Int32>();
- mrFont.SetFillColor(Color(nColor));
- }
- else if(rPropName == "CharHeight")
- {
- float fHeight = rProp.second.get<float>();
- mrFont.SetFontSize(Size(0,(fHeight*127+36)/72)); //taken from the MCW implementation
- }
- else if(rPropName == "CharUnderline")
- {
- FontLineStyle eUnderline = static_cast<FontLineStyle>(rProp.second.get<sal_Int16>());
- mrFont.SetUnderline(eUnderline);
- }
- else if(rPropName == "CharWeight")
- {
- float fWeight = rProp.second.get<float>();
- FontWeight eFontWeight = vcl::unohelper::ConvertFontWeight(fWeight);
- mrFont.SetWeight(eFontWeight);
- }
- else if(rPropName == "ChartWidth")
- {
- float fWidth = rProp.second.get<float>();
- FontWidth eFontWidth = vcl::unohelper::ConvertFontWidth(fWidth);
- mrFont.SetAverageFontWidth(eFontWidth);
- }
- }
-private:
- vcl::Font& mrFont;
-};
-
-}
-
-DummyText::DummyText(const OUString& rText, const tNameSequence& rNames,
- const tAnySequence& rValues, const uno::Any& rTrans, uno::Reference< drawing::XShapes > const & xTarget, double nRotation ):
- maTrans(rTrans),
- mnRotation(nRotation)
-{
- setProperties(rNames, rValues, maProperties);
-
- xTarget->add(this);
- DummyChart* pChart = getRootShape();
- TextCache& rCache = pChart->getTextCache();
- TextCache::TextCacheKey aKey;
- aKey.maText = rText;
- aKey.maProperties = maProperties;
- int bmpWidth;
- int bmpHeight;
- if(rCache.hasEntry(aKey))
- {
- maBitmap = rCache.getBitmap(aKey);
- bmpWidth = maBitmap.GetSizePixel().Width();
- bmpHeight = maBitmap.GetSizePixel().Height();
- }
- else
- {
- vcl::Font aFont;
- std::for_each(maProperties.begin(), maProperties.end(), FontAttribSetter(aFont));
- ScopedVclPtrInstance< VirtualDevice > pDevice(*Application::GetDefaultDevice(),
- DeviceFormat::DEFAULT, DeviceFormat::DEFAULT);
- pDevice->Erase();
- tools::Rectangle aRect;
- pDevice->SetFont(aFont);
- pDevice->GetTextBoundRect(aRect, rText);
- int screenWidth = aRect.BottomRight().X();
- int screenHeight = aRect.BottomRight().Y();
- pDevice->SetOutputSizePixel(Size(screenWidth * 3, screenHeight));
- pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
- pDevice->DrawText(Point(0, 0), rText);
- bmpWidth = aRect.Right() - aRect.Left();
- bmpHeight = aRect.Bottom() - aRect.Top();
- maBitmap = pDevice->GetBitmapEx(aRect.TopLeft(), Size(bmpWidth, bmpHeight));
- rCache.insertBitmap(aKey, maBitmap);
- }
-
- if(rTrans.hasValue())
- {
- drawing::HomogenMatrix3 aTrans = rTrans.get<drawing::HomogenMatrix3>();
- setSize(awt::Size(20*bmpWidth, 20*bmpHeight));
- setPosition(awt::Point(aTrans.Line1.Column3, aTrans.Line2.Column3));
- aTrans.Line1.Column1 = 20 * bmpWidth;
- aTrans.Line2.Column2 = 20 * bmpHeight;
- setTransformatAsProperty(aTrans);
- }
- else
- {
- setSize(awt::Size(20*bmpWidth, 20*bmpHeight));
- uno::Reference< drawing::XShape > xTargetShape(xTarget, uno::UNO_QUERY);
- drawing::HomogenMatrix3 aTrans;
- aTrans.Line1.Column1 = 20 * bmpWidth;
- aTrans.Line2.Column2 = 20 * bmpHeight;
- aTrans.Line3.Column3 = 1;
- if(xTargetShape.is())
- {
- const awt::Point rPoint = xTargetShape->getPosition();
- setPosition(rPoint);
- aTrans.Line1.Column3 = rPoint.X;
- aTrans.Line2.Column3 = rPoint.Y;
- }
- setTransformatAsProperty(aTrans);
- }
-}
-
-void DummyText::render()
-{
- SAL_INFO("chart2.opengl", "render DummyText");
- debugProperties(maProperties);
-
- DummyChart* pChart = getRootShape();
-
- drawing::HomogenMatrix3 aTransformation;
- std::map<OUString, uno::Any>::const_iterator itr =
- maProperties.find("Transformation");
- if(itr != maProperties.end())
- {
- SAL_INFO("chart2.opengl", "found a transformation");
- if(itr->second.hasValue())
- {
- aTransformation = itr->second.get<drawing::HomogenMatrix3>();
- }
- }
- else if(maTrans.hasValue())
- {
- aTransformation = maTrans.get<drawing::HomogenMatrix3>();
- }
- pChart->m_GLRender.CreateTextTexture(maBitmap, maSize,
- mnRotation, aTransformation);
- pChart->m_GLRender.RenderTextShape();
-}
-
-void SAL_CALL DummyText::setPropertyValue( const OUString& rName, const uno::Any& rValue)
-{
- SAL_INFO("chart2.opengl", "property value set after image has been created");
- DummyXShape::setPropertyValue(rName, rValue);
-}
-
-void SAL_CALL DummyText::setPosition(const awt::Point& rPosition )
-{
- DummyXShape::setPosition(rPosition);
- if(maTrans.hasValue())
- return;
-
- std::map<OUString, uno::Any>::const_iterator itr =
- maProperties.find("Transformation");
- if(itr != maProperties.end())
- {
- if(itr->second.hasValue())
- {
- drawing::HomogenMatrix3 aTrans = itr->second.get<drawing::HomogenMatrix3>();
- aTrans.Line1.Column3 = rPosition.X;
- aTrans.Line2.Column3 = rPosition.Y;
- setTransformatAsProperty(aTrans);
- }
- }
-}
-
-void DummyText::setTransformatAsProperty(const drawing::HomogenMatrix3& rMatrix)
-{
- setPropertyValue("Transformation", uno::Any(rMatrix));
-}
-
-DummyGroup3D::DummyGroup3D(const OUString& rName)
-{
- setName(rName);
-}
-
-DummyGroup2D::DummyGroup2D(const OUString& rName)
-{
- setName(rName);
-}
-
-awt::Point SAL_CALL DummyGroup2D::getPosition()
-{
- long nTop = std::numeric_limits<long>::max();
- long nLeft = std::numeric_limits<long>::max();
- for (auto const& shape : maShapes)
- {
- awt::Point aPoint = shape->getPosition();
- if(aPoint.X >= 0 && aPoint.Y >= 0)
- {
- nLeft = std::min<long>(nLeft, aPoint.X);
- nTop = std::min<long>(nTop, aPoint.Y);
- }
- }
-
- return awt::Point(nLeft, nTop);
-}
-
-awt::Size SAL_CALL DummyGroup2D::getSize()
-{
- long nTop = std::numeric_limits<long>::max();
- long nLeft = std::numeric_limits<long>::max();
- long nBottom = 0;
- long nRight = 0;
- for (auto const& shape : maShapes)
- {
- awt::Point aPoint = shape->getPosition();
- nLeft = std::min<long>(nLeft, aPoint.X);
- nTop = std::min<long>(nTop, aPoint.Y);
- awt::Size aSize = shape->getSize();
- nRight = std::max<long>(nRight, aPoint.X + aSize.Width);
- nBottom = std::max<long>(nBottom, aPoint.Y + aSize.Height);
- }
-
- return awt::Size(nRight - nLeft, nBottom - nTop);
-}
-
-void SAL_CALL DummyGroup2D::setPosition( const awt::Point& rPos )
-{
- for (auto const& shape : maShapes)
- {
- const awt::Point& rOldPos = shape->getPos();
- awt::Point aNewPos( rPos.X + rOldPos.X, rPos.Y + rOldPos.Y);
- shape->setPosition(aNewPos);
- }
-}
-
-void SAL_CALL DummyGroup2D::setSize( const awt::Size& )
-{
- SAL_WARN("chart2.opengl", "set size on group shape");
-}
-
-DummyGraphic2D::DummyGraphic2D(const drawing::Position3D& rPos, const drawing::Direction3D& rSize)
-{
- setPosition(Position3DToAWTPoint(rPos));
- setSize(Direction3DToAWTSize(rSize));
-}
-
-DummyChart* DummyXShape::getRootShape()
-{
- assert(mxParent.is());
- DummyXShape& rParent = dynamic_cast<DummyXShape&>(*mxParent.get());
- return rParent.getRootShape();
-}
-
-DummyChart* DummyChart::getRootShape()
-{
- return this;
-}
-
-uno::Any SAL_CALL DummyXShapes::queryInterface( const uno::Type& rType )
-{
- if( rType == cppu::UnoType<drawing::XShapes>::get() )
- return uno::Any(uno::Reference<drawing::XShapes>(this));
- if( rType == cppu::UnoType<container::XIndexAccess>::get() )
- return uno::Any(uno::Reference<container::XIndexAccess>(this));
- return DummyXShape::queryInterface(rType);
-}
-
-uno::Any SAL_CALL DummyXShapes::queryAggregation( const uno::Type & rType )
-{
- if( rType == cppu::UnoType<drawing::XShapes>::get() )
- return uno::Any(uno::Reference< drawing::XShapes >(this));
- else
- return DummyXShape::queryAggregation( rType );
-}
-
-void SAL_CALL DummyXShapes::acquire()
- throw()
-{
- DummyXShape::acquire();
-}
-
-void DummyXShapes::release()
- throw()
-{
- DummyXShape::release();
-}
-
-void SAL_CALL DummyXShapes::add( const uno::Reference< drawing::XShape>& xShape )
-{
- DummyXShape& rChild = dynamic_cast<DummyXShape&>(*xShape.get());
- maUNOShapes.push_back(xShape);
- rChild.setParent(static_cast< ::cppu::OWeakObject* >( this ));
- maShapes.push_back(&rChild);
-}
-
-void SAL_CALL DummyXShapes::remove( const uno::Reference< drawing::XShape>& xShape )
-{
- std::vector< uno::Reference<drawing::XShape> >::iterator itr = std::find(maUNOShapes.begin(), maUNOShapes.end(), xShape);
- if(itr != maUNOShapes.end())
- {
- DummyXShape* pChild = dynamic_cast<DummyXShape*>((*itr).get());
- std::vector< DummyXShape* >::iterator itrShape = std::find(maShapes.begin(), maShapes.end(), pChild);
- if(itrShape != maShapes.end())
- maShapes.erase(itrShape);
-
- maUNOShapes.erase(itr);
- }
-}
-
-uno::Type SAL_CALL DummyXShapes::getElementType()
-{
- return cppu::UnoType<drawing::XShape>::get();
-}
-
-sal_Bool SAL_CALL DummyXShapes::hasElements()
-{
- return !maUNOShapes.empty();
-}
-
-sal_Int32 SAL_CALL DummyXShapes::getCount()
-{
- return maUNOShapes.size();
-}
-
-uno::Any SAL_CALL DummyXShapes::getByIndex(sal_Int32 nIndex)
-{
- uno::Any aShape;
- aShape <<= maUNOShapes[nIndex];
- return aShape;
-}
-
-void DummyXShapes::render()
-{
- SAL_INFO("chart2.opengl", "render DummyShapes");
- for (auto const& shape : maShapes)
- {
- shape->render();
- }
-}
-
-DummyChart::DummyChart():
- mbNotInit(true),
- m_GLRender()
-{
- SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: ");
- setName("com.sun.star.chart2.shapes");
-}
-
-void SAL_CALL DummyChart::setPosition( const awt::Point& aPosition )
-{
- DummyXShape::setPosition(aPosition);
-}
-
-DummyChart::~DummyChart()
-{
-}
-
-void SAL_CALL DummyChart::setSize( const awt::Size& aSize )
-{
- SAL_INFO("chart2.opengl", "DummyChart::setSize()---aSize.Width = " << aSize.Width << ", aSize.Height = " << aSize.Height);
- int width = aSize.Width;
- int height = aSize.Height;
- DummyXShape::setSize(awt::Size(0,0));
- m_GLRender.SetSize(width, height);
- SAL_INFO("chart2.opengl", "DummyChart::GLRender.Width = " << width << ", GLRender.Height = " << height);
-}
-
-void DummyChart::render()
-{
- if(mbNotInit)
- {
- m_GLRender.InitOpenGL();
- mbNotInit = false;
- }
-
- SAL_INFO("chart2.opengl", "render chart");
- m_GLRender.prepareToRender();
- DummyXShapes::render();
-}
-
-void DummyChart::clear()
-{
- maUNOShapes.clear();
- maShapes.clear();
-}
-
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/DummyXShape.hxx b/chart2/source/view/main/DummyXShape.hxx
deleted file mode 100644
index 30e29239c0d4..000000000000
--- a/chart2/source/view/main/DummyXShape.hxx
+++ /dev/null
@@ -1,402 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_MAIN_DUMMYXSHAPE_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_MAIN_DUMMYXSHAPE_HXX
-
-#include <cppuhelper/implbase6.hxx>
-
-#include <vcl/opengl/OpenGLContext.hxx>
-#include "OpenGLRender.hxx"
-
-#include <com/sun/star/drawing/XShape.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/beans/XMultiPropertySet.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/awt/Point.hpp>
-#include <com/sun/star/awt/Size.hpp>
-#include <com/sun/star/uno/Type.h>
-#include <com/sun/star/uno/Any.h>
-#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/drawing/CircleKind.hpp>
-#include <com/sun/star/drawing/DoubleSequence.hpp>
-#include <com/sun/star/drawing/FlagSequence.hpp>
-#include <com/sun/star/drawing/FillStyle.hpp>
-#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/drawing/NormalsKind.hpp>
-#include <com/sun/star/drawing/PointSequence.hpp>
-#include <com/sun/star/drawing/PolygonKind.hpp>
-#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
-#include <com/sun/star/drawing/ProjectionMode.hpp>
-#include <com/sun/star/drawing/ShadeMode.hpp>
-#include <com/sun/star/drawing/TextFitToSizeType.hpp>
-#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
-#include <com/sun/star/drawing/TextureProjectionMode.hpp>
-#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/drawing/Direction3D.hpp>
-#include <com/sun/star/drawing/Position3D.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/drawing/HomogenMatrix.hpp>
-#include <com/sun/star/drawing/PointSequenceSequence.hpp>
-#include <com/sun/star/chart2/XFormattedString.hpp>
-
-#include <PropertyMapper.hxx>
-#include <VLineProperties.hxx>
-#include <Stripe.hxx>
-
-#include <rtl/ustring.hxx>
-
-#include <map>
-#include <unordered_map>
-#include <vector>
-
-namespace chart {
-
-namespace dummy {
-
-class DummyChart;
-
-class TextCache
-{
-public:
- struct TextCacheKey
- {
- OUString maText;
- std::map<OUString, css::uno::Any> maProperties;
-
- bool operator==(const TextCacheKey& rKey) const
- {
- return maText == rKey.maText && maProperties == rKey.maProperties;
- }
- };
-
- struct TextCacheKeyHash
- {
- size_t operator()(const TextCacheKey& rKey) const
- {
- return rKey.maText.hashCode();
- }
- };
-
- bool hasEntry(const TextCacheKey& rKey);
- BitmapEx& getBitmap(const TextCacheKey& rKey);
- void insertBitmap(const TextCacheKey& rKey, const BitmapEx& rBitmap);
-
-private:
-
- std::unordered_map<TextCacheKey, BitmapEx, TextCacheKeyHash> maCache;
-};
-
-class DummyXShape : public cppu::WeakAggImplHelper6<
- css::drawing::XShape,
- css::beans::XPropertySet,
- css::beans::XMultiPropertySet,
- css::container::XNamed,
- css::container::XChild,
- css::lang::XServiceInfo >
-{
-public:
- DummyXShape();
-
- // XNamed
- virtual OUString SAL_CALL getName() override;
- virtual void SAL_CALL setName( const OUString& aName ) override;
-
- // XShape
- virtual css::awt::Point SAL_CALL getPosition() override;
- virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
- virtual css::awt::Size SAL_CALL getSize() override;
- virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
-
- // XShapeDescriptor
- virtual OUString SAL_CALL getShapeType() override;
-
- // XPropertySet
- virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
- virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
- virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
- virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
- virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
- virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
- virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
-
- // XMultiPropertySet
- virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames,
- const css::uno::Sequence< css::uno::Any >& aValues ) override;
-
- virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(
- const css::uno::Sequence< OUString >& aPropertyNames ) override;
-
- virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
-
- virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
-
- virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames,
- const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
-
- // XChild
- virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
- virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName() override;
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
-
- // normal non UNO methods
-
- virtual DummyChart* getRootShape();
- /**
- * Implement this method for all subclasses that should be rendered
- */
- virtual void render();
-
- const css::awt::Point& getPos() { return maPosition;} // internal API
-
-protected:
-
- std::map<OUString, css::uno::Any> maProperties;
- css::awt::Point maPosition;
- css::awt::Size maSize;
-
-private:
- OUString maName;
-
- css::uno::Reference< css::uno::XInterface > mxParent;
-
-};
-
-class DummyCube : public DummyXShape
-{
-public:
- DummyCube(const css::drawing::Position3D &rPos, const css::drawing::Direction3D& rSize,
- const css::uno::Reference< css::beans::XPropertySet > & xPropSet,
- const tPropertyNameMap& rPropertyNameMap );
-};
-
-class DummyCylinder : public DummyXShape
-{
-public:
- DummyCylinder(const css::drawing::Position3D&, const css::drawing::Direction3D& rSize );
-};
-
-class DummyPyramid : public DummyXShape
-{
-public:
- DummyPyramid(const css::drawing::Position3D& rPosition, const css::drawing::Direction3D& rSize,
- const css::uno::Reference< css::beans::XPropertySet > & xPropSet,
- const tPropertyNameMap& rPropertyNameMap );
-};
-
-class DummyCone : public DummyXShape
-{
-public:
- DummyCone(const css::drawing::Position3D& rPosition, const css::drawing::Direction3D& rSize);
-};
-
-class DummyPieSegment2D : public DummyXShape
-{
-public:
- DummyPieSegment2D(double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree,
- double fUnitCircleInnerRadius, double fUnitCircleOuterRadius,
- const css::drawing::Direction3D& rOffset, const css::drawing::HomogenMatrix& rUnitCircleToScene);
- void render() override;
-private:
- double mfUnitCircleStartAngleDegree;
- double mfUnitCircleWidthAngleDegree;
- double mfUnitCircleInnerRadius;
- double mfUnitCircleOuterRadius;
-
- css::drawing::Direction3D maOffset;
- css::drawing::HomogenMatrix maUnitCircleToScene;
-};
-
-class DummyPieSegment : public DummyXShape {};
-
-class DummyStripe : public DummyXShape
-{
-public:
- DummyStripe(const css::uno::Reference< css::beans::XPropertySet > & xPropSet,
- const tPropertyNameMap& rPropertyNameMap );
-};
-
-class DummyArea3D : public DummyXShape {};
-
-class DummyArea2D : public DummyXShape
-{
-public:
- explicit DummyArea2D(const css::drawing::PointSequenceSequence& rShape);
-
- virtual void render() override;
-
-private:
- css::drawing::PointSequenceSequence maShapes;
-};
-
-class DummySymbol2D : public DummyXShape
-{
-public:
- DummySymbol2D(const css::drawing::Position3D& rPosition, const css::drawing::Direction3D& rSize,
- sal_Int32 nStandardSymbol, sal_Int32 nFillColor);
- void render() override;
-private:
- sal_Int32 mnStandardSymbol;
- sal_Int32 mnFillColor;
-};
-
-class DummyGraphic2D : public DummyXShape
-{
-public:
- DummyGraphic2D(const css::drawing::Position3D& rPosition, const css::drawing::Direction3D& rSize );
-};
-
-class DummyCircle : public DummyXShape
-{
-public:
- DummyCircle(const css::awt::Point& rPosition, const css::awt::Size& rSize);
-
- virtual void render() override;
-};
-
-class DummyLine3D : public DummyXShape
-{
-public:
- explicit DummyLine3D(const VLineProperties& rProperties);
-};
-
-class DummyLine2D : public DummyXShape
-{
-public:
- DummyLine2D(const css::drawing::PointSequenceSequence& rPoints, const VLineProperties* pProperties);
- DummyLine2D(const css::awt::Size& rSize, const css::awt::Point& rPosition);
-
- virtual void render() override;
-
-private:
- css::drawing::PointSequenceSequence maPoints;
-};
-
-class DummyRectangle : public DummyXShape
-{
-public:
- DummyRectangle();
- explicit DummyRectangle(const css::awt::Size& rSize);
- DummyRectangle(const css::awt::Size& rSize, const css::awt::Point& rPoint, const tNameSequence& rNames,
- const tAnySequence& rValues );
-
- virtual void render() override;
-};
-
-class DummyText : public DummyXShape
-{
-public:
- DummyText(const OUString& rText, const tNameSequence& rNames,
- const tAnySequence& rValues, const css::uno::Any& rTrans, css::uno::Reference<
- css::drawing::XShapes > const & xTarget, double nRotation);
-
- virtual void render() override;
-
- virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
-
- virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
-
-private:
- void setTransformatAsProperty(const css::drawing::HomogenMatrix3& rMatrix);
-
- css::uno::Any maTrans;
- BitmapEx maBitmap;
- double mnRotation;
-};
-
-class DummyXShapes : public DummyXShape, public css::drawing::XShapes
-{
-public:
-
- virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
-
- // XShapes
- virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
- virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
-
- // XElementAccess
- virtual css::uno::Type SAL_CALL getElementType() override;
- virtual sal_Bool SAL_CALL hasElements() override;
-
- // XIndexAccess
- virtual sal_Int32 SAL_CALL getCount() override ;
- virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
-
- // normal methods
- virtual void render() override;
-
-protected:
- std::vector<css::uno::Reference< css::drawing::XShape > > maUNOShapes;
- std::vector<DummyXShape*> maShapes;
-};
-
-class DummyChart : public DummyXShapes
-{
-public:
- DummyChart();
- virtual ~DummyChart() override;
- virtual DummyChart* getRootShape() override;
-
- virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
- virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
-
- virtual void render() override;
-
- void clear();
- void invalidateInit() { mbNotInit = true; }
- TextCache& getTextCache() { return maTextCache;}
-
- OpenGLRender& getRenderer() { return m_GLRender; }
-
-private:
-
- TextCache maTextCache;
- bool mbNotInit;
-
-public:
- OpenGLRender m_GLRender;
-
-};
-
-class DummyGroup2D : public DummyXShapes
-{
-public:
- explicit DummyGroup2D(const OUString& rName);
-
- virtual css::awt::Point SAL_CALL getPosition() override;
- virtual css::awt::Size SAL_CALL getSize() override;
- virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override;
- virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override;
-};
-
-class DummyGroup3D : public DummyXShapes
-{
-public:
- explicit DummyGroup3D(const OUString& rName);
-};
-
-}
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/GL3DPlotterBase.cxx b/chart2/source/view/main/GL3DPlotterBase.cxx
deleted file mode 100644
index e342b68a304a..000000000000
--- a/chart2/source/view/main/GL3DPlotterBase.cxx
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- 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/.
- */
-
-#include <GL3DPlotterBase.hxx>
-
-namespace chart {
-
-GL3DPlotterBase::~GL3DPlotterBase() {}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
deleted file mode 100644
index 7ac5d29d49ce..000000000000
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ /dev/null
@@ -1,2600 +0,0 @@
-/* -*- 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/.
- */
-
-#include <epoxy/gl.h>
-
-#include <GL3DRenderer.hxx>
-
-#include <cmath>
-#include <vcl/opengl/OpenGLHelper.hxx>
-#include <vcl/font.hxx>
-#include <vcl/virdev.hxx>
-
-#include <com/sun/star/awt/Size.hpp>
-
-#include <StaticGeometry.h>
-#include <glm/gtc/matrix_inverse.hpp>
-#include <memory>
-
-#define DEBUG_FBO 0
-
-using namespace com::sun::star;
-
-namespace chart {
-
-namespace opengl3D {
-
-namespace {
-
-const int CORNER_DIVION_Y = 20;
-const int CORNER_DIVION_Z = 20;
-
-GLfloat texCoords[] = {
- 1.0f, 0.0f,
- 1.0f, 0.96f,
- 0.0f, 0.96f,
- 0.0f, 0.0f
-};
-
-glm::vec4 getColorAsVector(Color nColor)
-{
- return glm::vec4(nColor.GetRed() / 255.0f,
- nColor.GetGreen() / 255.0f,
- nColor.GetBlue() / 255.0f,
- (0xFF - nColor.GetTransparency())/255.0);
-}
-
-}
-
-TextureArrayInfo::TextureArrayInfo():
- subTextureNum(0),
- textureArrayWidth(0),
- textureArrayHeight(0),
- textureID(0)
-{
-}
-
-OpenGL3DRenderer::OpenGL3DRenderer():
- m_iWidth(0)
- , m_iHeight(0)
- , m_3DUBOBuffer(0)
- , m_3DActualSizeLight(0)
- , m_NormalBuffer(0)
- , m_VertexBuffer(0)
- , m_CubeVertexBuf(0)
- , m_CubeElementBuf(0)
- , m_CubeNormalBuf(0)
- , m_BoundBox(0)
- , m_BoundBoxNormal(0)
- , m_TextTexCoordBuf(0)
- , m_TextTexCoordBufBatch(0)
- , m_RoundBarMesh()
- , m_RenderVertexBuf(0)
- , m_RenderTexCoordBuf(0)
- , m_fViewAngle(30.0f)
- , mbPickingMode(false)
- , mnPickingFbo(0)
- , mnPickingRboDepth(0)
- , mnPickingRboColor(0)
- , m_BatchModelMatrixBuf(0)
- , m_BatchNormalMatrixBuf(0)
- , m_BatchColorBuf(0)
- , m_Batch3DUBOBuffer(0)
- , m_Batch3DActualSizeLight(0)
- , m_iLightNum(0)
- , m_bHighLighting(false)
- , m_uiSelectID(0)
- , m_fScrollSpeed(0.0f)
- , m_fScrollDistance(0.0f)
- , m_fMinCoordX(0.0f)
- , m_fMaxCoordX(0.0f)
- , m_fCurDistance(0.0f)
- , m_ScrollMoveMatrix(glm::mat4(1.0))
- , m_bUndrawFlag(false)
- , m_matDiff(glm::mat4(0.0))
-{
- m_Polygon3DInfo.lineOnly = false;
- m_Polygon3DInfo.twoSidesLighting = false;
- m_Polygon3DInfo.vertices = nullptr;
- m_Polygon3DInfo.normals = nullptr;
- m_Polygon3DInfo.lineWidth = 0.001f;
-
- m_Extrude3DInfo.twoSidesLighting = false;
-
- m_RoundBarMesh.iMeshSizes = 0;
-}
-
-OpenGL3DRenderer::~OpenGL3DRenderer()
-{
- ReleaseShapes();
- // delete buffers
- glDeleteBuffers(1, &m_CubeVertexBuf);
- glDeleteBuffers(1, &m_CubeNormalBuf);
- glDeleteBuffers(1, &m_CubeElementBuf);
- glDeleteBuffers(1, &m_BoundBox);
- glDeleteBuffers(1, &m_BoundBoxNormal);
- glDeleteBuffers(1, &m_TextTexCoordBuf);
- glDeleteBuffers(1, &m_RenderTexCoordBuf);
- glDeleteBuffers(1, &m_RenderVertexBuf);
- glDeleteBuffers(1, &m_3DUBOBuffer);
- glDeleteBuffers(1, &m_VertexBuffer);
- glDeleteBuffers(1, &m_NormalBuffer);
- glDeleteBuffers(1, &m_Batch3DUBOBuffer);
- glDeleteBuffers(1, &m_3DUBOBuffer);
- glDeleteBuffers(1, &m_3DUBOBuffer);
- glDeleteBuffers(1, &m_TextTexCoordBufBatch);
-
- glDeleteFramebuffers(1, &mnPickingFbo);
- glDeleteRenderbuffers(1, &mnPickingRboDepth);
- glDeleteRenderbuffers(1, &mnPickingRboColor);
-
- for (TextureArrayInfo & i : m_TextInfoBatch.texture)
- {
- glDeleteTextures(1, &i.textureID);
- }
- m_TextInfoBatch.texture.clear();
-
-}
-
-OpenGL3DRenderer::ShaderResources::ShaderResources()
- : m_b330Support(false)
- , m_bScrollFlag(false)
- , m_3DProID(0)
- , m_3DProjectionID(0)
- , m_3DViewID(0)
- , m_3DModelID(0)
- , m_3DNormalMatrixID(0)
- , m_3DVertexID(0)
- , m_3DNormalID(0)
- , m_3DMinCoordXID(0)
- , m_3DMaxCoordXID(0)
- , m_3DUndrawID(0)
- , m_3DMaterialAmbientID(0)
- , m_3DMaterialDiffuseID(0)
- , m_3DMaterialSpecularID(0)
- , m_3DMaterialColorID(0)
- , m_3DMaterialTwoSidesID(0)
- , m_3DMaterialShininessID(0)
- , m_3DLightColorID(0)
- , m_3DLightPosID(0)
- , m_3DLightPowerID(0)
- , m_3DLightNumID(0)
- , m_3DLightAmbientID(0)
- , m_TextProID(0)
- , m_TextMatrixID(0)
- , m_TextVertexID(0)
- , m_TextTexCoordID(0)
- , m_TextTexID(0)
- , m_ScreenTextProID(0)
- , m_ScreenTextVertexID(0)
- , m_ScreenTextTexCoordID(0)
- , m_ScreenTextTexID(0)
- , m_ScreenTextColorID(0)
- , m_CommonProID(0)
- , m_2DVertexID(0)
- , m_2DColorID(0)
- , m_MatrixID(0)
- , m_3DBatchProID(0)
- , m_3DBatchProjectionID(0)
- , m_3DBatchViewID(0)
- , m_3DBatchModelID(0)
- , m_3DBatchNormalMatrixID(0)
- , m_3DBatchVertexID(0)
- , m_3DBatchNormalID(0)
- , m_3DBatchColorID(0)
- , m_3DBatchTransMatrixID(0)
- , m_3DBatchMinCoordXID(0)
- , m_3DBatchMaxCoordXID(0)
- , m_3DBatchUndrawID(0)
- , mbTexBatchSupport(false)
- , m_BatchTextProID(0)
- , m_BatchTextMatrixID(0)
- , m_BatchTextVertexID(0)
- , m_BatchTextTexCoordID(0)
- , m_BatchTextTexID(0)
-{
-}
-
-OpenGL3DRenderer::ShaderResources::~ShaderResources()
-{
- glDeleteProgram(m_CommonProID);
- glDeleteProgram(m_TextProID);
- glDeleteProgram(m_ScreenTextProID);
- glDeleteProgram(m_3DProID);
- glDeleteProgram(m_3DBatchProID);
- glDeleteProgram(m_BatchTextProID);
-}
-
-void OpenGL3DRenderer::ShaderResources::LoadShaders()
-{
- CHECK_GL_ERROR();
- if (m_b330Support)
- {
- m_3DProID = OpenGLHelper::LoadShaders("shape3DVertexShader", "shape3DFragmentShader");
- m_3DProjectionID = glGetUniformLocation(m_3DProID, "P");
- m_3DViewID = glGetUniformLocation(m_3DProID, "V");
- m_3DModelID = glGetUniformLocation(m_3DProID, "M");
- m_3DNormalMatrixID = glGetUniformLocation(m_3DProID, "normalMatrix");
- m_3DVertexID = glGetAttribLocation(m_3DProID, "vertexPositionModelspace");
- m_3DNormalID = glGetAttribLocation(m_3DProID, "vertexNormalModelspace");
- CHECK_GL_ERROR();
- if (m_bScrollFlag)
- {
- m_3DBatchProID = OpenGLHelper::LoadShaders("shape3DVertexShaderBatchScroll", "shape3DFragmentShaderBatchScroll");
- m_3DBatchTransMatrixID = glGetUniformLocation(m_3DBatchProID, "transMatrix");
- m_3DBatchMinCoordXID = glGetUniformLocation(m_3DBatchProID, "minCoordX");
- m_3DBatchMaxCoordXID = glGetUniformLocation(m_3DBatchProID, "maxCoordX");
- m_3DBatchUndrawID = glGetUniformLocation(m_3DBatchProID, "undraw");
- }
- else
- m_3DBatchProID = OpenGLHelper::LoadShaders("shape3DVertexShaderBatch", "shape3DFragmentShaderBatch");
-
- CHECK_GL_ERROR();
- m_3DBatchProjectionID = glGetUniformLocation(m_3DBatchProID, "P");
- m_3DBatchViewID = glGetUniformLocation(m_3DBatchProID, "V");
- m_3DBatchModelID = glGetAttribLocation(m_3DBatchProID, "M");
- m_3DBatchNormalMatrixID = glGetAttribLocation(m_3DBatchProID, "normalMatrix");
- m_3DBatchVertexID = glGetAttribLocation(m_3DBatchProID, "vertexPositionModelspace");
- m_3DBatchNormalID = glGetAttribLocation(m_3DBatchProID, "vertexNormalModelspace");
- m_3DBatchColorID = glGetAttribLocation(m_3DBatchProID, "barColor");
-#if !defined MACOSX
- //check whether the texture array is supported
- mbTexBatchSupport = epoxy_has_gl_extension("GL_EXT_texture_array");
-#endif
- CHECK_GL_ERROR();
- if (mbTexBatchSupport)
- {
- m_BatchTextProID = OpenGLHelper::LoadShaders("textVertexShaderBatch", "textFragmentShaderBatch");
- m_BatchTextMatrixID = glGetUniformLocation(m_BatchTextProID, "MVP");
- m_BatchTextTexID = glGetUniformLocation(m_BatchTextProID, "texArray");
- m_BatchTextVertexID = glGetAttribLocation(m_BatchTextProID, "vPosition");
- m_BatchTextTexCoordID = glGetAttribLocation(m_BatchTextProID, "texCoord");
- }
- mbTexBatchSupport = m_BatchTextProID != 0;
- CHECK_GL_ERROR();
- }
- else
- {
- CHECK_GL_ERROR();
- //use 300
- m_3DProID = OpenGLHelper::LoadShaders("shape3DVertexShaderV300", "shape3DFragmentShaderV300");
- m_3DProjectionID = glGetUniformLocation(m_3DProID, "P");
- m_3DViewID = glGetUniformLocation(m_3DProID, "V");
- m_3DModelID = glGetUniformLocation(m_3DProID, "M");
- m_3DNormalMatrixID = glGetUniformLocation(m_3DProID, "normalMatrix");
- m_3DMaterialAmbientID = glGetUniformLocation(m_3DProID, "materialAmbient");
- m_3DMaterialDiffuseID = glGetUniformLocation(m_3DProID, "materialDiffuse");
- m_3DMaterialSpecularID = glGetUniformLocation(m_3DProID, "materialSpecular");
- m_3DMaterialColorID = glGetUniformLocation(m_3DProID, "materialColor");
- m_3DMaterialTwoSidesID = glGetUniformLocation(m_3DProID, "twoSidesLighting");
- m_3DMaterialShininessID = glGetUniformLocation(m_3DProID, "materialShininess");
- m_3DLightColorID = glGetUniformLocation(m_3DProID, "lightColor");
- m_3DLightPosID = glGetUniformLocation(m_3DProID, "lightPosWorldspace");
- m_3DLightPowerID = glGetUniformLocation(m_3DProID, "lightPower");
- m_3DLightNumID = glGetUniformLocation(m_3DProID, "lightNum");
- m_3DLightAmbientID = glGetUniformLocation(m_3DProID, "lightAmbient");
- m_3DMinCoordXID = glGetUniformLocation(m_3DProID, "minCoordX");
- m_3DMaxCoordXID = glGetUniformLocation(m_3DProID, "maxCoordX");
- m_3DUndrawID = glGetUniformLocation(m_3DProID, "undraw");
- m_3DVertexID = glGetAttribLocation(m_3DProID, "vertexPositionModelspace");
- m_3DNormalID = glGetAttribLocation(m_3DProID, "vertexNormalModelspace");
- }
- CHECK_GL_ERROR();
- if (!mbTexBatchSupport)
- {
- m_TextProID = OpenGLHelper::LoadShaders("textVertexShader", "textFragmentShader");
- m_TextMatrixID = glGetUniformLocation(m_TextProID, "MVP");
- m_TextVertexID = glGetAttribLocation(m_TextProID, "vPosition");
- m_TextTexCoordID = glGetAttribLocation(m_TextProID, "texCoord");
- m_TextTexID = glGetUniformLocation(m_TextProID, "TextTex");
- }
- CHECK_GL_ERROR();
-
- m_ScreenTextProID = OpenGLHelper::LoadShaders("screenTextVertexShader", "screenTextFragmentShader");
- m_ScreenTextVertexID = glGetAttribLocation(m_ScreenTextProID, "vPosition");
- m_ScreenTextTexCoordID = glGetAttribLocation(m_ScreenTextProID, "texCoord");
- m_ScreenTextTexID = glGetUniformLocation(m_ScreenTextProID, "TextTex");
- m_ScreenTextColorID = glGetUniformLocation(m_ScreenTextProID, "textColor");
- CHECK_GL_ERROR();
-
- m_CommonProID = OpenGLHelper::LoadShaders("commonVertexShader", "commonFragmentShader");
- m_MatrixID = glGetUniformLocation(m_CommonProID, "MVP");
- m_2DColorID = glGetUniformLocation(m_CommonProID, "vColor");
- m_2DVertexID = glGetAttribLocation(m_CommonProID, "vPosition");
-
- CHECK_GL_ERROR();
-}
-
-OpenGL3DRenderer::PickingShaderResources::PickingShaderResources()
- : m_CommonProID(0)
- , m_2DVertexID(0)
- , m_2DColorID(0)
- , m_MatrixID(0)
- , m_ModelID(0)
- , m_MinCoordXID(0)
- , m_MaxCoordXID(0)
-{
-}
-
-OpenGL3DRenderer::PickingShaderResources::~PickingShaderResources()
-{
- glDeleteProgram(m_CommonProID);
-}
-
-void OpenGL3DRenderer::PickingShaderResources::LoadShaders()
-{
- m_CommonProID = OpenGLHelper::LoadShaders("pickingVertexShader", "pickingFragmentShader");
- m_MatrixID = glGetUniformLocation(m_CommonProID, "MVP");
- m_2DVertexID = glGetAttribLocation(m_CommonProID, "vPosition");
- m_2DColorID = glGetUniformLocation(m_CommonProID, "vColor");
- m_ModelID = glGetUniformLocation(m_CommonProID, "M");
- m_MinCoordXID = glGetUniformLocation(m_CommonProID, "minCoordX");
- m_MaxCoordXID = glGetUniformLocation(m_CommonProID, "maxCoordX");
-}
-
-void OpenGL3DRenderer::SetCameraInfo(const glm::vec3& pos, const glm::vec3& direction, const glm::vec3& up)
-{
- m_CameraInfo.cameraPos = pos;
- m_CameraInfo.cameraOrg = direction;
- m_CameraInfo.cameraUp = up;
-}
-
-void OpenGL3DRenderer::init()
-{
- CHECK_GL_ERROR();
- glEnable(GL_CULL_FACE);
- CHECK_GL_ERROR();
- glCullFace(GL_BACK);
- CHECK_GL_ERROR();
-#if !defined(ANDROID) && !defined(IOS)
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-#endif
- // Enable depth test
- CHECK_GL_ERROR();
- glEnable(GL_DEPTH_TEST);
- // Accept fragment if it closer to the camera than the former one
- CHECK_GL_ERROR();
- glDepthFunc(GL_LESS);
- CHECK_GL_ERROR();
- glEnable(GL_LINE_SMOOTH);
- CHECK_GL_ERROR();
- glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
- CHECK_GL_ERROR();
- glEnable(GL_BLEND);
- CHECK_GL_ERROR();
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- CHECK_GL_ERROR();
-
- glEnable(GL_MULTISAMPLE);
-
- CHECK_GL_ERROR();
- ClearBuffer();
- CHECK_GL_ERROR();
-
- glGenBuffers(1, &m_CubeVertexBuf);
- glGenBuffers(1, &m_CubeNormalBuf);
- glGenBuffers(1, &m_CubeElementBuf);
- glGenBuffers(1, &m_VertexBuffer);
- glGenBuffers(1, &m_NormalBuffer);
- glGenBuffers(1, &m_BatchModelMatrixBuf);
- glGenBuffers(1, &m_BatchNormalMatrixBuf);
- glGenBuffers(1, &m_BatchColorBuf);
- glGenBuffers(1, &m_TextTexCoordBufBatch);
- glGenBuffers(1, &m_BoundBox);
- glBindBuffer(GL_ARRAY_BUFFER, m_BoundBox);
- glBufferData(GL_ARRAY_BUFFER, sizeof(boundBox), boundBox, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- CHECK_GL_ERROR();
-
- glGenBuffers(1, &m_BoundBoxNormal);
- glBindBuffer(GL_ARRAY_BUFFER, m_BoundBoxNormal);
- glBufferData(GL_ARRAY_BUFFER, sizeof(boundBoxNormal), boundBoxNormal, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- CHECK_GL_ERROR();
-
- m_fViewAngle = 30.0f;
- m_3DProjection = glm::perspective(m_fViewAngle, static_cast<float>(m_iWidth) / static_cast<float>(m_iHeight), 0.01f, 6000.0f);
-
- maResources.m_b330Support = epoxy_gl_version() >= 33;
- CHECK_GL_ERROR();
- maResources.LoadShaders();
- maPickingResources.LoadShaders();
-
- glGenBuffers(1, &m_TextTexCoordBuf);
- glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(texCoords), texCoords, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- glGenBuffers(1, &m_RenderTexCoordBuf);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderTexCoordBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(coordReverseVertices), coordReverseVertices, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- glGenBuffers(1, &m_RenderVertexBuf);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderVertexBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(squareVertices), squareVertices, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- CHECK_GL_ERROR();
-
- OpenGLHelper::createFramebuffer(m_iWidth, m_iHeight, mnPickingFbo, mnPickingRboDepth, mnPickingRboColor);
-
- m_Extrude3DInfo.rounded = false;
- CHECK_GL_ERROR();
- if (maResources.m_b330Support)
- {
- Init3DUniformBlock();
- InitBatch3DUniformBlock();
- }
- m_TextInfoBatch.batchNum = 512;
- CHECK_GL_ERROR();
- glViewport(0, 0, m_iWidth, m_iHeight);
- Set3DSenceInfo(Color(0xFFFFFF));
- m_GlobalScaleMatrix = glm::scale(glm::vec3(0.01f, 0.01f, 0.01f));
-}
-
-void OpenGL3DRenderer::SetSize(const Size& rSize)
-{
- m_iWidth = rSize.Width();
- m_iHeight = rSize.Height();
-}
-
-void OpenGL3DRenderer::AddVertexData(GLuint vertexBuf)
-{
- glBindBuffer(GL_ARRAY_BUFFER, vertexBuf);
- glBufferData(GL_ARRAY_BUFFER, m_Vertices.size() * sizeof(glm::vec3), &m_Vertices[0], GL_STATIC_DRAW);
- CHECK_GL_ERROR();
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-}
-
-void OpenGL3DRenderer::AddNormalData(GLuint normalBuf)
-{
- glBindBuffer(GL_ARRAY_BUFFER, normalBuf);
- glBufferData(GL_ARRAY_BUFFER, m_Normals.size() * sizeof(glm::vec3), &m_Normals[0], GL_STATIC_DRAW);
- CHECK_GL_ERROR();
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-}
-
-void OpenGL3DRenderer::AddIndexData(GLuint indexBuf)
-{
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuf);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_Indices.size() * sizeof(unsigned short), &m_Indices[0], GL_STATIC_DRAW);
- CHECK_GL_ERROR();
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
-}
-
-bool OpenGL3DRenderer::GetSimilarVertexIndex(PackedVertex const & packed,
- std::map<PackedVertex,unsigned short> & VertexToOutIndex,
- unsigned short & result
- )
-{
- std::map<PackedVertex,unsigned short>::iterator it = VertexToOutIndex.find(packed);
- if ( it == VertexToOutIndex.end() )
- {
- return false;
- }
- else
- {
- result = it->second;
- return true;
- }
-}
-
-void OpenGL3DRenderer::SetVertex(PackedVertex const &packed,
- std::map<PackedVertex,unsigned short> &VertexToOutIndex,
- std::vector<glm::vec3> &vertex,
- std::vector<glm::vec3> &normal,
- std::vector<unsigned short> &indices)
-{
- unsigned short index;
- bool found = GetSimilarVertexIndex(packed, VertexToOutIndex, index);
- if ( found )
- { // A similar vertex is already in the VBO, use it instead !
- indices.push_back( index );
- }
- else
- { // If not, it needs to be added in the output data.
- vertex.push_back(packed.position);
- normal.push_back(packed.normal);
- size_t newindex = vertex.size() - 1;
- indices.push_back( newindex );
- VertexToOutIndex[ packed ] = newindex;
- }
-}
-
-void OpenGL3DRenderer::CreateActualRoundedCube(float fRadius, int iSubDivY, int iSubDivZ, float width, float height, float depth)
-{
- float topThreshold = depth - 2 * fRadius;
- float bottomThreshold = fRadius;
-
- std::vector<glm::vec3> vertices;
- std::vector<glm::vec3> normals;
- GenerateRoundCornerBar(vertices, normals, fRadius, iSubDivY, iSubDivZ, width, height, depth);
- std::map<PackedVertex,unsigned short> VertexToOutIndex;
- glm::vec3 actualVerteices[3];
- glm::vec3 actualNormals[3];
- std::vector<unsigned short> indices[5];
- glm::vec3 externSurNormal;
- glm::mat4 corrctCoord = glm::translate(glm::vec3(width / 2.0f, height / 2.0f, depth / 2.0f - fRadius));
- m_RoundBarMesh.topThreshold = topThreshold;
- m_RoundBarMesh.bottomThreshold = bottomThreshold;
- m_RoundBarMesh.iMeshStartIndices = m_Vertices.size();
- for (int k = 0; k < 5; k++)
- {
- m_RoundBarMesh.iElementStartIndices[k] = indices[k].size();
- }
- for (size_t i = 0; i < vertices.size(); i += 3)
- {
- for (int k = 0; k < 3; k++)
- {
- actualVerteices[k] = glm::vec3(corrctCoord * glm::vec4(vertices[i + k], 1.0));
- actualNormals[k] = normals[i + k];
- }
- float maxZ = std::max(std::max(actualVerteices[0].z, actualVerteices[1].z), actualVerteices[2].z);
- float minZ = std::min(std::min(actualVerteices[0].z, actualVerteices[1].z), actualVerteices[2].z);
- int surfaceIndex = (minZ >= topThreshold - 0.001) ? TOP_SURFACE : ((maxZ <= bottomThreshold + 0.001) ? BOTTOM_SURFACE : MIDDLE_SURFACE);
- for (int k = 0; k < 3; k++)
- {
- {
- PackedVertex packed = {actualVerteices[k], actualNormals[k]};
- SetVertex(packed, VertexToOutIndex, m_Vertices, m_Normals, indices[surfaceIndex]);
- }
-
- //add extern
- if ((surfaceIndex == TOP_SURFACE) || (surfaceIndex == BOTTOM_SURFACE))
- {
- actualVerteices[k].z = 0.0f;
- externSurNormal = (surfaceIndex == TOP_SURFACE) ? glm::vec3(0.0, 0.0, 1.0) : glm::vec3(0.0, 0.0, -1.0);
- int tmpSurfaceIndex = (surfaceIndex == TOP_SURFACE) ? FLAT_TOP_SURFACE : FLAT_BOTTOM_SURFACE;
- PackedVertex packed = {actualVerteices[k], externSurNormal};
- SetVertex(packed, VertexToOutIndex, m_Vertices, m_Normals, indices[tmpSurfaceIndex]);
- }
- }
-
- }
- //create index below
- m_RoundBarMesh.iMeshSizes = m_Vertices.size() - m_RoundBarMesh.iMeshStartIndices;
- for (int k = 0; k < 5; k++)
- {
- m_RoundBarMesh.iElementSizes[k] = indices[k].size() - m_RoundBarMesh.iElementStartIndices[k];
- m_RoundBarMesh.iElementStartIndices[k] = m_Indices.size() * sizeof(unsigned short);
- for (unsigned short & IdxCnt : indices[k])
- {
- m_Indices.push_back(IdxCnt);
- }
- indices[k].clear();
- }
- vertices.clear();
- normals.clear();
- VertexToOutIndex.clear();
-}
-
-int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, std::vector<glm::vec3> &normals, float fRadius, int iSubDivY, int iSubDivZ, float width, float height, float depth)
-{
- //float fAddAngleY = 360.0f/float(iSubDivY), fAddAngleZ = 180.0f/float(iSubDivZ);
- float fAddAngleY = 360.0f/float(iSubDivY);
- float fAddAngleZ = 180.0f/float(iSubDivZ);
- float fCurAngleY = 0.0f;
- int iStepsY = 1;
-
- const float PI = float(atan(1.0)*4.0);
- int iFacesAdded = 0;
- float xOffset[] = {(width / 2 - fRadius), -(width / 2 - fRadius), -(width / 2 - fRadius), (width / 2 - fRadius), (width / 2 - fRadius)};
- float yOffset[] = {(height / 2 - fRadius), -(height / 2 - fRadius), (height / 2 - fRadius)};
- float zOffset[] = {-(depth / 2 - fRadius), -(depth / 2 - fRadius), (depth / 2 - fRadius), (depth / 2 - fRadius), -(depth / 2 - fRadius)};
- int iIndices[] = {0, 1, 2, 2, 3, 0};
- while(iStepsY <= iSubDivY)
- {
- float fNextAngleY = fCurAngleY+fAddAngleY;
- if ((fCurAngleY < 90.0f) && (fNextAngleY >= 90.0f))
- {
- fNextAngleY = 90.0f;
- }
- else if ((fCurAngleY < 180.0f) && (fNextAngleY >= 180.0f))
- {
- fNextAngleY = 180.0f;
- }
- else if ((fCurAngleY < 270.0f) && (fNextAngleY >= 270.0f))
- {
- fNextAngleY = 270.0f;
- }
- else if ((fCurAngleY < 360.0f) && (fNextAngleY >= 360.0f))
- {
- fNextAngleY = 360.0f;
- }
- float fSineY = std::sin(fCurAngleY/180.0f*PI), fCosY = std::cos(fCurAngleY/180.0f*PI);
- float fNextSineY = std::sin(fNextAngleY/180.0f*PI), fNextCosY = std::cos(fNextAngleY/180.0f*PI);
- glm::vec3 vDirY(fCosY, 0.0f, -fSineY), vNextDirY(fNextCosY, 0.0f, -fNextSineY);
- float fCurAngleZ = 0.0f;
- int iStepsZ = 1;
- int xzIndex = 0;
- if ((fCurAngleY >= 0) && (fCurAngleY < 90.0))
- {
- xzIndex = 0;
- }
- else if ((fCurAngleY >= 90) && (fCurAngleY < 180.0))
- {
- xzIndex = 1;
- }
- else if ((fCurAngleY >= 180) && (fCurAngleY < 270.0))
- {
- xzIndex = 2;
- }
- else if ((fCurAngleY >= 270) && (fCurAngleY < 360.0))
- {
- xzIndex = 3;
- }
- while(iStepsZ <= iSubDivZ)
- {
- int yIndex = 0;
- float fNextAngleZ = fCurAngleZ+fAddAngleZ;
-
- float fSineZ = std::sin(fCurAngleZ/180.0f*PI), fCosZ = std::cos(fCurAngleZ/180.0f*PI);
- float fNextSineZ = std::sin(fNextAngleZ/180.0f*PI), fNextCosZ = std::cos(fNextAngleZ/180.0f*PI);
-
- if ((fCurAngleZ < 90.0f) && (fNextAngleZ >= 90.0f))
- {
- fNextAngleZ = 90.0f;
- }
-
- if ((fCurAngleZ >= 0.0f) && (fCurAngleZ < 90.0f))
- {
- yIndex = 0;
- }
- else
- {
- yIndex = 1;
- }
-
- glm::vec3 vQuadPoints[] =
- {
- glm::vec3(vDirY.x*fSineZ*fRadius, fCosZ*fRadius, vDirY.z*fSineZ*fRadius),
- glm::vec3(vDirY.x*fNextSineZ*fRadius, fNextCosZ*fRadius, vDirY.z*fNextSineZ*fRadius),
- glm::vec3(vNextDirY.x*fNextSineZ*fRadius, fNextCosZ*fRadius, vNextDirY.z*fNextSineZ*fRadius),
- glm::vec3(vNextDirY.x*fSineZ*fRadius, fCosZ*fRadius, vNextDirY.z*fSineZ*fRadius)
- };
-
- glm::vec3 vActualQuadPoints[] =
- {
-
- glm::vec3(vQuadPoints[0].x + xOffset[xzIndex], vQuadPoints[0].y + yOffset[yIndex], vQuadPoints[0].z + zOffset[xzIndex]),
- glm::vec3(vQuadPoints[1].x + xOffset[xzIndex], vQuadPoints[1].y + yOffset[yIndex], vQuadPoints[1].z + zOffset[xzIndex]),
- glm::vec3(vQuadPoints[2].x + xOffset[xzIndex], vQuadPoints[2].y + yOffset[yIndex], vQuadPoints[2].z + zOffset[xzIndex]),
- glm::vec3(vQuadPoints[3].x + xOffset[xzIndex], vQuadPoints[3].y + yOffset[yIndex], vQuadPoints[3].z + zOffset[xzIndex])
- };
-
- glm::vec3 vNormals[] =
- {
- glm::normalize(vQuadPoints[0]),
- glm::normalize(vQuadPoints[1]),
- glm::normalize(vQuadPoints[2]),
- glm::normalize(vQuadPoints[3])
- };
- for (int index : iIndices)
- {
- vertices.push_back(vActualQuadPoints[index]);
- normals.push_back(vNormals[index]);
- }
- iFacesAdded += 2; // Keep count of added faces
- if (((fCurAngleY < 90.0) && (fNextAngleY >= 90.0)) ||
- ((fCurAngleY < 180.0) && (fNextAngleY >= 180.0)) ||
- ((fCurAngleY < 270.0) && (fNextAngleY >= 270.0)) ||
- ((fCurAngleY < 360.0) && (fNextAngleY >= 360.0)))
- {
- glm::vec3 vXZQuadNextPoints[] =
- {
- glm::vec3(vQuadPoints[3].x + xOffset[xzIndex], vQuadPoints[3].y + yOffset[yIndex], vQuadPoints[3].z + zOffset[xzIndex]),
- glm::vec3(vQuadPoints[2].x + xOffset[xzIndex], vQuadPoints[2].y + yOffset[yIndex], vQuadPoints[2].z + zOffset[xzIndex]),
- glm::vec3(vQuadPoints[2].x + xOffset[xzIndex + 1], vQuadPoints[2].y + yOffset[yIndex], vQuadPoints[2].z + zOffset[xzIndex + 1]),
- glm::vec3(vQuadPoints[3].x + xOffset[xzIndex + 1], vQuadPoints[3].y + yOffset[yIndex], vQuadPoints[3].z + zOffset[xzIndex + 1])
- };
- glm::vec3 vXZNextNormals[] =
- {
- glm::normalize(vQuadPoints[3]),
- glm::normalize(vQuadPoints[2]),
- glm::normalize(vQuadPoints[2]),
- glm::normalize(vQuadPoints[3])
- };
- for (int index : iIndices)
- {
- vertices.push_back(vXZQuadNextPoints[index]);
- normals.push_back(vXZNextNormals[index]);
- }
- iFacesAdded += 2;
- }
- if ((fCurAngleZ < 90.0) && (fNextAngleZ >= 90.0))
- {
- glm::vec3 vYQuadNextPoints[] =
- {
- glm::vec3(vQuadPoints[1].x + xOffset[xzIndex], vQuadPoints[1].y + yOffset[yIndex], vQuadPoints[1].z + zOffset[xzIndex]),
- glm::vec3(vQuadPoints[1].x + xOffset[xzIndex], vQuadPoints[1].y + yOffset[yIndex + 1], vQuadPoints[1].z + zOffset[xzIndex]),
- glm::vec3(vQuadPoints[2].x + xOffset[xzIndex], vQuadPoints[2].y + yOffset[yIndex + 1], vQuadPoints[2].z + zOffset[xzIndex]),
- glm::vec3(vQuadPoints[2].x + xOffset[xzIndex], vQuadPoints[2].y + yOffset[yIndex], vQuadPoints[2].z + zOffset[xzIndex])
- };
- glm::vec3 vYNextNormals[] =
- {
- glm::normalize(vQuadPoints[1]),
- glm::normalize(vQuadPoints[1]),
- glm::normalize(vQuadPoints[2]),
- glm::normalize(vQuadPoints[2])
- };
- for (int index : iIndices)
- {
- vertices.push_back(vYQuadNextPoints[index]);
- normals.push_back(vYNextNormals[index]);
- }
- iFacesAdded += 2;
- }
- iStepsZ++;
- if ((iStepsZ > iSubDivZ) && (fCurAngleZ < 180.0f))
- {
- iStepsZ--;
- }
- fCurAngleZ = fNextAngleZ;
- }
- iStepsY++;
- if ((iStepsY > iSubDivY) && (fCurAngleY < 360.0f))
- {
- iStepsY--;
- }
- fCurAngleY = fNextAngleY;
- }
- //draw the rectangle face
- //top surface
- glm::vec3 vTopPoints[] =
- {
- glm::vec3(xOffset[0], height / 2, zOffset[0]),
- glm::vec3(xOffset[1], height / 2, zOffset[1]),
- glm::vec3(xOffset[2], height / 2, zOffset[2]),
- glm::vec3(xOffset[3], height / 2, zOffset[3])
- };
- glm::vec3 vTopNormal = glm::vec3(0.0f, 1.0f, 0.0f);
- for (int index : iIndices)
- {
- vertices.push_back(vTopPoints[index]);
- normals.push_back(vTopNormal);
- }
- iFacesAdded += 2;
- //bottom surface
- glm::vec3 vBottomPoints[] =
- {
- glm::vec3(xOffset[3], -height / 2, zOffset[3]),
- glm::vec3(xOffset[2], -height / 2, zOffset[2]),
- glm::vec3(xOffset[1], -height / 2, zOffset[1]),
- glm::vec3(xOffset[0], -height / 2, zOffset[0])
- };
- glm::vec3 vBottomNormal = glm::vec3(0.0f, -1.0f, 0.0f);
- for (int index : iIndices)
- {
- vertices.push_back(vBottomPoints[index]);
- normals.push_back(vBottomNormal);
- }
- iFacesAdded += 2;
- //left surface
- glm::vec3 vLeftPoints[] =
- {
- glm::vec3(-width / 2, yOffset[0], zOffset[0]),
- glm::vec3(-width / 2, yOffset[1], zOffset[1]),
- glm::vec3(-width / 2, yOffset[1], zOffset[2]),
- glm::vec3(-width / 2, yOffset[0], zOffset[3])
- };
- glm::vec3 vLeftNormal = glm::vec3(-1.0f, 0.0f, 0.0f);
- for (int index : iIndices)
- {
- vertices.push_back(vLeftPoints[index]);
- normals.push_back(vLeftNormal);
- }
- //right surface
- glm::vec3 vRightPoints[] =
- {
- glm::vec3(width / 2, yOffset[0], zOffset[3]),
- glm::vec3(width / 2, yOffset[1], zOffset[2]),
- glm::vec3(width / 2, yOffset[1], zOffset[1]),
- glm::vec3(width / 2, yOffset[0], zOffset[0])
- };
- glm::vec3 vRightNormal = glm::vec3(1.0f, 0.0f, 0.0f);
- for (int index : iIndices)
- {
- vertices.push_back(vRightPoints[index]);
- normals.push_back(vRightNormal);
- }
- iFacesAdded += 2;
- //front surface
- glm::vec3 vFrontPoints[] =
- {
- glm::vec3(xOffset[0], yOffset[0], depth / 2),
- glm::vec3(xOffset[1], yOffset[0], depth / 2),
- glm::vec3(xOffset[2], yOffset[1], depth / 2),
- glm::vec3(xOffset[3], yOffset[1], depth / 2)
- };
- glm::vec3 vFrontNormal = glm::vec3(0.0f, 0.0f, 1.0f);
- for (int index : iIndices)
- {
- vertices.push_back(vFrontPoints[index]);
- normals.push_back(vFrontNormal);
- }
- //back surface
- glm::vec3 vBackPoints[] =
- {
- glm::vec3(xOffset[0], yOffset[1], -depth / 2),
- glm::vec3(xOffset[1], yOffset[1], -depth / 2),
- glm::vec3(xOffset[2], yOffset[0], -depth / 2),
- glm::vec3(xOffset[3], yOffset[0], -depth / 2)
- };
- glm::vec3 vBackNormal = glm::vec3(0.0f, 0.0f, -1.0f);
- for (int index : iIndices)
- {
- vertices.push_back(vBackPoints[index]);
- normals.push_back(vBackNormal);
- }
- iFacesAdded += 2;
- return iFacesAdded;
-}
-
-void OpenGL3DRenderer::RenderLine3D(const Polygon3DInfo& polygon)
-{
- CHECK_GL_ERROR();
- glUseProgram(maResources.m_CommonProID);
- PosVecf3 const trans = {0.0f, 0, 0.0};
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {1.0f, 1.0f, 1.0f};
- MoveModelf(trans, angle, scale);
- m_Model = m_GlobalScaleMatrix * m_Model;
- m_3DMVP = m_3DProjection * m_3DView * m_Model;
-
- for (size_t i = 0; i < polygon.verticesList.size(); i++)
- {
- //move the circle to the pos, and scale using the xScale and Y scale
- Vertices3D *pointList = polygon.verticesList[i];
- //if line only, using the common shader to render
-
- //fill vertex buffer
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glBufferData(GL_ARRAY_BUFFER, pointList->size() * sizeof(glm::vec3), &pointList[0][0], GL_STATIC_DRAW);
- if(mbPickingMode)
- glUniform4fv(maResources.m_2DColorID, 1, &polygon.id[0]);
- else
- glUniform4fv(maResources.m_2DColorID, 1, &polygon.polygonColor[0]);
- glUniformMatrix4fv(maResources.m_MatrixID, 1, GL_FALSE, &m_3DMVP[0][0]);
- CHECK_GL_ERROR();
-
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(maResources.m_2DVertexID);
- CHECK_GL_ERROR();
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- CHECK_GL_ERROR();
- glVertexAttribPointer(maResources.m_2DVertexID, // attribute
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
-
- CHECK_GL_ERROR();
- glLineWidth(polygon.lineWidth);
- CHECK_GL_ERROR();
- glDrawArrays(GL_LINE_STRIP, 0, pointList->size());
- CHECK_GL_ERROR();
- glDisableVertexAttribArray(maResources.m_2DVertexID);
- CHECK_GL_ERROR();
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- CHECK_GL_ERROR();
- }
- glUseProgram(0);
- CHECK_GL_ERROR();
-}
-
-void OpenGL3DRenderer::RenderPolygon3D(const Polygon3DInfo& polygon)
-{
- CHECK_GL_ERROR();
- size_t verticesNum = polygon.verticesList.size();
- size_t normalsNum = polygon.normalsList.size();
- //check whether the number of vertices and normals are equal
- if (m_CameraInfo.cameraPos.z >= 0.0f)
- glPolygonOffset(1.0, 1.0);
- else
- glPolygonOffset(-1.0, -1.0);
- CHECK_GL_ERROR();
- if (verticesNum != normalsNum)
- {
- return ;
- }
- glBindBuffer(GL_UNIFORM_BUFFER, 0);
- CHECK_GL_ERROR();
- if(mbPickingMode)
- {
- glUseProgram(maPickingResources.m_CommonProID);
- float minCoordX = 0.0f;
- float maxCoordX = m_fMinCoordX + m_fMaxCoordX;
- glUniform1fv(maPickingResources.m_MinCoordXID, 1, &minCoordX);
- glUniform1fv(maPickingResources.m_MaxCoordXID, 1, &maxCoordX);
- }
- else
- {
- glUseProgram(maResources.m_3DProID);
- glUniformMatrix4fv(maResources.m_3DViewID, 1, GL_FALSE, &m_3DView[0][0]);
- glUniformMatrix4fv(maResources.m_3DProjectionID, 1, GL_FALSE, &m_3DProjection[0][0]);
- CHECK_GL_ERROR();
- if (maResources.m_b330Support)
- {
- //update ubo
- Update3DUniformBlock();
- glBindBuffer(GL_UNIFORM_BUFFER, m_3DUBOBuffer);
- glBufferSubData(GL_UNIFORM_BUFFER, m_3DActualSizeLight, sizeof(MaterialParameters), &polygon.material);
- CHECK_GL_ERROR();
- }
- else
- {
- float minCoordX = 0.0f;
- float maxCoordX = m_fMinCoordX + m_fMaxCoordX;
- glUniform1fv(maResources.m_3DMinCoordXID, 1, &minCoordX);
- glUniform1fv(maResources.m_3DMaxCoordXID, 1, &maxCoordX);
- glUniform1i(maResources.m_3DUndrawID, m_bUndrawFlag);
- CHECK_GL_ERROR();
- //update light information
- glUniform4fv(maResources.m_3DLightColorID, m_iLightNum, reinterpret_cast<GLfloat*>(m_LightColor));
- glUniform4fv(maResources.m_3DLightPosID, m_iLightNum, reinterpret_cast<GLfloat*>(m_PositionWorldspace));
- glUniform1fv(maResources.m_3DLightPowerID, m_iLightNum, m_fLightPower);
- glUniform1i(maResources.m_3DLightNumID, m_iLightNum);
- glUniform4fv(maResources.m_3DLightAmbientID, 1, &m_Ambient[0]);
- CHECK_GL_ERROR();
- //update material information
- glUniform4fv(maResources.m_3DMaterialAmbientID, 1, &polygon.material.ambient[0]);
- glUniform4fv(maResources.m_3DMaterialDiffuseID, 1, &polygon.material.diffuse[0]);
- glUniform4fv(maResources.m_3DMaterialSpecularID, 1, &polygon.material.specular[0]);
- glUniform4fv(maResources.m_3DMaterialColorID, 1, &polygon.material.materialColor[0]);
- glUniform1i(maResources.m_3DMaterialTwoSidesID, polygon.material.twoSidesLighting);
- glUniform1f(maResources.m_3DMaterialShininessID, polygon.material.shininess);
- CHECK_GL_ERROR();
- }
- }
- for (size_t i = 0; i < verticesNum; i++)
- {
- //move the circle to the pos, and scale using the xScale and Y scale
- Vertices3D *pointList = polygon.verticesList[i];
- Normals3D *normalList = polygon.normalsList[i];
- PosVecf3 const trans = {0.0f, 0.0f, 0.0};
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {1.0f, 1.0f, 1.0f};
- MoveModelf(trans, angle, scale);
- m_Model = m_GlobalScaleMatrix * m_Model;
- glm::mat3 normalMatrix(m_Model);
- glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
-
- //render to fbo
- //fill vertex buffer
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glBufferData(GL_ARRAY_BUFFER, pointList->size() * sizeof(glm::vec3), &pointList[0][0], GL_STATIC_DRAW);
- CHECK_GL_ERROR();
-
- if(!mbPickingMode)
- {
- //fill normal buffer
- glBindBuffer(GL_ARRAY_BUFFER, m_NormalBuffer);
- CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, normalList->size() * sizeof(glm::vec3), &normalList[0][0], GL_STATIC_DRAW);
- CHECK_GL_ERROR();
- glUniformMatrix4fv(maResources.m_3DModelID, 1, GL_FALSE, &m_Model[0][0]);
- CHECK_GL_ERROR();
- glUniformMatrix3fv(maResources.m_3DNormalMatrixID, 1, GL_FALSE, &normalInverseTranspos[0][0]);
- CHECK_GL_ERROR();
- }
- else
- {
- glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model;
- glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]);
- glUniform4fv(maPickingResources.m_2DColorID, 1, &polygon.id[0]);
- }
- CHECK_GL_ERROR();
- GLint aVertexID = mbPickingMode ? maPickingResources.m_2DVertexID : maResources.m_3DVertexID;
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(aVertexID);
- CHECK_GL_ERROR();
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- CHECK_GL_ERROR();
- glVertexAttribPointer(aVertexID, // attribute
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- CHECK_GL_ERROR();
- if(!mbPickingMode)
- {
- // 2nd attribute buffer : normals
- glEnableVertexAttribArray(maResources.m_3DNormalID);
- CHECK_GL_ERROR();
- glBindBuffer(GL_ARRAY_BUFFER, m_NormalBuffer);
- CHECK_GL_ERROR();
- glVertexAttribPointer(maResources.m_3DNormalID, // attribute
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- }
- CHECK_GL_ERROR();
- glDrawArrays(GL_POLYGON, 0, pointList->size());
- CHECK_GL_ERROR();
- glDisableVertexAttribArray(aVertexID);
- CHECK_GL_ERROR();
- if(!mbPickingMode)
- glDisableVertexAttribArray(maResources.m_3DNormalID);
-
- CHECK_GL_ERROR();
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- CHECK_GL_ERROR();
- }
- glUseProgram(0);
- CHECK_GL_ERROR();
-}
-
-namespace {
-
-template< typename T >
-struct DeletePointer
-{
- void operator()(T* p)
- {
- delete p;
- }
-};
-
-}
-
-void OpenGL3DRenderer::ReleasePolygonShapes()
-{
- for (Polygon3DInfo & polygon : m_Polygon3DInfoList)
- {
- std::for_each(polygon.verticesList.begin(),
- polygon.verticesList.end(), DeletePointer<Vertices3D>());
- std::for_each(polygon.normalsList.begin(),
- polygon.normalsList.end(), DeletePointer<Normals3D>());
- delete polygon.vertices;
- delete polygon.normals;
- }
- m_Polygon3DInfoList.clear();
-}
-
-void OpenGL3DRenderer::RenderPolygon3DObject()
-{
- glDepthMask(GL_FALSE);
- CHECK_GL_ERROR();
- for (Polygon3DInfo & polygon : m_Polygon3DInfoList)
- {
- if (polygon.lineOnly || (!polygon.fillStyle))
- {
- //just use the common shader is ok for lines
- RenderLine3D(polygon);
- CHECK_GL_ERROR();
- }
- else
- {
- RenderPolygon3D(polygon);
- }
- }
- glDepthMask(GL_TRUE);
-}
-
-void OpenGL3DRenderer::Set3DSenceInfo(Color nColor, bool twoSidesLighting)
-{
- m_Polygon3DInfo.material.twoSidesLighting = twoSidesLighting;
- if (maResources.m_b330Support)
- {
- m_LightsInfo.ambient = getColorAsVector(nColor);
- m_LightsInfo.lightNum = 0;
- }
- else
- {
- m_iLightNum = 0;
- m_Ambient = getColorAsVector(nColor);
- }
- SetLightInfo(true, Color(0xFFFFFF), glm::vec4(-1.0, -1.0, 1.0, 0.0));
- SetLightInfo(true, Color(0xFFFFFF), glm::vec4(-1.0, 1.0, 1.0, 0.0));
- SetLightInfo(true, Color(0xFFFFFF), glm::vec4(1.0, -1.0, 1.0, 0.0));
- SetLightInfo(true, Color(0xFFFFFF), glm::vec4(1.0, 1.0, 1.0, 0.0));
-}
-
-void OpenGL3DRenderer::SetLightInfo(bool lightOn, Color nColor, const glm::vec4& direction)
-{
- if (lightOn)
- {
- if (maResources.m_b330Support)
- {
- if (m_LightsInfo.lightNum >= maxLights)
- {
- return;
- }
- m_LightsInfo.light[m_LightsInfo.lightNum].lightColor = getColorAsVector(nColor);
- m_LightsInfo.light[m_LightsInfo.lightNum].positionWorldspace = direction;
- m_LightsInfo.light[m_LightsInfo.lightNum].lightPower = 0.3f;
- m_LightsInfo.lightNum++;
- }
- else
- {
- if (m_iLightNum >= maxLights)
- {
- return;
- }
- m_LightColor[m_iLightNum] = getColorAsVector(nColor);
- m_PositionWorldspace[m_iLightNum] = direction;
- m_fLightPower[m_iLightNum] = 0.3f;
- m_iLightNum++;
- }
- }
-}
-
-void OpenGL3DRenderer::AddShapePolygon3DObject(Color nColor, bool lineOnly, Color nLineColor,long fillStyle, sal_uInt32 specular, sal_uInt32 nUniqueId)
-{
- m_Polygon3DInfo.polygonColor = getColorAsVector(nColor);
- m_Polygon3DInfo.id = getColorAsVector(Color(nUniqueId));
- m_Polygon3DInfo.material.materialColor = m_Polygon3DInfo.polygonColor;//material color seems to be the same for all parts, so we use the polygon color
- //line or Polygon
- m_Polygon3DInfo.lineOnly = lineOnly;
-
- // if line only, use line color
- if (m_Polygon3DInfo.lineOnly)
- {
- m_Polygon3DInfo.polygonColor = getColorAsVector(nLineColor);
- }
-
- //fillStyle
- m_Polygon3DInfo.fillStyle= fillStyle;
-
- //material specular;
- m_Polygon3DInfo.material.specular = getColorAsVector(Color(specular));
-
- m_Polygon3DInfo.material.diffuse = glm::vec4(1.0, 1.0, 1.0, 1.0);
-
- m_Polygon3DInfo.material.ambient = glm::vec4(0.2, 0.2, 0.2, 1.0);
-
- m_Polygon3DInfo.material.shininess = 1.0f;
-}
-
-void OpenGL3DRenderer::EndAddShapePolygon3DObject()
-{
- m_Polygon3DInfoList.push_back(m_Polygon3DInfo);
- m_Polygon3DInfo.normals = nullptr;
- m_Polygon3DInfo.vertices = nullptr;
- // TODO: moggi: memory leak???
- m_Polygon3DInfo.verticesList.clear();
- m_Polygon3DInfo.normalsList.clear();
-}
-
-void OpenGL3DRenderer::AddPolygon3DObjectNormalPoint(float x, float y, float z)
-{
- if (m_Polygon3DInfo.fillStyle)
- {
- if (!m_Polygon3DInfo.normals)
- {
- m_Polygon3DInfo.normals = new Normals3D;
- }
- m_Polygon3DInfo.normals->push_back(glm::vec3(x, y, z));
- }
-}
-
-void OpenGL3DRenderer::EndAddPolygon3DObjectNormalPoint()
-{
- m_Polygon3DInfo.normalsList.push_back(m_Polygon3DInfo.normals);
- m_Polygon3DInfo.normals = nullptr;
-}
-
-void OpenGL3DRenderer::AddPolygon3DObjectPoint(float x, float y, float z)
-{
- if (!m_Polygon3DInfo.vertices)
- {
- m_Polygon3DInfo.vertices = new Vertices3D;
- }
- //float actualX = x - (float)m_iWidth / 2;
- //float actualY = y - (float)m_iHeight / 2;
- float actualX = x;
- float actualY = y;
- float actualZ = z;
- m_Polygon3DInfo.vertices->push_back(glm::vec3(actualX, actualY, actualZ));
-}
-
-void OpenGL3DRenderer::EndAddPolygon3DObjectPoint()
-{
- m_Polygon3DInfo.verticesList.push_back(m_Polygon3DInfo.vertices);
- m_Polygon3DInfo.vertices = nullptr;
-}
-
-void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, Color nColor, sal_uInt32 specular, const glm::mat4& modelMatrix, sal_uInt32 nUniqueId)
-{
- m_Extrude3DInfo.id = getColorAsVector(Color(nUniqueId));
- m_Extrude3DInfo.orgID = nUniqueId;
- glm::vec4 tranform = modelMatrix * glm::vec4(0.0, 0.0, 0.0, 1.0);
- glm::vec4 DirX = modelMatrix * glm::vec4(1.0, 0.0, 0.0, 0.0);
- glm::vec4 DirY = modelMatrix * glm::vec4(0.0, 1.0, 0.0, 0.0);
- glm::vec4 DirZ = modelMatrix * glm::vec4(0.0, 0.0, 1.0, 0.0);
- m_Extrude3DInfo.xScale = glm::length(DirX);
- m_Extrude3DInfo.yScale = glm::length(DirY);
- m_Extrude3DInfo.zScale = glm::length(DirZ);
- glm::mat4 transformMatrixInverse = glm::inverse(glm::translate(glm::vec3(tranform)));
- glm::mat4 scaleMatrixInverse = glm::inverse(glm::scale(glm::vec3(m_Extrude3DInfo.xScale, m_Extrude3DInfo.yScale, m_Extrude3DInfo.zScale)));
- m_Extrude3DInfo.rotation = transformMatrixInverse * modelMatrix * scaleMatrixInverse;
-
- //color
- m_Extrude3DInfo.extrudeColor = getColorAsVector(nColor);
- m_Extrude3DInfo.material.materialColor = m_Extrude3DInfo.extrudeColor;//material color seems to be the same for all parts, so we use the polygon color
-
- //material specular;
- m_Extrude3DInfo.material.specular = getColorAsVector(Color(specular));
-
- m_Extrude3DInfo.material.diffuse = glm::vec4(1.0, 1.0, 1.0, 1.0);
-
- m_Extrude3DInfo.material.ambient = glm::vec4(0.2, 0.2, 0.2, 1.0);
-
- m_Extrude3DInfo.material.shininess = 1.0f;
- m_Extrude3DInfo.xTransform = tranform.x;
- m_Extrude3DInfo.yTransform = tranform.y;
- m_Extrude3DInfo.zTransform = tranform.z;
- float width = 1.0f;
- float height = m_Extrude3DInfo.yScale / m_Extrude3DInfo.xScale;
- float radius = height > 0.2f ? 0.2f : height / 4.0f;
- float depth = 1 + 2 * radius;
- bool NORoundedCube = (radius > (width / 2)) || (radius > (height / 2)) || (radius > (depth / 2));
- if (!NORoundedCube && roundedCorner && (m_RoundBarMesh.iMeshSizes == 0))
- {
- CreateActualRoundedCube(radius, CORNER_DIVION_Y, CORNER_DIVION_Z, width, height, depth);
- AddVertexData(m_CubeVertexBuf);
- AddNormalData(m_CubeNormalBuf);
- AddIndexData(m_CubeElementBuf);
- for (int j = 0; j < 5; j++)
- {
- m_Extrude3DInfo.startIndex[j] = m_RoundBarMesh.iElementStartIndices[j];
- m_Extrude3DInfo.size[j] = m_RoundBarMesh.iElementSizes[j];
- }
- m_Vertices.clear();
- m_Normals.clear();
- m_Indices.clear();
- m_Extrude3DInfo.rounded = true;
- }
- m_Batchmaterial = m_Extrude3DInfo.material;
-}
-
-void OpenGL3DRenderer::EndAddShape3DExtrudeObject()
-{
- m_Extrude3DList.push_back(m_Extrude3DInfo);
-}
-
-void OpenGL3DRenderer::Init3DUniformBlock()
-{
- if(mbPickingMode)
- return;
-
- GLuint a3DLightBlockIndex = glGetUniformBlockIndex(maResources.m_3DProID, "GlobalLights");
- GLuint a3DMaterialBlockIndex = glGetUniformBlockIndex(maResources.m_3DProID, "GlobalMaterialParameters");
-
- if ((a3DLightBlockIndex == GL_INVALID_INDEX) || (a3DMaterialBlockIndex == GL_INVALID_INDEX))
- {
- return;
- }
- int nUniformBufferAlignSize = 1;
- glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &nUniformBufferAlignSize);
- GLint nBlockDataSizeLight = 0, nBlockDataSizeMertrial = 0;
- glGetActiveUniformBlockiv(maResources.m_3DProID, a3DLightBlockIndex, GL_UNIFORM_BLOCK_DATA_SIZE, &nBlockDataSizeLight);
- glGetActiveUniformBlockiv(maResources.m_3DProID, a3DMaterialBlockIndex, GL_UNIFORM_BLOCK_DATA_SIZE, &nBlockDataSizeMertrial);
- CHECK_GL_ERROR();
- glGenBuffers(1, &m_3DUBOBuffer);
- glBindBuffer(GL_UNIFORM_BUFFER, m_3DUBOBuffer);
- CHECK_GL_ERROR();
- m_3DActualSizeLight = ((nBlockDataSizeLight / nUniformBufferAlignSize) + std::min(nBlockDataSizeLight % nUniformBufferAlignSize, 1)) * nUniformBufferAlignSize;
-// cout << "nBlockDataSizeMertrial = " << nBlockDataSizeMertrial << ", nBlockDataSizeLight = " << nBlockDataSizeLight << ", m_3DActualSizeLight = " << m_3DActualSizeLight << endl;
- int dataSize = m_3DActualSizeLight + nBlockDataSizeMertrial;
- glBufferData(GL_UNIFORM_BUFFER, dataSize, nullptr, GL_DYNAMIC_DRAW);
- glBindBufferRange(GL_UNIFORM_BUFFER, 0, m_3DUBOBuffer, 0, nBlockDataSizeLight);
- CHECK_GL_ERROR();
- glUniformBlockBinding(maResources.m_3DProID, a3DLightBlockIndex, 0);
-
- glBindBufferRange(GL_UNIFORM_BUFFER, 1, m_3DUBOBuffer, ((nBlockDataSizeLight / nUniformBufferAlignSize) + std::min(nBlockDataSizeLight % nUniformBufferAlignSize, 1)) * nUniformBufferAlignSize, nBlockDataSizeMertrial);
- glUniformBlockBinding(maResources.m_3DProID, a3DMaterialBlockIndex, 1);
- //for the light source uniform, we must calc the offset of each element
- CHECK_GL_ERROR();
- glBindBuffer(GL_UNIFORM_BUFFER, 0);
-}
-
-void OpenGL3DRenderer::InitBatch3DUniformBlock()
-{
- if(mbPickingMode)
- return;
-
- GLuint a3DLightBlockIndex = glGetUniformBlockIndex(maResources.m_3DBatchProID, "GlobalLights");
- GLuint a3DMaterialBlockIndex = glGetUniformBlockIndex(maResources.m_3DBatchProID, "GlobalMaterialParameters");
-
- if ((a3DLightBlockIndex == GL_INVALID_INDEX) || (a3DMaterialBlockIndex == GL_INVALID_INDEX))
- {
- return;
- }
- int nUniformBufferAlignSize = 1;
- glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &nUniformBufferAlignSize);
- GLint nBlockDataSizeLight = 0, nBlockDataSizeMertrial = 0;
- glGetActiveUniformBlockiv(maResources.m_3DBatchProID, a3DLightBlockIndex, GL_UNIFORM_BLOCK_DATA_SIZE, &nBlockDataSizeLight);
- glGetActiveUniformBlockiv(maResources.m_3DBatchProID, a3DMaterialBlockIndex, GL_UNIFORM_BLOCK_DATA_SIZE, &nBlockDataSizeMertrial);
- CHECK_GL_ERROR();
- glGenBuffers(1, &m_Batch3DUBOBuffer);
- glBindBuffer(GL_UNIFORM_BUFFER, m_Batch3DUBOBuffer);
- CHECK_GL_ERROR();
- m_Batch3DActualSizeLight = ((nBlockDataSizeLight / nUniformBufferAlignSize) + std::min(nBlockDataSizeLight % nUniformBufferAlignSize, 1)) * nUniformBufferAlignSize;
-// cout << "nBlockDataSizeMertrial = " << nBlockDataSizeMertrial << ", nBlockDataSizeLight = " << nBlockDataSizeLight << ", m_3DActualSizeLight = " << m_3DActualSizeLight << endl;
- int dataSize = m_Batch3DActualSizeLight + nBlockDataSizeMertrial;
- glBufferData(GL_UNIFORM_BUFFER, dataSize, nullptr, GL_DYNAMIC_DRAW);
- glBindBufferRange(GL_UNIFORM_BUFFER, 2, m_Batch3DUBOBuffer, 0, nBlockDataSizeLight);
- CHECK_GL_ERROR();
- glUniformBlockBinding(maResources.m_3DBatchProID, a3DLightBlockIndex, 2);
-
- glBindBufferRange(GL_UNIFORM_BUFFER, 3, m_Batch3DUBOBuffer, ((nBlockDataSizeLight / nUniformBufferAlignSize) + std::min(nBlockDataSizeLight % nUniformBufferAlignSize, 1)) * nUniformBufferAlignSize, nBlockDataSizeMertrial);
- glUniformBlockBinding(maResources.m_3DBatchProID, a3DMaterialBlockIndex, 3);
- //for the light source uniform, we must calc the offset of each element
- CHECK_GL_ERROR();
- glBindBuffer(GL_UNIFORM_BUFFER, 0);
-}
-
-void OpenGL3DRenderer::UpdateBatch3DUniformBlock()
-{
- if(mbPickingMode)
- return;
-
- CHECK_GL_ERROR();
- glBindBuffer(GL_UNIFORM_BUFFER, m_Batch3DUBOBuffer);
- CHECK_GL_ERROR();
- glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(GLint), &m_LightsInfo.lightNum);
- CHECK_GL_ERROR();
- //current std140 alignment: 16
- glBufferSubData(GL_UNIFORM_BUFFER, 16, sizeof(glm::vec4), &m_LightsInfo.ambient[0]);
- CHECK_GL_ERROR();
- //current std140 alignment: 16
- glBufferSubData(GL_UNIFORM_BUFFER, 32, sizeof(LightSource) * maxLights, &m_LightsInfo.light);
- CHECK_GL_ERROR();
- glBindBuffer(GL_UNIFORM_BUFFER, 0);
-}
-
-void OpenGL3DRenderer::Update3DUniformBlock()
-{
- if(mbPickingMode)
- return;
-
- CHECK_GL_ERROR();
- glBindBuffer(GL_UNIFORM_BUFFER, m_3DUBOBuffer);
- CHECK_GL_ERROR();
- glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(GLint), &m_LightsInfo.lightNum);
- CHECK_GL_ERROR();
- //current std140 alignment: 16
- glBufferSubData(GL_UNIFORM_BUFFER, 16, sizeof(glm::vec4), &m_LightsInfo.ambient[0]);
- CHECK_GL_ERROR();
- //current std140 alignment: 16
- glBufferSubData(GL_UNIFORM_BUFFER, 32, sizeof(LightSource) * maxLights, &m_LightsInfo.light);
- CHECK_GL_ERROR();
- glBindBuffer(GL_UNIFORM_BUFFER, 0);
-}
-
-void OpenGL3DRenderer::RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D, int surIndex)
-{
- float xyScale = extrude3D.xScale;
- PosVecf3 trans = {extrude3D.xTransform,
- extrude3D.yTransform,
- extrude3D.zTransform};
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- glm::mat4 flatScale = glm::scale(glm::vec3(xyScale, xyScale, xyScale));
- m_Model = m_ScrollMoveMatrix * m_GlobalScaleMatrix * aTranslationMatrix * extrude3D.rotation * flatScale;
- if(!mbPickingMode)
- {
- glm::mat3 normalMatrix(m_Model);
- glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
- glUniformMatrix4fv(maResources.m_3DModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix3fv(maResources.m_3DNormalMatrixID, 1, GL_FALSE, &normalInverseTranspos[0][0]);
- }
- else
- {
- glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model;
- glUniformMatrix4fv(maPickingResources.m_ModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]);
- glUniform4fv(maPickingResources.m_2DColorID, 1, &extrude3D.id[0]);
- }
-
- glDrawElements(GL_TRIANGLES, extrude3D.size[surIndex], GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(extrude3D.startIndex[surIndex]));
-}
-
-void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D)
-{
- float xyScale = extrude3D.xScale;
- float zScale = extrude3D.zScale;
- float actualZTrans = zScale - m_RoundBarMesh.bottomThreshold * xyScale;
- PosVecf3 trans = {extrude3D.xTransform,
- extrude3D.yTransform,
- extrude3D.zTransform};
- //PosVecf3 angle = {0.0f, 0.0f, 0.0f};
- if (actualZTrans < 0.0f)
- {
- // the height of rounded corner is higher than the cube than use the org scale matrix
- // yScale /= (float)(1 + BOTTOM_THRESHOLD);
- zScale /= m_RoundBarMesh.bottomThreshold;
- PosVecf3 scale = {xyScale, xyScale, zScale};
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- glm::mat4 aScaleMatrix = glm::scale(glm::vec3(scale.x, scale.y, scale.z));
- m_Model = aTranslationMatrix * extrude3D.rotation * aScaleMatrix;
- }
- else
- {
- glm::mat4 topTrans = glm::translate(glm::vec3(0.0, 0.0, actualZTrans));
- glm::mat4 topScale = glm::scale(glm::vec3(xyScale, xyScale, xyScale));
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- m_Model = aTranslationMatrix * extrude3D.rotation * topTrans * topScale;
- }
- m_Model = m_ScrollMoveMatrix * m_GlobalScaleMatrix * m_Model;
- if(!mbPickingMode)
- {
- glm::mat3 normalMatrix(m_Model);
- glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
- glUniformMatrix4fv(maResources.m_3DModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix3fv(maResources.m_3DNormalMatrixID, 1, GL_FALSE, &normalInverseTranspos[0][0]);
- }
- else
- {
- glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model;
- glUniformMatrix4fv(maPickingResources.m_ModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]);
- glUniform4fv(maPickingResources.m_2DColorID, 1, &extrude3D.id[0]);
- }
- glDrawElements(GL_TRIANGLES, extrude3D.size[BOTTOM_SURFACE], GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(extrude3D.startIndex[BOTTOM_SURFACE]));
-}
-
-void OpenGL3DRenderer::RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D)
-{
- float xyScale = extrude3D.xScale;
- float zScale = extrude3D.zScale;
- float actualZScale = zScale - m_RoundBarMesh.bottomThreshold * xyScale;
- PosVecf3 trans = {extrude3D.xTransform,
- extrude3D.yTransform,
- extrude3D.zTransform};
- if (actualZScale < 0.0f)
- {
- // the height of rounded corner is higher than the cube than use the org scale matrix
- // yScale /= (float)(1 + BOTTOM_THRESHOLD);
- // PosVecf3 scale = {xzScale, yScale, xzScale};
- // MoveModelf(trans, angle, scale);
- return ;
- }
- else
- {
- glm::mat4 scale = glm::scale(glm::vec3(xyScale, xyScale,actualZScale));
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- m_Model = aTranslationMatrix * extrude3D.rotation * scale;
- }
-
- if (extrude3D.reverse)
- {
- glm::mat4 reverseMatrix = glm::translate(glm::vec3(0.0, 0.0, -1.0));
- m_Model = m_Model * reverseMatrix;
- }
- m_Model = m_ScrollMoveMatrix * m_GlobalScaleMatrix * m_Model;
- if(!mbPickingMode)
- {
- glm::mat3 normalMatrix(m_Model);
- glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
- glUniformMatrix4fv(maResources.m_3DModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix3fv(maResources.m_3DNormalMatrixID, 1, GL_FALSE, &normalInverseTranspos[0][0]);
- }
- else
- {
- glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model;
- glUniformMatrix4fv(maPickingResources.m_ModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]);
- glUniform4fv(maPickingResources.m_2DColorID, 1, &extrude3D.id[0]);
- }
- glDrawElements(GL_TRIANGLES, extrude3D.size[MIDDLE_SURFACE], GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(extrude3D.startIndex[MIDDLE_SURFACE]));
-}
-
-void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
-{
- float xyScale = extrude3D.xScale;
- float zScale = extrude3D.zScale;
- float actualZTrans = zScale - m_RoundBarMesh.bottomThreshold * xyScale;
- PosVecf3 trans = {extrude3D.xTransform,
- extrude3D.yTransform,
- extrude3D.zTransform};
- if (actualZTrans < 0.0f)
- {
- // the height of rounded corner is higher than the cube than use the org scale matrix
- //yScale /= (float)(1 + BOTTOM_THRESHOLD);
- zScale /= m_RoundBarMesh.bottomThreshold;
- glm::mat4 orgTrans = glm::translate(glm::vec3(0.0, 0.0, -1.0));
- glm::mat4 scale = glm::scale(glm::vec3(xyScale, xyScale, zScale));
- //MoveModelf(trans, angle, scale);
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- m_Model = aTranslationMatrix * extrude3D.rotation * scale * orgTrans;
- }
- else
- {
- // use different matrices for different parts
- glm::mat4 orgTrans = glm::translate(glm::vec3(0.0, 0.0, -1.0));
- glm::mat4 topTrans = glm::translate(glm::vec3(0.0, 0.0, actualZTrans));
- glm::mat4 topScale = glm::scale(glm::vec3(xyScale, xyScale, xyScale));
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- m_Model = aTranslationMatrix * extrude3D.rotation * topTrans * topScale * orgTrans;
- }
- m_Model = m_ScrollMoveMatrix * m_GlobalScaleMatrix * m_Model;
- if(!mbPickingMode)
- {
- glm::mat3 normalMatrix(m_Model);
- glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
- glUniformMatrix4fv(maResources.m_3DModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix3fv(maResources.m_3DNormalMatrixID, 1, GL_FALSE, &normalInverseTranspos[0][0]);
- }
- else
- {
- glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model;
- glUniformMatrix4fv(maPickingResources.m_ModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]);
- glUniform4fv(maPickingResources.m_2DColorID, 1, &extrude3D.id[0]);
- }
- glDrawElements(GL_TRIANGLES, extrude3D.size[TOP_SURFACE], GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(extrude3D.startIndex[TOP_SURFACE]));
-}
-
-void OpenGL3DRenderer::RenderNonRoundedBar(const Extrude3DInfo& extrude3D)
-{
- float xScale = extrude3D.xScale;
- float yScale = extrude3D.yScale;
- float zScale = extrude3D.zScale;
- glm::mat4 transformMatrix = glm::translate(glm::vec3(extrude3D.xTransform, extrude3D.yTransform, extrude3D.zTransform));
- glm::mat4 scaleMatrix = glm::scale(glm::vec3(xScale, yScale, zScale));
- m_Model = transformMatrix * extrude3D.rotation * scaleMatrix;
- if (extrude3D.reverse)
- {
- glm::mat4 reverseMatrix = glm::translate(glm::vec3(0.0, 0.0, -1.0));
- m_Model = m_Model * reverseMatrix;
- }
- m_Model = m_ScrollMoveMatrix * m_GlobalScaleMatrix * m_Model;
- if(!mbPickingMode)
- {
- glm::mat3 normalMatrix(m_Model);
- glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
- glUniformMatrix4fv(maResources.m_3DModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix3fv(maResources.m_3DNormalMatrixID, 1, GL_FALSE, &normalInverseTranspos[0][0]);
- }
- else
- {
- glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model;
- glUniformMatrix4fv(maPickingResources.m_ModelID, 1, GL_FALSE, &m_Model[0][0]);
- glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]);
- glUniform4fv(maPickingResources.m_2DColorID, 1, &extrude3D.id[0]);
- }
- glDrawArrays(GL_TRIANGLES, 0, 36);
-}
-
-void OpenGL3DRenderer::RenderExtrudeSurface(const Extrude3DInfo& extrude3D)
-{
- RenderExtrudeMiddleSurface(extrude3D);
- // check reverse flag to decide whether to render the top middle
- if (extrude3D.reverse)
- {
- RenderExtrudeBottomSurface(extrude3D);
- RenderExtrudeFlatSurface(extrude3D, FLAT_TOP_SURFACE);
- }
- else
- {
- RenderExtrudeTopSurface(extrude3D);
- RenderExtrudeFlatSurface(extrude3D, FLAT_BOTTOM_SURFACE);
- }
-}
-void OpenGL3DRenderer::ReleaseExtrude3DShapes()
-{
- m_Extrude3DList.clear();
-}
-
-void OpenGL3DRenderer::RenderExtrude3DObject()
-{
- CHECK_GL_ERROR();
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_CULL_FACE);
- glCullFace(GL_BACK);
- CHECK_GL_ERROR();
- if(mbPickingMode)
- {
- glUseProgram(maPickingResources.m_CommonProID);
- glUniform1fv(maPickingResources.m_MinCoordXID, 1, &m_fMinCoordX);
- glUniform1fv(maPickingResources.m_MaxCoordXID, 1, &m_fMaxCoordX);
- }
- else
- {
- glUseProgram(maResources.m_3DProID);
- glUniformMatrix4fv(maResources.m_3DViewID, 1, GL_FALSE, &m_3DView[0][0]);
- glUniformMatrix4fv(maResources.m_3DProjectionID, 1, GL_FALSE, &m_3DProjection[0][0]);
- CHECK_GL_ERROR();
- if (maResources.m_b330Support)
- {
- //update ubo
- Update3DUniformBlock();
- CHECK_GL_ERROR();
- }
- else
- {
- glUniform1fv(maResources.m_3DMinCoordXID, 1, &m_fMinCoordX);
- glUniform1fv(maResources.m_3DMaxCoordXID, 1, &m_fMaxCoordX);
- glUniform1i(maResources.m_3DUndrawID, m_bUndrawFlag);
- //update light information
- glUniform4fv(maResources.m_3DLightColorID, m_iLightNum, reinterpret_cast<GLfloat*>(m_LightColor));
- glUniform4fv(maResources.m_3DLightPosID, m_iLightNum, reinterpret_cast<GLfloat*>(m_PositionWorldspace));
- glUniform1fv(maResources.m_3DLightPowerID, m_iLightNum, m_fLightPower);
- glUniform1i(maResources.m_3DLightNumID, m_iLightNum);
- glUniform4fv(maResources.m_3DLightAmbientID, 1, &m_Ambient[0]);
- CHECK_GL_ERROR();
- }
- }
- size_t extrude3DNum = m_Extrude3DList.size();
- for (size_t i = 0; i < extrude3DNum; i++)
- {
- Extrude3DInfo extrude3DInfo = m_Extrude3DList[i];
- GLuint vertexBuf = extrude3DInfo.rounded ? m_CubeVertexBuf : m_BoundBox;
- GLuint normalBuf = extrude3DInfo.rounded ? m_CubeNormalBuf : m_BoundBoxNormal;
-
- if(mbPickingMode)
- glUniform4fv(maPickingResources.m_2DColorID, 1, &extrude3DInfo.id[0]);
- // 1st attribute buffer : vertices
-
- GLint aVertexID = mbPickingMode ? maPickingResources.m_2DVertexID : maResources.m_3DVertexID;
- glEnableVertexAttribArray(aVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, vertexBuf);
- glVertexAttribPointer(aVertexID, // attribute
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
-
- if(!mbPickingMode)
- {
- // 2nd attribute buffer : normals
- glEnableVertexAttribArray(maResources.m_3DNormalID);
- glBindBuffer(GL_ARRAY_BUFFER, normalBuf);
- glVertexAttribPointer(maResources.m_3DNormalID, // attribute
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- }
- if(!mbPickingMode)
- {
- if (maResources.m_b330Support)
- {
- glBindBuffer(GL_UNIFORM_BUFFER, m_3DUBOBuffer);
- glBufferSubData(GL_UNIFORM_BUFFER, m_3DActualSizeLight, sizeof(MaterialParameters), &extrude3DInfo.material);
- CHECK_GL_ERROR();
- glBindBuffer(GL_UNIFORM_BUFFER, 0);
- }
- else
- {
- //update material information
- glUniform4fv(maResources.m_3DMaterialAmbientID, 1, &extrude3DInfo.material.ambient[0]);
- glUniform4fv(maResources.m_3DMaterialDiffuseID, 1, &extrude3DInfo.material.diffuse[0]);
- glUniform4fv(maResources.m_3DMaterialSpecularID, 1, &extrude3DInfo.material.specular[0]);
- glUniform4fv(maResources.m_3DMaterialColorID, 1, &extrude3DInfo.material.materialColor[0]);
- glUniform1i(maResources.m_3DMaterialTwoSidesID, extrude3DInfo.material.twoSidesLighting);
- glUniform1f(maResources.m_3DMaterialShininessID, extrude3DInfo.material.shininess);
- }
- }
- extrude3DInfo.reverse = 0;
- if (extrude3DInfo.rounded)
- {
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_CubeElementBuf);
- RenderExtrudeSurface(extrude3DInfo);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- }
- else
- {
- RenderNonRoundedBar(extrude3DInfo);
- }
- glDisableVertexAttribArray(aVertexID);
- if(!mbPickingMode)
- glDisableVertexAttribArray(maResources.m_3DNormalID);
- }
- glUseProgram(0);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- glDisable(GL_CULL_FACE);
-}
-
-void OpenGL3DRenderer::CreateScreenTextTexture(
- const boost::shared_array<sal_uInt8> &bitmapBuf,
- const ::Size& rSizePixels, const glm::vec2& vTopLeft,
- const glm::vec2& vBottomRight, const glm::vec3& vPos,
- const glm::vec4& vScreenTextColor, sal_uInt32 nUniqueId)
-{
- long bmpWidth = rSizePixels.Width();
- long bmpHeight = rSizePixels.Height();
-
- TextInfo aTextInfo;
- aTextInfo.id = getColorAsVector(Color(nUniqueId));
- aTextInfo.uniqueId = nUniqueId;
- aTextInfo.vertex[0] = vBottomRight.x;
- aTextInfo.vertex[1] = vBottomRight.y;
- aTextInfo.vertex[2] = 0;
-
- aTextInfo.vertex[3] = vBottomRight.x;
- aTextInfo.vertex[4] = vTopLeft.y;
- aTextInfo.vertex[5] = 0;
-
- aTextInfo.vertex[6] = vTopLeft.x;
- aTextInfo.vertex[7] = vTopLeft.y;
- aTextInfo.vertex[8] = 0;
-
- aTextInfo.vertex[9] = vTopLeft.x;
- aTextInfo.vertex[10] = vBottomRight.y;
- aTextInfo.vertex[11] = 0;
- aTextInfo.pos = vPos;
- aTextInfo.textColor = vScreenTextColor;
-
- CHECK_GL_ERROR();
- glGenTextures(1, &aTextInfo.texture);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, aTextInfo.texture);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- CHECK_GL_ERROR();
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bmpWidth, bmpHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapBuf.get());
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, 0);
- CHECK_GL_ERROR();
- m_ScreenTextInfoList.push_back(aTextInfo);
- m_ScreenTexturelist.push_back(aTextInfo.texture);
-}
-
-void OpenGL3DRenderer::CreateTextTextureSingle(const boost::shared_array<sal_uInt8> &bitmapBuf,
- const ::Size& rSizePixels,
- const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
- const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
- sal_uInt32 nUniqueId)
-{
- long bmpWidth = rSizePixels.Width();
- long bmpHeight = rSizePixels.Height();
-
- TextInfo aTextInfo;
- aTextInfo.id = getColorAsVector(Color(nUniqueId));
- aTextInfo.vertex[0] = vBottomRight.x;
- aTextInfo.vertex[1] = vBottomRight.y;
- aTextInfo.vertex[2] = vBottomRight.z;
-
- aTextInfo.vertex[3] = vTopRight.x;
- aTextInfo.vertex[4] = vTopRight.y;
- aTextInfo.vertex[5] = vTopRight.z;
-
- aTextInfo.vertex[9] = vBottomLeft.x;
- aTextInfo.vertex[10] = vBottomLeft.y;
- aTextInfo.vertex[11] = vBottomLeft.z;
-
- aTextInfo.vertex[6] = vTopLeft.x;
- aTextInfo.vertex[7] = vTopLeft.y;
- aTextInfo.vertex[8] = vTopLeft.z;
-
- CHECK_GL_ERROR();
- glGenTextures(1, &aTextInfo.texture);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, aTextInfo.texture);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- CHECK_GL_ERROR();
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bmpWidth, bmpHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapBuf.get());
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, 0);
- CHECK_GL_ERROR();
- m_TextInfoList.push_back(aTextInfo);
- m_Texturelist.push_back(aTextInfo.texture);
-
-}
-
-void OpenGL3DRenderer::CreateTextTextureBatch(const boost::shared_array<sal_uInt8> &bitmapBuf,
- const ::Size& rSizePixels,
- const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
- const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
- sal_uInt32 nUniqueId)
-{
- long bmpWidth = rSizePixels.Width();
- long bmpHeight = rSizePixels.Height();
- glm::vec4 id = getColorAsVector(Color(nUniqueId));
- m_TextInfoBatch.idList.push_back(id);
- m_TextInfoBatch.vertexList.emplace_back(vBottomRight.x, vBottomRight.y, vBottomRight.z);
- m_TextInfoBatch.vertexList.emplace_back(vTopRight.x, vTopRight.y, vTopRight.z);
- m_TextInfoBatch.vertexList.emplace_back(vTopLeft.x, vTopLeft.y, vTopLeft.z);
- m_TextInfoBatch.vertexList.emplace_back(vBottomLeft.x, vBottomLeft.y, vBottomLeft.z);
- //find the last vector, which size is small than default batch number;
- size_t index = 0;
- while ((m_TextInfoBatch.texture.size() > 0) &&
- (m_TextInfoBatch.texture[index].subTextureNum >= m_TextInfoBatch.batchNum) &&
- (index < m_TextInfoBatch.texture.size() - 1))
- {
- index++;
- }
- //if the sub texture number of the last texture array reach the largest, create a new textur array
- if (m_TextInfoBatch.texture.empty() ||
- (m_TextInfoBatch.texture[index].subTextureNum >= m_TextInfoBatch.batchNum))
- {
- TextureArrayInfo textureArray;
- glGenTextures(1, &textureArray.textureID);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D_ARRAY, textureArray.textureID);
- glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- CHECK_GL_ERROR();
- textureArray.textureArrayWidth = bmpHeight * 8;
- textureArray.textureArrayHeight = bmpHeight;
- glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, textureArray.textureArrayWidth, textureArray.textureArrayHeight,
- m_TextInfoBatch.batchNum, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
- CHECK_GL_ERROR();
- if (m_TextInfoBatch.texture.size() > 0)
- {
- index++;
- }
- m_TextInfoBatch.texture.push_back(textureArray);
- glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
- }
- glBindTexture(GL_TEXTURE_2D_ARRAY, m_TextInfoBatch.texture[index].textureID);
- CHECK_GL_ERROR();
- glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, m_TextInfoBatch.texture[index].subTextureNum, bmpWidth, bmpHeight, 1, GL_RGB, GL_UNSIGNED_BYTE, bitmapBuf.get());
- CHECK_GL_ERROR();
- //calc texture coordinate
- m_TextInfoBatch.textureCoordList.emplace_back(static_cast<float>(bmpWidth) / static_cast<float>(m_TextInfoBatch.texture[index].textureArrayWidth),
- 0,
- m_TextInfoBatch.texture[index].subTextureNum);
- m_TextInfoBatch.textureCoordList.emplace_back(static_cast<float>(bmpWidth) / static_cast<float>(m_TextInfoBatch.texture[index].textureArrayWidth),
- static_cast<float>(bmpHeight)/ static_cast<float>(m_TextInfoBatch.texture[index].textureArrayHeight),
- m_TextInfoBatch.texture[index].subTextureNum);
- m_TextInfoBatch.textureCoordList.emplace_back(0,
- static_cast<float>(bmpHeight)/ static_cast<float>(m_TextInfoBatch.texture[index].textureArrayHeight),
- m_TextInfoBatch.texture[index].subTextureNum);
- m_TextInfoBatch.textureCoordList.emplace_back(0,
- 0,
- m_TextInfoBatch.texture[index].subTextureNum);
- m_TextInfoBatch.texture[index].subTextureNum++;
- glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
-}
-
-void OpenGL3DRenderer::CreateTextTexture(const boost::shared_array<sal_uInt8> &bitmapBuf,
- const ::Size& rSizePixels,
- const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
- const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
- sal_uInt32 nUniqueId)
-{
- if (maResources.mbTexBatchSupport)
- {
- CreateTextTextureBatch(bitmapBuf, rSizePixels, vTopLeft, vTopRight, vBottomRight, vBottomLeft, nUniqueId);
- }
- else
- {
- CreateTextTextureSingle(bitmapBuf, rSizePixels, vTopLeft, vTopRight, vBottomRight, vBottomLeft, nUniqueId);
- }
-}
-
-void OpenGL3DRenderer::ReleaseTextShapes()
-{
- m_TextInfoList.clear();
-}
-
-void OpenGL3DRenderer::ReleaseTextTexture()
-{
- for (unsigned int & i : m_Texturelist)
- {
- glDeleteTextures(1, &i);
- }
- m_Texturelist.clear();
-}
-
-void OpenGL3DRenderer::ReleaseScreenTextShapes()
-{
- m_ScreenTextInfoList.clear();
-}
-
-void OpenGL3DRenderer::ReleaseScreenTextTexture()
-{
- for (unsigned int & i : m_ScreenTexturelist)
- {
- glDeleteTextures(1, &i);
- }
- m_ScreenTexturelist.clear();
-}
-
-
-void OpenGL3DRenderer::RenderScreenTextShape()
-{
- if (mbPickingMode)
- return;
- glUseProgram(maResources.m_ScreenTextProID);
- CHECK_GL_ERROR();
- for (TextInfo & textInfo : m_ScreenTextInfoList)
- {
- //calc the position and check whether it can be displayed
- if (textInfo.uniqueId)
- {
- glm::vec3 worldPos = glm::vec3(m_ScrollMoveMatrix * m_GlobalScaleMatrix * glm::vec4(textInfo.pos, 1));
- if ((worldPos.x < m_fMinCoordX) || (worldPos.x > m_fMaxCoordX))
- continue;
- glm::vec4 pos = m_3DProjection * m_3DView * glm::vec4(worldPos, 1);
- const float xTrans = pos.x / pos.w;
- const float yTrans = pos.y / pos.w;
- for (int j = 0; j < 12; j++)
- {
- if (j % 3 == 0)
- {
- textInfo.vertex[j] += xTrans;
- }
- if (j % 3 == 1)
- {
- textInfo.vertex[j] += yTrans;
- }
- }
- }
- glUniform4fv(maResources.m_ScreenTextColorID, 1, &textInfo.textColor[0]);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, sizeof(textInfo.vertex), textInfo.vertex, GL_STATIC_DRAW);
- CHECK_GL_ERROR();
-
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(maResources.m_ScreenTextVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- maResources.m_ScreenTextVertexID,
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //tex coord
- CHECK_GL_ERROR();
- glEnableVertexAttribArray(maResources.m_ScreenTextTexCoordID);
- glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBuf);
- glVertexAttribPointer(
- maResources.m_ScreenTextTexCoordID,
- 2, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //texture
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, textInfo.texture);
- CHECK_GL_ERROR();
- glUniform1i(maResources.m_ScreenTextTexID, 0);
- CHECK_GL_ERROR();
- //TODO: moggi: get rid fo GL_QUADS
- glDrawArrays(GL_QUADS, 0, 4);
- CHECK_GL_ERROR();
- }
- glDisableVertexAttribArray(maResources.m_ScreenTextTexCoordID);
- CHECK_GL_ERROR();
- glDisableVertexAttribArray(maResources.m_ScreenTextVertexID);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, 0);
- glUseProgram(0);
- CHECK_GL_ERROR();
-}
-void OpenGL3DRenderer::ReleaseTextShapesBatch()
-{
- for (TextureArrayInfo & i : m_TextInfoBatch.texture)
- {
- i.subTextureNum = 0;
- }
- m_TextInfoBatch.vertexList.clear();
- m_TextInfoBatch.textureCoordList.clear();
- m_TextInfoBatch.idList.clear();
-}
-
-void OpenGL3DRenderer::RenderTextShapeBatch()
-{
- glm::mat4 aMVP = m_3DProjection * m_3DView * m_GlobalScaleMatrix;
- glUseProgram(maResources.m_BatchTextProID);
- CHECK_GL_ERROR();
- glUniformMatrix4fv(maResources.m_BatchTextMatrixID, 1, GL_FALSE, &aMVP[0][0]);
- glEnableVertexAttribArray(maResources.m_BatchTextVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- maResources.m_BatchTextVertexID,
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //tex coord
- CHECK_GL_ERROR();
- glEnableVertexAttribArray(maResources.m_BatchTextTexCoordID);
- glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBufBatch);
- CHECK_GL_ERROR();
- glVertexAttribPointer(
- maResources.m_BatchTextTexCoordID,
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //use texture array to get the vertex
- for (size_t i = 0; i < m_TextInfoBatch.texture.size(); i++)
- {
- int vertexNum = m_TextInfoBatch.texture[i].subTextureNum;
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, 4 * vertexNum * sizeof(glm::vec3), &m_TextInfoBatch.vertexList[4 * i * m_TextInfoBatch.batchNum], GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBufBatch);
- CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, 4 * vertexNum * sizeof(glm::vec3), &m_TextInfoBatch.textureCoordList[4 * i * m_TextInfoBatch.batchNum], GL_STATIC_DRAW);
- glBindTexture(GL_TEXTURE_2D_ARRAY, m_TextInfoBatch.texture[i].textureID);
- CHECK_GL_ERROR();
- glUniform1i(maResources.m_BatchTextTexID, 0);
- CHECK_GL_ERROR();
- //TODO: moggi: get rid fo GL_QUADS
- glDrawArrays(GL_QUADS, 0, 4 * vertexNum);
- }
- glDisableVertexAttribArray(maResources.m_BatchTextVertexID);
- CHECK_GL_ERROR();
- glDisableVertexAttribArray(maResources.m_BatchTextTexCoordID);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
- CHECK_GL_ERROR();
- glUseProgram(0);
-}
-void OpenGL3DRenderer::RenderTextShape()
-{
- CHECK_GL_ERROR();
- for (TextInfo & textInfo : m_TextInfoList)
- {
- PosVecf3 const trans = {0, 0, 0};
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {1.0, 1.0, 1.0f};
- MoveModelf(trans, angle, scale);
- m_Model = m_GlobalScaleMatrix * m_Model;
- glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model;
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, sizeof(textInfo.vertex), textInfo.vertex, GL_STATIC_DRAW);
- CHECK_GL_ERROR();
- glUseProgram(maResources.m_TextProID);
-
- CHECK_GL_ERROR();
- glUniformMatrix4fv(maResources.m_TextMatrixID, 1, GL_FALSE, &aMVP[0][0]);
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(maResources.m_TextVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- maResources.m_TextVertexID,
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //tex coord
- CHECK_GL_ERROR();
- glEnableVertexAttribArray(maResources.m_TextTexCoordID);
- glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBuf);
- glVertexAttribPointer(
- maResources.m_TextTexCoordID,
- 2, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //texture
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, textInfo.texture);
- CHECK_GL_ERROR();
- glUniform1i(maResources.m_TextTexID, 0);
- CHECK_GL_ERROR();
- //TODO: moggi: get rid fo GL_QUADS
- glDrawArrays(GL_QUADS, 0, 4);
- CHECK_GL_ERROR();
- glDisableVertexAttribArray(maResources.m_TextTexCoordID);
- CHECK_GL_ERROR();
- glDisableVertexAttribArray(maResources.m_TextVertexID);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, 0);
- glUseProgram(0);
- }
- CHECK_GL_ERROR();
-}
-
-void OpenGL3DRenderer::CreateSceneBoxView()
-{
- m_CameraInfo.cameraPos = glm::vec3(m_GlobalScaleMatrix * glm::vec4(m_CameraInfo.cameraPos, 1.0));
- m_CameraInfo.cameraOrg = glm::vec3(m_GlobalScaleMatrix * glm::vec4(m_CameraInfo.cameraOrg, 1.0));
- m_3DView = glm::lookAt(m_CameraInfo.cameraPos,
- m_CameraInfo.cameraOrg,
- m_CameraInfo.cameraUp);
- m_3DView = m_3DView + m_matDiff;
-}
-
-void OpenGL3DRenderer::AddMatrixDiff(const glm::mat4& aMat)
-{
- m_matDiff = m_matDiff + aMat;
-}
-
-void OpenGL3DRenderer::ResetMatrixDiff()
-{
- m_matDiff = glm::mat4(0.0);
-}
-
-void OpenGL3DRenderer::ClearBuffer()
-{
- CHECK_GL_ERROR();
- glDisable(GL_DEPTH_TEST);
- CHECK_GL_ERROR();
-
-#if defined(IOS) || defined(ANDROID)
- glClearDepthf(1.0f);
-#else
- glClearDepth(1.0f);
-#endif
- CHECK_GL_ERROR();
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- CHECK_GL_ERROR();
-
- /*
- * TODO: moggi: use a shader!!!
- glBegin (GL_QUADS);
- glColor3f (0.3f, 0.3f, 0.3f);
- glVertex3f (-1.0f, -1.0f, -1.0f);
- glVertex3f (1.0f, -1.0f, -1.0f);
-
- glColor3f (0.0f, 0.0f, 0.0f);
- glVertex3f (1.0f, 1.0f, -1.0f);
- glVertex3f (-1.0f, 1.0f, -1.0f);
- glEnd ();
- */
-
- glEnable(GL_DEPTH_TEST);
- CHECK_GL_ERROR();
-}
-
-void OpenGL3DRenderer::ProcessUnrenderedShape(bool bNewScene)
-{
- glViewport(0, 0, m_iWidth, m_iHeight);
- CHECK_GL_ERROR();
- ClearBuffer();
- CHECK_GL_ERROR();
- CreateSceneBoxView();
- CHECK_GL_ERROR();
- CalcScrollMoveMatrix(bNewScene);
- //Polygon
- CHECK_GL_ERROR();
- RenderPolygon3DObject();
- //Shape3DExtrudeObject
- if(mbPickingMode)
- RenderExtrude3DObject();
- else
- {
- if (maResources.m_b330Support)
- {
- RenderBatchBars(bNewScene);
- }
- else
- {
- RenderExtrude3DObject();
- }
- }
- //render text
- if (maResources.mbTexBatchSupport)
- {
- RenderTextShapeBatch();
- }
- else
- {
- RenderTextShape();
- }
- // render screen text
- RenderScreenTextShape();
-#if DEBUG_FBO
- OUString aFileName = OUString("D://shaderout_") + OUString::number(m_iWidth) + "_" + OUString::number(m_iHeight) + ".png";
- OpenGLHelper::renderToFile(m_iWidth, m_iHeight, aFileName);
-#endif
-}
-
-void OpenGL3DRenderer::MoveModelf(const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale)
-{
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- glm::mat4 aScaleMatrix = glm::scale(glm::vec3(scale.x, scale.y, scale.z));
- glm::mat4 aRotationMatrix = glm::eulerAngleYXZ(angle.y, angle.x, angle.z);
- m_Model = aTranslationMatrix * aRotationMatrix * aScaleMatrix;
-}
-
-void OpenGL3DRenderer::SetPickingMode(bool bPickingMode)
-{
- mbPickingMode = bPickingMode;
- if(mbPickingMode)
- {
- glBindFramebuffer(GL_FRAMEBUFFER, mnPickingFbo);
- glDisable(GL_MULTISAMPLE);
- }
- else
- {
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glEnable(GL_MULTISAMPLE);
- }
-}
-
-Color OpenGL3DRenderer::GetPixelColorFromPoint(long nX, long nY)
-{
-// OUString aFileName = "/home/moggi/work/picking_" + OUString::number(nId++) + ".png";
-// OpenGLHelper::renderToFile(m_iWidth, m_iHeight, aFileName);
- std::unique_ptr<sal_uInt8[]> buf(new sal_uInt8[4]);
- glReadPixels(nX, m_iHeight-nY, 1, 1, GL_BGRA, GL_UNSIGNED_BYTE, buf.get());
- Color aColor(255-buf[3], buf[2], buf[1], buf[0]);
- return aColor;
-}
-
-void OpenGL3DRenderer::ReleaseBatchBarInfo()
-{
- for (BatchBarInfo & i : m_BarSurface)
- {
- i.modelMatrixList.clear();
- i.normalMatrixList.clear();
- i.colorList.clear();
- i.mapId2Color.clear();
- }
-}
-
-void OpenGL3DRenderer::ReleaseShapes()
-{
- ReleasePolygonShapes();
- ReleaseExtrude3DShapes();
- ReleaseTextShapes();
- //ReleaseScreenTextShapes();
- ReleaseBatchBarInfo();
- ReleaseTextShapesBatch();
-}
-
-void OpenGL3DRenderer::GetBatchMiddleInfo(const Extrude3DInfo &extrude3D)
-{
- float xyScale = extrude3D.xScale;
- float zScale = extrude3D.zScale;
- float actualZScale = zScale - m_RoundBarMesh.bottomThreshold * xyScale;
- PosVecf3 trans = {extrude3D.xTransform,
- extrude3D.yTransform,
- extrude3D.zTransform};
- if (actualZScale < 0.0f)
- {
- return ;
- }
- else
- {
- glm::mat4 scale = glm::scale(glm::vec3(xyScale, xyScale,actualZScale));
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- m_Model = aTranslationMatrix * extrude3D.rotation * scale;
- }
-
- m_Model = m_GlobalScaleMatrix * m_Model;
- glm::mat3 normalMatrix(m_Model);
- glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
- m_BarSurface[MIDDLE_SURFACE].modelMatrixList.push_back(m_Model);
- m_BarSurface[MIDDLE_SURFACE].normalMatrixList.push_back(normalInverseTranspos);
- m_BarSurface[MIDDLE_SURFACE].colorList.push_back(extrude3D.material.materialColor);
- m_BarSurface[MIDDLE_SURFACE].mapId2Color[extrude3D.orgID] = m_BarSurface[MIDDLE_SURFACE].colorList.size() - 1;
-}
-
-void OpenGL3DRenderer::GetBatchTopAndFlatInfo(const Extrude3DInfo &extrude3D)
-{
- float xyScale = extrude3D.xScale;
- float zScale = extrude3D.zScale;
- float actualZTrans = zScale - m_RoundBarMesh.bottomThreshold * xyScale;
- PosVecf3 trans = {extrude3D.xTransform,
- extrude3D.yTransform,
- extrude3D.zTransform};
- glm::mat4 orgTrans = glm::translate(glm::vec3(0.0, 0.0, -1.0));
- if (actualZTrans < 0.0f)
- {
- // the height of rounded corner is higher than the cube than use the org scale matrix
- //yScale /= (float)(1 + BOTTOM_THRESHOLD);
- zScale /= m_RoundBarMesh.bottomThreshold;
- glm::mat4 scale = glm::scale(glm::vec3(xyScale, xyScale, zScale));
- //MoveModelf(trans, angle, scale);
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- m_Model = aTranslationMatrix * extrude3D.rotation * scale * orgTrans;
- }
- else
- {
- // use different matrices for different parts
- glm::mat4 topTrans = glm::translate(glm::vec3(0.0, 0.0, actualZTrans));
- glm::mat4 topScale = glm::scale(glm::vec3(xyScale, xyScale, xyScale));
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- m_Model = aTranslationMatrix * extrude3D.rotation * topTrans * topScale * orgTrans;
- }
-
- m_Model = m_GlobalScaleMatrix * m_Model;
- glm::mat3 normalMatrix(m_Model);
- glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
- m_BarSurface[TOP_SURFACE].modelMatrixList.push_back(m_Model);
- m_BarSurface[TOP_SURFACE].normalMatrixList.push_back(normalInverseTranspos);
- m_BarSurface[TOP_SURFACE].colorList.push_back(extrude3D.material.materialColor);
- m_BarSurface[TOP_SURFACE].mapId2Color[extrude3D.orgID] = m_BarSurface[TOP_SURFACE].colorList.size() - 1;
-
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- glm::mat4 flatScale = glm::scale(glm::vec3(xyScale, xyScale, xyScale));
- m_Model = aTranslationMatrix * extrude3D.rotation * flatScale;
- m_Model = m_GlobalScaleMatrix * m_Model;
- normalMatrix = glm::mat3(m_Model);
- normalInverseTranspos = glm::inverseTranspose(normalMatrix);
-
- m_BarSurface[FLAT_BOTTOM_SURFACE].modelMatrixList.push_back(m_Model);
- m_BarSurface[FLAT_BOTTOM_SURFACE].normalMatrixList.push_back(normalInverseTranspos);
- m_BarSurface[FLAT_BOTTOM_SURFACE].colorList.push_back(extrude3D.material.materialColor);
- m_BarSurface[FLAT_BOTTOM_SURFACE].mapId2Color[extrude3D.orgID] = m_BarSurface[FLAT_BOTTOM_SURFACE].colorList.size() - 1;
-}
-
-void OpenGL3DRenderer::GetBatchBarsInfo()
-{
- for (Extrude3DInfo & extrude3DInfo : m_Extrude3DList)
- {
- if (m_Extrude3DInfo.rounded)
- {
- GetBatchTopAndFlatInfo(extrude3DInfo);
- GetBatchMiddleInfo(extrude3DInfo);
- }
- else
- {
- glm::mat4 transformMatrix = glm::translate(glm::vec3(extrude3DInfo.xTransform, extrude3DInfo.yTransform, extrude3DInfo.zTransform));
- glm::mat4 scaleMatrix = glm::scale(glm::vec3(extrude3DInfo.xScale, extrude3DInfo.yScale, extrude3DInfo.zScale));
- m_Model = transformMatrix * extrude3DInfo.rotation * scaleMatrix;
- m_Model = m_GlobalScaleMatrix * m_Model;
- glm::mat3 normalMatrix(m_Model);
- glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
- m_BarSurface[0].modelMatrixList.push_back(m_Model);
- m_BarSurface[0].normalMatrixList.push_back(normalInverseTranspos);
- m_BarSurface[0].colorList.push_back(extrude3DInfo.material.materialColor);
- m_BarSurface[0].mapId2Color[extrude3DInfo.orgID] = m_BarSurface[0].colorList.size() - 1;
- }
- }
-}
-
-void OpenGL3DRenderer::SetHighLightBar(BatchBarInfo &barInfo)
-{
- std::map<sal_uInt32, unsigned int> ::iterator it = barInfo.mapId2Color.find(m_uiSelectID);
- if (it != barInfo.mapId2Color.end())
- {
- unsigned int idx = it->second;
- barInfo.selectBarColor = barInfo.colorList[idx];
- barInfo.colorList[idx] = glm::vec4(1.0, 1.0, 1.0, 1.0);
- }
-}
-
-void OpenGL3DRenderer::DisableHighLightBar(BatchBarInfo &barInfo)
-{
- std::map<sal_uInt32, unsigned int> ::iterator it = barInfo.mapId2Color.find(m_uiSelectID);
- if (it != barInfo.mapId2Color.end())
- {
- unsigned int idx = it->second;
- barInfo.colorList[idx] = barInfo.selectBarColor;
- }
-}
-
-void OpenGL3DRenderer::StartClick(sal_uInt32 selectID)
-{
- m_bHighLighting = true;
- m_uiSelectID = selectID;
- for (BatchBarInfo & i : m_BarSurface)
- {
- SetHighLightBar(i);
- }
-}
-
-void OpenGL3DRenderer::EndClick()
-{
- m_bHighLighting = false;
- for (BatchBarInfo & i : m_BarSurface)
- {
- DisableHighLightBar(i);
- }
-}
-
-void OpenGL3DRenderer::SetScroll()
-{
- maResources.m_bScrollFlag = true;
-}
-
-void OpenGL3DRenderer::SetScrollSpeed(float scrollSpeed)
-{
- m_fScrollSpeed = scrollSpeed;
-}
-void OpenGL3DRenderer::SetScrollDistance(float scrollDistance)
-{
- m_fScrollDistance = scrollDistance;
-}
-
-void OpenGL3DRenderer::SetSceneEdge(float minCoordX, float maxCoordX)
-{
- m_fMinCoordX = minCoordX * 0.01;
- m_fMaxCoordX = maxCoordX * 0.01;
-}
-
-void OpenGL3DRenderer::CalcScrollMoveMatrix(bool bNewScene)
-{
- if (!maResources.m_bScrollFlag)
- return;
- if (bNewScene)
- m_fCurDistance = -m_fScrollSpeed;
- m_fCurDistance += m_fCurDistance >= m_fScrollDistance ? 0.0f : m_fScrollSpeed;
- m_ScrollMoveMatrix = glm::translate(glm::vec3(-m_fCurDistance * 0.01, 0.0f, 0.0f));
- m_bUndrawFlag = m_fCurDistance >= m_fScrollDistance;
-}
-
-glm::mat4 OpenGL3DRenderer::GetDiffOfTwoCameras(const glm::vec3& rBeginPos, const glm::vec3& rEndPos, const glm::vec3& rBeginDirection, const glm::vec3& rEndDirection)
-{
- glm::mat4 aBegin = glm::lookAt(glm::vec3(m_GlobalScaleMatrix * glm::vec4(rBeginPos, 1.0)),
- glm::vec3(m_GlobalScaleMatrix * glm::vec4(rBeginDirection, 1.0)),
- glm::vec3(0, 0, 1));
- glm::mat4 aEnd = glm::lookAt(glm::vec3(m_GlobalScaleMatrix * glm::vec4(rEndPos, 1.0)),
- glm::vec3(m_GlobalScaleMatrix * glm::vec4(rEndDirection, 1.0)),
- glm::vec3(0, 0, 1));
- return aEnd - aBegin;
-}
-
-glm::mat4 OpenGL3DRenderer::GetDiffOfTwoCameras(const glm::vec3& rEndPos, const glm::vec3& rEndDirection)
-{
- glm::mat4 aEnd = glm::lookAt(glm::vec3(m_GlobalScaleMatrix * glm::vec4(rEndPos, 1.0)),
- glm::vec3(m_GlobalScaleMatrix * glm::vec4(rEndDirection, 1.0)),glm::vec3(0, 0, 1));
- return aEnd - m_3DView;
-}
-
-const glm::mat4& OpenGL3DRenderer::GetProjectionMatrix()
-{
- return m_3DProjection;
-}
-
-const glm::mat4& OpenGL3DRenderer::GetViewMatrix()
-{
- return m_3DView;
-}
-
-const glm::mat4& OpenGL3DRenderer::GetGlobalScaleMatrix()
-{
- return m_GlobalScaleMatrix;
-}
-
-void OpenGL3DRenderer::RenderBatchBars(bool bNewScene)
-{
- if (m_BarSurface[0].modelMatrixList.empty())
- return;
-
- if(bNewScene)
- {
- GetBatchBarsInfo();
- if (m_bHighLighting)
- {
- for (BatchBarInfo & i : m_BarSurface)
- {
- SetHighLightBar(i);
- }
- }
- }
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_CULL_FACE);
- glCullFace(GL_BACK);
- glPolygonOffset(0.0f, 0.0f);
- glUseProgram(maResources.m_3DBatchProID);
- UpdateBatch3DUniformBlock();
- glBindBuffer(GL_UNIFORM_BUFFER, m_Batch3DUBOBuffer);
- glBufferSubData(GL_UNIFORM_BUFFER, m_Batch3DActualSizeLight, sizeof(MaterialParameters), &m_Batchmaterial);
- CHECK_GL_ERROR();
- glBindBuffer(GL_UNIFORM_BUFFER, 0);
- if (maResources.m_bScrollFlag)
- {
- glUniform1fv(maResources.m_3DBatchMinCoordXID, 1, &m_fMinCoordX);
- glUniform1fv(maResources.m_3DBatchMaxCoordXID, 1, &m_fMaxCoordX);
- glUniform1i(maResources.m_3DBatchUndrawID, m_bUndrawFlag);
- glUniformMatrix4fv(maResources.m_3DBatchTransMatrixID, 1, GL_FALSE, &m_ScrollMoveMatrix[0][0]);
- }
- glUniformMatrix4fv(maResources.m_3DBatchViewID, 1, GL_FALSE, &m_3DView[0][0]);
- glUniformMatrix4fv(maResources.m_3DBatchProjectionID, 1, GL_FALSE, &m_3DProjection[0][0]);
- CHECK_GL_ERROR();
- GLuint vertexBuf = m_Extrude3DInfo.rounded ? m_CubeVertexBuf : m_BoundBox;
- GLuint normalBuf = m_Extrude3DInfo.rounded ? m_CubeNormalBuf : m_BoundBoxNormal;
- //vertex
- glEnableVertexAttribArray(maResources.m_3DBatchVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, vertexBuf);
- glVertexAttribPointer(maResources.m_3DBatchVertexID, // attribute
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //normal
- glEnableVertexAttribArray(maResources.m_3DBatchNormalID);
- glBindBuffer(GL_ARRAY_BUFFER, normalBuf);
- glVertexAttribPointer(maResources.m_3DBatchNormalID, // attribute
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
-
- for (unsigned int i = 0; i < 4 ; i++)
- {
- glEnableVertexAttribArray(maResources.m_3DBatchModelID + i);
- glBindBuffer(GL_ARRAY_BUFFER, m_BatchModelMatrixBuf);
- glVertexAttribPointer(maResources.m_3DBatchModelID + i, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4), reinterpret_cast<GLvoid*>(sizeof(GLfloat) * i * 4));
- glVertexAttribDivisor(maResources.m_3DBatchModelID + i, 1);
- }
-
- for (unsigned int i = 0; i < 3 ; i++)
- {
- glEnableVertexAttribArray(maResources.m_3DBatchNormalMatrixID + i);
- glBindBuffer(GL_ARRAY_BUFFER, m_BatchNormalMatrixBuf);
- glVertexAttribPointer(maResources.m_3DBatchNormalMatrixID + i, 3, GL_FLOAT, GL_FALSE, sizeof(glm::mat3), reinterpret_cast<GLvoid*>(sizeof(GLfloat) * i * 3));
- glVertexAttribDivisor(maResources.m_3DBatchNormalMatrixID + i, 1);
- }
- glEnableVertexAttribArray(maResources.m_3DBatchColorID);
- glBindBuffer(GL_ARRAY_BUFFER, m_BatchColorBuf);
- glVertexAttribPointer(maResources.m_3DBatchColorID , 4, GL_FLOAT, GL_FALSE, sizeof(glm::vec4), nullptr);
- glVertexAttribDivisor(maResources.m_3DBatchColorID, 1);
- if (m_Extrude3DInfo.rounded)
- {
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_CubeElementBuf);
- for (int i = 0; i < 2; i++)
- {
- glBindBuffer(GL_ARRAY_BUFFER, m_BatchModelMatrixBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(glm::mat4) * m_BarSurface[i].modelMatrixList.size(), &m_BarSurface[i].modelMatrixList[0][0], GL_DYNAMIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, m_BatchNormalMatrixBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(glm::mat3) * m_BarSurface[i].normalMatrixList.size(), &m_BarSurface[i].normalMatrixList[0][0], GL_DYNAMIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, m_BatchColorBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec4) * m_BarSurface[i].colorList.size(), &m_BarSurface[i].colorList[0], GL_DYNAMIC_DRAW);
- glDrawElementsInstancedBaseVertex(GL_TRIANGLES,
- m_Extrude3DInfo.size[i],
- GL_UNSIGNED_SHORT,
- reinterpret_cast<GLvoid*>(m_Extrude3DInfo.startIndex[i]),
- m_BarSurface[i].modelMatrixList.size(),
- 0);
- }
- }
- else
- {
- glBindBuffer(GL_ARRAY_BUFFER, m_BatchModelMatrixBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(glm::mat4) * m_BarSurface[0].modelMatrixList.size(), &m_BarSurface[0].modelMatrixList[0][0], GL_DYNAMIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, m_BatchNormalMatrixBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(glm::mat3) * m_BarSurface[0].normalMatrixList.size(), &m_BarSurface[0].normalMatrixList[0][0], GL_DYNAMIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, m_BatchColorBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec4) * m_BarSurface[0].colorList.size(), &m_BarSurface[0].colorList[0], GL_DYNAMIC_DRAW);
- glDrawArraysInstanced(GL_TRIANGLES, 0, 36, m_BarSurface[0].modelMatrixList.size());
- }
- glDisableVertexAttribArray(maResources.m_3DBatchVertexID);
- glDisableVertexAttribArray(maResources.m_3DBatchNormalID);
- glDisableVertexAttribArray(maResources.m_3DBatchColorID);
- glVertexAttribDivisor(maResources.m_3DBatchColorID, 0);
- for (unsigned int i = 0; i < 4 ; i++)
- {
- glDisableVertexAttribArray(maResources.m_3DBatchModelID + i);
- glVertexAttribDivisor(maResources.m_3DBatchModelID + i, 0);
- }
- for (unsigned int i = 0; i < 3 ; i++)
- {
- glDisableVertexAttribArray(maResources.m_3DBatchNormalMatrixID + i);
- glVertexAttribDivisor(maResources.m_3DBatchNormalMatrixID + i, 0);
- }
- glUseProgram(0);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- glDisable(GL_CULL_FACE);
-}
-}
-}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
deleted file mode 100644
index f461bb80f290..000000000000
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ /dev/null
@@ -1,1024 +0,0 @@
-/* -*- 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/.
- */
-
-#include <epoxy/gl.h>
-#include <cmath>
-#include <vector>
-#include "OpenGLRender.hxx"
-#include <vcl/graph.hxx>
-#include <com/sun/star/awt/XBitmap.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/drawing/CircleKind.hpp>
-#include <com/sun/star/drawing/DoubleSequence.hpp>
-#include <com/sun/star/drawing/FlagSequence.hpp>
-#include <com/sun/star/drawing/FillStyle.hpp>
-#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/drawing/NormalsKind.hpp>
-#include <com/sun/star/drawing/PointSequence.hpp>
-#include <com/sun/star/drawing/PolygonKind.hpp>
-#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
-#include <com/sun/star/drawing/ProjectionMode.hpp>
-#include <com/sun/star/drawing/ShadeMode.hpp>
-#include <com/sun/star/drawing/TextFitToSizeType.hpp>
-#include <com/sun/star/drawing/TextureProjectionMode.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <editeng/unoprnms.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/dibtools.hxx>
-#include <vcl/svapp.hxx>
-#include <sal/log.hxx>
-
-#include <vcl/opengl/OpenGLHelper.hxx>
-
-#include <CommonConverters.hxx>
-
-using namespace com::sun::star;
-
-#define DEBUG_PNG 0
-
-#if DEBUG_PNG
-#include <vcl/pngwrite.hxx>
-#endif
-
-#define GL_PI 3.14159f
-
-#define Z_STEP 0.001f
-
-static GLfloat squareVertices[] = {
- -1.0f, -1.0f, -1.0,
- 1.0f, -1.0f, -1.0,
- 1.0f, 1.0f, -1.0,
- -1.0f, 1.0f, -1.0
-};
-
-static GLfloat coordReverseVertices[] = {
- 0.0f, 1.0f,
- 1.0f, 1.0f,
- 1.0f, 0.0f,
- 0.0f, 0.0f,
-};
-
-#define CHECK_GL_FRAME_BUFFER_STATUS() \
- GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\
- if( status != GL_FRAMEBUFFER_COMPLETE ) {\
- SAL_WARN("chart2.opengl", "OpenGL error: " << status );\
- return -1;\
- }
-
-namespace {
-
-GLfloat texCoords[] = {
- 0.0f, 0.0f,
- 1.0f, 0.0f,
- 1.0f, 1.0f,
- 0.0f, 1.0f
-};
-
-}
-
-int OpenGLRender::InitOpenGL()
-{
- glEnable(GL_TEXTURE_2D);
- glDisable(GL_CULL_FACE);
- glCullFace(GL_BACK);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- // Enable depth test
- glEnable(GL_DEPTH_TEST);
- // Accept fragment if it closer to the camera than the former one
- glDepthFunc(GL_LESS);
- glEnable(GL_POINT_SMOOTH);
- glEnable(GL_LINE_SMOOTH);
- glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
- glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
- glClearColor (1.0, 1.0, 1.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- glClearDepth(1.0f);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glGenBuffers(1, &m_VertexBuffer);
- glGenBuffers(1, &m_ColorBuffer);
-
- CHECK_GL_ERROR();
-
- m_CommonProID = OpenGLHelper::LoadShaders("commonVertexShader", "commonFragmentShader");
- m_MatrixID = glGetUniformLocation(m_CommonProID, "MVP");
- m_2DVertexID = glGetAttribLocation(m_CommonProID, "vPosition");
- m_2DColorID = glGetUniformLocation(m_CommonProID, "vColor");
- CHECK_GL_ERROR();
-
-#if DEBUG_POSITIONING
- m_DebugProID = OpenGLHelper::LoadShaders("debugVertexShader", "debugFragmentShader");
- m_DebugVertexID = glGetAttribLocation(m_DebugProID, "vPosition");
- CHECK_GL_ERROR();
-#endif
-
- m_BackgroundProID = OpenGLHelper::LoadShaders("backgroundVertexShader", "backgroundFragmentShader");
- m_BackgroundMatrixID = glGetUniformLocation(m_BackgroundProID, "MVP");
- m_BackgroundVertexID = glGetAttribLocation(m_BackgroundProID, "vPosition");
- m_BackgroundColorID = glGetAttribLocation(m_BackgroundProID, "vColor");
-
- CHECK_GL_ERROR();
-
- m_SymbolProID = OpenGLHelper::LoadShaders("symbolVertexShader", "symbolFragmentShader");
- m_SymbolVertexID = glGetAttribLocation(m_SymbolProID, "vPosition");
- m_SymbolMatrixID = glGetUniformLocation(m_SymbolProID, "MVP");
- m_SymbolColorID = glGetUniformLocation(m_SymbolProID, "vColor");
- m_SymbolShapeID = glGetUniformLocation(m_SymbolProID, "shape");
-
- CHECK_GL_ERROR();
-
- m_TextProID = OpenGLHelper::LoadShaders("textVertexShader", "textFragmentShader");
- m_TextMatrixID = glGetUniformLocation(m_TextProID, "MVP");
- m_TextVertexID = glGetAttribLocation(m_TextProID, "vPosition");
- m_TextTexCoordID = glGetAttribLocation(m_TextProID, "texCoord");
- m_TextTexID = glGetUniformLocation(m_TextProID, "TextTex");
- CHECK_GL_ERROR();
-
- glGenBuffers(1, &m_RenderVertexBuf);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderVertexBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(squareVertices), squareVertices, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- glGenBuffers(1, &m_RenderTexCoordBuf);
- glBindBuffer(GL_ARRAY_BUFFER, m_RenderTexCoordBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(coordReverseVertices), coordReverseVertices, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- glGenBuffers(1, &m_TextTexCoordBuf);
- glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBuf);
- glBufferData(GL_ARRAY_BUFFER, sizeof(texCoords), texCoords, GL_STATIC_DRAW);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
-
- glEnable(GL_LIGHTING);
- GLfloat const light_direction[] = { 0.0 , 0.0 , 1.0 };
- GLfloat const materialDiffuse[] = { 1.0 , 1.0 , 1.0 , 1.0};
- glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, light_direction);
- glMaterialfv(GL_FRONT,GL_DIFFUSE,materialDiffuse);
- glEnable(GL_LIGHT0);
- glEnable(GL_NORMALIZE);
-
- return 0;
-}
-
-void OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
-{
- if (m_Line2DPointList.empty())
- {
- m_Line2DPointList.reserve(listLength*3);
- }
- m_Line2DPointList.push_back(x);
- m_Line2DPointList.push_back(y);
- m_Line2DPointList.push_back(m_fZStep);
-
- if (m_Line2DPointList.size() == size_t(listLength * 3))
- {
- m_Line2DShapePointList.push_back(m_Line2DPointList);
- m_Line2DPointList.clear();
- }
-}
-
-int OpenGLRender::RenderLine2FBO()
-{
- CHECK_GL_ERROR();
- glLineWidth(m_fLineWidth);
- PosVecf3 const trans = {0.0f, 0.0f, 0.0f};
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {1.0f, 1.0f, 1.0f};
- MoveModelf(trans, angle, scale);
- m_MVP = m_Projection * m_View * m_Model;
- for (auto const& pointList : m_Line2DShapePointList)
- {
- //fill vertex buffer
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, pointList.size() * sizeof(float), &pointList[0], GL_STATIC_DRAW);
- CHECK_GL_ERROR();
- // Use our shader
- glUseProgram(m_CommonProID);
- CHECK_GL_ERROR();
-
- glUniform4fv(m_2DColorID, 1, &m_2DColor[0]);
- CHECK_GL_ERROR();
- glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]);
- //CHECK_GL_ERROR();
-
- // 1rst attribute buffer : vertices
- CHECK_GL_ERROR();
- glVertexAttribPointer(
- m_2DVertexID,
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- glEnableVertexAttribArray(m_2DVertexID);
- glDrawArrays(GL_LINE_STRIP, 0, pointList.size()/3); // 12*3 indices starting at 0 -> 12 triangles
- CHECK_GL_ERROR();
- glUseProgram(0);
- glDisableVertexAttribArray(m_2DVertexID);
- CHECK_GL_ERROR();
- }
- m_Line2DShapePointList.clear();
- CHECK_GL_ERROR();
- CHECK_GL_FRAME_BUFFER_STATUS();
- m_fZStep += Z_STEP;
- return 0;
-}
-
-#if DEBUG_POSITIONING
-void OpenGLRender::renderDebug()
-{
- CHECK_GL_ERROR();
-
- GLfloat vertices[4][3] = {
- {-0.9, -0.9, 0 },
- {-0.6, -0.2, 0 },
- {0.3, 0.3, 0 },
- {0.9, 0.9, 0 } };
-
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
- CHECK_GL_ERROR();
- glUseProgram(m_DebugProID);
- CHECK_GL_ERROR();
- glVertexAttribPointer(m_DebugVertexID, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
- CHECK_GL_ERROR();
- glEnableVertexAttribArray(m_DebugVertexID);
-
- glDrawArrays(GL_LINE_STRIP, 0, 3);
- CHECK_GL_ERROR();
- glDisableVertexAttribArray(m_DebugVertexID);
-
- CHECK_GL_ERROR();
-}
-#endif
-
-void OpenGLRender::prepareToRender()
-{
- glViewport(0, 0, m_iWidth, m_iHeight);
-
- // Clear the screen
- glClearDepth(1.0f);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- m_fZStep = 0;
-}
-
-void OpenGLRender::MoveModelf(const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale)
-{
- glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
- glm::mat4 aScaleMatrix = glm::scale(glm::vec3(scale.x, scale.y, scale.z));
- glm::mat4 aRotationMatrix = glm::eulerAngleYXZ(angle.y, angle.x, angle.z);
- m_Model = aTranslationMatrix * aRotationMatrix * aScaleMatrix;
-}
-
-void OpenGLRender::Release()
-{
- glDeleteBuffers(1, &m_VertexBuffer);
- glDeleteBuffers(1, &m_ColorBuffer);
- glDeleteBuffers(1, &m_TextTexCoordBuf);
- glDeleteProgram(m_CommonProID);
- glDeleteProgram(m_TextProID);
- glDeleteProgram(m_BackgroundProID);
- glDeleteProgram(m_SymbolProID);
-}
-
-OpenGLRender::OpenGLRender()
- : m_iWidth(1600)
- , m_iHeight(900)
- , m_Model(glm::mat4(1.0f))
- , m_VertexBuffer(0)
- , m_ColorBuffer(0)
- , m_MatrixID(0)
- , m_RenderVertexBuf(0)
- , m_RenderTexCoordBuf(0)
- , m_fLineWidth(0.001f)
- , m_2DColor(glm::vec4(1.0, 0.0, 0.0, 1.0))
- , m_CommonProID(0)
- , m_2DVertexID(0)
- , m_2DColorID(0)
- , m_fZStep(0)
- , m_TextProID(0)
- , m_TextMatrixID(0)
- , m_TextVertexID(0)
- , m_TextTexCoordID(0)
- , m_TextTexCoordBuf(0)
- , m_TextTexID(0)
- , m_BackgroundProID(0)
- , m_BackgroundMatrixID(0)
- , m_BackgroundVertexID(0)
- , m_BackgroundColorID(0)
- , m_SymbolProID(0)
- , m_SymbolVertexID(0)
- , m_SymbolMatrixID(0)
- , m_SymbolColorID(0)
- , m_SymbolShapeID(0)
-{
- //TODO: moggi: use STL
- for (float & i : m_BackgroundColor)
- {
- i = 1.0;
- }
-}
-
-OpenGLRender::~OpenGLRender()
-{
- Release();
-}
-
-// TODO: moggi: that screws up FBO if called after buffers have been created!!!!
-void OpenGLRender::SetSize(int width, int height)
-{
- m_iWidth = width;
- m_iHeight = height;
-}
-
-void OpenGLRender::SetSizePixel(int width, int height)
-{
- m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -4.f, 3.f);
- m_Projection = m_Projection * glm::scale(glm::vec3(static_cast<float>(width) / m_iWidth, -static_cast<float>(height) / m_iHeight, 1.0f));
-
- m_View = glm::lookAt(glm::vec3(0,m_iHeight,1),
- glm::vec3(0,m_iHeight,0),
- glm::vec3(0,1,0) );
-}
-
-void OpenGLRender::SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uInt8 nAlpha)
-{
- m_2DColor = glm::vec4(static_cast<float>(r) / 255.0f, static_cast<float>(g) / 255.0f, static_cast<float>(b) / 255.0f, nAlpha/255.f);
-}
-
-void OpenGLRender::SetLine2DWidth(int width)
-{
- m_fLineWidth = std::max(static_cast<float>(width), 0.001f);
-}
-
-void OpenGLRender::SetColor(sal_uInt32 color, sal_uInt8 nAlpha)
-{
- sal_uInt8 r = (color & 0x00FF0000) >> 16;
- sal_uInt8 g = (color & 0x0000FF00) >> 8;
- sal_uInt8 b = (color & 0x000000FF);
- m_2DColor = glm::vec4(static_cast<float>(r) / 255.0f, static_cast<float>(g) / 255.0f, static_cast<float>(b) / 255.0f, nAlpha/ 255.f);
-}
-
-int OpenGLRender::Create2DCircle(int detail)
-{
- float angle;
- if (detail <= 0)
- {
- return -1;
- }
- m_Bubble2DCircle.clear();
- m_Bubble2DCircle.reserve(2 * (detail + 3));
- m_Bubble2DCircle.push_back(0);
- m_Bubble2DCircle.push_back(0);
- for(angle = 2.0f * GL_PI; angle > -(2.0f * GL_PI / detail); angle -= (2.0f * GL_PI / detail))
- {
- m_Bubble2DCircle.push_back(std::sin(angle));
- m_Bubble2DCircle.push_back(std::cos(angle));
- }
- return 0;
-}
-
-void OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float directionY)
-{
- //check whether to create the circle data
- if (m_Bubble2DCircle.empty())
- {
- Create2DCircle(100);
- }
-
- Bubble2DPointList aBubble2DPointList;
- aBubble2DPointList.xScale = directionX;
- aBubble2DPointList.yScale = directionY;
- aBubble2DPointList.x = x + aBubble2DPointList.xScale / 2;
- aBubble2DPointList.y = y + aBubble2DPointList.yScale / 2;
-
- m_Bubble2DShapePointList.push_back(aBubble2DPointList);
-}
-
-int OpenGLRender::RenderBubble2FBO()
-{
- CHECK_GL_ERROR();
- glm::vec4 edgeColor = glm::vec4(0.0, 0.0, 0.0, 1.0);
- for (auto const& pointList : m_Bubble2DShapePointList)
- {
- //move the circle to the pos, and scale using the xScale and Y scale
- PosVecf3 const trans = {pointList.x, pointList.y, m_fZStep};
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {pointList.xScale / 2, pointList.yScale / 2 , 1.0f};
- MoveModelf(trans, angle, scale);
- m_MVP = m_Projection * m_View * m_Model;
- //render to fbo
- //fill vertex buffer
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- if (m_Bubble2DCircle.empty())
- {
- Create2DCircle(100);
- }
- glBufferData(GL_ARRAY_BUFFER, m_Bubble2DCircle.size() * sizeof(GLfloat), &m_Bubble2DCircle[0], GL_STATIC_DRAW);
-
- glUseProgram(m_CommonProID);
-
- glUniform4fv(m_2DColorID, 1, &m_2DColor[0]);
-
- glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]);
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(m_2DVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- m_2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 2, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- glDrawArrays(GL_TRIANGLE_FAN, 0, m_Bubble2DCircle.size() / 2);
- glDisableVertexAttribArray(m_2DVertexID);
- glUseProgram(0);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- //add black edge
- glLineWidth(3.0);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glBufferData(GL_ARRAY_BUFFER, m_Bubble2DCircle.size() * sizeof(GLfloat) -2 , &m_Bubble2DCircle[2], GL_STATIC_DRAW);
- glUseProgram(m_CommonProID);
- glUniform4fv(m_2DColorID, 1, &edgeColor[0]);
- glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]);
- glEnableVertexAttribArray(m_2DVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- m_2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 2, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- glDrawArrays(GL_LINE_STRIP, 0, (m_Bubble2DCircle.size() * sizeof(GLfloat) -2) / sizeof(float) / 2);
- glDisableVertexAttribArray(m_2DVertexID);
- glUseProgram(0);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- glLineWidth(m_fLineWidth);
- }
- m_Bubble2DShapePointList.clear();
- //if use MSAA, we should copy the data to the FBO texture
- GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER);
- if( fbResult != GL_FRAMEBUFFER_COMPLETE )
- {
- SAL_WARN("chart2.opengl", "error");
- return -1;
- }
- CHECK_GL_ERROR();
- m_fZStep += Z_STEP;
- return 0;
-}
-
-void OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float directionY)
-{
- RectanglePointList aRectangle;
-
- aRectangle.points[0] = x;
- aRectangle.points[1] = y;
- aRectangle.points[2] = m_fZStep;
- aRectangle.points[3] = x + directionX;
- aRectangle.points[4] = y;
- aRectangle.points[5] = m_fZStep;
- aRectangle.points[6] = x + directionX;
- aRectangle.points[7] = y + directionY;
- aRectangle.points[8] = m_fZStep;
- aRectangle.points[9] = x;
- aRectangle.points[10] = y + directionY;
- aRectangle.points[11] = m_fZStep;
-
- m_RectangleShapePointList.push_back(aRectangle);
-}
-
-void OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill)
-{
- for (auto const& pointList : m_RectangleShapePointList)
- {
- //move the circle to the pos, and scale using the xScale and Y scale
- {
- PosVecf3 const trans = {0, 0, 0};
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {1, 1, 1.0f};
- MoveModelf(trans, angle, scale);
- m_MVP = m_Projection * m_View * m_Model;
- }
-
- //render to fbo
- //fill vertex buffer
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glBufferData(GL_ARRAY_BUFFER, sizeof(pointList.points), pointList.points, GL_STATIC_DRAW);
-
- glBindBuffer(GL_ARRAY_BUFFER, m_ColorBuffer);
- glBufferData(GL_ARRAY_BUFFER, sizeof(m_BackgroundColor), m_BackgroundColor, GL_STATIC_DRAW);
- glUseProgram(m_BackgroundProID);
-
- glUniformMatrix4fv(m_BackgroundMatrixID, 1, GL_FALSE, &m_MVP[0][0]);
- if(bFill)
- {
- glEnableVertexAttribArray(m_BackgroundVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- m_BackgroundVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
-
- // 2nd attribute buffer : color
- glEnableVertexAttribArray(m_BackgroundColorID);
- glBindBuffer(GL_ARRAY_BUFFER, m_ColorBuffer);
- glVertexAttribPointer(
- m_BackgroundColorID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 4, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //TODO: moggi: get rid of GL_QUADS
- glDrawArrays(GL_QUADS, 0, 4);
- glDisableVertexAttribArray(m_BackgroundVertexID);
- glDisableVertexAttribArray(m_BackgroundColorID);
- }
- if(bBorder)
- {
- if(bFill)
- {
- PosVecf3 const trans = {0.0, 0.0, Z_STEP };
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {1, 1, 1.0f};
- MoveModelf(trans, angle, scale);
- m_MVP = m_Projection * m_View * m_Model;
-
- m_fZStep += Z_STEP;
- glUniformMatrix4fv(m_BackgroundMatrixID, 1, GL_FALSE, &m_MVP[0][0]);
- }
- SetBackGroundColor(COL_BLACK, COL_BLACK, css::drawing::FillStyle_SOLID);
-
- glBindBuffer(GL_ARRAY_BUFFER, m_ColorBuffer);
- glBufferData(GL_ARRAY_BUFFER, sizeof(m_BackgroundColor), m_BackgroundColor, GL_STATIC_DRAW);
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(m_BackgroundVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- m_BackgroundVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
-
- // 2nd attribute buffer : color
- glEnableVertexAttribArray(m_BackgroundColorID);
- glBindBuffer(GL_ARRAY_BUFFER, m_ColorBuffer);
- glVertexAttribPointer(
- m_BackgroundColorID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 4, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- glDrawArrays(GL_LINE_LOOP, 0, 4);
- glDisableVertexAttribArray(m_BackgroundVertexID);
- glDisableVertexAttribArray(m_BackgroundColorID);
- }
- glDisableVertexAttribArray(m_BackgroundVertexID);
- glDisableVertexAttribArray(m_BackgroundColorID);
- glUseProgram(0);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- }
- m_RectangleShapePointList.clear();
- CHECK_GL_ERROR();
-
- m_fZStep += Z_STEP;
-}
-
-
-int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Size& aSize, long rotation,
- const drawing::HomogenMatrix3& rTrans)
-{
-#if DEBUG_PNG // debug PNG writing
- static int nIdx = 0;
- OUString aName = OUString( "file:///home/moggi/Documents/work/text" ) + OUString::number( nIdx++ ) + ".png";
- try {
- vcl::PNGWriter aWriter( rBitmapEx );
- SvFileStream sOutput( aName, StreamMode::WRITE );
- aWriter.Write( sOutput );
- sOutput.Close();
- } catch (...) {
- SAL_WARN("chart2.opengl", "Error writing png to " << aName);
- }
-#endif
-
- boost::shared_array<sal_uInt8> bitmapBuf(new sal_uInt8[4 * rBitmapEx.GetSizePixel().Width() * rBitmapEx.GetSizePixel().Height()]);
-
- OpenGLHelper::ConvertBitmapExToRGBATextureBuffer(rBitmapEx, bitmapBuf.get());
-
- CreateTextTexture(bitmapBuf, rBitmapEx.GetSizePixel(),
- aSize, rotation, rTrans);
- return 0;
-}
-
-void OpenGLRender::CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixels,
- const ::Size &aPixelSize,
- const awt::Size& aSize,
- long rotation,
- const drawing::HomogenMatrix3& rTrans)
-{
- long bmpWidth = aPixelSize.Width();
- long bmpHeight = aPixelSize.Height();
-
- TextInfo aTextInfo;
- aTextInfo.rotation = -static_cast<double>(rotation) / 360.0 * 2* GL_PI;
- aTextInfo.vertex[0] = -aSize.Width / 2;
- aTextInfo.vertex[1] = -aSize.Height / 2;
- aTextInfo.vertex[2] = m_fZStep;
-
- aTextInfo.vertex[3] = aSize.Width / 2;
- aTextInfo.vertex[4] = -aSize.Height / 2;
- aTextInfo.vertex[5] = m_fZStep;
-
- aTextInfo.vertex[6] = aSize.Width / 2;
- aTextInfo.vertex[7] = aSize.Height / 2;
- aTextInfo.vertex[8] = m_fZStep;
-
- aTextInfo.vertex[9] = -aSize.Width / 2;
- aTextInfo.vertex[10] = aSize.Height / 2;
- aTextInfo.vertex[11] = m_fZStep;
- aTextInfo.nDx = (rTrans.Line1.Column3 + aSize.Width / 2 ) - bmpWidth/2;
- aTextInfo.nDy = (rTrans.Line2.Column3 + aSize.Height / 2 ) - bmpHeight/2;
-
- CHECK_GL_ERROR();
- glGenTextures(1, &aTextInfo.texture);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, aTextInfo.texture);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- CHECK_GL_ERROR();
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bmpWidth, bmpHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, rPixels.get());
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, 0);
- CHECK_GL_ERROR();
- m_TextInfoVector.push_back(aTextInfo);
-}
-
-void OpenGLRender::RenderTextShape()
-{
- CHECK_GL_ERROR();
- for (auto const& textInfo : m_TextInfoVector)
- {
- PosVecf3 const trans = { textInfo.nDx, textInfo.nDy, 0};
- PosVecf3 const angle = {0.0f, 0.0f, float(textInfo.rotation)};
- PosVecf3 const scale = {1.0, 1.0, 1.0f};
- MoveModelf(trans, angle, scale);
- m_MVP = m_Projection * m_View * m_Model;
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, sizeof(textInfo.vertex), textInfo.vertex, GL_STATIC_DRAW);
- CHECK_GL_ERROR();
- glUseProgram(m_TextProID);
-
- CHECK_GL_ERROR();
- glUniformMatrix4fv(m_TextMatrixID, 1, GL_FALSE, &m_MVP[0][0]);
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(m_TextVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- m_TextVertexID,
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //tex coord
- CHECK_GL_ERROR();
- glEnableVertexAttribArray(m_TextTexCoordID);
- glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBuf);
- glVertexAttribPointer(
- m_TextTexCoordID,
- 2, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- //texture
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, textInfo.texture);
- CHECK_GL_ERROR();
- glUniform1i(m_TextTexID, 0);
- CHECK_GL_ERROR();
- //TODO: moggi: get rid fo GL_QUADS
- glDrawArrays(GL_QUADS, 0, 4);
- CHECK_GL_ERROR();
- glDisableVertexAttribArray(m_TextTexCoordID);
- CHECK_GL_ERROR();
- glDisableVertexAttribArray(m_TextVertexID);
- CHECK_GL_ERROR();
- glBindTexture(GL_TEXTURE_2D, 0);
- glUseProgram(0);
- glDeleteTextures(1, &textInfo.texture);
- CHECK_GL_ERROR();
- }
- m_TextInfoVector.clear();
- CHECK_GL_ERROR();
- m_fZStep += Z_STEP;
-}
-
-void OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
-{
- if (m_Area2DPointList.empty())
- {
- m_Area2DPointList.reserve(listLength);
- }
- m_Area2DPointList.push_back(x);
- m_Area2DPointList.push_back(y);
- m_Area2DPointList.push_back(m_fZStep);
-
- if (m_Area2DPointList.size() == size_t(listLength * 3))
- {
- m_Area2DShapePointList.push_back(m_Area2DPointList);
- m_Area2DPointList.clear();
- }
-}
-
-namespace {
-
-// only 2D
-bool checkCCW(const PointList& rPoints)
-{
- if(rPoints.size() < 3)
- return true;
-
- GLfloat sum = 0;
- for(size_t i = 1; i < rPoints.size()/3; i += 3)
- {
- GLfloat x1 = rPoints[(i-1)*3];
- GLfloat x2 = rPoints[i*3];
- GLfloat y1 = rPoints[(i-1)*3 + 1];
- GLfloat y2 = rPoints[i*3 + 1];
- GLfloat prod = (x2-x1)*(y2+y1);
-
- sum += prod;
- }
-
- return (sum <= 0);
-}
-
-}
-
-void OpenGLRender::RenderArea2DShape()
-{
- CHECK_GL_ERROR();
-
- glDisable(GL_MULTISAMPLE);
- PosVecf3 const trans = {0.0f, 0.0f, 0.0f};
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {1.0f, 1.0f, 1.0f};
- MoveModelf(trans, angle, scale);
- m_MVP = m_Projection * m_View * m_Model;
- for (auto const& pointList : m_Area2DShapePointList)
- {
- bool bIsCCW = checkCCW(pointList); // is it counter clockwise (CCW) or clockwise (CW)
- if(!bIsCCW)
- glFrontFace(GL_CW);
- //fill vertex buffer
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glBufferData(GL_ARRAY_BUFFER, pointList.size() * sizeof(float), &pointList[0], GL_STATIC_DRAW);
- // Use our shader
- glUseProgram(m_CommonProID);
-
- glUniform4fv(m_2DColorID, 1, &m_2DColor[0]);
-
- glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]);
-
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(m_2DVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- m_2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- // TODO: moggi: remove deprecated GL_POLYGON
- glDrawArrays(GL_POLYGON, 0, pointList.size() / 3); // 12*3 indices starting at 0 -> 12 triangles
- glDisableVertexAttribArray(m_2DVertexID);
- glUseProgram(0);
- if(!bIsCCW)
- glFrontFace(GL_CCW);
- }
- m_Area2DShapePointList.clear();
- glEnable(GL_MULTISAMPLE);
- m_fZStep += Z_STEP;
-
- CHECK_GL_ERROR();
-}
-
-void OpenGLRender::SetBackGroundColor(::Color color1, ::Color color2, css::drawing::FillStyle fillStyle)
-{
- sal_uInt8 r = color1.GetRed();
- sal_uInt8 g = color1.GetGreen();
- sal_uInt8 b = color1.GetBlue();
-
- m_BackgroundColor[0] = static_cast<float>(r) / 255.0f;
- m_BackgroundColor[1] = static_cast<float>(g) / 255.0f;
- m_BackgroundColor[2] = static_cast<float>(b) / 255.0f;
- m_BackgroundColor[3] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0;
-
- m_BackgroundColor[4] = static_cast<float>(r) / 255.0f;
- m_BackgroundColor[5] = static_cast<float>(g) / 255.0f;
- m_BackgroundColor[6] = static_cast<float>(b) / 255.0f;
- m_BackgroundColor[7] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0;
-
- r = color2.GetRed();
- g = color2.GetGreen();
- b = color2.GetBlue();
-
- m_BackgroundColor[8] = static_cast<float>(r) / 255.0f;
- m_BackgroundColor[9] = static_cast<float>(g) / 255.0f;
- m_BackgroundColor[10] = static_cast<float>(b) / 255.0f;
- m_BackgroundColor[11] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0;
-
- m_BackgroundColor[12] = static_cast<float>(r) / 255.0f;
- m_BackgroundColor[13] = static_cast<float>(g) / 255.0f;
- m_BackgroundColor[14] = static_cast<float>(b) / 255.0f;
- m_BackgroundColor[15] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0;
- SAL_INFO("chart2.opengl", "color1 = " << sal_uInt32(color1) << ", color2 = " << sal_uInt32(color2));
-
-}
-
-void OpenGLRender::SetChartTransparencyGradient(long transparencyGradient)
-{
- if (transparencyGradient == 1)
- {
- m_BackgroundColor[11] = 0.0;
- m_BackgroundColor[15] = 0.0;
- }
-}
-
-void OpenGLRender::GeneratePieSegment2D(double fInnerRadius, double fOutterRadius, double nAngleStart, double nAngleWidth)
-{
- double nAngleStep = 1;
- PointList aPointList;
- // TODO: moggi: GL_TRIANGLE_FAN seems not to work
- const bool bInnerRadiusNotZero = true; //!rtl::math::approxEqual(0.0, fInnerRadius);
- size_t nVectorSize = 3*(nAngleWidth/nAngleStep);
- if(bInnerRadiusNotZero)
- nVectorSize *= 2;
-
- nAngleStart += 90;
- aPointList.reserve(nVectorSize);
- // if inner radius = 0 generate a normal pie segment (triangle fan)
- // if inner radius != 0 generate a pie segment - inner pie (triangle strip)
- if(!bInnerRadiusNotZero)
- {
- aPointList.push_back(0);
- aPointList.push_back(0);
- aPointList.push_back(m_fZStep);
- }
- for(double nAngle = nAngleStart; nAngle <= nAngleStart + nAngleWidth; nAngle += nAngleStep)
- {
- float xVal = sin(nAngle/360*2*GL_PI);
- float yVal = cos(nAngle/360*2*GL_PI);
- aPointList.push_back(fOutterRadius * xVal);
- aPointList.push_back(fOutterRadius * yVal);
- aPointList.push_back(m_fZStep);
-
- if(bInnerRadiusNotZero)
- {
- aPointList.push_back(fInnerRadius * xVal);
- aPointList.push_back(fInnerRadius * yVal);
- aPointList.push_back(m_fZStep);
- }
- }
-
- m_PieSegment2DShapePointList.push_back(aPointList);
-}
-
-void OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY)
-{
- int listNum = m_PieSegment2DShapePointList.size();
- PosVecf3 const trans = {fPosX, fPosY, 0.0f};
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {fSize, fSize, 1.0f};
- MoveModelf(trans, angle, scale);
- m_MVP = m_Projection * m_View * m_Model;
-
- for (int i = 0; i < listNum; i++)
- {
- PointList &pointList = m_PieSegment2DShapePointList.back();
- //fill vertex buffer
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glBufferData(GL_ARRAY_BUFFER, pointList.size() * sizeof(float), &pointList[0] , GL_STATIC_DRAW);
- // Use our shader
- glUseProgram(m_CommonProID);
-
- glUniform4fv(m_2DColorID, 1, &m_2DColor[0]);
-
- glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]);
-
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(m_2DVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- m_2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
- glDrawArrays(GL_TRIANGLE_STRIP, 0, pointList.size() / 3); // 12*3 indices starting at 0 -> 12 triangles
- glDisableVertexAttribArray(m_2DVertexID);
- glUseProgram(0);
- m_PieSegment2DShapePointList.pop_back();
- CHECK_GL_ERROR();
-
- }
- m_fZStep += Z_STEP;
-
- CHECK_GL_ERROR();
-}
-
-void OpenGLRender::RenderSymbol2DShape(float x, float y, sal_Int32 nSymbol)
-{
- CHECK_GL_ERROR();
-
- glPointSize(20.f);
- CHECK_GL_ERROR();
- PosVecf3 const trans = {0.0, 0.0, 0.0};
- PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 const scale = {1.0, 1.0, 1.0f};
- MoveModelf(trans, angle, scale);
- m_MVP = m_Projection * m_View * m_Model;
-
- float aPos[3] = { x, y, m_fZStep };
- //fill vertex buffer
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- CHECK_GL_ERROR();
- glBufferData(GL_ARRAY_BUFFER, 3 * sizeof(float), aPos, GL_STATIC_DRAW);
- CHECK_GL_ERROR();
-
- // Use our shader
- glUseProgram(m_SymbolProID);
- CHECK_GL_ERROR();
-
- glUniform4fv(m_SymbolColorID, 1, &m_2DColor[0]);
- glUniform1i(m_SymbolShapeID, nSymbol);
- CHECK_GL_ERROR();
-
- glUniformMatrix4fv(m_SymbolMatrixID, 1, GL_FALSE, &m_MVP[0][0]);
-
- CHECK_GL_ERROR();
- // 1rst attribute buffer : vertices
- glEnableVertexAttribArray(m_SymbolVertexID);
- glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glVertexAttribPointer(
- m_SymbolVertexID, // attribute. No particular reason for 0, but must match the layout in the shader.
- 3, // size
- GL_FLOAT, // type
- GL_FALSE, // normalized?
- 0, // stride
- nullptr // array buffer offset
- );
-
- glDrawArrays(GL_POINTS, 0, 1);
-
- glDisableVertexAttribArray(m_SymbolVertexID);
- CHECK_GL_ERROR();
- glUseProgram(0);
- m_fZStep += Z_STEP;
-
- CHECK_GL_ERROR();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
deleted file mode 100644
index 3b9d8700c3ce..000000000000
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ /dev/null
@@ -1,192 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_CHART2_SOURCE_VIEW_MAIN_OPENGLRENDER_HXX
-#define INCLUDED_CHART2_SOURCE_VIEW_MAIN_OPENGLRENDER_HXX
-
-#include <vcl/bitmapex.hxx>
-#include <com/sun/star/drawing/HomogenMatrix3.hpp>
-#include <com/sun/star/drawing/FillStyle.hpp>
-#include <com/sun/star/drawing/XDrawPage.hpp>
-#include <vcl/font.hxx>
-#include <vcl/opengl/OpenGLContext.hxx>
-#include <boost/shared_array.hpp>
-
-// Include GLM
-#include <vector>
-#include <map>
-#include <glm/glm.hpp>
-#include <glm/gtx/transform.hpp>
-#include <glm/gtx/euler_angles.hpp>
-#include <glm/gtx/quaternion.hpp>
-
-#define DEBUG_POSITIONING 0
-
-struct PosVecf3
-{
- float x;
- float y;
- float z;
-};
-
-struct Bubble2DPointList
-{
- float x;
- float y;
- float xScale;
- float yScale;
-};
-
-struct RectanglePointList
-{
- float points[12];
-};
-
-struct TextInfo
-{
- GLuint texture;
- double rotation;
- float vertex[12];
- float nDx;
- float nDy;
-};
-
-typedef std::vector<GLfloat> PointList;
-
-// for 3D, use vector to save the points
-
-class OpenGLRender
-{
-public:
- OpenGLRender();
- ~OpenGLRender();
- int InitOpenGL();
- void MoveModelf(const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale);
- void SetSize(int width, int height);
- void SetSizePixel(int width, int height);
- void Release();
- int RenderLine2FBO();
- void SetLine2DShapePoint(float x, float y, int listLength);
- void SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uInt8 nAlpha);
- void SetLine2DWidth(int width);
- void SetColor(sal_uInt32 color, sal_uInt8 nAlpha);
- void Bubble2DShapePoint(float x, float y, float directionX, float directionY);
- int RenderBubble2FBO();
-
- void prepareToRender();
-
- void RenderRectangleShape(bool bBorder, bool bFill);
- void RectangleShapePoint(float x, float y, float directionX, float directionY);
-
- void CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixels,
- const ::Size &aPixelSize,
- const css::awt::Size& aSize,
- long rotation,
- const css::drawing::HomogenMatrix3& rTrans);
- int CreateTextTexture(const BitmapEx& rBitmapEx,
- const css::awt::Size& aSize,
- long rotation, const css::drawing::HomogenMatrix3& rTrans);
- void RenderTextShape();
-
- void SetArea2DShapePoint(float x, float y, int listLength);
- void RenderArea2DShape();
- void SetChartTransparencyGradient(long transparencyGradient);
-
- void GeneratePieSegment2D(double, double, double, double);
- void RenderPieSegment2DShape(float, float, float);
-
- void RenderSymbol2DShape(float, float, sal_Int32);
-#if DEBUG_POSITIONING
- void renderDebug();
-#endif
-
- void SetBackGroundColor(::Color color1, ::Color color2, css::drawing::FillStyle fillstyle);
-
-private:
- int m_iWidth;
-
- int m_iHeight;
-
-private:
- int Create2DCircle(int detail);
-private:
- // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
- glm::mat4 m_Projection;
- // Camera matrix
- glm::mat4 m_View;
- // Model matrix : an identity matrix (model will be at the origin
- glm::mat4 m_Model;
- // Our ModelViewProjection : multiplication of our 3 matrices
- glm::mat4 m_MVP;
-
- GLuint m_VertexBuffer;
-
- GLuint m_ColorBuffer;
-
- GLint m_MatrixID;
-
- GLuint m_RenderVertexBuf;
-
- GLuint m_RenderTexCoordBuf;
-
- PointList m_Line2DPointList;
-
- float m_fLineWidth;
-
- std::vector<PointList> m_Line2DShapePointList;
-
- glm::vec4 m_2DColor;
-
- std::vector<GLfloat> m_Bubble2DCircle;
-
- std::vector<Bubble2DPointList> m_Bubble2DShapePointList;
- GLint m_CommonProID;
- GLint m_2DVertexID;
- GLint m_2DColorID;
-
- float m_fZStep;
-
- std::vector<RectanglePointList> m_RectangleShapePointList;
- // add for text
- std::vector<TextInfo> m_TextInfoVector;
- GLint m_TextProID;
- GLint m_TextMatrixID;
- GLint m_TextVertexID;
- GLint m_TextTexCoordID;
- GLuint m_TextTexCoordBuf;
- GLint m_TextTexID;
-
- PointList m_Area2DPointList;
- std::vector<PointList> m_Area2DShapePointList;
-
- GLint m_BackgroundProID;
- GLint m_BackgroundMatrixID;
- GLint m_BackgroundVertexID;
- GLint m_BackgroundColorID;
-
- float m_BackgroundColor[16];
-
- std::vector<PointList> m_PieSegment2DShapePointList;
-
- GLuint m_SymbolProID;
- GLuint m_SymbolVertexID;
- GLuint m_SymbolMatrixID;
- GLuint m_SymbolColorID;
- GLuint m_SymbolShapeID;
-
-#if DEBUG_POSITIONING
- GLuint m_DebugProID;
- GLuint m_DebugVertexID;
- GLuint m_DebugColorID;
-#endif
-};
-
-#endif // INCLUDED_CHART2_SOURCE_VIEW_MAIN_OPENGLRENDER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
deleted file mode 100644
index b1169292090c..000000000000
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ /dev/null
@@ -1,504 +0,0 @@
-/* -*- 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 <svx/unoshape.hxx>
-#include <OpenglShapeFactory.hxx>
-#include "DummyXShape.hxx"
-#include <ViewDefines.hxx>
-#include <Stripe.hxx>
-#include <CommonConverters.hxx>
-#include <PropertyMapper.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/drawing/CircleKind.hpp>
-#include <com/sun/star/drawing/DoubleSequence.hpp>
-#include <com/sun/star/drawing/FlagSequence.hpp>
-#include <com/sun/star/drawing/FillStyle.hpp>
-#include <com/sun/star/drawing/LineStyle.hpp>
-#include <com/sun/star/drawing/NormalsKind.hpp>
-#include <com/sun/star/drawing/PointSequence.hpp>
-#include <com/sun/star/drawing/PolygonKind.hpp>
-#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
-#include <com/sun/star/drawing/ProjectionMode.hpp>
-#include <com/sun/star/drawing/ShadeMode.hpp>
-#include <com/sun/star/drawing/TextFitToSizeType.hpp>
-#include <com/sun/star/drawing/TextureProjectionMode.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Any.hxx>
-
-#include <editeng/unoprnms.hxx>
-#include <rtl/math.hxx>
-#include <svx/svdocirc.hxx>
-#include <svx/svdopath.hxx>
-#include <vcl/openglwin.hxx>
-#include <sal/log.hxx>
-
-#include <basegfx/point/b2dpoint.hxx>
-#include <basegfx/matrix/b3dhommatrix.hxx>
-
-#include <RelativeSizeHelper.hxx>
-
-using namespace ::com::sun::star;
-
-namespace chart
-{
-
-extern "C" {
- SAL_DLLPUBLIC_EXPORT opengl::OpenglShapeFactory* getOpenglShapeFactory()
- { return new opengl::OpenglShapeFactory;}
- }
-
-using dummy::DummyCylinder;
-using dummy::DummyRectangle;
-using dummy::DummyPyramid;
-using dummy::DummyCone;
-
-namespace opengl {
-
-namespace {
-
-uno::Reference< drawing::XShapes > getChartShape(
- const uno::Reference< drawing::XDrawPage>& xDrawPage )
-{
- uno::Reference< drawing::XShapes > xRet;
- uno::Reference< drawing::XShapes > xShapes( xDrawPage, uno::UNO_QUERY );
- if( xShapes.is() )
- {
- sal_Int32 nCount = xShapes->getCount();
- uno::Reference< drawing::XShape > xShape;
- for( sal_Int32 nN = nCount; nN--; )
- {
- if( xShapes->getByIndex( nN ) >>= xShape )
- {
-
- OUString aRet;
-
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- xProp->getPropertyValue( UNO_NAME_MISC_OBJ_NAME ) >>= aRet;
- if( aRet == "com.sun.star.chart2.shapes" )
- {
- xRet = dynamic_cast<SvxDummyShapeContainer&>(*xShape.get()).getWrappedShape();
- break;
- }
- }
- }
- }
- return xRet;
-}
-
-}
-
-uno::Reference< drawing::XShapes > OpenglShapeFactory::getOrCreateChartRootShape(
- const uno::Reference< drawing::XDrawPage>& xDrawPage )
-{
- uno::Reference< drawing::XShapes > xRet( getChartShape( xDrawPage ) );
- if( !xRet.is() )
- {
- //create the root shape
- SAL_WARN("chart2.opengl", "getOrCreateChartRootShape");
-
- dummy::DummyChart *pChart = new dummy::DummyChart();
- SvxDummyShapeContainer* pContainer = new SvxDummyShapeContainer(pChart);
- pContainer->setSize(awt::Size(0,0));
- xRet = pChart;
- xDrawPage->add(pContainer);
- }
- return xRet;
-}
-
-void OpenglShapeFactory::setPageSize( uno::Reference < drawing::XShapes > xChartShapes, const awt::Size& rSize )
-{
- uno::Reference< drawing::XShape > xShape(xChartShapes, uno::UNO_QUERY_THROW);
- xShape->setSize(rSize);
-}
-
-// methods for 3D shape creation
-
-uno::Reference<drawing::XShape>
- OpenglShapeFactory::createCube(
- const uno::Reference<drawing::XShapes>& xTarget
- , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
- , sal_Int32
- , const uno::Reference< beans::XPropertySet >& xSourceProp
- , const tPropertyNameMap& rPropertyNameMap
- , bool )
-{
- dummy::DummyCube* pCube = new dummy::DummyCube(rPosition, rSize,
- xSourceProp,
- rPropertyNameMap);
- xTarget->add(pCube);
- return pCube;
-}
-
-uno::Reference<drawing::XShape>
- OpenglShapeFactory::createCylinder(
- const uno::Reference<drawing::XShapes>& xTarget
- , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
- , sal_Int32 )
-{
- dummy::DummyCylinder* pCylinder = new dummy::DummyCylinder( rPosition, rSize );
- xTarget->add(pCylinder);
- return pCylinder;
-}
-
-uno::Reference<drawing::XShape>
- OpenglShapeFactory::createPyramid(
- const uno::Reference<drawing::XShapes>& xTarget
- , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
- , double, bool
- , const uno::Reference< beans::XPropertySet >& xSourceProp
- , const tPropertyNameMap& rPropertyNameMap )
-{
- dummy::DummyPyramid* pPyramid = new dummy::DummyPyramid(rPosition, rSize,
- xSourceProp, rPropertyNameMap );
- xTarget->add(pPyramid);
- return pPyramid;
-}
-
-uno::Reference<drawing::XShape>
- OpenglShapeFactory::createCone(
- const uno::Reference<drawing::XShapes>& xTarget
- , const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
- , double, sal_Int32 )
-{
- dummy::DummyCone* pCone = new dummy::DummyCone(rPosition, rSize);
- xTarget->add(pCone);
- return pCone;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createPieSegment2D(
- const uno::Reference< drawing::XShapes >& xTarget
- , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
- , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
- , const drawing::Direction3D& rOffset
- , const drawing::HomogenMatrix& rUnitCircleToScene )
-{
- dummy::DummyPieSegment2D* pSegment = new dummy::DummyPieSegment2D(fUnitCircleStartAngleDegree,
- fUnitCircleWidthAngleDegree, fUnitCircleInnerRadius, fUnitCircleOuterRadius,
- rOffset, rUnitCircleToScene);
- xTarget->add(pSegment);
- return pSegment;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createPieSegment(
- const uno::Reference< drawing::XShapes >& xTarget
- , double, double
- , double, double
- , const drawing::Direction3D&
- , const drawing::HomogenMatrix&
- , double )
-{
- dummy::DummyPieSegment* pSegment = new dummy::DummyPieSegment;
-
- xTarget->add(pSegment);
- return pSegment;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createStripe( const uno::Reference< drawing::XShapes >& xTarget
- , const Stripe&
- , const uno::Reference< beans::XPropertySet >& xSourceProp
- , const tPropertyNameMap& rPropertyNameMap
- , bool
- , short
- , bool )
-{
- dummy::DummyStripe* pStripe = new dummy::DummyStripe(
- xSourceProp, rPropertyNameMap);
- xTarget->add(pStripe);
- return pStripe;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createArea3D( const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::PolyPolygonShape3D&
- , double )
-{
- dummy::DummyArea3D* pArea = new dummy::DummyArea3D;
- xTarget->add(pArea);
- return pArea;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createArea2D( const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::PolyPolygonShape3D& rPolyPolygon )
-{
- dummy::DummyArea2D* pArea = new dummy::DummyArea2D(PolyToPointSequence(rPolyPolygon));
- xTarget->add(pArea);
- return pArea;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createSymbol2D(
- const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::Position3D& rPosition
- , const drawing::Direction3D& rSize
- , sal_Int32 nStandardSymbol
- , sal_Int32
- , sal_Int32 nFillColor )
-{
- dummy::DummySymbol2D* pSymbol = new dummy::DummySymbol2D(rPosition, rSize,
- nStandardSymbol, nFillColor);
- xTarget->add(pSymbol);
- return pSymbol;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createGraphic2D(
- const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::Position3D& rPosition
- , const drawing::Direction3D& rSize
- , const uno::Reference< graphic::XGraphic >& )
-{
- dummy::DummyGraphic2D* pGraphic = new dummy::DummyGraphic2D(rPosition, rSize);
- xTarget->add(pGraphic);
- return pGraphic;
-}
-
-uno::Reference< drawing::XShapes >
- OpenglShapeFactory::createGroup2D( const uno::Reference< drawing::XShapes >& xTarget
- , const OUString& aName)
-{
- dummy::DummyGroup2D* pNewShape = new dummy::DummyGroup2D(aName);
- xTarget->add(pNewShape);
- return pNewShape;
-}
-
-uno::Reference< drawing::XShapes >
- OpenglShapeFactory::createGroup3D( const uno::Reference< drawing::XShapes >& xTarget
- , const OUString& aName )
-{
- dummy::DummyGroup3D* pNewShape = new dummy::DummyGroup3D(aName);
- xTarget->add(pNewShape);
- return pNewShape;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createCircle2D( const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::Position3D& rPosition
- , const drawing::Direction3D& rSize )
-{
- drawing::Position3D aCenterPosition(
- rPosition.PositionX - (rSize.DirectionX / 2.0),
- rPosition.PositionY - (rSize.DirectionY / 2.0),
- rPosition.PositionZ );
- dummy::DummyCircle* pCircle = new dummy::DummyCircle(Position3DToAWTPoint( aCenterPosition ),
- Direction3DToAWTSize( rSize ));
- xTarget->add(pCircle);
- return pCircle;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createCircle( const uno::Reference< drawing::XShapes >& xTarget
- , const awt::Size& rSize
- , const awt::Point& rPosition )
-{
- dummy::DummyCircle* pCircle = new dummy::DummyCircle(rPosition, rSize);
- xTarget->add(pCircle);
- return pCircle;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createLine3D( const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::PolyPolygonShape3D&
- , const VLineProperties& rLineProperties )
-{
- dummy::DummyLine3D* pLine = new dummy::DummyLine3D(rLineProperties);
- xTarget->add(pLine);
- return pLine;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createLine2D( const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::PointSequenceSequence& rPoints
- , const VLineProperties* pLineProperties )
-{
- dummy::DummyLine2D* pLine = new dummy::DummyLine2D(rPoints, pLineProperties);
- xTarget->add(pLine);
-
- return pLine;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createLine ( const uno::Reference< drawing::XShapes >& xTarget,
- const awt::Size& rSize, const awt::Point& rPosition )
-{
- dummy::DummyLine2D* pLine = new dummy::DummyLine2D(rSize, rPosition);
- xTarget->add(pLine);
- return pLine;
-}
-
-uno::Reference< drawing::XShape > OpenglShapeFactory::createInvisibleRectangle(
- const uno::Reference< drawing::XShapes >& xTarget
- , const awt::Size& rSize )
-{
- dummy::DummyRectangle* pRectangle = new dummy::DummyRectangle(rSize);
- pRectangle->setPropertyValue("Invisible", uno::Any(true));
- xTarget->add(pRectangle);
- return pRectangle;
-}
-
-uno::Reference< drawing::XShape > OpenglShapeFactory::createRectangle(
- const uno::Reference< drawing::XShapes >& xTarget,
- const awt::Size& rSize,
- const awt::Point& rPosition,
- const tNameSequence& rPropNames,
- const tAnySequence& rPropValues,
- StackPosition /*ePos*/ )
-{
- dummy::DummyRectangle* pRectangle = new dummy::DummyRectangle(rSize, rPosition,
- rPropNames, rPropValues);
-
- // TODO : Honor stack position.
- xTarget->add(pRectangle);
- return pRectangle;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createRectangle(
- const uno::Reference<
- drawing::XShapes >& xTarget)
-{
- dummy::DummyRectangle* pRectangle = new dummy::DummyRectangle();
- xTarget->add(pRectangle);
- return pRectangle;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget
- , const OUString& rText
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues
- , const uno::Any& rATransformation )
-{
- dummy::DummyText* pText = new dummy::DummyText( rText, rPropNames, rPropValues,
- rATransformation, xTarget, 0 );
- return pText;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget
- , const uno::Sequence< OUString >& rTextParagraphs
- , const uno::Sequence< tNameSequence >& /*rParaPropNames*/
- , const uno::Sequence< tAnySequence >& /*rParaPropValues*/
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues
- , const uno::Any& rATransformation )
-{
- dummy::DummyText* pText = new dummy::DummyText( rTextParagraphs[0], rPropNames, rPropValues,
- rATransformation, xTarget, 0 );
- return pText;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget
- , uno::Sequence< uno::Reference< chart2::XFormattedString > >& rFormattedString
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues
- , const uno::Any& rATransformation )
-{
- dummy::DummyText* pText = new dummy::DummyText( rFormattedString[0]->getString(), rPropNames, rPropValues,
- rATransformation, xTarget, 0 );
- return pText;
-}
-
-uno::Reference< drawing::XShape >
- OpenglShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget,
- const awt::Size& , const awt::Point& rPos,
- uno::Sequence< uno::Reference< chart2::XFormattedString > >& rFormattedString,
- const uno::Reference< beans::XPropertySet > & xTextProperties,
- double nRotation, const OUString& rName)
-{
- tPropertyNameValueMap aValueMap;
- //fill line-, fill- and paragraph-properties into the ValueMap
- {
- tPropertyNameMap aNameMap = PropertyMapper::getPropertyNameMapForParagraphProperties();
- auto const & add = PropertyMapper::getPropertyNameMapForFillAndLineProperties();
- aNameMap.insert(add.begin(), add.end());
-
- PropertyMapper::getValueMap( aValueMap, aNameMap, xTextProperties );
- }
-
- //fill some more shape properties into the ValueMap
- aValueMap.insert( { "TextHorizontalAdjust", uno::Any(drawing::TextHorizontalAdjust_CENTER) } );
- aValueMap.insert( { "TextVerticalAdjust", uno::Any(drawing::TextVerticalAdjust_CENTER) } );
- aValueMap.insert( { "TextAutoGrowHeight", uno::Any(true) } );
- aValueMap.insert( { "TextAutoGrowWidth", uno::Any(true) } );
-
- //set global title properties
- tNameSequence aPropNames;
- tAnySequence aPropValues;
- PropertyMapper::getMultiPropertyListsFromValueMap( aPropNames, aPropValues, aValueMap );
-
- OUString aString = rFormattedString[0]->getString();
-
- sal_Int32 nXPos = rPos.X;
- sal_Int32 nYPos = rPos.Y;
- ::basegfx::B2DHomMatrix aM;
- aM.rotate( -nRotation*F_PI/180.0 );//#i78696#->#i80521#
- aM.translate( nXPos, nYPos );
-
- dummy::DummyText* pText = new dummy::DummyText(aString, aPropNames, aPropValues,
- uno::Any(B2DHomMatrixToHomogenMatrix3(aM)), xTarget, nRotation);
- pText->setName(rName);
- return pText;
-}
-
-void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape, bool bInitOpenGL)
-{
- dummy::DummyChart& rChart = dynamic_cast<dummy::DummyChart&>(*xRootShape.get());
- if(bInitOpenGL)
- {
- rChart.invalidateInit();
- }
- rChart.render();
-}
-
-bool OpenglShapeFactory::preRender(uno::Reference< drawing::XShapes > xRootShape, OpenGLWindow* pWindow)
-{
- if(!pWindow)
- return false;
-
- pWindow->Show();
- pWindow->getContext().makeCurrent();
- Size aSize = pWindow->GetSizePixel();
- pWindow->getContext().setWinSize(aSize);
- dummy::DummyChart& rChart = dynamic_cast<dummy::DummyChart&>(*xRootShape.get());
- rChart.getRenderer().SetSizePixel(aSize.Width(), aSize.Height());
- return true;
-}
-
-void OpenglShapeFactory::postRender(OpenGLWindow* pWindow)
-{
- pWindow->getContext().swapBuffers();
-}
-
-void OpenglShapeFactory::clearPage(uno::Reference< drawing::XShapes > xRootShape)
-{
- dummy::DummyChart& rChart = dynamic_cast<dummy::DummyChart&>(*xRootShape.get());
- rChart.clear();
-}
-
-} //namespace dummy
-
-} //namespace chart
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/uiconfig/ui/tp_ChartType.ui b/chart2/uiconfig/ui/tp_ChartType.ui
index 851c12e209f2..a38a30daae4b 100644
--- a/chart2/uiconfig/ui/tp_ChartType.ui
+++ b/chart2/uiconfig/ui/tp_ChartType.ui
@@ -412,33 +412,6 @@
<property name="height">1</property>
</packing>
</child>
- <child>
- <object class="GtkGrid" id="gl3dblock">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkCheckButton" id="rounded-edge">
- <property name="label" translatable="yes" context="tp_ChartType|rounded-edge">Rounded edge</property>
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="use_underline">True</property>
- <property name="no_show_all">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/compilerplugins/clang/constantparam.booleans.results b/compilerplugins/clang/constantparam.booleans.results
index 96d9b570b2eb..9e6cfc5158e8 100644
--- a/compilerplugins/clang/constantparam.booleans.results
+++ b/compilerplugins/clang/constantparam.booleans.results
@@ -142,22 +142,6 @@ chart2/source/view/charttypes/CategoryPositionHelper.hxx:29
void chart::CategoryPositionHelper::CategoryPositionHelper(double,double)
double fSeriesCount
1
-chart2/source/view/inc/GL3DBarChart.hxx:107
- float chart::GL3DBarChart::addScreenTextShape(class rtl::OUString &,const struct glm::detail::tvec2<float> &,float,_Bool,const struct glm::detail::tvec4<float> &,const struct glm::detail::tvec3<float> &,unsigned int)
- unsigned int nEvent
- 0
-chart2/source/view/inc/GL3DRenderer.hxx:184
- void chart::opengl3D::OpenGL3DRenderer::Set3DSenceInfo(class Color,_Bool)
- _Bool twoSidesLighting
- 1
-chart2/source/view/inc/GL3DRenderer.hxx:185
- void chart::opengl3D::OpenGL3DRenderer::SetLightInfo(_Bool,class Color,const struct glm::detail::tvec4<float> &)
- _Bool lightOn
- 1
-chart2/source/view/inc/GL3DRenderer.hxx:193
- void chart::opengl3D::OpenGL3DRenderer::AddShape3DExtrudeObject(_Bool,class Color,unsigned int,const struct glm::detail::tmat4x4<float> &,unsigned int)
- _Bool roundedCorner
- 1
chart2/source/view/inc/PlottingPositionHelper.hxx:112
void chart::PlottingPositionHelper::AllowShiftXAxisPos(_Bool)
_Bool bAllowShift
diff --git a/compilerplugins/clang/constantparam.numbers.results b/compilerplugins/clang/constantparam.numbers.results
index 66ce9a005bc3..42a9776a532d 100644
--- a/compilerplugins/clang/constantparam.numbers.results
+++ b/compilerplugins/clang/constantparam.numbers.results
@@ -78,26 +78,6 @@ chart2/source/tools/RangeHighlighter.cxx:43
void lcl_fillRanges(class com::sun::star::uno::Sequence<struct com::sun::star::chart2::data::HighlightedRange> &,const class com::sun::star::uno::Sequence<class rtl::OUString> &,class Color,int)
int nIndex
-1
-chart2/source/view/charttypes/GL3DBarChart.cxx:157
- void chart::RenderAnimationThread::RenderAnimationThread(class chart::GL3DBarChart *,const struct glm::detail::tvec3<float> &,const struct glm::detail::tvec3<float> &,const int)
- const int nSteps
- 200
-chart2/source/view/inc/GL3DRenderer.hxx:193
- void chart::opengl3D::OpenGL3DRenderer::AddShape3DExtrudeObject(_Bool,class Color,unsigned int,const struct glm::detail::tmat4x4<float> &,unsigned int)
- unsigned int specular
- 16777215
-chart2/source/view/inc/GL3DRenderer.hxx:260
- void chart::opengl3D::OpenGL3DRenderer::CreateActualRoundedCube(float,int,int,float,float,float)
- int iSubDivZ
- 20
-chart2/source/view/inc/GL3DRenderer.hxx:260
- void chart::opengl3D::OpenGL3DRenderer::CreateActualRoundedCube(float,int,int,float,float,float)
- int iSubDivY
- 20
-chart2/source/view/main/OpenGLRender.hxx:117
- int OpenGLRender::Create2DCircle(int)
- int detail
- 100
codemaker/source/javamaker/classfile.cxx:86
void writeU4(class FileStream &,unsigned int)
unsigned int data
diff --git a/compilerplugins/clang/singlevalfields.results b/compilerplugins/clang/singlevalfields.results
index 23684e4d8879..6647455fd247 100644
--- a/compilerplugins/clang/singlevalfields.results
+++ b/compilerplugins/clang/singlevalfields.results
@@ -1,9 +1,6 @@
chart2/source/model/main/DataPoint.hxx:107
chart::DataPoint m_bNoParentPropAllowed
0
-chart2/source/view/inc/GL3DRenderer.hxx:161
- chart::opengl3D::TextInfoBatch batchNum
- 512
connectivity/source/inc/dbase/DIndexIter.hxx:37
connectivity::dbase::OIndexIterator m_pOperand
0
diff --git a/compilerplugins/clang/unusedenumconstants.writeonly.results b/compilerplugins/clang/unusedenumconstants.writeonly.results
index 41c4befbf588..b57a679aa1d8 100644
--- a/compilerplugins/clang/unusedenumconstants.writeonly.results
+++ b/compilerplugins/clang/unusedenumconstants.writeonly.results
@@ -304,8 +304,6 @@ chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx:
enum chart::wrapper::(anonymous namespace)::(anonymous at chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx:96:1) PROP_CHART_AUTOMATIC_POSITION
chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx:54
enum chart::wrapper::(anonymous namespace)::(anonymous at chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx:51:1) PROP_CHART_DATAPOINT_DATA_CAPTION
-chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx:28
- enum chart::wrapper::(anonymous namespace)::(anonymous at chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx:26:1) PROP_GL3DCHARTTYPE_ROUNDED_EDGE
chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx:110
enum chart::wrapper::(anonymous namespace)::(anonymous at chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx:108:1) PROP_CHART_SCALE_TEXT
chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx:171
@@ -830,10 +828,6 @@ chart2/source/model/template/ColumnChartType.cxx:37
enum (anonymous namespace)::(anonymous at chart2/source/model/template/ColumnChartType.cxx:34:1) PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE
chart2/source/model/template/ColumnLineChartTypeTemplate.cxx:47
enum (anonymous namespace)::(anonymous at chart2/source/model/template/ColumnLineChartTypeTemplate.cxx:45:1) PROP_COL_LINE_NUMBER_OF_LINES
-chart2/source/model/template/GL3DBarChartType.cxx:27
- enum chart::(anonymous namespace)::(anonymous at chart2/source/model/template/GL3DBarChartType.cxx:25:1) PROP_GL3DCHARTTYPE_ROUNDED_EDGE
-chart2/source/model/template/GL3DBarChartTypeTemplate.cxx:30
- enum chart::(anonymous namespace)::(anonymous at chart2/source/model/template/GL3DBarChartTypeTemplate.cxx:28:1) PROP_GL3DCHARTTYPE_ROUNDED_EDGE
chart2/source/model/template/LineChartType.cxx:40
enum (anonymous namespace)::(anonymous at chart2/source/model/template/LineChartType.cxx:38:1) PROP_LINECHARTTYPE_CURVE_STYLE
chart2/source/model/template/LineChartType.cxx:41
@@ -6290,8 +6284,6 @@ include/xmloff/xmltoken.hxx:911
enum xmloff::token::XMLTokenEnum XML_GENERATOR
include/xmloff/xmltoken.hxx:912
enum xmloff::token::XMLTokenEnum XML_GEQ
-include/xmloff/xmltoken.hxx:913
- enum xmloff::token::XMLTokenEnum XML_GL3DBAR
include/xmloff/xmltoken.hxx:914
enum xmloff::token::XMLTokenEnum XML_GOURAUD
include/xmloff/xmltoken.hxx:915
@@ -7534,8 +7526,6 @@ include/xmloff/xmltoken.hxx:1555
enum xmloff::token::XMLTokenEnum XML_ROTATION_ANGLE
include/xmloff/xmltoken.hxx:1556
enum xmloff::token::XMLTokenEnum XML_ROUND
-include/xmloff/xmltoken.hxx:1557
- enum xmloff::token::XMLTokenEnum XML_ROUNDED_EDGE
include/xmloff/xmltoken.hxx:1559
enum xmloff::token::XMLTokenEnum XML_ROW_HEIGHT
include/xmloff/xmltoken.hxx:1560
@@ -16968,8 +16958,6 @@ xmloff/source/chart/SchXMLTools.hxx:63
enum SchXMLTools::SchXMLChartTypeEnum XML_CHART_CLASS_BAR
xmloff/source/chart/SchXMLTools.hxx:65
enum SchXMLTools::SchXMLChartTypeEnum XML_CHART_CLASS_BUBBLE
-xmloff/source/chart/SchXMLTools.hxx:66
- enum SchXMLTools::SchXMLChartTypeEnum XML_CHART_CLASS_GL3DBAR
xmloff/source/chart/SchXMLTools.hxx:67
enum SchXMLTools::SchXMLChartTypeEnum XML_CHART_CLASS_ADDIN
xmloff/source/chart/transporttypes.hxx:30
diff --git a/compilerplugins/clang/unusedfields.only-used-in-constructor.results b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
index f6a684c5ea75..70b38deb71d1 100644
--- a/compilerplugins/clang/unusedfields.only-used-in-constructor.results
+++ b/compilerplugins/clang/unusedfields.only-used-in-constructor.results
@@ -30,16 +30,6 @@ chart2/source/controller/inc/dlg_View3D.hxx:53
chart::View3DDialog m_aControllerLocker class chart::ControllerLockHelper
chart2/source/controller/inc/RangeSelectionListener.hxx:63
chart::RangeSelectionListener m_aControllerLockGuard class chart::ControllerLockGuardUNO
-chart2/source/view/inc/GL3DRenderer.hxx:54
- chart::opengl3D::MaterialParameters pad float
-chart2/source/view/inc/GL3DRenderer.hxx:55
- chart::opengl3D::MaterialParameters pad1 float
-chart2/source/view/inc/GL3DRenderer.hxx:64
- chart::opengl3D::LightSource pad1 float
-chart2/source/view/inc/GL3DRenderer.hxx:65
- chart::opengl3D::LightSource pad2 float
-chart2/source/view/inc/GL3DRenderer.hxx:66
- chart::opengl3D::LightSource pad3 float
connectivity/source/commontools/RowFunctionParser.cxx:374
connectivity::(anonymous namespace)::ExpressionGrammar::definition unaryFunction ::boost::spirit::rule<ScannerT>
connectivity/source/commontools/RowFunctionParser.cxx:375
diff --git a/compilerplugins/clang/unusedfields.untouched.results b/compilerplugins/clang/unusedfields.untouched.results
index c8156c084c3d..7743a742db28 100644
--- a/compilerplugins/clang/unusedfields.untouched.results
+++ b/compilerplugins/clang/unusedfields.untouched.results
@@ -22,16 +22,6 @@ canvas/source/vcl/impltools.hxx:117
vclcanvas::tools::LocalGuard aSolarGuard class SolarMutexGuard
chart2/source/controller/inc/RangeSelectionListener.hxx:63
chart::RangeSelectionListener m_aControllerLockGuard class chart::ControllerLockGuardUNO
-chart2/source/view/inc/GL3DRenderer.hxx:54
- chart::opengl3D::MaterialParameters pad float
-chart2/source/view/inc/GL3DRenderer.hxx:55
- chart::opengl3D::MaterialParameters pad1 float
-chart2/source/view/inc/GL3DRenderer.hxx:64
- chart::opengl3D::LightSource pad1 float
-chart2/source/view/inc/GL3DRenderer.hxx:65
- chart::opengl3D::LightSource pad2 float
-chart2/source/view/inc/GL3DRenderer.hxx:66
- chart::opengl3D::LightSource pad3 float
comphelper/source/container/enumerablemap.cxx:298
comphelper::MapEnumeration m_xKeepMapAlive Reference<class com::sun::star::uno::XInterface>
connectivity/source/drivers/evoab2/EApi.h:122
diff --git a/compilerplugins/clang/unusedfields.writeonly.results b/compilerplugins/clang/unusedfields.writeonly.results
index 8ad41ca74132..4b985610ef29 100644
--- a/compilerplugins/clang/unusedfields.writeonly.results
+++ b/compilerplugins/clang/unusedfields.writeonly.results
@@ -66,14 +66,6 @@ chart2/source/inc/MediaDescriptorHelper.hxx:75
apphelper::MediaDescriptorHelper ReadOnly _Bool
chart2/source/view/charttypes/PieChart.hxx:128
chart::PieChart::PieLabelInfo fValue double
-chart2/source/view/inc/GL3DRenderer.hxx:63
- chart::opengl3D::LightSource lightPower float
-chart2/source/view/inc/GL3DRenderer.hxx:80
- chart::opengl3D::Polygon3DInfo twoSidesLighting _Bool
-chart2/source/view/inc/GL3DRenderer.hxx:94
- chart::opengl3D::Extrude3DInfo twoSidesLighting _Bool
-chart2/source/view/inc/GL3DRenderer.hxx:123
- chart::opengl3D::RoundBarMesh topThreshold float
codemaker/source/cppumaker/dependencies.hxx:105
codemaker::cppumaker::Dependencies m_voidDependency _Bool
codemaker/source/cppumaker/dependencies.hxx:111
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index 798b4c3c59f5..6afbba4aa50c 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -1257,8 +1257,7 @@ awt::Rectangle SAL_CALL DocumentHolder::calcAdjustedRectangle( const awt::Rectan
void SAL_CALL DocumentHolder::activated( )
{
- if ( (m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
- svt::EmbeddedObjectRef::IsGLChart(m_pEmbedObj) )
+ if ( m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
{
if ( m_pEmbedObj->getCurrentState() != embed::EmbedStates::UI_ACTIVE &&
!(m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_NOUIACTIVATE) )
diff --git a/icon-themes/breeze/chart2/res/gl3dbar_roundrect.png b/icon-themes/breeze/chart2/res/gl3dbar_roundrect.png
deleted file mode 100644
index 1b7c410341ab..000000000000
--- a/icon-themes/breeze/chart2/res/gl3dbar_roundrect.png
+++ /dev/null
Binary files differ
diff --git a/icon-themes/breeze/chart2/res/typegl3dbar_16.png b/icon-themes/breeze/chart2/res/typegl3dbar_16.png
deleted file mode 100644
index 631e7e16e9f8..000000000000
--- a/icon-themes/breeze/chart2/res/typegl3dbar_16.png
+++ /dev/null
Binary files differ
diff --git a/icon-themes/breeze_dark/chart2/res/gl3dbar_roundrect.png b/icon-themes/breeze_dark/chart2/res/gl3dbar_roundrect.png
deleted file mode 100644
index 6483b459c5c1..000000000000
--- a/icon-themes/breeze_dark/chart2/res/gl3dbar_roundrect.png
+++ /dev/null
Binary files differ
diff --git a/icon-themes/breeze_dark/chart2/res/typegl3dbar_16.png b/icon-themes/breeze_dark/chart2/res/typegl3dbar_16.png
deleted file mode 100644
index 4d39b491da5f..000000000000
--- a/icon-themes/breeze_dark/chart2/res/typegl3dbar_16.png
+++ /dev/null
Binary files differ
diff --git a/icon-themes/breeze_svg/chart2/res/gl3dbar_roundrect.svg b/icon-themes/breeze_svg/chart2/res/gl3dbar_roundrect.svg
deleted file mode 100644
index 2eeb38ed4574..000000000000
--- a/icon-themes/breeze_svg/chart2/res/gl3dbar_roundrect.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="52" viewBox="0 0 60 52" width="60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="11" x2="57" y1="1026.3622" y2="1026.3622"><stop offset="0" stop-color="#f62459"/><stop offset="1" stop-color="#f73768"/></linearGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="11" x2="3" y1="1028.3622" y2="1028.3622"><stop offset="0" stop-color="#22a7f0"/><stop offset="1" stop-color="#19b5fe"/></linearGradient><g transform="translate(0 -1000.3622)"><path d="m0 1000.3622h60v52h-60z" fill="#fff"/><path d="m11 1049.3622 46.000001-3.8334v-38.3333l-46.000001-3.8333z" fill="url(#a)" fill-rule="evenodd"/><path d="m3 1011.0288 8-7.6666v46l-8-7.6667z" fill="url(#b)" fill-rule="evenodd"/><g fill="#fff"><path d="m41 1015.3622h2v21.999983h-2z"/><path d="m43 1035.3622h4v2h-4z"/><path d="m35 1027.3622h2v10h-2z"/><path d="m31 1027.3622h4v2h-4z"/><path d="m34 1015.3622a11 11 0 0 0 -11 11 11 11 0 0 0 11 11 11 11 0 0 0 3-.4277v-2.0977a9 9 0 0 1 -3 .5254 9 9 0 0 1 -9-9 9 9 0 0 1 9-9 9 9 0 0 1 3 .5273v-2.1074a11 11 0 0 0 -3-.4199z"/><path d="m33 1035.3622h3v2h-3z"/><path d="m35 1009.3622a20 17 0 0 0 -20 17 20 17 0 0 0 20 17 20 17 0 0 0 20-17 18 15 0 0 1 -18 15 18 15 0 0 1 -18-15 18 15 0 0 1 18-15 18 15 0 0 1 17.955078 13.9395 20 17 0 0 0 -19.955078-15.9395z"/></g></g></svg> \ No newline at end of file
diff --git a/icon-themes/breeze_svg/chart2/res/typegl3dbar_16.svg b/icon-themes/breeze_svg/chart2/res/typegl3dbar_16.svg
deleted file mode 100644
index bc4a5fc0e61f..000000000000
--- a/icon-themes/breeze_svg/chart2/res/typegl3dbar_16.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
- <path
- style="fill:#b3b3b3"
- d="M 3 2 L 3 14 L 15 13 L 15 3 L 3 2 z "
- />
- <path
- style="fill:#4d4d4d"
- d="M 3 2 L 1 4 L 1 12 L 3 14 L 3 2 z M 9.5 3 A 5.5 5 0 0 0 4 8 A 5.5 5 0 0 0 9.5 13 A 5.5 5 0 0 0 15 8 A 5.0416667 4 0 0 1 9.9589844 12 A 5.0416667 4 0 0 1 4.9160156 8 A 5.0416667 4 0 0 1 9.9589844 4 A 5.0416667 4 0 0 1 14.982422 7.6796875 A 5.5 5 0 0 0 9.5 3 z M 14.982422 7.6796875 A 5.5 5 0 0 1 15 8 A 5.0416667 4 0 0 0 14.982422 7.6796875 z M 9 5 A 3 3 0 0 0 6 8 A 3 3 0 0 0 9 11 A 3 3 0 0 0 10 10.824219 L 10 10 L 10 9.7285156 L 10 8 L 9 8 L 8 8 L 8 9 L 9 9 L 9 10 A 2 2 0 0 1 7 8 A 2 2 0 0 1 9 6 A 2 2 0 0 1 10 6.2695312 L 10 5.1738281 A 3 3 0 0 0 9 5 z M 11 5 L 11 11 L 12 11 L 13 11 L 13 10 L 12 10 L 12 5 L 11 5 z "
- />
- </svg>
diff --git a/icon-themes/colibre/chart2/res/gl3dbar_roundrect.png b/icon-themes/colibre/chart2/res/gl3dbar_roundrect.png
deleted file mode 100644
index bc0fb07903f4..000000000000
--- a/icon-themes/colibre/chart2/res/gl3dbar_roundrect.png
+++ /dev/null
Binary files differ
diff --git a/icon-themes/colibre/chart2/res/typegl3dbar_16.png b/icon-themes/colibre/chart2/res/typegl3dbar_16.png
deleted file mode 100644
index 6050874966ab..000000000000
--- a/icon-themes/colibre/chart2/res/typegl3dbar_16.png
+++ /dev/null
Binary files differ
diff --git a/icon-themes/colibre_svg/chart2/res/gl3dbar_roundrect.svg b/icon-themes/colibre_svg/chart2/res/gl3dbar_roundrect.svg
deleted file mode 100644
index 0d2eecd55f9d..000000000000
--- a/icon-themes/colibre_svg/chart2/res/gl3dbar_roundrect.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="52" viewBox="0 0 60 52" width="60" xmlns="http://www.w3.org/2000/svg"><path d="m0 0h60v52h-60z" fill="#fff"/><path d="m11 49 46.000001-3.8334v-38.3333l-46.000001-3.8333z" fill="#eac282" fill-rule="evenodd"/><path d="m3 10.6666 8-7.6666v46l-8-7.6667z" fill="#4d82b8" fill-rule="evenodd"/><g fill="#fff"><path d="m41 15h2v22h-2z"/><path d="m43 35h4v2h-4z"/><path d="m35 27h2v10h-2z"/><path d="m31 27h4v2h-4z"/><path d="m34 15a11 11 0 0 0 -11 11 11 11 0 0 0 11 11 11 11 0 0 0 3-.4277v-2.0977a9 9 0 0 1 -3 .5254 9 9 0 0 1 -9-9 9 9 0 0 1 9-9 9 9 0 0 1 3 .5273v-2.1074a11 11 0 0 0 -3-.4199z"/><path d="m33 35h3v2h-3z"/><path d="m35 9a20 17 0 0 0 -20 17 20 17 0 0 0 20 17 20 17 0 0 0 20-17 18 15 0 0 1 -18 15 18 15 0 0 1 -18-15 18 15 0 0 1 18-15 18 15 0 0 1 17.955078 13.9395 20 17 0 0 0 -19.955078-15.9395z"/></g></svg> \ No newline at end of file
diff --git a/icon-themes/colibre_svg/chart2/res/typegl3dbar_16.svg b/icon-themes/colibre_svg/chart2/res/typegl3dbar_16.svg
deleted file mode 100644
index 03c92aeb511e..000000000000
--- a/icon-themes/colibre_svg/chart2/res/typegl3dbar_16.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m3 2v12l12-1v-10z" fill="#eac282"/><path d="m9.5 3c-3.0375661 0-5.5 2.2385763-5.5 5 0 2.761424 2.4624339 5 5.5 5 3.037566 0 5.5-2.238576 5.5-5 0 2.208937-2.256834 3.999715-5.0410156 4-2.7849441.000571-5.0429689-1.790457-5.0429688-4-.0000001-2.2095425 2.2580247-4.0005707 5.0429688-4 2.6270966.0008427 4.8130646 1.6020728 5.0234376 3.6796875-.185674-2.6294514-2.584074-4.6766787-5.482422-4.6796875zm5.482422 4.6796875c.009625.1065725.015488.2133983.017578.3203125-.000461-.1069143-.006325-.213771-.017578-.3203125zm-5.982422-2.6796875c-1.6568542 0-3 1.3431458-3 3s1.3431458 3 3 3c .3408996-.0014.6790752-.0608 1-.175781v-.824219-.2714844-1.7285156h-1-1v1h1v1c-1.1045695 0-2-.8954305-2-2s .8954305-2 2-2c .3512171.0004809.6961149.093442 1 .2695312v-1.0957031c-.3210407-.1143201-.6592131-.1731039-1-.1738281zm2 0v6h1 1v-1h-1v-5z" fill="#fff"/><path d="m3 2-2 2v8l2 2z" fill="#4d82b8"/></svg> \ No newline at end of file
diff --git a/icon-themes/elementary/chart2/res/gl3dbar_roundrect.png b/icon-themes/elementary/chart2/res/gl3dbar_roundrect.png
deleted file mode 100644
index 17aec463f372..000000000000
--- a/icon-themes/elementary/chart2/res/gl3dbar_roundrect.png
+++ /dev/null
Binary files differ
diff --git a/icon-themes/elementary/chart2/res/typegl3dbar_16.png b/icon-themes/elementary/chart2/res/typegl3dbar_16.png
deleted file mode 100644
index d04c6b05eb21..000000000000
--- a/icon-themes/elementary/chart2/res/typegl3dbar_16.png
+++ /dev/null
Binary files differ
diff --git a/icon-themes/elementary_svg/chart2/res/gl3dbar_roundrect.svg b/icon-themes/elementary_svg/chart2/res/gl3dbar_roundrect.svg
deleted file mode 100644
index d220c6852189..000000000000
--- a/icon-themes/elementary_svg/chart2/res/gl3dbar_roundrect.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg height="52" viewBox="0 0 60 52" width="60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="11" x2="57" y1="1026.3622" y2="1026.3622"><stop offset="0" stop-color="#7a36b1"/><stop offset="1" stop-color="#c5a3f2"/></linearGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="11" x2="3" y1="1028.3622" y2="1028.3622"><stop offset="0" stop-color="#55c1ec"/><stop offset="1" stop-color="#3689e6"/></linearGradient><g transform="translate(0 -1000.3622)"><path d="m0 1000.3622h60v52h-60z" fill="#fff"/><path d="m11 1049.3622 46.000001-3.8334v-38.3333l-46.000001-3.8333z" fill="url(#a)" fill-rule="evenodd"/><path d="m3 1011.0288 8-7.6666v46l-8-7.6667z" fill="url(#b)" fill-rule="evenodd"/><g fill="#fff"><path d="m41 1015.3622h2v21.999983h-2z"/><path d="m43 1035.3622h4v2h-4z"/><path d="m35 1027.3622h2v10h-2z"/><path d="m31 1027.3622h4v2h-4z"/><path d="m34 1015.3622a11 11 0 0 0 -11 11 11 11 0 0 0 11 11 11 11 0 0 0 3-.4277v-2.0977a9 9 0 0 1 -3 .5254 9 9 0 0 1 -9-9 9 9 0 0 1 9-9 9 9 0 0 1 3 .5273v-2.1074a11 11 0 0 0 -3-.4199z"/><path d="m33 1035.3622h3v2h-3z"/><path d="m35 1009.3622a20 17 0 0 0 -20 17 20 17 0 0 0 20 17 20 17 0 0 0 20-17 18 15 0 0 1 -18 15 18 15 0 0 1 -18-15 18 15 0 0 1 18-15 18 15 0 0 1 17.955078 13.9395 20 17 0 0 0 -19.955078-15.9395z"/></g></g></svg>
diff --git a/icon-themes/elementary_svg/chart2/res/typegl3dbar_16.svg b/icon-themes/elementary_svg/chart2/res/typegl3dbar_16.svg
deleted file mode 100644
index eb9928efdf69..000000000000
--- a/icon-themes/elementary_svg/chart2/res/typegl3dbar_16.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="1" x2="15" y1="8" y2="8"><stop offset="0" stop-color="#b900c4"/><stop offset="1" stop-color="#c69ac8"/></linearGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" spreadMethod="pad" x1="3" x2="15" y1="8" y2="8"><stop offset="0" stop-color="#b900c4"/><stop offset="1" stop-color="#ae4300"/></linearGradient><path d="m3 2v12l12-1v-10z" fill="url(#b)"/><path d="m3 2-2 2v8l2 2zm6.5 1a5.5 5 0 0 0 -5.5 5 5.5 5 0 0 0 5.5 5 5.5 5 0 0 0 5.5-5 5.0416667 4 0 0 1 -5.0410156 4 5.0416667 4 0 0 1 -5.0429688-4 5.0416667 4 0 0 1 5.0429688-4 5.0416667 4 0 0 1 5.0234376 3.6796875 5.5 5 0 0 0 -5.482422-4.6796875zm5.482422 4.6796875a5.5 5 0 0 1 .017578.3203125 5.0416667 4 0 0 0 -.017578-.3203125zm-5.982422-2.6796875a3 3 0 0 0 -3 3 3 3 0 0 0 3 3 3 3 0 0 0 1-.175781v-.824219-.2714844-1.7285156h-1-1v1h1v1a2 2 0 0 1 -2-2 2 2 0 0 1 2-2 2 2 0 0 1 1 .2695312v-1.0957031a3 3 0 0 0 -1-.1738281zm2 0v6h1 1v-1h-1v-5z" fill="url(#a)"/></svg> \ No newline at end of file
diff --git a/icon-themes/karasa_jaga/chart2/res/gl3dbar_roundrect.png b/icon-themes/karasa_jaga/chart2/res/gl3dbar_roundrect.png
deleted file mode 100644
index ea152305261a..000000000000
--- a/icon-themes/karasa_jaga/chart2/res/gl3dbar_roundrect.png
+++ /dev/null
Binary files differ
diff --git a/icon-themes/karasa_jaga/chart2/res/typegl3dbar_16.png b/icon-themes/karasa_jaga/chart2/res/typegl3dbar_16.png
deleted file mode 100644
index d04c6b05eb21..000000000000
--- a/icon-themes/karasa_jaga/chart2/res/typegl3dbar_16.png
+++ /dev/null
Binary files differ
diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx
index 27e3e89eb590..5e74e97a3d60 100644
--- a/include/svtools/embedhlp.hxx
+++ b/include/svtools/embedhlp.hxx
@@ -69,7 +69,6 @@ public:
throw();
static bool IsChart(const css::uno::Reference < css::embed::XEmbeddedObject >& xObj);
- static bool IsGLChart(const css::uno::Reference < css::embed::XEmbeddedObject >& xObj);
const css::uno::Reference <css::embed::XEmbeddedObject>& operator->() const;
const css::uno::Reference <css::embed::XEmbeddedObject>& GetObject() const;
@@ -111,7 +110,6 @@ public:
bool IsLocked() const;
bool IsChart() const;
- bool IsGLChart() const;
OUString GetChartType();
diff --git a/include/svx/charthelper.hxx b/include/svx/charthelper.hxx
index acc1349c93c5..7bdcd4cc42be 100644
--- a/include/svx/charthelper.hxx
+++ b/include/svx/charthelper.hxx
@@ -36,9 +36,6 @@ namespace basegfx { class B2DRange; }
class SAL_WARN_UNUSED SVX_DLLPUBLIC ChartHelper
{
public:
- /// Check that the XDiagram is a real 3D chart.
- static bool isGL3DDiagram(const css::uno::Reference<css::chart2::XDiagram>& xDiagram);
-
/// Use chart's XUpdatable::update() to update values.
static void updateChart( const css::uno::Reference< css::frame::XModel >& rXModel, bool bHardUpdate );
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index 59adef7e4ca5..a897b797694d 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -160,7 +160,6 @@ public:
css::uno::Reference< css::frame::XModel > getXModel() const;
bool IsChart() const;
- bool IsReal3DChart() const;
bool IsCalc() const;
bool UpdateLinkURL_Impl();
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 1c388e5e3193..2364f63d6879 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -919,7 +919,6 @@ namespace xmloff { namespace token {
XML_GCD,
XML_GENERATOR,
XML_GEQ,
- XML_GL3DBAR,
XML_GOURAUD,
XML_GRADIENT,
XML_GRADIENT_ANGLE,
@@ -1569,7 +1568,6 @@ namespace xmloff { namespace token {
XML_ROTATION_ALIGN,
XML_ROTATION_ANGLE,
XML_ROUND,
- XML_ROUNDED_EDGE,
XML_ROW,
XML_ROW_HEIGHT,
XML_ROW_NUMBER,
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 93a76c5908a2..54231555fbff 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2013,7 +2013,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/chart2,\
SymbolStyle \
TickmarkStyle \
TransparencyStyle \
- X3DChartWindowProvider \
XAnyDescriptionAccess \
XAxis \
XChartDocument \
diff --git a/offapi/com/sun/star/chart2/X3DChartWindowProvider.idl b/offapi/com/sun/star/chart2/X3DChartWindowProvider.idl
deleted file mode 100644
index ff67fc323553..000000000000
--- a/offapi/com/sun/star/chart2/X3DChartWindowProvider.idl
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- 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 __com_sun_star_chart2_X3DChartWindowProvider_idl__
-#define __com_sun_star_chart2_X3DChartWindowProvider_idl__
-
-module com { module sun { module star { module chart2 {
-
-interface X3DChartWindowProvider
-{
- void setWindow( [in] unsigned hyper window );
-};
-
-}; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/chart2/XChartDocument.idl b/offapi/com/sun/star/chart2/XChartDocument.idl
index 57bcfc9c259f..0055cbb83fd2 100644
--- a/offapi/com/sun/star/chart2/XChartDocument.idl
+++ b/offapi/com/sun/star/chart2/XChartDocument.idl
@@ -127,10 +127,6 @@ interface XChartDocument : ::com::sun::star::frame::XModel
/** Creates a default chart type for a brand-new chart object.
*/
void createDefaultChart();
-
- /** Returns true if the chart is based on OpenGL
- */
- boolean isOpenGLChart();
};
} ; // chart2
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index c9067fdd4ff2..833ced31405e 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -53,7 +53,6 @@
#include <com/sun/star/chart2/data/XDataProvider.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/X3DChartWindowProvider.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index c90fe8df5bdc..556880a93ac7 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -90,7 +90,6 @@
#include <gridwin.hxx>
#include <com/sun/star/document/XDocumentProperties.hpp>
-#include <com/sun/star/chart2/X3DChartWindowProvider.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 047a4b1acbd0..a02377b05428 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -1045,8 +1045,7 @@ void SfxInPlaceClient::DeactivateObject()
m_pViewSh->GetViewFrame()->GetFrame().LockResize_Impl(true);
- if ( (m_xImp->m_xObject->getStatus( m_xImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
- svt::EmbeddedObjectRef::IsGLChart(m_xImp->m_xObject) )
+ if ( m_xImp->m_xObject->getStatus( m_xImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
{
m_xImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
if (bHasFocus)
@@ -1079,8 +1078,7 @@ void SfxInPlaceClient::ResetObject()
try
{
m_xImp->m_bUIActive = false;
- if ( (m_xImp->m_xObject->getStatus( m_xImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
- svt::EmbeddedObjectRef::IsGLChart(m_xImp->m_xObject) )
+ if ( m_xImp->m_xObject->getStatus( m_xImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
m_xImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
else
{
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index d5ec553855d8..fe494ae1c522 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1649,8 +1649,7 @@ void SfxViewShell::CheckIPClient_Impl(
bool bAlwaysActive =
( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) != 0 );
bool bActiveWhenVisible =
- ( (( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 ) ||
- svt::EmbeddedObjectRef::IsGLChart(pIPClient->GetObject()));
+ ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0;
// this method is called when a client is created
if (!pIPClient->IsObjectInPlaceActive())
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index f87b94fe02b9..25e6c448042a 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -77,7 +77,6 @@ core_constructor_list = [
"com_sun_star_comp_chart_DataSeries_get_implementation",
"com_sun_star_comp_chart_DataSource_get_implementation",
"com_sun_star_comp_chart_FilledNetChartType_get_implementation",
- "com_sun_star_comp_chart_GL3DBarChartType_get_implementation",
"com_sun_star_comp_chart_FormattedString_get_implementation",
"com_sun_star_comp_chart_LineChartType_get_implementation",
"com_sun_star_comp_chart_NetChartType_get_implementation",
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index c54a125bcf4f..ee236d590a9b 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -863,8 +863,6 @@ chart2/inc/pch/precompiled_chartcontroller.cxx
chart2/inc/pch/precompiled_chartcontroller.hxx
chart2/inc/pch/precompiled_chartcore.cxx
chart2/inc/pch/precompiled_chartcore.hxx
-chart2/inc/pch/precompiled_chartopengl.cxx
-chart2/inc/pch/precompiled_chartopengl.hxx
chart2/inc/unonames.hxx
chart2/qa/extras/PivotChartTest.cxx
chart2/qa/extras/chart2_trendcalculators.cxx
@@ -922,8 +920,6 @@ chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx
chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx
-chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx
-chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.hxx
chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
@@ -958,8 +954,6 @@ chart2/source/controller/dialogs/DataBrowserModel.cxx
chart2/source/controller/dialogs/DataBrowserModel.hxx
chart2/source/controller/dialogs/DialogModel.cxx
chart2/source/controller/dialogs/DialogModel.hxx
-chart2/source/controller/dialogs/GL3DBarChartDialogController.cxx
-chart2/source/controller/dialogs/GL3DBarChartDialogController.hxx
chart2/source/controller/dialogs/ObjectNameProvider.cxx
chart2/source/controller/dialogs/RangeSelectionHelper.cxx
chart2/source/controller/dialogs/RangeSelectionListener.cxx
@@ -1331,10 +1325,6 @@ chart2/source/model/template/DataInterpreter.cxx
chart2/source/model/template/DataInterpreter.hxx
chart2/source/model/template/FilledNetChartType.cxx
chart2/source/model/template/FilledNetChartType.hxx
-chart2/source/model/template/GL3DBarChartType.cxx
-chart2/source/model/template/GL3DBarChartType.hxx
-chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
-chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
chart2/source/model/template/LineChartType.cxx
chart2/source/model/template/LineChartType.hxx
chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -1473,7 +1463,6 @@ chart2/source/view/charttypes/CandleStickChart.cxx
chart2/source/view/charttypes/CandleStickChart.hxx
chart2/source/view/charttypes/CategoryPositionHelper.cxx
chart2/source/view/charttypes/CategoryPositionHelper.hxx
-chart2/source/view/charttypes/GL3DBarChart.cxx
chart2/source/view/charttypes/NetChart.cxx
chart2/source/view/charttypes/NetChart.hxx
chart2/source/view/charttypes/PieChart.cxx
@@ -1482,19 +1471,14 @@ chart2/source/view/charttypes/Splines.cxx
chart2/source/view/charttypes/Splines.hxx
chart2/source/view/charttypes/VSeriesPlotter.cxx
chart2/source/view/diagram/VDiagram.cxx
-chart2/source/view/inc/3DChartObjects.hxx
chart2/source/view/inc/AbstractShapeFactory.hxx
chart2/source/view/inc/Clipping.hxx
chart2/source/view/inc/DateHelper.hxx
-chart2/source/view/inc/GL3DBarChart.hxx
-chart2/source/view/inc/GL3DPlotterBase.hxx
-chart2/source/view/inc/GL3DRenderer.hxx
chart2/source/view/inc/LabelAlignment.hxx
chart2/source/view/inc/LabelPositionHelper.hxx
chart2/source/view/inc/LegendEntryProvider.hxx
chart2/source/view/inc/Linear3DTransformation.hxx
chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
-chart2/source/view/inc/OpenglShapeFactory.hxx
chart2/source/view/inc/PlotterBase.hxx
chart2/source/view/inc/PlottingPositionHelper.hxx
chart2/source/view/inc/PolarLabelPositionHelper.hxx
@@ -1511,7 +1495,6 @@ chart2/source/view/inc/VLineProperties.hxx
chart2/source/view/inc/VPolarTransformation.hxx
chart2/source/view/inc/VSeriesPlotter.hxx
chart2/source/view/inc/ViewDefines.hxx
-chart2/source/view/main/3DChartObjects.cxx
chart2/source/view/main/AbstractShapeFactory.cxx
chart2/source/view/main/ChartItemPool.cxx
chart2/source/view/main/ChartItemPool.hxx
@@ -1519,15 +1502,8 @@ chart2/source/view/main/ChartView.cxx
chart2/source/view/main/Clipping.cxx
chart2/source/view/main/DataPointSymbolSupplier.cxx
chart2/source/view/main/DrawModelWrapper.cxx
-chart2/source/view/main/DummyXShape.cxx
-chart2/source/view/main/DummyXShape.hxx
-chart2/source/view/main/GL3DPlotterBase.cxx
-chart2/source/view/main/GL3DRenderer.cxx
chart2/source/view/main/LabelPositionHelper.cxx
chart2/source/view/main/Linear3DTransformation.cxx
-chart2/source/view/main/OpenGLRender.cxx
-chart2/source/view/main/OpenGLRender.hxx
-chart2/source/view/main/OpenglShapeFactory.cxx
chart2/source/view/main/PlotterBase.cxx
chart2/source/view/main/PlottingPositionHelper.cxx
chart2/source/view/main/PolarLabelPositionHelper.cxx
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index b6ec9ae1576d..4d98a55c19df 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -787,23 +787,6 @@ bool EmbeddedObjectRef::IsChart(const css::uno::Reference < css::embed::XEmbedde
|| SvGlobalName(SO3_SCH_CLASSID_60) == aObjClsId;
}
-bool EmbeddedObjectRef::IsGLChart(const css::uno::Reference < css::embed::XEmbeddedObject >& xObj)
-{
- static const char* env = getenv("CHART_DUMMY_FACTORY");
- if (IsChart(xObj))
- {
- if (env)
- return true;
-
- uno::Reference< chart2::XChartDocument > xChartDoc(xObj->getComponent(), uno::UNO_QUERY);
- if (!xChartDoc.is())
- return false;
-
- return xChartDoc->isOpenGLChart();
- }
- return false;
-}
-
void EmbeddedObjectRef::UpdateReplacement()
{
if (mpImpl->bUpdating)
@@ -844,14 +827,6 @@ bool EmbeddedObjectRef::IsChart() const
return EmbeddedObjectRef::IsChart(mpImpl->mxObj);
}
-bool EmbeddedObjectRef::IsGLChart() const
-{
- if (!mpImpl->mxObj.is())
- return false;
-
- return EmbeddedObjectRef::IsGLChart(mpImpl->mxObj);
-}
-
// MT: Only used for getting accessible attributes, which are not localized
OUString EmbeddedObjectRef::GetChartType()
{
diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx
index e0d52153e525..43d022db4073 100644
--- a/svx/source/sdr/contact/viewobjectcontact.cxx
+++ b/svx/source/sdr/contact/viewobjectcontact.cxx
@@ -250,14 +250,6 @@ void ViewObjectContact::triggerLazyInvalidate()
// reset flag
mbLazyInvalidate = false;
-#if HAVE_FEATURE_DESKTOP
- // 3D charts need to be notified separately, they are not to be
- // drawn by the drawinglayer
- ViewContactOfSdrOle2Obj* pViewContact = dynamic_cast<ViewContactOfSdrOle2Obj*>(&GetViewContact());
- if (pViewContact && pViewContact->GetOle2Obj().IsReal3DChart())
- ChartHelper::updateChart(pViewContact->GetOle2Obj().getXModel(), false);
-#endif
-
// force ObjectRange
getObjectRange();
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index 3c9a1a25ce8d..a2ca6ffe7b05 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -88,8 +88,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfSdrOle2Obj::c
}
SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
- if(pPageView && ((nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
- xObjRef.IsGLChart()))
+ if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE))
{
// connect plugin object
pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2));
diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx
index 4e1d0a698318..a9c18eb4f2ae 100644
--- a/svx/source/svdraw/charthelper.cxx
+++ b/svx/source/svdraw/charthelper.cxx
@@ -36,37 +36,6 @@
using namespace ::com::sun::star;
-bool ChartHelper::isGL3DDiagram( const css::uno::Reference<css::chart2::XDiagram>& xDiagram )
-{
- uno::Reference<chart2::XCoordinateSystemContainer> xCooSysContainer(xDiagram, uno::UNO_QUERY);
-
- if (!xCooSysContainer.is())
- return false;
-
- uno::Sequence< uno::Reference<chart2::XCoordinateSystem> > aCooSysList = xCooSysContainer->getCoordinateSystems();
- for (sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS)
- {
- uno::Reference<chart2::XCoordinateSystem> xCooSys = aCooSysList[nCS];
-
- //iterate through all chart types in the current coordinate system
- uno::Reference<chart2::XChartTypeContainer> xChartTypeContainer(xCooSys, uno::UNO_QUERY);
- OSL_ASSERT( xChartTypeContainer.is());
- if( !xChartTypeContainer.is() )
- continue;
-
- uno::Sequence< uno::Reference<chart2::XChartType> > aChartTypeList = xChartTypeContainer->getChartTypes();
- for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
- {
- uno::Reference<chart2::XChartType> xChartType = aChartTypeList[nT];
- OUString aChartType = xChartType->getChartType();
- if( aChartType == "com.sun.star.chart2.GL3DBarChartType" )
- return true;
- }
- }
-
- return false;
-}
-
void ChartHelper::updateChart( const uno::Reference< ::frame::XModel >& rXModel, bool bHardUpdate )
{
if (!rXModel.is())
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index b01af63da0ca..c259f1b4bb1e 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -380,8 +380,7 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI()
uno::Reference< embed::XEmbeddedObject > xObject = pObj->GetObjRef();
try
{
- if ( (xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
- svt::EmbeddedObjectRef::IsGLChart(xObject) )
+ if ( xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
else
{
@@ -1851,20 +1850,6 @@ bool SdrOle2Obj::IsChart() const
return mpImpl->mbIsChart;
}
-bool SdrOle2Obj::IsReal3DChart() const
-{
- if (!IsChart())
- return false;
-
- uno::Reference<chart2::XChartDocument> xChart2Document(getXModel(), uno::UNO_QUERY);
- uno::Reference<chart2::XDiagram> xChart2Diagram(xChart2Document->getFirstDiagram(), uno::UNO_QUERY);
-
- if (!xChart2Diagram.is())
- return false;
-
- return ChartHelper::isGL3DDiagram(xChart2Diagram);
-}
-
void SdrOle2Obj::SetGraphicToObj( const Graphic& aGraphic )
{
mpImpl->mxObjRef.SetGraphic( aGraphic, OUString() );
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 9490c08d880b..6a18eb351e8d 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1248,9 +1248,8 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr
}
sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
- if ( !bPrn && dynamic_cast< const SwCursorShell *>( pShell ) != nullptr && (
- (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
- pOLENd->GetOLEObj().GetObject().IsGLChart()))
+ if ( !bPrn && dynamic_cast< const SwCursorShell *>( pShell ) != nullptr &&
+ (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE))
{
const SwFlyFrame *pFly = FindFlyFrame();
assert( pFly != nullptr );
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx
index d81a11993082..f00726a65b3e 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -148,9 +148,6 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
MAP_ENTRY_ODF_EXT( "BuiltInUnit", LO_EXT, XML_CHART_DUNITS_BUILTINUNIT, XML_TYPE_STRING ),
MAP_ENTRY_ODF_EXT( "ExternalData", LO_EXT, XML_EXTERNALDATA, XML_TYPE_STRING),
- // OpenGL 3D chart flags
- MAP_ENTRY_ODF_EXT( "RoundedEdge", LO_EXT, XML_ROUNDED_EDGE, XML_TYPE_BOOL),
-
MAP_ENTRY_ODF_EXT( "LabelBorderColor", LO_EXT, XML_LABEL_STROKE_COLOR, XML_TYPE_COLOR ),
MAP_ENTRY_ODF_EXT( "LabelBorderStyle", LO_EXT, XML_LABEL_STROKE, XML_SCH_TYPE_LABEL_BORDER_STYLE ),
MAP_ENTRY_ODF_EXT( "LabelBorderTransparency", LO_EXT, XML_LABEL_STROKE_OPACITY, XML_SCH_TYPE_LABEL_BORDER_OPACITY ),
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index 74d4989292a3..7b1348ec846e 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -141,7 +141,6 @@ static const SvXMLEnumMapEntry<SchXMLChartTypeEnum> aXMLChartClassMap[] =
{ XML_BAR, XML_CHART_CLASS_BAR },
{ XML_STOCK, XML_CHART_CLASS_STOCK },
{ XML_BUBBLE, XML_CHART_CLASS_BUBBLE },
- { XML_GL3DBAR, XML_CHART_CLASS_GL3DBAR },
{ XML_SURFACE, XML_CHART_CLASS_BAR }, //@todo change this if a surface chart is available
{ XML_ADD_IN, XML_CHART_CLASS_ADDIN },
{ XML_TOKEN_INVALID, XML_CHART_CLASS_UNKNOWN }
@@ -179,9 +178,7 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap()
{"com.sun.star.chart.StockDiagram",
"com.sun.star.chart2.CandleStickChartType"},
{"com.sun.star.chart.BubbleDiagram",
- "com.sun.star.chart2.BubbleChartType"},
- {"com.sun.star.chart.GL3DBarDiagram",
- "com.sun.star.chart2.GL3DBarChartType"}};
+ "com.sun.star.chart2.BubbleChartType"}};
return g_aChartTypeNameMap;
}
@@ -258,8 +255,6 @@ OUString GetChartTypeByClassName(
else
aResultBuffer.append("Column");
}
- else if (IsXMLToken(rClassName, XML_GL3DBAR))
- aResultBuffer.append("GL3DBar");
else
bInternalType = false;
@@ -325,8 +320,6 @@ XMLTokenEnum getTokenByChartType(
else if( (bUseOldNames && aServiceName == "Stock") ||
(!bUseOldNames && aServiceName == "CandleStick"))
eResult = XML_STOCK;
- else if (aServiceName == "GL3DBar")
- eResult = XML_GL3DBAR;
}
}
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
index c8b888d00ed7..d8f16eda480c 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -63,7 +63,6 @@ namespace SchXMLTools
XML_CHART_CLASS_BAR,
XML_CHART_CLASS_STOCK,
XML_CHART_CLASS_BUBBLE,
- XML_CHART_CLASS_GL3DBAR,
XML_CHART_CLASS_ADDIN,
XML_CHART_CLASS_UNKNOWN
};
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 8287fd4797fa..5e6700252e78 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -919,7 +919,6 @@ namespace xmloff { namespace token {
TOKEN( "gcd", XML_GCD ),
TOKEN( "generator", XML_GENERATOR ),
TOKEN( "geq", XML_GEQ ),
- TOKEN( "gl3d-bar", XML_GL3DBAR ),
TOKEN( "gouraud", XML_GOURAUD ),
TOKEN( "gradient", XML_GRADIENT ),
TOKEN( "angle", XML_GRADIENT_ANGLE ),
@@ -1570,7 +1569,6 @@ namespace xmloff { namespace token {
TOKEN( "rotation-align", XML_ROTATION_ALIGN ),
TOKEN( "rotation-angle", XML_ROTATION_ANGLE ),
TOKEN( "round", XML_ROUND ),
- TOKEN( "rounded-edge", XML_ROUNDED_EDGE ),
TOKEN( "row", XML_ROW ),
TOKEN( "row-height", XML_ROW_HEIGHT ),
TOKEN( "row-number", XML_ROW_NUMBER ),
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 6551c5b7b9f2..27b83a01872e 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -842,7 +842,6 @@ gap-width
gcd
generator
geq
-gl3d-bar
gouraud
gradient
angle
@@ -1488,7 +1487,6 @@ rotation
rotation-align
rotation-angle
round
-rounded-edge
row
row-height
row-number