Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
edge-of-space
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dario Seyb
edge-of-space
Commits
67c59f2b
Commit
67c59f2b
authored
Feb 06, 2016
by
Dario Seyb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polished intro
parent
72fa81e7
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
418 additions
and
20 deletions
+418
-20
data/geometry/cockpit/cockpit_v2_console_back_left.obj
data/geometry/cockpit/cockpit_v2_console_back_left.obj
+52
-0
data/geometry/cockpit/cockpit_v2_console_back_right.obj
data/geometry/cockpit/cockpit_v2_console_back_right.obj
+52
-0
data/geometry/cockpit/cockpit_v2_console_front_left.obj
data/geometry/cockpit/cockpit_v2_console_front_left.obj
+52
-0
data/geometry/cockpit/cockpit_v2_console_front_right.obj
data/geometry/cockpit/cockpit_v2_console_front_right.obj
+52
-0
data/geometry/cockpit/cockpit_v2_console_middle_left.obj
data/geometry/cockpit/cockpit_v2_console_middle_left.obj
+41
-0
data/geometry/cockpit/cockpit_v2_console_middle_right.obj
data/geometry/cockpit/cockpit_v2_console_middle_right.obj
+41
-0
data/geometry_src/cockpit_v2.blend
data/geometry_src/cockpit_v2.blend
+0
-0
data/geometry_src/cockpit_v2.blend1
data/geometry_src/cockpit_v2.blend1
+0
-0
data/shader/Skybox.fsh
data/shader/Skybox.fsh
+4
-1
data/shader/console/Background.fsh
data/shader/console/Background.fsh
+7
-3
src/game/include/engine/audio/AudioSystem.hpp
src/game/include/engine/audio/AudioSystem.hpp
+17
-0
src/game/src/engine/audio/AudioSystem.cpp
src/game/src/engine/audio/AudioSystem.cpp
+19
-0
src/game/src/engine/scene/scenes/AtmosphereTestScene.cpp
src/game/src/engine/scene/scenes/AtmosphereTestScene.cpp
+45
-14
src/game/src/engine/scene/scenes/Console.cpp
src/game/src/engine/scene/scenes/Console.cpp
+36
-2
No files found.
data/geometry/cockpit/cockpit_v2_console_back_left.obj
0 → 100644
View file @
67c59f2b
# Blender v2.71 (sub 0) OBJ File: 'cockpit_v2.blend'
# www.blender.org
v -1.061821 -0.698382 -1.686825
v -1.291435 -0.444211 -1.852240
v -1.262768 -0.520902 -1.745952
v -1.222154 -0.520902 -1.802329
v -1.044899 -0.482556 -2.120801
v -1.196148 -0.444211 -1.984509
v -0.990964 -0.520902 -2.123246
v -1.031578 -0.520902 -2.066868
v -1.102435 -0.698382 -1.630447
v -1.277529 -0.482556 -1.797886
v -1.126866 -0.520902 -1.934599
v -0.966533 -0.698382 -1.819094
v -0.830631 -0.698382 -2.007741
v -1.100860 -0.444211 -2.116779
v -0.871246 -0.698382 -1.951364
vt 0.149489 0.997251
vt 0.072139 0.846115
vt 0.000090 0.696382
vt 0.500001 0.997250
vt 0.149489 0.696383
vt 0.149490 0.000111
vt 0.500001 0.696383
vt 0.999909 0.696381
vt 0.927860 0.846115
vt 0.850510 0.997250
vt 0.850511 0.696383
vt 0.999909 0.000110
vt 0.850512 0.000110
vt 0.000093 0.000112
vt 0.500001 0.000111
vn 0.731100 0.631400 0.258400
vn 0.542200 0.744000 0.390600
vn 0.476600 0.631400 0.611700
s off
f 2/1/1 10/2/1 3/3/1
f 6/4/2 2/1/2 4/5/2
f 1/6/2 4/5/2 3/3/2
f 11/7/2 4/5/2 1/6/2
f 7/8/3 5/9/3 14/10/3
f 11/7/2 8/11/2 14/10/2
f 13/12/2 7/8/2 8/11/2
f 15/13/2 8/11/2 11/7/2
f 4/5/2 2/1/2 3/3/2
f 11/7/2 6/4/2 4/5/2
f 9/14/2 1/6/2 3/3/2
f 12/15/2 11/7/2 1/6/2
f 8/11/2 7/8/2 14/10/2
f 6/4/2 11/7/2 14/10/2
f 15/13/2 13/12/2 8/11/2
f 12/15/2 15/13/2 11/7/2
data/geometry/cockpit/cockpit_v2_console_back_right.obj
0 → 100644
View file @
67c59f2b
# Blender v2.71 (sub 0) OBJ File: 'cockpit_v2.blend'
# www.blender.org
v 1.061821 -0.698382 -1.686825
v 1.291435 -0.444211 -1.852240
v 1.262768 -0.520902 -1.745952
v 1.222154 -0.520902 -1.802329
v 1.044899 -0.482556 -2.120801
v 1.196148 -0.444211 -1.984509
v 0.990964 -0.520902 -2.123246
v 1.031578 -0.520902 -2.066868
v 1.102435 -0.698382 -1.630447
v 1.277529 -0.482556 -1.797886
v 1.126866 -0.520902 -1.934599
v 0.966533 -0.698382 -1.819094
v 0.830631 -0.698382 -2.007741
v 1.100860 -0.444211 -2.116779
v 0.871246 -0.698382 -1.951364
vt 0.999910 0.696382
vt 0.927861 0.846115
vt 0.850511 0.997251
vt 0.850511 0.696383
vt 0.499999 0.997250
vt 0.850510 0.000111
vt 0.999907 0.000112
vt 0.499999 0.696383
vt 0.149490 0.997250
vt 0.072140 0.846115
vt 0.000091 0.696381
vt 0.149489 0.696383
vt 0.000091 0.000110
vt 0.149488 0.000110
vt 0.499999 0.000111
vn -0.731100 0.631400 0.258400
vn -0.542200 0.744000 0.390600
vn -0.476600 0.631400 0.611700
s off
f 3/1/1 10/2/1 2/3/1
f 4/4/2 2/3/2 6/5/2
f 1/6/2 9/7/2 3/1/2
f 1/6/2 4/4/2 11/8/2
f 14/9/3 5/10/3 7/11/3
f 11/8/2 6/5/2 14/9/2
f 8/12/2 7/11/2 13/13/2
f 11/8/2 8/12/2 15/14/2
f 4/4/2 3/1/2 2/3/2
f 11/8/2 4/4/2 6/5/2
f 4/4/2 1/6/2 3/1/2
f 12/15/2 1/6/2 11/8/2
f 8/12/2 14/9/2 7/11/2
f 8/12/2 11/8/2 14/9/2
f 15/14/2 8/12/2 13/13/2
f 12/15/2 11/8/2 15/14/2
data/geometry/cockpit/cockpit_v2_console_front_left.obj
0 → 100644
View file @
67c59f2b
# Blender v2.71 (sub 0) OBJ File: 'cockpit_v2.blend'
# www.blender.org
v -0.964138 -0.445972 -2.312674
v -0.772664 -0.703471 -2.087978
v -0.731518 -0.703471 -2.145093
v -0.935096 -0.523667 -2.204994
v -0.893950 -0.523667 -2.262110
v -0.497302 -0.703471 -2.470211
v -0.714375 -0.484820 -2.584751
v -0.700880 -0.523667 -2.530112
v -0.950050 -0.484820 -2.257608
v -0.867603 -0.445972 -2.446675
v -0.797415 -0.523667 -2.396111
v -0.634983 -0.703471 -2.279094
v -0.659734 -0.523667 -2.587227
v -0.771068 -0.445972 -2.580676
v -0.538448 -0.703471 -2.413095
vt 0.149492 0.992412
vt 0.072141 0.842009
vt 0.000090 0.693003
vt 0.500002 0.693003
vt 0.500003 0.992409
vt 0.149489 0.693003
vt 0.000091 0.000110
vt 0.149491 0.000110
vt 0.850513 0.693001
vt 0.850512 0.992408
vt 0.999908 0.000110
vt 0.999910 0.692999
vt 0.500002 0.000110
vt 0.850511 0.000110
vt 0.927862 0.842005
vn 0.731000 0.631500 0.258400
vn 0.542200 0.744000 0.390600
vn 0.476600 0.631500 0.611600
s off
f 1/1/1 9/2/1 4/3/1
f 11/4/2 10/5/2 1/1/2
f 5/6/2 4/3/2 2/7/2
f 11/4/2 5/6/2 3/8/2
f 11/4/2 8/9/2 14/10/2
f 6/11/2 13/12/2 8/9/2
f 12/13/2 15/14/2 8/9/2
f 13/12/3 7/15/3 14/10/3
f 5/6/2 1/1/2 4/3/2
f 5/6/2 11/4/2 1/1/2
f 3/8/2 5/6/2 2/7/2
f 12/13/2 11/4/2 3/8/2
f 10/5/2 11/4/2 14/10/2
f 15/14/2 6/11/2 8/9/2
f 11/4/2 12/13/2 8/9/2
f 8/9/2 13/12/2 14/10/2
data/geometry/cockpit/cockpit_v2_console_front_right.obj
0 → 100644
View file @
67c59f2b
# Blender v2.71 (sub 0) OBJ File: 'cockpit_v2.blend'
# www.blender.org
v 0.964138 -0.445972 -2.312674
v 0.772664 -0.703471 -2.087978
v 0.731518 -0.703471 -2.145093
v 0.935096 -0.523667 -2.204994
v 0.893950 -0.523667 -2.262110
v 0.497302 -0.703471 -2.470211
v 0.714375 -0.484820 -2.584751
v 0.700880 -0.523667 -2.530112
v 0.950050 -0.484820 -2.257608
v 0.867603 -0.445972 -2.446675
v 0.797415 -0.523667 -2.396111
v 0.634983 -0.703471 -2.279094
v 0.659734 -0.523667 -2.587227
v 0.771068 -0.445972 -2.580676
v 0.538448 -0.703471 -2.413095
vt 0.999910 0.693003
vt 0.927859 0.842009
vt 0.850508 0.992412
vt 0.499998 0.693003
vt 0.850511 0.693003
vt 0.999909 0.000110
vt 0.850509 0.000110
vt 0.499997 0.992409
vt 0.149488 0.992408
vt 0.149487 0.693001
vt 0.000090 0.692999
vt 0.000092 0.000110
vt 0.149489 0.000110
vt 0.072138 0.842005
vt 0.499998 0.000110
vn -0.731000 0.631500 0.258400
vn -0.542200 0.744000 0.390600
vn -0.476600 0.631500 0.611600
s off
f 4/1/1 9/2/1 1/3/1
f 11/4/2 5/5/2 1/3/2
f 2/6/2 4/1/2 5/5/2
f 3/7/2 5/5/2 11/4/2
f 11/4/2 10/8/2 14/9/2
f 8/10/2 13/11/2 6/12/2
f 11/4/2 8/10/2 15/13/2
f 14/9/3 7/14/3 13/11/3
f 5/5/2 4/1/2 1/3/2
f 10/8/2 11/4/2 1/3/2
f 3/7/2 2/6/2 5/5/2
f 12/15/2 3/7/2 11/4/2
f 8/10/2 11/4/2 14/9/2
f 15/13/2 8/10/2 6/12/2
f 12/15/2 11/4/2 15/13/2
f 8/10/2 14/9/2 13/11/2
data/geometry/cockpit/cockpit_v2_console_middle_left.obj
0 → 100644
View file @
67c59f2b
# Blender v2.71 (sub 0) OBJ File: 'cockpit_v2.blend'
# www.blender.org
v -0.357533 -0.697646 -2.478408
v -0.315905 -0.825259 -2.223594
v -0.281419 -0.825259 -2.234052
v -0.369054 -0.736151 -2.394220
v -0.085110 -0.825259 -2.293582
v -0.166277 -0.716899 -2.495718
v -0.363808 -0.716899 -2.435817
v -0.276622 -0.697646 -2.502944
v -0.200508 -0.825259 -2.258588
v -0.138259 -0.736151 -2.464208
v -0.195711 -0.697646 -2.527479
v -0.119597 -0.825259 -2.283124
vt 0.499923 0.997923
vt 0.840881 0.999908
vt 0.916120 0.849220
vt 0.986209 0.700532
vt 0.986209 0.005755
vt 0.840884 0.004908
vt 0.158968 0.000938
vt 0.013642 0.000091
vt 0.013639 0.694871
vt 0.158964 0.995941
vt 0.083722 0.844377
vt 0.499927 0.002923
vn 0.128600 0.896400 0.424200
vn 0.129500 0.894900 0.427000
vn 0.127500 0.892800 0.432100
vn 0.134000 0.892800 0.430100
s off
f 8/1/1 1/2/1 7/3/1
f 4/4/2 2/5/2 3/6/2
f 12/7/2 5/8/2 10/9/2
f 11/10/1 8/1/1 6/11/1
f 8/1/3 10/9/3 6/11/3
f 4/4/4 8/1/4 7/3/4
f 9/12/2 12/7/2 10/9/2
f 8/1/2 4/4/2 10/9/2
f 4/4/2 3/6/2 9/12/2
f 4/4/2 9/12/2 10/9/2
data/geometry/cockpit/cockpit_v2_console_middle_right.obj
0 → 100644
View file @
67c59f2b
# Blender v2.71 (sub 0) OBJ File: 'cockpit_v2.blend'
# www.blender.org
v 0.357533 -0.697646 -2.478408
v 0.315905 -0.825259 -2.223594
v 0.281419 -0.825259 -2.234052
v 0.369054 -0.736151 -2.394220
v 0.085110 -0.825259 -2.293582
v 0.166277 -0.716899 -2.495718
v 0.363808 -0.716899 -2.435817
v 0.276622 -0.697646 -2.502944
v 0.200508 -0.825259 -2.258588
v 0.138259 -0.736151 -2.464208
v 0.195711 -0.697646 -2.527479
v 0.119597 -0.825259 -2.283124
vt 0.013791 0.700532
vt 0.986361 0.694871
vt 0.500073 0.002923
vt 0.159116 0.004908
vt 0.013791 0.005755
vt 0.159119 0.999908
vt 0.500077 0.997923
vt 0.083880 0.849220
vt 0.841032 0.000938
vt 0.916278 0.844377
vt 0.986358 0.000091
vt 0.841036 0.995941
vn -0.129500 0.894900 0.427000
vn -0.128600 0.896400 0.424200
vn -0.127500 0.892800 0.432100
vn -0.134000 0.892800 0.430100
s off
f 4/1/1 10/2/1 9/3/1
f 3/4/1 2/5/1 4/1/1
f 1/6/2 8/7/2 7/8/2
f 10/2/1 12/9/1 9/3/1
f 10/2/3 8/7/3 6/10/3
f 10/2/1 5/11/1 12/9/1
f 9/3/1 3/4/1 4/1/1
f 8/7/4 4/1/4 7/8/4
f 8/7/2 11/12/2 6/10/2
f 4/1/1 8/7/1 10/2/1
data/geometry_src/cockpit_v2.blend
View file @
67c59f2b
No preview for this file type
data/geometry_src/cockpit_v2.blend1
View file @
67c59f2b
No preview for this file type
data/shader/Skybox.fsh
View file @
67c59f2b
...
...
@@ -11,7 +11,10 @@ vec4 color() {
}
vec4 emissive() {
return texture(uTexture, vTexCoord).rgba * uEmissiveColor;
if(uHasAlbedoMap) {
return texture(uTexture, vTexCoord).rgba * uEmissiveColor;
}
return vec4(0);
}
vec3 normal() {
...
...
data/shader/console/Background.fsh
View file @
67c59f2b
...
...
@@ -19,12 +19,16 @@ vec4 emissive() {
}
float middle = pow(abs(texCoord.y-0.5), 0.5);
float octave01 = sin(texCoord.x * 100 + uTime) * 0.02;
float val = texture(uTexture, vec2(-0.15, 0) + vTexCoord).r * pow((1.0- middle), 7);
float octave01 = sin(texCoord.x * 100 + uTime) * 0.02 + val * 40;
float octave02 = sin(texCoord.x * 200 + 2 + uTime * 3) * 0.01;
float period = mod( abs(texCoord.x-0.5) + uTime * 0.2 + middle + octave01 + octave02, 0.4 );
vec4 res = vec4(2, 3 + sin(uTime * 0.6), 3 + cos(uTime*0.6), 1) * (0.1 + 0.6 * period) * 0.2;
res += res * val * 200;
res.a = 1;
return res * uEmissiveColor;
}
...
...
src/game/include/engine/audio/AudioSystem.hpp
View file @
67c59f2b
...
...
@@ -25,6 +25,10 @@ private:
FMOD
::
System
*
m_fmodSystem
;
FMOD
::
DSP
*
m_fftDsp
;
FMOD
::
DSP
*
m_lowPassDsp
;
SoundId
m_nextId
;
bool
m_isActive
;
...
...
@@ -43,6 +47,19 @@ public:
void
setListener
(
Entity
listener
)
{
m_listener
=
listener
;
setListenerProperties
();
}
std
::
shared_ptr
<
Sound
>
createSound
(
std
::
string
filename
,
SoundMode
mode
);
void
getSpectrum
(
float
**
data
,
unsigned
int
*
length
)
{
FMOD_DSP_PARAMETER_FFT
*
dspData
;
auto
result
=
m_fftDsp
->
getParameterData
(
2
,
(
void
**
)
&
dspData
,
length
,
0
,
0
);
*
length
=
dspData
->
length
;
*
data
=
dspData
->
spectrum
[
1
];
}
void
setLowPassCutoff
(
float
val
)
{
m_lowPassDsp
->
setParameterFloat
(
FMOD_DSP_LOWPASS_CUTOFF
,
val
);
}
bool
startup
()
override
;
void
shutdown
()
override
;
};
\ No newline at end of file
src/game/src/engine/audio/AudioSystem.cpp
View file @
67c59f2b
...
...
@@ -25,6 +25,25 @@ bool AudioSystem::startup() {
result
=
m_fmodSystem
->
init
(
32
,
FMOD_INIT_NORMAL
,
0
);
CHECK_RESULT
(
result
,
"Could not init fmod system."
);
result
=
m_fmodSystem
->
createDSPByType
(
FMOD_DSP_TYPE_FFT
,
&
m_fftDsp
);
CHECK_RESULT
(
result
,
"Could not create FFT DSP."
);
FMOD
::
ChannelGroup
*
masterChannelGroup
;
result
=
m_fmodSystem
->
getMasterChannelGroup
(
&
masterChannelGroup
);
CHECK_RESULT
(
result
,
"Could not get master channel group."
);
result
=
masterChannelGroup
->
addDSP
(
1
,
m_fftDsp
);
CHECK_RESULT
(
result
,
"Could not add FFT DSP to master channel group."
);
result
=
m_fmodSystem
->
createDSPByType
(
FMOD_DSP_TYPE_LOWPASS
,
&
m_lowPassDsp
);
CHECK_RESULT
(
result
,
"Could not create Low Pass DSP."
);
result
=
masterChannelGroup
->
addDSP
(
0
,
m_lowPassDsp
);
CHECK_RESULT
(
result
,
"Could not add Low Pass to master channel group."
);
setLowPassCutoff
(
800
);
m_isActive
=
true
;
return
true
;
}
...
...
src/game/src/engine/scene/scenes/AtmosphereTestScene.cpp
View file @
67c59f2b
...
...
@@ -333,35 +333,66 @@ void AtmosphereTestScene::switchToMainScene() {
consoleSoundSource
->
play
();
auto
consoleFront
=
m_sceneGraph
->
create
();
consoleGeom
=
Geometry
{
VertexArrayObjectCreator
(
"cockpit/cockpit_v2_console_front.obj"
).
create
()
};
consoleFront
.
assign
<
Drawable
>
(
auto
consoleFront
Left
=
m_sceneGraph
->
create
();
consoleGeom
=
Geometry
{
VertexArrayObjectCreator
(
"cockpit/cockpit_v2_console_front
_left
.obj"
).
create
()
};
consoleFront
Left
.
assign
<
Drawable
>
(
consoleGeom
,
Material
{
glm
::
vec4
{
1
,
1
,
1
,
1
},
glm
::
vec4
{
1
,
1
,
1
,
1
},
m_renderer
->
getRenderPassTarget
(
"Console"
_sh
)
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
skyboxMaterial
.
prog
,
true
,
RenderQueue
::
OPAQUE
,
GL_NONE
},
0
,
cockpitPassId
);
consoleFront
.
assign
<
Transform
>
();
consoleFront
Left
.
assign
<
Transform
>
();
auto
consoleBack
=
m_sceneGraph
->
create
();
consoleGeom
=
Geometry
{
VertexArrayObjectCreator
(
"cockpit/cockpit_v2_console_back.obj"
).
create
()
};
consoleBack
.
assign
<
Drawable
>
(
auto
consoleFrontRight
=
m_sceneGraph
->
create
();
consoleGeom
=
Geometry
{
VertexArrayObjectCreator
(
"cockpit/cockpit_v2_console_front_right.obj"
).
create
()
};
consoleFrontRight
.
assign
<
Drawable
>
(
consoleGeom
,
Material
{
glm
::
vec4
{
1
,
1
,
1
,
1
},
glm
::
vec4
{
1
,
1
,
1
,
1
},
nullptr
,
nullptr
,
nullptr
,
skyboxMaterial
.
prog
,
true
,
RenderQueue
::
OPAQUE
,
GL_NONE
},
0
,
cockpitPassId
);
consoleFrontRight
.
assign
<
Transform
>
();
auto
consoleBackLeft
=
m_sceneGraph
->
create
();
consoleGeom
=
Geometry
{
VertexArrayObjectCreator
(
"cockpit/cockpit_v2_console_back_left.obj"
).
create
()
};
consoleBackLeft
.
assign
<
Drawable
>
(
consoleGeom
,
Material
{
glm
::
vec4
{
1
,
1
,
1
,
1
},
glm
::
vec4
{
1
,
1
,
1
,
1
},
m_renderer
->
getRenderPassTarget
(
"Minimap"
_sh
),
nullptr
,
nullptr
,
skyboxMaterial
.
prog
,
true
,
RenderQueue
::
OPAQUE
,
GL_NONE
},
0
,
cockpitPassId
);
consoleBack
.
assign
<
Transform
>
();
consoleBackLeft
.
assign
<
Transform
>
();
auto
consoleBackRight
=
m_sceneGraph
->
create
();
consoleGeom
=
Geometry
{
VertexArrayObjectCreator
(
"cockpit/cockpit_v2_console_back_right.obj"
).
create
()
};
consoleBackRight
.
assign
<
Drawable
>
(
consoleGeom
,
Material
{
glm
::
vec4
{
1
,
1
,
1
,
1
},
glm
::
vec4
{
1
,
1
,
1
,
1
},
nullptr
,
nullptr
,
nullptr
,
skyboxMaterial
.
prog
,
true
,
RenderQueue
::
OPAQUE
,
GL_NONE
},
0
,
cockpitPassId
);
consoleBackRight
.
assign
<
Transform
>
();
auto
consoleMiddleLeft
=
m_sceneGraph
->
create
();
consoleGeom
=
Geometry
{
VertexArrayObjectCreator
(
"cockpit/cockpit_v2_console_middle_left.obj"
).
create
()
};
consoleMiddleLeft
.
assign
<
Drawable
>
(
consoleGeom
,
Material
{
glm
::
vec4
{
1
,
1
,
1
,
1
},
glm
::
vec4
{
1
,
1
,
1
,
1
},
nullptr
,
nullptr
,
nullptr
,
skyboxMaterial
.
prog
,
true
,
RenderQueue
::
OPAQUE
,
GL_NONE
},
0
,
cockpitPassId
);
consoleMiddleLeft
.
assign
<
Transform
>
();
auto
consoleMiddle
=
m_sceneGraph
->
create
();
consoleGeom
=
Geometry
{
VertexArrayObjectCreator
(
"cockpit/cockpit_v2_console_middle.obj"
).
create
()
};
consoleMiddle
.
assign
<
Drawable
>
(
auto
consoleMiddle
Right
=
m_sceneGraph
->
create
();
consoleGeom
=
Geometry
{
VertexArrayObjectCreator
(
"cockpit/cockpit_v2_console_middle
_right
.obj"
).
create
()
};
consoleMiddle
Right
.
assign
<
Drawable
>
(
consoleGeom
,
Material
{
glm
::
vec4
{
1
,
1
,
1
,
1
},
glm
::
vec4
{
1
,
1
,
1
,
1
},
m_renderer
->
getRenderPassTarget
(
"Console"
_sh
)
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
skyboxMaterial
.
prog
,
true
,
RenderQueue
::
OPAQUE
,
GL_NONE
},
0
,
cockpitPassId
);
consoleMiddle
.
assign
<
Transform
>
();
consoleMiddle
Right
.
assign
<
Transform
>
();
auto
windShield
=
m_sceneGraph
->
create
();
auto
windShieldGeom
=
Geometry
{
...
...
src/game/src/engine/scene/scenes/Console.cpp
View file @
67c59f2b
...
...
@@ -224,6 +224,39 @@ bool Console::update(const SimulateEvent &e, const bool* keyTable) {
updateShots
(
dt
);
updateEnemies
(
dt
);
float
*
data
=
nullptr
;
unsigned
int
length
=
0
;
m_audio
->
getSpectrum
(
&
data
,
&
length
);
float
max
=
0.0001
f
;
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
if
(
data
[
i
]
>
max
)
max
=
data
[
i
];
}
GLubyte
*
byteData
=
new
GLubyte
[
length
];
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
byteData
[
i
]
=
(
GLubyte
)(
data
[
i
]
/
max
*
255
);
}
SharedTextureData
fftData
=
std
::
make_shared
<
TextureData
>
();
fftData
->
setWidth
(
length
);
fftData
->
setHeight
(
1
);
fftData
->
setData
(
byteData
);
fftData
->
setFormat
(
GL_RED
);
fftData
->
setType
(
GL_UNSIGNED_BYTE
);
auto
fftTex
=
std
::
make_shared
<
Texture2D
>
(
GL_R8
);
fftTex
->
setMinFilter
(
GL_LINEAR
);
fftTex
->
setMagFilter
(
GL_LINEAR
);
fftTex
->
setImageData
(
fftData
);
backgroundDrawable
->
material
.
mainTexture
=
fftTex
;
float
posPercentage
=
(
letterATransform
->
position
.
x
+
3.2
)
/
4.5
;
m_audio
->
setLowPassCutoff
(
500
+
posPercentage
*
3000
);
switch
(
state
)
{
case
State
::
FadingIn
:
if
(
timer
>
FADE_IN_TIME
)
{
...
...
@@ -299,7 +332,7 @@ bool Console::update(const SimulateEvent &e, const bool* keyTable) {
auto
newPos
=
letterATransform
->
position
+
playerSpeed
*
dt
;
if
(
newPos
.
x
<
-
3.
6
)
{
if
(
newPos
.
x
<
-
3.
2
)
{
playerSpeed
.
x
*=
-
0.9
f
;
soundSourceTransform
->
position
=
-
newPos
*
0.1
;
soundSourceAudio
->
setVolume
(
playerSpeed
.
length
());
...
...
@@ -334,11 +367,12 @@ bool Console::update(const SimulateEvent &e, const bool* keyTable) {
letterATransform
->
position
+=
playerSpeed
*
dt
;
playerSpeed
-=
playerSpeed
*
5
*
dt
;
if
(
newPos
.
x
>
5
)
return
true
;
if
(
newPos
.
x
>
4.
5
)
return
true
;
break
;
}
timer
+=
e
.
dt
;
return
false
;
}
...
...
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