Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Courses
Scotty3D
Commits
afa3f68f
Commit
afa3f68f
authored
May 04, 2021
by
TheNumbat
Browse files
fix 0 particle/s
parent
59ff78b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/scene/particles.cpp
View file @
afa3f68f
...
@@ -121,28 +121,31 @@ void Scene_Particles::step(const PT::BVH<PT::Object>& scene, float dt) {
...
@@ -121,28 +121,31 @@ void Scene_Particles::step(const PT::BVH<PT::Object>& scene, float dt) {
float
cos
=
std
::
cos
(
Radians
(
opt
.
angle
)
/
2.0
f
);
float
cos
=
std
::
cos
(
Radians
(
opt
.
angle
)
/
2.0
f
);
double
cooldown
=
1.0
/
opt
.
pps
;
if
(
opt
.
pps
>
0.0
f
)
{
while
(
particle_cooldown
<=
0.0
f
)
{
double
cooldown
=
1.0
/
opt
.
pps
;
while
(
particle_cooldown
<=
0.0
f
)
{
float
z
=
lerp
(
cos
,
1.0
f
,
RNG
::
unit
());
float
z
=
lerp
(
cos
,
1.0
f
,
RNG
::
unit
());
float
t
=
2
*
PI_F
*
RNG
::
unit
();
float
t
=
2
*
PI_F
*
RNG
::
unit
();
float
r
=
std
::
sqrt
(
1
-
z
*
z
);
float
r
=
std
::
sqrt
(
1
-
z
*
z
);
Vec3
dir
=
opt
.
velocity
*
Vec3
(
r
*
std
::
cos
(
t
),
z
,
r
*
std
::
sin
(
t
));
Vec3
dir
=
opt
.
velocity
*
Vec3
(
r
*
std
::
cos
(
t
),
z
,
r
*
std
::
sin
(
t
));
Particle
p
;
Particle
p
;
p
.
pos
=
pose
.
pos
;
p
.
pos
=
pose
.
pos
;
p
.
velocity
=
pose
.
rotation_mat
().
rotate
(
dir
);
p
.
velocity
=
pose
.
rotation_mat
().
rotate
(
dir
);
p
.
age
=
opt
.
lifetime
;
p
.
age
=
opt
.
lifetime
;
next
.
push_back
(
p
);
next
.
push_back
(
p
);
Mat4
T
=
Mat4
{
Vec4
{
S
,
0.0
f
,
0.0
f
,
0.0
f
},
Vec4
{
0.0
f
,
S
,
0.0
f
,
0.0
f
},
Mat4
T
=
Mat4
{
Vec4
{
S
,
0.0
f
,
0.0
f
,
0.0
f
},
Vec4
{
0.0
f
,
S
,
0.0
f
,
0.0
f
},
Vec4
{
0.0
f
,
0.0
f
,
S
,
0.0
f
},
Vec4
{
p
.
pos
,
1.0
f
}};
Vec4
{
0.0
f
,
0.0
f
,
S
,
0.0
f
},
Vec4
{
p
.
pos
,
1.0
f
}};
particle_instances
.
add
(
T
);
particle_instances
.
add
(
T
);
particle_cooldown
+=
cooldown
;
}
particle_cooldown
+
=
cooldown
;
particle_cooldown
-
=
dt
;
}
}
particle_cooldown
-=
dt
;
particles
=
std
::
move
(
next
);
particles
=
std
::
move
(
next
);
}
}
...
...
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