Kaydet (Commit) 8419d672 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

OPENGL_SCALE_VALUE is not needed any more

It seems to me that this value was a workaround to
make chart fit to the OpenGL window (working in calc, in default view).
Now it's uselss since projection matrix do this job better.

Change-Id: I968d6d96cb45c2444b8ebed59830b87f0cb87b61
üst 5278a0e3
...@@ -1158,8 +1158,8 @@ void SAL_CALL DummyChart::setSize( const awt::Size& aSize ) ...@@ -1158,8 +1158,8 @@ void SAL_CALL DummyChart::setSize( const awt::Size& aSize )
throw( beans::PropertyVetoException, uno::RuntimeException, std::exception ) throw( beans::PropertyVetoException, uno::RuntimeException, std::exception )
{ {
SAL_INFO("chart2.opengl", "DummyChart::setSize()---aSize.Width = " << aSize.Width << ", aSize.Height = " << aSize.Height); SAL_INFO("chart2.opengl", "DummyChart::setSize()---aSize.Width = " << aSize.Width << ", aSize.Height = " << aSize.Height);
int width = aSize.Width / OPENGL_SCALE_VALUE; int width = aSize.Width;
int height = aSize.Height / OPENGL_SCALE_VALUE; int height = aSize.Height;
DummyXShape::setSize(awt::Size(0,0)); DummyXShape::setSize(awt::Size(0,0));
m_GLRender.SetSize(width, height); m_GLRender.SetSize(width, height);
SAL_INFO("chart2.opengl", "DummyChart::GLRender.Width = " << width << ", GLRender.Height = " << height); SAL_INFO("chart2.opengl", "DummyChart::GLRender.Width = " << width << ", GLRender.Height = " << height);
......
...@@ -177,10 +177,8 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength) ...@@ -177,10 +177,8 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
{ {
m_Line2DPointList.reserve(listLength*3); m_Line2DPointList.reserve(listLength*3);
} }
float actualX = (x / OPENGL_SCALE_VALUE); m_Line2DPointList.push_back(x);
float actualY = (y / OPENGL_SCALE_VALUE); m_Line2DPointList.push_back(y);
m_Line2DPointList.push_back(actualX);
m_Line2DPointList.push_back(actualY);
m_Line2DPointList.push_back(m_fZStep); m_Line2DPointList.push_back(m_fZStep);
if (m_Line2DPointList.size() == size_t(listLength * 3)) if (m_Line2DPointList.size() == size_t(listLength * 3))
...@@ -368,7 +366,7 @@ void OpenGLRender::SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uIn ...@@ -368,7 +366,7 @@ void OpenGLRender::SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uIn
void OpenGLRender::SetLine2DWidth(int width) void OpenGLRender::SetLine2DWidth(int width)
{ {
m_fLineWidth = std::max((float)width / OPENGL_SCALE_VALUE, 0.001f); m_fLineWidth = std::max((float)width, 0.001f);
} }
void OpenGLRender::SetColor(sal_uInt32 color, sal_uInt8 nAlpha) void OpenGLRender::SetColor(sal_uInt32 color, sal_uInt8 nAlpha)
...@@ -406,13 +404,11 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d ...@@ -406,13 +404,11 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d
Create2DCircle(100); Create2DCircle(100);
} }
float actualX = (x / OPENGL_SCALE_VALUE);
float actualY = (y / OPENGL_SCALE_VALUE);
Bubble2DPointList aBubble2DPointList; Bubble2DPointList aBubble2DPointList;
aBubble2DPointList.xScale = directionX / OPENGL_SCALE_VALUE; aBubble2DPointList.xScale = directionX;
aBubble2DPointList.yScale = directionY / OPENGL_SCALE_VALUE; aBubble2DPointList.yScale = directionY;
aBubble2DPointList.x = actualX + aBubble2DPointList.xScale / 2; aBubble2DPointList.x = x + aBubble2DPointList.xScale / 2;
aBubble2DPointList.y = actualY + aBubble2DPointList.yScale / 2; aBubble2DPointList.y = y + aBubble2DPointList.yScale / 2;
m_Bubble2DShapePointList.push_back(aBubble2DPointList); m_Bubble2DShapePointList.push_back(aBubble2DPointList);
return 0; return 0;
...@@ -499,24 +495,19 @@ int OpenGLRender::RenderBubble2FBO(int) ...@@ -499,24 +495,19 @@ int OpenGLRender::RenderBubble2FBO(int)
int OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float directionY) int OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float directionY)
{ {
//check whether to create the circle data
float actualX = x / OPENGL_SCALE_VALUE;
float actualY = y / OPENGL_SCALE_VALUE;
float actualSizeX = directionX / OPENGL_SCALE_VALUE;
float actualSizeY = directionY / OPENGL_SCALE_VALUE;
RectanglePointList aRectangle; RectanglePointList aRectangle;
aRectangle.points[0] = actualX; aRectangle.points[0] = x;
aRectangle.points[1] = actualY; aRectangle.points[1] = y;
aRectangle.points[2] = m_fZStep; aRectangle.points[2] = m_fZStep;
aRectangle.points[3] = actualX + actualSizeX; aRectangle.points[3] = x + directionX;
aRectangle.points[4] = actualY; aRectangle.points[4] = y;
aRectangle.points[5] = m_fZStep; aRectangle.points[5] = m_fZStep;
aRectangle.points[6] = actualX + actualSizeX; aRectangle.points[6] = x + directionX;
aRectangle.points[7] = actualY + actualSizeY; aRectangle.points[7] = y + directionY;
aRectangle.points[8] = m_fZStep; aRectangle.points[8] = m_fZStep;
aRectangle.points[9] = actualX; aRectangle.points[9] = x;
aRectangle.points[10] = actualY + actualSizeY; aRectangle.points[10] = y + directionY;
aRectangle.points[11] = m_fZStep; aRectangle.points[11] = m_fZStep;
m_RectangleShapePointList.push_back(aRectangle); m_RectangleShapePointList.push_back(aRectangle);
...@@ -696,23 +687,23 @@ int OpenGLRender::CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixel ...@@ -696,23 +687,23 @@ int OpenGLRender::CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixel
TextInfo aTextInfo; TextInfo aTextInfo;
aTextInfo.rotation = -(double)rotation / 360.0 * 2* GL_PI; aTextInfo.rotation = -(double)rotation / 360.0 * 2* GL_PI;
aTextInfo.vertex[0] = -aSize.Width / 2 / OPENGL_SCALE_VALUE; aTextInfo.vertex[0] = -aSize.Width / 2;
aTextInfo.vertex[1] = -aSize.Height / 2 / OPENGL_SCALE_VALUE; aTextInfo.vertex[1] = -aSize.Height / 2;
aTextInfo.vertex[2] = m_fZStep; aTextInfo.vertex[2] = m_fZStep;
aTextInfo.vertex[3] = aSize.Width / 2 / OPENGL_SCALE_VALUE ; aTextInfo.vertex[3] = aSize.Width / 2;
aTextInfo.vertex[4] = -aSize.Height / 2 / OPENGL_SCALE_VALUE; aTextInfo.vertex[4] = -aSize.Height / 2;
aTextInfo.vertex[5] = m_fZStep; aTextInfo.vertex[5] = m_fZStep;
aTextInfo.vertex[6] = aSize.Width / 2 / OPENGL_SCALE_VALUE; aTextInfo.vertex[6] = aSize.Width / 2;
aTextInfo.vertex[7] = aSize.Height / 2 / OPENGL_SCALE_VALUE; aTextInfo.vertex[7] = aSize.Height / 2;
aTextInfo.vertex[8] = m_fZStep; aTextInfo.vertex[8] = m_fZStep;
aTextInfo.vertex[9] = -aSize.Width / 2 / OPENGL_SCALE_VALUE; aTextInfo.vertex[9] = -aSize.Width / 2;
aTextInfo.vertex[10] = aSize.Height / 2 / OPENGL_SCALE_VALUE; aTextInfo.vertex[10] = aSize.Height / 2;
aTextInfo.vertex[11] = m_fZStep; aTextInfo.vertex[11] = m_fZStep;
aTextInfo.nDx = (rTrans.Line1.Column3 + aSize.Width / 2 ) / OPENGL_SCALE_VALUE - bmpWidth/2; aTextInfo.nDx = (rTrans.Line1.Column3 + aSize.Width / 2 ) - bmpWidth/2;
aTextInfo.nDy = (rTrans.Line2.Column3 + aSize.Height / 2 ) / OPENGL_SCALE_VALUE - bmpHeight/2; aTextInfo.nDy = (rTrans.Line2.Column3 + aSize.Height / 2 ) - bmpHeight/2;
CHECK_GL_ERROR(); CHECK_GL_ERROR();
glGenTextures(1, &aTextInfo.texture); glGenTextures(1, &aTextInfo.texture);
...@@ -808,10 +799,8 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength) ...@@ -808,10 +799,8 @@ int OpenGLRender::SetArea2DShapePoint(float x, float y, int listLength)
{ {
m_Area2DPointList.reserve(listLength); m_Area2DPointList.reserve(listLength);
} }
float actualX = (x / OPENGL_SCALE_VALUE); m_Area2DPointList.push_back(x);
float actualY = (y / OPENGL_SCALE_VALUE); m_Area2DPointList.push_back(y);
m_Area2DPointList.push_back(actualX);
m_Area2DPointList.push_back(actualY);
m_Area2DPointList.push_back(m_fZStep); m_Area2DPointList.push_back(m_fZStep);
if (m_Area2DPointList.size() == size_t(listLength * 3)) if (m_Area2DPointList.size() == size_t(listLength * 3))
...@@ -985,9 +974,9 @@ void OpenGLRender::GeneratePieSegment2D(double fInnerRadius, double fOutterRadiu ...@@ -985,9 +974,9 @@ void OpenGLRender::GeneratePieSegment2D(double fInnerRadius, double fOutterRadiu
int OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY) int OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY)
{ {
int listNum = m_PieSegment2DShapePointList.size(); int listNum = m_PieSegment2DShapePointList.size();
PosVecf3 trans = {fPosX/OPENGL_SCALE_VALUE, fPosY/OPENGL_SCALE_VALUE, 0.0f}; PosVecf3 trans = {fPosX, fPosY, 0.0f};
PosVecf3 angle = {0.0f, 0.0f, 0.0f}; PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {fSize/OPENGL_SCALE_VALUE, fSize/OPENGL_SCALE_VALUE, 1.0f}; PosVecf3 scale = {fSize, fSize, 1.0f};
MoveModelf(trans, angle, scale); MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model; m_MVP = m_Projection * m_View * m_Model;
...@@ -1040,7 +1029,7 @@ int OpenGLRender::RenderSymbol2DShape(float x, float y, float , float , sal_Int3 ...@@ -1040,7 +1029,7 @@ int OpenGLRender::RenderSymbol2DShape(float x, float y, float , float , sal_Int3
MoveModelf(trans, angle, scale); MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model; m_MVP = m_Projection * m_View * m_Model;
float aPos[3] = { x/OPENGL_SCALE_VALUE, y/OPENGL_SCALE_VALUE, m_fZStep }; float aPos[3] = { x, y, m_fZStep };
//fill vertex buffer //fill vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
CHECK_GL_ERROR(); CHECK_GL_ERROR();
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "glm/gtx/euler_angles.hpp" #include "glm/gtx/euler_angles.hpp"
#include "glm/gtx/quaternion.hpp" #include "glm/gtx/quaternion.hpp"
#define OPENGL_SCALE_VALUE 20
#define DEBUG_POSITIONING 0 #define DEBUG_POSITIONING 0
#define RENDER_TO_FILE 0 #define RENDER_TO_FILE 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment