Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Dependencies
Cpp
mirrage
Commits
b38fb1db
Commit
b38fb1db
authored
Mar 25, 2019
by
Lotrado
Browse files
Fixed build on MSVC.
parent
e9432e3d
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/mirrage/gui/src/gui.cpp
View file @
b38fb1db
...
...
@@ -14,6 +14,10 @@
#include <cstdint>
#include <string>
#ifdef _WIN32
#include "SDL_syswm.h"
#endif
extern
void
ref_embedded_assets_mirrage_gui
();
...
...
@@ -274,7 +278,7 @@ namespace mirrage::gui {
int
display_w
,
display_h
;
SDL_GetWindowSize
(
window
,
&
w
,
&
h
);
SDL_GL_GetDrawableSize
(
window
,
&
display_w
,
&
display_h
);
io
.
DisplaySize
=
ImVec2
(
w
,
h
);
io
.
DisplaySize
=
ImVec2
(
static_cast
<
float
>
(
w
),
static_cast
<
float
>
(
h
)
);
if
(
w
>
0
&&
h
>
0
)
io
.
DisplayFramebufferScale
=
ImVec2
(
static_cast
<
float
>
(
display_w
)
/
w
,
static_cast
<
float
>
(
display_h
)
/
h
);
...
...
src/mirrage/renderer/src/particle_system.cpp
View file @
b38fb1db
...
...
@@ -53,7 +53,9 @@ namespace mirrage::renderer {
_spawn_entry_timer
=
0
;
}
auto
pps
=
std
::
normal_distribution
<
float
>
(
entry
.
particles_per_second
,
entry
.
stddev
)(
rand
);
auto
pps
=
(
entry
.
stddev
>
0.0
f
)
?
std
::
normal_distribution
<
float
>
(
entry
.
particles_per_second
,
entry
.
stddev
)(
rand
)
:
entry
.
particles_per_second
;
auto
spawn
=
static_cast
<
std
::
int32_t
>
(
_time_accumulator
*
pps
);
...
...
@@ -83,8 +85,8 @@ namespace mirrage::renderer {
,
_loaded
(
_cfg
.
ready
())
,
_emitters
(
!
_loaded
?
Emitter_list
{}
:
util
::
build_vector
(
_cfg
->
emitters
.
size
(),
[
&
](
auto
idx
)
{
return
Particle_emitter
(
_cfg
->
emitters
[
idx
]);
}))
_cfg
->
emitters
.
size
(),
[
&
](
auto
idx
)
{
return
Particle_emitter
(
_cfg
->
emitters
[
idx
]);
}))
,
_effectors
(
!
_loaded
?
Effector_list
{}
:
_cfg
->
effectors
)
,
_position
(
position
)
,
_rotation
(
rotation
)
...
...
@@ -162,8 +164,8 @@ namespace mirrage::renderer {
auto
desc_sets
=
std
::
array
<
vk
::
DescriptorSetLayout
,
2
>
{
shared_desc_set
,
storage_buffer
};
auto
push_constants
=
vk
::
PushConstantRange
{
vk
::
ShaderStageFlagBits
::
eCompute
,
0
,
4
*
4
*
4
*
2
};
return
device
.
vk_device
()
->
createPipelineLayoutUnique
(
vk
::
PipelineLayoutCreateInfo
{{},
desc_sets
.
size
(),
desc_sets
.
data
(),
1
,
&
push_constants
});
return
device
.
vk_device
()
->
createPipelineLayoutUnique
(
vk
::
PipelineLayoutCreateInfo
{
{},
gsl
::
narrow
<
std
::
uint32_t
>
(
desc_sets
.
size
()
)
,
desc_sets
.
data
(),
1
,
&
push_constants
});
}
}
// namespace mirrage::renderer
...
...
@@ -201,12 +203,13 @@ namespace mirrage::asset {
{
auto
r
=
renderer
::
Particle_system_config
();
sf2
::
deserialize_json
(
in
,
[
&
](
auto
&
msg
,
uint32_t
row
,
uint32_t
column
)
{
LOG
(
plog
::
error
)
<<
"Error parsing JSON from "
<<
in
.
aid
().
str
()
<<
" at "
<<
row
<<
":"
<<
column
<<
": "
<<
msg
;
},
r
);
sf2
::
deserialize_json
(
in
,
[
&
](
auto
&
msg
,
uint32_t
row
,
uint32_t
column
)
{
LOG
(
plog
::
error
)
<<
"Error parsing JSON from "
<<
in
.
aid
().
str
()
<<
" at "
<<
row
<<
":"
<<
column
<<
": "
<<
msg
;
},
r
);
auto
loads
=
std
::
vector
<
async
::
task
<
void
>>
();
loads
.
reserve
(
r
.
emitters
.
size
()
*
2u
);
...
...
@@ -229,12 +232,13 @@ namespace mirrage::asset {
{
auto
r
=
renderer
::
Particle_type_config
();
sf2
::
deserialize_json
(
in
,
[
&
](
auto
&
msg
,
uint32_t
row
,
uint32_t
column
)
{
LOG
(
plog
::
error
)
<<
"Error parsing JSON from "
<<
in
.
aid
().
str
()
<<
" at "
<<
row
<<
":"
<<
column
<<
": "
<<
msg
;
},
r
);
sf2
::
deserialize_json
(
in
,
[
&
](
auto
&
msg
,
uint32_t
row
,
uint32_t
column
)
{
LOG
(
plog
::
error
)
<<
"Error parsing JSON from "
<<
in
.
aid
().
str
()
<<
" at "
<<
row
<<
":"
<<
column
<<
": "
<<
msg
;
},
r
);
auto
script
=
in
.
manager
().
load
<
renderer
::
Particle_script
>
(
r
.
update_script_id
);
r
.
update_script
=
script
;
...
...
src/mirrage/renderer/src/pass/frustum_culling_pass.cpp
View file @
b38fb1db
...
...
@@ -103,7 +103,7 @@ namespace mirrage::renderer {
}
else
{
auto
position
=
transform
.
position
+
bb
.
offset
;
if
(
bb
.
active
&&
bb
.
material
.
ready
()
&&
is_visible
(
viewers
.
front
(),
position
,
bb
.
size
.
length
(
)))
{
&&
is_visible
(
viewers
.
front
(),
position
,
glm
::
length
(
bb
.
size
)))
{
frame
.
billboard_queue
.
emplace_back
(
bb
);
frame
.
billboard_queue
.
back
().
offset
=
position
;
}
...
...
src/mirrage/renderer/src/pass/particle_pass.cpp
View file @
b38fb1db
...
...
@@ -293,7 +293,7 @@ namespace mirrage::renderer {
for
(
auto
i
=
std
::
size_t
(
0
);
i
<
frame
.
particle_queue
.
size
();
i
++
)
{
auto
&
p
=
frame
.
particle_queue
[
i
];
effector_count
+=
p
.
effectors
.
size
();
effector_count
+=
gsl
::
narrow
<
std
::
int32_t
>
(
p
.
effectors
.
size
()
)
;
auto
spawn
=
p
.
emitter
->
spawn
(
_rand
);
if
(
particle_count
+
spawn
>=
max_particles
)
{
...
...
src/mirrage/renderer/src/pass/transparent_pass.cpp
View file @
b38fb1db
...
...
@@ -516,7 +516,7 @@ namespace mirrage::renderer {
{
vk
::
DeviceSize
(
particle
.
emitter
->
particle_offset
())
*
vk
::
DeviceSize
(
sizeof
(
Particle
))});
dpc
.
light_data2
.
w
=
mip_level
;
dpc
.
light_data2
.
w
=
static_cast
<
float
>
(
mip_level
)
;
dpc
.
model
=
glm
::
mat4
(
1
);
if
(
particle
.
type_cfg
->
geometry
==
Particle_geometry
::
billboard
)
{
dpc
.
model
=
glm
::
inverse
(
_renderer
.
global_uniforms
().
view_mat
);
...
...
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