summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-11 17:55:16 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-12 03:00:09 +0200
commitbc9d2f80c373e0ed22ba643964fe1b13c3169b40 (patch)
tree18e8b1d4c19953ed8363647009119cb95baf4232 /chart2
parent5c799db571e4bb911a32e0e3a9b4bb244015b53b (diff)
a few changes to camera position and bar positioning
Change-Id: I256e6855735bea050507c894f91ed895da0e13ba
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx6
-rw-r--r--chart2/source/view/main/3DChartObjects.cxx4
-rw-r--r--chart2/source/view/main/GL3DRenderer.cxx14
3 files changed, 12 insertions, 12 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index eabc36ae0fef..a5d4a36bcee5 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -68,7 +68,7 @@ void GL3DBarChart::create3DShapes()
for (boost::ptr_vector<VDataSeries>::const_iterator itr = maDataSeries.begin(),
itrEnd = maDataSeries.end(); itr != itrEnd; ++itr)
{
- nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY);
+ nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY) + nBarSizeY;
const VDataSeries& rDataSeries = *itr;
sal_Int32 nPointCount = rDataSeries.getTotalPointCount();
@@ -93,11 +93,11 @@ void GL3DBarChart::create3DShapes()
for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex)
{
float nVal = rDataSeries.getYValue(nIndex);
- float nXPos = nIndex * (nBarSizeX + nBarDistanceX);
+ float nXPos = nIndex * (nBarSizeX + nBarDistanceX) + nBarSizeX;
glm::mat4 aScaleMatrix = glm::scale(nBarSizeX, nBarSizeY, nVal);
- glm::mat4 aTranslationMatrix = glm::translate(nXPos, nYPos, nVal/2);
+ glm::mat4 aTranslationMatrix = glm::translate(nXPos, nYPos, nVal);
glm::mat4 aBarPosition = aTranslationMatrix * aScaleMatrix;
maShapes.push_back(new opengl3D::Bar(mpRenderer.get(), aBarPosition, nColor, nId++));
diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx
index 0aeec4054af5..202eb972bf7d 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -49,7 +49,7 @@ void Renderable3DObject::render()
Bar::Bar(OpenGL3DRenderer* pRenderer, const glm::mat4& rPosition, sal_uInt32 aColor, sal_uInt32 nId)
: Renderable3DObject(pRenderer, nId)
- , mbRoundedCorners(false)
+ , mbRoundedCorners(true)
, maPos(rPosition)
, maColor(aColor)
{
@@ -185,7 +185,7 @@ Camera::Camera(OpenGL3DRenderer* pRenderer):
Renderable3DObject(pRenderer, 0),
maPos(10,-50,20),
maUp(0, 0, 1),
- maDirection(glm::vec3(0,1,-0.5))
+ maDirection(glm::vec3(0,0,0))
{
}
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index c92d878ffb4f..636b0151584b 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -136,7 +136,7 @@ void OpenGL3DRenderer::LoadShaders()
void OpenGL3DRenderer::SetCameraInfo(glm::vec3 pos, glm::vec3 direction, glm::vec3 up)
{
m_CameraInfo.cameraPos = pos;
- m_CameraInfo.cameraOrg = pos + direction;
+ m_CameraInfo.cameraOrg = direction;
m_CameraInfo.cameraUp = up;
}
@@ -212,7 +212,7 @@ void OpenGL3DRenderer::init()
glBufferData(GL_ARRAY_BUFFER, sizeof(boundBoxNormal), boundBoxNormal, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
- m_fViewAngle = 30.0f;
+ m_fViewAngle = 60.0f;
m_3DProjection = glm::perspective(m_fViewAngle, (float)m_iWidth / (float)m_iHeight, 0.01f, 2000.0f);
LoadShaders();
glGenBuffers(1, &m_TextTexCoordBuf);
@@ -930,7 +930,8 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(sal_Int32 color,sal_Int32 specula
m_Extrude3DInfo.zScale = glm::length(DirY);
glm::mat4 transformMatrixInverse = glm::inverse(glm::translate(glm::vec3(tranform)));
glm::mat4 scaleMatrixInverse = glm::inverse(glm::scale(m_Extrude3DInfo.xScale, m_Extrude3DInfo.zScale, m_Extrude3DInfo.yScale));
- m_Extrude3DInfo.rotation = transformMatrixInverse * modelMatrix * scaleMatrixInverse;
+ //m_Extrude3DInfo.rotation = transformMatrixInverse * modelMatrix * scaleMatrixInverse;
+
//color
m_Extrude3DInfo.extrudeColor = glm::vec4((float)(((color) & 0x00FF0000) >> 16) / 255.0f,
(float)(((color) & 0x0000FF00) >> 8) / 255.0f,
@@ -1443,10 +1444,9 @@ void OpenGL3DRenderer::RenderClickPos(Point aMPos)
void OpenGL3DRenderer::CreateSceneBoxView()
{
- 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_3DView = glm::lookAt(m_CameraInfo.cameraPos,
+ m_CameraInfo.cameraOrg,
+ m_CameraInfo.cameraUp);
}
void OpenGL3DRenderer::ProcessUnrenderedShape()