[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart' - 3 commits - chart2/source include/vcl vcl/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Fri May 9 23:29:40 PDT 2014


 chart2/source/view/charttypes/GL3DBarChart.cxx |    6 +++++-
 chart2/source/view/main/GL3DRenderer.cxx       |    2 --
 include/vcl/openglwin.hxx                      |    1 +
 vcl/source/window/openglwin.cxx                |    9 +++++++++
 4 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 1e0f83ad831ba8ce5e0783bee1959656975b7abc
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 08:24:54 2014 +0200

    some work into intercepting mouse events in OpenGL window
    
    Change-Id: I46dcfed7d5398d994c68ed7cfe4408f9f5719bf1

diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx
index f78c530..b766f05 100644
--- a/include/vcl/openglwin.hxx
+++ b/include/vcl/openglwin.hxx
@@ -27,6 +27,7 @@ public:
     OpenGLContext* getContext();
 
     virtual void Paint(const Rectangle&) SAL_OVERRIDE {}
+    virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
 
 private:
     boost::scoped_ptr<OpenGLWindowImpl> mpImpl;
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index 3065718..77ab2d9 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -9,6 +9,7 @@
 
 #include <vcl/openglwin.hxx>
 #include <vcl/opengl/OpenGLContext.hxx>
+#include <vcl/event.hxx>
 
 class OpenGLWindowImpl
 {
@@ -44,4 +45,12 @@ OpenGLContext* OpenGLWindow::getContext()
     return mpImpl->getContext();
 }
 
+void OpenGLWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+    Point aPoint = rMEvt.GetPosPixel();
+
+    Color aColor = GetPixel(aPoint);
+    SAL_WARN("vcl.opengl", aColor.GetColor());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 00d7a1e6d48c2ac653567b2d3087eb7fd578f9c6
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 08:23:00 2014 +0200

    remove printf statements
    
    Change-Id: I82de8e5e3c028103f1d2b006124593293f9fe365

diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index f9f5e10..4875241 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -138,7 +138,6 @@ void OpenGL3DRenderer::LoadShaders()
     m_RenderVertexID = glGetAttribLocation(m_RenderProID, "vPosition");
     m_RenderTexCoordID = glGetAttribLocation(m_RenderProID, "texCoord");
     m_RenderTexID = glGetUniformLocation(m_RenderProID, "RenderTex");
-    printf("m_RenderProID = %d, m_RenderVertexID = %d\n", m_RenderProID, m_RenderVertexID);
     CHECK_GL_ERROR();
 }
 
@@ -1587,7 +1586,6 @@ int OpenGL3DRenderer::ProcessExtrude3DPickingBox()
 
     glReadPixels(select.X(), select.Y(), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, selectColor);
     int selectID = GetIndexByColor(selectColor[0], selectColor[1], selectColor[2]);
-//    printf("selectColor[0] = %d, selectColor[1] = %d, selectColor[2] = %d, selectID = %d\n", selectColor[0], selectColor[1], selectColor[2], selectID);
 
     if (selectID == RGB_WHITE)
     {
commit 9eef83885fcb9d207c2c18525dbaaea3ab1f9005
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 08:22:28 2014 +0200

    give each series an own color
    
    Change-Id: Ia74eda050349d34d23e07b8e700aaae97e43d903

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 3775d04..f300989 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -58,6 +58,10 @@ void GL3DBarChart::create3DShapes()
     float nXEnd = 0.0;
     float nYPos = 0.0;
 
+    const Color aSeriesColor[] = {
+        COL_RED, COL_GREEN, COL_YELLOW, COL_BROWN, COL_GRAY
+    };
+
     maShapes.clear();
     maShapes.push_back(new opengl3D::Camera(mpRenderer.get()));
     sal_Int32 nSeriesIndex = 0;
@@ -85,12 +89,12 @@ void GL3DBarChart::create3DShapes()
         aBottomRight.y += aTextSize.getHeight();
         p->setPosition(aTopLeft, aTopRight, aBottomRight);
 
+        sal_Int32 nColor = aSeriesColor[nSeriesIndex % SAL_N_ELEMENTS(aSeriesColor)].GetColor();
         for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex)
         {
             float nVal = rDataSeries.getYValue(nIndex);
             float nXPos = nIndex * (nBarSizeX + nBarDistanceX);
 
-            sal_Int32 nColor = COL_RED;
 
             glm::mat4 aBarPosition;
             aBarPosition = glm::scale(aBarPosition, nBarSizeX, nBarSizeY, nVal);


More information about the Libreoffice-commits mailing list