[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/main/GL3DRenderer.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit ccb7ca6903f1bf2b79b8d72ad0795c3dc77f0770 Author: Markus Mohrhard Date: Wed May 21 16:11:02 2014 +0200 remove second part of the debug output Change-Id: Ie691746b4621a90d2b7abbfbc75367780574032f diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index e26cafe..d686009 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -1602,7 +1602,6 @@ sal_uInt32 OpenGL3DRenderer::GetPixelColorFromPoint(long nX, long nY) glReadPixels(nX, nY, 1, 1, GL_BGRA, GL_UNSIGNED_BYTE, buf.get()); Color aColor(buf[3], buf[2], buf[1], buf[0]); static sal_Int32 i = 0; -OpenGLHelper::renderToFile(m_iWidth, m_iHeight, aFileName); return aColor.GetColor(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/charttypes/GL3DBarChart.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 7f55233410a241434d4e68e5f84020ab38662a30 Author: Markus Mohrhard Date: Thu May 22 13:18:00 2014 +0200 change the bar size a bit Change-Id: I09df4a7104a4df1603a7d64bfa49c103be4f4ade diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 542711a..a3a8858 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -64,10 +64,10 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector& rDataSer // guarantee they are positioned correctly. In fact, they are guaranteed // to be positioned incorrectly. -const float nBarSizeX = 10; -const float nBarSizeY = 10; -const float nBarDistanceX = nBarSizeX / 2; -const float nBarDistanceY = nBarSizeY / 2; +const float nBarSizeX = 10.0f; +const float nBarSizeY = 30.0f; +const float nBarDistanceX = 5.0f; +const float nBarDistanceY = 5.0; sal_uInt32 nId = 1; float nXEnd = 0.0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/main/GL3DRenderer.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 156f793e6c592c08e62d641080a6c2f386121548 Author: Stephan Bergmann Date: Wed May 21 16:21:26 2014 +0200 -Werror,-Wunused-variable Change-Id: Ie7919740e7e95eb53f7a719e3dc2b114c6fd3862 diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index d686009..d6c1dff 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -1601,7 +1601,6 @@ sal_uInt32 OpenGL3DRenderer::GetPixelColorFromPoint(long nX, long nY) boost::scoped_array buf(new sal_uInt8[4]); glReadPixels(nX, nY, 1, 1, GL_BGRA, GL_UNSIGNED_BYTE, buf.get()); Color aColor(buf[3], buf[2], buf[1], buf[0]); -static sal_Int32 i = 0; return aColor.GetColor(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/main/GL3DRenderer.cxx | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit 56d5364b711745e563eb20957e91a18c9fee5556 Author: Markus Mohrhard Date: Thu May 22 17:30:39 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 d6c1dff..1f8fe41 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -348,7 +348,7 @@ void OpenGL3DRenderer::CreateActualRoundedCube(float fRadius, int iSubDivY, int glm::vec3 actualNormals[3]; std::vector 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(); @@ -978,14 +978,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 @@ -1021,8 +1020,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() @@ -1130,7 +1129,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; @@ -1351,6 +1350,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); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/charttypes/GL3DBarChart.cxx | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) New commits: commit 68bac9fc0bde02462b78393a845231f5c6644a02 Author: Markus Mohrhard Date: Sat May 24 13:05:12 2014 +0200 improve the bar and text positioning Keep a bit of space to the border and move the text a bit away from the chart area. This makes it look much better in my opinion. Change-Id: I1eee505e8361cbc0e3ca859d74a96af880451198 diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index efd27af..6d0b6d7 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -87,7 +87,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector& rDataSer for (boost::ptr_vector::const_iterator itr = rDataSeriesContainer.begin(), itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr) { -nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY); +nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY) + nBarDistanceY; const VDataSeries& rDataSeries = *itr; sal_Int32 nPointCount = rDataSeries.getTotalPointCount(); @@ -104,10 +104,10 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector& rDataSer maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aSeriesName, nId++)); opengl3D::Text* p = static_cast(&maShapes.back()); glm::vec3 aTopLeft, aTopRight, aBottomRight; -aTopLeft.x = 0.0f; -aTopLeft.y = nYPos; -aTopRight.x = calculateTextWidth(aSeriesName) * -1.0; -aTopRight.y = nYPos; +aTopLeft.x = -nBarDistanceY; +aTopLeft.y = nYPos + 0.25 * nBarSizeY; +aTopRight.x = calculateTextWidth(aSeriesName) * -1.0 - nBarDistanceY; +aTopRight.y = nYPos + 0.25 * nBarSizeY; aBottomRight = aTopRight; aBottomRight.y += TEXT_HEIGHT; p->setPosition(aTopLeft, aTopRight, aBottomRight); @@ -122,7 +122,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector& rDataSer } float nVal = rDataSeries.getYValue(nIndex); -float nXPos = nIndex * (nBarSizeX + nBarDistanceX); +float nXPos = nIndex * (nBarSizeX + nBarDistanceX) + nBarDistanceX; glm::mat4 aScaleMatrix = glm::scale(nBarSizeX, nBarSizeY, nVal); @@ -165,7 +165,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector& rDataSer opengl3D::Rectangle* pRect = static_cast(&maShapes.back()); glm::vec3 aTopLeft; glm::vec3 aTopRight = aTopLeft; -aTopRight.x = nXEnd; +aTopRight.x = nXEnd + 2 * nBarDistanceX; glm::vec3 aBottomRight = aTopRight; aBottomRight.y = nYPos; pRect->setPosition(aTopLeft, aTopRight, aBottomRight); @@ -184,11 +184,11 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector& rDataSer maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aCats[i], nId++)); opengl3D::Text* p = static_cast(&maShapes.back()); aTopLeft.x = nXPos + TEXT_HEIGHT; -aTopLeft.y = nYPos + calculateTextWidth(aCats[i]); +aTopLeft.y = nYPos + calculateTextWidth(aCats[i]) + 0.5 * nBarDistanceY; aTopRight = aTopLeft; -aTopRight.y = nYPos; +aTopRight.y = nYPos + 0.5* nBarDistanceY; aBottomRight.x = nXPos; -aBottomRight.y = nYPos; +aBottomRight.y = nYPos + 0.5 * nBarDistanceY; p->setPosition(aTopLeft, aTopRight, aBottomRight); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/main/3DChartObjects.cxx | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) New commits: commit 89a4bbf6a7bb9be0f4c4060704975a54ffc685f8 Author: Jan Holesovsky Date: Sun May 25 11:12:59 2014 +0200 Improve computation of the text area to make it nicer. Change-Id: I24fb1caedc55dcc297fb013acb63b3c660fcf0a2 diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx index c77a273..3432bac 100644 --- a/chart2/source/view/main/3DChartObjects.cxx +++ b/chart2/source/view/main/3DChartObjects.cxx @@ -78,18 +78,14 @@ const BitmapEx& TextCache::getText(OUString rText) Font aFont = aDevice.GetFont(); aFont.SetSize(Size(0, 96)); aFont.SetColor(COL_BLACK); -::Rectangle aRect; aDevice.SetFont(aFont); aDevice.Erase(); -aDevice.GetTextBoundRect(aRect, rText); -Size aSize = aRect.GetSize(); -aSize.Width() += 5; -aSize.Height() *= 1.6; -aDevice.SetOutputSizePixel(aSize); + +aDevice.SetOutputSize(Size(aDevice.GetTextWidth(rText), aDevice.GetTextHeight())); aDevice.SetBackground(Wallpaper(COL_TRANSPARENT)); aDevice.DrawText(Point(0,0), rText); -BitmapEx* pText = new BitmapEx(aDevice.GetBitmapEx(Point(0,0), aSize)); +BitmapEx* pText = new BitmapEx(aDevice.GetBitmapEx(Point(0,0), aDevice.GetOutputSize())); maTextCache.insert(rText, pText); return *pText; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/main/GL3DRenderer.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 74544a356a5f69afe148405139ac783150e1b322 Author: weigao Date: Sun May 25 13:47:44 2014 +0800 fix the bar model generate Change-Id: I8df87b27dd93f0e11198998869b97754ded3bca1 diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index 75628da..a658536 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -329,7 +329,7 @@ void OpenGL3DRenderer::CreateActualRoundedCube(float fRadius, int iSubDivY, int { return; } -float topThreshold = height - 2 * fRadius; +float topThreshold = depth - 2 * fRadius; float bottomThreshold = fRadius; std::vector vertices; @@ -1002,7 +1002,8 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_uInt32 nC m_Extrude3DInfo.rounded = roundedCorner; if (m_Extrude3DInfo.rounded && (m_RoundBarMesh.iMeshSizes == 0)) { -CreateActualRoundedCube(0.1f, 30, 30, 1.0f, m_Extrude3DInfo.yScale / m_Extrude3DInfo.xScale, 1.2f); +float radius = 0.2f; +CreateActualRoundedCube(radius, 30, 30, 1.0f, m_Extrude3DInfo.yScale / m_Extrude3DInfo.xScale, 1 + 2 * radius); AddVertexData(m_CubeVertexBuf); AddNormalData(m_CubeNormalBuf); AddIndexData(m_CubeElementBuf); @@ -1197,7 +1198,6 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D) PosVecf3 trans = {extrude3D.xTransform, extrude3D.yTransform, extrude3D.zTransform}; - if (actualZTrans < 0.0f) { // the height of rounded corner is higher than the cube than use the org scale matrix ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/inc/GL3DRenderer.hxx | 15 -- chart2/source/view/main/GL3DRenderer.cxx | 73 ++- 2 files changed, 54 insertions(+), 34 deletions(-) New commits: commit 33921d26aabba22f24b2c49e9fedcea35ada81c6 Author: weigao Date: Sun May 25 15:19:47 2014 +0800 add delete shape function Change-Id: Ided3902a45c6bb7bf79827849aeca3c40f83 diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx index b5a5c68..e0214a8 100644 --- a/chart2/source/view/inc/GL3DRenderer.hxx +++ b/chart2/source/view/inc/GL3DRenderer.hxx @@ -83,9 +83,9 @@ struct Polygon3DInfo Vertices3D *vertices; UVs3D *uvs; Normals3D *normals; -std::list verticesList; -std::list uvsList; -std::list normalsList; +std::vector verticesList; +std::vector uvsList; +std::vector normalsList; MaterialParameters material; }; @@ -209,6 +209,11 @@ private: int iSubDivZ, float width, float height, float depth); void CreateSceneBoxView(); void RenderTexture(GLuint TexID); + +void ReleaseShapes(); +void ReleasePolygonShapes(); +void ReleaseExtrude3DShapes(); +void ReleaseTextShapes(); private: struct ShaderResources @@ -297,7 +302,7 @@ private: Polygon3DInfo m_Polygon3DInfo; -std::list m_Polygon3DInfoList; +std::vector m_Polygon3DInfoList; glm::mat4 m_D3DTrasform; @@ -332,7 +337,7 @@ private: GLuint m_BoundBox; GLuint m_BoundBoxNormal; // add for text -std::list m_TextInfoList; +std::vector m_TextInfoList; GLuint m_TextTexCoordBuf; int m_uiSelectFrameCounter; diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index a658536..ecab037 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -685,9 +685,7 @@ double OpenGL3DRenderer::GetTime() void OpenGL3DRenderer::RenderLine3D(Polygon3DInfo &polygon) { -size_t listNum = polygon.verticesList.size(); glUseProgram(maResources.m_CommonProID); - PosVecf3 trans = {0.0f, 0, 0.0}; PosVecf3 angle = {0.0f, 0.0f, 0.0f}; PosVecf3 scale = {1.0f, 1.0f, m_fHeightWeight}; @@ -695,10 +693,10 @@ void OpenGL3DRenderer::RenderLine3D(Polygon3DInfo &polygon) m_3DMVP = m_3DProjection * m_3DView * m_Model; -for (size_t i = 0; i < listNum; i++) +for (size_t i = 0; i < polygon.verticesList.size(); i++) { //move the circle to the pos, and scale using the xScale and Y scale -Vertices3D *pointList = polygon.verticesList.front(); +Vertices3D *pointList = polygon.verticesList[i]; //if line only, using the common shader to render //fill vertex buffer @@ -725,8 +723,6 @@ void OpenGL3DRenderer::RenderLine3D(Polygon3DInfo &polygon) glDrawArrays(GL_LINE_STRIP, 0, pointList->size()); glDisableVertexAttribArray(maResources.m_2DVertexID); glBindBuffer(GL_ARRAY_BUFFER, 0); -delete pointList; -polygon.verticesList.pop_front(); } glUseProgram(0); } @@ -759,8 +755,8 @@ void OpenGL3DRenderer::RenderPolygon3D(Polygon3DInfo &polygon) for (size_t i = 0; i < verticesNum; i++) { //move the circle to the pos, and scale using the xScale and Y scale -Vertices3D *pointList = polygon.verticesList.front(); -Normals3D *normalList = polygon.normalsList.front(); +Vertices3D *pointList = polygon.verticesList[i]; +Normals3D *normalList = polygon.normalsList[i]; PosVecf3 trans = {0.0f, 0.0f, 0.0}; PosVecf3 angle = {0.0f, 0.0f, 0.0f}; PosVecf3 scale = {1.0f, 1.0f, m_fHeightWeight}; @@ -818,10 +814,6 @@ void OpenGL3DRenderer::RenderPolygon3D(Polygon3DInfo &polygon) glDisableVertexAttribArray(maResources.m_3DNormalID); glBindBuffer(GL_ARRAY_BUFFER, 0); -delete pointList; -delete normalList; -polygon.verticesList.pop_front(); -polygon.normalsList.pop_front(); } glUseProgram(0); } @@ -839,13 +831,26 @@ struct DeletePointer } +void OpenGL3DRenderer::ReleasePolygonShapes() +{ +for (size_t i = 0; i < m_Polygon3DInfoList.size(); i++) +{ +Polygon3DInfo &polygon = m_Polygon3DInfoList[i]; +std::for_each(polygon.verticesList.begin(), +polygon.verticesList.end(), DeletePointer()); +std::for_each(polygon.normalsList.begin(), +polygon.normalsList.end(), DeletePointer()); +delete polygon.vertices; +delete polygon.normals; +} +m_Polygon3DInfoList.clear(); +} void OpenGL3DRenderer::RenderPolygon3DObject() { glDepthMask(GL_FALSE); -size_t polygonNum = m_Polygon3DInfoList.size(); -for (size_t i = 0; i < polygonNum; i++) +for (size_t i = 0; i < m_Polygon3DInfoList.size(); i++) { -Polygon3DInfo &polygon = m_P
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/inc/3DChartObjects.hxx | 19 +++ chart2/source/view/inc/GL3DRenderer.hxx| 13 +++-- chart2/source/view/main/3DChartObjects.cxx | 24 +++- chart2/source/view/main/GL3DRenderer.cxx | 21 + chart2/source/view/main/OpenGLRender.cxx | 21 - chart2/source/view/main/OpenGLRender.hxx | 11 +-- 6 files changed, 79 insertions(+), 30 deletions(-) New commits: commit 24e9b8fda0e0ca6ae8b5fbe26f13948da7d7b6f4 Author: Michael Meeks Date: Mon May 26 20:34:44 2014 +0100 cache the bitmap converted to flat RGBA pixels. Change-Id: Ied38d4457fbc04ded42fe4fb55a8ec654cefa259 diff --git a/chart2/source/view/inc/3DChartObjects.hxx b/chart2/source/view/inc/3DChartObjects.hxx index 39d2411..4674646 100644 --- a/chart2/source/view/inc/3DChartObjects.hxx +++ b/chart2/source/view/inc/3DChartObjects.hxx @@ -15,17 +15,28 @@ #include "GL3DRenderer.hxx" #include +#include namespace chart { namespace opengl3D { +struct TextCacheItem +{ +TextCacheItem(sal_uInt8 *pPixels, ::Size aSize) +: maSize(aSize), maPixels(pPixels) +{ +} +::Size maSize; +boost::shared_array maPixels; +}; + class TextCache { public: -const BitmapEx& getText(OUString rText); +const TextCacheItem &getText(OUString rText); private: -typedef boost::ptr_map TextCacheType; +typedef boost::ptr_map TextCacheType; TextCacheType maTextCache; }; @@ -85,7 +96,7 @@ public: void setPosition(const glm::vec3& rTopLeft, const glm::vec3& rTopRight, const glm::vec3& rBottomRight); private: -const BitmapEx& mrText; +TextCacheItem maText; glm::vec3 maTopLeft; glm::vec3 maTopRight; glm::vec3 maBottomRight; @@ -100,7 +111,7 @@ public: void setPosition(const glm::vec2& rTopLeft, const glm::vec2& rBottomRight); private: -const BitmapEx& mrText; +TextCacheItem maText; glm::vec2 maTopLeft; glm::vec2 maBottomRight; }; diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx index c2d6b4b..b16453c 100644 --- a/chart2/source/view/inc/GL3DRenderer.hxx +++ b/chart2/source/view/inc/GL3DRenderer.hxx @@ -16,6 +16,7 @@ #include "glm/gtx/quaternion.hpp" #include +#include #include #include @@ -162,8 +163,16 @@ public: void EndAddShape3DExtrudeObject(); void SetSize(const Size& rSize); 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, sal_uInt32 nUniqueId); -void CreateScreenTextTexture(const BitmapEx& rBitmapEx, glm::vec2 vTopLeft, glm::vec2 vBottomRight, sal_uInt32 nUniqueId); +void CreateTextTexture(const boost::shared_array &bitmapBuf, + ::Size maSizePixels, + glm::vec3 vTopLeft,glm::vec3 vTopRight, + glm::vec3 vBottomRight, glm::vec3 vBottomLeft, + sal_uInt32 nUniqueId); +void CreateScreenTextTexture(const boost::shared_array &bitmapBuf, + ::Size maSizePixels, + + glm::vec2 vTopLeft, glm::vec2 vBottomRight, + sal_uInt32 nUniqueId); void ProcessUnrenderedShape(); void SetPickingMode(bool bPickingMode); diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx index b838d31..09ed6aa 100644 --- a/chart2/source/view/main/3DChartObjects.cxx +++ b/chart2/source/view/main/3DChartObjects.cxx @@ -68,7 +68,7 @@ void Line::setLineColor(const Color& rColor) maLineColor = rColor; } -const BitmapEx& TextCache::getText(OUString rText) +const TextCacheItem& TextCache::getText(OUString rText) { TextCacheType::const_iterator itr = maTextCache.find(rText); if(itr != maTextCache.end()) @@ -85,14 +85,16 @@ const BitmapEx& TextCache::getText(OUString rText) aDevice.SetBackground(Wallpaper(COL_TRANSPARENT)); aDevice.DrawText(Point(0,0), rText); -BitmapEx* pText = new BitmapEx(aDevice.GetBitmapEx(Point(0,0), aDevice.GetOutputSize())); -maTextCache.insert(rText, pText); -return *pText; +BitmapEx aText(aDevice.GetBitmapEx(Point(0,0), aDevice.GetOutputSize())); +TextCacheItem *pItem = new TextCacheItem(OpenGLHelper::ConvertBitmapExToRGBABuffer(aText), aText.GetSizePixel()); +maTextCache.insert(rText, pItem); + +return *maTextCache.find(rText)->second; } Text::Text(OpenGL3DRenderer* pRenderer, TextCache& rTextCache, const OUString& rStr, sal_uInt32 nId): Renderable3DObject(pRenderer, nId), -mrText(rTextCache.getText(rStr)) +maText(rTextCache.getText(rStr)) { } @@ -100,12 +102,14 @@ void Text::render() { glm::vec3 dir2 = maTopRight - maTopLeft; glm::vec3 bottomLeft = ma
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/charttypes/GL3DBarChart.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 5836a29b9045b8abdaadff35848b287dee37effc Author: Markus Mohrhard Date: Tue May 27 16:32:25 2014 +0200 prevent that early return prevents further user interaction Change-Id: I24f814a402d2b8af3ddf888719b78d3158c2a38f diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 263bf50..c2b29c3 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -315,7 +315,6 @@ void GL3DBarChart::clickedAt(const Point& /*rPos*/, sal_uInt16 nButtons) if(nButtons != MOUSE_LEFT) return; -mbBlockUserInput = true; sal_uInt32 nId = 5; /* { @@ -331,6 +330,8 @@ void GL3DBarChart::clickedAt(const Point& /*rPos*/, sal_uInt16 nButtons) if(itr == maBarMap.end()) return; +mbBlockUserInput = true; + const BarInformation& rBarInfo = itr->second; mnStepsTotal = 100; mnStep = 0; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/inc/GL3DRenderer.hxx|1 chart2/source/view/main/3DChartObjects.cxx |6 +++- chart2/source/view/main/GL3DRenderer.cxx | 41 - 3 files changed, 40 insertions(+), 8 deletions(-) New commits: commit 331220fd8ccb73f2353d33af0a9a88ee152a3031 Author: Michael Meeks Date: Tue May 27 21:58:31 2014 +0100 Add a grey gradient background to the 3D chartm and tweak text color. Change-Id: I8b74a1e7f32c30b6a908c0870bbeacc00cdea444 diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx index b16453c..f110693 100644 --- a/chart2/source/view/inc/GL3DRenderer.hxx +++ b/chart2/source/view/inc/GL3DRenderer.hxx @@ -181,6 +181,7 @@ public: private: void MoveModelf(PosVecf3& trans,PosVecf3& angle,PosVecf3& scale); +void ClearBuffer(); void RenderPolygon3DObject(); void RenderLine3D(Polygon3DInfo &polygon); void RenderPolygon3D(Polygon3DInfo &polygon); diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx index 09ed6aa..038caaf 100644 --- a/chart2/source/view/main/3DChartObjects.cxx +++ b/chart2/source/view/main/3DChartObjects.cxx @@ -77,7 +77,11 @@ const TextCacheItem& TextCache::getText(OUString rText) VirtualDevice aDevice(*Application::GetDefaultDevice(), 0, 0); Font aFont = aDevice.GetFont(); aFont.SetSize(Size(0, 96)); -aFont.SetColor(COL_BLACK); +static bool bOldRender = getenv("OLDRENDER"); +if (bOldRender) +aFont.SetColor(COL_BLACK); +else +aFont.SetColor(COL_GREEN); // RGB_COLORDATA(0xf0, 0xf0, 0xf0)); aDevice.SetFont(aFont); aDevice.Erase(); diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index 74f8ec1..bfb7382 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -215,10 +215,7 @@ void OpenGL3DRenderer::init() glEnable(GL_MULTISAMPLE); -glClearColor (1.0, 1.0, 1.0, 1.0); -glClear(GL_COLOR_BUFFER_BIT); -glClearDepth(1.0f); -glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +ClearBuffer(); glGenBuffers(1, &m_CubeVertexBuf); glGenBuffers(1, &m_CubeNormalBuf); @@ -1596,12 +1593,42 @@ void OpenGL3DRenderer::CreateSceneBoxView() m_CameraInfo.cameraUp); } +void OpenGL3DRenderer::ClearBuffer() +{ +static bool bOldRender = getenv("OLDRENDER"); +if (!bOldRender) // gradient background +{ +glDisable(GL_DEPTH_TEST); +glDisable(GL_LIGHTING); + +glClearDepth(1.0f); +glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + +glBegin (GL_QUADS); +glColor3f(0.3,0.3,0.3); +glVertex3f (-1.0f, -1.0f, -1.0f); +glVertex3f (1.0f, -1.0f, -1.0f); + +glColor3f(0.0,0.0,0.0); +glVertex3f (1.0f, 1.0f, -1.0f); +glVertex3f (-1.0f, 1.0f, -1.0f); +glEnd (); + +glEnable(GL_LIGHTING); +glEnable(GL_DEPTH_TEST); +} +else +{ +glClearDepth(1.0f); +glClearColor (1.0, 0.5, 0.5, 1.0); +glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} +} + void OpenGL3DRenderer::ProcessUnrenderedShape() { glViewport(0, 0, m_iWidth, m_iHeight); -glClearDepth(1.0f); -glClearColor(1.0, 1.0, 1.0, 1.0); -glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +ClearBuffer(); CreateSceneBoxView(); //Polygon RenderPolygon3DObject(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/charttypes/GL3DBarChart.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 5daa541bcdb1f371193187c244d46babd644e4f1 Author: Markus Mohrhard Date: Wed May 28 19:29:54 2014 +0200 change the bar direction for the demo Change-Id: I24e45810cb154310d8e35982e2ef100cf5746e2b diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 5dac458..e6d04be 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -103,8 +103,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector& rDataSer // guarantee they are positioned correctly. In fact, they are guaranteed // to be positioned incorrectly. -const float nBarSizeX = 5.0f; -const float nBarSizeY = 30.0f; +const float nBarSizeX = 30.0f; +const float nBarSizeY = 5.0f; const float nBarDistanceX = 5.0f; const float nBarDistanceY = 5.0; @@ -153,9 +153,9 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector& rDataSer opengl3D::Text* p = static_cast(&maShapes.back()); glm::vec3 aTopLeft, aTopRight, aBottomRight; aTopRight.x = -nBarDistanceY; -aTopRight.y = nYPos + 0.25 * nBarSizeY; +aTopRight.y = nYPos + nBarDistanceY; aTopLeft.x = calculateTextWidth(aSeriesName) * -1.0 - nBarDistanceY; -aTopLeft.y = nYPos + 0.25 * nBarSizeY; +aTopLeft.y = nYPos + nBarDistanceY; aBottomRight = aTopRight; aBottomRight.y -= TEXT_HEIGHT; p->setPosition(aTopLeft, aTopRight, aBottomRight); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source
chart2/source/view/main/GL3DRenderer.cxx | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit 07ef1602dfc48301031dc92d1795a42c2b6d8769 Author: weigao Date: Sun May 18 04:09:13 2014 -0700 add reverse bars code Change-Id: I2db9edd9015bb10cffe58a44c379db0ab87e7d72 diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index bcb87b2..f7867d5 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -340,7 +340,7 @@ void OpenGL3DRenderer::CreateActualRoundedCube(float fRadius, int iSubDivY, int glm::vec3 actualNormals[3]; std::vector indeices[5]; glm::vec3 externSurNormal; -glm::mat4 corrctCoord = glm::translate(glm::vec3(width / 2.0f, height / 2.0f, depth / 2.0f - fRadius)); +glm::mat4 corrctCoord = glm::translate(glm::vec3(0.0f, 0.0f, depth / 2.0f - fRadius)); m_RoundBarMesh.topThreshold = topThreshold; m_RoundBarMesh.bottomThreshold = bottomThreshold; m_RoundBarMesh.iMeshStartIndices = m_Vertices.size(); @@ -964,13 +964,14 @@ 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)); +glm::mat4 scaleMatrixInverse = glm::inverse(glm::scale(m_Extrude3DInfo.xScale, m_Extrude3DInfo.yScale, m_Extrude3DInfo.zScale * crossZ)); 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 @@ -1006,8 +1007,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.zScale); -m_SenceBox.minZCoord = std::min(m_SenceBox.minZCoord, m_Extrude3DInfo.zTransform); +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); } void OpenGL3DRenderer::EndAddShape3DExtrudeObject() @@ -1114,7 +1115,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; @@ -1326,7 +1327,6 @@ void OpenGL3DRenderer::RenderExtrude3DObject() CHECK_GL_ERROR(); glBindBuffer(GL_UNIFORM_BUFFER, 0); } -extrude3DInfo.reverse = 0; if (extrude3DInfo.rounded) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_CubeElementBuf); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source include/vcl vcl/source
chart2/source/view/charttypes/GL3DBarChart.cxx |4 +-- chart2/source/view/inc/GL3DRenderer.hxx|4 +-- chart2/source/view/main/GL3DRenderer.cxx |9 -- include/vcl/opengl/OpenGLHelper.hxx|4 +-- vcl/source/opengl/OpenGLHelper.cxx | 33 ++--- 5 files changed, 26 insertions(+), 28 deletions(-) New commits: commit 12dd1c3999f7784aba438df38d55c5a8bd2cad3e Author: Markus Mohrhard Date: Wed May 21 14:23:07 2014 +0200 fix my issues with the offscreen rendering Change-Id: I4a2ed8a20890119220d63a6768f13365a7b5f97d diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index d36a008..5e21945 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -221,11 +221,11 @@ void GL3DBarChart::clickedAt(const Point& rPos) { sal_uInt32 nId = 1; { -PickingModeSetter(mpRenderer.get()); +PickingModeSetter aPickingModeSetter(mpRenderer.get()); render(); nId = mpRenderer->GetPixelColorFromPoint(rPos.X(), rPos.Y()); } -if (mpCamera) +if (mpCamera && nId != COL_WHITE) mpCamera->zoom(nId); } diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx index b08e90e..c2d7b87 100644 --- a/chart2/source/view/inc/GL3DRenderer.hxx +++ b/chart2/source/view/inc/GL3DRenderer.hxx @@ -366,8 +366,8 @@ private: SceneBox m_SenceBox; GLuint mnPickingFbo; -GLuint mnPickingRbo; -GLuint mnPickingTexture; +GLuint mnPickingRboDepth; +GLuint mnPickingRboColor; }; } diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index cf75ea6..d248016 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -112,8 +112,8 @@ OpenGL3DRenderer::~OpenGL3DRenderer() glDeleteBuffers(1, &m_VertexBuffer); glDeleteFramebuffers(1, &mnPickingFbo); -glDeleteRenderbuffers(1, &mnPickingRbo); -glDeleteTextures(1, &mnPickingTexture); +glDeleteRenderbuffers(1, &mnPickingRboDepth); +glDeleteRenderbuffers(1, &mnPickingRboColor); } void OpenGL3DRenderer::ShaderResources::LoadShaders() @@ -253,7 +253,7 @@ void OpenGL3DRenderer::init() glBufferData(GL_ARRAY_BUFFER, sizeof(squareVertices), squareVertices, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); -OpenGLHelper::createFramebuffer(m_iWidth, m_iHeight, mnPickingFbo, mnPickingRbo, mnPickingTexture); +OpenGLHelper::createFramebuffer(m_iWidth, m_iHeight, mnPickingFbo, mnPickingRboDepth, mnPickingRboColor); CHECK_GL_ERROR(); Init3DUniformBlock(); @@ -1601,6 +1601,9 @@ sal_uInt32 OpenGL3DRenderer::GetPixelColorFromPoint(long nX, long nY) boost::scoped_array buf(new sal_uInt8[4]); glReadPixels(nX, nY, 1, 1, GL_BGRA, GL_UNSIGNED_BYTE, buf.get()); Color aColor(buf[3], buf[2], buf[1], buf[0]); +static sal_Int32 i = 0; +OUString aFileName = OUString("/home/moggi/Documents/work/shader") + OUString::number(i) + ".png"; +OpenGLHelper::renderToFile(m_iWidth, m_iHeight, aFileName); return aColor.GetColor(); } diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx index 70b1d2a..475bd72 100644 --- a/include/vcl/opengl/OpenGLHelper.hxx +++ b/include/vcl/opengl/OpenGLHelper.hxx @@ -32,10 +32,10 @@ public: /** * The caller is responsible for deleting the buffer objects identified by - * nFramebufferId, nRenderbufferId and nTexturebufferId + * nFramebufferId, nRenderbufferDepthId and nRenderbufferColorId */ static void createFramebuffer(long nWidth, long nHeight, -GLuint& nFramebufferId, GLuint& nRenderbufferId, GLuint& nTexturebufferId); +GLuint& nFramebufferId, GLuint& nRenderbufferTextId, GLuint& nRenderbufferColorId); }; VCLOPENGL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const glm::mat4& rMatrix); diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index ad2506d..50d5799 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -269,36 +269,31 @@ std::ostream& operator<<(std::ostream& rStrm, const glm::mat4& rMatrix) } void OpenGLHelper::createFramebuffer(long nWidth, long nHeight, -GLuint& nFramebufferId, GLuint& nRenderbufferId, GLuint& nTexturebufferId) +GLuint& nFramebufferId, GLuint& nRenderbufferDepthId, GLuint& nRenderbufferColorId) { -// create a renderbuffer -glGenRenderbuffers(1, &nRenderbufferId); -glBindRenderbuffer(GL_RENDERBUFFER, nRenderbufferId); +// create a renderbuffer for depth attachment +glGenRenderbuffers(1, &nRenderbufferDepthId); +glBindRenderbuffer(GL_RENDERBUFFER, nRenderbufferDepthId); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, nWidth, nHeig
[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - chart2/source include/vcl vcl/source
chart2/source/view/charttypes/GL3DBarChart.cxx |5 + chart2/source/view/inc/GL3DBarChart.hxx|1 + include/vcl/openglwin.hxx |5 + vcl/source/window/openglwin.cxx| 12 4 files changed, 23 insertions(+) New commits: commit 19871e8f974e9a8da3927d785142f598e2e56123 Author: Michael Meeks Date: Sat May 24 16:43:05 2014 +0100 Stub mouse move events propagation to 3D charts. Change-Id: If87545df4b1caeece107a20e0c00df88fb8e6fd5 diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 6d0b6d7..1837736 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -250,6 +250,11 @@ void GL3DBarChart::clickedAt(const Point& rPos) mpCamera->zoom(nId); } +void GL3DBarChart::mouseDragMove(const Point& rPos, sal_uInt16 nButtons) +{ +//fprintf(stderr, "drag move %ld %ld (0x%x)\n", rPos.X(), rPos.Y(), nButtons); +} + void GL3DBarChart::contextDestroyed() { mbValidContext = false; diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx index 674daf6..5f1bcf9 100644 --- a/chart2/source/view/inc/GL3DBarChart.hxx +++ b/chart2/source/view/inc/GL3DBarChart.hxx @@ -47,6 +47,7 @@ public: virtual void update() SAL_OVERRIDE; virtual void clickedAt(const Point& rPos) SAL_OVERRIDE; +virtual void mouseDragMove(const Point& rPos, sal_uInt16 nButtons) SAL_OVERRIDE; virtual void contextDestroyed() SAL_OVERRIDE; private: diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx index 8e34d05..f69d0b3 100644 --- a/include/vcl/openglwin.hxx +++ b/include/vcl/openglwin.hxx @@ -10,6 +10,7 @@ #ifndef INCLUDED_VCL_OPENGLWIN_HXX #define INCLUDED_VCL_OPENGLWIN_HXX +#include #include #include @@ -24,6 +25,7 @@ public: virtual ~IRenderer() {} virtual void update() = 0; virtual void clickedAt(const Point& rPos) = 0; +virtual void mouseDragMove(const Point& rPos, sal_uInt16 nButtons) = 0; virtual void contextDestroyed() = 0; }; @@ -39,7 +41,10 @@ public: void setRenderer(IRenderer* pRenderer); virtual void Paint(const Rectangle&) SAL_OVERRIDE; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; +virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; +virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; private: boost::scoped_ptr mpImpl; diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx index d6e5357..9fd3935 100644 --- a/vcl/source/window/openglwin.cxx +++ b/vcl/source/window/openglwin.cxx @@ -65,6 +65,18 @@ void OpenGLWindow::MouseButtonDown( const MouseEvent& rMEvt ) mpRenderer->clickedAt(aPoint); } +void OpenGLWindow::MouseButtonUp( const MouseEvent& /* rMEvt */ ) +{ +// in case we need to track button state ourselves. +} + +void OpenGLWindow::MouseMove( const MouseEvent& rMEvt ) +{ +if(rMEvt.GetButtons()) +mpRenderer->mouseDragMove(rMEvt.GetPosPixel(), + rMEvt.GetButtons()); +} + void OpenGLWindow::setRenderer(IRenderer* pRenderer) { mpRenderer = pRenderer; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits