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

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


 chart2/source/view/inc/3DChartObjects.hxx  |    2 
 chart2/source/view/inc/GL3DRenderer.hxx    |   38 ------
 chart2/source/view/inc/StaticGeometry.h    |   48 ++++++-
 chart2/source/view/main/3DChartObjects.cxx |   15 +-
 chart2/source/view/main/GL3DRenderer.cxx   |  179 +++++++++++++----------------
 5 files changed, 136 insertions(+), 146 deletions(-)

New commits:
commit 51d5062642189ff5a4330903253c012e83e5ef1f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun May 11 06:11:01 2014 +0200

    separate rounded corner bar and normal bar rendering
    
    This makes it much easier to debug problems.
    
    Change-Id: I0ba10f6d24cca54be724639074bfd3fac59d37e5

diff --git a/chart2/source/view/inc/3DChartObjects.hxx b/chart2/source/view/inc/3DChartObjects.hxx
index 8571fd8..f8138aa 100644
--- a/chart2/source/view/inc/3DChartObjects.hxx
+++ b/chart2/source/view/inc/3DChartObjects.hxx
@@ -37,7 +37,7 @@ protected:
 class Bar : public Renderable3DObject
 {
 public:
-    Bar(OpenGL3DRenderer* pRenderer, const glm::mat4& rPosition, sal_Int32 nColor, sal_uInt32 nId);
+    Bar(OpenGL3DRenderer* pRenderer, const glm::mat4& rPosition, sal_uInt32 nColor, sal_uInt32 nId);
 
     virtual void render() SAL_OVERRIDE;
 private:
diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 5337384..7840a02 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -90,7 +90,6 @@ struct Polygon3DInfo
 
 struct Extrude3DInfo
 {
-    bool rounded;
     bool twoSidesLighting;
     glm::vec4 extrudeColor;
     float xScale;
@@ -157,7 +156,7 @@ public:
     void EndAddPolygon3DObjectNormalPoint();
     void AddPolygon3DObjectPoint(float x, float y, float z);
     void EndAddPolygon3DObjectPoint();
-    void AddShape3DExtrudeObject(bool roundedCorner, sal_Int32 color, sal_Int32 specular, glm::mat4 modelMatrix);
+    void AddShape3DExtrudeObject(sal_Int32 color, sal_Int32 specular, glm::mat4 modelMatrix);
     void EndAddShape3DExtrudeObject();
     double GetTime();
     void SetFPS(float fps);
@@ -166,6 +165,8 @@ public:
     void SetCameraInfo(glm::vec3 pos, glm::vec3 direction, glm::vec3 up);
     void CreateTextTexture(const BitmapEx& rBitmapEx, glm::vec3 vTopLeft,glm::vec3 vTopRight, glm::vec3 vBottomRight, glm::vec3 vBottomLeft);
     void ProcessUnrenderedShape();
+    void RenderNonRoundedBar(const glm::mat4& rModelMatrix, sal_uInt32 nColor);
+
 private:
     void MoveModelf(PosVecf3& trans,PosVecf3& angle,PosVecf3& scale);
 
@@ -189,7 +190,6 @@ private:
     void AddVertexData(GLuint vertexBuf);
     void AddNormalData(GLuint normalBuf);
     void AddIndexData(GLuint indexBuf);
-    void RenderNonRoundedBar(const Extrude3DInfo& extrude3D);
     bool GetSimilarVertexIndex(PackedVertex & packed,
         std::map<PackedVertex,unsigned short> & VertexToOutIndex,
         unsigned short & result
diff --git a/chart2/source/view/inc/StaticGeometry.h b/chart2/source/view/inc/StaticGeometry.h
index bdc8fe7..d3d5926 100644
--- a/chart2/source/view/inc/StaticGeometry.h
+++ b/chart2/source/view/inc/StaticGeometry.h
@@ -130,6 +130,45 @@ static GLfloat squareVertices[] = {
     -1.0f,  1.0f, -1.0
 };
 
+static const GLfloat cubeVertices[] = {
+    -1.0f,-1.0f,-1.0f,
+    -1.0f,-1.0f, 1.0f,
+    -1.0f, 1.0f, 1.0f,
+    1.0f, 1.0f,-1.0f,
+    -1.0f,-1.0f,-1.0f,
+    -1.0f, 1.0f,-1.0f,
+    1.0f,-1.0f, 1.0f,
+    -1.0f,-1.0f,-1.0f,
+    1.0f,-1.0f,-1.0f,
+    1.0f, 1.0f,-1.0f,
+    1.0f,-1.0f,-1.0f,
+    -1.0f,-1.0f,-1.0f,
+    -1.0f,-1.0f,-1.0f,
+    -1.0f, 1.0f, 1.0f,
+    -1.0f, 1.0f,-1.0f,
+    1.0f,-1.0f, 1.0f,
+    -1.0f,-1.0f, 1.0f,
+    -1.0f,-1.0f,-1.0f,
+    -1.0f, 1.0f, 1.0f,
+    -1.0f,-1.0f, 1.0f,
+    1.0f,-1.0f, 1.0f,
+    1.0f, 1.0f, 1.0f,
+    1.0f,-1.0f,-1.0f,
+    1.0f, 1.0f,-1.0f,
+    1.0f,-1.0f,-1.0f,
+    1.0f, 1.0f, 1.0f,
+    1.0f,-1.0f, 1.0f,
+    1.0f, 1.0f, 1.0f,
+    1.0f, 1.0f,-1.0f,
+    -1.0f, 1.0f,-1.0f,
+    1.0f, 1.0f, 1.0f,
+    -1.0f, 1.0f,-1.0f,
+    -1.0f, 1.0f, 1.0f,
+    1.0f, 1.0f, 1.0f,
+    -1.0f, 1.0f, 1.0f,
+    1.0f,-1.0f, 1.0f
+};
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx
index f46933e..0aeec40 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -47,9 +47,9 @@ void Renderable3DObject::render()
     (void) mnUniqueId;
 }
 
-Bar::Bar(OpenGL3DRenderer* pRenderer, const glm::mat4& rPosition, sal_Int32 aColor, sal_uInt32 nId)
+Bar::Bar(OpenGL3DRenderer* pRenderer, const glm::mat4& rPosition, sal_uInt32 aColor, sal_uInt32 nId)
     : Renderable3DObject(pRenderer, nId)
-    , mbRoundedCorners(true)
+    , mbRoundedCorners(false)
     , maPos(rPosition)
     , maColor(aColor)
 {
@@ -58,8 +58,15 @@ Bar::Bar(OpenGL3DRenderer* pRenderer, const glm::mat4& rPosition, sal_Int32 aCol
 
 void Bar::render()
 {
-    mpRenderer->AddShape3DExtrudeObject(mbRoundedCorners, (sal_Int32)maColor.GetColor(), 0xFFFFFF, maPos);
-    mpRenderer->EndAddShape3DExtrudeObject();
+    if(mbRoundedCorners)
+    {
+        mpRenderer->AddShape3DExtrudeObject((sal_Int32)maColor.GetColor(), 0xFFFFFF, maPos);
+        mpRenderer->EndAddShape3DExtrudeObject();
+    }
+    else
+    {
+        mpRenderer->RenderNonRoundedBar(maPos, maColor.GetColor());
+    }
 }
 
 Line::Line(OpenGL3DRenderer* pRenderer, sal_uInt32 nId):
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index e8de12b..c92d878 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -919,7 +919,7 @@ void OpenGL3DRenderer::EndAddPolygon3DObjectPoint()
     m_Polygon3DInfo.vertices = NULL;
 }
 
-void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_Int32 color,sal_Int32 specular, glm::mat4 modelMatrix)
+void OpenGL3DRenderer::AddShape3DExtrudeObject(sal_Int32 color,sal_Int32 specular, glm::mat4 modelMatrix)
 {
     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);
@@ -953,8 +953,7 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_Int32 col
     m_Extrude3DInfo.yTransform = tranform.y;
     m_Extrude3DInfo.zTransform = tranform.z;
 //    m_Extrude3DInfo.zTransform = 0;
-    m_Extrude3DInfo.rounded = roundedCorner;
-    if (m_Extrude3DInfo.rounded && (m_RoundBarMesh.iMeshSizes == 0))
+    if (m_RoundBarMesh.iMeshSizes == 0)
     {
         CreateActualRoundedCube(0.1f, 30, 30, 1.0f, 1.2f, m_Extrude3DInfo.zScale / m_Extrude3DInfo.xScale);
         AddVertexData(m_CubeVertexBuf);
@@ -1144,26 +1143,75 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
     RenderExtrudeFlatSurface(extrude3D, FLAT_BOTTOM_SURFACE);
 }
 
-void OpenGL3DRenderer::RenderNonRoundedBar(const Extrude3DInfo& extrude3D)
+namespace {
+
+glm::vec4 getColorAsVector(sal_uInt32 nColor)
 {
-    float xScale = extrude3D.xScale;
-    float yScale = extrude3D.yScale;
-    float zScale = extrude3D.zScale;
-    glUniformMatrix4fv(m_3DViewID, 1, GL_FALSE, &m_3DView[0][0]);
-    glUniformMatrix4fv(m_3DProjectionID, 1, GL_FALSE, &m_3DProjection[0][0]);
-    glm::mat4 transformMatrix = glm::translate(glm::vec3(extrude3D.xTransform, -extrude3D.yTransform, extrude3D.zTransform));
-    glm::mat4 scaleMatrix = glm::scale(xScale, yScale, zScale);
-    m_Model = transformMatrix * extrude3D.rotation * scaleMatrix;
-    if (extrude3D.reverse)
+    sal_uInt8 nRed = sal_uInt8((nColor & 0xFF0000) >> 16);
+    sal_uInt8 nGreen = sal_uInt8((nColor & 0xFF00) >> 8);
+    sal_uInt8 nBlue = sal_uInt8((nColor & 0xFF));
+    sal_uInt8 nAlpha = sal_uInt8((nColor & 0xFF000000) >> 24);
+    return glm::vec4(nRed/255.0, nGreen/255.0, nBlue/255.0, nAlpha/255.0);
+}
+
+std::ostream& operator<<(std::ostream& rStrm, const glm::vec4& rPos)
+{
+    rStrm << "( " << rPos[0] << ", " << rPos[1] << ", " << rPos[2] << ", " << rPos[3] << ")";
+    return rStrm;
+}
+
+std::ostream& operator<<(std::ostream& rStrm, const glm::mat4& rMatrix)
+{
+    for(int i = 0; i < 4; ++i)
     {
-        glm::mat4 reverseMatrix = glm::translate(glm::vec3(0.0, -1.0, 0.0));
-        m_Model = m_Model * reverseMatrix;
+        rStrm << "( ";
+        for(int j = 0; j < 4; ++j)
+        {
+            rStrm << rMatrix[j][i];
+            rStrm << " ";
+        }
+        rStrm << ")\n";
     }
-    glm::mat3 normalMatrix(m_Model);
-    glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
-    glUniformMatrix4fv(m_3DModelID, 1, GL_FALSE, &m_Model[0][0]);
-    glUniformMatrix3fv(m_3DNormalMatrixID, 1, GL_FALSE, &normalInverseTranspos[0][0]);
+    return rStrm;
+}
+
+}
+
+void OpenGL3DRenderer::RenderNonRoundedBar(const glm::mat4& modelMatrix, sal_uInt32 nColor)
+{
+    glm::mat4 aMVP = m_3DProjection * m_3DView * modelMatrix;
+    SAL_INFO("chart2.3dopengl", "render new bar");
+    SAL_INFO("chart2.3dopengl", aMVP);
+
+    for(size_t i = 0; i < SAL_N_ELEMENTS(cubeVertices); i += 3)
+    {
+        glm::vec4 aPos(cubeVertices[i*3], cubeVertices[i*3+1], cubeVertices[i*3+2], 1.0);
+        glm::vec4 aNewPos = aMVP * aPos;
+        SAL_INFO("chart2.3dopengl", aNewPos);
+    }
+
+    glm::vec4 aColor = getColorAsVector(nColor);
+    glUseProgram(m_CommonProID);
+    //fill vertex buffer
+    glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
+    glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), cubeVertices, GL_STATIC_DRAW);
+    glUniform4fv(m_2DColorID, 1, &aColor[0]);
+    glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &aMVP[0][0]);
+    // 1rst attribute buffer : vertices
+    glEnableVertexAttribArray(m_2DVertexID);
+    glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
+    glVertexAttribPointer(m_2DVertexID,
+            3,                  // size
+            GL_FLOAT,           // type
+            GL_FALSE,           // normalized?
+            0,                  // stride
+            (void*)0            // array buffer offset
+            );
+
     glDrawArrays(GL_TRIANGLES, 0, 36);
+    glDisableVertexAttribArray(m_2DVertexID);
+    glBindBuffer(GL_ARRAY_BUFFER, 0);
+    glUseProgram(0);
 }
 
 void OpenGL3DRenderer::RenderExtrudeSurface(const Extrude3DInfo& extrude3D)
@@ -1197,8 +1245,8 @@ void OpenGL3DRenderer::RenderExtrude3DObject()
     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;
+        GLuint vertexBuf = m_CubeVertexBuf;
+        GLuint normalBuf = m_CubeNormalBuf;
         // 1st attribute buffer : vertices
         glEnableVertexAttribArray(m_3DVertexID);
         glBindBuffer(GL_ARRAY_BUFFER, vertexBuf);
@@ -1226,15 +1274,8 @@ void OpenGL3DRenderer::RenderExtrude3DObject()
         CHECK_GL_ERROR();
         glBindBuffer(GL_UNIFORM_BUFFER, 0);
         extrude3DInfo.reverse = 0;
-        if (extrude3DInfo.rounded)
-        {
-            glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_CubeElementBuf);
-            RenderExtrudeSurface(extrude3DInfo);
-        }
-        else
-        {
-            RenderNonRoundedBar(extrude3DInfo);
-        }
+        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_CubeElementBuf);
+        RenderExtrudeSurface(extrude3DInfo);
         glDisableVertexAttribArray(m_3DVertexID);
         glDisableVertexAttribArray(m_3DNormalID);
     }
commit 45acf87db32c97d8123cb349d0123bd05c6128ff
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun May 11 05:26:02 2014 +0200

    this does not need to be a member variable
    
    Change-Id: I9be286f8e10d43c8c5ce89bb6b52ebddce48bb6b

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 242cb52..5337384 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -235,8 +235,6 @@ private:
 
     glm::mat4 m_3DMVP;
 
-    glm::mat4 m_TranslationMatrix;
-
     GLint m_3DProID;
 
     GLuint m_3DProjectionID;
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 87248d0..e8de12b 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -62,8 +62,7 @@ GLfloat texCoords[] = {
 }
 
 OpenGL3DRenderer::OpenGL3DRenderer():
-    m_TranslationMatrix(glm::translate(m_Model, glm::vec3(0.0f, 0.0f, 0.0f)))
-    , m_TextProID(0)
+    m_TextProID(0)
     , m_TextMatrixID(0)
     , m_TextVertexID(0)
     , m_TextTexCoordID(0)
@@ -1030,9 +1029,9 @@ void OpenGL3DRenderer::RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D,
     PosVecf3 trans = {extrude3D.xTransform,//m_Extrude3DInfo.xTransform + 140,
                       -extrude3D.yTransform,
                       extrude3D.zTransform};
-    m_TranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
+    glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
     glm::mat4 flatScale = glm::scale(xzScale, xzScale, xzScale);
-    m_Model = m_TranslationMatrix * extrude3D.rotation * flatScale;
+    m_Model = aTranslationMatrix * extrude3D.rotation * flatScale;
     glm::mat3 normalMatrix(m_Model);
     glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
     glUniformMatrix4fv(m_3DModelID, 1, GL_FALSE, &m_Model[0][0]);
@@ -1063,8 +1062,8 @@ void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D
     {
         glm::mat4 topTrans = glm::translate(glm::vec3(0.0, -actualYTrans, 0.0));
         glm::mat4 topScale = glm::scale(xzScale, xzScale, xzScale);
-        m_TranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
-        m_Model = m_TranslationMatrix * extrude3D.rotation * topTrans * topScale;
+        glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
+        m_Model = aTranslationMatrix * extrude3D.rotation * topTrans * topScale;
     }
     glm::mat3 normalMatrix(m_Model);
     glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
@@ -1092,8 +1091,8 @@ void OpenGL3DRenderer::RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D
     else
     {
         glm::mat4 scale = glm::scale(xzScale, actualYScale, xzScale);
-        m_TranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
-        m_Model = m_TranslationMatrix * extrude3D.rotation * scale;
+        glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
+        m_Model = aTranslationMatrix * extrude3D.rotation * scale;
     }
 
     if (extrude3D.reverse)
@@ -1125,8 +1124,8 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
         glm::mat4 orgTrans = glm::translate(glm::vec3(0.0, -1.0, 0.0));
         glm::mat4 scale = glm::scale(xzScale, yScale, xzScale);
         //MoveModelf(trans, angle, scale);
-        m_TranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
-        m_Model = m_TranslationMatrix * extrude3D.rotation * scale * orgTrans;
+        glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
+        m_Model = aTranslationMatrix * extrude3D.rotation * scale * orgTrans;
     }
     else
     {
@@ -1134,8 +1133,8 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
         glm::mat4 orgTrans = glm::translate(glm::vec3(0.0, -1.0, 0.0));
         glm::mat4 topTrans = glm::translate(glm::vec3(0.0, actualYTrans, 0.0));
         glm::mat4 topScale = glm::scale(xzScale, xzScale, xzScale);
-        m_TranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
-        m_Model = m_TranslationMatrix * extrude3D.rotation * topTrans * topScale * orgTrans;
+        glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
+        m_Model = aTranslationMatrix * extrude3D.rotation * topTrans * topScale * orgTrans;
     }
     glm::mat3 normalMatrix(m_Model);
     glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
commit 876795fcbc4283a9127fda471816e020c19afcfb
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun May 11 05:14:02 2014 +0200

    remove unused methods
    
    Change-Id: Id518c6a253f72cf062754fe6ff65c5041e41cc27

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 8ceae53..242cb52 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -117,15 +117,6 @@ struct CameraInfo
         cameraUp(glm::vec3(0, 0, 1)) {}
 };
 
-struct CoordinateAxisInfo
-{
-    int pickingFlg;
-    int reverse;
-    glm::vec4 color;
-    PosVecf3 trans;
-    PosVecf3 scale;
-};
-
 struct RoundBarMesh
 {
     float topThreshold;
@@ -195,9 +186,6 @@ private:
     void RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D);
     void RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D);
     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 RenderCoordinateAxis();
     void AddVertexData(GLuint vertexBuf);
     void AddNormalData(GLuint normalBuf);
     void AddIndexData(GLuint indexBuf);
@@ -226,16 +214,11 @@ private:
     glm::mat4 m_Model;
     // Our ModelViewProjection : multiplication of our 3 matrices
     glm::mat4 m_MVP;
-#if 0
-    double m_dFreq;
-#endif
 
     sal_Int32 m_iWidth;
 
     sal_Int32 m_iHeight;
 
-    float m_fZmax;
-
     GlobalLights m_LightsInfo;
 
     CameraInfo m_CameraInfo;
@@ -292,12 +275,6 @@ private:
 
     GLuint m_CubeNormalBuf;
 
-    bool m_bCameraUpdated;
-
-    float m_fFPS;
-
-    Point m_aMPos;
-
     GLuint m_BoundBox;
     GLuint m_BoundBoxNormal;
      // add for text
@@ -309,12 +286,8 @@ private:
     GLuint m_TextTexCoordBuf;
     GLint m_TextTexID;
 
-    GLuint m_CoordinateBuf;
-
     int m_uiSelectFrameCounter;
 
-    CoordinateAxisInfo m_coordinateAxisinfo;
-
     std::vector<glm::vec3> m_Vertices;
 
     std::vector<glm::vec3> m_Normals;
diff --git a/chart2/source/view/inc/StaticGeometry.h b/chart2/source/view/inc/StaticGeometry.h
index e734ade..bdc8fe7 100644
--- a/chart2/source/view/inc/StaticGeometry.h
+++ b/chart2/source/view/inc/StaticGeometry.h
@@ -116,15 +116,6 @@ static const GLfloat boundBoxNormal[] = {
     1.0f, 0.0f, 0.0f//12
 };
 
-static GLfloat coordinateAxis[] = {
-      -1.0, 0.0, 0.0,
-      1.0, 0.0, 0.0,//x
-      0.0, 0.0, -1.0,
-      0.0, 0.0, 1.0,//z
-      0.0, 0.0, 0.0,
-      0.0, 1.0, 0.0//y
-};
-
 static GLfloat coordReverseVertices[] = {
     0.0f, 1.0f,
     1.0f, 1.0f,
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index be34aee..87248d0 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -100,7 +100,6 @@ OpenGL3DRenderer::~OpenGL3DRenderer()
     glDeleteBuffers(1, &m_CubeElementBuf);
     glDeleteBuffers(1, &m_BoundBox);
     glDeleteBuffers(1, &m_BoundBoxNormal);
-    glDeleteBuffers(1, &m_CoordinateBuf);
     glDeleteBuffers(1, &m_TextTexCoordBuf);
     glDeleteBuffers(1, &m_RenderTexCoordBuf);
     glDeleteBuffers(1, &m_RenderVertexBuf);
@@ -214,10 +213,6 @@ void OpenGL3DRenderer::init()
     glBufferData(GL_ARRAY_BUFFER, sizeof(boundBoxNormal), boundBoxNormal, GL_STATIC_DRAW);
     glBindBuffer(GL_ARRAY_BUFFER, 0);
 
-    glGenBuffers(1, &m_CoordinateBuf);
-    glBindBuffer(GL_ARRAY_BUFFER, m_CoordinateBuf);
-    glBufferData(GL_ARRAY_BUFFER, sizeof(coordinateAxis), coordinateAxis, GL_STATIC_DRAW);
-    glBindBuffer(GL_ARRAY_BUFFER, 0);
     m_fViewAngle = 30.0f;
     m_3DProjection = glm::perspective(m_fViewAngle, (float)m_iWidth / (float)m_iHeight, 0.01f, 2000.0f);
     LoadShaders();
@@ -1250,11 +1245,6 @@ void OpenGL3DRenderer::RenderExtrude3DObject()
     glDisable(GL_CULL_FACE);
 }
 
-void OpenGL3DRenderer::SetFPS(float fps)
-{
-    m_fFPS = fps;
-}
-
 void OpenGL3DRenderer::CreateTextTexture(const BitmapEx& rBitmapEx, glm::vec3 vTopLeft,glm::vec3 vTopRight, glm::vec3 vBottomRight, glm::vec3 vBottomLeft)
 {
     long bmpWidth = rBitmapEx.GetSizePixel().Width();
@@ -1433,8 +1423,6 @@ void OpenGL3DRenderer::ProcessUnrenderedShape()
     RenderExtrude3DObject();
     //render text
     RenderTextShape();
-    //render the axis
-    RenderCoordinateAxis();
     glViewport(0, 0, m_iWidth, m_iHeight);
 #if DEBUG_FBO
     OUString aFileName = OUString("D://shaderout_") + OUString::number(m_iWidth) + "_" + OUString::number(m_iHeight) + ".png";
@@ -1443,47 +1431,6 @@ void OpenGL3DRenderer::ProcessUnrenderedShape()
 //    glBindFramebuffer(GL_FRAMEBUFFER, 0);
 }
 
-glm::vec4 OpenGL3DRenderer::GetColorByIndex(int index)
-{
-    sal_uInt8 r = index & 0xFF;
-    sal_uInt8 g = (index >> 8) & 0xFF;
-    sal_uInt8 b = (index >> 16) & 0xFF;
-    return glm::vec4(((float)r) / 255.0, ((float)g) / 255.0, ((float)b) / 255.0, 1.0);
-}
-
-sal_uInt32 OpenGL3DRenderer::GetIndexByColor(sal_uInt32 r, sal_uInt32 g, sal_uInt32 b)
-{
-    return r | (g << 8) | (b << 16);
-}
-
-void OpenGL3DRenderer::RenderCoordinateAxis()
-{
-    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));
-    glm::mat4 axisMVP = m_3DProjection * m_3DView * m_Model * reverseMatrix;
-    glUseProgram(m_CommonProID);
-    glLineWidth(3.0);
-    glEnable(GL_POLYGON_OFFSET_FILL);
-    glPolygonOffset(2.0, 2.0);
-    // 1rst attribute buffer : vertices
-    glEnableVertexAttribArray(m_2DVertexID);
-    glBindBuffer(GL_ARRAY_BUFFER, m_CoordinateBuf);
-    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
-                          );
-    glUniform4fv(m_2DColorID, 1, &m_coordinateAxisinfo.color[0]);
-    glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &axisMVP[0][0]);
-    glDrawArrays(GL_LINES, 0, sizeof(coordinateAxis) / sizeof(GLfloat) / 3);
-    glDisableVertexAttribArray(m_2DVertexID);
-    glDisable(GL_POLYGON_OFFSET_FILL);
-    glUseProgram(0);
-}
-
 void OpenGL3DRenderer::MoveModelf(PosVecf3& trans,PosVecf3& angle,PosVecf3& scale)
 {
     glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
commit 227a03ff9b0abbbcceca13daae8da66af1a7a409
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun May 11 05:07:54 2014 +0200

    remove unused variables
    
    Change-Id: Ia2dfa357d0fb7c2a19511ec0957deac38b85c09f

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 1a969b4..8ceae53 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -91,11 +91,8 @@ struct Polygon3DInfo
 struct Extrude3DInfo
 {
     bool rounded;
-    bool lineOnly;
-    float lineWidth;
     bool twoSidesLighting;
     glm::vec4 extrudeColor;
-    long fillStyle;
     float xScale;
     float yScale;
     float zScale;
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 030e968..be34aee 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -80,9 +80,7 @@ OpenGL3DRenderer::OpenGL3DRenderer():
     m_Polygon3DInfo.normals = NULL;
     m_Polygon3DInfo.lineWidth = 0.001f;
 
-    m_Extrude3DInfo.lineOnly = false;
     m_Extrude3DInfo.twoSidesLighting = false;
-    m_Extrude3DInfo.lineWidth = 0.001f;
 
     GetFreq();
     m_RoundBarMesh.iMeshSizes = 0;


More information about the Libreoffice-commits mailing list