Pointy trails

This commit is contained in:
Sam 2022-02-16 18:33:24 -05:00
parent 855733bdcb
commit f3c5c2b5e3
3 changed files with 15 additions and 6 deletions

View File

@ -49,7 +49,10 @@ impl Animation for AlphaAnimation {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword | ToolKind::Dagger) => {
if matches!(stage_section, Some(StageSection::Action | StageSection::Recover)) {
if matches!(
stage_section,
Some(StageSection::Action | StageSection::Recover)
) {
next.main_weapon_trail = true;
}
next.main.position = Vec3::new(0.0, 0.0, 0.0);

View File

@ -6452,7 +6452,7 @@ impl<S: Skeleton> FigureState<S> {
) {
let weapon_offsets = new_weapon_trail_mat.map(|mat| {
let (trail_start, trail_end) = match tools.0 {
Some(ToolKind::Sword) => (20.25, 29.25),
Some(ToolKind::Sword) => (0.0, 29.25),
// TODO: Make sure these are good positions, only did tweaking on sword
Some(ToolKind::Axe) => (10.0, 19.25),
Some(ToolKind::Hammer) => (10.0, 19.25),

View File

@ -48,12 +48,18 @@ impl TrailMgr {
self.entity_meshes.values_mut().for_each(|mesh| {
// Shrink size of each quad over time
let vertices = mesh.vertices_mut_vec();
let last_offset =
(self.offset + TRAIL_DYNAMIC_MODEL_SIZE - 1) % TRAIL_DYNAMIC_MODEL_SIZE;
let next_offset = (self.offset + 1) % TRAIL_DYNAMIC_MODEL_SIZE;
for i in 0..TRAIL_DYNAMIC_MODEL_SIZE {
// Verts per quad are in b, c, a, d order
vertices[i * 4 + 2] = vertices[i * 4 + 2] * TRAIL_SHRINKAGE
+ vertices[i * 4] * (1.0 - TRAIL_SHRINKAGE);
if i != (self.offset + TRAIL_DYNAMIC_MODEL_SIZE - 1) % TRAIL_DYNAMIC_MODEL_SIZE
{
vertices[i * 4 + 2] = if i == next_offset {
vertices[i * 4]
} else {
vertices[i * 4 + 2] * TRAIL_SHRINKAGE
+ vertices[i * 4] * (1.0 - TRAIL_SHRINKAGE)
};
if i != last_offset {
// Avoid shrinking edge of most recent quad so that edges of quads align
vertices[i * 4 + 3] = vertices[i * 4 + 3] * TRAIL_SHRINKAGE
+ vertices[i * 4 + 1] * (1.0 - TRAIL_SHRINKAGE);