mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Tweak particle effects
This commit is contained in:
parent
0c48efd445
commit
1f2ed53c42
@ -86,5 +86,9 @@ void main() {
|
||||
vec3 color = surf_color;
|
||||
#endif
|
||||
|
||||
<<<<<<< HEAD
|
||||
tgt_color = vec4(color, f_col.a);
|
||||
=======
|
||||
tgt_color = vec4(color, 1.0);
|
||||
>>>>>>> 62119c37a... Tweak particle effects
|
||||
}
|
||||
|
@ -243,13 +243,12 @@ void main() {
|
||||
);
|
||||
} else if (inst_mode == GROUND_SHOCKWAVE) {
|
||||
attr = Attr(
|
||||
linear_motion(
|
||||
vec3(rand0 * 0.25, rand1 * 0.25, 0.0),
|
||||
vec3(rand2 * 0.1, rand3 * 0.1, 0.0)
|
||||
),
|
||||
3.0 + 5.0 * rand5,
|
||||
vec4(vec3(0.42, 0.32, 0.1), 1),
|
||||
spin_in_axis(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
|
||||
vec3(0.0),
|
||||
vec3(1.0, 1.0, (3.0 * rand0 * sin(2.0 * lifetime * 3.14 * 2.0))) / 3,
|
||||
//3.0 + 5.0 * rand5,
|
||||
vec4(vec3(0.32 + (rand0 * 0.04), 0.22 + (rand1 * 0.03), 0.05 + (rand2 * 0.01)), 1),
|
||||
//rotationMatrix(vec3(rand6, rand7, rand8), rand9 * 3 + lifetime * 5)
|
||||
spin_in_axis(vec3(1,0,0),0)
|
||||
);
|
||||
} else {
|
||||
attr = Attr(
|
||||
|
@ -436,27 +436,44 @@ impl ParticleMgr {
|
||||
{
|
||||
let elapsed = time - shockwave.creation.unwrap_or_default();
|
||||
|
||||
let p = shockwave.properties.speed * elapsed as f32;
|
||||
let distance = shockwave.properties.speed * elapsed as f32;
|
||||
|
||||
let radians = shockwave.properties.angle.to_radians();
|
||||
|
||||
let theta = ori.0.y.atan2(ori.0.x);
|
||||
let dtheta = shockwave.properties.angle.to_radians() / p;
|
||||
let dtheta = radians / distance;
|
||||
|
||||
// 1 / 3 the size of terrain voxel
|
||||
let scale = 1.0 / 3.0;
|
||||
|
||||
let freqency_millis = shockwave.properties.speed * scale;
|
||||
|
||||
for heartbeat in 0..self
|
||||
.scheduler
|
||||
.heartbeats(Duration::from_millis(freqency_millis as u64))
|
||||
{
|
||||
let sub_tick_interpolation = freqency_millis * 1000.0 * heartbeat as f32;
|
||||
|
||||
let distance =
|
||||
shockwave.properties.speed * (elapsed as f32 - sub_tick_interpolation);
|
||||
|
||||
for d in 0..((distance / scale) as i32) {
|
||||
let arc_position = (theta - (radians / 2.0)) + (dtheta * d as f32 * scale);
|
||||
|
||||
let position = pos.0
|
||||
+ Vec3::new(
|
||||
distance * arc_position.cos(),
|
||||
distance * arc_position.sin(),
|
||||
0.0,
|
||||
);
|
||||
|
||||
let position_snapped = (position / scale).round() * scale;
|
||||
|
||||
for _ in 0..self.scheduler.heartbeats(Duration::from_millis(10)) {
|
||||
for d in 0..(p as i32) {
|
||||
self.particles.push(Particle::new(
|
||||
Duration::from_millis(250),
|
||||
time,
|
||||
ParticleMode::GroundShockwave,
|
||||
pos.0
|
||||
+ Vec3::new(
|
||||
p * ((theta - (shockwave.properties.angle.to_radians() / 2.0))
|
||||
+ (dtheta * d as f32))
|
||||
.cos(),
|
||||
p * ((theta - (shockwave.properties.angle.to_radians() / 2.0))
|
||||
+ (dtheta * d as f32))
|
||||
.sin(),
|
||||
0.0,
|
||||
),
|
||||
position_snapped,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user