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

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sat May 10 14:03:30 PDT 2014


 chart2/source/view/inc/GL3DRenderer.hxx  |   38 --------
 chart2/source/view/main/GL3DRenderer.cxx |  146 -------------------------------
 2 files changed, 2 insertions(+), 182 deletions(-)

New commits:
commit 57b52926389d5e729b0922566bd1fc2ce1ddab78
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 22:59:01 2014 +0200

    no need to call clear before destryozing a vector
    
    Change-Id: Ic5013c100520e8949d687ce6b34b83405bdfaf0a

diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index db1a9b8..5185d07 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -707,7 +707,6 @@ void OpenGL3DRenderer::RenderLine3D(Polygon3DInfo &polygon)
         glDrawArrays(GL_LINE_STRIP, 0, pointList->size());
         glDisableVertexAttribArray(m_2DVertexID);
         glBindBuffer(GL_ARRAY_BUFFER, 0);
-        pointList->clear();
         delete pointList;
         polygon.verticesList.pop_front();
     }
@@ -779,9 +778,7 @@ void OpenGL3DRenderer::RenderPolygon3D(Polygon3DInfo &polygon)
         glDisableVertexAttribArray(m_3DVertexID);
         glDisableVertexAttribArray(m_3DNormalID);
         glBindBuffer(GL_ARRAY_BUFFER, 0);
-        pointList->clear();
         delete pointList;
-        normalList->clear();
         delete normalList;
         polygon.verticesList.pop_front();
         polygon.normalsList.pop_front();
@@ -884,6 +881,7 @@ void OpenGL3DRenderer::EndAddShapePolygon3DObject()
     m_Polygon3DInfoList.push_back(m_Polygon3DInfo);
     m_Polygon3DInfo.normals = NULL;
     m_Polygon3DInfo.vertices = NULL;
+    // TODO: moggi: memory leak???
     m_Polygon3DInfo.verticesList.clear();
     m_Polygon3DInfo.normalsList.clear();
 }
commit 4c8e1eaf9c76e0af79efb02fcffe0cc6cb0573e2
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 22:55:02 2014 +0200

    remove unused variable
    
    Change-Id: Ic6455f080fae211d7919d9f6ea35cdbda3ca3757

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 8f2caa0..1a969b4 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -253,8 +253,6 @@ private:
 
     glm::mat4 m_3DView;
 
-    glm::mat4 m_3DViewBack;
-
     glm::mat4 m_3DMVP;
 
     glm::mat4 m_TranslationMatrix;
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 89792a2..db1a9b8 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -1418,7 +1418,6 @@ void OpenGL3DRenderer::CreateSceneBoxView()
                m_CameraInfo.cameraOrg, // and looks at the origin
                m_CameraInfo.cameraUp  // Head is up (set to 0,-1,0 to look upside-down)
                );
-    m_3DViewBack = m_3DView;
 }
 
 void OpenGL3DRenderer::ProcessUnrenderedShape()
commit 1416cfcd6767cb0c0190dc327a2f0ad0a0f0b816
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 22:54:12 2014 +0200

    remove unneccessary flag
    
    Change-Id: I88c7abe0fa428ea6d9b396e77b510088eda09289

diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index ab86007..89792a2 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -63,7 +63,6 @@ GLfloat texCoords[] = {
 
 OpenGL3DRenderer::OpenGL3DRenderer():
     m_TranslationMatrix(glm::translate(m_Model, glm::vec3(0.0f, 0.0f, 0.0f)))
-    , m_bCameraUpdated(false)
     , m_TextProID(0)
     , m_TextMatrixID(0)
     , m_TextVertexID(0)
@@ -792,10 +791,6 @@ void OpenGL3DRenderer::RenderPolygon3D(Polygon3DInfo &polygon)
 
 void OpenGL3DRenderer::RenderPolygon3DObject()
 {
-    if (!m_bCameraUpdated)
-    {
-        return;
-    }
     glDepthMask(GL_FALSE);
     size_t polygonNum = m_Polygon3DInfoList.size();
     for (size_t i = 0; i < polygonNum; i++)
@@ -1424,7 +1419,6 @@ void OpenGL3DRenderer::CreateSceneBoxView()
                m_CameraInfo.cameraUp  // Head is up (set to 0,-1,0 to look upside-down)
                );
     m_3DViewBack = m_3DView;
-    m_bCameraUpdated = true;
 }
 
 void OpenGL3DRenderer::ProcessUnrenderedShape()
commit 097cfcb79ff56a32707bee2f22ebc73f4605f0fb
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 22:53:24 2014 +0200

    remove unimplemented methods from class
    
    Change-Id: Ib050c0c0c699964cad91b184fcc4b3387b171235

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index bc0b8de..8f2caa0 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -159,10 +159,6 @@ public:
     OpenGL3DRenderer();
     ~OpenGL3DRenderer();
 
-    void CreateFrameBufferObj();
-    void CreateTextureObj(int,int);
-    void CreateRenderObj(int, int);
-    void LoadShaders();
     void init();
     void Set3DSenceInfo(sal_Int32 color = 255, bool twoSidesLighting = true);
     void SetLightInfo(bool lightOn, sal_Int32 color, const glm::vec4& direction);
@@ -185,6 +181,7 @@ public:
 private:
     void MoveModelf(PosVecf3& trans,PosVecf3& angle,PosVecf3& scale);
 
+    void LoadShaders();
     void GetFreq();
     void RenderPolygon3DObject();
     void RenderLine3D(Polygon3DInfo &polygon);
commit 67691d3cb651a80bb98b25ce7ba196eb4d2df153
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 22:51:43 2014 +0200

    remove unused pickingFlg
    
    Change-Id: I27b4559a5d2f4a003d31be9cce4d74dfb7b5326c

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 89e9f18..bc0b8de 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -90,7 +90,6 @@ struct Polygon3DInfo
 
 struct Extrude3DInfo
 {
-    int pickingFlg;
     bool rounded;
     bool lineOnly;
     float lineWidth;
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 343f174..ab86007 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -985,7 +985,6 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_Int32 col
 
 void OpenGL3DRenderer::EndAddShape3DExtrudeObject()
 {
-    m_Extrude3DInfo.pickingFlg = 0;
     m_Extrude3DList.push_back(m_Extrude3DInfo);
 }
 
@@ -1467,11 +1466,6 @@ sal_uInt32 OpenGL3DRenderer::GetIndexByColor(sal_uInt32 r, sal_uInt32 g, sal_uIn
 
 void OpenGL3DRenderer::RenderCoordinateAxis()
 {
-    if (!m_coordinateAxisinfo.pickingFlg)
-    {
-        return;
-    }
-
     PosVecf3 angle = {0.0f, 0.0f, 0.0f};
     MoveModelf(m_coordinateAxisinfo.trans, angle, m_coordinateAxisinfo.scale);
     glm::mat4 reverseMatrix = glm::scale(glm::vec3(1.0, m_coordinateAxisinfo.reverse, 1.0));
commit 77adadcb9ab12dd03f0739dc9725ce6bd4d7f2d0
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 22:51:32 2014 +0200

    remove unused methods
    
    Change-Id: Id9e35e171d4235d863a09f6d1d8083d7dbab59c6

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 7e407db..89e9f18 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -204,8 +204,6 @@ private:
     void RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D, int surIndex);
     glm::vec4 GetColorByIndex(int index);
     sal_uInt32 GetIndexByColor(sal_uInt32 r, sal_uInt32 g, sal_uInt32 b);
-    void ProcessPickingBox();
-    int ProcessExtrude3DPickingBox();
     void RenderCoordinateAxis();
     void AddVertexData(GLuint vertexBuf);
     void AddNormalData(GLuint normalBuf);
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index e581d23..343f174 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -20,8 +20,6 @@
 #include <StaticGeometry.h>
 #include "glm/gtc/matrix_inverse.hpp"
 
-#define RGB_WHITE (0xFF | (0xFF << 8) | (0xFF << 16))
-
 #define DEBUG_FBO 0
 
 using namespace com::sun::star;
@@ -1467,109 +1465,6 @@ sal_uInt32 OpenGL3DRenderer::GetIndexByColor(sal_uInt32 r, sal_uInt32 g, sal_uIn
     return r | (g << 8) | (b << 16);
 }
 
-void OpenGL3DRenderer::ProcessPickingBox()
-{
-    glViewport(0, 0, m_iWidth, m_iHeight);
-    glClearDepth(1.0f);
-    glClearColor(1.0, 1.0, 1.0, 1.0);
-    if(ProcessExtrude3DPickingBox() == 1)
-    {
-        //the picked object has been processed, return
-        return ;
-    }
-}
-
-int OpenGL3DRenderer::ProcessExtrude3DPickingBox()
-{
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-    //render the bounding box
-    Extrude3DInfo extrude3DInfo;
-    glUseProgram(m_CommonProID);
-
-    // 1rst attribute buffer : vertices
-    glEnableVertexAttribArray(m_2DVertexID);
-    glBindBuffer(GL_ARRAY_BUFFER, m_BoundBox);
-    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
-                          (void*)0            // array buffer offset
-                          );
-    for (unsigned int i = 0; i < m_Extrude3DList.size(); i++)
-    {
-        extrude3DInfo = m_Extrude3DList[i];
-        extrude3DInfo.yTransform *= m_fHeightWeight;
-        extrude3DInfo.yScale *= m_fHeightWeight;
-        PosVecf3 trans = {extrude3DInfo.xTransform,//m_Extrude3DInfo.xTransform + 140,
-                          -extrude3DInfo.yTransform,
-                          extrude3DInfo.zTransform};
-        PosVecf3 angle = {0.0f, 0.0f, 0.0f};
-        PosVecf3 scale = {extrude3DInfo.xScale,
-                          extrude3DInfo.yScale,
-                          extrude3DInfo.xScale};
-        MoveModelf(trans, angle, scale);
-        glm::mat4 boundMVP = m_3DProjection * m_3DView * m_Model;
-        glm::vec4 boundColor = GetColorByIndex(i);
-        int reverse = 1;
-        if (reverse < 0)
-        {
-            glm::mat4 reverseMatrix = glm::translate(glm::vec3(0.0, -1.0, 0.0));
-            boundMVP = boundMVP * reverseMatrix;
-        }
-        glUniform4fv(m_2DColorID, 1, &boundColor[0]);
-        glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &boundMVP[0][0]);
-
-        glDrawArrays(GL_TRIANGLES, 0, sizeof(boundBox) / sizeof(GLfloat) / 3);
-    }
-    glDisableVertexAttribArray(m_2DVertexID);
-    glUseProgram(0);
-    //read pixel to get the index
-    Point select = Point(m_aMPos.X(), m_aMPos.Y());
-    sal_uInt8 selectColor[4] = {0};
-
-    glReadPixels(select.X(), select.Y(), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, selectColor);
-    int selectID = GetIndexByColor(selectColor[0], selectColor[1], selectColor[2]);
-
-    if (selectID == RGB_WHITE)
-    {
-        if (m_uiSelectFrameCounter <= 0)
-        {
-            m_3DView = m_3DViewBack;
-            m_uiSelectFrameCounter = 0;
-            m_coordinateAxisinfo.pickingFlg = 0;
-        }
-        else
-        {
-            m_uiSelectFrameCounter--;
-        }
-        return 0;
-    }
-
-    extrude3DInfo = m_Extrude3DList[selectID];
-    extrude3DInfo.yTransform *= m_fHeightWeight;
-    extrude3DInfo.yScale *= m_fHeightWeight;
-    int reverse = 1;
-    m_3DView = glm::lookAt(m_CameraInfo.cameraPos, // Camera is at (0,0,3), in World Space
-               m_CameraInfo.cameraOrg, // and looks at the origin
-               m_CameraInfo.cameraUp  // Head is up (set to 0,-1,0 to look upside-down)
-               );
-    m_uiSelectFrameCounter = 5;
-
-    m_coordinateAxisinfo.pickingFlg = 1;
-    m_coordinateAxisinfo.reverse = reverse;
-    m_coordinateAxisinfo.trans.x = extrude3DInfo.xTransform + extrude3DInfo.xScale / 2;
-    m_coordinateAxisinfo.trans.y = -extrude3DInfo.yTransform + (extrude3DInfo.yScale + 1.5) * reverse;
-    m_coordinateAxisinfo.trans.z = extrude3DInfo.zTransform + extrude3DInfo.xScale / 2;
-
-    m_coordinateAxisinfo.scale.x = 4 * extrude3DInfo.xScale;
-    m_coordinateAxisinfo.scale.y = 4 * extrude3DInfo.xScale;
-    m_coordinateAxisinfo.scale.z = 4 * extrude3DInfo.xScale;
-    m_coordinateAxisinfo.color = glm::vec4(0.5, 1.0, 0.8, 1.0);
-    glBindFramebuffer(GL_FRAMEBUFFER, 0);
-    return 1;
-}
-
 void OpenGL3DRenderer::RenderCoordinateAxis()
 {
     if (!m_coordinateAxisinfo.pickingFlg)
commit 9cd4a556445ce248c686a480c8802216e6e3386f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat May 10 22:45:30 2014 +0200

    remove scene box that should not be in the renderer
    
    Change-Id: I3ec69042782aaac2fa2b583dd5a667b91dcdbb88

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 9eb21b2..7e407db 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -154,26 +154,6 @@ struct TextInfo
     float vertex[12];
 };
 
-
-struct SceneBox
-{
-    float maxXCoord;
-    float minXCoord;
-    float maxYCoord;
-    float minYCoord;
-    float maxZCoord;
-    float minZCoord;
-
-    SceneBox():
-        maxXCoord(-1*FLT_MAX),
-        minXCoord(FLT_MAX),
-        maxYCoord(-1*FLT_MAX),
-        minYCoord(FLT_MAX),
-        maxZCoord(-1*FLT_MAX),
-        minZCoord(FLT_MAX) {}
-};
-
-
 class OpenGL3DRenderer
 {
 public:
@@ -198,7 +178,6 @@ public:
     void EndAddShape3DExtrudeObject();
     double GetTime();
     void SetFPS(float fps);
-    void SetClickPos(Point aMPos);
     void RenderClickPos(Point aMPos);
     void SetSize(const Size& rSize);
     void SetCameraInfo(glm::vec3 pos, glm::vec3 direction, glm::vec3 up);
@@ -370,13 +349,6 @@ private:
     GLint m_RenderVertexID;
 
     GLint m_RenderTexCoordID;
-    //TODO: moggi: kill the following parts
-    // don't add anything below or I will remove it
-#if 0
-    size_t m_iPointNum;
-#endif
-
-    SceneBox m_SenceBox;
 
     float m_fViewAngle;
 
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 412d401..e581d23 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -924,17 +924,7 @@ void OpenGL3DRenderer::AddPolygon3DObjectPoint(float x, float y, float z)
     float actualX = x;
     float actualY = y;
     float actualZ = z;
-    float maxCoord = std::max(actualX, std::max(actualY, actualZ));
-    m_fZmax = std::max(maxCoord, m_fZmax);
     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()
@@ -993,15 +983,6 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_Int32 col
     m_Vertices.clear();
     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()
@@ -1283,11 +1264,6 @@ void OpenGL3DRenderer::SetFPS(float fps)
     m_fFPS = fps;
 }
 
-void OpenGL3DRenderer::SetClickPos(Point aMPos)
-{
-    m_aMPos = aMPos;
-}
-
 void OpenGL3DRenderer::CreateTextTexture(const BitmapEx& rBitmapEx, glm::vec3 vTopLeft,glm::vec3 vTopRight, glm::vec3 vBottomRight, glm::vec3 vBottomLeft)
 {
     long bmpWidth = rBitmapEx.GetSizePixel().Width();


More information about the Libreoffice-commits mailing list