1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_CHART2_SOURCE_VIEW_MAIN_OPENGLRENDER_HXX
11 #define INCLUDED_CHART2_SOURCE_VIEW_MAIN_OPENGLRENDER_HXX
13 #include <vcl/bitmapex.hxx>
14 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
15 #include <com/sun/star/drawing/FillStyle.hpp>
16 #include <com/sun/star/drawing/XDrawPage.hpp>
17 #include <vcl/font.hxx>
18 #include <vcl/opengl/OpenGLContext.hxx>
19 #include <boost/shared_array.hpp>
24 #include <glm/glm.hpp>
25 #include <glm/gtx/transform.hpp>
26 #include <glm/gtx/euler_angles.hpp>
27 #include <glm/gtx/quaternion.hpp>
29 #define DEBUG_POSITIONING 0
38 struct Bubble2DPointList
46 struct RectanglePointList
60 typedef std::vector
<GLfloat
> PointList
;
62 // for 3D, use vector to save the points
70 int MoveModelf(const PosVecf3
& trans
, const PosVecf3
& angle
, const PosVecf3
& scale
);
71 void SetSize(int width
, int height
);
72 void SetSizePixel(int width
, int height
);
75 int SetLine2DShapePoint(float x
, float y
, int listLength
);
76 void SetLine2DColor(sal_uInt8 r
, sal_uInt8 g
, sal_uInt8 b
, sal_uInt8 nAlpha
);
77 void SetLine2DWidth(int width
);
78 void SetColor(sal_uInt32 color
, sal_uInt8 nAlpha
);
79 int Bubble2DShapePoint(float x
, float y
, float directionX
, float directionY
);
80 int RenderBubble2FBO();
82 void prepareToRender();
84 int RenderRectangleShape(bool bBorder
, bool bFill
);
85 int RectangleShapePoint(float x
, float y
, float directionX
, float directionY
);
87 int CreateTextTexture(const boost::shared_array
<sal_uInt8
> &rPixels
,
88 const ::Size
&aPixelSize
,
89 const css::awt::Size
& aSize
,
91 const css::drawing::HomogenMatrix3
& rTrans
);
92 int CreateTextTexture(const BitmapEx
& rBitmapEx
,
93 const css::awt::Size
& aSize
,
94 long rotation
, const css::drawing::HomogenMatrix3
& rTrans
);
95 int RenderTextShape();
97 int SetArea2DShapePoint(float x
, float y
, int listLength
);
98 int RenderArea2DShape();
99 void SetChartTransparencyGradient(long transparencyGradient
);
101 void GeneratePieSegment2D(double, double, double, double);
102 int RenderPieSegment2DShape(float, float, float);
104 int RenderSymbol2DShape(float, float, sal_Int32
);
105 #if DEBUG_POSITIONING
109 void SetBackGroundColor(::Color color1
, ::Color color2
, css::drawing::FillStyle fillstyle
);
117 int Create2DCircle(int detail
);
119 // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
120 glm::mat4 m_Projection
;
123 // Model matrix : an identity matrix (model will be at the origin
125 // Our ModelViewProjection : multiplication of our 3 matrices
128 GLuint m_VertexBuffer
;
130 GLuint m_ColorBuffer
;
134 GLuint m_RenderVertexBuf
;
136 GLuint m_RenderTexCoordBuf
;
138 PointList m_Line2DPointList
;
142 std::vector
<PointList
> m_Line2DShapePointList
;
146 std::vector
<GLfloat
> m_Bubble2DCircle
;
148 std::vector
<Bubble2DPointList
> m_Bubble2DShapePointList
;
155 std::vector
<RectanglePointList
> m_RectangleShapePointList
;
157 std::vector
<TextInfo
> m_TextInfoVector
;
159 GLint m_TextMatrixID
;
160 GLint m_TextVertexID
;
161 GLint m_TextTexCoordID
;
162 GLuint m_TextTexCoordBuf
;
165 PointList m_Area2DPointList
;
166 std::vector
<PointList
> m_Area2DShapePointList
;
168 GLint m_BackgroundProID
;
169 GLint m_BackgroundMatrixID
;
170 GLint m_BackgroundVertexID
;
171 GLint m_BackgroundColorID
;
173 float m_BackgroundColor
[16];
175 std::vector
<PointList
> m_PieSegment2DShapePointList
;
177 GLuint m_SymbolProID
;
178 GLuint m_SymbolVertexID
;
179 GLuint m_SymbolMatrixID
;
180 GLuint m_SymbolColorID
;
181 GLuint m_SymbolShapeID
;
183 #if DEBUG_POSITIONING
185 GLuint m_DebugVertexID
;
186 GLuint m_DebugColorID
;
190 #endif // INCLUDED_CHART2_SOURCE_VIEW_MAIN_OPENGLRENDER_HXX
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */