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
d9116f22
Kaydet (Commit)
d9116f22
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 Glitter transition
Change-Id: Iaf482b357577ff8a5511607844a69c90ea28d29f
üst
c0b8c035
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
205 additions
and
23 deletions
+205
-23
Package_opengl.mk
slideshow/Package_opengl.mk
+2
-0
glitterFragmentShader.glsl
slideshow/opengl/glitterFragmentShader.glsl
+36
-0
glitterVertexShader.glsl
slideshow/opengl/glitterVertexShader.glsl
+79
-0
OGLTrans_TransitionImpl.cxx
...ource/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+88
-23
No files found.
slideshow/Package_opengl.mk
Dosyayı görüntüle @
d9116f22
...
...
@@ -15,6 +15,8 @@ $(eval $(call gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
dissolveFragmentShader.glsl \
fadeBlackFragmentShader.glsl \
fadeFragmentShader.glsl \
glitterVertexShader.glsl \
glitterFragmentShader.glsl \
honeycombVertexShader.glsl \
honeycombGeometryShader.glsl \
honeycombFragmentShader.glsl \
...
...
slideshow/opengl/glitterFragmentShader.glsl
0 → 100644
Dosyayı görüntüle @
d9116f22
/* -*- 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 130
#define M_PI 3.1415926535897932384626433832795
uniform
sampler2D
leavingSlideTexture
;
uniform
sampler2D
enteringSlideTexture
;
varying
vec2
v_texturePosition
;
varying
vec3
v_normal
;
uniform
float
time
;
varying
float
angle
;
void
main
()
{
vec3
lightVector
=
vec3
(
0
.
0
,
0
.
0
,
1
.
0
);
float
light
=
dot
(
lightVector
,
v_normal
);
vec4
fragment
;
if
(
angle
<
M_PI
)
fragment
=
texture2D
(
leavingSlideTexture
,
v_texturePosition
);
else
fragment
=
texture2D
(
enteringSlideTexture
,
v_texturePosition
);
vec4
black
=
vec4
(
0
.
0
,
0
.
0
,
0
.
0
,
fragment
.
a
);
gl_FragColor
=
mix
(
black
,
fragment
,
max
(
light
,
0
.
0
));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
slideshow/opengl/glitterVertexShader.glsl
0 → 100644
Dosyayı görüntüle @
d9116f22
/* -*- 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 130
#define M_PI 3.1415926535897932384626433832795
attribute
vec3
a_position
;
attribute
vec3
a_normal
;
uniform
mat4
u_projectionMatrix
;
uniform
mat4
u_modelViewMatrix
;
uniform
mat4
u_sceneTransformMatrix
;
uniform
mat4
u_primitiveTransformMatrix
;
uniform
mat4
u_operationsTransformMatrix
;
varying
vec2
v_texturePosition
;
varying
vec3
v_normal
;
attribute
vec3
center
;
uniform
float
time
;
uniform
ivec2
numTiles
;
uniform
sampler2D
permTexture
;
varying
float
angle
;
float
snoise
(
vec2
p
)
{
return
texture2D
(
permTexture
,
p
).
r
;
}
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
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
)
{
// There are 18 vertices in an hexagon
int
instanceID
=
gl_VertexID
/
18
;
vec2
pos
=
(
center
.
xy
+
1
)
/
2
;
float
fuzz
=
snoise
(
pos
);
float
startTime
=
pos
.
x
*
0
.
5
+
fuzz
*
0
.
25
;
float
endTime
=
startTime
+
0
.
25
;
float
actualTime
=
clamp
((
time
-
startTime
)
/
(
endTime
-
startTime
),
0
,
1
);
angle
=
actualTime
*
M_PI
*
2
;
mat4
modelViewMatrix
=
u_modelViewMatrix
*
u_operationsTransformMatrix
*
u_sceneTransformMatrix
*
u_primitiveTransformMatrix
;
mat4
transformMatrix
=
translationMatrix
(
center
)
*
rotationMatrix
(
vec3
(
0
,
1
,
0
),
angle
)
*
translationMatrix
(
-
center
);
mat3
normalMatrix
=
mat3
(
transpose
(
inverse
(
transformMatrix
)));
gl_Position
=
u_projectionMatrix
*
modelViewMatrix
*
transformMatrix
*
vec4
(
a_position
,
1
.
0
);
v_texturePosition
=
vec2
((
a_position
.
x
+
1
)
/
2
,
(
1
-
a_position
.
y
)
/
2
);
v_normal
=
normalize
(
normalMatrix
*
a_normal
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
Dosyayı görüntüle @
d9116f22
...
...
@@ -1768,40 +1768,105 @@ void createHexagon(Primitive& aHexagon, const int x, const int y, const int NX,
}
}
std
::
shared_ptr
<
OGLTransitionImpl
>
makeGlitter
()
namespace
{
const
int
NX
=
80
;
const
int
NY
=
NX
*
4
/
3
;
Primitives_t
aLeavingSlide
;
Primitives_t
aEnteringSlide
;
for
(
int
y
=
0
;
y
<
NY
+
2
;
y
+=
2
)
class
GlitterTransition
:
public
PermTextureTransition
{
public
:
GlitterTransition
(
const
TransitionScene
&
rScene
,
const
TransitionSettings
&
rSettings
)
:
PermTextureTransition
(
rScene
,
rSettings
)
{
for
(
int
x
=
0
;
x
<
NX
+
2
;
x
+=
2
)
{
Primitive
aHexagon
;
createHexagon
(
aHexagon
,
x
,
y
,
NX
,
NY
);
}
glm
::
vec3
aCenter
=
aHexagon
.
getVertex
(
2
);
private
:
virtual
GLuint
makeShader
()
const
override
;
virtual
void
prepareTransition
(
sal_Int32
glLeavingSlideTex
,
sal_Int32
glEnteringSlideTex
)
override
;
virtual
void
finish
(
double
nTime
,
double
SlideWidth
,
double
SlideHeight
,
double
DispWidth
,
double
DispHeight
)
override
;
float
fRandom
=
comphelper
::
rng
::
uniform_real_distribution
(
-
0.25
,
std
::
nextafter
(
0.2
,
DBL_MAX
));
GLuint
maBuffer
=
0
;
};
double
fDelta
=
0.6
+
fRandom
;
double
fHorizontal
=
fdiv
(
x
,
NX
+
2
)
*
fDelta
;
GLuint
GlitterTransition
::
makeShader
()
const
{
return
OpenGLHelper
::
LoadShaders
(
"glitterVertexShader"
,
"glitterFragmentShader"
);
}
double
fStart
=
fHorizontal
;
double
fEnd
=
fHorizontal
+
(
1.0
-
fDelta
);
struct
ThreeFloats
{
GLfloat
x
,
y
,
z
;
};
aHexagon
.
Operations
.
push_back
(
makeSRotate
(
glm
::
vec3
(
0
,
1
,
0
),
aCenter
,
180
,
true
,
fStart
,
fEnd
));
aLeavingSlide
.
push_back
(
aHexagon
);
void
GlitterTransition
::
prepareTransition
(
sal_Int32
glLeavingSlideTex
,
sal_Int32
glEnteringSlideTex
)
{
CHECK_GL_ERROR
();
PermTextureTransition
::
prepareTransition
(
glLeavingSlideTex
,
glEnteringSlideTex
);
CHECK_GL_ERROR
();
aHexagon
.
Operations
.
push_back
(
makeSRotate
(
glm
::
vec3
(
0
,
1
,
0
),
aCenter
,
180
,
false
,
fStart
,
fEnd
));
aEnteringSlide
.
push_back
(
aHexagon
);
}
GLint
nNumTilesLocation
=
glGetUniformLocation
(
m_nProgramObject
,
"numTiles"
);
if
(
nNumTilesLocation
!=
-
1
)
{
glUniform2iv
(
nNumTilesLocation
,
1
,
glm
::
value_ptr
(
glm
::
ivec2
(
41
,
41
*
4
/
3
)));
CHECK_GL_ERROR
();
}
return
makeSimpleTransition
(
aLeavingSlide
,
aEnteringSlide
);
glGenBuffers
(
1
,
&
maBuffer
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
maBuffer
);
// Upload the center of each hexagon.
const
Primitive
&
primitive
=
getScene
().
getLeavingSlide
()[
0
];
int
nbVertices
=
primitive
.
getVerticesSize
()
/
sizeof
(
Vertex
);
std
::
vector
<
ThreeFloats
>
vertices
;
for
(
int
i
=
2
;
i
<
nbVertices
;
i
+=
18
)
{
const
glm
::
vec3
&
center
=
primitive
.
getVertex
(
i
);
for
(
int
j
=
0
;
j
<
18
;
++
j
)
vertices
.
push_back
({
center
.
x
,
center
.
y
,
center
.
z
});
}
glBufferData
(
GL_ARRAY_BUFFER
,
vertices
.
size
()
*
3
*
sizeof
(
GLfloat
),
vertices
.
data
(),
GL_STATIC_DRAW
);
GLint
location
=
glGetAttribLocation
(
m_nProgramObject
,
"center"
);
if
(
location
!=
-
1
)
{
glEnableVertexAttribArray
(
location
);
glVertexAttribPointer
(
location
,
3
,
GL_FLOAT
,
false
,
0
,
NULL
);
CHECK_GL_ERROR
();
}
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
}
void
GlitterTransition
::
finish
(
double
,
double
,
double
,
double
,
double
)
{
CHECK_GL_ERROR
();
glDeleteBuffers
(
1
,
&
maBuffer
);
CHECK_GL_ERROR
();
}
std
::
shared_ptr
<
OGLTransitionImpl
>
makeGlitterTransition
(
const
Primitives_t
&
rLeavingSlidePrimitives
,
const
Primitives_t
&
rEnteringSlidePrimitives
,
const
TransitionSettings
&
rSettings
=
TransitionSettings
())
{
return
std
::
make_shared
<
GlitterTransition
>
(
TransitionScene
(
rLeavingSlidePrimitives
,
rEnteringSlidePrimitives
),
rSettings
);
}
}
std
::
shared_ptr
<
OGLTransitionImpl
>
makeGlitter
()
{
const
int
NX
=
80
;
const
int
NY
=
NX
*
4
/
3
;
Primitives_t
aSlide
;
Primitives_t
aEmptySlide
;
Primitive
aHexagon
;
for
(
int
y
=
0
;
y
<
NY
+
2
;
y
+=
2
)
for
(
int
x
=
0
;
x
<
NX
+
2
;
x
+=
2
)
createHexagon
(
aHexagon
,
x
,
y
,
NX
,
NY
);
aSlide
.
push_back
(
aHexagon
);
return
makeGlitterTransition
(
aSlide
,
aEmptySlide
);
}
namespace
...
...
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