Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
c0b8c035
Kaydet (Commit)
c0b8c035
authored
Ara 09, 2015
tarafından
Emmanuel Gil Peyrot
Kaydeden (comit)
Tomaž Vajngerl
Ara 11, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
slideshow: Improve the performances of the Honeycomb transition
Change-Id: Iacddc7b84bf0be8bb112cba88cc7fd36f72e7ca0
üst
c5228bd0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
297 additions
and
51 deletions
+297
-51
Package_opengl.mk
slideshow/Package_opengl.mk
+3
-0
honeycombFragmentShader.glsl
slideshow/opengl/honeycombFragmentShader.glsl
+63
-0
honeycombGeometryShader.glsl
slideshow/opengl/honeycombGeometryShader.glsl
+64
-0
honeycombVertexShader.glsl
slideshow/opengl/honeycombVertexShader.glsl
+83
-0
OGLTrans_TransitionImpl.cxx
...ource/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+84
-51
No files found.
slideshow/Package_opengl.mk
Dosyayı görüntüle @
c0b8c035
...
@@ -15,6 +15,9 @@ $(eval $(call gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
...
@@ -15,6 +15,9 @@ $(eval $(call gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
dissolveFragmentShader.glsl \
dissolveFragmentShader.glsl \
fadeBlackFragmentShader.glsl \
fadeBlackFragmentShader.glsl \
fadeFragmentShader.glsl \
fadeFragmentShader.glsl \
honeycombVertexShader.glsl \
honeycombGeometryShader.glsl \
honeycombFragmentShader.glsl \
reflectionVertexShader.glsl \
reflectionVertexShader.glsl \
reflectionFragmentShader.glsl \
reflectionFragmentShader.glsl \
staticFragmentShader.glsl \
staticFragmentShader.glsl \
...
...
slideshow/opengl/honeycombFragmentShader.glsl
0 → 100644
Dosyayı görüntüle @
c0b8c035
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 150
in
vec2
texturePosition
;
in
float
fuzz
;
in
vec2
v_center
;
uniform
sampler2D
slideTexture
;
uniform
float
selectedTexture
;
uniform
float
time
;
uniform
float
hexagonSize
;
bool
isBorder
(
vec2
point
)
{
return
point
.
x
<
0
.
02
||
point
.
x
>
0
.
98
||
point
.
y
<
0
.
02
||
point
.
y
>
0
.
98
;
}
void
main
()
{
gl_FragColor
=
texture2D
(
slideTexture
,
texturePosition
);
if
(
hexagonSize
>
1
.
0
)
{
// The space in-between hexagons.
if
(
selectedTexture
>
0
.
5
)
gl_FragColor
.
a
=
1
.
0
-
time
*
8
+
gl_FragCoord
.
x
/
1024
.;
else
gl_FragColor
.
a
=
time
*
8
-
7
.
7
+
gl_FragCoord
.
x
/
1024
.;
}
else
{
// The hexagons themselves.
float
startTime
;
float
actualTime
;
if
(
selectedTexture
>
0
.
5
)
{
// Leaving slide.
if
(
isBorder
(
v_center
))
// If the center is “outside” of the canvas, clear it first.
startTime
=
0
.
15
;
else
startTime
=
0
.
15
+
fuzz
*
0
.
3
;
float
endTime
=
startTime
+
0
.
05
;
actualTime
=
1
.
0
-
clamp
((
time
-
startTime
)
/
(
endTime
-
startTime
),
0
,
1
);
}
else
{
// Entering slide.
if
(
isBorder
(
v_center
))
// If the center is “outside” of the canvas, clear it first.
startTime
=
0
.
85
;
else
startTime
=
0
.
5
+
fuzz
*
0
.
3
;
float
endTime
=
startTime
+
0
.
05
;
actualTime
=
clamp
((
time
-
startTime
)
/
(
endTime
-
startTime
),
0
,
1
);
}
gl_FragColor
.
a
=
actualTime
;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
slideshow/opengl/honeycombGeometryShader.glsl
0 → 100644
Dosyayı görüntüle @
c0b8c035
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 150
layout
(
triangles
)
in
;
layout
(
triangle_strip
,
max_vertices
=
13
)
out
;
in
mat4
modelViewProjectionMatrix
[];
uniform
float
hexagonSize
;
uniform
sampler2D
permTexture
;
out
vec2
texturePosition
;
out
float
fuzz
;
out
vec2
v_center
;
const
float
expandFactor
=
0
.
031
8
;
float
snoise
(
vec2
p
)
{
return
texture2D
(
permTexture
,
p
).
r
;
}
void
emitHexagonVertex
(
vec3
center
,
vec2
translation
)
{
vec4
pos
=
vec4
(
center
+
hexagonSize
*
expandFactor
*
vec3
(
translation
,
0
.
0
),
1
.
0
);
gl_Position
=
modelViewProjectionMatrix
[
0
]
*
pos
;
texturePosition
=
vec2
((
pos
.
x
+
1
),
(
1
-
pos
.
y
))
/
2
;
EmitVertex
();
}
void
main
()
{
vec2
translateVectors
[
6
];
translateVectors
[
0
]
=
vec2
(
-
3
,
-
2
);
translateVectors
[
1
]
=
vec2
(
0
,
-
4
);
translateVectors
[
2
]
=
vec2
(
3
,
-
2
);
translateVectors
[
3
]
=
vec2
(
3
,
2
);
translateVectors
[
4
]
=
vec2
(
0
,
4
);
translateVectors
[
5
]
=
vec2
(
-
3
,
2
);
vec3
center
=
gl_in
[
0
].
gl_Position
.
xyz
;
v_center
=
(
1
+
center
.
xy
)
/
2
;
fuzz
=
snoise
(
center
.
xy
);
emitHexagonVertex
(
center
,
translateVectors
[
5
]);
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
emitHexagonVertex
(
center
,
translateVectors
[
i
]);
emitHexagonVertex
(
center
,
vec2
(
0
,
0
));
}
EndPrimitive
();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
slideshow/opengl/honeycombVertexShader.glsl
0 → 100644
Dosyayı görüntüle @
c0b8c035
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#version 150
#define M_PI 3.1415926535897932384626433832795
in
vec3
a_position
;
uniform
mat4
u_projectionMatrix
;
uniform
mat4
u_modelViewMatrix
;
uniform
mat4
u_sceneTransformMatrix
;
uniform
mat4
u_primitiveTransformMatrix
;
uniform
mat4
u_operationsTransformMatrix
;
uniform
float
time
;
uniform
float
selectedTexture
;
out
mat4
modelViewProjectionMatrix
;
mat4
translationMatrix
(
vec3
axis
)
{
return
mat4
(
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
axis
.
x
,
axis
.
y
,
axis
.
z
,
1
.
0
);
}
mat4
scaleMatrix
(
vec3
axis
)
{
return
mat4
(
axis
.
x
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
axis
.
y
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
axis
.
z
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
);
}
mat4
rotationMatrix
(
vec3
axis
,
float
angle
)
{
axis
=
normalize
(
axis
);
float
s
=
sin
(
angle
);
float
c
=
cos
(
angle
);
float
oc
=
1
.
0
-
c
;
return
mat4
(
oc
*
axis
.
x
*
axis
.
x
+
c
,
oc
*
axis
.
x
*
axis
.
y
-
axis
.
z
*
s
,
oc
*
axis
.
z
*
axis
.
x
+
axis
.
y
*
s
,
0
.
0
,
oc
*
axis
.
x
*
axis
.
y
+
axis
.
z
*
s
,
oc
*
axis
.
y
*
axis
.
y
+
c
,
oc
*
axis
.
y
*
axis
.
z
-
axis
.
x
*
s
,
0
.
0
,
oc
*
axis
.
z
*
axis
.
x
-
axis
.
y
*
s
,
oc
*
axis
.
y
*
axis
.
z
+
axis
.
x
*
s
,
oc
*
axis
.
z
*
axis
.
z
+
c
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
);
}
void
main
(
void
)
{
mat4
modelViewMatrix
=
u_modelViewMatrix
*
u_operationsTransformMatrix
*
u_sceneTransformMatrix
*
u_primitiveTransformMatrix
;
mat4
transformMatrix
;
// TODO: use the aspect ratio of the slide instead.
mat4
slideScaleMatrix
=
scaleMatrix
(
vec3
(
0
.
75
,
1
,
1
));
mat4
invertSlideScaleMatrix
=
scaleMatrix
(
1
.
0
/
vec3
(
0
.
75
,
1
,
1
));
if
(
selectedTexture
>
0
.
5
)
{
// Leaving texture
transformMatrix
=
translationMatrix
(
vec3
(
0
,
0
,
6
*
time
))
*
scaleMatrix
(
vec3
(
1
+
pow
(
2
*
time
,
2
.
1
),
1
+
pow
(
2
*
time
,
2
.
1
),
0
))
*
slideScaleMatrix
*
rotationMatrix
(
vec3
(
0
.
0
,
0
.
0
,
1
.
0
),
-
pow
(
time
,
3
)
*
M_PI
)
*
invertSlideScaleMatrix
;
}
else
{
// Entering texture
transformMatrix
=
translationMatrix
(
vec3
(
0
,
0
,
28
*
(
sqrt
(
time
)
-
1
)))
*
slideScaleMatrix
*
rotationMatrix
(
vec3
(
0
.
0
,
0
.
0
,
1
.
0
),
pow
(
time
-
1
,
2
)
*
M_PI
)
*
invertSlideScaleMatrix
;
}
modelViewProjectionMatrix
=
u_projectionMatrix
*
modelViewMatrix
*
transformMatrix
;
gl_Position
=
vec4
(
a_position
,
1
.
0
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
Dosyayı görüntüle @
c0b8c035
...
@@ -1804,70 +1804,103 @@ std::shared_ptr<OGLTransitionImpl> makeGlitter()
...
@@ -1804,70 +1804,103 @@ std::shared_ptr<OGLTransitionImpl> makeGlitter()
return
makeSimpleTransition
(
aLeavingSlide
,
aEnteringSlide
);
return
makeSimpleTransition
(
aLeavingSlide
,
aEnteringSlide
);
}
}
std
::
shared_ptr
<
OGLTransitionImpl
>
makeHoneycomb
()
namespace
{
{
const
int
NX
=
21
;
const
int
NY
=
21
;
Primitives_t
aLeavingSlide
;
class
HoneycombTransition
:
public
PermTextureTransition
Primitives_t
aEnteringSlide
;
{
public
:
HoneycombTransition
(
const
TransitionScene
&
rScene
,
const
TransitionSettings
&
rSettings
)
:
PermTextureTransition
(
rScene
,
rSettings
)
{
}
float
fRandom
=
0.0
f
;
private
:
virtual
GLuint
makeShader
()
const
override
;
virtual
void
prepareTransition
(
sal_Int32
glLeavingSlideTex
,
sal_Int32
glEnteringSlideTex
)
override
;
virtual
void
displaySlides_
(
double
nTime
,
sal_Int32
glLeavingSlideTex
,
sal_Int32
glEnteringSlideTex
,
double
SlideWidthScale
,
double
SlideHeightScale
)
override
;
int
centerX
=
NX
/
2
;
GLint
maHexagonSizeLocation
=
0
;
int
centerY
=
NY
/
2
;
GLint
maTimeLocation
=
0
;
GLint
maSelectedTextureLocation
=
0
;
};
for
(
int
y
=
0
;
y
<
NY
+
2
;
y
+=
2
)
GLuint
HoneycombTransition
::
makeShader
()
const
{
{
for
(
int
x
=
0
;
x
<
NX
+
2
;
x
+=
2
)
return
OpenGLHelper
::
LoadShaders
(
"honeycombVertexShader"
,
"honeycombFragmentShader"
,
"honeycombGeometryShader"
);
{
}
Primitive
aHexagon
;
createHexagon
(
aHexagon
,
x
,
y
,
NX
,
NY
);
fRandom
=
comphelper
::
rng
::
uniform_real_distribution
(
0.2
,
std
::
nextafter
(
0.7
,
DBL_MAX
));
void
HoneycombTransition
::
prepareTransition
(
sal_Int32
glLeavingSlideTex
,
sal_Int32
glEnteringSlideTex
)
{
CHECK_GL_ERROR
();
PermTextureTransition
::
prepareTransition
(
glLeavingSlideTex
,
glEnteringSlideTex
);
aHexagon
.
Operations
.
push_back
(
makeSRotate
(
glm
::
vec3
(
0
,
0
,
1
),
glm
::
vec3
(
0
,
0
,
0
),
0
,
false
,
-
1
,
0.1
));
CHECK_GL_ERROR
();
aHexagon
.
Operations
.
push_back
(
makeSRotate
(
glm
::
vec3
(
0
,
0
,
1
),
glm
::
vec3
(
0
,
0
,
0
),
90
,
true
,
0.2
,
1.0
));
maHexagonSizeLocation
=
glGetUniformLocation
(
m_nProgramObject
,
"hexagonSize"
);
if
(
x
<=
0
||
y
<=
0
||
x
>=
NX
||
y
>=
NY
)
maTimeLocation
=
glGetUniformLocation
(
m_nProgramObject
,
"time"
);
{
maSelectedTextureLocation
=
glGetUniformLocation
(
m_nProgramObject
,
"selectedTexture"
);
aHexagon
.
Operations
.
push_back
(
makeSTranslate
(
glm
::
vec3
(
0
,
0
,
100
),
false
,
0.1
,
1.0
));
CHECK_GL_ERROR
();
}
else
if
((
centerX
-
1
<=
x
&&
x
<=
centerX
+
1
&&
centerY
-
1
<=
y
&&
y
<=
centerY
+
1
))
{
aHexagon
.
Operations
.
push_back
(
makeSTranslate
(
glm
::
vec3
(
0
,
0
,
7
),
true
,
0.0
,
1.0
));
aHexagon
.
Operations
.
push_back
(
makeSTranslate
(
glm
::
vec3
(
0
,
0
,
100
),
false
,
0.1
,
1.0
));
}
else
{
aHexagon
.
Operations
.
push_back
(
makeSTranslate
(
glm
::
vec3
(
0
,
0
,
7
),
true
,
0.0
,
1.0
));
aHexagon
.
Operations
.
push_back
(
makeSTranslate
(
glm
::
vec3
(
0
,
0
,
100
),
false
,
fRandom
,
1.0
));
}
aLeavingSlide
.
push_back
(
aHexagon
);
// We want to see the entering slide behind the leaving one.
glEnable
(
GL_BLEND
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
CHECK_GL_ERROR
();
}
aHexagon
.
Operations
.
clear
();
void
HoneycombTransition
::
displaySlides_
(
double
nTime
,
sal_Int32
glLeavingSlideTex
,
sal_Int32
glEnteringSlideTex
,
double
SlideWidthScale
,
double
SlideHeightScale
)
{
CHECK_GL_ERROR
();
applyOverallOperations
(
nTime
,
SlideWidthScale
,
SlideHeightScale
);
glUniform1f
(
maTimeLocation
,
nTime
);
aHexagon
.
Operations
.
push_back
(
makeSRotate
(
glm
::
vec3
(
0
,
0
,
1
),
glm
::
vec3
(
0
,
0
,
0
),
-
90
,
false
,
-
1
,
0.0
));
// The back (entering) slide needs to be drawn before the front (leaving) one in order for blending to work.
aHexagon
.
Operations
.
push_back
(
makeSRotate
(
glm
::
vec3
(
0
,
0
,
1
),
glm
::
vec3
(
0
,
0
,
0
),
90
,
true
,
0.0
,
0.8
));
aHexagon
.
Operations
.
push_back
(
makeSTranslate
(
glm
::
vec3
(
-
100
,
0
,
-
20
),
false
,
-
1
,
0
))
;
const
float
borderSize
=
0.15
;
if
(
x
<=
0
||
y
<=
0
||
x
>=
NX
||
y
>=
NY
)
CHECK_GL_ERROR
();
{
glUniform1f
(
maSelectedTextureLocation
,
0.0
);
fRandom
=
comphelper
::
rng
::
uniform_real_distribution
(
0.85
,
std
::
nextafter
(
0.95
,
DBL_MAX
));
glUniform1f
(
maHexagonSizeLocation
,
1.0
-
borderSize
);
aHexagon
.
Operations
.
push_back
(
makeSTranslate
(
glm
::
vec3
(
100
,
0
,
0
),
false
,
fRandom
,
0.95
));
displaySlide
(
nTime
,
glEnteringSlideTex
,
getScene
().
getEnteringSlide
(),
SlideWidthScale
,
SlideHeightScale
);
}
glUniform1f
(
maHexagonSizeLocation
,
1.0
+
borderSize
);
else
displaySlide
(
nTime
,
glEnteringSlideTex
,
getScene
().
getEnteringSlide
(),
SlideWidthScale
,
SlideHeightScale
);
{
CHECK_GL_ERROR
();
fRandom
=
comphelper
::
rng
::
uniform_real_distribution
(
0.3
,
std
::
nextafter
(
0.8
,
DBL_MAX
));
aHexagon
.
Operations
.
push_back
(
makeSTranslate
(
glm
::
vec3
(
100
,
0
,
0
),
false
,
fRandom
,
0.9
));
}
aHexagon
.
Operations
.
push_back
(
makeSTranslate
(
glm
::
vec3
(
0
,
0
,
20
),
true
,
0.1
,
1.0
));
aEnteringSlide
.
push_back
(
aHexagon
);
}
}
return
makeSimpleTransition
(
aLeavingSlide
,
aEnteringSlide
);
glUniform1f
(
maSelectedTextureLocation
,
1.0
);
glUniform1f
(
maHexagonSizeLocation
,
1.0
-
borderSize
);
displaySlide
(
nTime
,
glLeavingSlideTex
,
getScene
().
getLeavingSlide
(),
SlideWidthScale
,
SlideHeightScale
);
glUniform1f
(
maHexagonSizeLocation
,
1.0
+
borderSize
);
displaySlide
(
nTime
,
glLeavingSlideTex
,
getScene
().
getLeavingSlide
(),
SlideWidthScale
,
SlideHeightScale
);
}
std
::
shared_ptr
<
OGLTransitionImpl
>
makeHoneycombTransition
(
const
Primitives_t
&
rLeavingSlidePrimitives
,
const
Primitives_t
&
rEnteringSlidePrimitives
,
const
TransitionSettings
&
rSettings
=
TransitionSettings
())
{
// The center point should be adjustable by the user, but we have no way to do that in the UI
return
std
::
make_shared
<
HoneycombTransition
>
(
TransitionScene
(
rLeavingSlidePrimitives
,
rEnteringSlidePrimitives
),
rSettings
);
}
}
std
::
shared_ptr
<
OGLTransitionImpl
>
makeHoneycomb
()
{
const
int
NX
=
21
;
const
int
NY
=
21
;
TransitionSettings
aSettings
;
aSettings
.
mnRequiredGLVersion
=
3.2
;
Primitives_t
aSlide
;
Primitive
aHexagon
;
for
(
int
y
=
0
;
y
<
NY
+
2
;
y
+=
2
)
for
(
int
x
=
0
;
x
<
NX
+
2
;
x
+=
2
)
aHexagon
.
pushTriangle
(
glm
::
vec2
(
y
%
4
?
fdiv
(
x
,
NX
)
:
fdiv
(
x
+
1
,
NX
),
fdiv
(
y
,
NY
)),
glm
::
vec2
(
1
,
0
),
glm
::
vec2
(
0
,
0
));
aSlide
.
push_back
(
aHexagon
);
return
makeHoneycombTransition
(
aSlide
,
aSlide
,
aSettings
);
}
}
std
::
shared_ptr
<
OGLTransitionImpl
>
makeNewsflash
()
std
::
shared_ptr
<
OGLTransitionImpl
>
makeNewsflash
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment