diff --git a/assets/voxygen/voxel/npc/cardinalfish/tail.vox b/assets/voxygen/voxel/npc/cardinalfish/tail.vox new file mode 100644 index 0000000000..c58fe81db3 --- /dev/null +++ b/assets/voxygen/voxel/npc/cardinalfish/tail.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2d294e515c61b0bce7eb81609e611b24a89d4543a81328cee03b41f22b86980 +size 1320 diff --git a/assets/voxygen/voxel/npc/cardinalfish/torso.vox b/assets/voxygen/voxel/npc/cardinalfish/torso.vox new file mode 100644 index 0000000000..b9ce93fc17 --- /dev/null +++ b/assets/voxygen/voxel/npc/cardinalfish/torso.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f36f0d362133bfaf0a04262abc05d0acbe34949f0b202c5c676fa33adb0fe553 +size 2100 diff --git a/assets/voxygen/voxel/npc/crow/head.vox b/assets/voxygen/voxel/npc/crow/head.vox new file mode 100644 index 0000000000..f14dcf709f --- /dev/null +++ b/assets/voxygen/voxel/npc/crow/head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c427b188ca4275197e9dc80716a0b67d66327d1a095d22ba9333e806c3bb18b +size 1420 diff --git a/assets/voxygen/voxel/npc/crow/torso.vox b/assets/voxygen/voxel/npc/crow/torso.vox new file mode 100644 index 0000000000..c7fc172c57 --- /dev/null +++ b/assets/voxygen/voxel/npc/crow/torso.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c7174b3c97e19dbbd5c5fe5495841e1a0ad0ea2f7ac249440df8ea5d0950beb +size 2900 diff --git a/assets/voxygen/voxel/npc/crow/wing_l.vox b/assets/voxygen/voxel/npc/crow/wing_l.vox new file mode 100644 index 0000000000..757d9ba333 --- /dev/null +++ b/assets/voxygen/voxel/npc/crow/wing_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f5e5670531fabc51dc1f5578c555ee96b2ec19b71df51b662685ed92935ccc2 +size 1292 diff --git a/assets/voxygen/voxel/npc/crow/wing_r.vox b/assets/voxygen/voxel/npc/crow/wing_r.vox new file mode 100644 index 0000000000..757d9ba333 --- /dev/null +++ b/assets/voxygen/voxel/npc/crow/wing_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f5e5670531fabc51dc1f5578c555ee96b2ec19b71df51b662685ed92935ccc2 +size 1292 diff --git a/assets/voxygen/voxel/npc/dragon/chest_front.vox b/assets/voxygen/voxel/npc/dragon/chest_front.vox new file mode 100644 index 0000000000..5385ca652f --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/chest_front.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ccb3946a7b70bbe3bbca76b0930651b1fafb6f10cf466d730dc838a8dd900102 +size 4556 diff --git a/assets/voxygen/voxel/npc/dragon/chest_rear.vox b/assets/voxygen/voxel/npc/dragon/chest_rear.vox new file mode 100644 index 0000000000..03c2c36ca0 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/chest_rear.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5d9f4fa579f6456f4a642f94d6388074422858d7c4053e339e253bb0b86f888 +size 6080 diff --git a/assets/voxygen/voxel/npc/dragon/foot_bl.vox b/assets/voxygen/voxel/npc/dragon/foot_bl.vox new file mode 100644 index 0000000000..d9ad85b152 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/foot_bl.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3392c489527b685662705bdba578d8f2f12788c00a881885edd45505f741124 +size 1408 diff --git a/assets/voxygen/voxel/npc/dragon/foot_br.vox b/assets/voxygen/voxel/npc/dragon/foot_br.vox new file mode 100644 index 0000000000..5f3d81ec51 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/foot_br.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff5cc1eac6b2939d3658e21228f87366327665ae70dd83d5af92ac3b3dae0fb4 +size 1408 diff --git a/assets/voxygen/voxel/npc/dragon/foot_fl.vox b/assets/voxygen/voxel/npc/dragon/foot_fl.vox new file mode 100644 index 0000000000..f1e67b65c8 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/foot_fl.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed4cb29ddba38424eb238ce2c3df7ea9b67d2e3b4f902194588f67a41f759b89 +size 1408 diff --git a/assets/voxygen/voxel/npc/dragon/foot_fr.vox b/assets/voxygen/voxel/npc/dragon/foot_fr.vox new file mode 100644 index 0000000000..03497e9382 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/foot_fr.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a5b309ae1146a4a5dab72e7bd534201b9ccbddcdc512d0a5619e4ef6880eefa +size 1408 diff --git a/assets/voxygen/voxel/npc/dragon/head.vox b/assets/voxygen/voxel/npc/dragon/head.vox new file mode 100644 index 0000000000..d27c554eac --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3c6dcc28719e148e572786722426103d4e4e7af05b815e8328ee71515db813a +size 3040 diff --git a/assets/voxygen/voxel/npc/dragon/tail_front.vox b/assets/voxygen/voxel/npc/dragon/tail_front.vox new file mode 100644 index 0000000000..27a01ab209 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/tail_front.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da84212d78276b933a4b374c7b038d0ca5026c5be0d14a0dc93cb3fe15771d0c +size 1784 diff --git a/assets/voxygen/voxel/npc/dragon/tail_rear.vox b/assets/voxygen/voxel/npc/dragon/tail_rear.vox new file mode 100644 index 0000000000..41d539f783 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/tail_rear.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26867c50e937a64890489706c33fe8b06d43138ff134c7fdaf165128ef24c470 +size 1392 diff --git a/assets/voxygen/voxel/npc/dragon/wing_in_l.vox b/assets/voxygen/voxel/npc/dragon/wing_in_l.vox new file mode 100644 index 0000000000..217aa90fa2 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/wing_in_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71a8f3a854354946d80fd9c90839ac67549508c490ae342c8d5a9dc4b1f5ff6b +size 2884 diff --git a/assets/voxygen/voxel/npc/dragon/wing_in_r.vox b/assets/voxygen/voxel/npc/dragon/wing_in_r.vox new file mode 100644 index 0000000000..9ca1b76e22 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/wing_in_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ddbdc71bb337dc45b4d32e2f3d9a11845e198ac17215e09ace38638a2c567b44 +size 2884 diff --git a/assets/voxygen/voxel/npc/dragon/wing_out_l.vox b/assets/voxygen/voxel/npc/dragon/wing_out_l.vox new file mode 100644 index 0000000000..2f54e5758a --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/wing_out_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6bcab7b445899e1f24d7f61b468782612a79b36636786975b00a33e1ad266ab6 +size 3544 diff --git a/assets/voxygen/voxel/npc/dragon/wing_out_r.vox b/assets/voxygen/voxel/npc/dragon/wing_out_r.vox new file mode 100644 index 0000000000..960761f385 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/wing_out_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c076249b9a357865e20f146b54fbfa4f2a7e82c3542fec09c99467d691ea5de +size 3544 diff --git a/assets/voxygen/voxel/npc/duck_m/body.vox b/assets/voxygen/voxel/npc/duck_m/body.vox new file mode 100644 index 0000000000..19a3ba1a3b --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/body.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:695d8f719c5bb550643cf3e276cc984ee0953e35cba3da7a0d17bce9b3b8f2dd +size 56063 diff --git a/assets/voxygen/voxel/npc/duck_m/head.vox b/assets/voxygen/voxel/npc/duck_m/head.vox new file mode 100644 index 0000000000..466c83223b --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8c1abcecd2c0cc979d2babe83d3797949a986dab1580f50097b08ebe919a190 +size 55703 diff --git a/assets/voxygen/voxel/npc/duck_m/leg_l.vox b/assets/voxygen/voxel/npc/duck_m/leg_l.vox new file mode 100644 index 0000000000..515df8f571 --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/leg_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:804f7a03dae44eaf54e36c424b7ec00b2c345f8d9f5326f7769ee01aca65a6cb +size 55615 diff --git a/assets/voxygen/voxel/npc/duck_m/leg_r.vox b/assets/voxygen/voxel/npc/duck_m/leg_r.vox new file mode 100644 index 0000000000..0257a695e9 --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/leg_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60ff0228f74dae0a6c0b7624b031e38032f473fe40c8bf28a3e71144e64ae4cf +size 55615 diff --git a/assets/voxygen/voxel/npc/duck_m/tail.vox b/assets/voxygen/voxel/npc/duck_m/tail.vox new file mode 100644 index 0000000000..62d1a47a18 --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/tail.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29b27c5210140ece6e914c356b7c92e2cdf118c46a520ee06ec21be6490c988e +size 55643 diff --git a/assets/voxygen/voxel/npc/duck_m/wing.vox b/assets/voxygen/voxel/npc/duck_m/wing.vox new file mode 100644 index 0000000000..afea120592 --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/wing.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ed2820afb08af1175ddad78a2a429d57cb9c951abdc0f1215498fd89ba59784 +size 55631 diff --git a/assets/voxygen/voxel/npc/knight/foot_l.vox b/assets/voxygen/voxel/npc/knight/foot_l.vox new file mode 100644 index 0000000000..d5946e40ed --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/foot_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ef4829618aa75b7d87bf608eb06c761f03f798912982e2edf971a2999531be8 +size 1388 diff --git a/assets/voxygen/voxel/npc/knight/foot_r.vox b/assets/voxygen/voxel/npc/knight/foot_r.vox new file mode 100644 index 0000000000..83361e2b9e --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/foot_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:634d800724de41dd2755f3c066aa748797aff5c299c620651d736e2a8095772e +size 1388 diff --git a/assets/voxygen/voxel/npc/knight/hand_l.vox b/assets/voxygen/voxel/npc/knight/hand_l.vox new file mode 100644 index 0000000000..d6fb9a604e --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/hand_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:392002386275e85e7fcc9d2174baf9da9d6df8e40818b0aee184c191dfe736a5 +size 1440 diff --git a/assets/voxygen/voxel/npc/knight/hand_r.vox b/assets/voxygen/voxel/npc/knight/hand_r.vox new file mode 100644 index 0000000000..7f297f3cd8 --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/hand_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9257231eac4887eec381a900b743b0b02fae1d626146767b79042c3b6ee135a +size 1432 diff --git a/assets/voxygen/voxel/npc/knight/head.vox b/assets/voxygen/voxel/npc/knight/head.vox new file mode 100644 index 0000000000..70f7667c63 --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4432921d3f584bdcdf5ea47bb89771532bdaa43a0c2bc65d6ba10f61e7a2f123 +size 3524 diff --git a/assets/voxygen/voxel/npc/knight/leg_l.vox b/assets/voxygen/voxel/npc/knight/leg_l.vox new file mode 100644 index 0000000000..8f200e1f5a --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/leg_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b183b026fdee036061550b9b7fa790e5921ae19a7355b1ff6e478f8a2cdfa489 +size 1776 diff --git a/assets/voxygen/voxel/npc/knight/leg_r.vox b/assets/voxygen/voxel/npc/knight/leg_r.vox new file mode 100644 index 0000000000..c60d410e74 --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/leg_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60563e0e3cf012f3da6f3d5069fd3450cf73c7273b3e2ac55082daa5bc1b0f8b +size 1776 diff --git a/assets/voxygen/voxel/npc/knight/lower_torso.vox b/assets/voxygen/voxel/npc/knight/lower_torso.vox new file mode 100644 index 0000000000..e04193bc0b --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/lower_torso.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a9f2658e6da77d24671ea4375f24703714b1d9ed0d6e035dbddefe4fc595393 +size 4260 diff --git a/assets/voxygen/voxel/npc/knight/shoulder_l.vox b/assets/voxygen/voxel/npc/knight/shoulder_l.vox new file mode 100644 index 0000000000..f227e0e4db --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/shoulder_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11e0fcaef237348c3a7d2375f3714d62ee9e0f707a189612f600eac506dffc3e +size 1748 diff --git a/assets/voxygen/voxel/npc/knight/shoulder_r.vox b/assets/voxygen/voxel/npc/knight/shoulder_r.vox new file mode 100644 index 0000000000..624d5be848 --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/shoulder_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f03637a6b4574d0554473e9d971a595ba09053d732beea48d03388c613b558c +size 1748 diff --git a/assets/voxygen/voxel/npc/knight/torso_upper.vox b/assets/voxygen/voxel/npc/knight/torso_upper.vox new file mode 100644 index 0000000000..e4ada8306d --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/torso_upper.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07437596c5a7947da998b5bb53bc87ab4e3bfb4d9f94c1202bf60b8736b67c5c +size 6832 diff --git a/assets/voxygen/voxel/npc/marlin/fin_l.vox b/assets/voxygen/voxel/npc/marlin/fin_l.vox new file mode 100644 index 0000000000..4b6f517af8 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/fin_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80b0d57ec40c04bad6207cbd2443126cf731898df1f2586b26806c426c46ff5e +size 1152 diff --git a/assets/voxygen/voxel/npc/marlin/fin_r.vox b/assets/voxygen/voxel/npc/marlin/fin_r.vox new file mode 100644 index 0000000000..d208e485aa --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/fin_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aef2d194365db70e6a30551071f361863fad2f6c6a768f8c3368982363cdcdd6 +size 1152 diff --git a/assets/voxygen/voxel/npc/marlin/head.vox b/assets/voxygen/voxel/npc/marlin/head.vox new file mode 100644 index 0000000000..45a31f5b69 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcbe6707a2278ebd4828998b58d9fa69c2eba15b3b31f11de2e9104a9b59c1eb +size 1352 diff --git a/assets/voxygen/voxel/npc/marlin/rear.vox b/assets/voxygen/voxel/npc/marlin/rear.vox new file mode 100644 index 0000000000..ab15e4fc13 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/rear.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dea03905c68b83f25f5196393ca8d06196b5a35eed0b12be61aa6bcfc8d5e081 +size 1360 diff --git a/assets/voxygen/voxel/npc/marlin/tail.vox b/assets/voxygen/voxel/npc/marlin/tail.vox new file mode 100644 index 0000000000..30a1696564 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/tail.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e55b9da2a45123b3109b763d741b550a11f274fc2563c4e54df17da389426c8 +size 1308 diff --git a/assets/voxygen/voxel/npc/marlin/torso.vox b/assets/voxygen/voxel/npc/marlin/torso.vox new file mode 100644 index 0000000000..1c0219ac08 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/torso.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0398753b0ff2719940aa1e2f20430892ebee6b7da26b61d8b16dad5d826655a +size 1476 diff --git a/assets/voxygen/voxel/npc/pig_purple/pig_chest.vox b/assets/voxygen/voxel/npc/pig_purple/chest.vox similarity index 100% rename from assets/voxygen/voxel/npc/pig_purple/pig_chest.vox rename to assets/voxygen/voxel/npc/pig_purple/chest.vox diff --git a/assets/voxygen/voxel/npc/pig_purple/pig_head.vox b/assets/voxygen/voxel/npc/pig_purple/head.vox similarity index 100% rename from assets/voxygen/voxel/npc/pig_purple/pig_head.vox rename to assets/voxygen/voxel/npc/pig_purple/head.vox diff --git a/assets/voxygen/voxel/npc/pig_purple/pig_leg_l.vox b/assets/voxygen/voxel/npc/pig_purple/leg_l.vox similarity index 100% rename from assets/voxygen/voxel/npc/pig_purple/pig_leg_l.vox rename to assets/voxygen/voxel/npc/pig_purple/leg_l.vox diff --git a/assets/voxygen/voxel/npc/pig_purple/pig_leg_r.vox b/assets/voxygen/voxel/npc/pig_purple/leg_r.vox similarity index 100% rename from assets/voxygen/voxel/npc/pig_purple/pig_leg_r.vox rename to assets/voxygen/voxel/npc/pig_purple/leg_r.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_ears.vox b/assets/voxygen/voxel/npc/wolf/ears.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_ears.vox rename to assets/voxygen/voxel/npc/wolf/ears.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_foot_lb.vox b/assets/voxygen/voxel/npc/wolf/foot_lb.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_foot_lb.vox rename to assets/voxygen/voxel/npc/wolf/foot_lb.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_foot_lf.vox b/assets/voxygen/voxel/npc/wolf/foot_lf.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_foot_lf.vox rename to assets/voxygen/voxel/npc/wolf/foot_lf.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_foot_rb.vox b/assets/voxygen/voxel/npc/wolf/foot_rb.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_foot_rb.vox rename to assets/voxygen/voxel/npc/wolf/foot_rb.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_foot_rf.vox b/assets/voxygen/voxel/npc/wolf/foot_rf.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_foot_rf.vox rename to assets/voxygen/voxel/npc/wolf/foot_rf.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_head_lower.vox b/assets/voxygen/voxel/npc/wolf/head_lower.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_head_lower.vox rename to assets/voxygen/voxel/npc/wolf/head_lower.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_head_upper.vox b/assets/voxygen/voxel/npc/wolf/head_upper.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_head_upper.vox rename to assets/voxygen/voxel/npc/wolf/head_upper.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_jaw.vox b/assets/voxygen/voxel/npc/wolf/jaw.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_jaw.vox rename to assets/voxygen/voxel/npc/wolf/jaw.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_tail.vox b/assets/voxygen/voxel/npc/wolf/tail.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_tail.vox rename to assets/voxygen/voxel/npc/wolf/tail.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_torso_back.vox b/assets/voxygen/voxel/npc/wolf/torso_back.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_torso_back.vox rename to assets/voxygen/voxel/npc/wolf/torso_back.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_torso_mid.vox b/assets/voxygen/voxel/npc/wolf/torso_mid.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_torso_mid.vox rename to assets/voxygen/voxel/npc/wolf/torso_mid.vox diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 2ac56c58b1..b2ba589b24 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -1,7 +1,13 @@ +pub mod biped_large; +pub mod bird_medium; +pub mod bird_small; +pub mod dragon; +pub mod fish_medium; +pub mod fish_small; pub mod humanoid; pub mod object; -pub mod quadruped; pub mod quadruped_medium; +pub mod quadruped_small; use specs::{Component, FlaggedStorage}; use specs_idvs::IDVStorage; @@ -9,8 +15,14 @@ use specs_idvs::IDVStorage; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum Body { Humanoid(humanoid::Body), - Quadruped(quadruped::Body), + QuadrupedSmall(quadruped_small::Body), QuadrupedMedium(quadruped_medium::Body), + BirdMedium(bird_medium::Body), + FishMedium(fish_medium::Body), + Dragon(dragon::Body), + BirdSmall(bird_small::Body), + FishSmall(fish_small::Body), + BipedLarge(biped_large::Body), Object(object::Body), } diff --git a/common/src/comp/body/biped_large.rs b/common/src/comp/body/biped_large.rs new file mode 100644 index 0000000000..9e9dc2a3cf --- /dev/null +++ b/common/src/comp/body/biped_large.rs @@ -0,0 +1,100 @@ +use rand::{seq::SliceRandom, thread_rng}; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct Body { + pub head: Head, + pub upper_torso: UpperTorso, + pub lower_torso: LowerTorso, + pub shoulder_l: ShoulderL, + pub shoulder_r: ShoulderR, + pub hand_l: HandL, + pub hand_r: HandR, + pub leg_l: LegL, + pub leg_r: LegR, + pub foot_l: FootL, + pub foot_r: FootR, +} +impl Body { + pub fn random() -> Self { + let mut rng = thread_rng(); + Self { + head: *(&ALL_HEADS).choose(&mut rng).unwrap(), + upper_torso: *(&ALL_UPPER_TORSOS).choose(&mut rng).unwrap(), + lower_torso: *(&ALL_LOWER_TORSOS).choose(&mut rng).unwrap(), + shoulder_l: *(&ALL_SHOULDER_LS).choose(&mut rng).unwrap(), + shoulder_r: *(&ALL_SHOULDER_RS).choose(&mut rng).unwrap(), + hand_l: *(&ALL_HAND_LS).choose(&mut rng).unwrap(), + hand_r: *(&ALL_HAND_RS).choose(&mut rng).unwrap(), + leg_l: *(&ALL_LEG_LS).choose(&mut rng).unwrap(), + leg_r: *(&ALL_LEG_RS).choose(&mut rng).unwrap(), + foot_l: *(&ALL_FOOT_LS).choose(&mut rng).unwrap(), + foot_r: *(&ALL_FOOT_RS).choose(&mut rng).unwrap(), + } + } +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Head { + Default, +} +const ALL_HEADS: [Head; 1] = [Head::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum UpperTorso { + Default, +} +const ALL_UPPER_TORSOS: [UpperTorso; 1] = [UpperTorso::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum LowerTorso { + Default, +} +const ALL_LOWER_TORSOS: [LowerTorso; 1] = [LowerTorso::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ShoulderL { + Default, +} +const ALL_SHOULDER_LS: [ShoulderL; 1] = [ShoulderL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ShoulderR { + Default, +} +const ALL_SHOULDER_RS: [ShoulderR; 1] = [ShoulderR::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum HandL { + Default, +} +const ALL_HAND_LS: [HandL; 1] = [HandL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum HandR { + Default, +} +const ALL_HAND_RS: [HandR; 1] = [HandR::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum LegL { + Default, +} +const ALL_LEG_LS: [LegL; 1] = [LegL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum LegR { + Default, +} +const ALL_LEG_RS: [LegR; 1] = [LegR::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum FootL { + Default, +} +const ALL_FOOT_LS: [FootL; 1] = [FootL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum FootR { + Default, +} +const ALL_FOOT_RS: [FootR; 1] = [FootR::Default]; diff --git a/common/src/comp/body/bird_medium.rs b/common/src/comp/body/bird_medium.rs new file mode 100644 index 0000000000..6968b2d2a5 --- /dev/null +++ b/common/src/comp/body/bird_medium.rs @@ -0,0 +1,68 @@ +use rand::{seq::SliceRandom, thread_rng}; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct Body { + pub head: Head, + pub torso: Torso, + pub tail: Tail, + pub wing_l: WingL, + pub wing_r: WingR, + pub leg_l: LegL, + pub leg_r: LegR, +} +impl Body { + pub fn random() -> Self { + let mut rng = thread_rng(); + Self { + head: *(&ALL_HEADS).choose(&mut rng).unwrap(), + torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(), + tail: *(&ALL_TAILS).choose(&mut rng).unwrap(), + wing_l: *(&ALL_WING_LS).choose(&mut rng).unwrap(), + wing_r: *(&ALL_WING_RS).choose(&mut rng).unwrap(), + leg_l: *(&ALL_LEG_LS).choose(&mut rng).unwrap(), + leg_r: *(&ALL_LEG_RS).choose(&mut rng).unwrap(), + } + } +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Head { + Default, +} +const ALL_HEADS: [Head; 1] = [Head::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Torso { + Default, +} +const ALL_TORSOS: [Torso; 1] = [Torso::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Tail { + Default, +} +const ALL_TAILS: [Tail; 1] = [Tail::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum WingL { + Default, +} +const ALL_WING_LS: [WingL; 1] = [WingL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum WingR { + Default, +} +const ALL_WING_RS: [WingR; 1] = [WingR::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum LegL { + Default, +} +const ALL_LEG_LS: [LegL; 1] = [LegL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum LegR { + Default, +} +const ALL_LEG_RS: [LegR; 1] = [LegR::Default]; diff --git a/common/src/comp/body/bird_small.rs b/common/src/comp/body/bird_small.rs new file mode 100644 index 0000000000..533613fe3a --- /dev/null +++ b/common/src/comp/body/bird_small.rs @@ -0,0 +1,44 @@ +use rand::{seq::SliceRandom, thread_rng}; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct Body { + pub head: Head, + pub torso: Torso, + pub wing_l: WingL, + pub wing_r: WingR, +} +impl Body { + pub fn random() -> Self { + let mut rng = thread_rng(); + Self { + head: *(&ALL_HEADS).choose(&mut rng).unwrap(), + torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(), + wing_l: *(&ALL_WING_LS).choose(&mut rng).unwrap(), + wing_r: *(&ALL_WING_RS).choose(&mut rng).unwrap(), + } + } +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Head { + Default, +} +const ALL_HEADS: [Head; 1] = [Head::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Torso { + Default, +} +const ALL_TORSOS: [Torso; 1] = [Torso::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum WingL { + Default, +} +const ALL_WING_LS: [WingL; 1] = [WingL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum WingR { + Default, +} +const ALL_WING_RS: [WingR; 1] = [WingR::Default]; diff --git a/common/src/comp/body/dragon.rs b/common/src/comp/body/dragon.rs new file mode 100644 index 0000000000..1b777d5aa4 --- /dev/null +++ b/common/src/comp/body/dragon.rs @@ -0,0 +1,116 @@ +use rand::{seq::SliceRandom, thread_rng}; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct Body { + pub head: Head, + pub chest_front: ChestFront, + pub chest_rear: ChestRear, + pub tail_front: TailFront, + pub tail_rear: TailRear, + pub wing_in_l: WingInL, + pub wing_in_r: WingInR, + pub wing_out_l: WingOutL, + pub wing_out_r: WingOutR, + pub foot_fl: FootFL, + pub foot_fr: FootFR, + pub foot_bl: FootBL, + pub foot_br: FootBR, +} +impl Body { + pub fn random() -> Self { + let mut rng = thread_rng(); + Self { + head: *(&ALL_HEADS).choose(&mut rng).unwrap(), + chest_front: *(&ALL_CHEST_FRONTS).choose(&mut rng).unwrap(), + chest_rear: *(&ALL_CHEST_REARS).choose(&mut rng).unwrap(), + tail_front: *(&ALL_TAIL_FRONTS).choose(&mut rng).unwrap(), + tail_rear: *(&ALL_TAIL_REARS).choose(&mut rng).unwrap(), + wing_in_l: *(&ALL_WING_IN_LS).choose(&mut rng).unwrap(), + wing_in_r: *(&ALL_WING_IN_RS).choose(&mut rng).unwrap(), + wing_out_l: *(&ALL_WING_OUT_LS).choose(&mut rng).unwrap(), + wing_out_r: *(&ALL_WING_OUT_RS).choose(&mut rng).unwrap(), + foot_fl: *(&ALL_FOOT_FLS).choose(&mut rng).unwrap(), + foot_fr: *(&ALL_FOOT_FRS).choose(&mut rng).unwrap(), + foot_bl: *(&ALL_FOOT_BLS).choose(&mut rng).unwrap(), + foot_br: *(&ALL_FOOT_BRS).choose(&mut rng).unwrap(), + } + } +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Head { + Default, +} +const ALL_HEADS: [Head; 1] = [Head::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ChestFront { + Default, +} +const ALL_CHEST_FRONTS: [ChestFront; 1] = [ChestFront::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum ChestRear { + Default, +} +const ALL_CHEST_REARS: [ChestRear; 1] = [ChestRear::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum TailFront { + Default, +} +const ALL_TAIL_FRONTS: [TailFront; 1] = [TailFront::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum TailRear { + Default, +} +const ALL_TAIL_REARS: [TailRear; 1] = [TailRear::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum WingInL { + Default, +} +const ALL_WING_IN_LS: [WingInL; 1] = [WingInL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum WingInR { + Default, +} +const ALL_WING_IN_RS: [WingInR; 1] = [WingInR::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum WingOutL { + Default, +} +const ALL_WING_OUT_LS: [WingOutL; 1] = [WingOutL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum WingOutR { + Default, +} +const ALL_WING_OUT_RS: [WingOutR; 1] = [WingOutR::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum FootFL { + Default, +} +const ALL_FOOT_FLS: [FootFL; 1] = [FootFL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum FootFR { + Default, +} +const ALL_FOOT_FRS: [FootFR; 1] = [FootFR::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum FootBL { + Default, +} +const ALL_FOOT_BLS: [FootBL; 1] = [FootBL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum FootBR { + Default, +} +const ALL_FOOT_BRS: [FootBR; 1] = [FootBR::Default]; diff --git a/common/src/comp/body/fish_medium.rs b/common/src/comp/body/fish_medium.rs new file mode 100644 index 0000000000..6d1c92a5f3 --- /dev/null +++ b/common/src/comp/body/fish_medium.rs @@ -0,0 +1,60 @@ +use rand::{seq::SliceRandom, thread_rng}; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct Body { + pub head: Head, + pub torso: Torso, + pub rear: Rear, + pub tail: Tail, + pub fin_l: FinL, + pub fin_r: FinR, +} +impl Body { + pub fn random() -> Self { + let mut rng = thread_rng(); + Self { + head: *(&ALL_HEADS).choose(&mut rng).unwrap(), + torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(), + rear: *(&ALL_REARS).choose(&mut rng).unwrap(), + tail: *(&ALL_TAILS).choose(&mut rng).unwrap(), + fin_l: *(&ALL_FIN_LS).choose(&mut rng).unwrap(), + fin_r: *(&ALL_FIN_RS).choose(&mut rng).unwrap(), + } + } +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Head { + Default, +} +const ALL_HEADS: [Head; 1] = [Head::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Torso { + Default, +} +const ALL_TORSOS: [Torso; 1] = [Torso::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Rear { + Default, +} +const ALL_REARS: [Rear; 1] = [Rear::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Tail { + Default, +} +const ALL_TAILS: [Tail; 1] = [Tail::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum FinL { + Default, +} +const ALL_FIN_LS: [FinL; 1] = [FinL::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum FinR { + Default, +} +const ALL_FIN_RS: [FinR; 1] = [FinR::Default]; diff --git a/common/src/comp/body/fish_small.rs b/common/src/comp/body/fish_small.rs new file mode 100644 index 0000000000..6d0150de43 --- /dev/null +++ b/common/src/comp/body/fish_small.rs @@ -0,0 +1,28 @@ +use rand::{seq::SliceRandom, thread_rng}; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub struct Body { + pub torso: Torso, + pub tail: Tail, +} +impl Body { + pub fn random() -> Self { + let mut rng = thread_rng(); + Self { + torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(), + tail: *(&ALL_TAILS).choose(&mut rng).unwrap(), + } + } +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Torso { + Default, +} +const ALL_TORSOS: [Torso; 1] = [Torso::Default]; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Tail { + Default, +} +const ALL_TAILS: [Tail; 1] = [Tail::Default]; diff --git a/common/src/comp/body/quadruped.rs b/common/src/comp/body/quadruped_small.rs similarity index 100% rename from common/src/comp/body/quadruped.rs rename to common/src/comp/body/quadruped_small.rs diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index d79fb41ae7..fa13636e02 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -16,7 +16,10 @@ mod visual; // Reexports pub use admin::Admin; pub use agent::Agent; -pub use body::{humanoid, object, quadruped, quadruped_medium, Body}; +pub use body::{ + biped_large, bird_medium, bird_small, dragon, fish_medium, fish_small, humanoid, object, + quadruped_medium, quadruped_small, Body, +}; pub use character_state::{ActionState, CharacterState, MovementState}; pub use controller::{ ControlEvent, Controller, ControllerInputs, InventoryManip, MountState, Mounting, diff --git a/common/src/npc.rs b/common/src/npc.rs index 3f95c17cca..0c0ebe25d5 100644 --- a/common/src/npc.rs +++ b/common/src/npc.rs @@ -30,6 +30,7 @@ impl FromStr for NpcKind { "humanoid" => Ok(NpcKind::Humanoid), "wolf" => Ok(NpcKind::Wolf), "pig" => Ok(NpcKind::Pig), + _ => Err(()), } } diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 0b967a36db..7f8bf53b55 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -553,7 +553,7 @@ fn alignment_to_agent(alignment: &str, target: EcsEntity) -> Option fn kind_to_body(kind: NpcKind) -> comp::Body { match kind { NpcKind::Humanoid => comp::Body::Humanoid(comp::humanoid::Body::random()), - NpcKind::Pig => comp::Body::Quadruped(comp::quadruped::Body::random()), + NpcKind::Pig => comp::Body::QuadrupedSmall(comp::quadruped_small::Body::random()), NpcKind::Wolf => comp::Body::QuadrupedMedium(comp::quadruped_medium::Body::random()), } } diff --git a/voxygen/src/anim/biped_large/idle.rs b/voxygen/src/anim/biped_large/idle.rs new file mode 100644 index 0000000000..1bae88481e --- /dev/null +++ b/voxygen/src/anim/biped_large/idle.rs @@ -0,0 +1,68 @@ +use super::{ + super::{Animation, SkeletonAttr}, + BipedLargeSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct IdleAnimation; + +impl Animation for IdleAnimation { + type Skeleton = BipedLargeSkeleton; + type Dependency = (f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.upper_torso.scale = Vec3::one() / 10.88; + + next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.lower_torso.scale = Vec3::one() / 10.88; + + next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.shoulder_l.scale = Vec3::one() / 10.88; + + next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.shoulder_r.scale = Vec3::one() / 10.88; + + next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.hand_l.scale = Vec3::one() / 10.88; + + next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.hand_r.scale = Vec3::one() / 10.88; + + next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.leg_l.scale = Vec3::one() / 10.88; + + next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.leg_r.scale = Vec3::one() / 10.88; + + next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.foot_l.scale = Vec3::one() / 10.88; + + next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.foot_r.scale = Vec3::one() / 10.88; + next + } +} diff --git a/voxygen/src/anim/biped_large/jump.rs b/voxygen/src/anim/biped_large/jump.rs new file mode 100644 index 0000000000..0494cf0bb8 --- /dev/null +++ b/voxygen/src/anim/biped_large/jump.rs @@ -0,0 +1,68 @@ +use super::{ + super::{Animation, SkeletonAttr}, + BipedLargeSkeleton, +}; +//use std::f32::consts::PI; +use vek::*; + +pub struct JumpAnimation; + +impl Animation for JumpAnimation { + type Skeleton = BipedLargeSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.upper_torso.scale = Vec3::one() / 10.88; + + next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.lower_torso.scale = Vec3::one() / 10.88; + + next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.shoulder_l.scale = Vec3::one() / 10.88; + + next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.shoulder_r.scale = Vec3::one() / 10.88; + + next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.hand_l.scale = Vec3::one() / 10.88; + + next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.hand_r.scale = Vec3::one() / 10.88; + + next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.leg_l.scale = Vec3::one() / 10.88; + + next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.leg_r.scale = Vec3::one() / 10.88; + + next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.foot_l.scale = Vec3::one() / 10.88; + + next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.foot_r.scale = Vec3::one() / 10.88; + next + } +} diff --git a/voxygen/src/anim/biped_large/mod.rs b/voxygen/src/anim/biped_large/mod.rs new file mode 100644 index 0000000000..b1bc01d4ce --- /dev/null +++ b/voxygen/src/anim/biped_large/mod.rs @@ -0,0 +1,91 @@ +pub mod idle; +pub mod jump; +pub mod run; + +// Reexports +pub use self::idle::IdleAnimation; +pub use self::jump::JumpAnimation; +pub use self::run::RunAnimation; + +use super::{Bone, Skeleton}; +use crate::render::FigureBoneData; + +#[derive(Clone)] +pub struct BipedLargeSkeleton { + head: Bone, + upper_torso: Bone, + lower_torso: Bone, + shoulder_l: Bone, + shoulder_r: Bone, + hand_l: Bone, + hand_r: Bone, + leg_l: Bone, + leg_r: Bone, + foot_l: Bone, + foot_r: Bone, +} + +impl BipedLargeSkeleton { + pub fn new() -> Self { + Self { + head: Bone::default(), + upper_torso: Bone::default(), + lower_torso: Bone::default(), + shoulder_l: Bone::default(), + shoulder_r: Bone::default(), + hand_l: Bone::default(), + hand_r: Bone::default(), + leg_l: Bone::default(), + leg_r: Bone::default(), + foot_l: Bone::default(), + foot_r: Bone::default(), + } + } +} + +impl Skeleton for BipedLargeSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let upper_torso_mat = self.upper_torso.compute_base_matrix(); + let shoulder_l_mat = self.shoulder_l.compute_base_matrix(); + let shoulder_r_mat = self.shoulder_r.compute_base_matrix(); + let leg_l_mat = self.leg_l.compute_base_matrix(); + let leg_r_mat = self.leg_r.compute_base_matrix(); + + [ + FigureBoneData::new(self.head.compute_base_matrix()), + FigureBoneData::new(upper_torso_mat), + FigureBoneData::new(self.lower_torso.compute_base_matrix() * upper_torso_mat), + FigureBoneData::new(shoulder_l_mat * upper_torso_mat), + FigureBoneData::new(shoulder_r_mat * upper_torso_mat), + FigureBoneData::new( + self.hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat, + ), + FigureBoneData::new( + self.hand_r.compute_base_matrix() * shoulder_r_mat * upper_torso_mat, + ), + FigureBoneData::new(leg_l_mat), + FigureBoneData::new(leg_r_mat), + FigureBoneData::new(self.foot_l.compute_base_matrix() * leg_l_mat), + FigureBoneData::new(self.foot_r.compute_base_matrix() * leg_r_mat), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] + } + + fn interpolate(&mut self, target: &Self, dt: f32) { + self.head.interpolate(&target.head, dt); + self.upper_torso.interpolate(&target.upper_torso, dt); + self.lower_torso.interpolate(&target.lower_torso, dt); + self.shoulder_l.interpolate(&target.shoulder_l, dt); + self.shoulder_r.interpolate(&target.shoulder_r, dt); + self.hand_l.interpolate(&target.hand_l, dt); + self.hand_r.interpolate(&target.hand_r, dt); + self.leg_l.interpolate(&target.leg_l, dt); + self.leg_r.interpolate(&target.leg_r, dt); + self.foot_l.interpolate(&target.foot_l, dt); + self.foot_r.interpolate(&target.foot_r, dt); + } +} diff --git a/voxygen/src/anim/biped_large/run.rs b/voxygen/src/anim/biped_large/run.rs new file mode 100644 index 0000000000..4f77065716 --- /dev/null +++ b/voxygen/src/anim/biped_large/run.rs @@ -0,0 +1,68 @@ +use super::{ + super::{Animation, SkeletonAttr}, + BipedLargeSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct RunAnimation; + +impl Animation for RunAnimation { + type Skeleton = BipedLargeSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + (_velocity, _global_time): Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.upper_torso.scale = Vec3::one() / 10.88; + + next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.lower_torso.scale = Vec3::one() / 10.88; + + next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.shoulder_l.scale = Vec3::one() / 10.88; + + next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.shoulder_r.scale = Vec3::one() / 10.88; + + next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.hand_l.scale = Vec3::one() / 10.88; + + next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.hand_r.scale = Vec3::one() / 10.88; + + next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.leg_l.scale = Vec3::one() / 10.88; + + next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.leg_r.scale = Vec3::one() / 10.88; + + next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.foot_l.scale = Vec3::one() / 10.88; + + next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.foot_r.scale = Vec3::one() / 10.88; + next + } +} diff --git a/voxygen/src/anim/bird_medium/idle.rs b/voxygen/src/anim/bird_medium/idle.rs new file mode 100644 index 0000000000..d2156415e7 --- /dev/null +++ b/voxygen/src/anim/bird_medium/idle.rs @@ -0,0 +1,52 @@ +use super::{ + super::{Animation, SkeletonAttr}, + BirdMediumSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct IdleAnimation; + +impl Animation for IdleAnimation { + type Skeleton = BirdMediumSkeleton; + type Dependency = (f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.torso.offset = Vec3::new(0.0, 4.5, 2.0); + next.torso.ori = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() * 1.01; + + next.tail.offset = Vec3::new(0.0, 3.1, -4.5); + next.tail.ori = Quaternion::rotation_z(0.0); + next.tail.scale = Vec3::one() * 0.98; + + next.wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.wing_l.scale = Vec3::one() / 11.0; + + next.wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.wing_r.ori = Quaternion::rotation_y(0.0); + next.wing_r.scale = Vec3::one() / 11.0; + + next.leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.leg_l.ori = Quaternion::rotation_y(0.0); + next.leg_l.scale = Vec3::one() / 10.5; + + next.leg_r.offset = Vec3::new(0.0, 0.75, 5.25); + next.leg_r.ori = Quaternion::rotation_x(0.0); + next.leg_r.scale = Vec3::one() * 1.00; + next + } +} diff --git a/voxygen/src/anim/bird_medium/jump.rs b/voxygen/src/anim/bird_medium/jump.rs new file mode 100644 index 0000000000..14d57abe9b --- /dev/null +++ b/voxygen/src/anim/bird_medium/jump.rs @@ -0,0 +1,52 @@ +use super::{ + super::{Animation, SkeletonAttr}, + BirdMediumSkeleton, +}; +//use std::f32::consts::PI; +use vek::*; + +pub struct JumpAnimation; + +impl Animation for JumpAnimation { + type Skeleton = BirdMediumSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.torso.offset = Vec3::new(0.0, 4.5, 2.0); + next.torso.ori = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() * 1.01; + + next.tail.offset = Vec3::new(0.0, 3.1, -4.5); + next.tail.ori = Quaternion::rotation_z(0.0); + next.tail.scale = Vec3::one() * 0.98; + + next.wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.wing_l.scale = Vec3::one() / 11.0; + + next.wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.wing_r.ori = Quaternion::rotation_y(0.0); + next.wing_r.scale = Vec3::one() / 11.0; + + next.leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.leg_l.ori = Quaternion::rotation_y(0.0); + next.leg_l.scale = Vec3::one() / 10.5; + + next.leg_r.offset = Vec3::new(0.0, 0.75, 5.25); + next.leg_r.ori = Quaternion::rotation_x(0.0); + next.leg_r.scale = Vec3::one() * 1.00; + next + } +} diff --git a/voxygen/src/anim/bird_medium/mod.rs b/voxygen/src/anim/bird_medium/mod.rs new file mode 100644 index 0000000000..0ed048b719 --- /dev/null +++ b/voxygen/src/anim/bird_medium/mod.rs @@ -0,0 +1,71 @@ +pub mod idle; +pub mod jump; +pub mod run; + +// Reexports +pub use self::idle::IdleAnimation; +pub use self::jump::JumpAnimation; +pub use self::run::RunAnimation; + +use super::{Bone, Skeleton}; +use crate::render::FigureBoneData; + +#[derive(Clone)] +pub struct BirdMediumSkeleton { + head: Bone, + torso: Bone, + tail: Bone, + wing_l: Bone, + wing_r: Bone, + leg_l: Bone, + leg_r: Bone, +} + +impl BirdMediumSkeleton { + pub fn new() -> Self { + Self { + head: Bone::default(), + torso: Bone::default(), + tail: Bone::default(), + wing_l: Bone::default(), + wing_r: Bone::default(), + leg_l: Bone::default(), + leg_r: Bone::default(), + } + } +} + +impl Skeleton for BirdMediumSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let torso_mat = self.torso.compute_base_matrix(); + + [ + FigureBoneData::new(self.head.compute_base_matrix() * torso_mat), + FigureBoneData::new(torso_mat), + FigureBoneData::new(self.tail.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.wing_l.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.wing_r.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.leg_l.compute_base_matrix()), + FigureBoneData::new(self.leg_r.compute_base_matrix()), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] + } + + fn interpolate(&mut self, target: &Self, dt: f32) { + self.head.interpolate(&target.head, dt); + self.torso.interpolate(&target.torso, dt); + self.tail.interpolate(&target.tail, dt); + self.wing_l.interpolate(&target.wing_l, dt); + self.wing_r.interpolate(&target.wing_r, dt); + self.leg_l.interpolate(&target.leg_l, dt); + self.leg_r.interpolate(&target.leg_r, dt); + } +} diff --git a/voxygen/src/anim/bird_medium/run.rs b/voxygen/src/anim/bird_medium/run.rs new file mode 100644 index 0000000000..11f825cb96 --- /dev/null +++ b/voxygen/src/anim/bird_medium/run.rs @@ -0,0 +1,52 @@ +use super::{ + super::{Animation, SkeletonAttr}, + BirdMediumSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct RunAnimation; + +impl Animation for RunAnimation { + type Skeleton = BirdMediumSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + (_velocity, _global_time): Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.torso.offset = Vec3::new(0.0, 4.5, 2.0); + next.torso.ori = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() * 1.01; + + next.tail.offset = Vec3::new(0.0, 3.1, -4.5); + next.tail.ori = Quaternion::rotation_z(0.0); + next.tail.scale = Vec3::one() * 0.98; + + next.wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.wing_l.scale = Vec3::one() / 11.0; + + next.wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.wing_r.ori = Quaternion::rotation_y(0.0); + next.wing_r.scale = Vec3::one() / 11.0; + + next.leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.leg_l.ori = Quaternion::rotation_y(0.0); + next.leg_l.scale = Vec3::one() / 10.5; + + next.leg_r.offset = Vec3::new(0.0, 0.75, 5.25); + next.leg_r.ori = Quaternion::rotation_x(0.0); + next.leg_r.scale = Vec3::one() * 1.00; + next + } +} diff --git a/voxygen/src/anim/bird_small/idle.rs b/voxygen/src/anim/bird_small/idle.rs new file mode 100644 index 0000000000..9cef0371f3 --- /dev/null +++ b/voxygen/src/anim/bird_small/idle.rs @@ -0,0 +1,41 @@ +use super::{ + super::{Animation, SkeletonAttr}, + BirdSmallSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct IdleAnimation; + +impl Animation for IdleAnimation { + type Skeleton = BirdSmallSkeleton; + type Dependency = (f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 10.88; + + next.wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.wing_l.scale = Vec3::one() / 10.88; + + next.wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.wing_r.scale = Vec3::one() / 10.88; + + next + } +} diff --git a/voxygen/src/anim/bird_small/jump.rs b/voxygen/src/anim/bird_small/jump.rs new file mode 100644 index 0000000000..21dd935088 --- /dev/null +++ b/voxygen/src/anim/bird_small/jump.rs @@ -0,0 +1,41 @@ +use super::{ + super::{Animation, SkeletonAttr}, + BirdSmallSkeleton, +}; +//use std::f32::consts::PI; +use vek::*; + +pub struct JumpAnimation; + +impl Animation for JumpAnimation { + type Skeleton = BirdSmallSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 10.88; + + next.wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.wing_l.scale = Vec3::one() / 10.88; + + next.wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.wing_r.scale = Vec3::one() / 10.88; + + next + } +} diff --git a/voxygen/src/anim/bird_small/mod.rs b/voxygen/src/anim/bird_small/mod.rs new file mode 100644 index 0000000000..dff5671b62 --- /dev/null +++ b/voxygen/src/anim/bird_small/mod.rs @@ -0,0 +1,62 @@ +pub mod idle; +pub mod jump; +pub mod run; + +// Reexports +pub use self::idle::IdleAnimation; +pub use self::jump::JumpAnimation; +pub use self::run::RunAnimation; + +use super::{Bone, Skeleton}; +use crate::render::FigureBoneData; + +#[derive(Clone)] +pub struct BirdSmallSkeleton { + head: Bone, + torso: Bone, + wing_l: Bone, + wing_r: Bone, +} + +impl BirdSmallSkeleton { + pub fn new() -> Self { + Self { + head: Bone::default(), + torso: Bone::default(), + wing_l: Bone::default(), + wing_r: Bone::default(), + } + } +} + +impl Skeleton for BirdSmallSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let torso_mat = self.torso.compute_base_matrix(); + + [ + FigureBoneData::new(self.head.compute_base_matrix() * torso_mat), + FigureBoneData::new(torso_mat), + FigureBoneData::new(self.wing_l.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.wing_r.compute_base_matrix() * torso_mat), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] + } + + fn interpolate(&mut self, target: &Self, dt: f32) { + self.head.interpolate(&target.head, dt); + self.torso.interpolate(&target.torso, dt); + self.wing_l.interpolate(&target.wing_l, dt); + self.wing_r.interpolate(&target.wing_r, dt); + } +} diff --git a/voxygen/src/anim/bird_small/run.rs b/voxygen/src/anim/bird_small/run.rs new file mode 100644 index 0000000000..62762cc33f --- /dev/null +++ b/voxygen/src/anim/bird_small/run.rs @@ -0,0 +1,41 @@ +use super::{ + super::{Animation, SkeletonAttr}, + BirdSmallSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct RunAnimation; + +impl Animation for RunAnimation { + type Skeleton = BirdSmallSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + (_velocity, _global_time): Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 10.88; + + next.wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.wing_l.scale = Vec3::one() / 10.88; + + next.wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.wing_r.scale = Vec3::one() / 10.88; + + next + } +} diff --git a/voxygen/src/anim/character/run - Copy.rs b/voxygen/src/anim/character/run - Copy.rs new file mode 100644 index 0000000000..6e0a6aff0b --- /dev/null +++ b/voxygen/src/anim/character/run - Copy.rs @@ -0,0 +1,147 @@ +use super::{ + super::{Animation, SkeletonAttr}, + CharacterSkeleton, +}; +use std::f32::consts::PI; +use std::ops::Mul; +use vek::*; + +pub struct SneakAnimation; + +impl Animation for SneakAnimation { + type Skeleton = CharacterSkeleton; + type Dependency = (Vec3, Vec3, Vec3, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + (velocity, orientation, last_ori, global_time): Self::Dependency, + anim_time: f64, + rate: &mut f32, + skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let speed = Vec2::::from(velocity).magnitude(); + *rate = speed; + + let constant = 1.0; + let wave = (((5.0) + / (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 1.2).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * constant as f32 * 1.2).sin()); + let wave_cos = (((5.0) + / (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * constant as f32 * 1.5).sin()); + let wave_cos_dub = (((5.0) + / (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 4.8).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * constant as f32 * 1.5).sin()); + + let wave_diff = (anim_time as f32 * 0.6).sin(); + let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin(); + let head_look = Vec2::new( + ((global_time + anim_time) as f32 / 4.0) + .floor() + .mul(7331.0) + .sin() + * 0.2, + ((global_time + anim_time) as f32 / 4.0) + .floor() + .mul(1337.0) + .sin() + * 0.1, + ); + + let ori = Vec2::from(orientation); + let last_ori = Vec2::from(last_ori); + + let tilt = if Vec2::new(ori, last_ori) + .map(|o| Vec2::::from(o).magnitude_squared()) + .map(|m| m > 0.001 && m.is_finite()) + .reduce_and() + && ori.angle_between(last_ori).is_finite() + { + ori.angle_between(last_ori).min(0.5) + * last_ori.determine_side(Vec2::zero(), ori).signum() + } else { + 0.0 + } * 1.3; + + next.head.offset = Vec3::new( + 0.0, + -3.0 + skeleton_attr.neck_forward, + skeleton_attr.neck_height + 20.0 + wave_cos * 1.3, + ); + next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1) + * Quaternion::rotation_x(head_look.y + 0.35); + next.head.scale = Vec3::one() * skeleton_attr.head_scale; + + next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 1.1); + next.chest.ori = Quaternion::rotation_z(wave * 0.2); + next.chest.scale = Vec3::one(); + + next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_cos * 1.1); + next.belt.ori = Quaternion::rotation_z(wave * 0.35); + next.belt.scale = Vec3::one(); + + next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_cos * 1.1); + next.shorts.ori = Quaternion::rotation_z(wave * 0.6); + next.shorts.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new( + -6.0 + wave_stop * -1.0, + -0.25 + wave_cos * 2.0, + 5.0 - wave * 1.5, + ); + next.l_hand.ori = + Quaternion::rotation_x(0.8 + wave_cos * 1.2) * Quaternion::rotation_y(wave_stop * 0.1); + next.l_hand.scale = Vec3::one(); + + next.r_hand.offset = Vec3::new( + 6.0 + wave_stop * 1.0, + -0.25 - wave_cos * 2.0, + 5.0 + wave * 1.5, + ); + next.r_hand.ori = Quaternion::rotation_x(0.8 + wave_cos * -1.2) + * Quaternion::rotation_y(wave_stop * -0.1); + next.r_hand.scale = Vec3::one(); + + next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0 - wave_cos_dub * 0.7); + next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.2); + next.l_foot.scale = Vec3::one(); + + next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0 - wave_cos_dub * 0.7); + next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.2); + next.r_foot.scale = Vec3::one(); + + next.weapon.offset = Vec3::new( + -7.0 + skeleton_attr.weapon_x, + -5.0 + skeleton_attr.weapon_y, + 15.0, + ); + next.weapon.ori = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25); + next.weapon.scale = Vec3::one(); + + next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); + next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15); + next.l_shoulder.scale = Vec3::one() * 1.1; + + next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); + next.r_shoulder.ori = Quaternion::rotation_x(wave * 0.15); + next.r_shoulder.scale = Vec3::one() * 1.1; + + next.draw.offset = Vec3::new(0.0, 5.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.torso.offset = Vec3::new(0.0, 0.3 + wave * -0.08, 0.4) * skeleton_attr.scaler; + next.torso.ori = + Quaternion::rotation_x(wave_stop * speed * -0.06 + wave_diff * speed * -0.005) + * Quaternion::rotation_y(tilt); + next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; + + next + } +} diff --git a/voxygen/src/anim/character/sneak.rs b/voxygen/src/anim/character/sneak.rs new file mode 100644 index 0000000000..389c370bb4 --- /dev/null +++ b/voxygen/src/anim/character/sneak.rs @@ -0,0 +1,151 @@ +use super::{ + super::{Animation, SkeletonAttr}, + CharacterSkeleton, +}; +use std::f32::consts::PI; +use std::ops::Mul; +use vek::*; + +pub struct SneakAnimation; + +impl Animation for SneakAnimation { + type Skeleton = CharacterSkeleton; + type Dependency = (Vec3, Vec3, Vec3, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + (velocity, orientation, last_ori, global_time): Self::Dependency, + anim_time: f64, + rate: &mut f32, + skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let speed = Vec2::::from(velocity).magnitude(); + *rate = speed; + + let constant = 1.0; + let wave = (((5.0) + / (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 1.2).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * constant as f32 * 1.2).sin()); + let wavecos = (((5.0) + / (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 1.2).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * constant as f32 * 1.2).cos()); + let wave_cos = (((5.0) + / (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * constant as f32 * 1.5).sin()); + let wave_cos_dub = (((5.0) + / (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 4.8).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * constant as f32 * 1.5).sin()); + let wave_slow = (anim_time as f32 * 0.1).sin(); + let wave_diff = (anim_time as f32 * 0.6).sin(); + let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin(); + let head_look = Vec2::new( + ((global_time + anim_time) as f32 *0.25) + .floor() + .mul(7331.0) + .sin() + * 0.4, + ((global_time + anim_time) as f32 *0.25) + .floor() + .mul(1337.0) + .sin() + * 0.2, + ); + + let ori = Vec2::from(orientation); + let last_ori = Vec2::from(last_ori); + + let tilt = if Vec2::new(ori, last_ori) + .map(|o| Vec2::::from(o).magnitude_squared()) + .map(|m| m > 0.001 && m.is_finite()) + .reduce_and() + && ori.angle_between(last_ori).is_finite() + { + ori.angle_between(last_ori).min(0.5) + * last_ori.determine_side(Vec2::zero(), ori).signum() + } else { + 0.0 + } * 1.3; + + next.head.offset = Vec3::new( + 0.0, + 0.0 + skeleton_attr.neck_forward, + skeleton_attr.neck_height + 16.0, + ); + next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1) + * Quaternion::rotation_x(head_look.y + 0.05); + next.head.scale = Vec3::one() * skeleton_attr.head_scale; + + next.chest.offset = Vec3::new(0.0, -1.5, 3.0 +wave_slow * 2.0); + next.chest.ori = Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(wave * 0.15); + next.chest.scale = Vec3::one(); + + next.belt.offset = Vec3::new(0.0, 0.0, 1.5 + wave_cos * 0.3); + next.belt.ori = Quaternion::rotation_x(-0.1) * Quaternion::rotation_z(wave * 0.25); + next.belt.scale = Vec3::one(); + + next.shorts.offset = Vec3::new(0.0, 1.0, -1.0 + wave_cos * 0.3); + next.shorts.ori = Quaternion::rotation_x(0.2) *Quaternion::rotation_z(wave * 0.4); + next.shorts.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new( + -5.0 + wave_stop * -0.5, + 2.25, + 4.0 - wave * 1.0, + ); + next.l_hand.ori = + Quaternion::rotation_x(1.5 + wave_cos * 0.1) * Quaternion::rotation_y(wave_stop * 0.1); + next.l_hand.scale = Vec3::one(); + + next.r_hand.offset = Vec3::new( + 5.0 + wave_stop * 0.5, + 2.25, + 4.0 + wave * 1.0, + ); + next.r_hand.ori = Quaternion::rotation_x(1.5 + wave_cos * -0.1) + * Quaternion::rotation_y(wave_stop * -0.1); + next.r_hand.scale = Vec3::one(); + + next.l_foot.offset = Vec3::new(-3.4, 5.0+ wave * -3.0, 4.0); + next.l_foot.ori = Quaternion::rotation_x(-0.8 + wavecos * 0.15); + next.l_foot.scale = Vec3::one(); + + next.r_foot.offset = Vec3::new(3.4, 5.0+ wave * 3.0, 4.0); + next.r_foot.ori = Quaternion::rotation_x(-0.8 - wavecos * 0.15); + next.r_foot.scale = Vec3::one(); + + next.weapon.offset = Vec3::new( + -7.0 + skeleton_attr.weapon_x, + -5.0 + skeleton_attr.weapon_y, + 15.0, + ); + next.weapon.ori = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25); + next.weapon.scale = Vec3::one(); + + next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); + next.l_shoulder.ori = Quaternion::rotation_x(wavecos * 0.05); + next.l_shoulder.scale = Vec3::one() * 1.1; + + next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); + next.r_shoulder.ori = Quaternion::rotation_x(wave * 0.05); + next.r_shoulder.scale = Vec3::one() * 1.1; + + next.draw.offset = Vec3::new(0.0, 5.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.torso.offset = Vec3::new(0.0, 0.3 + wave * -0.08, 0.4) * skeleton_attr.scaler; + next.torso.ori = + Quaternion::rotation_x(wave_stop * speed * -0.03 + wave_diff * speed * -0.005) + * Quaternion::rotation_y(tilt); + next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; + + next + } +} diff --git a/voxygen/src/anim/dragon/idle.rs b/voxygen/src/anim/dragon/idle.rs new file mode 100644 index 0000000000..9073740442 --- /dev/null +++ b/voxygen/src/anim/dragon/idle.rs @@ -0,0 +1,76 @@ +use super::{ + super::{Animation, SkeletonAttr}, + DragonSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct IdleAnimation; + +impl Animation for IdleAnimation { + type Skeleton = DragonSkeleton; + type Dependency = (f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0); + next.chest_front.ori = Quaternion::rotation_x(0.0); + next.chest_front.scale = Vec3::one() * 1.01; + + next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0); + next.chest_rear.ori = Quaternion::rotation_x(0.0); + next.chest_rear.scale = Vec3::one() * 1.01; + + next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0); + next.tail_front.ori = Quaternion::rotation_x(0.0); + next.tail_front.scale = Vec3::one() * 1.01; + + next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0); + next.tail_rear.ori = Quaternion::rotation_x(0.0); + next.tail_rear.scale = Vec3::one() * 1.01; + + next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_in_l.ori = Quaternion::rotation_x(0.0); + next.wing_in_l.scale = Vec3::one() * 1.01; + + next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_in_r.ori = Quaternion::rotation_x(0.0); + next.wing_in_r.scale = Vec3::one() * 1.01; + + next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_out_l.ori = Quaternion::rotation_x(0.0); + next.wing_out_l.scale = Vec3::one() * 1.01; + + next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_out_r.ori = Quaternion::rotation_x(0.0); + next.wing_out_r.scale = Vec3::one() * 1.01; + + next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_fl.ori = Quaternion::rotation_x(0.0); + next.foot_fl.scale = Vec3::one() * 1.01; + + next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_fr.ori = Quaternion::rotation_x(0.0); + next.foot_fr.scale = Vec3::one() * 1.01; + + next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_bl.ori = Quaternion::rotation_x(0.0); + next.foot_bl.scale = Vec3::one() * 1.01; + + next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_br.ori = Quaternion::rotation_x(0.0); + next.foot_br.scale = Vec3::one() * 1.01; + next + } +} diff --git a/voxygen/src/anim/dragon/jump.rs b/voxygen/src/anim/dragon/jump.rs new file mode 100644 index 0000000000..8aa98d93cd --- /dev/null +++ b/voxygen/src/anim/dragon/jump.rs @@ -0,0 +1,76 @@ +use super::{ + super::{Animation, SkeletonAttr}, + DragonSkeleton, +}; +//use std::f32::consts::PI; +use vek::*; + +pub struct JumpAnimation; + +impl Animation for JumpAnimation { + type Skeleton = DragonSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0); + next.chest_front.ori = Quaternion::rotation_x(0.0); + next.chest_front.scale = Vec3::one() * 1.01; + + next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0); + next.chest_rear.ori = Quaternion::rotation_x(0.0); + next.chest_rear.scale = Vec3::one() * 1.01; + + next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0); + next.tail_front.ori = Quaternion::rotation_x(0.0); + next.tail_front.scale = Vec3::one() * 1.01; + + next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0); + next.tail_rear.ori = Quaternion::rotation_x(0.0); + next.tail_rear.scale = Vec3::one() * 1.01; + + next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_in_l.ori = Quaternion::rotation_x(0.0); + next.wing_in_l.scale = Vec3::one() * 1.01; + + next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_in_r.ori = Quaternion::rotation_x(0.0); + next.wing_in_r.scale = Vec3::one() * 1.01; + + next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_out_l.ori = Quaternion::rotation_x(0.0); + next.wing_out_l.scale = Vec3::one() * 1.01; + + next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_out_r.ori = Quaternion::rotation_x(0.0); + next.wing_out_r.scale = Vec3::one() * 1.01; + + next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_fl.ori = Quaternion::rotation_x(0.0); + next.foot_fl.scale = Vec3::one() * 1.01; + + next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_fr.ori = Quaternion::rotation_x(0.0); + next.foot_fr.scale = Vec3::one() * 1.01; + + next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_bl.ori = Quaternion::rotation_x(0.0); + next.foot_bl.scale = Vec3::one() * 1.01; + + next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_br.ori = Quaternion::rotation_x(0.0); + next.foot_br.scale = Vec3::one() * 1.01; + next + } +} diff --git a/voxygen/src/anim/dragon/mod.rs b/voxygen/src/anim/dragon/mod.rs new file mode 100644 index 0000000000..b6950956e5 --- /dev/null +++ b/voxygen/src/anim/dragon/mod.rs @@ -0,0 +1,92 @@ +pub mod idle; +pub mod jump; +pub mod run; + +// Reexports +pub use self::idle::IdleAnimation; +pub use self::jump::JumpAnimation; +pub use self::run::RunAnimation; + +use super::{Bone, Skeleton}; +use crate::render::FigureBoneData; + +#[derive(Clone)] +pub struct DragonSkeleton { + head: Bone, + chest_front: Bone, + chest_rear: Bone, + tail_front: Bone, + tail_rear: Bone, + wing_in_l: Bone, + wing_in_r: Bone, + wing_out_l: Bone, + wing_out_r: Bone, + foot_fl: Bone, + foot_fr: Bone, + foot_bl: Bone, + foot_br: Bone, +} + +impl DragonSkeleton { + pub fn new() -> Self { + Self { + head: Bone::default(), + chest_front: Bone::default(), + chest_rear: Bone::default(), + tail_front: Bone::default(), + tail_rear: Bone::default(), + wing_in_l: Bone::default(), + wing_in_r: Bone::default(), + wing_out_l: Bone::default(), + wing_out_r: Bone::default(), + foot_fl: Bone::default(), + foot_fr: Bone::default(), + foot_bl: Bone::default(), + foot_br: Bone::default(), + } + } +} + +impl Skeleton for DragonSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let chest_front_mat = self.chest_front.compute_base_matrix(); + let wing_in_l_mat = self.wing_in_l.compute_base_matrix(); + let wing_in_r_mat = self.wing_in_r.compute_base_matrix(); + let tail_front_mat = self.tail_front.compute_base_matrix(); + + [ + FigureBoneData::new(self.head.compute_base_matrix() * chest_front_mat), + FigureBoneData::new(chest_front_mat), + FigureBoneData::new(self.chest_rear.compute_base_matrix() * chest_front_mat), + FigureBoneData::new(tail_front_mat), + FigureBoneData::new(self.tail_rear.compute_base_matrix() * tail_front_mat), + FigureBoneData::new(wing_in_l_mat), + FigureBoneData::new(wing_in_r_mat), + FigureBoneData::new(self.wing_out_l.compute_base_matrix() * wing_in_l_mat), + FigureBoneData::new(self.wing_out_r.compute_base_matrix() * wing_in_r_mat), + FigureBoneData::new(self.foot_fl.compute_base_matrix()), + FigureBoneData::new(self.foot_fr.compute_base_matrix()), + FigureBoneData::new(self.foot_bl.compute_base_matrix()), + FigureBoneData::new(self.foot_br.compute_base_matrix()), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] + } + + fn interpolate(&mut self, target: &Self, dt: f32) { + self.head.interpolate(&target.head, dt); + self.chest_front.interpolate(&target.chest_front, dt); + self.chest_rear.interpolate(&target.chest_rear, dt); + self.tail_front.interpolate(&target.tail_front, dt); + self.tail_rear.interpolate(&target.tail_rear, dt); + self.wing_in_l.interpolate(&target.wing_in_l, dt); + self.wing_in_r.interpolate(&target.wing_in_r, dt); + self.wing_out_l.interpolate(&target.wing_out_l, dt); + self.wing_out_r.interpolate(&target.wing_out_r, dt); + self.foot_fl.interpolate(&target.foot_fl, dt); + self.foot_fr.interpolate(&target.foot_fr, dt); + self.foot_bl.interpolate(&target.foot_bl, dt); + self.foot_br.interpolate(&target.foot_br, dt); + } +} diff --git a/voxygen/src/anim/dragon/run.rs b/voxygen/src/anim/dragon/run.rs new file mode 100644 index 0000000000..2abe9fae1a --- /dev/null +++ b/voxygen/src/anim/dragon/run.rs @@ -0,0 +1,76 @@ +use super::{ + super::{Animation, SkeletonAttr}, + DragonSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct RunAnimation; + +impl Animation for RunAnimation { + type Skeleton = DragonSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + (_velocity, _global_time): Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0); + next.chest_front.ori = Quaternion::rotation_x(0.0); + next.chest_front.scale = Vec3::one() * 1.01; + + next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0); + next.chest_rear.ori = Quaternion::rotation_x(0.0); + next.chest_rear.scale = Vec3::one() * 1.01; + + next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0); + next.tail_front.ori = Quaternion::rotation_x(0.0); + next.tail_front.scale = Vec3::one() * 1.01; + + next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0); + next.tail_rear.ori = Quaternion::rotation_x(0.0); + next.tail_rear.scale = Vec3::one() * 1.01; + + next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_in_l.ori = Quaternion::rotation_x(0.0); + next.wing_in_l.scale = Vec3::one() * 1.01; + + next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_in_r.ori = Quaternion::rotation_x(0.0); + next.wing_in_r.scale = Vec3::one() * 1.01; + + next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_out_l.ori = Quaternion::rotation_x(0.0); + next.wing_out_l.scale = Vec3::one() * 1.01; + + next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0); + next.wing_out_r.ori = Quaternion::rotation_x(0.0); + next.wing_out_r.scale = Vec3::one() * 1.01; + + next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_fl.ori = Quaternion::rotation_x(0.0); + next.foot_fl.scale = Vec3::one() * 1.01; + + next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_fr.ori = Quaternion::rotation_x(0.0); + next.foot_fr.scale = Vec3::one() * 1.01; + + next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_bl.ori = Quaternion::rotation_x(0.0); + next.foot_bl.scale = Vec3::one() * 1.01; + + next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0); + next.foot_br.ori = Quaternion::rotation_x(0.0); + next.foot_br.scale = Vec3::one() * 1.01; + next + } +} diff --git a/voxygen/src/anim/fish_medium/idle.rs b/voxygen/src/anim/fish_medium/idle.rs new file mode 100644 index 0000000000..5a04c110af --- /dev/null +++ b/voxygen/src/anim/fish_medium/idle.rs @@ -0,0 +1,48 @@ +use super::{ + super::{Animation, SkeletonAttr}, + FishMediumSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct IdleAnimation; + +impl Animation for IdleAnimation { + type Skeleton = FishMediumSkeleton; + type Dependency = (f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.torso.offset = Vec3::new(0.0, 4.5, 2.0); + next.torso.ori = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() * 1.01; + + next.rear.offset = Vec3::new(0.0, 3.1, -4.5); + next.rear.ori = Quaternion::rotation_z(0.0); + next.rear.scale = Vec3::one() * 0.98; + + next.tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.tail.scale = Vec3::one() / 11.0; + + next.fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.fin_l.ori = Quaternion::rotation_y(0.0); + next.fin_l.scale = Vec3::one() / 11.0; + + next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.fin_r.ori = Quaternion::rotation_y(0.0); + next.fin_r.scale = Vec3::one() / 10.5; + next + } +} diff --git a/voxygen/src/anim/fish_medium/jump.rs b/voxygen/src/anim/fish_medium/jump.rs new file mode 100644 index 0000000000..6b6266e402 --- /dev/null +++ b/voxygen/src/anim/fish_medium/jump.rs @@ -0,0 +1,48 @@ +use super::{ + super::{Animation, SkeletonAttr}, + FishMediumSkeleton, +}; +//use std::f32::consts::PI; +use vek::*; + +pub struct JumpAnimation; + +impl Animation for JumpAnimation { + type Skeleton = FishMediumSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.torso.offset = Vec3::new(0.0, 4.5, 2.0); + next.torso.ori = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() * 1.01; + + next.rear.offset = Vec3::new(0.0, 3.1, -4.5); + next.rear.ori = Quaternion::rotation_z(0.0); + next.rear.scale = Vec3::one() * 0.98; + + next.tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.tail.scale = Vec3::one() / 11.0; + + next.fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.fin_l.ori = Quaternion::rotation_y(0.0); + next.fin_l.scale = Vec3::one() / 11.0; + + next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.fin_r.ori = Quaternion::rotation_y(0.0); + next.fin_r.scale = Vec3::one() / 10.5; + next + } +} diff --git a/voxygen/src/anim/fish_medium/mod.rs b/voxygen/src/anim/fish_medium/mod.rs new file mode 100644 index 0000000000..566967a532 --- /dev/null +++ b/voxygen/src/anim/fish_medium/mod.rs @@ -0,0 +1,69 @@ +pub mod idle; +pub mod jump; +pub mod run; + +// Reexports +pub use self::idle::IdleAnimation; +pub use self::jump::JumpAnimation; +pub use self::run::RunAnimation; + +use super::{Bone, Skeleton}; +use crate::render::FigureBoneData; + +#[derive(Clone)] +pub struct FishMediumSkeleton { + head: Bone, + torso: Bone, + rear: Bone, + tail: Bone, + fin_l: Bone, + fin_r: Bone, +} + +impl FishMediumSkeleton { + pub fn new() -> Self { + Self { + head: Bone::default(), + torso: Bone::default(), + rear: Bone::default(), + tail: Bone::default(), + fin_l: Bone::default(), + fin_r: Bone::default(), + } + } +} + +impl Skeleton for FishMediumSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let torso_mat = self.torso.compute_base_matrix(); + let rear_mat = self.rear.compute_base_matrix(); + + [ + FigureBoneData::new(self.head.compute_base_matrix() * torso_mat), + FigureBoneData::new(torso_mat), + FigureBoneData::new(rear_mat * torso_mat), + FigureBoneData::new(self.tail.compute_base_matrix() * rear_mat), + FigureBoneData::new(self.fin_l.compute_base_matrix() * rear_mat), + FigureBoneData::new(self.fin_r.compute_base_matrix() * rear_mat), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] + } + + fn interpolate(&mut self, target: &Self, dt: f32) { + self.head.interpolate(&target.head, dt); + self.torso.interpolate(&target.torso, dt); + self.rear.interpolate(&target.rear, dt); + self.tail.interpolate(&target.tail, dt); + self.fin_l.interpolate(&target.fin_l, dt); + self.fin_r.interpolate(&target.fin_r, dt); + } +} diff --git a/voxygen/src/anim/fish_medium/run.rs b/voxygen/src/anim/fish_medium/run.rs new file mode 100644 index 0000000000..18886ee935 --- /dev/null +++ b/voxygen/src/anim/fish_medium/run.rs @@ -0,0 +1,48 @@ +use super::{ + super::{Animation, SkeletonAttr}, + FishMediumSkeleton, +}; +//use std::f32::consts::PI; +use vek::*; + +pub struct RunAnimation; + +impl Animation for RunAnimation { + type Skeleton = FishMediumSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.head.scale = Vec3::one() / 10.88; + + next.torso.offset = Vec3::new(0.0, 4.5, 2.0); + next.torso.ori = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() * 1.01; + + next.rear.offset = Vec3::new(0.0, 3.1, -4.5); + next.rear.ori = Quaternion::rotation_z(0.0); + next.rear.scale = Vec3::one() * 0.98; + + next.tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.tail.scale = Vec3::one() / 11.0; + + next.fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.fin_l.ori = Quaternion::rotation_y(0.0); + next.fin_l.scale = Vec3::one() / 11.0; + + next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.fin_r.ori = Quaternion::rotation_y(0.0); + next.fin_r.scale = Vec3::one() / 10.5; + next + } +} diff --git a/voxygen/src/anim/fish_small/idle.rs b/voxygen/src/anim/fish_small/idle.rs new file mode 100644 index 0000000000..67ba7bc94f --- /dev/null +++ b/voxygen/src/anim/fish_small/idle.rs @@ -0,0 +1,33 @@ +use super::{ + super::{Animation, SkeletonAttr}, + FishSmallSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct IdleAnimation; + +impl Animation for IdleAnimation { + type Skeleton = FishSmallSkeleton; + type Dependency = (f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 10.88; + + next.tail.offset = Vec3::new(0.0, 4.5, 2.0); + next.tail.ori = Quaternion::rotation_x(0.0); + next.tail.scale = Vec3::one() * 1.01; + + next + } +} diff --git a/voxygen/src/anim/fish_small/jump.rs b/voxygen/src/anim/fish_small/jump.rs new file mode 100644 index 0000000000..f8088c84df --- /dev/null +++ b/voxygen/src/anim/fish_small/jump.rs @@ -0,0 +1,33 @@ +use super::{ + super::{Animation, SkeletonAttr}, + FishSmallSkeleton, +}; +//use std::f32::consts::PI; +use vek::*; + +pub struct JumpAnimation; + +impl Animation for JumpAnimation { + type Skeleton = FishSmallSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 10.88; + + next.tail.offset = Vec3::new(0.0, 4.5, 2.0); + next.tail.ori = Quaternion::rotation_x(0.0); + next.tail.scale = Vec3::one() * 1.01; + + next + } +} diff --git a/voxygen/src/anim/fish_small/mod.rs b/voxygen/src/anim/fish_small/mod.rs new file mode 100644 index 0000000000..3d8b8e1184 --- /dev/null +++ b/voxygen/src/anim/fish_small/mod.rs @@ -0,0 +1,56 @@ +pub mod idle; +pub mod jump; +pub mod run; + +// Reexports +pub use self::idle::IdleAnimation; +pub use self::jump::JumpAnimation; +pub use self::run::RunAnimation; + +use super::{Bone, Skeleton}; +use crate::render::FigureBoneData; + +#[derive(Clone)] +pub struct FishSmallSkeleton { + torso: Bone, + tail: Bone, +} + +impl FishSmallSkeleton { + pub fn new() -> Self { + Self { + torso: Bone::default(), + tail: Bone::default(), + } + } +} + +impl Skeleton for FishSmallSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let torso_mat = self.torso.compute_base_matrix(); + + [ + FigureBoneData::new(torso_mat), + FigureBoneData::new(self.tail.compute_base_matrix() * torso_mat), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] + } + + fn interpolate(&mut self, target: &Self, dt: f32) { + self.torso.interpolate(&target.torso, dt); + self.tail.interpolate(&target.tail, dt); + } +} diff --git a/voxygen/src/anim/fish_small/run.rs b/voxygen/src/anim/fish_small/run.rs new file mode 100644 index 0000000000..0f1952c9dd --- /dev/null +++ b/voxygen/src/anim/fish_small/run.rs @@ -0,0 +1,33 @@ +use super::{ + super::{Animation, SkeletonAttr}, + FishSmallSkeleton, +}; +//use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct RunAnimation; + +impl Animation for RunAnimation { + type Skeleton = FishSmallSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + (_velocity, _global_time): Self::Dependency, + _anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 10.88; + + next.tail.offset = Vec3::new(0.0, 4.5, 2.0); + next.tail.ori = Quaternion::rotation_x(0.0); + next.tail.scale = Vec3::one() * 1.01; + + next + } +} diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index a527d759ce..a65eb04a6d 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -1,8 +1,14 @@ +pub mod biped_large; +pub mod bird_medium; +pub mod bird_small; pub mod character; +pub mod dragon; +pub mod fish_medium; +pub mod fish_small; pub mod fixture; pub mod object; -pub mod quadruped; -pub mod quadrupedmedium; +pub mod quadruped_medium; +pub mod quadruped_small; use crate::render::FigureBoneData; use common::comp::{self, item::Tool}; diff --git a/voxygen/src/anim/quadruped/idle.rs b/voxygen/src/anim/quadruped/idle.rs deleted file mode 100644 index fc0f912acc..0000000000 --- a/voxygen/src/anim/quadruped/idle.rs +++ /dev/null @@ -1,67 +0,0 @@ -use super::{ - super::{Animation, SkeletonAttr}, - QuadrupedSkeleton, -}; -use std::{f32::consts::PI, ops::Mul}; -use vek::*; - -pub struct IdleAnimation; - -impl Animation for IdleAnimation { - type Skeleton = QuadrupedSkeleton; - type Dependency = (f64); - - fn update_skeleton( - skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, - _rate: &mut f32, - _skeleton_attr: &SkeletonAttr, - ) -> Self::Skeleton { - let mut next = (*skeleton).clone(); - - let wave = (anim_time as f32 * 14.0).sin(); - let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); - let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - - let pig_head_look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, - ); - - next.pig_head.offset = Vec3::new(0.0, -2.0, -1.5 + wave * 0.2) / 11.0; - next.pig_head.ori = Quaternion::rotation_z(pig_head_look.x) - * Quaternion::rotation_x(pig_head_look.y + wave_slow_cos * 0.03); - next.pig_head.scale = Vec3::one() / 10.5; - - next.pig_chest.offset = Vec3::new(wave_slow * 0.05, -9.0, 1.5 + wave_slow_cos * 0.4) / 11.0; - next.pig_chest.ori = Quaternion::rotation_y(wave_slow * 0.05); - next.pig_chest.scale = Vec3::one() / 11.0; - - next.pig_leg_lf.offset = Vec3::new(-4.5, 2.0, 1.5) / 11.0; - next.pig_leg_lf.ori = Quaternion::rotation_x(wave_slow * 0.08); - next.pig_leg_lf.scale = Vec3::one() / 11.0; - - next.pig_leg_rf.offset = Vec3::new(2.5, 2.0, 1.5) / 11.0; - next.pig_leg_rf.ori = Quaternion::rotation_x(wave_slow_cos * 0.08); - next.pig_leg_rf.scale = Vec3::one() / 11.0; - - next.pig_leg_lb.offset = Vec3::new(-4.5, -3.0, 1.5) / 11.0; - next.pig_leg_lb.ori = Quaternion::rotation_x(wave_slow_cos * 0.08); - next.pig_leg_lb.scale = Vec3::one() / 11.0; - - next.pig_leg_rb.offset = Vec3::new(2.5, -3.0, 1.5) / 11.0; - next.pig_leg_rb.ori = Quaternion::rotation_x(wave_slow * 0.08); - next.pig_leg_rb.scale = Vec3::one() / 11.0; - - next - } -} diff --git a/voxygen/src/anim/quadruped/jump.rs b/voxygen/src/anim/quadruped/jump.rs deleted file mode 100644 index d0cf3fbe39..0000000000 --- a/voxygen/src/anim/quadruped/jump.rs +++ /dev/null @@ -1,52 +0,0 @@ -use super::{ - super::{Animation, SkeletonAttr}, - QuadrupedSkeleton, -}; -use std::f32::consts::PI; -use vek::*; - -pub struct JumpAnimation; - -impl Animation for JumpAnimation { - type Skeleton = QuadrupedSkeleton; - type Dependency = (f32, f64); - - fn update_skeleton( - skeleton: &Self::Skeleton, - (_velocity, _global_time): Self::Dependency, - anim_time: f64, - _rate: &mut f32, - _skeleton_attr: &SkeletonAttr, - ) -> Self::Skeleton { - let mut next = (*skeleton).clone(); - - let wave_slow = (anim_time as f32 * 7.0 + PI).sin(); - let wave_stop = (anim_time as f32 * 4.5).min(PI / 2.0).sin(); - - next.pig_head.offset = Vec3::new(0.0, 0.0, -1.5) / 11.0; - next.pig_head.ori = Quaternion::rotation_x(wave_stop * 0.4); - next.pig_head.scale = Vec3::one() / 10.5; - - next.pig_chest.offset = Vec3::new(0.0, -9.0, 1.5) / 11.0; - next.pig_chest.ori = Quaternion::rotation_x(0.0); - next.pig_chest.scale = Vec3::one() / 11.0; - - next.pig_leg_lf.offset = Vec3::new(-4.5, 3.0, 1.5) / 11.0; - next.pig_leg_lf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3); - next.pig_leg_lf.scale = Vec3::one() / 11.0; - - next.pig_leg_rf.offset = Vec3::new(2.5, 3.0, 1.5) / 11.0; - next.pig_leg_rf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3); - next.pig_leg_rf.scale = Vec3::one() / 11.0; - - next.pig_leg_lb.offset = Vec3::new(-4.5, -4.0, 2.0) / 11.0; - next.pig_leg_lb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3); - next.pig_leg_lb.scale = Vec3::one() / 11.0; - - next.pig_leg_rb.offset = Vec3::new(2.5, -4.0, 2.0) / 11.0; - next.pig_leg_rb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3); - next.pig_leg_rb.scale = Vec3::one() / 11.0; - - next - } -} diff --git a/voxygen/src/anim/quadruped/mod.rs b/voxygen/src/anim/quadruped/mod.rs deleted file mode 100644 index 662c641b38..0000000000 --- a/voxygen/src/anim/quadruped/mod.rs +++ /dev/null @@ -1,66 +0,0 @@ -pub mod idle; -pub mod jump; -pub mod run; - -// Reexports -pub use self::idle::IdleAnimation; -pub use self::jump::JumpAnimation; -pub use self::run::RunAnimation; - -use super::{Bone, Skeleton}; -use crate::render::FigureBoneData; - -#[derive(Clone)] -pub struct QuadrupedSkeleton { - pig_head: Bone, - pig_chest: Bone, - pig_leg_lf: Bone, - pig_leg_rf: Bone, - pig_leg_lb: Bone, - pig_leg_rb: Bone, -} - -impl QuadrupedSkeleton { - pub fn new() -> Self { - Self { - pig_head: Bone::default(), - pig_chest: Bone::default(), - pig_leg_lf: Bone::default(), - pig_leg_rf: Bone::default(), - pig_leg_lb: Bone::default(), - pig_leg_rb: Bone::default(), - } - } -} - -impl Skeleton for QuadrupedSkeleton { - fn compute_matrices(&self) -> [FigureBoneData; 16] { - [ - FigureBoneData::new(self.pig_head.compute_base_matrix()), - FigureBoneData::new(self.pig_chest.compute_base_matrix()), - FigureBoneData::new(self.pig_leg_lf.compute_base_matrix()), - FigureBoneData::new(self.pig_leg_rf.compute_base_matrix()), - FigureBoneData::new(self.pig_leg_lb.compute_base_matrix()), - FigureBoneData::new(self.pig_leg_rb.compute_base_matrix()), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - ] - } - - fn interpolate(&mut self, target: &Self, dt: f32) { - self.pig_head.interpolate(&target.pig_head, dt); - self.pig_chest.interpolate(&target.pig_chest, dt); - self.pig_leg_lf.interpolate(&target.pig_leg_lf, dt); - self.pig_leg_rf.interpolate(&target.pig_leg_rf, dt); - self.pig_leg_lb.interpolate(&target.pig_leg_lb, dt); - self.pig_leg_rb.interpolate(&target.pig_leg_rb, dt); - } -} diff --git a/voxygen/src/anim/quadruped_medium/idle.rs b/voxygen/src/anim/quadruped_medium/idle.rs new file mode 100644 index 0000000000..54affc86f8 --- /dev/null +++ b/voxygen/src/anim/quadruped_medium/idle.rs @@ -0,0 +1,100 @@ +use super::{ + super::{Animation, SkeletonAttr}, + QuadrupedMediumSkeleton, +}; +use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct IdleAnimation; + +impl Animation for IdleAnimation { + type Skeleton = QuadrupedMediumSkeleton; + type Dependency = (f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + global_time: Self::Dependency, + anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); + let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos(); + let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); + let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); + + let look = Vec2::new( + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(7331.0) + .sin() + * 0.5, + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(1337.0) + .sin() + * 0.25, + ); + let tailmove = Vec2::new( + ((global_time + anim_time) as f32 / 2.0) + .floor() + .mul(7331.0) + .sin() + * 0.25, + ((global_time + anim_time) as f32 / 2.0) + .floor() + .mul(1337.0) + .sin() + * 0.125, + ); + + next.head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_ultra_slow * 0.4) / 11.0; + next.head_upper.ori = Quaternion::rotation_z(look.x) * Quaternion::rotation_x(look.y); + next.head_upper.scale = Vec3::one() / 10.88; + + next.jaw.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0 + wave_slow * 0.2); + next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05); + next.jaw.scale = Vec3::one() * 1.01; + + next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_ultra_slow * 0.20); + next.head_lower.ori = Quaternion::rotation_z(0.0); + next.head_lower.scale = Vec3::one() * 0.98; + + next.tail.offset = Vec3::new(0.0, -13.0, 8.0 + wave_ultra_slow * 1.2) / 11.0; + next.tail.ori = Quaternion::rotation_z(0.0 + wave_slow * 0.2 + tailmove.x) + * Quaternion::rotation_x(tailmove.y); + next.tail.scale = Vec3::one() / 11.0; + + next.torso_back.offset = Vec3::new(0.0, -11.7, 11.0 + wave_ultra_slow * 1.2) / 11.0; + next.torso_back.ori = Quaternion::rotation_y(wave_slow_cos * 0.015); + next.torso_back.scale = Vec3::one() / 11.0; + + next.torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_ultra_slow * 0.7) / 11.0; + next.torso_mid.ori = Quaternion::rotation_y(wave_slow * 0.015); + next.torso_mid.scale = Vec3::one() / 10.5; + + next.ears.offset = Vec3::new(0.0, 0.75, 5.25); + next.ears.ori = Quaternion::rotation_x(0.0 + wave_slow * 0.1); + next.ears.scale = Vec3::one() * 1.05; + + next.foot_lf.offset = Vec3::new(-5.0, 5.0, 2.5) / 11.0; + next.foot_lf.ori = Quaternion::rotation_x(0.0); + next.foot_lf.scale = Vec3::one() / 11.0; + + next.foot_rf.offset = Vec3::new(5.0, 5.0, 2.5) / 11.0; + next.foot_rf.ori = Quaternion::rotation_x(0.0); + next.foot_rf.scale = Vec3::one() / 11.0; + + next.foot_lb.offset = Vec3::new(-5.0, -10.0, 2.5) / 11.0; + next.foot_lb.ori = Quaternion::rotation_x(0.0); + next.foot_lb.scale = Vec3::one() / 11.0; + + next.foot_rb.offset = Vec3::new(5.0, -10.0, 2.5) / 11.0; + next.foot_rb.ori = Quaternion::rotation_x(0.0); + next.foot_rb.scale = Vec3::one() / 11.0; + + next + } +} diff --git a/voxygen/src/anim/quadruped_medium/jump.rs b/voxygen/src/anim/quadruped_medium/jump.rs new file mode 100644 index 0000000000..d262a85067 --- /dev/null +++ b/voxygen/src/anim/quadruped_medium/jump.rs @@ -0,0 +1,76 @@ +use super::{ + super::{Animation, SkeletonAttr}, + QuadrupedMediumSkeleton, +}; +use std::f32::consts::PI; +use vek::*; + +pub struct JumpAnimation; + +impl Animation for JumpAnimation { + type Skeleton = QuadrupedMediumSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + _global_time: Self::Dependency, + anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let wave = (anim_time as f32 * 14.0).sin(); + let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); + let wave_stop = (anim_time as f32 * 5.0).min(PI / 2.0).sin(); + + next.head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) / 11.0; + next.head_upper.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25); + next.head_upper.scale = Vec3::one() / 10.88; + + next.jaw.offset = Vec3::new(0.0, 4.5, 2.0); + next.jaw.ori = Quaternion::rotation_x(0.0); + next.jaw.scale = Vec3::one() * 1.01; + + next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5); + next.head_lower.ori = Quaternion::rotation_x(wave_stop * -0.1); + next.head_lower.scale = Vec3::one() * 0.98; + + next.tail.offset = Vec3::new(0.0, -12.0, 8.0) / 11.0; + next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25); + next.tail.scale = Vec3::one() / 11.0; + + next.torso_back.offset = + Vec3::new(0.0, -9.5 + wave_stop * 1.0, 11.0 + wave_stop * 2.2) / 11.0; + next.torso_back.ori = Quaternion::rotation_x(wave_slow * -0.25); + next.torso_back.scale = Vec3::one() / 11.0; + + next.torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_stop * 3.6) / 11.0; + next.torso_mid.ori = Quaternion::rotation_x(wave_slow * -0.25); + next.torso_mid.scale = Vec3::one() / 10.5; + + next.ears.offset = Vec3::new(0.0, 0.75, 6.25); + next.ears.ori = Quaternion::rotation_x(0.0); + next.ears.scale = Vec3::one() * 1.05; + + next.foot_lf.offset = Vec3::new(-5.0, 5.0 + wave_stop * 3.0, 5.0 + wave_stop * 7.0) / 11.0; + next.foot_lf.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15); + next.foot_lf.scale = Vec3::one() / 11.0; + + next.foot_rf.offset = Vec3::new(5.0, 5.0 - wave_stop * 3.0, 5.0 + wave_stop * 5.0) / 11.0; + next.foot_rf.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15); + next.foot_rf.scale = Vec3::one() / 11.0; + + next.foot_lb.offset = + Vec3::new(-5.0, -10.0 - wave_stop * 2.0, 5.0 + wave_stop * 0.0) / 11.0; + next.foot_lb.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15); + next.foot_lb.scale = Vec3::one() / 11.0; + + next.foot_rb.offset = Vec3::new(5.0, -10.0 + wave_stop * 2.0, 5.0 + wave_stop * 2.0) / 11.0; + next.foot_rb.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15); + next.foot_rb.scale = Vec3::one() / 11.0; + + next + } +} diff --git a/voxygen/src/anim/quadruped_medium/mod.rs b/voxygen/src/anim/quadruped_medium/mod.rs new file mode 100644 index 0000000000..3f294968d8 --- /dev/null +++ b/voxygen/src/anim/quadruped_medium/mod.rs @@ -0,0 +1,85 @@ +pub mod idle; +pub mod jump; +pub mod run; + +// Reexports +pub use self::idle::IdleAnimation; +pub use self::jump::JumpAnimation; +pub use self::run::RunAnimation; + +use super::{Bone, Skeleton}; +use crate::render::FigureBoneData; + +#[derive(Clone)] +pub struct QuadrupedMediumSkeleton { + head_upper: Bone, + jaw: Bone, + head_lower: Bone, + tail: Bone, + torso_back: Bone, + torso_mid: Bone, + ears: Bone, + foot_lf: Bone, + foot_rf: Bone, + foot_lb: Bone, + foot_rb: Bone, +} + +impl QuadrupedMediumSkeleton { + pub fn new() -> Self { + Self { + head_upper: Bone::default(), + jaw: Bone::default(), + head_lower: Bone::default(), + tail: Bone::default(), + torso_back: Bone::default(), + torso_mid: Bone::default(), + ears: Bone::default(), + foot_lf: Bone::default(), + foot_rf: Bone::default(), + foot_lb: Bone::default(), + foot_rb: Bone::default(), + } + } +} + +impl Skeleton for QuadrupedMediumSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let ears_mat = self.ears.compute_base_matrix(); + let head_upper_mat = self.head_upper.compute_base_matrix(); + let head_lower_mat = self.head_lower.compute_base_matrix(); + + [ + FigureBoneData::new(head_upper_mat), + FigureBoneData::new(head_upper_mat * head_lower_mat * self.jaw.compute_base_matrix()), + FigureBoneData::new(head_upper_mat * head_lower_mat), + FigureBoneData::new(self.tail.compute_base_matrix()), + FigureBoneData::new(self.torso_back.compute_base_matrix()), + FigureBoneData::new(self.torso_mid.compute_base_matrix()), + FigureBoneData::new(head_upper_mat * ears_mat), + FigureBoneData::new(self.foot_lf.compute_base_matrix()), + FigureBoneData::new(self.foot_rf.compute_base_matrix()), + FigureBoneData::new(self.foot_lb.compute_base_matrix()), + FigureBoneData::new(self.foot_rb.compute_base_matrix()), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] + } + + fn interpolate(&mut self, target: &Self, dt: f32) { + self.head_upper.interpolate(&target.head_upper, dt); + self.jaw.interpolate(&target.jaw, dt); + self.head_lower.interpolate(&target.head_lower, dt); + self.tail.interpolate(&target.tail, dt); + self.torso_back.interpolate(&target.torso_back, dt); + self.torso_mid.interpolate(&target.torso_mid, dt); + self.ears.interpolate(&target.ears, dt); + self.foot_lf.interpolate(&target.foot_lf, dt); + self.foot_rf.interpolate(&target.foot_rf, dt); + self.foot_lb.interpolate(&target.foot_lb, dt); + self.foot_rb.interpolate(&target.foot_rb, dt); + } +} diff --git a/voxygen/src/anim/quadruped_medium/run.rs b/voxygen/src/anim/quadruped_medium/run.rs new file mode 100644 index 0000000000..6aea5b70b8 --- /dev/null +++ b/voxygen/src/anim/quadruped_medium/run.rs @@ -0,0 +1,98 @@ +use super::{ + super::{Animation, SkeletonAttr}, + QuadrupedMediumSkeleton, +}; +use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct RunAnimation; + +impl Animation for RunAnimation { + type Skeleton = QuadrupedMediumSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + (_velocity, global_time): Self::Dependency, + anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let wave = (anim_time as f32 * 14.0).sin(); + let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); + let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); + let wave_quick = (anim_time as f32 * 18.0).sin(); + let wave_med = (anim_time as f32 * 12.0).sin(); + let wave_med_cos = (anim_time as f32 * 12.0).cos(); + let wave_quick_cos = (anim_time as f32 * 18.0).cos(); + + let wolf_look = Vec2::new( + ((global_time + anim_time) as f32 / 4.0) + .floor() + .mul(7331.0) + .sin() + * 0.25, + ((global_time + anim_time) as f32 / 4.0) + .floor() + .mul(1337.0) + .sin() + * 0.125, + ); + + next.head_upper.offset = + Vec3::new(0.0, 9.5 + wave_quick_cos * 2.0, 15.0 + wave_med * 3.0) / 11.0; + next.head_upper.ori = Quaternion::rotation_x(-0.12 + wave_quick_cos * 0.12 + wolf_look.y) + * Quaternion::rotation_z(wolf_look.x); + next.head_upper.scale = Vec3::one() / 10.88; + + next.jaw.offset = Vec3::new(0.0, 4.5, 2.0 + wave_slow_cos * 1.0); + next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05); + next.jaw.scale = Vec3::one() * 1.01; + + next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_med * 1.0); + next.head_lower.ori = Quaternion::rotation_z(0.0); + next.head_lower.scale = Vec3::one() * 0.98; + + next.tail.offset = Vec3::new(0.0, -12.0, 10.0) / 11.0; + next.tail.ori = Quaternion::rotation_x(wave_quick * 0.18); + next.tail.scale = Vec3::one() / 11.0; + + next.torso_back.offset = + Vec3::new(0.0, -9.5 + wave_quick_cos * 2.2, 13.0 + wave_med * 2.8) / 11.0; + next.torso_back.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.14); + next.torso_back.scale = Vec3::one() / 11.0; + + next.torso_mid.offset = + Vec3::new(0.0, 0.0 + wave_quick_cos * 2.2, 14.0 + wave_med * 3.2) / 11.0; + next.torso_mid.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.12); + next.torso_mid.scale = Vec3::one() / 10.5; + + next.ears.offset = Vec3::new(0.0, 0.75 + wave * 0.4, 6.25); + next.ears.ori = Quaternion::rotation_x(wave * 0.2); + next.ears.scale = Vec3::one() * 1.05; + + next.foot_lf.offset = + Vec3::new(-5.0, 5.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0; + next.foot_lf.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8); + next.foot_lf.scale = Vec3::one() / 11.0; + + next.foot_rf.offset = + Vec3::new(5.0, 5.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0; + next.foot_rf.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8); + next.foot_rf.scale = Vec3::one() / 11.0; + + next.foot_lb.offset = + Vec3::new(-5.0, -10.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0; + next.foot_lb.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8); + next.foot_lb.scale = Vec3::one() / 11.0; + + next.foot_rb.offset = + Vec3::new(5.0, -10.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0; + next.foot_rb.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8); + next.foot_rb.scale = Vec3::one() / 11.0; + + next + } +} diff --git a/voxygen/src/anim/quadruped_small/idle.rs b/voxygen/src/anim/quadruped_small/idle.rs new file mode 100644 index 0000000000..a8410db858 --- /dev/null +++ b/voxygen/src/anim/quadruped_small/idle.rs @@ -0,0 +1,67 @@ +use super::{ + super::{Animation, SkeletonAttr}, + QuadrupedSmallSkeleton, +}; +use std::{f32::consts::PI, ops::Mul}; +use vek::*; + +pub struct IdleAnimation; + +impl Animation for IdleAnimation { + type Skeleton = QuadrupedSmallSkeleton; + type Dependency = (f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + global_time: Self::Dependency, + anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let wave = (anim_time as f32 * 14.0).sin(); + let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); + let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); + + let pig_head_look = Vec2::new( + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(7331.0) + .sin() + * 0.5, + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(1337.0) + .sin() + * 0.25, + ); + + next.head.offset = Vec3::new(0.0, -2.0, -1.5 + wave * 0.2) / 11.0; + next.head.ori = Quaternion::rotation_z(pig_head_look.x) + * Quaternion::rotation_x(pig_head_look.y + wave_slow_cos * 0.03); + next.head.scale = Vec3::one() / 10.5; + + next.chest.offset = Vec3::new(wave_slow * 0.05, -9.0, 1.5 + wave_slow_cos * 0.4) / 11.0; + next.chest.ori = Quaternion::rotation_y(wave_slow * 0.05); + next.chest.scale = Vec3::one() / 11.0; + + next.leg_lf.offset = Vec3::new(-4.5, 2.0, 1.5) / 11.0; + next.leg_lf.ori = Quaternion::rotation_x(wave_slow * 0.08); + next.leg_lf.scale = Vec3::one() / 11.0; + + next.leg_rf.offset = Vec3::new(2.5, 2.0, 1.5) / 11.0; + next.leg_rf.ori = Quaternion::rotation_x(wave_slow_cos * 0.08); + next.leg_rf.scale = Vec3::one() / 11.0; + + next.leg_lb.offset = Vec3::new(-4.5, -3.0, 1.5) / 11.0; + next.leg_lb.ori = Quaternion::rotation_x(wave_slow_cos * 0.08); + next.leg_lb.scale = Vec3::one() / 11.0; + + next.leg_rb.offset = Vec3::new(2.5, -3.0, 1.5) / 11.0; + next.leg_rb.ori = Quaternion::rotation_x(wave_slow * 0.08); + next.leg_rb.scale = Vec3::one() / 11.0; + + next + } +} diff --git a/voxygen/src/anim/quadruped_small/jump.rs b/voxygen/src/anim/quadruped_small/jump.rs new file mode 100644 index 0000000000..11d38973b4 --- /dev/null +++ b/voxygen/src/anim/quadruped_small/jump.rs @@ -0,0 +1,52 @@ +use super::{ + super::{Animation, SkeletonAttr}, + QuadrupedSmallSkeleton, +}; +use std::f32::consts::PI; +use vek::*; + +pub struct JumpAnimation; + +impl Animation for JumpAnimation { + type Skeleton = QuadrupedSmallSkeleton; + type Dependency = (f32, f64); + + fn update_skeleton( + skeleton: &Self::Skeleton, + (_velocity, _global_time): Self::Dependency, + anim_time: f64, + _rate: &mut f32, + _skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let wave_slow = (anim_time as f32 * 7.0 + PI).sin(); + let wave_stop = (anim_time as f32 * 4.5).min(PI / 2.0).sin(); + + next.head.offset = Vec3::new(0.0, 0.0, -1.5) / 11.0; + next.head.ori = Quaternion::rotation_x(wave_stop * 0.4); + next.head.scale = Vec3::one() / 10.5; + + next.chest.offset = Vec3::new(0.0, -9.0, 1.5) / 11.0; + next.chest.ori = Quaternion::rotation_x(0.0); + next.chest.scale = Vec3::one() / 11.0; + + next.leg_lf.offset = Vec3::new(-4.5, 3.0, 1.5) / 11.0; + next.leg_lf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3); + next.leg_lf.scale = Vec3::one() / 11.0; + + next.leg_rf.offset = Vec3::new(2.5, 3.0, 1.5) / 11.0; + next.leg_rf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3); + next.leg_rf.scale = Vec3::one() / 11.0; + + next.leg_lb.offset = Vec3::new(-4.5, -4.0, 2.0) / 11.0; + next.leg_lb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3); + next.leg_lb.scale = Vec3::one() / 11.0; + + next.leg_rb.offset = Vec3::new(2.5, -4.0, 2.0) / 11.0; + next.leg_rb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3); + next.leg_rb.scale = Vec3::one() / 11.0; + + next + } +} diff --git a/voxygen/src/anim/quadruped_small/mod.rs b/voxygen/src/anim/quadruped_small/mod.rs new file mode 100644 index 0000000000..600bb9d2ba --- /dev/null +++ b/voxygen/src/anim/quadruped_small/mod.rs @@ -0,0 +1,66 @@ +pub mod idle; +pub mod jump; +pub mod run; + +// Reexports +pub use self::idle::IdleAnimation; +pub use self::jump::JumpAnimation; +pub use self::run::RunAnimation; + +use super::{Bone, Skeleton}; +use crate::render::FigureBoneData; + +#[derive(Clone)] +pub struct QuadrupedSmallSkeleton { + head: Bone, + chest: Bone, + leg_lf: Bone, + leg_rf: Bone, + leg_lb: Bone, + leg_rb: Bone, +} + +impl QuadrupedSmallSkeleton { + pub fn new() -> Self { + Self { + head: Bone::default(), + chest: Bone::default(), + leg_lf: Bone::default(), + leg_rf: Bone::default(), + leg_lb: Bone::default(), + leg_rb: Bone::default(), + } + } +} + +impl Skeleton for QuadrupedSmallSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + [ + FigureBoneData::new(self.head.compute_base_matrix()), + FigureBoneData::new(self.chest.compute_base_matrix()), + FigureBoneData::new(self.leg_lf.compute_base_matrix()), + FigureBoneData::new(self.leg_rf.compute_base_matrix()), + FigureBoneData::new(self.leg_lb.compute_base_matrix()), + FigureBoneData::new(self.leg_rb.compute_base_matrix()), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] + } + + fn interpolate(&mut self, target: &Self, dt: f32) { + self.head.interpolate(&target.head, dt); + self.chest.interpolate(&target.chest, dt); + self.leg_lf.interpolate(&target.leg_lf, dt); + self.leg_rf.interpolate(&target.leg_rf, dt); + self.leg_lb.interpolate(&target.leg_lb, dt); + self.leg_rb.interpolate(&target.leg_rb, dt); + } +} diff --git a/voxygen/src/anim/quadruped/run.rs b/voxygen/src/anim/quadruped_small/run.rs similarity index 51% rename from voxygen/src/anim/quadruped/run.rs rename to voxygen/src/anim/quadruped_small/run.rs index f43863a063..c5af0a7af8 100644 --- a/voxygen/src/anim/quadruped/run.rs +++ b/voxygen/src/anim/quadruped_small/run.rs @@ -1,13 +1,13 @@ use super::{ super::{Animation, SkeletonAttr}, - QuadrupedSkeleton, + QuadrupedSmallSkeleton, }; use vek::*; pub struct RunAnimation; impl Animation for RunAnimation { - type Skeleton = QuadrupedSkeleton; + type Skeleton = QuadrupedSmallSkeleton; type Dependency = (f32, f64); fn update_skeleton( @@ -24,34 +24,34 @@ impl Animation for RunAnimation { let wave_quick_cos = (anim_time as f32 * 20.0).cos(); let wave_cos = (anim_time as f32 * 14.0).cos(); - next.pig_head.offset = Vec3::new(0.0, 0.0, -1.5 + wave * 1.5) / 11.0; - next.pig_head.ori = + next.head.offset = Vec3::new(0.0, 0.0, -1.5 + wave * 1.5) / 11.0; + next.head.ori = Quaternion::rotation_x(0.2 + wave * 0.05) * Quaternion::rotation_y(wave_cos * 0.03); - next.pig_head.scale = Vec3::one() / 10.5; + next.head.scale = Vec3::one() / 10.5; - next.pig_chest.offset = Vec3::new(0.0, -9.0, 1.5 + wave_cos * 1.2) / 11.0; - next.pig_chest.ori = Quaternion::rotation_x(wave * 0.1); - next.pig_chest.scale = Vec3::one() / 11.0; + next.chest.offset = Vec3::new(0.0, -9.0, 1.5 + wave_cos * 1.2) / 11.0; + next.chest.ori = Quaternion::rotation_x(wave * 0.1); + next.chest.scale = Vec3::one() / 11.0; - next.pig_leg_lf.offset = + next.leg_lf.offset = Vec3::new(-4.5, 2.0 + wave_quick * 0.8, 2.5 + wave_quick_cos * 1.5) / 11.0; - next.pig_leg_lf.ori = Quaternion::rotation_x(wave_quick * 0.3); - next.pig_leg_lf.scale = Vec3::one() / 11.0; + next.leg_lf.ori = Quaternion::rotation_x(wave_quick * 0.3); + next.leg_lf.scale = Vec3::one() / 11.0; - next.pig_leg_rf.offset = + next.leg_rf.offset = Vec3::new(2.5, 2.0 - wave_quick_cos * 0.8, 2.5 + wave_quick * 1.5) / 11.0; - next.pig_leg_rf.ori = Quaternion::rotation_x(wave_quick_cos * -0.3); - next.pig_leg_rf.scale = Vec3::one() / 11.0; + next.leg_rf.ori = Quaternion::rotation_x(wave_quick_cos * -0.3); + next.leg_rf.scale = Vec3::one() / 11.0; - next.pig_leg_lb.offset = + next.leg_lb.offset = Vec3::new(-4.5, -3.0 - wave_quick_cos * 0.8, 2.5 + wave_quick * 1.5) / 11.0; - next.pig_leg_lb.ori = Quaternion::rotation_x(wave_quick_cos * -0.3); - next.pig_leg_lb.scale = Vec3::one() / 11.0; + next.leg_lb.ori = Quaternion::rotation_x(wave_quick_cos * -0.3); + next.leg_lb.scale = Vec3::one() / 11.0; - next.pig_leg_rb.offset = + next.leg_rb.offset = Vec3::new(2.5, -3.0 + wave_quick * 0.8, 2.5 + wave_quick_cos * 1.5) / 11.0; - next.pig_leg_rb.ori = Quaternion::rotation_x(wave_quick * 0.3); - next.pig_leg_rb.scale = Vec3::one() / 11.0; + next.leg_rb.ori = Quaternion::rotation_x(wave_quick * 0.3); + next.leg_rb.scale = Vec3::one() / 11.0; next } diff --git a/voxygen/src/anim/quadrupedmedium/idle.rs b/voxygen/src/anim/quadrupedmedium/idle.rs deleted file mode 100644 index 63c1bcd97e..0000000000 --- a/voxygen/src/anim/quadrupedmedium/idle.rs +++ /dev/null @@ -1,102 +0,0 @@ -use super::{ - super::{Animation, SkeletonAttr}, - QuadrupedMediumSkeleton, -}; -use std::{f32::consts::PI, ops::Mul}; -use vek::*; - -pub struct IdleAnimation; - -impl Animation for IdleAnimation { - type Skeleton = QuadrupedMediumSkeleton; - type Dependency = (f64); - - fn update_skeleton( - skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, - _rate: &mut f32, - _skeleton_attr: &SkeletonAttr, - ) -> Self::Skeleton { - let mut next = (*skeleton).clone(); - - let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); - let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos(); - let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); - let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - - let wolf_look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, - ); - let wolf_tail = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 0.25, - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(1337.0) - .sin() - * 0.125, - ); - - next.wolf_head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_ultra_slow * 0.4) / 11.0; - next.wolf_head_upper.ori = - Quaternion::rotation_z(wolf_look.x) * Quaternion::rotation_x(wolf_look.y); - next.wolf_head_upper.scale = Vec3::one() / 10.88; - - next.wolf_jaw.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0 + wave_slow * 0.2); - next.wolf_jaw.ori = Quaternion::rotation_x(wave_slow * 0.05); - next.wolf_jaw.scale = Vec3::one() * 1.01; - - next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_ultra_slow * 0.20); - next.wolf_head_lower.ori = Quaternion::rotation_z(0.0); - next.wolf_head_lower.scale = Vec3::one() * 0.98; - - next.wolf_tail.offset = Vec3::new(0.0, -13.0, 8.0 + wave_ultra_slow * 1.2) / 11.0; - next.wolf_tail.ori = Quaternion::rotation_z(0.0 + wave_slow * 0.2 + wolf_tail.x) - * Quaternion::rotation_x(wolf_tail.y); - next.wolf_tail.scale = Vec3::one() / 11.0; - - next.wolf_torso_back.offset = Vec3::new(0.0, -11.7, 11.0 + wave_ultra_slow * 1.2) / 11.0; - next.wolf_torso_back.ori = Quaternion::rotation_y(wave_slow_cos * 0.015); - next.wolf_torso_back.scale = Vec3::one() / 11.0; - - next.wolf_torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_ultra_slow * 0.7) / 11.0; - next.wolf_torso_mid.ori = Quaternion::rotation_y(wave_slow * 0.015); - next.wolf_torso_mid.scale = Vec3::one() / 10.5; - - next.wolf_ears.offset = Vec3::new(0.0, 0.75, 5.25); - next.wolf_ears.ori = Quaternion::rotation_x(0.0 + wave_slow * 0.1); - next.wolf_ears.scale = Vec3::one() * 1.05; - - next.wolf_foot_lf.offset = Vec3::new(-5.0, 5.0, 2.5) / 11.0; - next.wolf_foot_lf.ori = Quaternion::rotation_x(0.0); - next.wolf_foot_lf.scale = Vec3::one() / 11.0; - - next.wolf_foot_rf.offset = Vec3::new(5.0, 5.0, 2.5) / 11.0; - next.wolf_foot_rf.ori = Quaternion::rotation_x(0.0); - next.wolf_foot_rf.scale = Vec3::one() / 11.0; - - next.wolf_foot_lb.offset = Vec3::new(-5.0, -10.0, 2.5) / 11.0; - next.wolf_foot_lb.ori = Quaternion::rotation_x(0.0); - next.wolf_foot_lb.scale = Vec3::one() / 11.0; - - next.wolf_foot_rb.offset = Vec3::new(5.0, -10.0, 2.5) / 11.0; - next.wolf_foot_rb.ori = Quaternion::rotation_x(0.0); - next.wolf_foot_rb.scale = Vec3::one() / 11.0; - - next - } -} diff --git a/voxygen/src/anim/quadrupedmedium/jump.rs b/voxygen/src/anim/quadrupedmedium/jump.rs deleted file mode 100644 index 06f93aa6f7..0000000000 --- a/voxygen/src/anim/quadrupedmedium/jump.rs +++ /dev/null @@ -1,80 +0,0 @@ -use super::{ - super::{Animation, SkeletonAttr}, - QuadrupedMediumSkeleton, -}; -use std::f32::consts::PI; -use vek::*; - -pub struct JumpAnimation; - -impl Animation for JumpAnimation { - type Skeleton = QuadrupedMediumSkeleton; - type Dependency = (f32, f64); - - fn update_skeleton( - skeleton: &Self::Skeleton, - _global_time: Self::Dependency, - anim_time: f64, - _rate: &mut f32, - _skeleton_attr: &SkeletonAttr, - ) -> Self::Skeleton { - let mut next = (*skeleton).clone(); - - let wave = (anim_time as f32 * 14.0).sin(); - let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); - let wave_stop = (anim_time as f32 * 5.0).min(PI / 2.0).sin(); - - next.wolf_head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) / 11.0; - next.wolf_head_upper.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25); - next.wolf_head_upper.scale = Vec3::one() / 10.88; - - next.wolf_jaw.offset = Vec3::new(0.0, 4.5, 2.0); - next.wolf_jaw.ori = Quaternion::rotation_x(0.0); - next.wolf_jaw.scale = Vec3::one() * 1.01; - - next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5); - next.wolf_head_lower.ori = Quaternion::rotation_x(wave_stop * -0.1); - next.wolf_head_lower.scale = Vec3::one() * 0.98; - - next.wolf_tail.offset = Vec3::new(0.0, -12.0, 8.0) / 11.0; - next.wolf_tail.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25); - next.wolf_tail.scale = Vec3::one() / 11.0; - - next.wolf_torso_back.offset = - Vec3::new(0.0, -9.5 + wave_stop * 1.0, 11.0 + wave_stop * 2.2) / 11.0; - next.wolf_torso_back.ori = Quaternion::rotation_x(wave_slow * -0.25); - next.wolf_torso_back.scale = Vec3::one() / 11.0; - - next.wolf_torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_stop * 3.6) / 11.0; - next.wolf_torso_mid.ori = Quaternion::rotation_x(wave_slow * -0.25); - next.wolf_torso_mid.scale = Vec3::one() / 10.5; - - next.wolf_ears.offset = Vec3::new(0.0, 0.75, 6.25); - next.wolf_ears.ori = Quaternion::rotation_x(0.0); - next.wolf_ears.scale = Vec3::one() * 1.05; - - next.wolf_foot_lf.offset = - Vec3::new(-5.0, 5.0 + wave_stop * 3.0, 5.0 + wave_stop * 7.0) / 11.0; - next.wolf_foot_lf.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15); - next.wolf_foot_lf.scale = Vec3::one() / 11.0; - - next.wolf_foot_rf.offset = - Vec3::new(5.0, 5.0 - wave_stop * 3.0, 5.0 + wave_stop * 5.0) / 11.0; - next.wolf_foot_rf.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15); - next.wolf_foot_rf.scale = Vec3::one() / 11.0; - - next.wolf_foot_lb.offset = - Vec3::new(-5.0, -10.0 - wave_stop * 2.0, 5.0 + wave_stop * 0.0) / 11.0; - next.wolf_foot_lb.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15); - next.wolf_foot_lb.scale = Vec3::one() / 11.0; - - next.wolf_foot_rb.offset = - Vec3::new(5.0, -10.0 + wave_stop * 2.0, 5.0 + wave_stop * 2.0) / 11.0; - next.wolf_foot_rb.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15); - next.wolf_foot_rb.scale = Vec3::one() / 11.0; - - next - } -} diff --git a/voxygen/src/anim/quadrupedmedium/mod.rs b/voxygen/src/anim/quadrupedmedium/mod.rs deleted file mode 100644 index 1941442eac..0000000000 --- a/voxygen/src/anim/quadrupedmedium/mod.rs +++ /dev/null @@ -1,90 +0,0 @@ -pub mod idle; -pub mod jump; -pub mod run; - -// Reexports -pub use self::idle::IdleAnimation; -pub use self::jump::JumpAnimation; -pub use self::run::RunAnimation; - -use super::{Bone, Skeleton}; -use crate::render::FigureBoneData; - -#[derive(Clone)] -pub struct QuadrupedMediumSkeleton { - wolf_head_upper: Bone, - wolf_jaw: Bone, - wolf_head_lower: Bone, - wolf_tail: Bone, - wolf_torso_back: Bone, - wolf_torso_mid: Bone, - wolf_ears: Bone, - wolf_foot_lf: Bone, - wolf_foot_rf: Bone, - wolf_foot_lb: Bone, - wolf_foot_rb: Bone, -} - -impl QuadrupedMediumSkeleton { - pub fn new() -> Self { - Self { - wolf_head_upper: Bone::default(), - wolf_jaw: Bone::default(), - wolf_head_lower: Bone::default(), - wolf_tail: Bone::default(), - wolf_torso_back: Bone::default(), - wolf_torso_mid: Bone::default(), - wolf_ears: Bone::default(), - wolf_foot_lf: Bone::default(), - wolf_foot_rf: Bone::default(), - wolf_foot_lb: Bone::default(), - wolf_foot_rb: Bone::default(), - } - } -} - -impl Skeleton for QuadrupedMediumSkeleton { - fn compute_matrices(&self) -> [FigureBoneData; 16] { - let ears_mat = self.wolf_ears.compute_base_matrix(); - let head_upper_mat = self.wolf_head_upper.compute_base_matrix(); - let head_lower_mat = self.wolf_head_lower.compute_base_matrix(); - - [ - FigureBoneData::new(head_upper_mat), - FigureBoneData::new( - head_upper_mat * head_lower_mat * self.wolf_jaw.compute_base_matrix(), - ), - FigureBoneData::new(head_upper_mat * head_lower_mat), - FigureBoneData::new(self.wolf_tail.compute_base_matrix()), - FigureBoneData::new(self.wolf_torso_back.compute_base_matrix()), - FigureBoneData::new(self.wolf_torso_mid.compute_base_matrix()), - FigureBoneData::new(head_upper_mat * ears_mat), - FigureBoneData::new(self.wolf_foot_lf.compute_base_matrix()), - FigureBoneData::new(self.wolf_foot_rf.compute_base_matrix()), - FigureBoneData::new(self.wolf_foot_lb.compute_base_matrix()), - FigureBoneData::new(self.wolf_foot_rb.compute_base_matrix()), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), - ] - } - - fn interpolate(&mut self, target: &Self, dt: f32) { - self.wolf_head_upper - .interpolate(&target.wolf_head_upper, dt); - self.wolf_jaw.interpolate(&target.wolf_jaw, dt); - self.wolf_head_lower - .interpolate(&target.wolf_head_lower, dt); - self.wolf_tail.interpolate(&target.wolf_tail, dt); - self.wolf_torso_back - .interpolate(&target.wolf_torso_back, dt); - self.wolf_torso_mid.interpolate(&target.wolf_torso_mid, dt); - self.wolf_ears.interpolate(&target.wolf_ears, dt); - self.wolf_foot_lf.interpolate(&target.wolf_foot_lf, dt); - self.wolf_foot_rf.interpolate(&target.wolf_foot_rf, dt); - self.wolf_foot_lb.interpolate(&target.wolf_foot_lb, dt); - self.wolf_foot_rb.interpolate(&target.wolf_foot_rb, dt); - } -} diff --git a/voxygen/src/anim/quadrupedmedium/run.rs b/voxygen/src/anim/quadrupedmedium/run.rs deleted file mode 100644 index 5acc6d4cd8..0000000000 --- a/voxygen/src/anim/quadrupedmedium/run.rs +++ /dev/null @@ -1,99 +0,0 @@ -use super::{ - super::{Animation, SkeletonAttr}, - QuadrupedMediumSkeleton, -}; -use std::{f32::consts::PI, ops::Mul}; -use vek::*; - -pub struct RunAnimation; - -impl Animation for RunAnimation { - type Skeleton = QuadrupedMediumSkeleton; - type Dependency = (f32, f64); - - fn update_skeleton( - skeleton: &Self::Skeleton, - (_velocity, global_time): Self::Dependency, - anim_time: f64, - _rate: &mut f32, - _skeleton_attr: &SkeletonAttr, - ) -> Self::Skeleton { - let mut next = (*skeleton).clone(); - - let wave = (anim_time as f32 * 14.0).sin(); - let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); - let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - let wave_quick = (anim_time as f32 * 18.0).sin(); - let wave_med = (anim_time as f32 * 12.0).sin(); - let wave_med_cos = (anim_time as f32 * 12.0).cos(); - let wave_quick_cos = (anim_time as f32 * 18.0).cos(); - - let wolf_look = Vec2::new( - ((global_time + anim_time) as f32 / 4.0) - .floor() - .mul(7331.0) - .sin() - * 0.25, - ((global_time + anim_time) as f32 / 4.0) - .floor() - .mul(1337.0) - .sin() - * 0.125, - ); - - next.wolf_head_upper.offset = - Vec3::new(0.0, 9.5 + wave_quick_cos * 2.0, 15.0 + wave_med * 3.0) / 11.0; - next.wolf_head_upper.ori = - Quaternion::rotation_x(-0.12 + wave_quick_cos * 0.12 + wolf_look.y) - * Quaternion::rotation_z(wolf_look.x); - next.wolf_head_upper.scale = Vec3::one() / 10.88; - - next.wolf_jaw.offset = Vec3::new(0.0, 4.5, 2.0 + wave_slow_cos * 1.0); - next.wolf_jaw.ori = Quaternion::rotation_x(wave_slow * 0.05); - next.wolf_jaw.scale = Vec3::one() * 1.01; - - next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_med * 1.0); - next.wolf_head_lower.ori = Quaternion::rotation_z(0.0); - next.wolf_head_lower.scale = Vec3::one() * 0.98; - - next.wolf_tail.offset = Vec3::new(0.0, -12.0, 10.0) / 11.0; - next.wolf_tail.ori = Quaternion::rotation_x(wave_quick * 0.18); - next.wolf_tail.scale = Vec3::one() / 11.0; - - next.wolf_torso_back.offset = - Vec3::new(0.0, -9.5 + wave_quick_cos * 2.2, 13.0 + wave_med * 2.8) / 11.0; - next.wolf_torso_back.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.14); - next.wolf_torso_back.scale = Vec3::one() / 11.0; - - next.wolf_torso_mid.offset = - Vec3::new(0.0, 0.0 + wave_quick_cos * 2.2, 14.0 + wave_med * 3.2) / 11.0; - next.wolf_torso_mid.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.12); - next.wolf_torso_mid.scale = Vec3::one() / 10.5; - - next.wolf_ears.offset = Vec3::new(0.0, 0.75 + wave * 0.4, 6.25); - next.wolf_ears.ori = Quaternion::rotation_x(wave * 0.2); - next.wolf_ears.scale = Vec3::one() * 1.05; - - next.wolf_foot_lf.offset = - Vec3::new(-5.0, 5.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0; - next.wolf_foot_lf.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8); - next.wolf_foot_lf.scale = Vec3::one() / 11.0; - - next.wolf_foot_rf.offset = - Vec3::new(5.0, 5.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0; - next.wolf_foot_rf.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8); - next.wolf_foot_rf.scale = Vec3::one() / 11.0; - - next.wolf_foot_lb.offset = - Vec3::new(-5.0, -10.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0; - next.wolf_foot_lb.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8); - next.wolf_foot_lb.scale = Vec3::one() / 11.0; - - next.wolf_foot_rb.offset = - Vec3::new(5.0, -10.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0; - next.wolf_foot_rb.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8); - next.wolf_foot_rb.scale = Vec3::one() / 11.0; - - next - } -} diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index 5063b50a14..eb3874c159 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -190,13 +190,13 @@ impl FigureModelCache { None, None, ], - Body::Quadruped(body) => [ - Some(mesh_pig_head(body.head)), - Some(mesh_pig_chest(body.chest)), - Some(mesh_pig_leg_lf(body.leg_l)), - Some(mesh_pig_leg_rf(body.leg_r)), - Some(mesh_pig_leg_lb(body.leg_l)), - Some(mesh_pig_leg_rb(body.leg_r)), + Body::QuadrupedSmall(body) => [ + Some(mesh_quadruped_small_head(body.head)), + Some(mesh_quadruped_small_chest(body.chest)), + Some(mesh_quadruped_small_leg_lf(body.leg_l)), + Some(mesh_quadruped_small_leg_rf(body.leg_r)), + Some(mesh_quadruped_small_leg_lb(body.leg_l)), + Some(mesh_quadruped_small_leg_rb(body.leg_r)), None, None, None, @@ -209,17 +209,125 @@ impl FigureModelCache { None, ], Body::QuadrupedMedium(body) => [ - Some(mesh_wolf_head_upper(body.head_upper)), - Some(mesh_wolf_jaw(body.jaw)), - Some(mesh_wolf_head_lower(body.head_lower)), - Some(mesh_wolf_tail(body.tail)), - Some(mesh_wolf_torso_back(body.torso_back)), - Some(mesh_wolf_torso_mid(body.torso_mid)), - Some(mesh_wolf_ears(body.ears)), - Some(mesh_wolf_foot_lf(body.foot_lf)), - Some(mesh_wolf_foot_rf(body.foot_rf)), - Some(mesh_wolf_foot_lb(body.foot_lb)), - Some(mesh_wolf_foot_rb(body.foot_rb)), + Some(mesh_quadruped_medium_head_upper(body.head_upper)), + Some(mesh_quadruped_medium_jaw(body.jaw)), + Some(mesh_quadruped_medium_head_lower(body.head_lower)), + Some(mesh_quadruped_medium_tail(body.tail)), + Some(mesh_quadruped_medium_torso_back(body.torso_back)), + Some(mesh_quadruped_medium_torso_mid(body.torso_mid)), + Some(mesh_quadruped_medium_ears(body.ears)), + Some(mesh_quadruped_medium_foot_lf(body.foot_lf)), + Some(mesh_quadruped_medium_foot_rf(body.foot_rf)), + Some(mesh_quadruped_medium_foot_lb(body.foot_lb)), + Some(mesh_quadruped_medium_foot_rb(body.foot_rb)), + None, + None, + None, + None, + None, + ], + Body::BirdMedium(body) => [ + Some(mesh_bird_medium_head(body.head)), + Some(mesh_bird_medium_torso(body.torso)), + Some(mesh_bird_medium_tail(body.tail)), + Some(mesh_bird_medium_wing_l(body.wing_l)), + Some(mesh_bird_medium_wing_r(body.wing_r)), + Some(mesh_bird_medium_leg_l(body.leg_l)), + Some(mesh_bird_medium_leg_r(body.leg_r)), + None, + None, + None, + None, + None, + None, + None, + None, + None, + ], + Body::FishMedium(body) => [ + Some(mesh_fish_medium_head(body.head)), + Some(mesh_fish_medium_torso(body.torso)), + Some(mesh_fish_medium_rear(body.rear)), + Some(mesh_fish_medium_tail(body.tail)), + Some(mesh_fish_medium_fin_l(body.fin_l)), + Some(mesh_fish_medium_fin_r(body.fin_r)), + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ], + Body::Dragon(body) => [ + Some(mesh_dragon_head(body.head)), + Some(mesh_dragon_chest_front(body.chest_front)), + Some(mesh_dragon_chest_rear(body.chest_rear)), + Some(mesh_dragon_tail_front(body.tail_front)), + Some(mesh_dragon_tail_rear(body.tail_rear)), + Some(mesh_dragon_wing_in_l(body.wing_in_l)), + Some(mesh_dragon_wing_in_r(body.wing_in_r)), + Some(mesh_dragon_wing_out_l(body.wing_out_l)), + Some(mesh_dragon_wing_out_r(body.wing_out_r)), + Some(mesh_dragon_foot_fl(body.foot_fl)), + Some(mesh_dragon_foot_fr(body.foot_fr)), + Some(mesh_dragon_foot_bl(body.foot_bl)), + Some(mesh_dragon_foot_br(body.foot_br)), + None, + None, + None, + ], + Body::BirdSmall(body) => [ + Some(mesh_bird_small_head(body.head)), + Some(mesh_bird_small_torso(body.torso)), + Some(mesh_bird_small_wing_l(body.wing_l)), + Some(mesh_bird_small_wing_r(body.wing_r)), + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ], + Body::FishSmall(body) => [ + Some(mesh_fish_small_torso(body.torso)), + Some(mesh_fish_small_tail(body.tail)), + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ], + Body::BipedLarge(body) => [ + Some(mesh_biped_large_head(body.head)), + Some(mesh_biped_large_upper_torso(body.upper_torso)), + Some(mesh_biped_large_lower_torso(body.lower_torso)), + Some(mesh_biped_large_shoulder_l(body.shoulder_l)), + Some(mesh_biped_large_shoulder_r(body.shoulder_r)), + Some(mesh_biped_large_hand_l(body.hand_l)), + Some(mesh_biped_large_hand_r(body.hand_r)), + Some(mesh_biped_large_leg_l(body.leg_l)), + Some(mesh_biped_large_leg_r(body.leg_r)), + Some(mesh_biped_large_foot_l(body.foot_l)), + Some(mesh_biped_large_foot_r(body.foot_r)), None, None, None, diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index b5783de10c..18a0656ea4 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -6,11 +6,12 @@ use common::comp::humanoid::Body; use common::{ assets::{self, watch::ReloadIndicator, Asset}, comp::{ + biped_large, bird_medium, bird_small, dragon, fish_medium, fish_small, humanoid::{ Belt, BodyType, Chest, EyeColor, Eyebrows, Foot, Hand, Pants, Race, Shoulder, Skin, }, item::Tool, - object, quadruped, quadruped_medium, Item, ItemKind, + object, quadruped_medium, quadruped_small, Item, ItemKind, }, figure::{DynaUnionizer, MatSegment, Material, Segment}, }; @@ -535,169 +536,557 @@ pub fn mesh_draw() -> Mesh { load_mesh("object.glider", Vec3::new(-26.0, -26.0, -5.0)) } -//pub fn mesh_right_equip(hand: Hand) -> Mesh { -// load_mesh( -// match hand { -// Hand::Default => "figure/body/hand", -// }, -// Vec3::new(-2.0, -2.5, -5.0), -// ) -//} - ///////// -pub fn mesh_pig_head(head: quadruped::Head) -> Mesh { +pub fn mesh_quadruped_small_head(head: quadruped_small::Head) -> Mesh { load_mesh( match head { - quadruped::Head::Default => "npc.pig_purple.pig_head", + quadruped_small::Head::Default => "npc.pig_purple.head", }, Vec3::new(-6.0, 4.5, 3.0), ) } -pub fn mesh_pig_chest(chest: quadruped::Chest) -> Mesh { +pub fn mesh_quadruped_small_chest(chest: quadruped_small::Chest) -> Mesh { load_mesh( match chest { - quadruped::Chest::Default => "npc.pig_purple.pig_chest", + quadruped_small::Chest::Default => "npc.pig_purple.chest", }, Vec3::new(-5.0, 4.5, 0.0), ) } -pub fn mesh_pig_leg_lf(leg_l: quadruped::LegL) -> Mesh { +pub fn mesh_quadruped_small_leg_lf(leg_l: quadruped_small::LegL) -> Mesh { load_mesh( match leg_l { - quadruped::LegL::Default => "npc.pig_purple.pig_leg_l", + quadruped_small::LegL::Default => "npc.pig_purple.leg_l", }, Vec3::new(0.0, -1.0, -1.5), ) } -pub fn mesh_pig_leg_rf(leg_r: quadruped::LegR) -> Mesh { +pub fn mesh_quadruped_small_leg_rf(leg_r: quadruped_small::LegR) -> Mesh { load_mesh( match leg_r { - quadruped::LegR::Default => "npc.pig_purple.pig_leg_r", + quadruped_small::LegR::Default => "npc.pig_purple.leg_r", }, Vec3::new(0.0, -1.0, -1.5), ) } -pub fn mesh_pig_leg_lb(leg_l: quadruped::LegL) -> Mesh { +pub fn mesh_quadruped_small_leg_lb(leg_l: quadruped_small::LegL) -> Mesh { load_mesh( match leg_l { - quadruped::LegL::Default => "npc.pig_purple.pig_leg_l", + quadruped_small::LegL::Default => "npc.pig_purple.leg_l", }, Vec3::new(0.0, -1.0, -1.5), ) } -pub fn mesh_pig_leg_rb(leg_r: quadruped::LegR) -> Mesh { +pub fn mesh_quadruped_small_leg_rb(leg_r: quadruped_small::LegR) -> Mesh { load_mesh( match leg_r { - quadruped::LegR::Default => "npc.pig_purple.pig_leg_r", + quadruped_small::LegR::Default => "npc.pig_purple.leg_r", }, Vec3::new(0.0, -1.0, -1.5), ) } ////// -pub fn mesh_wolf_head_upper(upper_head: quadruped_medium::HeadUpper) -> Mesh { +pub fn mesh_quadruped_medium_head_upper( + upper_head: quadruped_medium::HeadUpper, +) -> Mesh { load_mesh( match upper_head { - quadruped_medium::HeadUpper::Default => "npc.wolf.wolf_head_upper", + quadruped_medium::HeadUpper::Default => "npc.wolf.head_upper", }, Vec3::new(-7.0, -6.0, -5.5), ) } -pub fn mesh_wolf_jaw(jaw: quadruped_medium::Jaw) -> Mesh { +pub fn mesh_quadruped_medium_jaw(jaw: quadruped_medium::Jaw) -> Mesh { load_mesh( match jaw { - quadruped_medium::Jaw::Default => "npc.wolf.wolf_jaw", + quadruped_medium::Jaw::Default => "npc.wolf.jaw", }, Vec3::new(-3.0, -3.0, -2.5), ) } -pub fn mesh_wolf_head_lower(head_lower: quadruped_medium::HeadLower) -> Mesh { +pub fn mesh_quadruped_medium_head_lower( + head_lower: quadruped_medium::HeadLower, +) -> Mesh { load_mesh( match head_lower { - quadruped_medium::HeadLower::Default => "npc.wolf.wolf_head_lower", + quadruped_medium::HeadLower::Default => "npc.wolf.head_lower", }, Vec3::new(-7.0, -6.0, -5.5), ) } -pub fn mesh_wolf_tail(tail: quadruped_medium::Tail) -> Mesh { +pub fn mesh_quadruped_medium_tail(tail: quadruped_medium::Tail) -> Mesh { load_mesh( match tail { - quadruped_medium::Tail::Default => "npc.wolf.wolf_tail", + quadruped_medium::Tail::Default => "npc.wolf.tail", }, Vec3::new(-2.0, -12.0, -5.0), ) } -pub fn mesh_wolf_torso_back(torso_back: quadruped_medium::TorsoBack) -> Mesh { +pub fn mesh_quadruped_medium_torso_back( + torso_back: quadruped_medium::TorsoBack, +) -> Mesh { load_mesh( match torso_back { - quadruped_medium::TorsoBack::Default => "npc.wolf.wolf_torso_back", + quadruped_medium::TorsoBack::Default => "npc.wolf.torso_back", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_wolf_torso_mid(torso_mid: quadruped_medium::TorsoMid) -> Mesh { +pub fn mesh_quadruped_medium_torso_mid( + torso_mid: quadruped_medium::TorsoMid, +) -> Mesh { load_mesh( match torso_mid { - quadruped_medium::TorsoMid::Default => "npc.wolf.wolf_torso_mid", + quadruped_medium::TorsoMid::Default => "npc.wolf.torso_mid", }, Vec3::new(-8.0, -5.5, -6.0), ) } -pub fn mesh_wolf_ears(ears: quadruped_medium::Ears) -> Mesh { +pub fn mesh_quadruped_medium_ears(ears: quadruped_medium::Ears) -> Mesh { load_mesh( match ears { - quadruped_medium::Ears::Default => "npc.wolf.wolf_ears", + quadruped_medium::Ears::Default => "npc.wolf.ears", }, Vec3::new(-4.0, -1.0, -1.0), ) } -pub fn mesh_wolf_foot_lf(foot_lf: quadruped_medium::FootLF) -> Mesh { +pub fn mesh_quadruped_medium_foot_lf(foot_lf: quadruped_medium::FootLF) -> Mesh { load_mesh( match foot_lf { - quadruped_medium::FootLF::Default => "npc.wolf.wolf_foot_lf", + quadruped_medium::FootLF::Default => "npc.wolf.foot_lf", }, Vec3::new(-2.5, -4.0, -2.5), ) } -pub fn mesh_wolf_foot_rf(foot_rf: quadruped_medium::FootRF) -> Mesh { +pub fn mesh_quadruped_medium_foot_rf(foot_rf: quadruped_medium::FootRF) -> Mesh { load_mesh( match foot_rf { - quadruped_medium::FootRF::Default => "npc.wolf.wolf_foot_rf", + quadruped_medium::FootRF::Default => "npc.wolf.foot_rf", }, Vec3::new(-2.5, -4.0, -2.5), ) } -pub fn mesh_wolf_foot_lb(foot_lb: quadruped_medium::FootLB) -> Mesh { +pub fn mesh_quadruped_medium_foot_lb(foot_lb: quadruped_medium::FootLB) -> Mesh { load_mesh( match foot_lb { - quadruped_medium::FootLB::Default => "npc.wolf.wolf_foot_lb", + quadruped_medium::FootLB::Default => "npc.wolf.foot_lb", }, Vec3::new(-2.5, -4.0, -2.5), ) } -pub fn mesh_wolf_foot_rb(foot_rb: quadruped_medium::FootRB) -> Mesh { +pub fn mesh_quadruped_medium_foot_rb(foot_rb: quadruped_medium::FootRB) -> Mesh { load_mesh( match foot_rb { - quadruped_medium::FootRB::Default => "npc.wolf.wolf_foot_rb", + quadruped_medium::FootRB::Default => "npc.wolf.foot_rb", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} +//// +pub fn mesh_bird_medium_head(head: bird_medium::Head) -> Mesh { + load_mesh( + match head { + bird_medium::Head::Default => "npc.duck_m.head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_bird_medium_torso(torso: bird_medium::Torso) -> Mesh { + load_mesh( + match torso { + bird_medium::Torso::Default => "npc.duck_m.body", + }, + Vec3::new(-8.0, -5.5, -6.0), + ) +} + +pub fn mesh_bird_medium_tail(tail: bird_medium::Tail) -> Mesh { + load_mesh( + match tail { + bird_medium::Tail::Default => "npc.duck_m.tail", + }, + Vec3::new(-4.0, -1.0, -1.0), + ) +} + +pub fn mesh_bird_medium_wing_l(wing_l: bird_medium::WingL) -> Mesh { + load_mesh( + match wing_l { + bird_medium::WingL::Default => "npc.duck_m.wing", }, Vec3::new(-2.5, -4.0, -2.5), ) } +pub fn mesh_bird_medium_wing_r(wing_r: bird_medium::WingR) -> Mesh { + load_mesh( + match wing_r { + bird_medium::WingR::Default => "npc.duck_m.wing", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} + +pub fn mesh_bird_medium_leg_l(leg_l: bird_medium::LegL) -> Mesh { + load_mesh( + match leg_l { + bird_medium::LegL::Default => "npc.duck_m.leg_l", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} + +pub fn mesh_bird_medium_leg_r(leg_r: bird_medium::LegR) -> Mesh { + load_mesh( + match leg_r { + bird_medium::LegR::Default => "npc.duck_m.leg_r", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} +//// +pub fn mesh_fish_medium_head(head: fish_medium::Head) -> Mesh { + load_mesh( + match head { + fish_medium::Head::Default => "npc.marlin.head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_fish_medium_torso(torso: fish_medium::Torso) -> Mesh { + load_mesh( + match torso { + fish_medium::Torso::Default => "npc.marlin.torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_fish_medium_rear(rear: fish_medium::Rear) -> Mesh { + load_mesh( + match rear { + fish_medium::Rear::Default => "npc.marlin.rear", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_fish_medium_tail(tail: fish_medium::Tail) -> Mesh { + load_mesh( + match tail { + fish_medium::Tail::Default => "npc.marlin.tail", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_fish_medium_fin_l(fin_l: fish_medium::FinL) -> Mesh { + load_mesh( + match fin_l { + fish_medium::FinL::Default => "npc.marlin.fin_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_fish_medium_fin_r(fin_r: fish_medium::FinR) -> Mesh { + load_mesh( + match fin_r { + fish_medium::FinR::Default => "npc.marlin.fin_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} +//// +pub fn mesh_dragon_head(head: dragon::Head) -> Mesh { + load_mesh( + match head { + dragon::Head::Default => "npc.dragon.head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_chest_front(chest_front: dragon::ChestFront) -> Mesh { + load_mesh( + match chest_front { + dragon::ChestFront::Default => "npc.dragon.chest_front", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_chest_rear(chest_rear: dragon::ChestRear) -> Mesh { + load_mesh( + match chest_rear { + dragon::ChestRear::Default => "npc.dragon.chest_rear", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_tail_front(tail_front: dragon::TailFront) -> Mesh { + load_mesh( + match tail_front { + dragon::TailFront::Default => "npc.dragon.tail_front", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_tail_rear(tail_rear: dragon::TailRear) -> Mesh { + load_mesh( + match tail_rear { + dragon::TailRear::Default => "npc.dragon.tail_rear", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_wing_in_l(wing_in_l: dragon::WingInL) -> Mesh { + load_mesh( + match wing_in_l { + dragon::WingInL::Default => "npc.dragon.wing_in_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_wing_in_r(wing_in_r: dragon::WingInR) -> Mesh { + load_mesh( + match wing_in_r { + dragon::WingInR::Default => "npc.dragon.wing_in_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_wing_out_l(wing_out_l: dragon::WingOutL) -> Mesh { + load_mesh( + match wing_out_l { + dragon::WingOutL::Default => "npc.dragon.wing_out_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_wing_out_r(wing_out_r: dragon::WingOutR) -> Mesh { + load_mesh( + match wing_out_r { + dragon::WingOutR::Default => "npc.dragon.wing_out_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_foot_fl(foot_fl: dragon::FootFL) -> Mesh { + load_mesh( + match foot_fl { + dragon::FootFL::Default => "npc.dragon.foot_fl", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_foot_fr(foot_fr: dragon::FootFR) -> Mesh { + load_mesh( + match foot_fr { + dragon::FootFR::Default => "npc.dragon.foot_fr", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_foot_bl(foot_bl: dragon::FootBL) -> Mesh { + load_mesh( + match foot_bl { + dragon::FootBL::Default => "npc.dragon.foot_bl", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_foot_br(foot_br: dragon::FootBR) -> Mesh { + load_mesh( + match foot_br { + dragon::FootBR::Default => "npc.dragon.foot_br", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +//// +pub fn mesh_bird_small_head(head: bird_small::Head) -> Mesh { + load_mesh( + match head { + bird_small::Head::Default => "npc.crow.head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_bird_small_torso(torso: bird_small::Torso) -> Mesh { + load_mesh( + match torso { + bird_small::Torso::Default => "npc.crow.torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_bird_small_wing_l(wing_l: bird_small::WingL) -> Mesh { + load_mesh( + match wing_l { + bird_small::WingL::Default => "npc.crow.wing_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_bird_small_wing_r(wing_r: bird_small::WingR) -> Mesh { + load_mesh( + match wing_r { + bird_small::WingR::Default => "npc.crow.wing_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} +//// +pub fn mesh_fish_small_torso(torso: fish_small::Torso) -> Mesh { + load_mesh( + match torso { + fish_small::Torso::Default => "npc.cardinalfish.torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_fish_small_tail(tail: fish_small::Tail) -> Mesh { + load_mesh( + match tail { + fish_small::Tail::Default => "npc.cardinalfish.tail", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} +//// +pub fn mesh_biped_large_head(head: biped_large::Head) -> Mesh { + load_mesh( + match head { + biped_large::Head::Default => "npc.knight.head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_upper_torso(upper_torso: biped_large::UpperTorso) -> Mesh { + load_mesh( + match upper_torso { + biped_large::UpperTorso::Default => "npc.knight.upper_torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_lower_torso(lower_torso: biped_large::LowerTorso) -> Mesh { + load_mesh( + match lower_torso { + biped_large::LowerTorso::Default => "npc.knight.lower_torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_shoulder_l(shoulder_l: biped_large::ShoulderL) -> Mesh { + load_mesh( + match shoulder_l { + biped_large::ShoulderL::Default => "npc.knight.shoulder_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_shoulder_r(shoulder_r: biped_large::ShoulderR) -> Mesh { + load_mesh( + match shoulder_r { + biped_large::ShoulderR::Default => "npc.knight.shoulder_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_hand_l(hand_l: biped_large::HandL) -> Mesh { + load_mesh( + match hand_l { + biped_large::HandL::Default => "npc.knight.hand_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_hand_r(hand_r: biped_large::HandR) -> Mesh { + load_mesh( + match hand_r { + biped_large::HandR::Default => "npc.knight.hand_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_leg_l(leg_l: biped_large::LegL) -> Mesh { + load_mesh( + match leg_l { + biped_large::LegL::Default => "npc.knight.leg_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_leg_r(leg_r: biped_large::LegR) -> Mesh { + load_mesh( + match leg_r { + biped_large::LegR::Default => "npc.knight.leg_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_foot_l(foot_l: biped_large::FootL) -> Mesh { + load_mesh( + match foot_l { + biped_large::FootL::Default => "npc.knight.foot_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_biped_large_foot_r(foot_r: biped_large::FootR) -> Mesh { + load_mesh( + match foot_r { + biped_large::FootR::Default => "npc.knight.foot_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +//// pub fn mesh_object(obj: object::Body) -> Mesh { use object::Body; diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index ef0b35f046..028f15cc0f 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -6,8 +6,11 @@ pub use load::load_mesh; // TODO: Don't make this public. use crate::{ anim::{ - self, character::CharacterSkeleton, object::ObjectSkeleton, quadruped::QuadrupedSkeleton, - quadrupedmedium::QuadrupedMediumSkeleton, Animation, Skeleton, + self, biped_large::BipedLargeSkeleton, bird_medium::BirdMediumSkeleton, + bird_small::BirdSmallSkeleton, character::CharacterSkeleton, dragon::DragonSkeleton, + fish_medium::FishMediumSkeleton, fish_small::FishSmallSkeleton, object::ObjectSkeleton, + quadruped_medium::QuadrupedMediumSkeleton, quadruped_small::QuadrupedSmallSkeleton, + Animation, Skeleton, }, render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow}, scene::camera::{Camera, CameraMode}, @@ -30,8 +33,14 @@ const DAMAGE_FADE_COEFFICIENT: f64 = 5.0; pub struct FigureMgr { model_cache: FigureModelCache, character_states: HashMap>, - quadruped_states: HashMap>, + quadruped_small_states: HashMap>, quadruped_medium_states: HashMap>, + bird_medium_states: HashMap>, + fish_medium_states: HashMap>, + dragon_states: HashMap>, + bird_small_states: HashMap>, + fish_small_states: HashMap>, + biped_large_states: HashMap>, object_states: HashMap>, } @@ -40,8 +49,14 @@ impl FigureMgr { Self { model_cache: FigureModelCache::new(), character_states: HashMap::new(), - quadruped_states: HashMap::new(), + quadruped_small_states: HashMap::new(), quadruped_medium_states: HashMap::new(), + bird_medium_states: HashMap::new(), + fish_medium_states: HashMap::new(), + dragon_states: HashMap::new(), + bird_small_states: HashMap::new(), + fish_small_states: HashMap::new(), + biped_large_states: HashMap::new(), object_states: HashMap::new(), } } @@ -87,12 +102,30 @@ impl FigureMgr { Body::Humanoid(_) => { self.character_states.remove(&entity); } - Body::Quadruped(_) => { - self.quadruped_states.remove(&entity); + Body::QuadrupedSmall(_) => { + self.quadruped_small_states.remove(&entity); } Body::QuadrupedMedium(_) => { self.quadruped_medium_states.remove(&entity); } + Body::BirdMedium(_) => { + self.bird_medium_states.remove(&entity); + } + Body::FishMedium(_) => { + self.fish_medium_states.remove(&entity); + } + Body::Dragon(_) => { + self.dragon_states.remove(&entity); + } + Body::BirdSmall(_) => { + self.bird_small_states.remove(&entity); + } + Body::FishSmall(_) => { + self.fish_small_states.remove(&entity); + } + Body::BipedLarge(_) => { + self.biped_large_states.remove(&entity); + } Body::Object(_) => { self.object_states.remove(&entity); } @@ -266,11 +299,13 @@ impl FigureMgr { action_animation_rate, ); } - Body::Quadruped(_) => { + Body::QuadrupedSmall(_) => { let state = self - .quadruped_states + .quadruped_small_states .entry(entity) - .or_insert_with(|| FigureState::new(renderer, QuadrupedSkeleton::new())); + .or_insert_with(|| { + FigureState::new(renderer, QuadrupedSmallSkeleton::new()) + }); let (character, last_character) = match (character, last_character) { (Some(c), Some(l)) => (c, l), @@ -282,22 +317,22 @@ impl FigureMgr { } let target_base = match character.movement { - Stand => anim::quadruped::IdleAnimation::update_skeleton( - &QuadrupedSkeleton::new(), + Stand => anim::quadruped_small::IdleAnimation::update_skeleton( + &QuadrupedSmallSkeleton::new(), time, state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Run => anim::quadruped::RunAnimation::update_skeleton( - &QuadrupedSkeleton::new(), + Run => anim::quadruped_small::RunAnimation::update_skeleton( + &QuadrupedSmallSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Jump => anim::quadruped::JumpAnimation::update_skeleton( - &QuadrupedSkeleton::new(), + Jump => anim::quadruped_small::JumpAnimation::update_skeleton( + &QuadrupedSmallSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, &mut movement_animation_rate, @@ -339,21 +374,21 @@ impl FigureMgr { } let target_base = match character.movement { - Stand => anim::quadrupedmedium::IdleAnimation::update_skeleton( + Stand => anim::quadruped_medium::IdleAnimation::update_skeleton( &QuadrupedMediumSkeleton::new(), time, state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Run => anim::quadrupedmedium::RunAnimation::update_skeleton( + Run => anim::quadruped_medium::RunAnimation::update_skeleton( &QuadrupedMediumSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Jump => anim::quadrupedmedium::JumpAnimation::update_skeleton( + Jump => anim::quadruped_medium::JumpAnimation::update_skeleton( &QuadrupedMediumSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, @@ -378,6 +413,336 @@ impl FigureMgr { action_animation_rate, ); } + Body::BirdMedium(_) => { + let state = self + .bird_medium_states + .entry(entity) + .or_insert_with(|| FigureState::new(renderer, BirdMediumSkeleton::new())); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::bird_medium::IdleAnimation::update_skeleton( + &BirdMediumSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::bird_medium::RunAnimation::update_skeleton( + &BirdMediumSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::bird_medium::JumpAnimation::update_skeleton( + &BirdMediumSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } + Body::FishMedium(_) => { + let state = self + .fish_medium_states + .entry(entity) + .or_insert_with(|| FigureState::new(renderer, FishMediumSkeleton::new())); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::fish_medium::IdleAnimation::update_skeleton( + &FishMediumSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::fish_medium::RunAnimation::update_skeleton( + &FishMediumSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::fish_medium::JumpAnimation::update_skeleton( + &FishMediumSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } + Body::Dragon(_) => { + let state = self + .dragon_states + .entry(entity) + .or_insert_with(|| FigureState::new(renderer, DragonSkeleton::new())); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::dragon::IdleAnimation::update_skeleton( + &DragonSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::dragon::RunAnimation::update_skeleton( + &DragonSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::dragon::JumpAnimation::update_skeleton( + &DragonSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } + Body::BirdSmall(_) => { + let state = self + .bird_small_states + .entry(entity) + .or_insert_with(|| FigureState::new(renderer, BirdSmallSkeleton::new())); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::bird_small::IdleAnimation::update_skeleton( + &BirdSmallSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::bird_small::RunAnimation::update_skeleton( + &BirdSmallSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::bird_small::JumpAnimation::update_skeleton( + &BirdSmallSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } + Body::FishSmall(_) => { + let state = self + .fish_small_states + .entry(entity) + .or_insert_with(|| FigureState::new(renderer, FishSmallSkeleton::new())); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::fish_small::IdleAnimation::update_skeleton( + &FishSmallSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::fish_small::RunAnimation::update_skeleton( + &FishSmallSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::fish_small::JumpAnimation::update_skeleton( + &FishSmallSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } + Body::BipedLarge(_) => { + let state = self + .biped_large_states + .entry(entity) + .or_insert_with(|| FigureState::new(renderer, BipedLargeSkeleton::new())); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::biped_large::IdleAnimation::update_skeleton( + &BipedLargeSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::biped_large::RunAnimation::update_skeleton( + &BipedLargeSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::biped_large::JumpAnimation::update_skeleton( + &BipedLargeSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } Body::Object(_) => { let state = self .object_states @@ -403,10 +768,22 @@ impl FigureMgr { // Clear states that have dead entities. self.character_states .retain(|entity, _| ecs.entities().is_alive(*entity)); - self.quadruped_states + self.quadruped_small_states .retain(|entity, _| ecs.entities().is_alive(*entity)); self.quadruped_medium_states .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.bird_medium_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.fish_medium_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.dragon_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.bird_small_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.fish_small_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.biped_large_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); self.object_states .retain(|entity, _| ecs.entities().is_alive(*entity)); } @@ -456,14 +833,38 @@ impl FigureMgr { .character_states .get(&entity) .map(|state| (state.locals(), state.bone_consts())), - Body::Quadruped(_) => self - .quadruped_states + Body::QuadrupedSmall(_) => self + .quadruped_small_states .get(&entity) .map(|state| (state.locals(), state.bone_consts())), Body::QuadrupedMedium(_) => self .quadruped_medium_states .get(&entity) .map(|state| (state.locals(), state.bone_consts())), + Body::BirdMedium(_) => self + .bird_medium_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), + Body::FishMedium(_) => self + .fish_medium_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), + Body::Dragon(_) => self + .dragon_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), + Body::BirdSmall(_) => self + .bird_small_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), + Body::FishSmall(_) => self + .fish_small_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), + Body::BipedLarge(_) => self + .biped_large_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), Body::Object(_) => self .object_states .get(&entity)