fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / view / main / OpenGLRender.hxx
blobc11653df4710d651b1a9cd1933ae697a46389e1e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
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>
20 // Include GLM
21 #include <list>
22 #include <map>
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
30 struct PosVecf3
32 float x;
33 float y;
34 float z;
37 struct Bubble2DPointList
39 float x;
40 float y;
41 float xScale;
42 float yScale;
45 typedef std::vector<GLfloat> Bubble2DCircle;
47 struct RectanglePointList
49 float points[12];
52 struct TextInfo
54 GLuint texture;
55 double rotation;
56 float vertex[12];
57 float nDx;
58 float nDy;
61 typedef std::vector<GLfloat> PointList;
63 // for 3D, use vector to save the points
65 class OpenGLRender
67 public:
68 OpenGLRender();
69 ~OpenGLRender();
70 int InitOpenGL();
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);
74 void Release();
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,
92 long rotation,
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
109 void renderDebug();
110 #endif
112 void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha);
114 private:
115 #if 0
116 //for performance
117 double m_dFreq;
118 #endif
119 int m_iWidth;
121 int m_iHeight;
123 private:
124 int Create2DCircle(int detail);
125 private:
126 // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
127 glm::mat4 m_Projection;
128 // Camera matrix
129 glm::mat4 m_View;
130 // Model matrix : an identity matrix (model will be at the origin
131 glm::mat4 m_Model;
132 // Our ModelViewProjection : multiplication of our 3 matrices
133 glm::mat4 m_MVP;
134 #if 0
135 GLint m_RenderProID;
136 #endif
137 glm::vec4 m_ClearColor;
139 GLuint m_VertexBuffer;
141 GLuint m_ColorBuffer;
143 GLint m_MatrixID;
144 #if 0
145 GLint m_RenderVertexID;
147 GLint m_RenderTexCoordID;
149 GLint m_RenderTexID;
150 #endif
151 GLuint m_RenderVertexBuf;
153 GLuint m_RenderTexCoordBuf;
155 PointList m_Line2DPointList;
157 float m_fLineWidth;
159 std::list <PointList> m_Line2DShapePointList;
161 glm::vec4 m_2DColor;
163 Bubble2DCircle m_Bubble2DCircle;
165 std::list <Bubble2DPointList> m_Bubble2DShapePointList;
166 GLint m_CommonProID;
167 GLint m_2DVertexID;
168 GLint m_2DColorID;
170 float m_fZStep;
172 std::list <RectanglePointList> m_RectangleShapePointList;
173 // add for text
174 std::list <TextInfo> m_TextInfoList;
175 GLint m_TextProID;
176 GLint m_TextMatrixID;
177 GLint m_TextVertexID;
178 GLint m_TextTexCoordID;
179 GLuint m_TextTexCoordBuf;
180 GLint m_TextTexID;
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
203 GLuint m_DebugProID;
204 GLuint m_DebugVertexID;
205 GLuint m_DebugColorID;
206 #endif
209 #endif // INCLUDED_CHART2_SOURCE_VIEW_MAIN_OPENGLRENDER_HXX
211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */