[Libreoffice-commits] core.git: Branch 'feature/chart-opengl2' - 4 commits - chart2/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Wed Jan 15 12:34:03 PST 2014
chart2/source/view/main/DummyXShape.cxx | 22 +++++++++--
chart2/source/view/main/OpenGLRender.cxx | 49 +++++++++++++------------
chart2/source/view/main/OpenGLRender.hxx | 12 +-----
chart2/source/view/main/OpenglShapeFactory.cxx | 1
4 files changed, 50 insertions(+), 34 deletions(-)
New commits:
commit 3d8d018861caf9a0aa56abbff053aec28f92c536
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Jan 15 21:30:57 2014 +0100
fix z ordering problems
Change-Id: Ia1c9ea521029f871c8b0bdfd078d986d3e0f40e8
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 7340b37..a73b39a 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -572,7 +572,7 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
float actualY = (y / OPENGL_SCALE_VALUE);
m_Line2DPointList.push_back(actualX);
m_Line2DPointList.push_back(actualY);
- m_Line2DPointList.push_back(0);
+ m_Line2DPointList.push_back(m_fZStep);
if (m_Line2DPointList.size() == size_t(listLength * 3))
{
@@ -584,6 +584,7 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
int OpenGLRender::RenderLine2FBO(int)
{
+ m_fZStep += 0.001;
CHECK_GL_ERROR();
glLineWidth(m_fLineWidth);
size_t listNum = m_Line2DShapePointList.size();
@@ -1282,7 +1283,7 @@ int OpenGLRender::RenderBubble2FBO(int)
{
//move the circle to the pos, and scale using the xScale and Y scale
Bubble2DPointList &pointList = m_Bubble2DShapePointList.front();
- PosVecf3 trans = {pointList.x, pointList.y, 0.0f};
+ PosVecf3 trans = {pointList.x, pointList.y, m_fZStep};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {pointList.xScale, pointList.yScale, 1.0f};
MoveModelf(trans, angle, scale);
commit ffe0d1748cd09538cb20dc6e35cca5fa4fa29d9a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Jan 15 21:30:41 2014 +0100
finally fix rectangle rendering
Change-Id: Iaf0467ce4d9eb12ac3e84c2f1059b859ee9c4de1
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 5b60108..7340b37 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -211,13 +211,6 @@ static GLfloat coordVertices[] = {
0.0f, 1.0f,
};
-static GLfloat square2DVertices[] = {
- -1.0f, -1.0f,
- 1.0f, -1.0f,
- 1.0f, 1.0f,
- -1.0f, 1.0f
-};
-
#if 0
static const GLfloat g_vertex_buffer_data[] = {
-1.0f,-1.0f,-1.0f,
@@ -1346,34 +1339,46 @@ int OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float
//check whether to create the circle data
float actualX = x / OPENGL_SCALE_VALUE;
float actualY = y / OPENGL_SCALE_VALUE;
- RectanglePointList aRectangleList.x = actualX;
- aRectangleList.y = actualY;
- aRectangleList.z = m_fZStep;
- aRectangleList.xScale = directionX / OPENGL_SCALE_VALUE;
- aRectangleList.yScale = directionY / OPENGL_SCALE_VALUE;
-
- m_RectangleShapePointList.push_back(aRectangleList);
+ float actualSizeX = directionX / OPENGL_SCALE_VALUE;
+ float actualSizeY = directionY / OPENGL_SCALE_VALUE;
+ RectanglePointList aRectangle;
+
+ aRectangle.points[0] = actualX;
+ aRectangle.points[1] = actualY;
+ aRectangle.points[2] = m_fZStep;
+ aRectangle.points[3] = actualX + actualSizeX;
+ aRectangle.points[4] = actualX;
+ aRectangle.points[5] = m_fZStep;
+ aRectangle.points[6] = actualX + actualSizeX;
+ aRectangle.points[7] = actualX + actualSizeY;
+ aRectangle.points[8] = m_fZStep;
+ aRectangle.points[9] = actualX;
+ aRectangle.points[10] = actualX + actualSizeY;
+ aRectangle.points[11] = m_fZStep;
+
+ m_RectangleShapePointList.push_back(aRectangle);
return 0;
}
int OpenGLRender::RenderRectangleShape()
{
+ m_fZStep += 0.001;
size_t listNum = m_RectangleShapePointList.size();
for (size_t i = 0; i < listNum; i++)
{
//move the circle to the pos, and scale using the xScale and Y scale
RectanglePointList &pointList = m_RectangleShapePointList.front();
- PosVecf3 trans = {pointList.x, pointList.y, pointList.z};
+ PosVecf3 trans = {0, 0, 0};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
- PosVecf3 scale = {pointList.xScale, pointList.yScale, 1.0f};
+ PosVecf3 scale = {1, 1, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
//render to fbo
//fill vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
- glBufferData(GL_ARRAY_BUFFER, sizeof(square2DVertices), square2DVertices, GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(pointList.points), pointList.points, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, m_ColorBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(m_BackgroundColor), m_BackgroundColor, GL_STATIC_DRAW);
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 68d0982..815d7d3 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -84,14 +84,10 @@ typedef struct Bubble2DCircle
int bufLen;
}Bubble2DCircle;
-typedef struct RectanglePointList
+struct RectanglePointList
{
- float x;
- float y;
- float z;
- float xScale;
- float yScale;
-}RectanglePointList;
+ float points[12];
+};
typedef struct TextInfo
{
commit b352ef579930f654734fe6d9219cf4af43b8c0bf
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed Jan 15 21:03:48 2014 +0100
does not need to be a member variable
Change-Id: Ib5b61f724c9df974d02875cde76079094cb59c38
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index d540fe2..5b60108 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -940,7 +940,6 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget):
memset(&m_Bubble2DPointList, 0, sizeof(m_Bubble2DPointList));
memset(&m_Bubble2DCircle, 0, sizeof(m_Bubble2DCircle));
memset(&m_TextInfo, 0, sizeof(TextInfo));
- memset(&m_RectangleList, 0, sizeof(RectanglePointList));
m_iArbMultisampleFormat = 0;
@@ -1347,13 +1346,13 @@ int OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float
//check whether to create the circle data
float actualX = x / OPENGL_SCALE_VALUE;
float actualY = y / OPENGL_SCALE_VALUE;
- m_RectangleList.x = actualX;
- m_RectangleList.y = actualY;
- m_RectangleList.z = m_fZStep;
- m_RectangleList.xScale = directionX / OPENGL_SCALE_VALUE;
- m_RectangleList.yScale = directionY / OPENGL_SCALE_VALUE;
+ RectanglePointList aRectangleList.x = actualX;
+ aRectangleList.y = actualY;
+ aRectangleList.z = m_fZStep;
+ aRectangleList.xScale = directionX / OPENGL_SCALE_VALUE;
+ aRectangleList.yScale = directionY / OPENGL_SCALE_VALUE;
- m_RectangleShapePointList.push_back(m_RectangleList);
+ m_RectangleShapePointList.push_back(aRectangleList);
return 0;
}
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 5a28644..68d0982 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -278,8 +278,6 @@ private:
float m_fAlpha;
- RectanglePointList m_RectangleList;
-
std::list <RectanglePointList> m_RectangleShapePointList;
// add for text
TextInfo m_TextInfo;
commit d2d2968067102e8a75e75094ba510161bfda550f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Jan 14 16:19:14 2014 +0100
first fixes for rectangle rendering
Change-Id: I7705f8fd0472ad482d2292438d264eb0b641758e
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 64b1692..917136d 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -568,11 +568,28 @@ DummyRectangle::DummyRectangle(const awt::Size& rSize, const awt::Point& rPoint,
void DummyRectangle::render()
{
- /*
SAL_WARN("chart2.opengl", "render DummyRectangle");
debugProperties(maProperties);
DummyChart* pChart = getRootShape();
- std::map< OUString, uno::Any >::const_iterator itr = maProperties.find("FillColor");
+ std::map< OUString, uno::Any >::const_iterator itr = maProperties.find("Invisible");
+ if(itr != maProperties.end())
+ {
+ SAL_WARN("chart2.opengl", "invisble");
+ return;
+ }
+
+ itr = maProperties.find("FillStyle");
+ if(itr != maProperties.end())
+ {
+ drawing::FillStyle eStyle = itr->second.get<drawing::FillStyle>();
+ if(eStyle == drawing::FillStyle_NONE)
+ {
+ SAL_WARN("chart2.opengl", "no fill style");
+ return;
+ }
+ }
+
+ itr = maProperties.find("FillColor");
if(itr != maProperties.end())
{
uno::Any co = itr->second;
@@ -593,7 +610,6 @@ void DummyRectangle::render()
}
pChart->m_GLRender.RectangleShapePoint(maPosition.X, maPosition.Y, maSize.Width, maSize.Height);
pChart->m_GLRender.RenderRectangleShape();
- */
}
DummyText::DummyText(const OUString& rText, const tNameSequence& rNames,
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 9bd3e49..d540fe2 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1612,8 +1612,8 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
{
m_Area2DPointList.reserve(listLength);
}
- float actualX = (x / OPENGL_SCALE_VALUE) - ((float)m_iWidth / 2);
- float actualY = (y / OPENGL_SCALE_VALUE) - ((float)m_iHeight / 2);
+ float actualX = (x / OPENGL_SCALE_VALUE);
+ float actualY = (y / OPENGL_SCALE_VALUE);
m_Area2DPointList.push_back(actualX);
m_Area2DPointList.push_back(actualY);
m_Area2DPointList.push_back(m_fZStep);
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index dce9695..d7ab33b 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -368,6 +368,7 @@ uno::Reference< drawing::XShape > OpenglShapeFactory::createInvisibleRectangle(
, const awt::Size& rSize )
{
dummy::DummyRectangle* pRectangle = new dummy::DummyRectangle(rSize);
+ pRectangle->setPropertyValue("Invisible", uno::makeAny(sal_True));
xTarget->add(pRectangle);
return pRectangle;
}
More information about the Libreoffice-commits
mailing list