chart2/source/model/template/GL3DBarChartType.cxx | 9 +++++++++ chart2/source/model/template/GL3DBarChartType.hxx | 3 +++ chart2/source/view/charttypes/GL3DBarChart.cxx | 9 ++++++++- chart2/source/view/main/GL3DRenderer.cxx | 18 ++++++++++++------ 4 files changed, 32 insertions(+), 7 deletions(-)
New commits: commit ca52e5ff2c98268ad1965d43746d3c0f9a53fa79 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Fri May 16 12:43:09 2014 +0200 support property mapping in new 3D charts Change-Id: I3da71e354ed2595c1f5b2eaeb5fb565205d24de0 diff --git a/chart2/source/model/template/GL3DBarChartType.cxx b/chart2/source/model/template/GL3DBarChartType.cxx index 4e8868c..e99fe39 100644 --- a/chart2/source/model/template/GL3DBarChartType.cxx +++ b/chart2/source/model/template/GL3DBarChartType.cxx @@ -118,6 +118,15 @@ OUString SAL_CALL GL3DBarChartType::getChartType() return CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR; } +uno::Sequence<OUString> GL3DBarChartType::getSupportedPropertyRoles() + throw (::com::sun::star::uno::RuntimeException, std::exception) +{ + uno::Sequence< OUString > aPropRoles(1); + aPropRoles[0] = "FillColor"; + + return aPropRoles; +} + com::sun::star::uno::Reference<com::sun::star::util::XCloneable> GL3DBarChartType::createClone() throw (com::sun::star::uno::RuntimeException, std::exception) diff --git a/chart2/source/model/template/GL3DBarChartType.hxx b/chart2/source/model/template/GL3DBarChartType.hxx index f60ba4a..c758d46 100644 --- a/chart2/source/model/template/GL3DBarChartType.hxx +++ b/chart2/source/model/template/GL3DBarChartType.hxx @@ -25,6 +25,9 @@ public: GL3DBarChartType( const css::uno::Reference<css::uno::XComponentContext>& xContext ); virtual ~GL3DBarChartType(); + virtual com::sun::star::uno::Sequence< OUString > SAL_CALL + getSupportedPropertyRoles() + throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE; diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 3697903..9921d96 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -77,6 +77,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer const VDataSeries& rDataSeries = *itr; sal_Int32 nPointCount = rDataSeries.getTotalPointCount(); + bool bMappedFillProperty = rDataSeries.hasPropertyMapping("FillColor"); + // Create series name text object. OUString aSeriesName = DataSeriesHelper::getDataSeriesLabel( @@ -96,12 +98,17 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer sal_Int32 nColor = aSeriesColor[nSeriesIndex % SAL_N_ELEMENTS(aSeriesColor)].GetColor(); for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex) { + if(bMappedFillProperty) + { + nColor = static_cast<sal_uInt32>(rDataSeries.getValueByProperty(nIndex, "FillColor")); + } + float nVal = rDataSeries.getYValue(nIndex); float nXPos = nIndex * (nBarSizeX + nBarDistanceX); glm::mat4 aScaleMatrix = glm::scale(nBarSizeX, nBarSizeY, nVal); - glm::mat4 aTranslationMatrix = glm::translate(nXPos, nYPos, static_cast<float>(0)); + glm::mat4 aTranslationMatrix = glm::translate(nXPos, nYPos, 0.0f); glm::mat4 aBarPosition = aTranslationMatrix * aScaleMatrix; maShapes.push_back(new opengl3D::Bar(mpRenderer.get(), aBarPosition, nColor, nId++)); commit 2c7a4e8aff00f88dcc333f607a1c4334b197a4a1 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Fri May 16 09:31:38 2014 +0200 set the MVP matrix in picking mode Change-Id: I11d4838a320ada1d454870436e540b2c56fa18fd diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index c661e33..bcb87b2 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -782,7 +782,8 @@ void OpenGL3DRenderer::RenderPolygon3D(Polygon3DInfo &polygon) } else { - // TODO: moggi: model matrix + glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model; + glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]); } GLint maVertexID = mbPickingMode ? maPickingResources.m_2DVertexID : maResources.m_3DVertexID; @@ -1085,7 +1086,8 @@ void OpenGL3DRenderer::RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D, } else { - // TODO: moggi: model matrix + glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model; + glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]); } glDrawElements(GL_TRIANGLES, extrude3D.size[surIndex], GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(extrude3D.startIndex[surIndex])); @@ -1127,7 +1129,8 @@ void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D } else { - // TODO: moggi: model matrix + glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model; + glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]); } glDrawElements(GL_TRIANGLES, extrude3D.size[BOTTOM_SURFACE], GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(extrude3D.startIndex[BOTTOM_SURFACE])); } @@ -1170,7 +1173,8 @@ void OpenGL3DRenderer::RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D } else { - // TODO: moggi: model matrix + glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model; + glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]); } glDrawElements(GL_TRIANGLES, extrude3D.size[MIDDLE_SURFACE], GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(extrude3D.startIndex[MIDDLE_SURFACE])); } @@ -1214,7 +1218,8 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D) } else { - // TODO: moggi: model matrix + glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model; + glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]); } glDrawElements(GL_TRIANGLES, extrude3D.size[TOP_SURFACE], GL_UNSIGNED_SHORT, reinterpret_cast<GLvoid*>(extrude3D.startIndex[TOP_SURFACE])); RenderExtrudeFlatSurface(extrude3D, FLAT_BOTTOM_SURFACE); @@ -1243,7 +1248,8 @@ void OpenGL3DRenderer::RenderNonRoundedBar(const Extrude3DInfo& extrude3D) } else { - // TODO: moggi: model matrix + glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model; + glUniformMatrix4fv(maPickingResources.m_MatrixID, 1, GL_FALSE, &aMVP[0][0]); } glDrawArrays(GL_TRIANGLES, 0, 36); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits