[Libreoffice-commits] core.git: 7 commits - chart2/source sc/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sat May 24 08:43:21 PDT 2014


 chart2/source/view/charttypes/GL3DBarChart.cxx |   49 +++++++++++++++++++++--
 chart2/source/view/inc/3DChartObjects.hxx      |   19 ++++++++-
 chart2/source/view/inc/GL3DBarChart.hxx        |    7 +++
 chart2/source/view/inc/GL3DRenderer.hxx        |   10 ----
 chart2/source/view/main/3DChartObjects.cxx     |   36 +++++++++++++----
 chart2/source/view/main/GL3DRenderer.cxx       |   52 ++-----------------------
 sc/source/ui/view/viewdata.cxx                 |    8 ---
 7 files changed, 101 insertions(+), 80 deletions(-)

New commits:
commit 9ef8f82cb933f598d6bc9641f6bb937fce103ec9
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 24 17:35:41 2014 +0200

    much improved camera control for 3D chart
    
    Change-Id: I5acc481db01e2ea66c11933ec05f222858ba36f9

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index dbf0310..db1dc5b 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -54,6 +54,23 @@ float calculateTextWidth(const OUString& rText)
     return rText.getLength() * 10;
 }
 
+double findMaxValue(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer)
+{
+    double nMax = 0.0;
+    for (boost::ptr_vector<VDataSeries>::const_iterator itr = rDataSeriesContainer.begin(),
+            itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr)
+    {
+        const VDataSeries& rDataSeries = *itr;
+        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;
+}
+
 }
 
 void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
@@ -85,6 +102,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
     mpCamera = static_cast<opengl3D::Camera*>(&maShapes.back());
 
     sal_Int32 nSeriesIndex = 0;
+    sal_Int32 nMaxPointCount = 0;
+    double nMaxVal = findMaxValue(rDataSeriesContainer)/100;
     for (boost::ptr_vector<VDataSeries>::const_iterator itr = rDataSeriesContainer.begin(),
             itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr)
     {
@@ -92,6 +111,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
 
         const VDataSeries& rDataSeries = *itr;
         sal_Int32 nPointCount = rDataSeries.getTotalPointCount();
+        nMaxPointCount = std::max(nMaxPointCount, nPointCount);
 
         bool bMappedFillProperty = rDataSeries.hasPropertyMapping("FillColor");
 
@@ -126,8 +146,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
             float nVal = rDataSeries.getYValue(nIndex);
             float nXPos = nIndex * (nBarSizeX + nBarDistanceX) + nBarDistanceX;
 
-
-            glm::mat4 aScaleMatrix = glm::scale(nBarSizeX, nBarSizeY, nVal);
+            glm::mat4 aScaleMatrix = glm::scale(nBarSizeX, nBarSizeY, float(nVal/nMaxVal));
             glm::mat4 aTranslationMatrix = glm::translate(nXPos, nYPos, 0.0f);
             glm::mat4 aBarPosition = aTranslationMatrix * aScaleMatrix;
 
@@ -207,6 +226,10 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
         aBottomRight.y = -calculateTextWidth(aCats[i]) - 0.5 * nBarDistanceY;
         p->setPosition(aTopLeft, aTopRight, aBottomRight);
     }
+
+    maCameraPosition = glm::vec3(-30, -30, 200);
+    mpCamera->setPosition(maCameraPosition);
+    mpCamera->setDirection(glm::vec3(nMaxPointCount*(nBarSizeX+ nBarDistanceX), nSeriesIndex*(nBarSizeY+nBarDistanceY), 0));
 }
 
 void GL3DBarChart::render()
diff --git a/chart2/source/view/inc/3DChartObjects.hxx b/chart2/source/view/inc/3DChartObjects.hxx
index c92a435..1530dfc 100644
--- a/chart2/source/view/inc/3DChartObjects.hxx
+++ b/chart2/source/view/inc/3DChartObjects.hxx
@@ -115,6 +115,9 @@ public:
     Camera(OpenGL3DRenderer* pRenderer);
     virtual void render() SAL_OVERRIDE;
 
+    void setPosition(const glm::vec3& rPos);
+    void setDirection(const glm::vec3& rPos);
+
     /// Zooms the camera towards the bar with Unique Id nId.
     void zoom(sal_uInt32 nId);
 
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 15fffde..0ca4e23 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -16,6 +16,8 @@
 #include <boost/ptr_container/ptr_vector.hpp>
 #include "VDataSeries.hxx"
 
+#include <glm/glm.hpp>
+
 #include <vcl/openglwin.hxx>
 
 namespace chart {
@@ -61,6 +63,8 @@ private:
     bool mbValidContext;
 
     boost::scoped_ptr<opengl3D::TextCache> mpTextCache;
+
+    glm::vec3 maCameraPosition;
 };
 
 }
diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx
index ea20774..c77a273 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -186,6 +186,16 @@ 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;
+}
+
 void Camera::zoom(sal_uInt32 /*nId*/)
 {
     // TODO here
commit 20e4e65b656e3c47d2a0115ed3f17dabcb8d30da
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 24 16:44:00 2014 +0200

    add a text cache to improve rendering performance
    
    Change-Id: I5b3fbe9476f0eafed4524f57aa7bf65dfd029c1d

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 7a3d311..dbf0310 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -30,7 +30,8 @@ GL3DBarChart::GL3DBarChart(
     mpRenderer(new opengl3D::OpenGL3DRenderer()),
     mrWindow(rWindow),
     mpCamera(NULL),
-    mbValidContext(true)
+    mbValidContext(true),
+    mpTextCache(new opengl3D::TextCache())
 {
     Size aSize = mrWindow.GetSizePixel();
     mpRenderer->SetSize(aSize);
@@ -101,7 +102,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
 
         if(!aSeriesName.isEmpty())
         {
-            maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aSeriesName, nId++));
+            maShapes.push_back(new opengl3D::Text(mpRenderer.get(),
+                        *mpTextCache, aSeriesName, nId++));
             opengl3D::Text* p = static_cast<opengl3D::Text*>(&maShapes.back());
             glm::vec3 aTopLeft, aTopRight, aBottomRight;
             aTopLeft.x = -nBarDistanceY;
@@ -181,7 +183,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
 
         float nXPos = i * (nBarSizeX + nBarDistanceX);
 
-        maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aCats[i], nId++));
+        maShapes.push_back(new opengl3D::Text(mpRenderer.get(), *mpTextCache,
+                    aCats[i], nId++));
         opengl3D::Text* p = static_cast<opengl3D::Text*>(&maShapes.back());
         aTopLeft.x = nXPos + TEXT_HEIGHT;
         aTopLeft.y = nYPos + calculateTextWidth(aCats[i]) + 0.5 * nBarDistanceY;
@@ -193,7 +196,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
 
         // create shapes on other side as well
 
-        maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aCats[i], nId++));
+        maShapes.push_back(new opengl3D::Text(mpRenderer.get(), *mpTextCache,
+                    aCats[i], nId++));
         p = static_cast<opengl3D::Text*>(&maShapes.back());
         aTopLeft.x = nXPos + TEXT_HEIGHT;
         aTopLeft.y =  - 0.5 * nBarDistanceY;
diff --git a/chart2/source/view/inc/3DChartObjects.hxx b/chart2/source/view/inc/3DChartObjects.hxx
index f8138aa..c92a435 100644
--- a/chart2/source/view/inc/3DChartObjects.hxx
+++ b/chart2/source/view/inc/3DChartObjects.hxx
@@ -14,10 +14,22 @@
 #include <vcl/opengl/OpenGLContext.hxx>
 #include "GL3DRenderer.hxx"
 
+#include <boost/ptr_container/ptr_map.hpp>
+
 namespace chart {
 
 namespace opengl3D {
 
+class TextCache
+{
+public:
+    const BitmapEx& getText(OUString rText);
+private:
+    typedef boost::ptr_map<OUString, BitmapEx> TextCacheType;
+
+    TextCacheType maTextCache;
+};
+
 class Renderable3DObject
 {
 public:
@@ -65,7 +77,7 @@ private:
 class Text : public Renderable3DObject
 {
 public:
-    Text(OpenGL3DRenderer* pRenderer, const OUString& rStr, sal_uInt32 nId);
+    Text(OpenGL3DRenderer* pRenderer, TextCache& rTextCache, const OUString& rStr, sal_uInt32 nId);
     virtual void render() SAL_OVERRIDE;
 
     Size getSize() const;
@@ -73,7 +85,7 @@ public:
     void setPosition(const glm::vec3& rTopLeft, const glm::vec3& rTopRight, const glm::vec3& rBottomRight);
 
 private:
-    BitmapEx maText;
+    const BitmapEx& mrText;
     glm::vec3 maTopLeft;
     glm::vec3 maTopRight;
     glm::vec3 maBottomRight;
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 674daf6..15fffde 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -26,6 +26,7 @@ namespace opengl3D {
 
 class Renderable3DObject;
 class OpenGL3DRenderer;
+class TextCache;
 class Camera;
 
 }
@@ -58,6 +59,8 @@ private:
 
     opengl3D::Camera* mpCamera;
     bool mbValidContext;
+
+    boost::scoped_ptr<opengl3D::TextCache> mpTextCache;
 };
 
 }
diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx
index bf8c10b..ea20774 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -68,10 +68,12 @@ void Line::setLineColor(const Color& rColor)
     maLineColor = rColor;
 }
 
-Text::Text(OpenGL3DRenderer* pRenderer, const OUString& rStr, sal_uInt32 nId):
-    Renderable3DObject(pRenderer, nId)
+const BitmapEx& TextCache::getText(OUString rText)
 {
-    // Convert OUString to BitmapEx.
+    TextCacheType::const_iterator itr = maTextCache.find(rText);
+    if(itr != maTextCache.end())
+        return *itr->second;
+
     VirtualDevice aDevice(*Application::GetDefaultDevice(), 0, 0);
     Font aFont = aDevice.GetFont();
     aFont.SetSize(Size(0, 96));
@@ -79,27 +81,35 @@ Text::Text(OpenGL3DRenderer* pRenderer, const OUString& rStr, sal_uInt32 nId):
     ::Rectangle aRect;
     aDevice.SetFont(aFont);
     aDevice.Erase();
-    aDevice.GetTextBoundRect(aRect, rStr);
+    aDevice.GetTextBoundRect(aRect, rText);
     Size aSize = aRect.GetSize();
     aSize.Width() += 5;
     aSize.Height() *= 1.6;
     aDevice.SetOutputSizePixel(aSize);
     aDevice.SetBackground(Wallpaper(COL_TRANSPARENT));
-    aDevice.DrawText(Point(0,0), rStr);
+    aDevice.DrawText(Point(0,0), rText);
 
-    maText = BitmapEx(aDevice.GetBitmapEx(Point(0,0), aSize));
+    BitmapEx* pText = new BitmapEx(aDevice.GetBitmapEx(Point(0,0), aSize));
+    maTextCache.insert(rText, pText);
+    return *pText;
+}
+
+Text::Text(OpenGL3DRenderer* pRenderer, TextCache& rTextCache, const OUString& rStr, sal_uInt32 nId):
+    Renderable3DObject(pRenderer, nId),
+    mrText(rTextCache.getText(rStr))
+{
 }
 
 void Text::render()
 {
     glm::vec3 dir2 = maTopRight - maTopLeft;
     glm::vec3 bottomLeft = maBottomRight - dir2;
-    mpRenderer->CreateTextTexture(maText, maTopLeft, maTopRight, maBottomRight, bottomLeft, mnUniqueId);
+    mpRenderer->CreateTextTexture(mrText, maTopLeft, maTopRight, maBottomRight, bottomLeft, mnUniqueId);
 }
 
 Size Text::getSize() const
 {
-    return maText.GetSizePixel();
+    return mrText.GetSizePixel();
 }
 
 void Text::setPosition(const glm::vec3& rTopLeft, const glm::vec3& rTopRight, const glm::vec3& rBottomRight)
commit 4f8d97753fb48da181c5e7aa277c1d26f092d2ae
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 24 15:38:53 2014 +0200

    fix chart background color
    
    Change-Id: I4bda3201dff1094a7fd646c620b016532a4fbc77

diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 555ee73..b49aa4c 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -1520,7 +1520,7 @@ void OpenGL3DRenderer::ProcessUnrenderedShape()
 {
     glViewport(0, 0, m_iWidth, m_iHeight);
     glClearDepth(1.0f);
-    glClearColor(1.0, 0.0, 1.0, 1.0);
+    glClearColor(1.0, 1.0, 1.0, 1.0);
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     CreateSceneBoxView();
     //Polygon
commit ead6136ba9a5eff7df2c7f094e8fc4d3f5d2428f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 24 15:35:30 2014 +0200

    add text on both sides of the chart
    
    Change-Id: I12d5f5e92bf908bc6d8fbd0e88293e1fcaa31c96

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 6d0b6d7..7a3d311 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -190,6 +190,18 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
         aBottomRight.x = nXPos;
         aBottomRight.y = nYPos + 0.5 * nBarDistanceY;
         p->setPosition(aTopLeft, aTopRight, aBottomRight);
+
+        // create shapes on other side as well
+
+        maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aCats[i], nId++));
+        p = static_cast<opengl3D::Text*>(&maShapes.back());
+        aTopLeft.x = nXPos + TEXT_HEIGHT;
+        aTopLeft.y =  - 0.5 * nBarDistanceY;
+        aTopRight = aTopLeft;
+        aTopRight.y = -calculateTextWidth(aCats[i]) - 0.5* nBarDistanceY;
+        aBottomRight.x = nXPos;
+        aBottomRight.y = -calculateTextWidth(aCats[i]) - 0.5 * nBarDistanceY;
+        p->setPosition(aTopLeft, aTopRight, aBottomRight);
     }
 }
 
commit 72dcc910a07ea1392c243dbf44674622bf79b871
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 24 15:24:57 2014 +0200

    remove camera positioning from OpenGL code
    
    Change-Id: I70a654282e8b187bc3d78041c44af17a11b4a622

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index cf19979..0fcf437 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -142,15 +142,6 @@ struct TextInfo
     float vertex[12];
 };
 
-typedef struct SceneBox{
-    float maxXCoord;
-    float minXCoord;
-    float maxYCoord;
-    float minYCoord;
-    float maxZCoord;
-    float minZCoord;
-}SceneBox;
-
 class OpenGL3DRenderer
 {
 public:
@@ -385,7 +376,6 @@ private:
     float m_fHeightWeight;
 
     bool mbPickingMode;
-    SceneBox m_SenceBox;
 
     GLuint mnPickingFbo;
     GLuint mnPickingRboDepth;
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 3404e6b..555ee73 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -23,8 +23,6 @@
 
 #define DEBUG_FBO 0
 
-#define GL_PI 3.14159f
-
 using namespace com::sun::star;
 
 namespace chart {
@@ -88,12 +86,6 @@ OpenGL3DRenderer::OpenGL3DRenderer():
 
     GetFreq();
     m_RoundBarMesh.iMeshSizes = 0;
-    m_SenceBox.maxXCoord = -1.0 * FLT_MAX;
-    m_SenceBox.minXCoord = FLT_MAX;
-    m_SenceBox.maxYCoord =  -1.0 * FLT_MAX;
-    m_SenceBox.minYCoord = FLT_MAX;
-    m_SenceBox.maxZCoord =  -1.0 * FLT_MAX;
-    m_SenceBox.minZCoord = FLT_MAX;
 }
 
 OpenGL3DRenderer::~OpenGL3DRenderer()
@@ -958,12 +950,6 @@ void OpenGL3DRenderer::AddPolygon3DObjectPoint(float x, float y, float z)
     float actualY = y;
     float actualZ = z;
     m_Polygon3DInfo.vertices->push_back(glm::vec3(actualX, actualY, actualZ));
-    m_SenceBox.maxXCoord = std::max(m_SenceBox.maxXCoord, actualX);
-    m_SenceBox.minXCoord = std::min(m_SenceBox.minXCoord, actualX);
-    m_SenceBox.maxYCoord = std::max(m_SenceBox.maxYCoord, actualY);
-    m_SenceBox.minYCoord = std::min(m_SenceBox.minYCoord, actualY);
-    m_SenceBox.maxZCoord = std::max(m_SenceBox.maxZCoord, actualZ);
-    m_SenceBox.minZCoord = std::min(m_SenceBox.minZCoord, actualZ);
 }
 
 void OpenGL3DRenderer::EndAddPolygon3DObjectPoint()
@@ -1017,12 +1003,6 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_uInt32 nC
         m_Normals.clear();
         m_Indeices.clear();
     }
-    m_SenceBox.maxXCoord = std::max(m_SenceBox.maxXCoord, m_Extrude3DInfo.xTransform + m_Extrude3DInfo.xScale);
-    m_SenceBox.minXCoord = std::min(m_SenceBox.minXCoord, m_Extrude3DInfo.xTransform);
-    m_SenceBox.maxYCoord = std::max(m_SenceBox.maxYCoord, m_Extrude3DInfo.yTransform + m_Extrude3DInfo.yScale);
-    m_SenceBox.minYCoord = std::min(m_SenceBox.minYCoord, m_Extrude3DInfo.yTransform );
-    m_SenceBox.maxZCoord = std::max(m_SenceBox.maxZCoord, m_Extrude3DInfo.zTransform + m_Extrude3DInfo.zScale);
-    m_SenceBox.minZCoord = std::min(m_SenceBox.minZCoord, m_Extrude3DInfo.zTransform);
 }
 
 void OpenGL3DRenderer::EndAddShape3DExtrudeObject()
@@ -1531,38 +1511,16 @@ void OpenGL3DRenderer::RenderClickPos(Point aMPos)
 
 void OpenGL3DRenderer::CreateSceneBoxView()
 {
-//original code start
     m_3DView = glm::lookAt(m_CameraInfo.cameraPos,
                m_CameraInfo.cameraOrg,
                m_CameraInfo.cameraUp);
-//original code end
-    float senceBoxWidth = m_SenceBox.maxXCoord - m_SenceBox.minXCoord;
-    float senceBoxHeight = m_SenceBox.maxZCoord - m_SenceBox.minZCoord;
-    float senceBoxDepth = m_SenceBox.maxYCoord - m_SenceBox.minYCoord;
-    float distanceY = m_SenceBox.maxYCoord + senceBoxWidth / 2 / tan(m_fViewAngle / 2 * GL_PI / 180.0f);
-    float veriticalAngle = atan((float)m_iHeight / (float)m_iWidth);
-    float distance = distanceY / cos(veriticalAngle);
-    float horizontalAngle = 0;
-    m_fHeightWeight = senceBoxWidth * (float)m_iHeight / (float)m_iWidth / senceBoxHeight;
-    m_SenceBox.maxZCoord *= m_fHeightWeight;
-    m_SenceBox.minZCoord *= m_fHeightWeight;
-    m_CameraInfo.cameraOrg = glm::vec3(m_SenceBox.minXCoord + senceBoxWidth / 2,
-                                       m_SenceBox.minYCoord + senceBoxDepth / 2,
-                                       m_SenceBox.minZCoord + senceBoxHeight * m_fHeightWeight/ 2);    //update the camera position and org
-    m_CameraInfo.cameraPos.x = m_CameraInfo.cameraOrg.x + distance * cos(veriticalAngle) * sin(horizontalAngle);
-    m_CameraInfo.cameraPos.y = m_CameraInfo.cameraOrg.y + distance * cos(veriticalAngle) * cos(horizontalAngle);
-    m_CameraInfo.cameraPos.z = m_CameraInfo.cameraOrg.z + distance * sin(veriticalAngle);
-    m_3DView = glm::lookAt(m_CameraInfo.cameraPos,
-                            m_CameraInfo.cameraOrg,
-                            m_CameraInfo.cameraUp
-                            );
 }
 
 void OpenGL3DRenderer::ProcessUnrenderedShape()
 {
     glViewport(0, 0, m_iWidth, m_iHeight);
     glClearDepth(1.0f);
-    glClearColor(1.0, 1.0, 1.0, 1.0);
+    glClearColor(1.0, 0.0, 1.0, 1.0);
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     CreateSceneBoxView();
     //Polygon
commit 9cff642cd51bc70327789f9dc64349bb9b4cb3ea
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 24 12:24:49 2014 +0200

    remove whitespace
    
    Change-Id: Ia8b664f09da0008bde48e55a144e63965dd00609

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 90f1377..d77d8cd 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -17,11 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include "scitems.hxx"
 #include <editeng/eeitem.hxx>
 
-
 #include <sfx2/viewfrm.hxx>
 #include <editeng/adjustitem.hxx>
 #include <svx/algitem.hxx>
@@ -442,7 +440,6 @@ void ScViewData::InitData( ScDocument* pDocument )
     *pOptions = pDoc->GetViewOptions();
 }
 
-
 ScDocument* ScViewData::GetDocument() const
 {
     if (pDoc)
@@ -1611,10 +1608,7 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
     return Point( nScrPosX, nScrPosY );
 }
 
-
 //      Number of cells on a screen
-
-
 SCCOL ScViewData::CellsAtX( SCsCOL nPosX, SCsCOL nDir, ScHSplitPos eWhichX, sal_uInt16 nScrSizeX ) const
 {
     OSL_ENSURE( nDir==1 || nDir==-1, "falscher CellsAt Aufruf" );
@@ -1715,7 +1709,6 @@ SCROW ScViewData::PrevCellsY( ScVSplitPos eWhichY ) const
     return CellsAtY( GetPosY( eWhichY ), -1, eWhichY, SC_SIZE_NONE );
 }
 
-
 bool ScViewData::GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix ) const
 {
     const ScMergeAttr* pMerge = (const ScMergeAttr*) pDoc->GetAttr( nX,nY,nTabNo, ATTR_MERGE );
@@ -3090,7 +3083,6 @@ void ScViewData::AddPixelsWhile( long & rScrY, long nEndPixels, SCROW & rPosY,
     rPosY = nRow;
 }
 
-
 void ScViewData::AddPixelsWhileBackward( long & rScrY, long nEndPixels,
         SCROW & rPosY, SCROW nStartRow, double nPPTY, const ScDocument * pDoc,
         SCTAB nTabNo )
commit 904eb232d2df83d72957a93c624edbab0730cc10
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu May 22 17:27:35 2014 +0200

    Revert "add reverse bars code"
    
    This reverts commit 07ef1602dfc48301031dc92d1795a42c2b6d8769.

diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index ffd89ad..3404e6b 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -349,7 +349,7 @@ void OpenGL3DRenderer::CreateActualRoundedCube(float fRadius, int iSubDivY, int
     glm::vec3 actualNormals[3];
     std::vector<unsigned short> indeices[5];
     glm::vec3 externSurNormal;
-    glm::mat4 corrctCoord = glm::translate(glm::vec3(0.0f, 0.0f, depth / 2.0f - fRadius));
+    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();
@@ -979,14 +979,13 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_uInt32 nC
     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);
-    float crossZ = glm::normalize(glm::dot(glm::vec3(DirZ), glm::vec3(0.0, 0.0, 1.0)));
-    m_Extrude3DInfo.reverse = (crossZ > 0 ? 0 : 1);
     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(m_Extrude3DInfo.xScale, m_Extrude3DInfo.yScale, m_Extrude3DInfo.zScale * crossZ));
+    glm::mat4 scaleMatrixInverse = glm::inverse(glm::scale(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
@@ -1022,8 +1021,8 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_uInt32 nC
     m_SenceBox.minXCoord = std::min(m_SenceBox.minXCoord, m_Extrude3DInfo.xTransform);
     m_SenceBox.maxYCoord = std::max(m_SenceBox.maxYCoord, m_Extrude3DInfo.yTransform + m_Extrude3DInfo.yScale);
     m_SenceBox.minYCoord = std::min(m_SenceBox.minYCoord, m_Extrude3DInfo.yTransform );
-    m_SenceBox.maxZCoord = std::max(m_SenceBox.maxZCoord, m_Extrude3DInfo.zTransform - (m_Extrude3DInfo.reverse - 1) * m_Extrude3DInfo.zScale);
-    m_SenceBox.minZCoord = std::min(m_SenceBox.minZCoord, m_Extrude3DInfo.zTransform - m_Extrude3DInfo.reverse * m_Extrude3DInfo.zScale);
+    m_SenceBox.maxZCoord = std::max(m_SenceBox.maxZCoord, m_Extrude3DInfo.zTransform + m_Extrude3DInfo.zScale);
+    m_SenceBox.minZCoord = std::min(m_SenceBox.minZCoord, m_Extrude3DInfo.zTransform);
 }
 
 void OpenGL3DRenderer::EndAddShape3DExtrudeObject()
@@ -1131,7 +1130,7 @@ void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D
     }
     else
     {
-        glm::mat4 topTrans = glm::translate(glm::vec3(0.0, 0.0, -actualZTrans));
+        glm::mat4 topTrans = glm::translate(glm::vec3(0.0, 0.0, actualZTrans));
         glm::mat4 topScale = glm::scale(xyScale, xyScale, xyScale);
         glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
         m_Model = aTranslationMatrix * extrude3D.rotation * topTrans * topScale;
@@ -1352,6 +1351,7 @@ void OpenGL3DRenderer::RenderExtrude3DObject()
             CHECK_GL_ERROR();
             glBindBuffer(GL_UNIFORM_BUFFER, 0);
         }
+        extrude3DInfo.reverse = 0;
         if (extrude3DInfo.rounded)
         {
             glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_CubeElementBuf);


More information about the Libreoffice-commits mailing list