LibreOffice Module slideshow (master) 1
Operation.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * Copyright 2015 by Collabora, Ltd.
7 *
8 * OpenOffice.org - a multi-platform office productivity suite
9 *
10 * This file is part of OpenOffice.org.
11 *
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
15 *
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
21 *
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
26 *
27 ************************************************************************/
28#ifndef INCLUDED_OGLTRANS_OPERATIONS_HXX_
29#define INCLUDED_OGLTRANS_OPERATIONS_HXX_
30
31#include <config_lgpl.h>
32#include <glm/gtc/type_ptr.hpp>
33
34#include <memory>
35
39{
40public:
41 virtual ~Operation(){}
42 Operation(const Operation&) = delete;
43 Operation& operator=(const Operation&) = delete;
44
45protected:
49
52 double mnT0;
53
56 double mnT1;
57public:
70 virtual void interpolate(glm::mat4& matrix, double t, double SlideWidthScale, double SlideHeightScale) const = 0;
71
72protected:
73 Operation(bool bInterpolate, double nT0, double nT1):
74 mbInterpolate(bInterpolate), mnT0(nT0), mnT1(nT1){}
75};
76
79class SRotate: public Operation
80{
81public:
82 virtual void interpolate(glm::mat4& matrix, double t, double SlideWidthScale, double SlideHeightScale) const override;
83
105 SRotate(const glm::vec3& Axis, const glm::vec3& Origin, double Angle,
106 bool bInter, double T0, double T1);
107private:
110 glm::vec3 axis;
111
114 glm::vec3 origin;
115
118 double angle;
119};
120
121std::shared_ptr<SRotate>
122makeSRotate(const glm::vec3& Axis, const glm::vec3& Origin, double Angle,
123 bool bInter, double T0, double T1);
124
127class SScale: public Operation
128{
129public:
130 virtual void interpolate(glm::mat4& matrix, double t, double SlideWidthScale, double SlideHeightScale) const override;
131
150 SScale(const glm::vec3& Scale, const glm::vec3& Origin,bool bInter, double T0, double T1);
151private:
152 glm::vec3 scale;
153 glm::vec3 origin;
154};
155
156std::shared_ptr<SScale>
157makeSScale(const glm::vec3& Scale, const glm::vec3& Origin,bool bInter, double T0, double T1);
158
162{
163public:
164 virtual void interpolate(glm::mat4& matrix, double t, double SlideWidthScale, double SlideHeightScale) const override;
165
181 STranslate(const glm::vec3& Vector,bool bInter, double T0, double T1);
182private:
185 glm::vec3 vector;
186};
187
188std::shared_ptr<STranslate>
189makeSTranslate(const glm::vec3& Vector,bool bInter, double T0, double T1);
190
194{
195public:
196 virtual void interpolate(glm::mat4& matrix, double t, double SlideWidthScale, double SlideHeightScale) const override;
197
213 SEllipseTranslate(double dWidth, double dHeight, double dStartPosition, double dEndPosition, bool bInter, double T0, double T1);
214private:
217 double width, height;
218
223};
224
225std::shared_ptr<SEllipseTranslate>
226makeSEllipseTranslate(double dWidth, double dHeight, double dStartPosition, double dEndPosition, bool bInter, double T0, double T1);
227
231{
232public:
233 virtual void interpolate(glm::mat4& matrix, double t, double SlideWidthScale, double SlideHeightScale) const override;
234
235 RotateAndScaleDepthByWidth(const glm::vec3& Axis,const glm::vec3& Origin,double Angle, bool bScale, bool bInter, double T0, double T1);
236private:
237 glm::vec3 axis;
238 glm::vec3 origin;
239 double angle;
240 bool scale;
241};
242
243std::shared_ptr<RotateAndScaleDepthByWidth>
244makeRotateAndScaleDepthByWidth(const glm::vec3& Axis,const glm::vec3& Origin,double Angle, bool bScale, bool bInter, double T0, double T1);
245
249{
250public:
251 virtual void interpolate(glm::mat4& matrix, double t, double SlideWidthScale, double SlideHeightScale) const override;
252
253 RotateAndScaleDepthByHeight(const glm::vec3& Axis,const glm::vec3& Origin,double Angle, bool bScale, bool bInter, double T0, double T1);
254private:
255 glm::vec3 axis;
256 glm::vec3 origin;
257 double angle;
258 bool scale;
259};
260
261std::shared_ptr<RotateAndScaleDepthByHeight>
262makeRotateAndScaleDepthByHeight(const glm::vec3& Axis,const glm::vec3& Origin,double Angle, bool bScale, bool bInter, double T0, double T1);
263
264#endif // INCLUDED_SLIDESHOW_OPERATIONS_HXX_
265
266/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< RotateAndScaleDepthByWidth > makeRotateAndScaleDepthByWidth(const glm::vec3 &Axis, const glm::vec3 &Origin, double Angle, bool bScale, bool bInter, double T0, double T1)
Definition: Operation.cxx:107
std::shared_ptr< SRotate > makeSRotate(const glm::vec3 &Axis, const glm::vec3 &Origin, double Angle, bool bInter, double T0, double T1)
Definition: Operation.cxx:83
std::shared_ptr< SScale > makeSScale(const glm::vec3 &Scale, const glm::vec3 &Origin, bool bInter, double T0, double T1)
Definition: Operation.cxx:89
std::shared_ptr< SEllipseTranslate > makeSEllipseTranslate(double dWidth, double dHeight, double dStartPosition, double dEndPosition, bool bInter, double T0, double T1)
Definition: Operation.cxx:101
std::shared_ptr< RotateAndScaleDepthByHeight > makeRotateAndScaleDepthByHeight(const glm::vec3 &Axis, const glm::vec3 &Origin, double Angle, bool bScale, bool bInter, double T0, double T1)
Definition: Operation.cxx:113
std::shared_ptr< STranslate > makeSTranslate(const glm::vec3 &Vector, bool bInter, double T0, double T1)
Definition: Operation.cxx:95
XPropertyListType t
This class is to be derived to make any operation (transform) you may need in order to construct your...
Definition: Operation.hxx:39
Operation(const Operation &)=delete
Operation(bool bInterpolate, double nT0, double nT1)
Definition: Operation.hxx:73
virtual ~Operation()
Definition: Operation.hxx:41
double mnT0
time to begin the transformation
Definition: Operation.hxx:52
bool mbInterpolate
Should this operation be interpolated .
Definition: Operation.hxx:48
virtual void interpolate(glm::mat4 &matrix, double t, double SlideWidthScale, double SlideHeightScale) const =0
this is the function that is called to give the Operation to OpenGL.
double mnT1
time to finish the transformation
Definition: Operation.hxx:56
Operation & operator=(const Operation &)=delete
Same as SRotate, except the depth is scaled by the width of the slide divided by the height of the wi...
Definition: Operation.hxx:249
virtual void interpolate(glm::mat4 &matrix, double t, double SlideWidthScale, double SlideHeightScale) const override
this is the function that is called to give the Operation to OpenGL.
Definition: Operation.cxx:180
RotateAndScaleDepthByHeight(const glm::vec3 &Axis, const glm::vec3 &Origin, double Angle, bool bScale, bool bInter, double T0, double T1)
Definition: Operation.cxx:65
Same as SRotate, except the depth is scaled by the width of the slide divided by the width of the win...
Definition: Operation.hxx:231
virtual void interpolate(glm::mat4 &matrix, double t, double SlideWidthScale, double SlideHeightScale) const override
this is the function that is called to give the Operation to OpenGL.
Definition: Operation.cxx:162
RotateAndScaleDepthByWidth(const glm::vec3 &Axis, const glm::vec3 &Origin, double Angle, bool bScale, bool bInter, double T0, double T1)
Definition: Operation.cxx:55
translation transformation
Definition: Operation.hxx:194
double width
width and length of the ellipse
Definition: Operation.hxx:217
double startPosition
start and end position on the ellipse <0,1>
Definition: Operation.hxx:221
virtual void interpolate(glm::mat4 &matrix, double t, double SlideWidthScale, double SlideHeightScale) const override
this is the function that is called to give the Operation to OpenGL.
Definition: Operation.cxx:208
SEllipseTranslate(double dWidth, double dHeight, double dStartPosition, double dEndPosition, bool bInter, double T0, double T1)
Constructor.
Definition: Operation.cxx:198
this class is a generic CounterClockWise(CCW) rotation with an axis angle
Definition: Operation.hxx:80
virtual void interpolate(glm::mat4 &matrix, double t, double SlideWidthScale, double SlideHeightScale) const override
this is the function that is called to give the Operation to OpenGL.
Definition: Operation.cxx:133
glm::vec3 origin
position that rotation axis runs through
Definition: Operation.hxx:114
glm::vec3 axis
axis to rotate CCW about
Definition: Operation.hxx:110
double angle
angle in degrees of CCW rotation
Definition: Operation.hxx:118
SRotate(const glm::vec3 &Axis, const glm::vec3 &Origin, double Angle, bool bInter, double T0, double T1)
Constructor.
Definition: Operation.cxx:38
scaling transformation
Definition: Operation.hxx:128
glm::vec3 scale
Definition: Operation.hxx:152
virtual void interpolate(glm::mat4 &matrix, double t, double SlideWidthScale, double SlideHeightScale) const override
this is the function that is called to give the Operation to OpenGL.
Definition: Operation.cxx:149
SScale(const glm::vec3 &Scale, const glm::vec3 &Origin, bool bInter, double T0, double T1)
Constructor.
Definition: Operation.cxx:47
glm::vec3 origin
Definition: Operation.hxx:153
translation transformation
Definition: Operation.hxx:162
virtual void interpolate(glm::mat4 &matrix, double t, double SlideWidthScale, double SlideHeightScale) const override
this is the function that is called to give the Operation to OpenGL.
Definition: Operation.cxx:123
glm::vec3 vector
vector to translate by
Definition: Operation.hxx:185
STranslate(const glm::vec3 &Vector, bool bInter, double T0, double T1)
Constructor.
Definition: Operation.cxx:76
double matrix[4][4]