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_INC_3DCHARTOBJECTS_HXX
11 #define INCLUDED_CHART2_SOURCE_VIEW_INC_3DCHARTOBJECTS_HXX
13 #include <glm/glm.hpp>
14 #include <tools/color.hxx>
15 #include <vcl/bitmapex.hxx>
17 #include <vcl/opengl/OpenGLContext.hxx>
18 #include "GL3DRenderer.hxx"
20 #include <boost/shared_array.hpp>
30 TextCacheItem(sal_uInt8
*pPixels
, ::Size aSize
)
31 : maSize(aSize
), maPixels(pPixels
)
35 boost::shared_array
<sal_uInt8
> maPixels
;
41 const TextCacheItem
&getText(OUString
const & rText
, bool bIs3dText
= false);
43 typedef std::map
<OUString
const, TextCacheItem
> TextCacheType
;
45 TextCacheType m_TextCache
;
48 class Renderable3DObject
51 Renderable3DObject(OpenGL3DRenderer
* pRenderer
, sal_uInt32 nId
);
53 virtual ~Renderable3DObject() {};
55 virtual void render();
58 OpenGL3DRenderer
* mpRenderer
;
59 sal_uInt32 mnUniqueId
;
62 class Bar
: public Renderable3DObject
65 Bar(OpenGL3DRenderer
* pRenderer
, const glm::mat4
& rPosition
, Color nColor
, sal_uInt32 nId
);
67 virtual void render() override
;
70 Color maColor
; // RGBA fill color
73 class Line
: public Renderable3DObject
76 Line(OpenGL3DRenderer
* pRenderer
, sal_uInt32 nId
);
78 virtual void render() override
;
80 void setPosition(const glm::vec3
& rBegin
, const glm::vec3
& rEnd
);
81 void setLineColor(const Color
& rColor
);
86 Color maLineColor
; // RGBA line color
89 class Text
: public Renderable3DObject
92 Text(OpenGL3DRenderer
* pRenderer
, TextCache
& rTextCache
, const OUString
& rStr
, sal_uInt32 nId
);
93 virtual void render() override
;
95 void setPosition(const glm::vec3
& rTopLeft
, const glm::vec3
& rTopRight
, const glm::vec3
& rBottomRight
);
100 glm::vec3 maTopRight
;
101 glm::vec3 maBottomRight
;
104 class ScreenText
: public Renderable3DObject
107 ScreenText(OpenGL3DRenderer
* pRenderer
, TextCache
& rTextCache
,
108 const OUString
& rStr
, const glm::vec4
& rColor
, sal_uInt32 nId
, bool bIs3dText
= false);
110 virtual void render() override
;
111 void setPosition(const glm::vec2
& rTopLeft
, const glm::vec2
& rBottomRight
,
112 const glm::vec3
& r3DPos
);
115 TextCacheItem maText
;
117 glm::vec2 maBottomRight
;
122 class Rectangle
: public Renderable3DObject
125 Rectangle(OpenGL3DRenderer
* pRenderer
, sal_uInt32 nId
);
126 virtual void render() override
;
128 void setPosition(const glm::vec3
& rTopLeft
, const glm::vec3
& rTopRight
, const glm::vec3
& rBottomRight
);
129 void setFillColor(const Color
& rColor
);
130 void setLineColor(const Color
& rColor
);
134 glm::vec3 maTopRight
;
135 glm::vec3 maBottomRight
;
136 Color maColor
; // RGBA fill color
137 Color maLineColor
; // RGBA line color
140 class Camera
: public Renderable3DObject
143 Camera(OpenGL3DRenderer
* pRenderer
);
144 virtual void render() override
;
146 void setPosition(const glm::vec3
& rPos
);
147 void setDirection(const glm::vec3
& rPos
);
152 glm::vec3 maDirection
;
159 #endif // INCLUDED_CHART2_SOURCE_VIEW_INC_3DCHARTOBJECTS_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */