[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart' - 4 commits - chart2/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Fri May 9 19:36:21 PDT 2014
chart2/source/view/charttypes/GL3DBarChart.cxx | 3 +
chart2/source/view/inc/GL3DRenderer.hxx | 38 ++++++++++++++++---------
chart2/source/view/main/GL3DRenderer.cxx | 20 +++----------
3 files changed, 33 insertions(+), 28 deletions(-)
New commits:
commit dd03005e628c7ae42dc10d245173730f8b586630
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat May 10 04:31:07 2014 +0200
we need to call OpenGL3DRenderer::init
Change-Id: I9bcdc7d033835bf3cdb6f9d4770aaee284f7eaf7
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 5384a64..525b4fc 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -72,6 +72,7 @@ void GL3DBarChart::render()
{
mrWindow.getContext()->makeCurrent();
Size aSize = mrWindow.GetSizePixel();
+ mpRenderer->init();
mpRenderer->SetSize(aSize);
mrWindow.getContext()->setWinSize(aSize);
for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(),
commit 8e75a19df2e18c6ecdccac7049669af0a54fa3e7
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat May 10 04:30:46 2014 +0200
change the color of the bars as the ackground is blue as well
Change-Id: Ib16ef3548368e5b07dd9411a4515d5e6abe3acaf
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 02264e4..5384a64 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -55,7 +55,7 @@ void GL3DBarChart::create3DShapes()
float nXPos = nIndex * (nBarSizeX + nBarDistanceX);
float nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY);
- sal_Int32 nColor = COL_BLUE;
+ sal_Int32 nColor = COL_RED;
glm::mat4 aBarPosition;
aBarPosition = glm::scale(aBarPosition, nBarSizeX, nBarSizeY, nVal);
commit 9042317d327afce5ca3ed3fd92347861b27057b9
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat May 10 04:29:20 2014 +0200
remove more unnecessary typedefs
Change-Id: I62968f11220da31febdbdff2d057607696ea6271
diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index c49370a..8c57412 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -42,7 +42,7 @@ typedef std::vector <glm::vec3> Vertices3D;
typedef std::vector <glm::vec2> UVs3D;
typedef std::vector <glm::vec3> Normals3D;
-typedef struct MaterialParameters
+struct MaterialParameters
{
glm::vec4 ambient;
glm::vec4 diffuse;
@@ -53,9 +53,9 @@ typedef struct MaterialParameters
float shininess;
float pad;
float pad1;
-}Material;
+};
-typedef struct LightSource
+struct LightSource
{
glm::vec4 lightColor;
glm::vec4 positionWorldspace;
@@ -63,16 +63,16 @@ typedef struct LightSource
float pad1;
float pad2;
float pad3;
-}LightSource;
+};
-typedef struct GlobalLights
+struct GlobalLights
{
int lightNum;
glm::vec4 ambient;
LightSource light[MAX_LIGHT_NUM];
-}Lights;
+};
-typedef struct Polygon3DInfo
+struct Polygon3DInfo
{
bool lineOnly;
float lineWidth;
@@ -85,10 +85,10 @@ typedef struct Polygon3DInfo
std::list <Vertices3D *> verticesList;
std::list <UVs3D *> uvsList;
std::list <Normals3D *> normalsList;
- Material material;
-}Polygon3DInfo;
+ MaterialParameters material;
+};
-typedef struct Extrude3DInfo
+struct Extrude3DInfo
{
int pickingFlg;
bool rounded;
@@ -104,11 +104,11 @@ typedef struct Extrude3DInfo
float yTransform;
float zTransform;
glm::mat4 rotation;
- Material material;
+ MaterialParameters material;
int startIndex[5];
int size[5];
int reverse;
-}Extrude3DInfo;
+};
struct CameraInfo
@@ -268,7 +268,7 @@ private:
float m_fZmax;
- Lights m_LightsInfo;
+ GlobalLights m_LightsInfo;
CameraInfo m_CameraInfo;
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index b3a9c53..f9f5e10 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -742,7 +742,7 @@ void OpenGL3DRenderer::RenderPolygon3D(Polygon3DInfo &polygon)
//update ubo
Update3DUniformBlock();
glBindBuffer(GL_UNIFORM_BUFFER, m_3DUBOBuffer);
- glBufferSubData(GL_UNIFORM_BUFFER, m_3DActualSizeLight, sizeof(Material), &polygon.material);
+ glBufferSubData(GL_UNIFORM_BUFFER, m_3DActualSizeLight, sizeof(MaterialParameters), &polygon.material);
CHECK_GL_ERROR();
glBindBuffer(GL_UNIFORM_BUFFER, 0);
glUseProgram(m_3DProID);
@@ -1269,7 +1269,7 @@ void OpenGL3DRenderer::RenderExtrude3DObject()
extrude3DInfo.yTransform *= m_fHeightWeight;
extrude3DInfo.yScale *= m_fHeightWeight;
glBindBuffer(GL_UNIFORM_BUFFER, m_3DUBOBuffer);
- glBufferSubData(GL_UNIFORM_BUFFER, m_3DActualSizeLight, sizeof(Material), &extrude3DInfo.material);
+ glBufferSubData(GL_UNIFORM_BUFFER, m_3DActualSizeLight, sizeof(MaterialParameters), &extrude3DInfo.material);
CHECK_GL_ERROR();
glBindBuffer(GL_UNIFORM_BUFFER, 0);
extrude3DInfo.reverse = 0;
commit d64c1431c8d85b7e7169ab5e968a301c5f24d079
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Fri May 9 05:34:34 2014 +0200
initialize variables in initializer list
Change-Id: I1526d40c28a33cd29074adcc8c8d182f92996914
diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 6c00422..c49370a 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -117,6 +117,10 @@ struct CameraInfo
glm::vec3 cameraPos;
glm::vec3 cameraOrg;
glm::vec3 cameraUp;
+
+ CameraInfo():
+ useDefault(true),
+ cameraUp(glm::vec3(0, 1, 0)) {}
};
struct CoordinateAxisInfo
@@ -161,6 +165,14 @@ struct SceneBox
float minYCoord;
float maxZCoord;
float minZCoord;
+
+ SceneBox():
+ maxXCoord(-1*FLT_MAX),
+ minXCoord(FLT_MAX),
+ maxYCoord(-1*FLT_MAX),
+ minYCoord(FLT_MAX),
+ maxZCoord(-1*FLT_MAX),
+ minZCoord(FLT_MAX) {}
};
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 277b78b..b3a9c53 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -66,12 +66,16 @@ GLfloat texCoords[] = {
OpenGL3DRenderer::OpenGL3DRenderer():
m_TranslationMatrix(glm::translate(m_Model, glm::vec3(0.0f, 0.0f, 0.0f)))
+ , m_bCameraUpdated(false)
, m_TextProID(0)
, m_TextMatrixID(0)
, m_TextVertexID(0)
, m_TextTexCoordID(0)
, m_TextTexCoordBuf(0)
, m_TextTexID(0)
+ , m_uiSelectFrameCounter(0)
+ , m_fViewAngle(30.0f)
+ , m_fHeightWeight(1.0f)
{
m_Polygon3DInfo.lineOnly = false;
m_Polygon3DInfo.twoSidesLighting = false;
@@ -84,19 +88,7 @@ OpenGL3DRenderer::OpenGL3DRenderer():
m_Extrude3DInfo.twoSidesLighting = false;
m_Extrude3DInfo.lineWidth = 0.001f;
- m_bCameraUpdated = false;
GetFreq();
- m_fViewAngle = 30.0f;
- m_SenceBox.maxXCoord = -1.0 * FLT_MAX;
- m_SenceBox.minXCoord = FLT_MAX;
- m_SenceBox.maxYCoord = -1.0 * FLT_MAX;
- m_SenceBox.minYCoord = FLT_MAX;
- m_SenceBox.maxZCoord = -1.0 * FLT_MAX;
- m_SenceBox.minZCoord = FLT_MAX;
- m_uiSelectFrameCounter = 0;
- m_fHeightWeight = 1.0f;
- m_CameraInfo.useDefault = true;
- m_CameraInfo.cameraUp = glm::vec3(0, 1, 0);
m_RoundBarMesh.iMeshSizes = 0;
}
More information about the Libreoffice-commits
mailing list