diff --git a/extensions/common/simulation/object.cpp b/extensions/common/simulation/object.cpp index 39354e4e45..54f7f2d2b7 100644 --- a/extensions/common/simulation/object.cpp +++ b/extensions/common/simulation/object.cpp @@ -68,7 +68,7 @@ ace::simulation::named_selection::~named_selection() void ace::simulation::named_selection::animate(const glm::mat4 &matrix, ace::vector3 rotation_offset) { - bool offset = rotation_offset.zero_distance(); + bool offset = !rotation_offset.zero_distance(); for (auto selection_vertex : this->vertices) { selection_vertex->animate(matrix, rotation_offset, offset); } diff --git a/extensions/common/vector.hpp b/extensions/common/vector.hpp index 5a32e9c5fe..ac5b38bd1f 100644 --- a/extensions/common/vector.hpp +++ b/extensions/common/vector.hpp @@ -65,7 +65,7 @@ namespace ace { T distance(const vector3 &v) const { vector3 dist = (*this - v); dist = dist * dist; return sqrt(dist.x() + dist.y() + dist.z()); } vector3 cross(const vector3 &v) const { return vector3(_y * v.z() - _z * v.y(), _z * v.x() - _x * v.z(), _x * v.y() - _y * v.x()); } vector3 normalize(void) const { return (*this / abs(magnitude())); }; - bool zero_distance() { if (_x == 0.0f && _y == 0.0f && _z == 0.0f) return true; return false; } + bool zero_distance() { return ((_x == 0.0f && _y == 0.0f && _z == 0.0f) ? true : false ); } static float clamp(T x, T a, T b) { return x < a ? a : (x > b ? b : x); } diff --git a/extensions/tests/longrod_dxtk_test.txt b/extensions/tests/longrod_dxtk_test.txt index af9e692880..de0de31ee5 100644 --- a/extensions/tests/longrod_dxtk_test.txt +++ b/extensions/tests/longrod_dxtk_test.txt @@ -1,6 +1,5 @@ init: debug_render: -register_vehicle:\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,0,4050.18;3802.55;5.075 -#set_animation_state:damageHide,0,Wheel_kolL1,4.45242e-005,Wheel_koloL1,4.45242e-005,Wheel_podkoloL1,0.516474,Wheel_kolP1,4.45066e-005,Wheel_koloP1,4.45066e-005,Wheel_podkoloP1,0.517239,Wheel_kolL2,4.45242e-005,Wheel_kolP2,4.45066e-005,Wheel_koloL2,4.45242e-005,Wheel_koloL3,4.45242e-005,Wheel_koloL4,4.45242e-005,Wheel_koloL5,4.45242e-005,Wheel_koloL6,4.45242e-005,Wheel_koloL7,4.45242e-005,Wheel_koloP2,4.45066e-005,Wheel_koloP3,4.45066e-005,Wheel_koloP4,4.45066e-005,Wheel_koloP5,4.45066e-005,Wheel_koloP6,4.45066e-005,Wheel_koloP7,4.45066e-005,Wheel_podkoloL2,0.502695,Wheel_podkoloL3,0.496173,Wheel_podkoloL4,0.504816,Wheel_podkoloL5,0.488489,Wheel_podkoloL6,0.477184,Wheel_podkoloP2,0.508792,Wheel_podkoloP3,0.50227,Wheel_podkoloP4,0.495971,Wheel_podkoloP5,0.491531,Wheel_podkoloP6,0.498859,podkoloL1_hide_damage,0,podkoloL2_hide_damage,0,podkoloL3_hide_damage,0,podkoloL4_hide_damage,0,podkoloL5_hide_damage,0,podkoloL6_hide_damage,0,podkoloL7_hide_damage,0,podkoloL8_hide_damage,0,podkoloP1_hide_damage,0,podkoloP2_hide_damage,0,podkoloP3_hide_damage,0,podkoloP4_hide_damage,0,podkoloP5_hide_damage,0,podkoloP6_hide_damage,0,podkoloP7_hide_damage,0,podkoloP8_hide_damage,0,damageVez,0,MainTurret,0,MainGun,0.174533,Recoil,0,ObsTurret,0,ObsGun,0,MainGunOptics,0.174533,Wheel_podkoloP7,0.488629,Wheel_podkoloL7,0.475399,HatchDriver,0,HatchCommander,0,HatchGunner,0,damageVezVelitele,0,poklop_commander_damage,0,poklop_gunner_damage,0,poklop_driver_damage,0,zaslehROT_HMG,0,zaslehROT_coax,1.669,cannon_muzzle_flash,0,zaslehROT_cannon,0,HideHull,0.374406,HideTurret,0.729166,LockMuzzle,0, -set_animation_state:damageHide,0,Wheel_kolL1,4.45242e-005,Wheel_koloL1,4.45242e-005,Wheel_podkoloL1,0.518667,Wheel_kolP1,4.45066e-005,Wheel_koloP1,4.45066e-005,Wheel_podkoloP1,0.51903,Wheel_kolL2,4.45242e-005,Wheel_kolP2,4.45066e-005,Wheel_koloL2,4.45242e-005,Wheel_koloL3,4.45242e-005,Wheel_koloL4,4.45242e-005,Wheel_koloL5,4.45242e-005,Wheel_koloL6,4.45242e-005,Wheel_koloL7,4.45242e-005,Wheel_koloP2,4.45066e-005,Wheel_koloP3,4.45066e-005,Wheel_koloP4,4.45066e-005,Wheel_koloP5,4.45066e-005,Wheel_koloP6,4.45066e-005,Wheel_koloP7,4.45066e-005,Wheel_podkoloL2,0.505578,Wheel_podkoloL3,0.499702,Wheel_podkoloL4,0.509021,Wheel_podkoloL5,0.493307,Wheel_podkoloL6,0.48267,Wheel_podkoloP2,0.511259,Wheel_podkoloP3,0.505382,Wheel_podkoloP4,0.499742,Wheel_podkoloP5,0.495988,Wheel_podkoloP6,0.50392,podkoloL1_hide_damage,0,podkoloL2_hide_damage,0,podkoloL3_hide_damage,0,podkoloL4_hide_damage,0,podkoloL5_hide_damage,0,podkoloL6_hide_damage,0,podkoloL7_hide_damage,0,podkoloL8_hide_damage,0,podkoloP1_hide_damage,0,podkoloP2_hide_damage,0,podkoloP3_hide_damage,0,podkoloP4_hide_damage,0,podkoloP5_hide_damage,0,podkoloP6_hide_damage,0,podkoloP7_hide_damage,0,podkoloP8_hide_damage,0,damageVez,0,MainTurret,-0.0683285,MainGun,0.170289,Recoil,0.299856,ObsTurret,0,ObsGun,0,MainGunOptics,0.170289,Wheel_podkoloP7,0.494357,Wheel_podkoloL7,0.481555,HatchDriver,0,HatchCommander,0,HatchGunner,0,damageVezVelitele,0,poklop_commander_damage,0,poklop_gunner_damage,0,poklop_driver_damage,0,zaslehROT_HMG,0,zaslehROT_coax,75.207,cannon_muzzle_flash,0.299856,zaslehROT_cannon,512,HideHull,0.534082,HideTurret,0.83349,LockMuzzle,0, +register_vehicle:\A3\Structures_F\Ind\Cargo\Cargo40_blue_F.p3d,0,4050.18;3802.55;5.075 +set_animation_state:Door_1_rot,1,Door_Locked_1_rot,0,Door_2_rot,0,Door_Locked_2_rot,0, fetch_result:1 \ No newline at end of file diff --git a/extensions/tests/longrod_dxtk_test.txt.backup b/extensions/tests/longrod_dxtk_test.txt.backup new file mode 100644 index 0000000000..af9e692880 --- /dev/null +++ b/extensions/tests/longrod_dxtk_test.txt.backup @@ -0,0 +1,6 @@ +init: +debug_render: +register_vehicle:\A3\Armor_F_EPB\MBT_03\MBT_03_cannon_F.p3d,0,4050.18;3802.55;5.075 +#set_animation_state:damageHide,0,Wheel_kolL1,4.45242e-005,Wheel_koloL1,4.45242e-005,Wheel_podkoloL1,0.516474,Wheel_kolP1,4.45066e-005,Wheel_koloP1,4.45066e-005,Wheel_podkoloP1,0.517239,Wheel_kolL2,4.45242e-005,Wheel_kolP2,4.45066e-005,Wheel_koloL2,4.45242e-005,Wheel_koloL3,4.45242e-005,Wheel_koloL4,4.45242e-005,Wheel_koloL5,4.45242e-005,Wheel_koloL6,4.45242e-005,Wheel_koloL7,4.45242e-005,Wheel_koloP2,4.45066e-005,Wheel_koloP3,4.45066e-005,Wheel_koloP4,4.45066e-005,Wheel_koloP5,4.45066e-005,Wheel_koloP6,4.45066e-005,Wheel_koloP7,4.45066e-005,Wheel_podkoloL2,0.502695,Wheel_podkoloL3,0.496173,Wheel_podkoloL4,0.504816,Wheel_podkoloL5,0.488489,Wheel_podkoloL6,0.477184,Wheel_podkoloP2,0.508792,Wheel_podkoloP3,0.50227,Wheel_podkoloP4,0.495971,Wheel_podkoloP5,0.491531,Wheel_podkoloP6,0.498859,podkoloL1_hide_damage,0,podkoloL2_hide_damage,0,podkoloL3_hide_damage,0,podkoloL4_hide_damage,0,podkoloL5_hide_damage,0,podkoloL6_hide_damage,0,podkoloL7_hide_damage,0,podkoloL8_hide_damage,0,podkoloP1_hide_damage,0,podkoloP2_hide_damage,0,podkoloP3_hide_damage,0,podkoloP4_hide_damage,0,podkoloP5_hide_damage,0,podkoloP6_hide_damage,0,podkoloP7_hide_damage,0,podkoloP8_hide_damage,0,damageVez,0,MainTurret,0,MainGun,0.174533,Recoil,0,ObsTurret,0,ObsGun,0,MainGunOptics,0.174533,Wheel_podkoloP7,0.488629,Wheel_podkoloL7,0.475399,HatchDriver,0,HatchCommander,0,HatchGunner,0,damageVezVelitele,0,poklop_commander_damage,0,poklop_gunner_damage,0,poklop_driver_damage,0,zaslehROT_HMG,0,zaslehROT_coax,1.669,cannon_muzzle_flash,0,zaslehROT_cannon,0,HideHull,0.374406,HideTurret,0.729166,LockMuzzle,0, +set_animation_state:damageHide,0,Wheel_kolL1,4.45242e-005,Wheel_koloL1,4.45242e-005,Wheel_podkoloL1,0.518667,Wheel_kolP1,4.45066e-005,Wheel_koloP1,4.45066e-005,Wheel_podkoloP1,0.51903,Wheel_kolL2,4.45242e-005,Wheel_kolP2,4.45066e-005,Wheel_koloL2,4.45242e-005,Wheel_koloL3,4.45242e-005,Wheel_koloL4,4.45242e-005,Wheel_koloL5,4.45242e-005,Wheel_koloL6,4.45242e-005,Wheel_koloL7,4.45242e-005,Wheel_koloP2,4.45066e-005,Wheel_koloP3,4.45066e-005,Wheel_koloP4,4.45066e-005,Wheel_koloP5,4.45066e-005,Wheel_koloP6,4.45066e-005,Wheel_koloP7,4.45066e-005,Wheel_podkoloL2,0.505578,Wheel_podkoloL3,0.499702,Wheel_podkoloL4,0.509021,Wheel_podkoloL5,0.493307,Wheel_podkoloL6,0.48267,Wheel_podkoloP2,0.511259,Wheel_podkoloP3,0.505382,Wheel_podkoloP4,0.499742,Wheel_podkoloP5,0.495988,Wheel_podkoloP6,0.50392,podkoloL1_hide_damage,0,podkoloL2_hide_damage,0,podkoloL3_hide_damage,0,podkoloL4_hide_damage,0,podkoloL5_hide_damage,0,podkoloL6_hide_damage,0,podkoloL7_hide_damage,0,podkoloL8_hide_damage,0,podkoloP1_hide_damage,0,podkoloP2_hide_damage,0,podkoloP3_hide_damage,0,podkoloP4_hide_damage,0,podkoloP5_hide_damage,0,podkoloP6_hide_damage,0,podkoloP7_hide_damage,0,podkoloP8_hide_damage,0,damageVez,0,MainTurret,-0.0683285,MainGun,0.170289,Recoil,0.299856,ObsTurret,0,ObsGun,0,MainGunOptics,0.170289,Wheel_podkoloP7,0.494357,Wheel_podkoloL7,0.481555,HatchDriver,0,HatchCommander,0,HatchGunner,0,damageVezVelitele,0,poklop_commander_damage,0,poklop_gunner_damage,0,poklop_driver_damage,0,zaslehROT_HMG,0,zaslehROT_coax,75.207,cannon_muzzle_flash,0.299856,zaslehROT_cannon,512,HideHull,0.534082,HideTurret,0.83349,LockMuzzle,0, +fetch_result:1 \ No newline at end of file diff --git a/extensions/vd/base_vehicle.cpp b/extensions/vd/base_vehicle.cpp index 73416dde46..292e5a321c 100644 --- a/extensions/vd/base_vehicle.cpp +++ b/extensions/vd/base_vehicle.cpp @@ -20,7 +20,7 @@ namespace ace { } } if (fire_lod == -1) // @TODO: fallback on geo LOD - fire_lod = 0; + fire_lod = 11; assert(fire_lod != -1); // Build the mesh from object faces diff --git a/extensions/vd/controller.cpp b/extensions/vd/controller.cpp index dd98f1b885..cf6706c7d1 100644 --- a/extensions/vd/controller.cpp +++ b/extensions/vd/controller.cpp @@ -153,7 +153,7 @@ namespace ace { if (vehicles.find(id) == vehicles.end()) return false; - for (int x = 0, y = 0; x < vehicles[id]->animation_state.size() && x < _args.size() - 1; x++, y +=2) { + for (int x = 0, y = 0; x < vehicles[id]->animation_state.size() && x < _args.size() / 2; x++, y +=2) { std::string animation_name = _args[y]; float state = _args[y + 1]; vehicles[id]->animation_state[animation_name] = state; diff --git a/extensions/vd/debug/penetration_display.cpp b/extensions/vd/debug/penetration_display.cpp index 10ca59419c..c39bba1b66 100644 --- a/extensions/vd/debug/penetration_display.cpp +++ b/extensions/vd/debug/penetration_display.cpp @@ -159,7 +159,7 @@ namespace ace { // Debug animation the shit _active_vehicle->simulate(); - for (auto & selection : obj.lods[lod]->selections) { + /*for (auto & selection : obj.lods[lod]->selections) { for (auto & face : selection.second->faces) { ace::vector3 vertices[3]; vertices[0] = { face->vertices[0]->x(), face->vertices[0]->y(), face->vertices[0]->z() }; @@ -180,9 +180,9 @@ namespace ace { batch.DrawLine(v2, v3); batch.DrawLine(v3, v1); } - } + }*/ - /* + for (auto & face : obj.lods[lod]->faces) { ace::vector3 vertices[3]; vertices[0] = { face->vertices[0]->x(), face->vertices[0]->y(), face->vertices[0]->z() }; @@ -204,7 +204,7 @@ namespace ace { batch.DrawLine(v2, v3); batch.DrawLine(v3, v1); //batch.DrawTriangle(v1, v2, v3); - }*/ + } batch.End(); }