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/XDrawPage.hpp>
16 #include <vcl/font.hxx>
17 #include <vcl/opengl/OpenGLContext.hxx>
18 #include <boost/shared_array.hpp>
23 #include "glm/glm.hpp"
24 #include "glm/gtx/transform.hpp"
25 #include "glm/gtx/euler_angles.hpp"
26 #include "glm/gtx/quaternion.hpp"
28 #define DEBUG_POSITIONING 0
37 struct Bubble2DPointList
45 typedef std::vector
<GLfloat
> Bubble2DCircle
;
47 struct RectanglePointList
61 typedef std::vector
<GLfloat
> PointList
;
63 // for 3D, use vector to save the points
71 int MoveModelf(const PosVecf3
& trans
, const PosVecf3
& angle
, const PosVecf3
& scale
);
72 void SetSize(int width
, int height
);
73 void SetSizePixel(int width
, int height
);
75 int RenderLine2FBO(int wholeFlag
);
76 int SetLine2DShapePoint(float x
, float y
, int listLength
);
77 void SetLine2DColor(sal_uInt8 r
, sal_uInt8 g
, sal_uInt8 b
, sal_uInt8 nAlpha
);
78 void SetLine2DWidth(int width
);
79 void SetColor(sal_uInt32 color
, sal_uInt8 nAlpha
);
80 int Bubble2DShapePoint(float x
, float y
, float directionX
, float directionY
);
81 int RenderBubble2FBO(int wholeFlag
);
83 void prepareToRender();
85 int RenderRectangleShape(bool bBorder
, bool bFill
);
86 int RectangleShapePoint(float x
, float y
, float directionX
, float directionY
);
88 int CreateTextTexture(const boost::shared_array
<sal_uInt8
> &rPixels
,
89 const ::Size
&aPixelSize
,
90 const css::awt::Point
&,
91 const css::awt::Size
& aSize
,
93 const css::drawing::HomogenMatrix3
& rTrans
);
94 int CreateTextTexture(const BitmapEx
& rBitmapEx
,
95 const css::awt::Point
& aPos
, const css::awt::Size
& aSize
,
96 long rotation
, const css::drawing::HomogenMatrix3
& rTrans
);
97 int CreateTextTexture(::rtl::OUString
const &textValue
, vcl::Font aFont
, long fontColor
, css::awt::Point aPos
, css::awt::Size aSize
, long rotation
);
98 int RenderTextShape();
100 int SetArea2DShapePoint(float x
, float y
, int listLength
);
101 int RenderArea2DShape();
102 void SetChartTransparencyGradient(long transparencyGradient
);
104 void GeneratePieSegment2D(double, double, double, double);
105 int RenderPieSegment2DShape(float, float, float);
107 int RenderSymbol2DShape(float, float, float, float, sal_Int32
);
108 #if DEBUG_POSITIONING
112 void SetBackGroundColor(sal_uInt32 color1
, sal_uInt32 color2
, sal_uInt8 nAlpha
);
124 int Create2DCircle(int detail
);
126 // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
127 glm::mat4 m_Projection
;
130 // Model matrix : an identity matrix (model will be at the origin
132 // Our ModelViewProjection : multiplication of our 3 matrices
137 glm::vec4 m_ClearColor
;
139 GLuint m_VertexBuffer
;
141 GLuint m_ColorBuffer
;
145 GLint m_RenderVertexID
;
147 GLint m_RenderTexCoordID
;
151 GLuint m_RenderVertexBuf
;
153 GLuint m_RenderTexCoordBuf
;
155 PointList m_Line2DPointList
;
159 std::list
<PointList
> m_Line2DShapePointList
;
163 Bubble2DCircle m_Bubble2DCircle
;
165 std::list
<Bubble2DPointList
> m_Bubble2DShapePointList
;
172 std::list
<RectanglePointList
> m_RectangleShapePointList
;
174 std::list
<TextInfo
> m_TextInfoList
;
176 GLint m_TextMatrixID
;
177 GLint m_TextVertexID
;
178 GLint m_TextTexCoordID
;
179 GLuint m_TextTexCoordBuf
;
182 PointList m_Area2DPointList
;
183 std::list
<PointList
> m_Area2DShapePointList
;
185 GLint m_BackgroundProID
;
186 GLint m_BackgroundMatrixID
;
187 GLint m_BackgroundVertexID
;
188 GLint m_BackgroundColorID
;
190 float m_BackgroundColor
[16];
192 std::list
<PointList
> m_PieSegment2DShapePointList
;
193 PointList m_Symbol2DPointList
;
194 std::list
<PointList
> m_Symbol2DShapePointList
;
196 GLuint m_SymbolProID
;
197 GLuint m_SymbolVertexID
;
198 GLuint m_SymbolMatrixID
;
199 GLuint m_SymbolColorID
;
200 GLuint m_SymbolShapeID
;
202 #if DEBUG_POSITIONING
204 GLuint m_DebugVertexID
;
205 GLuint m_DebugColorID
;
209 #endif // INCLUDED_CHART2_SOURCE_VIEW_MAIN_OPENGLRENDER_HXX
211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */