1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2015 by Collabora, Ltd.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
28 #ifndef INCLUDED_OGLTRANS_OPERATIONS_HXX_
29 #define INCLUDED_OGLTRANS_OPERATIONS_HXX_
31 #include <config_lgpl.h>
32 #include <glm/gtc/type_ptr.hpp>
36 /** This class is to be derived to make any operation (transform) you may need in order to construct your transitions
41 virtual ~Operation(){}
42 Operation(const Operation
&) = delete;
43 Operation
& operator=(const Operation
&) = delete;
46 /** Should this operation be interpolated . If TRUE, the transform will smoothly move from making no difference from t = 0.0 to mnT0 to being completely transformed from t = mnT1 to 1. If FALSE, the transform will be ineffectual from t = 0 to mnT0, and completely transformed from t = mnT0 to 1.
50 /** time to begin the transformation
54 /** time to finish the transformation
58 /** this is the function that is called to give the Operation to OpenGL.
61 time from t = 0 to t = 1
63 @param SlideWidthScale
64 width of slide divided by width of window
66 @param SlideHeightScale
67 height of slide divided by height of window
70 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const = 0;
73 Operation(bool bInterpolate
, double nT0
, double nT1
):
74 mbInterpolate(bInterpolate
), mnT0(nT0
), mnT1(nT1
){}
77 /** this class is a generic CounterClockWise(CCW) rotation with an axis angle
79 class SRotate
: public Operation
82 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
90 position that rotation axis runs through
93 angle in degrees of CCW rotation
99 transformation starting time
102 transformation ending time
105 SRotate(const glm::vec3
& Axis
, const glm::vec3
& Origin
, double Angle
,
106 bool bInter
, double T0
, double T1
);
107 virtual ~SRotate() override
{}
109 /** axis to rotate CCW about
113 /** position that rotation axis runs through
117 /** angle in degrees of CCW rotation
122 std::shared_ptr
<SRotate
>
123 makeSRotate(const glm::vec3
& Axis
, const glm::vec3
& Origin
, double Angle
,
124 bool bInter
, double T0
, double T1
);
126 /** scaling transformation
128 class SScale
: public Operation
131 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
139 position that rotation axis runs through
145 transformation starting time
148 transformation ending time
151 SScale(const glm::vec3
& Scale
, const glm::vec3
& Origin
,bool bInter
, double T0
, double T1
);
152 virtual ~SScale() override
{}
158 std::shared_ptr
<SScale
>
159 makeSScale(const glm::vec3
& Scale
, const glm::vec3
& Origin
,bool bInter
, double T0
, double T1
);
161 /** translation transformation
163 class STranslate
: public Operation
166 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
177 transformation starting time
180 transformation ending time
183 STranslate(const glm::vec3
& Vector
,bool bInter
, double T0
, double T1
);
184 virtual ~STranslate() override
{}
186 /** vector to translate by
191 std::shared_ptr
<STranslate
>
192 makeSTranslate(const glm::vec3
& Vector
,bool bInter
, double T0
, double T1
);
194 /** translation transformation
196 class SEllipseTranslate
: public Operation
199 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
210 transformation starting time
213 transformation ending time
216 SEllipseTranslate(double dWidth
, double dHeight
, double dStartPosition
, double dEndPosition
, bool bInter
, double T0
, double T1
);
217 virtual ~SEllipseTranslate() override
{}
219 /** width and length of the ellipse
221 double width
, height
;
223 /** start and end position on the ellipse <0,1>
225 double startPosition
;
229 std::shared_ptr
<SEllipseTranslate
>
230 makeSEllipseTranslate(double dWidth
, double dHeight
, double dStartPosition
, double dEndPosition
, bool bInter
, double T0
, double T1
);
232 /** Same as SRotate, except the depth is scaled by the width of the slide divided by the width of the window.
234 class RotateAndScaleDepthByWidth
: public Operation
237 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
239 RotateAndScaleDepthByWidth(const glm::vec3
& Axis
,const glm::vec3
& Origin
,double Angle
, bool bScale
, bool bInter
, double T0
, double T1
);
240 virtual ~RotateAndScaleDepthByWidth() override
{}
248 std::shared_ptr
<RotateAndScaleDepthByWidth
>
249 makeRotateAndScaleDepthByWidth(const glm::vec3
& Axis
,const glm::vec3
& Origin
,double Angle
, bool bScale
, bool bInter
, double T0
, double T1
);
251 /** Same as SRotate, except the depth is scaled by the width of the slide divided by the height of the window.
253 class RotateAndScaleDepthByHeight
: public Operation
256 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
258 RotateAndScaleDepthByHeight(const glm::vec3
& Axis
,const glm::vec3
& Origin
,double Angle
, bool bScale
, bool bInter
, double T0
, double T1
);
259 virtual ~RotateAndScaleDepthByHeight() override
{}
267 std::shared_ptr
<RotateAndScaleDepthByHeight
>
268 makeRotateAndScaleDepthByHeight(const glm::vec3
& Axis
,const glm::vec3
& Origin
,double Angle
, bool bScale
, bool bInter
, double T0
, double T1
);
270 #endif // INCLUDED_SLIDESHOW_OPERATIONS_HXX_
272 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */