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/ptr_container/ptr_map.hpp>
21 #include <boost/shared_array.hpp>
29 TextCacheItem(sal_uInt8
*pPixels
, ::Size aSize
)
30 : maSize(aSize
), maPixels(pPixels
)
34 boost::shared_array
<sal_uInt8
> maPixels
;
40 const TextCacheItem
&getText(OUString
const & rText
, bool bIs3dText
= false);
42 typedef boost::ptr_map
<OUString
const, TextCacheItem
> TextCacheType
;
44 TextCacheType maTextCache
;
47 class Renderable3DObject
50 Renderable3DObject(OpenGL3DRenderer
* pRenderer
, sal_uInt32 nId
);
52 virtual ~Renderable3DObject() {};
54 virtual void render();
56 OpenGL3DRenderer
* getRender();
59 OpenGL3DRenderer
* mpRenderer
;
60 sal_uInt32 mnUniqueId
;
63 class Bar
: public Renderable3DObject
66 Bar(OpenGL3DRenderer
* pRenderer
, const glm::mat4
& rPosition
, sal_uInt32 nColor
, sal_uInt32 nId
);
68 virtual void render() SAL_OVERRIDE
;
70 bool mbRoundedCorners
;
72 Color maColor
; // RGBA fill color
75 class Line
: public Renderable3DObject
78 Line(OpenGL3DRenderer
* pRenderer
, sal_uInt32 nId
);
80 virtual void render() SAL_OVERRIDE
;
82 void setPosition(const glm::vec3
& rBegin
, const glm::vec3
& rEnd
);
83 void setLineColor(const Color
& rColor
);
88 Color maLineColor
; // RGBA line color
91 class Text
: public Renderable3DObject
94 Text(OpenGL3DRenderer
* pRenderer
, TextCache
& rTextCache
, const OUString
& rStr
, sal_uInt32 nId
);
95 virtual void render() SAL_OVERRIDE
;
97 Size
getSize() const { return maText
.maSize
;}
99 void setPosition(const glm::vec3
& rTopLeft
, const glm::vec3
& rTopRight
, const glm::vec3
& rBottomRight
);
102 TextCacheItem maText
;
104 glm::vec3 maTopRight
;
105 glm::vec3 maBottomRight
;
108 class ScreenText
: public Renderable3DObject
111 ScreenText(OpenGL3DRenderer
* pRenderer
, TextCache
& rTextCache
,
112 const OUString
& rStr
, glm::vec4 rColor
, sal_uInt32 nId
, bool bIs3dText
= false);
114 virtual void render() SAL_OVERRIDE
;
115 void setPosition(const glm::vec2
& rTopLeft
, const glm::vec2
& rBottomRight
,
116 const glm::vec3
& r3DPos
= glm::vec3(0.0, 0.0, 0.0));
119 TextCacheItem maText
;
121 glm::vec2 maBottomRight
;
126 class Rectangle
: public Renderable3DObject
129 Rectangle(OpenGL3DRenderer
* pRenderer
, sal_uInt32 nId
);
130 virtual void render() SAL_OVERRIDE
;
132 void setPosition(const glm::vec3
& rTopLeft
, const glm::vec3
& rTopRight
, const glm::vec3
& rBottomRight
);
133 void setFillColor(const Color
& rColor
);
134 void setLineColor(const Color
& rColor
);
138 glm::vec3 maTopRight
;
139 glm::vec3 maBottomRight
;
140 Color maColor
; // RGBA fill color
141 Color maLineColor
; // RGBA line color
144 class Camera
: public Renderable3DObject
147 Camera(OpenGL3DRenderer
* pRenderer
);
148 virtual void render() SAL_OVERRIDE
;
150 void setPosition(const glm::vec3
& rPos
);
151 void setDirection(const glm::vec3
& rPos
);
156 glm::vec3 maDirection
;
163 #endif // INCLUDED_CHART2_SOURCE_VIEW_INC_3DCHARTOBJECTS_HXX
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */