summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorweigao <weigao@multicorewareinc.com>2014-05-28 20:53:07 +0800
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-28 19:16:18 +0200
commit6d1598c30e99a951d635b53cb52af12e9a6c94b7 (patch)
tree7410cff9a2ebfbef4a8e7ddbba33bacd429fc244 /chart2
parent4cde86a6e4648f49eb554cfaafcbf603c1a8a7c8 (diff)
Modify the bar generate function
Conflicts: chart2/source/view/main/GL3DRenderer.cxx Change-Id: Ia323c54b9113be15f01bff2a2f1e66da8ebfc39c
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/main/GL3DRenderer.cxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index a031ab1cd833..987c5e6c4621 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -299,6 +299,7 @@ void OpenGL3DRenderer::init()
OpenGLHelper::createFramebuffer(m_iWidth, m_iHeight, mnPickingFbo, mnPickingRboDepth, mnPickingRboColor);
+ m_Extrude3DInfo.rounded = false;
CHECK_GL_ERROR();
Init3DUniformBlock();
InitBatch3DUniformBlock();
@@ -378,10 +379,6 @@ void OpenGL3DRenderer::SetVertex(PackedVertex &packed,
void OpenGL3DRenderer::CreateActualRoundedCube(float fRadius, int iSubDivY, int iSubDivZ, float width, float height, float depth)
{
- if ((fRadius > (width / 2)) || (fRadius > (height / 2)) || (fRadius > (depth / 2)))
- {
- return;
- }
float topThreshold = depth - 2 * fRadius;
float bottomThreshold = fRadius;
@@ -1033,12 +1030,14 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_uInt32 nC
m_Extrude3DInfo.xTransform = tranform.x;
m_Extrude3DInfo.yTransform = tranform.y;
m_Extrude3DInfo.zTransform = tranform.z;
- m_Extrude3DInfo.rounded = roundedCorner;
- if (m_Extrude3DInfo.rounded && (m_RoundBarMesh.iMeshSizes == 0))
- {
- float radius = 0.2f;
- CreateActualRoundedCube(radius, CORNER_DIVION_Y, CORNER_DIVION_Z,
- 1.0f, m_Extrude3DInfo.yScale / m_Extrude3DInfo.xScale, 1 + 2 * radius);
+ float width = 1.0f;
+ float height = m_Extrude3DInfo.yScale / m_Extrude3DInfo.xScale;
+ float radius = height > 0.2f ? 0.2f : height / 4.0f;
+ float depth = 1 + 2 * radius;
+ bool NORoundedCube = (radius > (width / 2)) || (radius > (height / 2)) || (radius > (depth / 2));
+ if (!NORoundedCube && roundedCorner && (m_RoundBarMesh.iMeshSizes == 0))
+ {
+ CreateActualRoundedCube(radius, CORNER_DIVION_Y, CORNER_DIVION_Z, width, height, depth);
AddVertexData(m_CubeVertexBuf);
AddNormalData(m_CubeNormalBuf);
AddIndexData(m_CubeElementBuf);
@@ -1050,6 +1049,7 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_uInt32 nC
m_Vertices.clear();
m_Normals.clear();
m_Indices.clear();
+ m_Extrude3DInfo.rounded = true;
}
m_Batchmaterial = m_Extrude3DInfo.material;
}
@@ -1871,7 +1871,6 @@ void OpenGL3DRenderer::RenderBatchBars()
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
-
glUseProgram(maResources.m_3DBatchProID);
UpdateBatch3DUniformBlock();
glBindBuffer(GL_UNIFORM_BUFFER, m_Batch3DUBOBuffer);