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
);
108 /** axis to rotate CCW about
112 /** position that rotation axis runs through
116 /** angle in degrees of CCW rotation
121 std::shared_ptr
<SRotate
>
122 makeSRotate(const glm::vec3
& Axis
, const glm::vec3
& Origin
, double Angle
,
123 bool bInter
, double T0
, double T1
);
125 /** scaling transformation
127 class SScale
: public Operation
130 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
138 position that rotation axis runs through
144 transformation starting time
147 transformation ending time
150 SScale(const glm::vec3
& Scale
, const glm::vec3
& Origin
,bool bInter
, double T0
, double T1
);
156 std::shared_ptr
<SScale
>
157 makeSScale(const glm::vec3
& Scale
, const glm::vec3
& Origin
,bool bInter
, double T0
, double T1
);
159 /** translation transformation
161 class STranslate
: public Operation
164 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
175 transformation starting time
178 transformation ending time
181 STranslate(const glm::vec3
& Vector
,bool bInter
, double T0
, double T1
);
183 /** vector to translate by
188 std::shared_ptr
<STranslate
>
189 makeSTranslate(const glm::vec3
& Vector
,bool bInter
, double T0
, double T1
);
191 /** translation transformation
193 class SEllipseTranslate
: public Operation
196 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
207 transformation starting time
210 transformation ending time
213 SEllipseTranslate(double dWidth
, double dHeight
, double dStartPosition
, double dEndPosition
, bool bInter
, double T0
, double T1
);
215 /** width and length of the ellipse
217 double width
, height
;
219 /** start and end position on the ellipse <0,1>
221 double startPosition
;
225 std::shared_ptr
<SEllipseTranslate
>
226 makeSEllipseTranslate(double dWidth
, double dHeight
, double dStartPosition
, double dEndPosition
, bool bInter
, double T0
, double T1
);
228 /** Same as SRotate, except the depth is scaled by the width of the slide divided by the width of the window.
230 class RotateAndScaleDepthByWidth
: public Operation
233 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
235 RotateAndScaleDepthByWidth(const glm::vec3
& Axis
,const glm::vec3
& Origin
,double Angle
, bool bScale
, bool bInter
, double T0
, double T1
);
243 std::shared_ptr
<RotateAndScaleDepthByWidth
>
244 makeRotateAndScaleDepthByWidth(const glm::vec3
& Axis
,const glm::vec3
& Origin
,double Angle
, bool bScale
, bool bInter
, double T0
, double T1
);
246 /** Same as SRotate, except the depth is scaled by the width of the slide divided by the height of the window.
248 class RotateAndScaleDepthByHeight
: public Operation
251 virtual void interpolate(glm::mat4
& matrix
, double t
, double SlideWidthScale
, double SlideHeightScale
) const override
;
253 RotateAndScaleDepthByHeight(const glm::vec3
& Axis
,const glm::vec3
& Origin
,double Angle
, bool bScale
, bool bInter
, double T0
, double T1
);
261 std::shared_ptr
<RotateAndScaleDepthByHeight
>
262 makeRotateAndScaleDepthByHeight(const glm::vec3
& Axis
,const glm::vec3
& Origin
,double Angle
, bool bScale
, bool bInter
, double T0
, double T1
);
264 #endif // INCLUDED_SLIDESHOW_OPERATIONS_HXX_
266 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */