Update to m13
[ooovba.git] / applied_patches / 0536-transogl-transitions-slideshow.diff
blobd6517f506c73629a65dbc01736bbf256e94de661
1 --- slideshow/source/engine/OGLTrans/makefile.mk.ogltrss~ 2008-06-24 14:05:20.000000000 +0200
2 +++ slideshow/source/engine/OGLTrans/makefile.mk 2008-07-07 20:21:34.867096734 +0200
3 @@ -53,6 +53,7 @@ SLOFILES = \
4 $(SLO)$/OGLTrans_TransitionImpl.obj \
5 $(SLO)$/OGLTrans_TransitionerImpl.obj
7 +DLLPRE=
8 SHL1TARGET=$(TARGET).uno
10 .IF "$(GUI)"=="UNX"
11 --- slideshow/source/engine/OGLTrans/OGLTrans_TransitionImpl.cxx.ogltrss~ 2008-06-24 14:04:41.000000000 +0200
12 +++ slideshow/source/engine/OGLTrans/OGLTrans_TransitionImpl.cxx 2008-07-07 20:21:34.807096930 +0200
13 @@ -42,6 +42,8 @@ void OGLTransitionImpl::clear()
14 for(unsigned int i(0); i < maSceneObjects.size(); ++i)
15 delete maSceneObjects[i];
16 maSceneObjects.clear();
18 + bReflectSlides = false;
21 OGLTransitionImpl::~OGLTransitionImpl()
22 @@ -63,6 +65,30 @@ void OGLTransitionImpl::finish()
26 +static void blendSlide( double depth )
28 + double showHeight = -1 + depth*2;
29 + GLfloat reflectionColor[] = {0, 0, 0, 0.25};
31 + glBegin( GL_QUADS );
32 + glColor4fv( reflectionColor );
33 + glVertex3f( -1.01, -1.01, 0.001 );
34 + glColor4f( 0, 0, 0, 1 );
35 + glVertex3f(-1.01, showHeight, 0.001 );
36 + glVertex3f( 1.01, showHeight, 0.001 );
37 + glColor4fv( reflectionColor );
38 + glVertex3f( 1.01, -1.01, 0.001 );
39 + glEnd();
41 + glBegin( GL_QUADS );
42 + glColor4f( 0, 0, 0, 1 );
43 + glVertex3f( -1.01, showHeight, 0.001 );
44 + glVertex3f( -1.01, 1.01, 0.001 );
45 + glVertex3f( 1.01, 1.01, 0.001 );
46 + glVertex3f( 1.01, showHeight, 0.001 );
47 + glEnd();
50 void OGLTransitionImpl::display( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex,
51 double SlideWidth, double SlideHeight, double DispWidth, double DispHeight )
53 @@ -72,30 +98,79 @@ void OGLTransitionImpl::display( double
54 SlideHeightScale = SlideHeight/DispHeight;
56 glPushMatrix();
57 - glEnable(GL_TEXTURE_2D);
58 - //TODO change to foreach
59 + if ( bReflectSlides ) {
60 + double reflectionDepth = 0.3;
61 + double surfaceLevel = -0.04;
63 + /* reflected slides */
64 + glPushMatrix();
66 + glScaled( 1, -1, 1 );
67 + glTranslated( 0, 2 - surfaceLevel, 0 );
69 + glCullFace(GL_FRONT);
70 + displaySlides( nTime, glLeavingSlideTex, glEnteringSlideTex, SlideWidthScale, SlideHeightScale );
71 + glCullFace(GL_BACK);
73 + glEnable(GL_BLEND);
74 + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
75 + glDisable(GL_LIGHTING);
77 + /* leaving slide reflection blending */
78 + glPushMatrix();
79 + maLeavingSlidePrimitives[0].applyOperations( nTime, SlideWidthScale, SlideHeightScale );
80 + blendSlide( reflectionDepth );
81 + glPopMatrix();
83 + /* entering slide reflection blending */
84 + glPushMatrix();
85 + maEnteringSlidePrimitives[0].applyOperations( nTime, SlideWidthScale, SlideHeightScale );
86 + blendSlide( reflectionDepth );
87 + glPopMatrix();
89 + glDisable(GL_BLEND);
90 + glEnable(GL_LIGHTING);
92 + glPopMatrix();
93 + }
95 + displaySlides( nTime, glLeavingSlideTex, glEnteringSlideTex, SlideWidthScale, SlideHeightScale );
96 + displayScene( nTime, SlideWidth, SlideHeight, DispWidth, DispHeight );
97 + glPopMatrix();
100 +void OGLTransitionImpl::applyOverallOperations( double nTime, double SlideWidthScale, double SlideHeightScale )
102 for(unsigned int i(0); i < OverallOperations.size(); ++i)
103 OverallOperations[i]->interpolate(nTime,SlideWidthScale,SlideHeightScale);
106 +void OGLTransitionImpl::displaySlides( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex,
107 + double SlideWidthScale, double SlideHeightScale )
109 + applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
110 + glEnable(GL_TEXTURE_2D);
111 + //TODO change to foreach
112 glBindTexture(GL_TEXTURE_2D, glLeavingSlideTex);
113 for(unsigned int i(0); i < maLeavingSlidePrimitives.size(); ++i)
114 maLeavingSlidePrimitives[i].display(nTime,SlideWidthScale,SlideHeightScale);
115 glBindTexture(GL_TEXTURE_2D, glEnteringSlideTex);
116 for(unsigned int i(0); i < maEnteringSlidePrimitives.size(); ++i)
117 maEnteringSlidePrimitives[i].display(nTime,SlideWidthScale,SlideHeightScale);
120 +void OGLTransitionImpl::displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight )
122 + glEnable(GL_TEXTURE_2D);
123 for(unsigned int i(0); i < maSceneObjects.size(); ++i)
124 maSceneObjects[i]->display(nTime, SlideWidth, SlideHeight, DispWidth, DispHeight);
127 - glPopMatrix();
130 void Primitive::display(double nTime, double WidthScale, double HeightScale)
132 glPushMatrix();
133 - for(unsigned int i(0); i < Operations.size(); ++i)
134 - Operations[i]->interpolate( nTime ,WidthScale,HeightScale);
135 - glScaled(WidthScale,HeightScale,1);
137 + applyOperations( nTime, WidthScale, HeightScale );
139 glEnableClientState( GL_VERTEX_ARRAY );
140 if(!Normals.empty())
141 @@ -110,6 +185,13 @@ void Primitive::display(double nTime, do
142 glPopMatrix();
145 +void Primitive::applyOperations(double nTime, double WidthScale, double HeightScale)
147 + for(unsigned int i(0); i < Operations.size(); ++i)
148 + Operations[i]->interpolate( nTime ,WidthScale,HeightScale);
149 + glScaled(WidthScale,HeightScale,1);
152 Primitive::~Primitive()
154 for(unsigned int i( 0 ); i < Operations.size(); ++i)
155 @@ -222,6 +304,8 @@ void OGLTransitionImpl::makeTurnAround()
157 clear();
158 Primitive Slide;
160 + bReflectSlides = true;
162 Slide.pushTriangle(basegfx::B2DVector(0,0),basegfx::B2DVector(1,0),basegfx::B2DVector(0,1));
163 Slide.pushTriangle(basegfx::B2DVector(1,0),basegfx::B2DVector(0,1),basegfx::B2DVector(1,1));
164 @@ -320,10 +404,12 @@ void OGLTransitionImpl::makeRochade()
165 clear();
166 Primitive Slide;
168 + bReflectSlides = true;
170 double w, h;
172 w = 2.2;
173 - h = 5;
174 + h = 10;
176 Slide.pushTriangle(basegfx::B2DVector(0,0),basegfx::B2DVector(1,0),basegfx::B2DVector(0,1));
177 Slide.pushTriangle(basegfx::B2DVector(1,0),basegfx::B2DVector(0,1),basegfx::B2DVector(1,1));
178 --- slideshow/source/engine/OGLTrans/OGLTrans_TransitionImpl.hxx.ogltrss~ 2008-06-24 14:04:52.000000000 +0200
179 +++ slideshow/source/engine/OGLTrans/OGLTrans_TransitionImpl.hxx 2008-07-07 20:23:44.418846399 +0200
180 @@ -104,6 +104,15 @@ private:
181 /** All the operations that should be applied to both leaving and entering slide primitives. These operations will be called in the order they were pushed back in. In OpenGL this effectively uses the operations in the opposite order they were pushed back.
183 vector<Operation*> OverallOperations;
185 + /** Whether to reflect slides, the reflection happens on flat surface beneath the slides.
186 + ** Now it only works with slides which keep their rectangular shape together.
187 + */
188 + bool bReflectSlides;
190 + void displaySlides( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale );
191 + void displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight);
192 + void applyOverallOperations( double nTime, double SlideWidthScale, double SlideHeightScale );
195 class SceneObject
196 @@ -147,6 +156,7 @@ public:
197 Primitive(const Primitive& rvalue);
198 ~Primitive();
200 + void applyOperations(double nTime, double SlideWidthScale, double SlideHeightScale);
201 void display(double nTime, double SlideWidthScale, double SlideHeightScale);
202 const Primitive& operator=(const Primitive& rvalue);