From cb181d80bec5afb9c0e297cf6199e9633e41832d Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 26 Aug 2022 18:42:44 -0600 Subject: [PATCH 01/59] ballistics, clipboard --- addons/advanced_ballistics/XEH_postInit.sqf | 4 +- .../functions/fnc_handleFirePFH.sqf | 28 +- .../functions/fnc_handleFired.sqf | 34 +- .../fnc_initializeTerrainExtension.sqf | 12 +- addons/arsenal/functions/fnc_buttonExport.sqf | 12 +- addons/arsenal/functions/fnc_onKeyDown.sqf | 4 +- .../fnc_calculate_distance_at_velocity.sqf | 11 +- .../functions/fnc_calculate_solution.sqf | 20 +- .../functions/fnc_update_zero_range.sqf | 22 +- .../functions/fnc_debugDumpToClipboard.sqf | 6 +- .../functions/fnc_calculateRangeCard.sqf | 4 +- .../functions/fnc_updateRangeCard.sqf | 6 +- .../fnc_calculateZeroAngleCorrection.sqf | 25 +- extension/Cargo.lock | 122 + extension/Cargo.toml | 17 + extension/src/ballistics/atmosphere.rs | 109 + extension/src/ballistics/bullet/mod.rs | 130 + extension/src/ballistics/bullet/model.rs | 220 + extension/src/ballistics/drag.rs | 174 + extension/src/ballistics/map/mod.rs | 43 + extension/src/ballistics/map/model.rs | 59 + extension/src/ballistics/mod.rs | 141 + extension/src/ballistics/temperature.rs | 56 + extension/src/ballistics/zero.rs | 102 + extension/src/clipboard.rs | 33 + extension/src/common/mod.rs | 2 + extension/src/common/vector3.rs | 164 + extension/src/lib.rs | 13 + extensions/.clang-format | 9 - extensions/CMakeLists.txt | 166 - .../AdvancedBallistics.cpp | 711 -- extensions/advanced_ballistics/CMakeLists.txt | 22 - extensions/artillerytables/CMakeLists.txt | 33 - .../artillerytables/artillerytables.cpp | 283 - .../artillerytables/artillerytables.hpp | 22 - extensions/artillerytables/tests/tester.cpp | 100 - extensions/break_line/CMakeLists.txt | 22 - extensions/break_line/ace_break_line.cpp | 75 - extensions/clipboard/CMakeLists.txt | 22 - extensions/clipboard/ace_clipboard.cpp | 84 - extensions/cmake/FindDirectX.cmake | 215 - extensions/common/CMakeLists.txt | 18 - extensions/common/ace_common.cpp | 4 - extensions/common/ace_common.h | 4 - extensions/common/ace_version.hpp.in | 4 - extensions/common/ace_version_win32.rc.in | 47 - extensions/common/arguments.hpp | 90 - extensions/common/directx/d3d_display.cpp | 440 -- extensions/common/directx/d3d_display.hpp | 130 - extensions/common/dispatch.hpp | 153 - extensions/common/glm/CMakeLists.txt | 43 - extensions/common/glm/common.hpp | 35 - extensions/common/glm/detail/_features.hpp | 428 -- extensions/common/glm/detail/_fixes.hpp | 59 - extensions/common/glm/detail/_noise.hpp | 136 - extensions/common/glm/detail/_swizzle.hpp | 833 --- .../common/glm/detail/_swizzle_func.hpp | 725 -- extensions/common/glm/detail/_vectorize.hpp | 160 - extensions/common/glm/detail/dummy.cpp | 232 - extensions/common/glm/detail/func_common.hpp | 456 -- extensions/common/glm/detail/func_common.inl | 758 -- .../common/glm/detail/func_exponential.hpp | 132 - .../common/glm/detail/func_exponential.inl | 161 - .../common/glm/detail/func_geometric.hpp | 142 - .../common/glm/detail/func_geometric.inl | 201 - extensions/common/glm/detail/func_integer.hpp | 232 - extensions/common/glm/detail/func_integer.inl | 393 -- extensions/common/glm/detail/func_matrix.hpp | 178 - extensions/common/glm/detail/func_matrix.inl | 310 - extensions/common/glm/detail/func_noise.hpp | 93 - extensions/common/glm/detail/func_noise.inl | 388 - extensions/common/glm/detail/func_packing.hpp | 197 - extensions/common/glm/detail/func_packing.inl | 119 - .../common/glm/detail/func_trigonometric.hpp | 205 - .../common/glm/detail/func_trigonometric.inl | 224 - .../glm/detail/func_vector_relational.hpp | 140 - .../glm/detail/func_vector_relational.inl | 131 - extensions/common/glm/detail/glm.cpp | 286 - .../common/glm/detail/intrinsic_common.hpp | 87 - .../common/glm/detail/intrinsic_common.inl | 313 - .../glm/detail/intrinsic_exponential.hpp | 77 - .../glm/detail/intrinsic_exponential.inl | 27 - .../common/glm/detail/intrinsic_geometric.hpp | 74 - .../common/glm/detail/intrinsic_geometric.inl | 147 - .../common/glm/detail/intrinsic_integer.hpp | 48 - .../common/glm/detail/intrinsic_integer.inl | 139 - .../common/glm/detail/intrinsic_matrix.hpp | 67 - .../common/glm/detail/intrinsic_matrix.inl | 1070 --- .../glm/detail/intrinsic_trigonometric.hpp | 46 - .../glm/detail/intrinsic_trigonometric.inl | 27 - .../detail/intrinsic_vector_relational.hpp | 46 - .../detail/intrinsic_vector_relational.inl | 366 - extensions/common/glm/detail/precision.hpp | 44 - extensions/common/glm/detail/setup.hpp | 962 --- extensions/common/glm/detail/type_float.hpp | 96 - extensions/common/glm/detail/type_gentype.hpp | 224 - extensions/common/glm/detail/type_gentype.inl | 370 - extensions/common/glm/detail/type_half.hpp | 48 - extensions/common/glm/detail/type_half.inl | 277 - extensions/common/glm/detail/type_int.hpp | 326 - extensions/common/glm/detail/type_mat.hpp | 793 --- extensions/common/glm/detail/type_mat.inl | 32 - extensions/common/glm/detail/type_mat2x2.hpp | 223 - extensions/common/glm/detail/type_mat2x2.inl | 548 -- extensions/common/glm/detail/type_mat2x3.hpp | 201 - extensions/common/glm/detail/type_mat2x3.inl | 506 -- extensions/common/glm/detail/type_mat2x4.hpp | 202 - extensions/common/glm/detail/type_mat2x4.inl | 515 -- extensions/common/glm/detail/type_mat3x2.hpp | 207 - extensions/common/glm/detail/type_mat3x2.inl | 540 -- extensions/common/glm/detail/type_mat3x3.hpp | 230 - extensions/common/glm/detail/type_mat3x3.inl | 631 -- extensions/common/glm/detail/type_mat3x4.hpp | 206 - extensions/common/glm/detail/type_mat3x4.inl | 579 -- extensions/common/glm/detail/type_mat4x2.hpp | 212 - extensions/common/glm/detail/type_mat4x2.inl | 587 -- extensions/common/glm/detail/type_mat4x3.hpp | 211 - extensions/common/glm/detail/type_mat4x3.inl | 631 -- extensions/common/glm/detail/type_mat4x4.hpp | 235 - extensions/common/glm/detail/type_mat4x4.inl | 790 --- extensions/common/glm/detail/type_vec.hpp | 518 -- extensions/common/glm/detail/type_vec.inl | 31 - extensions/common/glm/detail/type_vec1.hpp | 322 - extensions/common/glm/detail/type_vec1.inl | 616 -- extensions/common/glm/detail/type_vec2.hpp | 403 -- extensions/common/glm/detail/type_vec2.inl | 909 --- extensions/common/glm/detail/type_vec3.hpp | 425 -- extensions/common/glm/detail/type_vec3.inl | 1042 --- extensions/common/glm/detail/type_vec4.hpp | 531 -- extensions/common/glm/detail/type_vec4.inl | 1124 --- .../common/glm/detail/type_vec4_avx.inl | 41 - .../common/glm/detail/type_vec4_avx2.inl | 41 - .../common/glm/detail/type_vec4_sse2.inl | 120 - extensions/common/glm/exponential.hpp | 35 - extensions/common/glm/ext.hpp | 143 - extensions/common/glm/fwd.hpp | 2601 ------- extensions/common/glm/geometric.hpp | 35 - extensions/common/glm/glm.hpp | 117 - extensions/common/glm/gtc/bitfield.hpp | 236 - extensions/common/glm/gtc/bitfield.inl | 542 -- extensions/common/glm/gtc/constants.hpp | 205 - extensions/common/glm/gtc/constants.inl | 210 - extensions/common/glm/gtc/epsilon.hpp | 102 - extensions/common/glm/gtc/epsilon.inl | 154 - extensions/common/glm/gtc/integer.hpp | 105 - extensions/common/glm/gtc/integer.inl | 74 - extensions/common/glm/gtc/matrix_access.hpp | 88 - extensions/common/glm/gtc/matrix_access.inl | 92 - extensions/common/glm/gtc/matrix_integer.hpp | 515 -- extensions/common/glm/gtc/matrix_inverse.hpp | 78 - extensions/common/glm/gtc/matrix_inverse.inl | 148 - .../common/glm/gtc/matrix_transform.hpp | 304 - .../common/glm/gtc/matrix_transform.inl | 413 -- extensions/common/glm/gtc/noise.hpp | 89 - extensions/common/glm/gtc/noise.inl | 837 --- extensions/common/glm/gtc/packing.hpp | 478 -- extensions/common/glm/gtc/packing.inl | 490 -- extensions/common/glm/gtc/quaternion.hpp | 377 - extensions/common/glm/gtc/quaternion.inl | 784 --- extensions/common/glm/gtc/random.hpp | 120 - extensions/common/glm/gtc/random.inl | 379 - extensions/common/glm/gtc/reciprocal.hpp | 134 - extensions/common/glm/gtc/reciprocal.inl | 221 - extensions/common/glm/gtc/round.hpp | 203 - extensions/common/glm/gtc/round.inl | 378 - extensions/common/glm/gtc/type_precision.hpp | 890 --- extensions/common/glm/gtc/type_precision.inl | 36 - extensions/common/glm/gtc/type_ptr.hpp | 178 - extensions/common/glm/gtc/type_ptr.inl | 479 -- extensions/common/glm/gtc/ulp.hpp | 92 - extensions/common/glm/gtc/ulp.inl | 350 - extensions/common/glm/gtc/vec1.hpp | 193 - extensions/common/glm/gtc/vec1.inl | 31 - .../common/glm/gtx/associated_min_max.hpp | 231 - .../common/glm/gtx/associated_min_max.inl | 384 - extensions/common/glm/gtx/bit.hpp | 120 - extensions/common/glm/gtx/bit.inl | 107 - extensions/common/glm/gtx/closest_point.hpp | 74 - extensions/common/glm/gtx/closest_point.inl | 75 - extensions/common/glm/gtx/color_space.hpp | 97 - extensions/common/glm/gtx/color_space.inl | 172 - .../common/glm/gtx/color_space_YCoCg.hpp | 85 - .../common/glm/gtx/color_space_YCoCg.inl | 87 - extensions/common/glm/gtx/common.hpp | 74 - extensions/common/glm/gtx/common.inl | 102 - extensions/common/glm/gtx/compatibility.hpp | 158 - extensions/common/glm/gtx/compatibility.inl | 83 - extensions/common/glm/gtx/component_wise.hpp | 84 - extensions/common/glm/gtx/component_wise.inl | 70 - extensions/common/glm/gtx/dual_quaternion.hpp | 321 - extensions/common/glm/gtx/dual_quaternion.inl | 400 -- extensions/common/glm/gtx/euler_angles.hpp | 156 - extensions/common/glm/gtx/euler_angles.inl | 287 - extensions/common/glm/gtx/extend.hpp | 67 - extensions/common/glm/gtx/extend.inl | 78 - .../common/glm/gtx/extented_min_max.hpp | 162 - .../common/glm/gtx/extented_min_max.inl | 169 - .../common/glm/gtx/fast_exponential.hpp | 120 - .../common/glm/gtx/fast_exponential.inl | 166 - .../common/glm/gtx/fast_square_root.hpp | 117 - .../common/glm/gtx/fast_square_root.inl | 110 - .../common/glm/gtx/fast_trigonometry.hpp | 104 - .../common/glm/gtx/fast_trigonometry.inl | 162 - extensions/common/glm/gtx/gradient_paint.hpp | 77 - extensions/common/glm/gtx/gradient_paint.inl | 66 - .../glm/gtx/handed_coordinate_space.hpp | 75 - .../glm/gtx/handed_coordinate_space.inl | 56 - extensions/common/glm/gtx/integer.hpp | 101 - extensions/common/glm/gtx/integer.inl | 211 - extensions/common/glm/gtx/intersect.hpp | 112 - extensions/common/glm/gtx/intersect.inl | 217 - extensions/common/glm/gtx/io.hpp | 224 - extensions/common/glm/gtx/io.inl | 618 -- extensions/common/glm/gtx/log_base.hpp | 73 - extensions/common/glm/gtx/log_base.inl | 47 - .../common/glm/gtx/matrix_cross_product.hpp | 72 - .../common/glm/gtx/matrix_cross_product.inl | 67 - .../common/glm/gtx/matrix_decompose.hpp | 70 - .../common/glm/gtx/matrix_decompose.inl | 231 - .../common/glm/gtx/matrix_interpolation.hpp | 89 - .../common/glm/gtx/matrix_interpolation.inl | 163 - .../common/glm/gtx/matrix_major_storage.hpp | 144 - .../common/glm/gtx/matrix_major_storage.inl | 196 - .../common/glm/gtx/matrix_operation.hpp | 113 - .../common/glm/gtx/matrix_operation.inl | 147 - extensions/common/glm/gtx/matrix_query.hpp | 102 - extensions/common/glm/gtx/matrix_query.inl | 143 - .../common/glm/gtx/matrix_transform_2d.hpp | 106 - .../common/glm/gtx/matrix_transform_2d.inl | 97 - extensions/common/glm/gtx/mixed_product.hpp | 66 - extensions/common/glm/gtx/mixed_product.inl | 45 - extensions/common/glm/gtx/multiple.hpp | 106 - extensions/common/glm/gtx/multiple.inl | 64 - extensions/common/glm/gtx/norm.hpp | 128 - extensions/common/glm/gtx/norm.inl | 170 - extensions/common/glm/gtx/normal.hpp | 68 - extensions/common/glm/gtx/normal.inl | 45 - extensions/common/glm/gtx/normalize_dot.hpp | 74 - extensions/common/glm/gtx/normalize_dot.inl | 46 - .../common/glm/gtx/number_precision.hpp | 86 - .../common/glm/gtx/number_precision.inl | 36 - extensions/common/glm/gtx/optimum_pow.hpp | 79 - extensions/common/glm/gtx/optimum_pow.inl | 52 - extensions/common/glm/gtx/orthonormalize.hpp | 74 - extensions/common/glm/gtx/orthonormalize.inl | 59 - extensions/common/glm/gtx/perpendicular.hpp | 68 - extensions/common/glm/gtx/perpendicular.inl | 44 - .../common/glm/gtx/polar_coordinates.hpp | 73 - .../common/glm/gtx/polar_coordinates.inl | 66 - extensions/common/glm/gtx/projection.hpp | 65 - extensions/common/glm/gtx/projection.inl | 40 - extensions/common/glm/gtx/quaternion.hpp | 214 - extensions/common/glm/gtx/quaternion.inl | 285 - extensions/common/glm/gtx/range.hpp | 102 - extensions/common/glm/gtx/raw_data.hpp | 76 - extensions/common/glm/gtx/raw_data.inl | 31 - .../common/glm/gtx/rotate_normalized_axis.hpp | 93 - .../common/glm/gtx/rotate_normalized_axis.inl | 88 - extensions/common/glm/gtx/rotate_vector.hpp | 146 - extensions/common/glm/gtx/rotate_vector.inl | 217 - .../common/glm/gtx/scalar_multiplication.hpp | 98 - .../common/glm/gtx/scalar_relational.hpp | 61 - .../common/glm/gtx/scalar_relational.inl | 118 - extensions/common/glm/gtx/simd_mat4.hpp | 205 - extensions/common/glm/gtx/simd_mat4.inl | 602 -- extensions/common/glm/gtx/simd_quat.hpp | 335 - extensions/common/glm/gtx/simd_quat.inl | 645 -- extensions/common/glm/gtx/simd_vec4.hpp | 574 -- extensions/common/glm/gtx/simd_vec4.inl | 727 -- extensions/common/glm/gtx/spline.hpp | 90 - extensions/common/glm/gtx/spline.inl | 92 - extensions/common/glm/gtx/std_based_type.hpp | 92 - extensions/common/glm/gtx/std_based_type.inl | 36 - extensions/common/glm/gtx/string_cast.hpp | 74 - extensions/common/glm/gtx/string_cast.inl | 455 -- extensions/common/glm/gtx/transform.hpp | 85 - extensions/common/glm/gtx/transform.inl | 60 - extensions/common/glm/gtx/transform2.hpp | 136 - extensions/common/glm/gtx/transform2.inl | 177 - extensions/common/glm/gtx/type_aligned.hpp | 995 --- extensions/common/glm/gtx/type_aligned.inl | 36 - extensions/common/glm/gtx/vector_angle.hpp | 89 - extensions/common/glm/gtx/vector_angle.inl | 87 - extensions/common/glm/gtx/vector_query.hpp | 91 - extensions/common/glm/gtx/vector_query.inl | 222 - extensions/common/glm/gtx/wrap.hpp | 74 - extensions/common/glm/gtx/wrap.inl | 185 - extensions/common/glm/integer.hpp | 35 - extensions/common/glm/mat2x2.hpp | 81 - extensions/common/glm/mat2x3.hpp | 61 - extensions/common/glm/mat2x4.hpp | 60 - extensions/common/glm/mat3x2.hpp | 60 - extensions/common/glm/mat3x3.hpp | 81 - extensions/common/glm/mat3x4.hpp | 60 - extensions/common/glm/mat4x2.hpp | 60 - extensions/common/glm/mat4x3.hpp | 60 - extensions/common/glm/mat4x4.hpp | 81 - extensions/common/glm/matrix.hpp | 35 - extensions/common/glm/packing.hpp | 35 - extensions/common/glm/trigonometric.hpp | 35 - extensions/common/glm/vec2.hpp | 35 - extensions/common/glm/vec3.hpp | 35 - extensions/common/glm/vec4.hpp | 35 - extensions/common/glm/vector_relational.hpp | 35 - extensions/common/lzoconf.h | 453 -- extensions/common/lzodefs.h | 3134 --------- extensions/common/membuf.hpp | 56 - extensions/common/minilzo.c | 6231 ----------------- extensions/common/minilzo.h | 106 - extensions/common/p3d/animation.cpp | 71 - extensions/common/p3d/animation.hpp | 69 - extensions/common/p3d/compressed.cpp | 240 - extensions/common/p3d/compressed.hpp | 170 - extensions/common/p3d/lod_info.cpp | 289 - extensions/common/p3d/lod_info.hpp | 237 - extensions/common/p3d/lod_types.hpp | 33 - extensions/common/p3d/model.cpp | 116 - extensions/common/p3d/model.hpp | 57 - extensions/common/p3d/model_info.cpp | 91 - extensions/common/p3d/model_info.hpp | 74 - extensions/common/p3d/parser.cpp | 26 - extensions/common/p3d/parser.hpp | 17 - extensions/common/p3d/parser_ref.txt | 269 - extensions/common/p3d/read_helpers.hpp | 11 - extensions/common/p3d/skeleton.cpp | 46 - extensions/common/p3d/skeleton.hpp | 36 - extensions/common/pbo/archive.cpp | 91 - extensions/common/pbo/archive.hpp | 61 - extensions/common/pbo/search.cpp | 305 - extensions/common/pbo/search.hpp | 31 - extensions/common/shared.cpp | 24 - extensions/common/shared.hpp | 104 - extensions/common/simulation/object.cpp | 464 -- extensions/common/simulation/object.hpp | 221 - extensions/common/singleton.hpp | 31 - extensions/common/targetver.h | 9 - extensions/common/transform_matrix.hpp | 34 - extensions/common/vector.cpp | 11 - extensions/common/vector.hpp | 176 - extensions/dynload/CMakeLists.txt | 14 - extensions/dynload/ace_dynload.cpp | 65 - extensions/dynload/ace_dynload_dllmain.cpp | 33 - extensions/dynload/dynloader.hpp | 168 - extensions/fcs/CMakeLists.txt | 22 - extensions/fcs/ace_fcs.cpp | 118 - extensions/medical/CMakeLists.txt | 13 - extensions/medical/DamageType.cpp | 11 - extensions/medical/DamageType.h | 28 - extensions/medical/InjuryType.cpp | 13 - extensions/medical/InjuryType.h | 27 - extensions/medical/OpenWound.cpp | 18 - extensions/medical/OpenWound.h | 26 - extensions/medical/handleDamage.cpp | 243 - extensions/medical/handleDamage.h | 92 - extensions/medical/medical.cpp | 90 - 355 files changed, 1515 insertions(+), 74673 deletions(-) create mode 100644 extension/Cargo.lock create mode 100644 extension/Cargo.toml create mode 100644 extension/src/ballistics/atmosphere.rs create mode 100644 extension/src/ballistics/bullet/mod.rs create mode 100644 extension/src/ballistics/bullet/model.rs create mode 100644 extension/src/ballistics/drag.rs create mode 100644 extension/src/ballistics/map/mod.rs create mode 100644 extension/src/ballistics/map/model.rs create mode 100644 extension/src/ballistics/mod.rs create mode 100644 extension/src/ballistics/temperature.rs create mode 100644 extension/src/ballistics/zero.rs create mode 100644 extension/src/clipboard.rs create mode 100644 extension/src/common/mod.rs create mode 100644 extension/src/common/vector3.rs create mode 100644 extension/src/lib.rs delete mode 100644 extensions/.clang-format delete mode 100644 extensions/CMakeLists.txt delete mode 100644 extensions/advanced_ballistics/AdvancedBallistics.cpp delete mode 100644 extensions/advanced_ballistics/CMakeLists.txt delete mode 100644 extensions/artillerytables/CMakeLists.txt delete mode 100644 extensions/artillerytables/artillerytables.cpp delete mode 100644 extensions/artillerytables/artillerytables.hpp delete mode 100644 extensions/artillerytables/tests/tester.cpp delete mode 100644 extensions/break_line/CMakeLists.txt delete mode 100644 extensions/break_line/ace_break_line.cpp delete mode 100644 extensions/clipboard/CMakeLists.txt delete mode 100644 extensions/clipboard/ace_clipboard.cpp delete mode 100644 extensions/cmake/FindDirectX.cmake delete mode 100644 extensions/common/CMakeLists.txt delete mode 100644 extensions/common/ace_common.cpp delete mode 100644 extensions/common/ace_common.h delete mode 100644 extensions/common/ace_version.hpp.in delete mode 100644 extensions/common/ace_version_win32.rc.in delete mode 100644 extensions/common/arguments.hpp delete mode 100644 extensions/common/directx/d3d_display.cpp delete mode 100644 extensions/common/directx/d3d_display.hpp delete mode 100644 extensions/common/dispatch.hpp delete mode 100644 extensions/common/glm/CMakeLists.txt delete mode 100644 extensions/common/glm/common.hpp delete mode 100644 extensions/common/glm/detail/_features.hpp delete mode 100644 extensions/common/glm/detail/_fixes.hpp delete mode 100644 extensions/common/glm/detail/_noise.hpp delete mode 100644 extensions/common/glm/detail/_swizzle.hpp delete mode 100644 extensions/common/glm/detail/_swizzle_func.hpp delete mode 100644 extensions/common/glm/detail/_vectorize.hpp delete mode 100644 extensions/common/glm/detail/dummy.cpp delete mode 100644 extensions/common/glm/detail/func_common.hpp delete mode 100644 extensions/common/glm/detail/func_common.inl delete mode 100644 extensions/common/glm/detail/func_exponential.hpp delete mode 100644 extensions/common/glm/detail/func_exponential.inl delete mode 100644 extensions/common/glm/detail/func_geometric.hpp delete mode 100644 extensions/common/glm/detail/func_geometric.inl delete mode 100644 extensions/common/glm/detail/func_integer.hpp delete mode 100644 extensions/common/glm/detail/func_integer.inl delete mode 100644 extensions/common/glm/detail/func_matrix.hpp delete mode 100644 extensions/common/glm/detail/func_matrix.inl delete mode 100644 extensions/common/glm/detail/func_noise.hpp delete mode 100644 extensions/common/glm/detail/func_noise.inl delete mode 100644 extensions/common/glm/detail/func_packing.hpp delete mode 100644 extensions/common/glm/detail/func_packing.inl delete mode 100644 extensions/common/glm/detail/func_trigonometric.hpp delete mode 100644 extensions/common/glm/detail/func_trigonometric.inl delete mode 100644 extensions/common/glm/detail/func_vector_relational.hpp delete mode 100644 extensions/common/glm/detail/func_vector_relational.inl delete mode 100644 extensions/common/glm/detail/glm.cpp delete mode 100644 extensions/common/glm/detail/intrinsic_common.hpp delete mode 100644 extensions/common/glm/detail/intrinsic_common.inl delete mode 100644 extensions/common/glm/detail/intrinsic_exponential.hpp delete mode 100644 extensions/common/glm/detail/intrinsic_exponential.inl delete mode 100644 extensions/common/glm/detail/intrinsic_geometric.hpp delete mode 100644 extensions/common/glm/detail/intrinsic_geometric.inl delete mode 100644 extensions/common/glm/detail/intrinsic_integer.hpp delete mode 100644 extensions/common/glm/detail/intrinsic_integer.inl delete mode 100644 extensions/common/glm/detail/intrinsic_matrix.hpp delete mode 100644 extensions/common/glm/detail/intrinsic_matrix.inl delete mode 100644 extensions/common/glm/detail/intrinsic_trigonometric.hpp delete mode 100644 extensions/common/glm/detail/intrinsic_trigonometric.inl delete mode 100644 extensions/common/glm/detail/intrinsic_vector_relational.hpp delete mode 100644 extensions/common/glm/detail/intrinsic_vector_relational.inl delete mode 100644 extensions/common/glm/detail/precision.hpp delete mode 100644 extensions/common/glm/detail/setup.hpp delete mode 100644 extensions/common/glm/detail/type_float.hpp delete mode 100644 extensions/common/glm/detail/type_gentype.hpp delete mode 100644 extensions/common/glm/detail/type_gentype.inl delete mode 100644 extensions/common/glm/detail/type_half.hpp delete mode 100644 extensions/common/glm/detail/type_half.inl delete mode 100644 extensions/common/glm/detail/type_int.hpp delete mode 100644 extensions/common/glm/detail/type_mat.hpp delete mode 100644 extensions/common/glm/detail/type_mat.inl delete mode 100644 extensions/common/glm/detail/type_mat2x2.hpp delete mode 100644 extensions/common/glm/detail/type_mat2x2.inl delete mode 100644 extensions/common/glm/detail/type_mat2x3.hpp delete mode 100644 extensions/common/glm/detail/type_mat2x3.inl delete mode 100644 extensions/common/glm/detail/type_mat2x4.hpp delete mode 100644 extensions/common/glm/detail/type_mat2x4.inl delete mode 100644 extensions/common/glm/detail/type_mat3x2.hpp delete mode 100644 extensions/common/glm/detail/type_mat3x2.inl delete mode 100644 extensions/common/glm/detail/type_mat3x3.hpp delete mode 100644 extensions/common/glm/detail/type_mat3x3.inl delete mode 100644 extensions/common/glm/detail/type_mat3x4.hpp delete mode 100644 extensions/common/glm/detail/type_mat3x4.inl delete mode 100644 extensions/common/glm/detail/type_mat4x2.hpp delete mode 100644 extensions/common/glm/detail/type_mat4x2.inl delete mode 100644 extensions/common/glm/detail/type_mat4x3.hpp delete mode 100644 extensions/common/glm/detail/type_mat4x3.inl delete mode 100644 extensions/common/glm/detail/type_mat4x4.hpp delete mode 100644 extensions/common/glm/detail/type_mat4x4.inl delete mode 100644 extensions/common/glm/detail/type_vec.hpp delete mode 100644 extensions/common/glm/detail/type_vec.inl delete mode 100644 extensions/common/glm/detail/type_vec1.hpp delete mode 100644 extensions/common/glm/detail/type_vec1.inl delete mode 100644 extensions/common/glm/detail/type_vec2.hpp delete mode 100644 extensions/common/glm/detail/type_vec2.inl delete mode 100644 extensions/common/glm/detail/type_vec3.hpp delete mode 100644 extensions/common/glm/detail/type_vec3.inl delete mode 100644 extensions/common/glm/detail/type_vec4.hpp delete mode 100644 extensions/common/glm/detail/type_vec4.inl delete mode 100644 extensions/common/glm/detail/type_vec4_avx.inl delete mode 100644 extensions/common/glm/detail/type_vec4_avx2.inl delete mode 100644 extensions/common/glm/detail/type_vec4_sse2.inl delete mode 100644 extensions/common/glm/exponential.hpp delete mode 100644 extensions/common/glm/ext.hpp delete mode 100644 extensions/common/glm/fwd.hpp delete mode 100644 extensions/common/glm/geometric.hpp delete mode 100644 extensions/common/glm/glm.hpp delete mode 100644 extensions/common/glm/gtc/bitfield.hpp delete mode 100644 extensions/common/glm/gtc/bitfield.inl delete mode 100644 extensions/common/glm/gtc/constants.hpp delete mode 100644 extensions/common/glm/gtc/constants.inl delete mode 100644 extensions/common/glm/gtc/epsilon.hpp delete mode 100644 extensions/common/glm/gtc/epsilon.inl delete mode 100644 extensions/common/glm/gtc/integer.hpp delete mode 100644 extensions/common/glm/gtc/integer.inl delete mode 100644 extensions/common/glm/gtc/matrix_access.hpp delete mode 100644 extensions/common/glm/gtc/matrix_access.inl delete mode 100644 extensions/common/glm/gtc/matrix_integer.hpp delete mode 100644 extensions/common/glm/gtc/matrix_inverse.hpp delete mode 100644 extensions/common/glm/gtc/matrix_inverse.inl delete mode 100644 extensions/common/glm/gtc/matrix_transform.hpp delete mode 100644 extensions/common/glm/gtc/matrix_transform.inl delete mode 100644 extensions/common/glm/gtc/noise.hpp delete mode 100644 extensions/common/glm/gtc/noise.inl delete mode 100644 extensions/common/glm/gtc/packing.hpp delete mode 100644 extensions/common/glm/gtc/packing.inl delete mode 100644 extensions/common/glm/gtc/quaternion.hpp delete mode 100644 extensions/common/glm/gtc/quaternion.inl delete mode 100644 extensions/common/glm/gtc/random.hpp delete mode 100644 extensions/common/glm/gtc/random.inl delete mode 100644 extensions/common/glm/gtc/reciprocal.hpp delete mode 100644 extensions/common/glm/gtc/reciprocal.inl delete mode 100644 extensions/common/glm/gtc/round.hpp delete mode 100644 extensions/common/glm/gtc/round.inl delete mode 100644 extensions/common/glm/gtc/type_precision.hpp delete mode 100644 extensions/common/glm/gtc/type_precision.inl delete mode 100644 extensions/common/glm/gtc/type_ptr.hpp delete mode 100644 extensions/common/glm/gtc/type_ptr.inl delete mode 100644 extensions/common/glm/gtc/ulp.hpp delete mode 100644 extensions/common/glm/gtc/ulp.inl delete mode 100644 extensions/common/glm/gtc/vec1.hpp delete mode 100644 extensions/common/glm/gtc/vec1.inl delete mode 100644 extensions/common/glm/gtx/associated_min_max.hpp delete mode 100644 extensions/common/glm/gtx/associated_min_max.inl delete mode 100644 extensions/common/glm/gtx/bit.hpp delete mode 100644 extensions/common/glm/gtx/bit.inl delete mode 100644 extensions/common/glm/gtx/closest_point.hpp delete mode 100644 extensions/common/glm/gtx/closest_point.inl delete mode 100644 extensions/common/glm/gtx/color_space.hpp delete mode 100644 extensions/common/glm/gtx/color_space.inl delete mode 100644 extensions/common/glm/gtx/color_space_YCoCg.hpp delete mode 100644 extensions/common/glm/gtx/color_space_YCoCg.inl delete mode 100644 extensions/common/glm/gtx/common.hpp delete mode 100644 extensions/common/glm/gtx/common.inl delete mode 100644 extensions/common/glm/gtx/compatibility.hpp delete mode 100644 extensions/common/glm/gtx/compatibility.inl delete mode 100644 extensions/common/glm/gtx/component_wise.hpp delete mode 100644 extensions/common/glm/gtx/component_wise.inl delete mode 100644 extensions/common/glm/gtx/dual_quaternion.hpp delete mode 100644 extensions/common/glm/gtx/dual_quaternion.inl delete mode 100644 extensions/common/glm/gtx/euler_angles.hpp delete mode 100644 extensions/common/glm/gtx/euler_angles.inl delete mode 100644 extensions/common/glm/gtx/extend.hpp delete mode 100644 extensions/common/glm/gtx/extend.inl delete mode 100644 extensions/common/glm/gtx/extented_min_max.hpp delete mode 100644 extensions/common/glm/gtx/extented_min_max.inl delete mode 100644 extensions/common/glm/gtx/fast_exponential.hpp delete mode 100644 extensions/common/glm/gtx/fast_exponential.inl delete mode 100644 extensions/common/glm/gtx/fast_square_root.hpp delete mode 100644 extensions/common/glm/gtx/fast_square_root.inl delete mode 100644 extensions/common/glm/gtx/fast_trigonometry.hpp delete mode 100644 extensions/common/glm/gtx/fast_trigonometry.inl delete mode 100644 extensions/common/glm/gtx/gradient_paint.hpp delete mode 100644 extensions/common/glm/gtx/gradient_paint.inl delete mode 100644 extensions/common/glm/gtx/handed_coordinate_space.hpp delete mode 100644 extensions/common/glm/gtx/handed_coordinate_space.inl delete mode 100644 extensions/common/glm/gtx/integer.hpp delete mode 100644 extensions/common/glm/gtx/integer.inl delete mode 100644 extensions/common/glm/gtx/intersect.hpp delete mode 100644 extensions/common/glm/gtx/intersect.inl delete mode 100644 extensions/common/glm/gtx/io.hpp delete mode 100644 extensions/common/glm/gtx/io.inl delete mode 100644 extensions/common/glm/gtx/log_base.hpp delete mode 100644 extensions/common/glm/gtx/log_base.inl delete mode 100644 extensions/common/glm/gtx/matrix_cross_product.hpp delete mode 100644 extensions/common/glm/gtx/matrix_cross_product.inl delete mode 100644 extensions/common/glm/gtx/matrix_decompose.hpp delete mode 100644 extensions/common/glm/gtx/matrix_decompose.inl delete mode 100644 extensions/common/glm/gtx/matrix_interpolation.hpp delete mode 100644 extensions/common/glm/gtx/matrix_interpolation.inl delete mode 100644 extensions/common/glm/gtx/matrix_major_storage.hpp delete mode 100644 extensions/common/glm/gtx/matrix_major_storage.inl delete mode 100644 extensions/common/glm/gtx/matrix_operation.hpp delete mode 100644 extensions/common/glm/gtx/matrix_operation.inl delete mode 100644 extensions/common/glm/gtx/matrix_query.hpp delete mode 100644 extensions/common/glm/gtx/matrix_query.inl delete mode 100644 extensions/common/glm/gtx/matrix_transform_2d.hpp delete mode 100644 extensions/common/glm/gtx/matrix_transform_2d.inl delete mode 100644 extensions/common/glm/gtx/mixed_product.hpp delete mode 100644 extensions/common/glm/gtx/mixed_product.inl delete mode 100644 extensions/common/glm/gtx/multiple.hpp delete mode 100644 extensions/common/glm/gtx/multiple.inl delete mode 100644 extensions/common/glm/gtx/norm.hpp delete mode 100644 extensions/common/glm/gtx/norm.inl delete mode 100644 extensions/common/glm/gtx/normal.hpp delete mode 100644 extensions/common/glm/gtx/normal.inl delete mode 100644 extensions/common/glm/gtx/normalize_dot.hpp delete mode 100644 extensions/common/glm/gtx/normalize_dot.inl delete mode 100644 extensions/common/glm/gtx/number_precision.hpp delete mode 100644 extensions/common/glm/gtx/number_precision.inl delete mode 100644 extensions/common/glm/gtx/optimum_pow.hpp delete mode 100644 extensions/common/glm/gtx/optimum_pow.inl delete mode 100644 extensions/common/glm/gtx/orthonormalize.hpp delete mode 100644 extensions/common/glm/gtx/orthonormalize.inl delete mode 100644 extensions/common/glm/gtx/perpendicular.hpp delete mode 100644 extensions/common/glm/gtx/perpendicular.inl delete mode 100644 extensions/common/glm/gtx/polar_coordinates.hpp delete mode 100644 extensions/common/glm/gtx/polar_coordinates.inl delete mode 100644 extensions/common/glm/gtx/projection.hpp delete mode 100644 extensions/common/glm/gtx/projection.inl delete mode 100644 extensions/common/glm/gtx/quaternion.hpp delete mode 100644 extensions/common/glm/gtx/quaternion.inl delete mode 100644 extensions/common/glm/gtx/range.hpp delete mode 100644 extensions/common/glm/gtx/raw_data.hpp delete mode 100644 extensions/common/glm/gtx/raw_data.inl delete mode 100644 extensions/common/glm/gtx/rotate_normalized_axis.hpp delete mode 100644 extensions/common/glm/gtx/rotate_normalized_axis.inl delete mode 100644 extensions/common/glm/gtx/rotate_vector.hpp delete mode 100644 extensions/common/glm/gtx/rotate_vector.inl delete mode 100644 extensions/common/glm/gtx/scalar_multiplication.hpp delete mode 100644 extensions/common/glm/gtx/scalar_relational.hpp delete mode 100644 extensions/common/glm/gtx/scalar_relational.inl delete mode 100644 extensions/common/glm/gtx/simd_mat4.hpp delete mode 100644 extensions/common/glm/gtx/simd_mat4.inl delete mode 100644 extensions/common/glm/gtx/simd_quat.hpp delete mode 100644 extensions/common/glm/gtx/simd_quat.inl delete mode 100644 extensions/common/glm/gtx/simd_vec4.hpp delete mode 100644 extensions/common/glm/gtx/simd_vec4.inl delete mode 100644 extensions/common/glm/gtx/spline.hpp delete mode 100644 extensions/common/glm/gtx/spline.inl delete mode 100644 extensions/common/glm/gtx/std_based_type.hpp delete mode 100644 extensions/common/glm/gtx/std_based_type.inl delete mode 100644 extensions/common/glm/gtx/string_cast.hpp delete mode 100644 extensions/common/glm/gtx/string_cast.inl delete mode 100644 extensions/common/glm/gtx/transform.hpp delete mode 100644 extensions/common/glm/gtx/transform.inl delete mode 100644 extensions/common/glm/gtx/transform2.hpp delete mode 100644 extensions/common/glm/gtx/transform2.inl delete mode 100644 extensions/common/glm/gtx/type_aligned.hpp delete mode 100644 extensions/common/glm/gtx/type_aligned.inl delete mode 100644 extensions/common/glm/gtx/vector_angle.hpp delete mode 100644 extensions/common/glm/gtx/vector_angle.inl delete mode 100644 extensions/common/glm/gtx/vector_query.hpp delete mode 100644 extensions/common/glm/gtx/vector_query.inl delete mode 100644 extensions/common/glm/gtx/wrap.hpp delete mode 100644 extensions/common/glm/gtx/wrap.inl delete mode 100644 extensions/common/glm/integer.hpp delete mode 100644 extensions/common/glm/mat2x2.hpp delete mode 100644 extensions/common/glm/mat2x3.hpp delete mode 100644 extensions/common/glm/mat2x4.hpp delete mode 100644 extensions/common/glm/mat3x2.hpp delete mode 100644 extensions/common/glm/mat3x3.hpp delete mode 100644 extensions/common/glm/mat3x4.hpp delete mode 100644 extensions/common/glm/mat4x2.hpp delete mode 100644 extensions/common/glm/mat4x3.hpp delete mode 100644 extensions/common/glm/mat4x4.hpp delete mode 100644 extensions/common/glm/matrix.hpp delete mode 100644 extensions/common/glm/packing.hpp delete mode 100644 extensions/common/glm/trigonometric.hpp delete mode 100644 extensions/common/glm/vec2.hpp delete mode 100644 extensions/common/glm/vec3.hpp delete mode 100644 extensions/common/glm/vec4.hpp delete mode 100644 extensions/common/glm/vector_relational.hpp delete mode 100644 extensions/common/lzoconf.h delete mode 100644 extensions/common/lzodefs.h delete mode 100644 extensions/common/membuf.hpp delete mode 100644 extensions/common/minilzo.c delete mode 100644 extensions/common/minilzo.h delete mode 100644 extensions/common/p3d/animation.cpp delete mode 100644 extensions/common/p3d/animation.hpp delete mode 100644 extensions/common/p3d/compressed.cpp delete mode 100644 extensions/common/p3d/compressed.hpp delete mode 100644 extensions/common/p3d/lod_info.cpp delete mode 100644 extensions/common/p3d/lod_info.hpp delete mode 100644 extensions/common/p3d/lod_types.hpp delete mode 100644 extensions/common/p3d/model.cpp delete mode 100644 extensions/common/p3d/model.hpp delete mode 100644 extensions/common/p3d/model_info.cpp delete mode 100644 extensions/common/p3d/model_info.hpp delete mode 100644 extensions/common/p3d/parser.cpp delete mode 100644 extensions/common/p3d/parser.hpp delete mode 100644 extensions/common/p3d/parser_ref.txt delete mode 100644 extensions/common/p3d/read_helpers.hpp delete mode 100644 extensions/common/p3d/skeleton.cpp delete mode 100644 extensions/common/p3d/skeleton.hpp delete mode 100644 extensions/common/pbo/archive.cpp delete mode 100644 extensions/common/pbo/archive.hpp delete mode 100644 extensions/common/pbo/search.cpp delete mode 100644 extensions/common/pbo/search.hpp delete mode 100644 extensions/common/shared.cpp delete mode 100644 extensions/common/shared.hpp delete mode 100644 extensions/common/simulation/object.cpp delete mode 100644 extensions/common/simulation/object.hpp delete mode 100644 extensions/common/singleton.hpp delete mode 100644 extensions/common/targetver.h delete mode 100644 extensions/common/transform_matrix.hpp delete mode 100644 extensions/common/vector.cpp delete mode 100644 extensions/common/vector.hpp delete mode 100644 extensions/dynload/CMakeLists.txt delete mode 100644 extensions/dynload/ace_dynload.cpp delete mode 100644 extensions/dynload/ace_dynload_dllmain.cpp delete mode 100644 extensions/dynload/dynloader.hpp delete mode 100644 extensions/fcs/CMakeLists.txt delete mode 100644 extensions/fcs/ace_fcs.cpp delete mode 100644 extensions/medical/CMakeLists.txt delete mode 100644 extensions/medical/DamageType.cpp delete mode 100644 extensions/medical/DamageType.h delete mode 100644 extensions/medical/InjuryType.cpp delete mode 100644 extensions/medical/InjuryType.h delete mode 100644 extensions/medical/OpenWound.cpp delete mode 100644 extensions/medical/OpenWound.h delete mode 100644 extensions/medical/handleDamage.cpp delete mode 100644 extensions/medical/handleDamage.h delete mode 100644 extensions/medical/medical.cpp diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf index 9ff22efe95d..3004501ea55 100644 --- a/addons/advanced_ballistics/XEH_postInit.sqf +++ b/addons/advanced_ballistics/XEH_postInit.sqf @@ -2,11 +2,9 @@ #include "initKeybinds.sqf" -GVAR(currentbulletID) = -1; - GVAR(Protractor) = false; GVAR(ProtractorStart) = CBA_missionTime; -GVAR(allBullets) = []; +GVAR(allBullets) = createHashMap; GVAR(currentGrid) = 0; if (!hasInterface) exitWith {}; diff --git a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf index 12199db1546..5a92af20420 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* - * Author: Glowbal, Ruthberg, joko // Jonas + * Author: Glowbal, Ruthberg, joko // Jonas, Brett Mayson * Handle the PFH for Bullets * * Arguments: @@ -17,7 +17,7 @@ private _deleted = false; { - _x params ["_bullet","_caliber","_bulletTraceVisible","_index"]; + _y params ["_bullet","_caliber","_bulletTraceVisible"]; if (alive _bullet) then { private _bulletVelocity = velocity _bullet; @@ -27,13 +27,21 @@ private _deleted = false; drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; }; - _bullet setVelocity (_bulletVelocity vectorAdd (parseSimpleArray ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6", _index, _bulletVelocity, _bulletPosition, wind, ASLToATL(_bulletPosition) select 2, CBA_missionTime toFixed 6]))); + ( + "ace" callExtension ["ballistics:bullet:simulate", [ + _x, + _bulletVelocity, + _bulletPosition, + wind, + ASLToATL(_bulletPosition) select 2, + CBA_missionTime toFixed 6 + ]] + ) params ["_data", "_code"]; + if (_code == 0) then { + _bullet setVelocity (_bulletVelocity vectorAdd (parseSimpleArray (_data))); + }; } else { - GVAR(allBullets) set [_forEachIndex, objNull]; - _deleted = true; + GVAR(allBullets) deleteAt _x; + "ace" callExtension ["ballistics:bullet:delete", [_x]]; }; -} forEach GVAR(allBullets); - -if (_deleted) then { - GVAR(allBullets) = GVAR(allBullets) - [objNull]; -}; +} forEach GVAR(allBullets) diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 90dc370ff29..e94c15f963c 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* - * Author: Glowbal, Ruthberg + * Author: Glowbal, Ruthberg, Brett Mayson * * Handles advanced ballistics for (BulletBase) projectiles. Called from the unified fired EH only for players. * @@ -62,11 +62,11 @@ if (_abort) exitWith {}; // Get Weapon and Ammo Configurations private _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo]; if (isNil "_AmmoCacheEntry") then { - _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig); + _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig); }; private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon]; if (isNil "_WeaponCacheEntry") then { - _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig); + _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig); }; _AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocityVariationSD"]; @@ -120,8 +120,26 @@ if (_caliber * _bulletLength * _bulletMass * _barrelTwist > 0) then { _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); }; -GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; - -"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _ammoCount, _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _transonicStabilityCoef, getPosASL _projectile, _bulletVelocity, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), EGVAR(weather,currentOvercast), CBA_missionTime toFixed 6]; - -GVAR(allBullets) pushBack [_projectile, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]; +private _id = "ace" callExtension [ + "ballistics:bullet:new", [ + _ammoCount, + _airFriction, + _ballisticCoefficients, + _velocityBoundaries, + _atmosphereModel, + _dragModel, + _stabilityFactor, + _twistDirection, + _transonicStabilityCoef, + getPosASL _projectile, + _bulletVelocity, + EGVAR(common,mapLatitude), + EGVAR(weather,currentTemperature), + EGVAR(common,mapAltitude), + EGVAR(weather,currentHumidity), + EGVAR(weather,currentOvercast), + CBA_missionTime toFixed 6 + ] +]; + +GVAR(allBullets) set [_id, [_projectile, _caliber, _bulletTraceVisible]]; diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index 8ff80527452..f7dc94b9722 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -21,7 +21,14 @@ if (!GVAR(enabled)) exitWith {}; private _initStartTime = diag_tickTime; private _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); -if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith { +( + "ace" callExtension ["ballistics:map:init", [worldName, _mapSize]] +) params ["_data", "_code"]; +if (_code != 0) exitWith { + WARN_1("Error initializing map") +}; + +if (_data == "true") exitWith { INFO_1("Terrain already initialized [world: %1]", worldName); #ifdef DEBUG_MODE_FULL systemChat "AdvancedBallistics: Terrain already initialized"; @@ -53,8 +60,7 @@ INFO_2("Starting Terrain Extension [cells: %1] [world: %2]", _gridCells, worldNa private _gridCenter = [_x + 25, _y + 25]; private _gridHeight = round(getTerrainHeightASL _gridCenter); private _gridNumObjects = count (_gridCenter nearObjects ["Building", 50]); - private _gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0}; - "ace_advanced_ballistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater]; + "ace" callExtension ["ballistics:map:set", [GVAR(currentGrid), _gridHeight, _gridNumObjects, surfaceIsWater _gridCenter]]; GVAR(currentGrid) = GVAR(currentGrid) + 1; if (GVAR(currentGrid) >= _gridCells) exitWith {}; }; diff --git a/addons/arsenal/functions/fnc_buttonExport.sqf b/addons/arsenal/functions/fnc_buttonExport.sqf index 3ff75be8245..9c9b4254ab1 100644 --- a/addons/arsenal/functions/fnc_buttonExport.sqf +++ b/addons/arsenal/functions/fnc_buttonExport.sqf @@ -25,27 +25,27 @@ if (GVAR(shiftState)) then { switch true do { case (_index == -1): { - "ace_clipboard" callExtension (format ["[%1", endl]); + "ace" callExtension ["clipboard:append", [(format ["[%1", endl])]]; }; case (_index == _listLength): { - "ace_clipboard" callExtension "];"; + "ace" callExtension ["clipboard:append", ["];"]]; }; default { - "ace_clipboard" callExtension ([" ",str (GVAR(defaultLoadoutsList) select _index), [",", ""] select (_index == _listLength - 1), endl] joinString ""); + "ace" callExtension ["clipboard:append", [([" ",str (GVAR(defaultLoadoutsList) select _index), [",", ""] select (_index == _listLength - 1), endl] joinString "")]]; }; }; }; - "ace_clipboard" callExtension "--COMPLETE--"; + "ace" callExtension ["clipboard:complete", []]; [_display, localize LSTRING(exportDefault)] call FUNC(message); } else { private _export = str ([GVAR(center)] call FUNC(getLoadout)); - "ace_clipboard" callExtension (_export + ";"); - "ace_clipboard" callExtension "--COMPLETE--"; + "ace" callExtension ["clipboard:append", [(_export + ";")]]; + "ace" callExtension ["clipboard:complete", []]; [_display, localize LSTRING(exportCurrent)] call FUNC(message); }; diff --git a/addons/arsenal/functions/fnc_onKeyDown.sqf b/addons/arsenal/functions/fnc_onKeyDown.sqf index 2bd8e0ac7b2..db37d20d74f 100644 --- a/addons/arsenal/functions/fnc_onKeyDown.sqf +++ b/addons/arsenal/functions/fnc_onKeyDown.sqf @@ -103,8 +103,8 @@ if (_loadoutsDisplay isNotEqualTo displayNull) then { }; } params ["_className"]; - "ace_clipboard" callExtension (_className + ";"); - "ace_clipboard" callExtension "--COMPLETE--"; + "ace" callExtension ["clipboard:append", [(_className + ";")]]; + "ace" callExtension ["clipboard:complete", []]; [_display, localize LSTRING(exportedClassnameText)] call FUNC(message); } else { diff --git a/addons/atragmx/functions/fnc_calculate_distance_at_velocity.sqf b/addons/atragmx/functions/fnc_calculate_distance_at_velocity.sqf index 1f06d799883..4963cc83c2b 100644 --- a/addons/atragmx/functions/fnc_calculate_distance_at_velocity.sqf +++ b/addons/atragmx/functions/fnc_calculate_distance_at_velocity.sqf @@ -30,9 +30,16 @@ while {_velocity > _thresholdVelocity} do { private _bc = GVAR(targetSolutionInput) select 14; private _dragModel = GVAR(targetSolutionInput) select 15; private _temperature = GVAR(targetSolutionInput) select 5; - private _drag = parseNumber(("ace_advanced_ballistics" callExtension format["retard:%1:%2:%3:%4", _dragModel, _bc, _velocity, _temperature])); _distance = _distance + _velocity * __DELTA_T; - _velocity = _velocity - (_drag * __DELTA_T); + private _data = ( + "ace" callExtension ["ballistics:retard", [ + _dragModel, + _bc, + _velocity, + _temperature + ]] + ) select 0; + _velocity = _velocity - ((parseNumber _data) * __DELTA_T); }; _distance diff --git a/addons/atragmx/functions/fnc_calculate_solution.sqf b/addons/atragmx/functions/fnc_calculate_solution.sqf index 3c854499d9e..25d175a78b5 100644 --- a/addons/atragmx/functions/fnc_calculate_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_solution.sqf @@ -90,7 +90,14 @@ private _wind1 = [cos(270 - _windDirection * 30) * _windSpeed1, sin(270 - _windD private _wind2 = [cos(270 - _windDirection * 30) * _windSpeed2, sin(270 - _windDirection * 30) * _windSpeed2, 0]; private _windDrift = 0; if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { - _bc = parseNumber(("ace_advanced_ballistics" callExtension format["atmosphericCorrection:%1:%2:%3:%4:%5", _bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel])); + _bc = parseNumber (("ace" callExtension ["ballistics:atmospheric_correction", [ + _bc, + _temperature, + _barometricPressure, + _relativeHumidity, + _atmosphereModel + ]] + ) select 0); }; private _eoetvoesMultiplier = 0; @@ -113,8 +120,15 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do { _trueSpeed = vectorMagnitude _trueVelocity; if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { - private _drag = parseNumber(("ace_advanced_ballistics" callExtension format["retard:%1:%2:%3:%4", _dragModel, _bc, _trueSpeed, _temperature])); - _bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (-1 * _drag); + private _data = ( + "ace" callExtension ["ballistics:retard", [ + _dragModel, + _bc, + _trueSpeed, + _temperature + ]] + ) select 0; + _bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (-1 * (parseNumber _data)); } else { _bulletAccel = _trueVelocity vectorMultiply (_trueSpeed * _airFriction); }; diff --git a/addons/atragmx/functions/fnc_update_zero_range.sqf b/addons/atragmx/functions/fnc_update_zero_range.sqf index 4de63705919..20cf1e996d0 100644 --- a/addons/atragmx/functions/fnc_update_zero_range.sqf +++ b/addons/atragmx/functions/fnc_update_zero_range.sqf @@ -36,11 +36,25 @@ if (!GVAR(atmosphereModeTBH)) then { }; private _scopeBaseAngle = if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])) then { - private _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZero:%1:%2:%3:%4", _zeroRange, _muzzleVelocity, _airFriction, _boreHeight]; - (parseNumber _zeroAngle) + (parseNumber ("ace" callExtension ["ballistics:calc_zero_vanilla", [ + _zeroRange, + _muzzleVelocity, + _airFriction, + _boreHeight + ]]) select 0) } else { - private _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZeroAB:%1:%2:%3:%4:%5:%6:%7:%8:%9", _zeroRange, _muzzleVelocity, _boreHeight, _temperature, _barometricPressure, _relativeHumidity, _bc, _dragModel, _atmosphereModel]; - (parseNumber _zeroAngle) + (parseNumber ("ace" callExtension ["ballistics:calc_zero_advanced", [ + _zeroRange, + _muzzleVelocity, + _airFriction, + _boreHeight, + _temperature, + _barometricPressure, + _relativeHumidity, + _bc, + _dragModel, + _atmosphereModel + ]]) select 0) }; GVAR(workingMemory) set [2, _zeroRange]; diff --git a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf index 6ed460d2f9e..0893bb150ab 100644 --- a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf +++ b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf @@ -19,8 +19,8 @@ private _outputText = { diag_log text (_this select 0); - "ace_clipboard" callExtension ((_this select 0) + " -"); + "ace" callExtension ["clipboard:append", [((_this select 0) + " +")]]; }; private _text = format ["~~~~~~~~~ACE Debug~~~~~~~~~ @@ -94,4 +94,4 @@ _text = format [" } forEach (allVariables _unit); } forEach allUnits; -"ace_clipboard" callExtension "--COMPLETE--"; +"ace" callExtension ["clipboard:complete", []]; diff --git a/addons/rangecard/functions/fnc_calculateRangeCard.sqf b/addons/rangecard/functions/fnc_calculateRangeCard.sqf index ebeadf6b7e6..d15f4558c93 100644 --- a/addons/rangecard/functions/fnc_calculateRangeCard.sqf +++ b/addons/rangecard/functions/fnc_calculateRangeCard.sqf @@ -64,7 +64,7 @@ private _n = 0; private _range = 0; if (_useABConfig) then { - _bc = parseNumber(("ace_advanced_ballistics" callExtension format["atmosphericCorrection:%1:%2:%3:%4:%5", _bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel])); + _bc = parseNumber(("ace" callExtension ["ballistics:atmospheric_correction", [_bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel]]) select 0); }; private _airFrictionCoef = 1; @@ -98,7 +98,7 @@ while {_TOF < 6 && (_bulletPos select 1) < _targetRange} do { _trueSpeed = vectorMagnitude _trueVelocity; if (_useABConfig) then { - private _drag = parseNumber(("ace_advanced_ballistics" callExtension format["retard:%1:%2:%3:%4", _dragModel, _bc, _trueSpeed, _temperature])); + private _drag = parseNumber(("ace" callExtension ["ballistics:retard", [_dragModel, _bc, _trueSpeed, _temperature]]) select 0); _bulletAccel = (vectorNormalized _trueVelocity) vectorMultiply (-1 * _drag); } else { _bulletAccel = _trueVelocity vectorMultiply (_trueSpeed * _airFriction * _airFrictionCoef); diff --git a/addons/rangecard/functions/fnc_updateRangeCard.sqf b/addons/rangecard/functions/fnc_updateRangeCard.sqf index 89a6ac9e542..74c848c14ff 100644 --- a/addons/rangecard/functions/fnc_updateRangeCard.sqf +++ b/addons/rangecard/functions/fnc_updateRangeCard.sqf @@ -156,11 +156,9 @@ if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) t private _cacheEntry = missionNamespace getVariable format[QGVAR(%1_%2_%3_%4_%5), _zeroRange, _boreHeight, _ammoClass, _weaponClass, missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]]; if (isNil {_cacheEntry}) then { private _scopeBaseAngle = if (!_useABConfig) then { - private _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZero:%1:%2:%3:%4", _zeroRange, _muzzleVelocity, _airFriction, _boreHeight]; - (parseNumber _zeroAngle) + parseNumber (("ace" callExtension ["ballistics:zero_vanilla", [_zeroRange, _muzzleVelocity, _airFriction, _boreHeight]]) select 0) } else { - private _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZeroAB:%1:%2:%3:%4:%5:%6:%7:%8:%9", _zeroRange, _muzzleVelocity, _boreHeight, EGVAR(scopes,zeroReferenceTemperature), EGVAR(scopes,zeroReferenceBarometricPressure), EGVAR(scopes,zeroReferenceHumidity), _bc, _dragModel, _atmosphereModel]; - (parseNumber _zeroAngle) + parseNumber (("ace" callExtension ["ballistics:zero_advanced", [_zeroRange, _muzzleVelocity, _boreHeight, EGVAR(scopes,zeroReferenceTemperature), EGVAR(scopes,zeroReferenceBarometricPressure), EGVAR(scopes,zeroReferenceHumidity), _bc, _dragModel, _atmosphereModel]]) select 0) }; if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && missionNamespace getVariable [QEGVAR(advanced_ballistics,ammoTemperatureEnabled), false]) then { { diff --git a/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf b/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf index 017c617ebcb..77b9140126a 100644 --- a/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf +++ b/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf @@ -32,25 +32,23 @@ if (_initSpeedCoef < 0) then { _initSpeed = _initSpeed * (-1 * _initSpeedCoef); }; -private _zeroAngle = "ace_advanced_ballistics" callExtension format ["replicateVanillaZero:%1:%2:%3", _oldZeroRange, _initSpeed, _airFriction]; -private _vanillaZero = parseNumber _zeroAngle; +private _vanillaZero = parseNumber (("ace" callExtension ["ballistics:replicate_vanilla_zero", [_oldZeroRange, _initSpeed, _airFriction]]) select 0); #ifdef DISABLE_DISPERSION _vanillaZero = 0; #endif private _trueZero = if (!_advancedBallistics) then { - _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZero:%1:%2:%3:%4", _newZeroRange, _initSpeed, _airFriction, _boreHeight]; - (parseNumber _zeroAngle) + parseNumber (("ace" callExtension ["ballistics:zero_vanilla", [_newZeroRange, _initSpeed, _airFriction, _boreHeight]]) select 0) } else { // Get Weapon and Ammo Configurations private _AmmoCacheEntry = uiNamespace getVariable format[QEGVAR(advanced_ballistics,%1), _ammo]; if (isNil "_AmmoCacheEntry") then { - _AmmoCacheEntry = _ammo call EFUNC(advanced_ballistics,readAmmoDataFromConfig); + _AmmoCacheEntry = _ammo call EFUNC(advanced_ballistics,readAmmoDataFromConfig); }; private _WeaponCacheEntry = uiNamespace getVariable format[QEGVAR(advanced_ballistics,%1), _weapon]; if (isNil "_WeaponCacheEntry") then { - _WeaponCacheEntry = _weapon call EFUNC(advanced_ballistics,readWeaponDataFromConfig); + _WeaponCacheEntry = _weapon call EFUNC(advanced_ballistics,readWeaponDataFromConfig); }; _AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocityVariationSD"]; @@ -66,8 +64,19 @@ private _trueZero = if (!_advancedBallistics) then { _initSpeed = _initSpeed + _ammoTemperatureVelocityShift; }; - _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZeroAB:%1:%2:%3:%4:%5:%6:%7:%8:%9", _newZeroRange, _initSpeed, _boreHeight, GVAR(zeroReferenceTemperature), GVAR(zeroReferenceBarometricPressure), GVAR(zeroReferenceHumidity), _ballisticCoefficients select 0, _dragModel, _atmosphereModel]; - (parseNumber _zeroAngle) + parseNumber ( + ("ace" callExtension ["ballistics:zero_advanced", [ + _newZeroRange, + _initSpeed, + _boreHeight, + GVAR(zeroReferenceTemperature), + GVAR(zeroReferenceBarometricPressure), + GVAR(zeroReferenceHumidity), + _ballisticCoefficients select 0, + _dragModel, + _atmosphereModel + ]]) select 0 + ) }; private _zeroAngleCorrection = _trueZero - _vanillaZero; diff --git a/extension/Cargo.lock b/extension/Cargo.lock new file mode 100644 index 00000000000..f729fde7f66 --- /dev/null +++ b/extension/Cargo.lock @@ -0,0 +1,122 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "arma-rs" +version = "1.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8855a5dce884e6b98caa2aaeeabeb350dd05d94908054998b0a8191ecf6ab2" +dependencies = [ + "arma-rs-proc", + "crossbeam-queue", + "libc", + "link_args", + "log", +] + +[[package]] +name = "arma-rs-proc" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c177e120733d13a150d2f6bedf3f5012bb19b720e430db9e8ace7ecc1609eb8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "crossbeam-queue" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "extension" +version = "0.1.0" +dependencies = [ + "arma-rs", +] + +[[package]] +name = "libc" +version = "0.2.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" + +[[package]] +name = "link_args" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c7721e472624c9aaad27a5eb6b7c9c6045c7a396f2efb6dabaec1b640d5e89b" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "once_cell" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" + +[[package]] +name = "proc-macro2" +version = "1.0.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" diff --git a/extension/Cargo.toml b/extension/Cargo.toml new file mode 100644 index 00000000000..a5d613cd6ba --- /dev/null +++ b/extension/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "extension" +version = "0.1.0" +edition = "2021" + +[dependencies] +# arma-rs = "1.7.7" +arma-rs = { git = "https://github.com/brettmayson/arma-rs", features = ["uuid"] } +uuid = { version = "1.1.2", features = ["v4"] } +rand = "0.8.5" +rand_chacha = "0.3.1" + +# Clipboard +clipboard = { version = "0.5", optional = true } + +[features] +default = ["clipboard"] diff --git a/extension/src/ballistics/atmosphere.rs b/extension/src/ballistics/atmosphere.rs new file mode 100644 index 00000000000..a5b33693b53 --- /dev/null +++ b/extension/src/ballistics/atmosphere.rs @@ -0,0 +1,109 @@ +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum AtmosphereModel { + Icao, + Asm, +} + +impl FromArma for AtmosphereModel { + fn from_arma(s: String) -> Result { + match s.as_str() { + "icao" => Ok(AtmosphereModel::Icao), + "asm" => Ok(AtmosphereModel::Asm), + _ => Err(String::from("unexpected model")), + } + } +} + +use arma_rs::FromArma; + +use super::{map::Map, temperature::Temperature}; + +const ROUGHNESS_LENGTHS: [f64; 10] = [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6]; + +pub fn calculate_roughness_length(map: &Map, x: f64, y: f64) -> f64 { + let grid_x = (x / 50.0).floor() as i64; + let grid_y = (y / 50.0).floor() as i64; + let grid_cell = (grid_x * map.grids() as i64) + grid_y; + + if grid_cell >= 0 { + let grid_cell = grid_cell as usize; + if grid_cell < map.heights().len() && grid_cell < map.building_nums().len() { + let near_building_num = map.building_num(grid_cell); + let surface_is_water = map.surface_is_water(grid_cell); + + if near_building_num == 0 && surface_is_water { + return 0.0005; + } + + if near_building_num >= 10 { + return 1.6; + } + + return ROUGHNESS_LENGTHS[2 + std::cmp::min(near_building_num as usize, 6)]; + } + } + + 0.0024 +} + +const DRY_AIR_MOLAR_MASS: f64 = 0.028964; +const WATOR_VAPOR_MOLAR_MASS: f64 = 0.018016; +const UNIVERSAL_GAS_CONSTANT: f64 = 8.31432; +const SPECIFIC_GAST_CONSTANT_DRY_AIR: f64 = UNIVERSAL_GAS_CONSTANT / DRY_AIR_MOLAR_MASS; +pub fn calculate_air_density( + temperature: Temperature, + pressure: f64, + relative_humidity: f64, +) -> f64 { + let temperature = temperature.as_celsius(); + let pressure = pressure * 100.0; + if relative_humidity > 0.0 { + // 610.78 gives pressure in Pa - https://en.wikipedia.org/wiki/Density_of_air + let p_sat = 610.78 * 10_f64.powf(7.5 * temperature / (temperature + 237.3)); + let vapor_pressure = relative_humidity * p_sat; + let partial_pressure = pressure - vapor_pressure; + + partial_pressure.mul_add(DRY_AIR_MOLAR_MASS, vapor_pressure * WATOR_VAPOR_MOLAR_MASS) + / (UNIVERSAL_GAS_CONSTANT * temperature) + } else { + pressure / (SPECIFIC_GAST_CONSTANT_DRY_AIR * temperature) + } +} + +const STD_AIR_DENSITY_ICAO: f64 = 1.22498; +const STD_AIR_DENSITY_ASM: f64 = 1.20886; +pub fn calculate_atmospheric_correction( + ballistic_coefficient: f64, + temperature: Temperature, + pressure: f64, + relative_humidity: f64, + atmosphere_model: AtmosphereModel, +) -> f64 { + let air_density = calculate_air_density(temperature, pressure, relative_humidity); + match atmosphere_model { + AtmosphereModel::Icao => (STD_AIR_DENSITY_ICAO / air_density) * ballistic_coefficient, + AtmosphereModel::Asm => (STD_AIR_DENSITY_ASM / air_density) * ballistic_coefficient, + } +} + +pub fn speed_of_sound(temperature: Temperature) -> f64 { + 331.3 * (1.0 + temperature.as_celsius() / 273.15).sqrt() +} + +#[cfg(test)] +mod tests { + use crate::ballistics::temperature::Temperature; + + #[test] + fn speed_of_sound() { + assert_eq!( + super::speed_of_sound(Temperature::new_celsius(-15.0)), + 322.07491299796527 + ); + assert_eq!(super::speed_of_sound(Temperature::new_celsius(0.0)), 331.3); + assert_eq!( + super::speed_of_sound(Temperature::new_celsius(15.0)), + 340.2750805118605 + ); + } +} diff --git a/extension/src/ballistics/bullet/mod.rs b/extension/src/ballistics/bullet/mod.rs new file mode 100644 index 00000000000..891cbaab778 --- /dev/null +++ b/extension/src/ballistics/bullet/mod.rs @@ -0,0 +1,130 @@ +use std::collections::HashMap; + +use arma_rs::Group; + +mod model; +pub use model::Bullet; +use uuid::Uuid; + +use crate::common::Vector3; + +use super::{ + atmosphere::AtmosphereModel, + drag::DragFunction, + map::{CURRENT_MAP, MAPS}, + temperature::Temperature, +}; + +pub fn group() -> Group { + Group::new() + .command("new", new) + .command("simulate", simulate) + .command("delete", delete) +} + +static mut BULLET_LIST: Option> = None; + +#[allow(clippy::too_many_arguments)] +/// Create a new bullet and return its UUID. +fn new( + ammo_count: u64, + air_friction: f64, + ballistic_coefficients: Vec, + velocity_boundaries: Vec, + atmosphere_model: AtmosphereModel, + drag_function: DragFunction, + stability_factor: f64, + twist_direction: f64, + transonic_stability_coefficient: f64, + origin: Vector3, + bullet_velocity: Vector3, + latitude: f64, + temperature: Temperature, + altitude: f64, + humidity: f64, + overcast: f64, + start_time: f64, +) -> Uuid { + let id = Uuid::new_v4(); + let bullet = Bullet { + air_friction, + bullet_caliber: 0.0, + bullet_length: 0.0, + bullet_mass: 0.0, + ballistic_coefficients, + velocity_boundaries, + atmosphere_model, + drag_function, + muzzle_velocities: vec![0.0, 0.0], + barrel_length: 0.0, + stability_factor, + twist_direction, + transonic_stability_coefficient, + bullet_velocity_last_frame: bullet_velocity, + origin, + latitude, + temperature, + altitude, + humidity, + overcast, + start_time, + last_frame: 0.0, + rng: rand::SeedableRng::seed_from_u64({ + let k1 = (start_time / 2.0).round(); + let k2 = ammo_count as f64; + (0.5 * (k1 + k2) * (k1 + k2 + 1.0) + k2) as u64 + }), + }; + // Safety: this is all single threaded, so no need to lock + unsafe { + if BULLET_LIST.is_none() { + BULLET_LIST = Some(HashMap::new()); + } + BULLET_LIST.as_mut().unwrap().insert(id.to_string(), bullet); + } + id +} + +/// Simulate a bullet for a given time. Returns the velocity +fn simulate( + id: String, + bullet_velocity: Vector3, + bullet_position: Vector3, + wind: Vector3, + altitude: f64, + time: f64, +) -> Result { + // Safety: this is all single threaded, so no need to lock + unsafe { + if let Some(map) = MAPS.as_ref() { + let bullet = { + if BULLET_LIST.is_none() { + BULLET_LIST = Some(HashMap::new()); + } + BULLET_LIST.as_mut().unwrap().get_mut(&id).unwrap() + }; + Ok(bullet.simulate( + map.get(CURRENT_MAP.as_ref().unwrap()).unwrap(), + bullet_velocity, + bullet_position, + wind, + altitude, + time, + )) + } else { + Err("No map loaded".to_string()) + } + } +} + +/// Delete a bullet +/// Returns true if the bullet was found and deleted +fn delete(id: String) -> bool { + // Safety: this is all single threaded, so no need to lock + unsafe { + if BULLET_LIST.is_none() { + BULLET_LIST = Some(HashMap::new()); + } + BULLET_LIST.as_mut().unwrap().remove(&id).is_some() + } +} diff --git a/extension/src/ballistics/bullet/model.rs b/extension/src/ballistics/bullet/model.rs new file mode 100644 index 00000000000..d3e146426be --- /dev/null +++ b/extension/src/ballistics/bullet/model.rs @@ -0,0 +1,220 @@ +use std::f64::consts::PI; + +use rand::{distributions::Uniform, prelude::Distribution}; +use rand_chacha::ChaCha8Rng; + +use crate::{ + ballistics::{ + atmosphere::{ + calculate_air_density, calculate_atmospheric_correction, calculate_roughness_length, + speed_of_sound, AtmosphereModel, + }, + drag::{calculate_retard, DragFunction}, + map::Map, + temperature::Temperature, + GRAVITY, + }, + common::Vector3, +}; + +const STD_AIR_DENSITY_ICAO: f64 = 1.22498; + +pub struct Bullet { + pub air_friction: f64, + pub bullet_caliber: f64, + pub bullet_length: f64, + pub bullet_mass: f64, + pub ballistic_coefficients: Vec, + pub velocity_boundaries: Vec, + pub atmosphere_model: AtmosphereModel, + pub drag_function: DragFunction, + pub muzzle_velocities: Vec, + pub barrel_length: f64, + pub stability_factor: f64, + pub twist_direction: f64, + pub transonic_stability_coefficient: f64, + pub bullet_velocity_last_frame: Vector3, + pub origin: Vector3, + pub latitude: f64, + pub temperature: Temperature, + pub altitude: f64, + pub humidity: f64, + pub overcast: f64, + pub start_time: f64, + pub last_frame: f64, + pub rng: ChaCha8Rng, +} + +impl Bullet { + pub fn simulate( + &mut self, + map: &Map, + bullet_velocity_current_frame: Vector3, + bullet_position: Vector3, + mut wind: Vector3, + height_atl: f64, + time: f64, + ) -> Vector3 { + let gravity_accel = Vector3::new(0.0, 0.0, -GRAVITY); + + let mut tof = time - self.start_time; + let delta_time = time - self.last_frame; + + let temperature = + Temperature::new_celsius(self.temperature.as_celsius() - 0.0065 * bullet_position.z()); + let pressure = (1010.32 - 10.0 * self.overcast) + * (1.0 + - (0.0065 * (self.altitude + bullet_position.z())) + / (temperature.as_kelvin() + 0.0065 * self.altitude)) + .powf(5.255754495); + + self.last_frame = time; + + if wind.magnitude() > 0.1 { + let mut wind_attenuation = 1.0; + let wind_source_terrain = bullet_position - wind.normalize() * 100.0; + + let grid_x = (wind_source_terrain.x() / 50.0).floor() as i64; + let grid_y = (wind_source_terrain.y() / 50.0).floor() as i64; + let grid_cell = grid_x * map.grids() as i64 + grid_y; + + if grid_cell >= 0 { + let grid_cell = grid_cell as usize; + if grid_cell < map.heights().len() && grid_cell < map.building_nums().len() { + let grid_height = map.height(grid_cell) as f64; + if grid_height > bullet_position.z() { + let angle = ((grid_height - bullet_position.z()) / 100.0).atan(); + wind_attenuation *= angle.cos().abs().powi(2); + } + } + } + + if height_atl > 0.0 && height_atl < 20.0 { + let wind_source_obstacles = bullet_position - wind.normalize() * 25.0; + let roughness_length = calculate_roughness_length( + map, + wind_source_obstacles.x(), + wind_source_obstacles.y(), + ); + wind_attenuation *= 0.0f64 + .max((height_atl / roughness_length).ln() / (20.0 / roughness_length).ln()); + } + + wind *= wind_attenuation; + } + + let mut velocity_offset = Vector3::default(); + + { + let mut bullet_velocity = self.bullet_velocity_last_frame; + let mut time = 0.0; + while time < delta_time { + let dt = (delta_time - time).min(0.005); + let drag_ref = -self.air_friction * bullet_velocity.magnitude_squared(); + let accel_ref = bullet_velocity.normalize() * drag_ref; + + velocity_offset += accel_ref * dt; + bullet_velocity -= accel_ref * dt; + bullet_velocity += gravity_accel * dt; + + time += dt; + } + } + + let mut bullet_velocity = self.bullet_velocity_last_frame; + let mut time = 0.0; + tof -= delta_time; + + while time < delta_time { + let dt = (delta_time - time).min(0.005 * 2.0); + + let mut true_velocity = bullet_velocity - wind; + + let sound_speed = speed_of_sound(temperature); + if self.transonic_stability_coefficient < 1.0 + && true_velocity.magnitude() < 1.2 * sound_speed + && true_velocity.magnitude() > 0.8 * sound_speed + { + let distribution = Uniform::from(-10.0..10.0); + let offset = Vector3::new( + distribution.sample(&mut self.rng), + distribution.sample(&mut self.rng), + distribution.sample(&mut self.rng), + ); + let coef = 1.0 - self.transonic_stability_coefficient; + let true_speed = true_velocity.magnitude(); + true_velocity += offset * coef; + true_velocity = true_velocity.normalize() * true_speed; + } + + let drag = if self.ballistic_coefficients.len() == self.velocity_boundaries.len() + 1 { + let mut ballistic_coefficient = self.ballistic_coefficients[0]; + for (i, boundry) in self.velocity_boundaries.iter().enumerate() { + if true_velocity.magnitude() < *boundry { + ballistic_coefficient = self.ballistic_coefficients[i + 1]; + break; + } + } + + ballistic_coefficient = calculate_atmospheric_correction( + ballistic_coefficient, + temperature, + pressure, + self.humidity, + self.atmosphere_model, + ); + + calculate_retard( + self.drag_function, + ballistic_coefficient, + true_velocity.magnitude(), + speed_of_sound(temperature), + ) + } else { + let air_density = calculate_air_density(temperature, pressure, self.humidity); + let air_friction = self.air_friction * air_density / STD_AIR_DENSITY_ICAO; + + -air_friction * true_velocity.magnitude_squared() + }; + + let accel = true_velocity.normalize() * drag; + + velocity_offset -= accel * dt; + bullet_velocity -= accel * dt; + + if tof > 0.0 { + let bullet_dir = bullet_velocity.x().atan2(bullet_velocity.y()); + let drift_accel = self.twist_direction + * (0.0482252 * (self.stability_factor + 1.2)) + / tof.powf(0.17); + let drift_velocity = 0.0581025 * (self.stability_factor + 1.2) * tof.powf(0.83); + let drag_correction = (drift_velocity / true_velocity.magnitude()) * drag; + let magnitude = (drift_accel + drag_correction) * dt; + let offset = Vector3::new( + (bullet_dir + PI / 2.0).sin() * magnitude, + (bullet_dir + PI / 2.0).cos() * magnitude, + 0.0, + ); + velocity_offset += offset; + bullet_velocity += offset; + } + + let lat = self.latitude; + const EARTH_ANGULAR_SPEED: f64 = 0.00007292; + let accel = Vector3::new( + 2.0 * EARTH_ANGULAR_SPEED + * (bullet_velocity.y() * lat.sin() - bullet_velocity.x() * lat.cos()), + 2.0 * EARTH_ANGULAR_SPEED * -(bullet_velocity.x() * lat.sin()), + 2.0 * EARTH_ANGULAR_SPEED * (bullet_velocity.x() * lat.cos()), + ); + + velocity_offset += accel * dt; + bullet_velocity -= accel * dt + gravity_accel * dt; + + tof += dt; + time += dt; + } + self.bullet_velocity_last_frame = bullet_velocity_current_frame + velocity_offset; + self.bullet_velocity_last_frame + } +} diff --git a/extension/src/ballistics/drag.rs b/extension/src/ballistics/drag.rs new file mode 100644 index 00000000000..ca00888232a --- /dev/null +++ b/extension/src/ballistics/drag.rs @@ -0,0 +1,174 @@ +#![allow(clippy::approx_constant)] + +use arma_rs::FromArma; + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum DragFunction { + G1, + G2, + G5, + G6, + G7, + G8, +} + +impl FromArma for DragFunction { + fn from_arma(s: String) -> Result { + match s.as_str() { + "1" => Ok(Self::G1), + "2" => Ok(Self::G2), + "5" => Ok(Self::G5), + "6" => Ok(Self::G6), + "7" => Ok(Self::G7), + "8" => Ok(Self::G8), + _ => Err(format!("Unknown drag function: {}", s)), + } + } +} + +impl DragFunction { + pub fn drag_coefficients(&self) -> Vec { + match self { + DragFunction::G1 => vec![ + 0.2629, 0.2558, 0.2487, 0.2413, 0.2344, 0.2278, 0.2214, 0.2155, 0.2104, 0.2061, + 0.2032, 0.2020, 0.2034, 0.2165, 0.2230, 0.2313, 0.2417, 0.2546, 0.2706, 0.2901, + 0.3136, 0.3415, 0.3734, 0.4084, 0.4448, 0.4805, 0.5136, 0.5427, 0.5677, 0.5883, + 0.6053, 0.6191, 0.6393, 0.6518, 0.6589, 0.6621, 0.6625, 0.6607, 0.6573, 0.6528, + 0.6474, 0.6413, 0.6347, 0.6280, 0.6210, 0.6141, 0.6072, 0.6003, 0.5934, 0.5867, + 0.5804, 0.5743, 0.5685, 0.5630, 0.5577, 0.5527, 0.5481, 0.5438, 0.5397, 0.5325, + 0.5264, 0.5211, 0.5168, 0.5133, 0.5105, 0.5084, 0.5067, 0.5054, 0.5040, 0.5030, + 0.5022, 0.5016, 0.5010, 0.5006, 0.4998, 0.4995, 0.4992, 0.4990, 0.4988, + ], + DragFunction::G2 => vec![ + 0.2303, 0.2298, 0.2287, 0.2271, 0.2251, 0.2227, 0.2196, 0.2156, 0.2107, 0.2048, + 0.1980, 0.1905, 0.1828, 0.1758, 0.1702, 0.1669, 0.1664, 0.1667, 0.1682, 0.1711, + 0.1761, 0.1831, 0.2004, 0.2589, 0.3492, 0.3983, 0.4075, 0.4103, 0.4114, 0.4106, + 0.4089, 0.4068, 0.4046, 0.4021, 0.3966, 0.3904, 0.3835, 0.3759, 0.3678, 0.3594, + 0.3512, 0.3432, 0.3356, 0.3282, 0.3213, 0.3149, 0.3089, 0.3033, 0.2982, 0.2933, + 0.2889, 0.2846, 0.2806, 0.2768, 0.2731, 0.2696, 0.2663, 0.2632, 0.2602, 0.2572, + 0.2543, 0.2515, 0.2487, 0.2460, 0.2433, 0.2408, 0.2382, 0.2357, 0.2333, 0.2309, + 0.2262, 0.2217, 0.2173, 0.2132, 0.2091, 0.2052, 0.2014, 0.1978, 0.1944, 0.1912, + 0.1851, 0.1794, 0.1741, 0.1693, 0.1648, + ], + DragFunction::G5 => vec![ + 0.1710, 0.1719, 0.1727, 0.1732, 0.1734, 0.1730, 0.1718, 0.1696, 0.1668, 0.1637, + 0.1603, 0.1566, 0.1529, 0.1497, 0.1473, 0.1463, 0.1489, 0.1583, 0.1672, 0.1815, + 0.2051, 0.2413, 0.2884, 0.3379, 0.3785, 0.4032, 0.4147, 0.4201, 0.4278, 0.4338, + 0.4373, 0.4392, 0.4403, 0.4406, 0.4401, 0.4386, 0.4362, 0.4328, 0.4286, 0.4237, + 0.4182, 0.4121, 0.4057, 0.3991, 0.3926, 0.3861, 0.3800, 0.3741, 0.3684, 0.3630, + 0.3578, 0.3529, 0.3481, 0.3435, 0.3391, 0.3349, 0.3269, 0.3194, 0.3125, 0.3060, + 0.2999, 0.2942, 0.2889, 0.2838, 0.2790, 0.2745, 0.2703, 0.2662, 0.2624, 0.2588, + 0.2553, 0.2488, 0.2429, 0.2376, 0.2326, 0.2280, + ], + DragFunction::G6 => vec![ + 0.2617, 0.2553, 0.2491, 0.2432, 0.2376, 0.2324, 0.2278, 0.2238, 0.2205, 0.2177, + 0.2155, 0.2138, 0.2126, 0.2121, 0.2122, 0.2132, 0.2154, 0.2194, 0.2229, 0.2297, + 0.2449, 0.2732, 0.3141, 0.3597, 0.3994, 0.4261, 0.4402, 0.4465, 0.4490, 0.4497, + 0.4494, 0.4482, 0.4464, 0.4441, 0.4390, 0.4336, 0.4279, 0.4221, 0.4162, 0.4102, + 0.4042, 0.3981, 0.3919, 0.3855, 0.3788, 0.3721, 0.3652, 0.3583, 0.3515, 0.3447, + 0.3381, 0.3314, 0.3249, 0.3185, 0.3122, 0.3060, 0.3000, 0.2941, 0.2883, 0.2772, + 0.2668, 0.2574, 0.2487, 0.2407, 0.2333, 0.2265, 0.2202, 0.2144, 0.2089, 0.2039, + 0.1991, 0.1947, 0.1905, 0.1866, 0.1794, 0.1730, 0.1673, 0.1621, 0.1574, + ], + DragFunction::G7 => vec![ + 0.1198, 0.1197, 0.1196, 0.1194, 0.1193, 0.1194, 0.1194, 0.1194, 0.1193, 0.1193, + 0.1194, 0.1193, 0.1194, 0.1197, 0.1202, 0.1207, 0.1215, 0.1226, 0.1242, 0.1266, + 0.1306, 0.1368, 0.1464, 0.1660, 0.2054, 0.2993, 0.3803, 0.4015, 0.4043, 0.4034, + 0.4014, 0.3987, 0.3955, 0.3884, 0.3810, 0.3732, 0.3657, 0.3580, 0.3440, 0.3376, + 0.3315, 0.3260, 0.3209, 0.3160, 0.3117, 0.3078, 0.3042, 0.3010, 0.2980, 0.2951, + 0.2922, 0.2892, 0.2864, 0.2835, 0.2807, 0.2779, 0.2752, 0.2725, 0.2697, 0.2670, + 0.2643, 0.2615, 0.2588, 0.2561, 0.2533, 0.2506, 0.2479, 0.2451, 0.2424, 0.2368, + 0.2313, 0.2258, 0.2205, 0.2154, 0.2106, 0.2060, 0.2017, 0.1975, 0.1935, 0.1861, + 0.1793, 0.1730, 0.1672, 0.1618, + ], + DragFunction::G8 => vec![ + 0.2105, 0.2105, 0.2104, 0.2104, 0.2103, 0.2103, 0.2103, 0.2103, 0.2103, 0.2102, + 0.2102, 0.2102, 0.2102, 0.2102, 0.2103, 0.2103, 0.2104, 0.2104, 0.2105, 0.2106, + 0.2109, 0.2183, 0.2571, 0.3358, 0.4068, 0.4378, 0.4476, 0.4493, 0.4477, 0.4450, + 0.4419, 0.4353, 0.4283, 0.4208, 0.4133, 0.4059, 0.3986, 0.3915, 0.3845, 0.3777, + 0.3710, 0.3645, 0.3581, 0.3519, 0.3458, 0.3400, 0.3343, 0.3288, 0.3234, 0.3182, + 0.3131, 0.3081, 0.3032, 0.2983, 0.2937, 0.2891, 0.2845, 0.2802, 0.2720, 0.2642, + 0.2569, 0.2499, 0.2432, 0.2368, 0.2308, 0.2251, 0.2197, 0.2147, 0.2101, 0.2058, + 0.2019, 0.1983, 0.1950, 0.1890, 0.1837, 0.1791, 0.1750, 0.1713, + ], + } + } + + fn mach_numbers(&self) -> Vec { + match self { + DragFunction::G1 => vec![ + 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.70, + 0.725, 0.75, 0.775, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, + 1.05, 1.075, 1.10, 1.125, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, + 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, + 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, + 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00, + ], + DragFunction::G2 => vec![ + 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, + 0.70, 0.75, 0.775, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, + 1.05, 1.075, 1.10, 1.125, 1.15, 1.175, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, + 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, + 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.55, 2.60, 2.65, 2.70, 2.75, 2.80, 2.85, 2.90, + 2.95, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, + 4.60, 4.80, 5.00, + ], + DragFunction::G5 => vec![ + 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, + 0.70, 0.75, 0.80, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, + 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, + 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, + 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, + 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00, + ], + DragFunction::G6 => vec![ + 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, + 0.70, 0.75, 0.80, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, + 1.10, 1.125, 1.15, 1.175, 1.20, 1.225, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, + 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, + 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, + 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00, + ], + DragFunction::G7 => vec![ + 0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, + 0.70, 0.725, 0.75, 0.775, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, + 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.50, 1.55, + 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, + 2.30, 2.35, 2.40, 2.45, 2.50, 2.55, 2.60, 2.65, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, + 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, + 4.80, 5.00, + ], + DragFunction::G8 => vec![ + 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, + 0.70, 0.75, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, + 1.075, 1.10, 1.125, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, + 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, + 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, + 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00, + ], + } + } +} + +const BC_CONVERSION_FACTOR: f64 = 0.00068418; +pub fn calculate_retard( + drag_function: DragFunction, + ballistic_coefficient: f64, + velocity: f64, + mach: f64, +) -> f64 { + let m = velocity / mach; + for (i, mach_number) in drag_function.mach_numbers().iter().enumerate() { + if *mach_number >= m { + let previous = std::cmp::max(0, i - 1); + let previous_drag_coefficient = drag_function.drag_coefficients()[previous]; + let previous_mach_number = drag_function.mach_numbers()[previous]; + let cd = previous_drag_coefficient + + (drag_function.drag_coefficients()[i] - previous_drag_coefficient) + * (m - previous_mach_number) + / (drag_function.mach_numbers()[i] - previous_mach_number); + return BC_CONVERSION_FACTOR * (cd / ballistic_coefficient) * velocity.powi(2); + } + } + 0.0 +} diff --git a/extension/src/ballistics/map/mod.rs b/extension/src/ballistics/map/mod.rs new file mode 100644 index 00000000000..ce7855e2d5f --- /dev/null +++ b/extension/src/ballistics/map/mod.rs @@ -0,0 +1,43 @@ +use std::collections::HashMap; + +use arma_rs::Group; + +mod model; +pub use model::Map; + +pub fn group() -> Group { + Group::new().command("init", init).command("set", set) +} + +pub static mut MAPS: Option> = None; +pub static mut CURRENT_MAP: Option = None; + +fn init(name: String, size: u32) -> Result { + // Safety: this is all single threaded, so no need to lock + unsafe { + if MAPS.is_none() { + MAPS = Some(HashMap::new()) + } + CURRENT_MAP = Some(name.clone()); + if MAPS.as_ref().unwrap().contains_key(&name) { + return Ok(true); + } + MAPS.as_mut() + .unwrap() + .insert(name, Map::new(size, (size / 50) + 1)); + } + Ok(false) +} + +fn set(grid: u64, height: i64, num_objects: i64, surface_is_water: bool) { + // Safety: this is all single threaded, so no need to lock + unsafe { + if MAPS.is_none() { + return; + } + let map = MAPS.as_mut().unwrap().get_mut(&grid.to_string()).unwrap(); + map.set_height(grid as usize, height); + map.set_building_num(grid as usize, num_objects); + map.set_surface_is_water(grid as usize, surface_is_water); + } +} diff --git a/extension/src/ballistics/map/model.rs b/extension/src/ballistics/map/model.rs new file mode 100644 index 00000000000..277f663261b --- /dev/null +++ b/extension/src/ballistics/map/model.rs @@ -0,0 +1,59 @@ +pub struct Map { + heights: Vec, + building_nums: Vec, + surface_is_water: Vec, + size: u32, + grids: u32, +} + +impl Map { + pub fn new(size: u32, grids: u32) -> Self { + Self { + heights: vec![0; (size * grids) as usize], + building_nums: vec![0; (size * grids) as usize], + surface_is_water: vec![false; (size * grids) as usize], + size, + grids, + } + } + + pub const fn heights(&self) -> &Vec { + &self.heights + } + + pub fn height(&self, cell: usize) -> i64 { + self.heights[cell] + } + + pub fn set_height(&mut self, cell: usize, height: i64) { + self.heights[cell] = height; + } + + pub const fn building_nums(&self) -> &Vec { + &self.building_nums + } + + pub fn building_num(&self, index: usize) -> i64 { + self.building_nums[index] + } + + pub fn set_building_num(&mut self, index: usize, num: i64) { + self.building_nums[index] = num; + } + + pub fn surface_is_water(&self, index: usize) -> bool { + self.surface_is_water[index] + } + + pub fn set_surface_is_water(&mut self, index: usize, is_water: bool) { + self.surface_is_water[index] = is_water; + } + + pub const fn size(&self) -> u32 { + self.size + } + + pub const fn grids(&self) -> u32 { + self.grids + } +} diff --git a/extension/src/ballistics/mod.rs b/extension/src/ballistics/mod.rs new file mode 100644 index 00000000000..f24b70a0b5b --- /dev/null +++ b/extension/src/ballistics/mod.rs @@ -0,0 +1,141 @@ +use arma_rs::Group; + +use self::{ + atmosphere::{calculate_atmospheric_correction, speed_of_sound}, + drag::calculate_retard, +}; + +const GRAVITY: f64 = 9.80665; + +mod atmosphere; +mod bullet; +mod drag; +mod map; +mod temperature; +mod zero; + +pub use self::{atmosphere::AtmosphereModel, temperature::Temperature, map::Map, drag::DragFunction}; + +pub enum BallisticModel { + Vanilla( + /// Air friction + f64, + ), + Advanced(AdvancedBallistics), +} + +pub struct AdvancedBallistics { + temperature: Temperature, + pressure: f64, + relative_humidity: f64, + ballistic_coefficient: f64, + drag_function: DragFunction, + atmosphere_model: AtmosphereModel, +} + +impl AdvancedBallistics { + pub fn temperature(&self) -> Temperature { + self.temperature + } + + pub fn pressure(&self) -> f64 { + self.pressure + } + + pub fn relative_humidity(&self) -> f64 { + self.relative_humidity + } + + pub fn ballistic_coefficient(&self) -> f64 { + self.ballistic_coefficient + } + + pub fn drag_function(&self) -> DragFunction { + self.drag_function + } + + pub fn atmosphere_model(&self) -> AtmosphereModel { + self.atmosphere_model + } +} + +pub fn group() -> Group { + Group::new() + .command("retard", retard) + .command("atmospheric_correction", atmospheric_correction) + .command("replicate_vanilla_zero", replicate_vanilla_zero) + .command("zero_vanilla", zero_vanilla) + .command("zero_advanced", zero_advanced) + .group("bullet", bullet::group()) + .group("map", map::group()) +} + +fn retard( + drag_function: DragFunction, + ballistic_coefficient: f64, + velocity: f64, + temperature: Temperature, +) -> f64 { + calculate_retard( + drag_function, + ballistic_coefficient, + velocity, + speed_of_sound(temperature), + ) +} + +fn atmospheric_correction( + ballistic_coefficient: f64, + temperature: Temperature, + pressure: f64, + relative_humidity: f64, + atmosphere_model: AtmosphereModel, +) -> f64 { + calculate_atmospheric_correction( + ballistic_coefficient, + temperature, + pressure, + relative_humidity, + atmosphere_model, + ) +} + +fn replicate_vanilla_zero(zero_range: f64, muzzle_velocity: f64, air_friction: f64) -> f64 { + zero::replicate_vanilla_zero(zero_range, muzzle_velocity, air_friction) +} + +fn zero_vanilla(zero_range: f64, muzzle_velocity: f64, air_friction: f64, bore_height: f64) -> f64 { + zero::calculate_zero( + zero_range, + muzzle_velocity, + bore_height, + BallisticModel::Vanilla(air_friction), + ) +} + +#[allow(clippy::too_many_arguments)] +fn zero_advanced( + zero_range: f64, + muzzle_velocity: f64, + bore_height: f64, + temperature: Temperature, + pressure: f64, + relative_humidity: f64, + ballistic_coefficient: f64, + drag_function: DragFunction, + atmosphere_model: AtmosphereModel, +) -> f64 { + zero::calculate_zero( + zero_range, + muzzle_velocity, + bore_height, + BallisticModel::Advanced(AdvancedBallistics { + temperature, + pressure, + relative_humidity, + ballistic_coefficient, + drag_function, + atmosphere_model, + }), + ) +} diff --git a/extension/src/ballistics/temperature.rs b/extension/src/ballistics/temperature.rs new file mode 100644 index 00000000000..06aaa1bb166 --- /dev/null +++ b/extension/src/ballistics/temperature.rs @@ -0,0 +1,56 @@ +use arma_rs::FromArma; + +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct Temperature(f64); + +impl Temperature { + pub fn new_celsius(value: f64) -> Self { + Self(value + 273.15) + } + + pub fn new_kelvin(value: f64) -> Self { + Self(value) + } + + pub fn new_fahrenheit(value: f64) -> Self { + Self((value - 32.0) * 5.0 / 9.0 + 273.15) + } + + pub fn as_celsius(&self) -> f64 { + self.0 - 273.15 + } + + pub fn as_kelvin(&self) -> f64 { + self.0 + } + + pub fn as_fahrenheit(&self) -> f64 { + (self.0 - 273.15) * 9.0 / 5.0 + 32.0 + } +} + +impl FromArma for Temperature { + fn from_arma(s: String) -> Result { + if s.is_empty() { + return Err(String::from("unexpected empty string")); + } + match s.chars().next().unwrap() { + 'c' => { + let temp = s[1..].parse::().map_err(|e| format!("{}", e))?; + Ok(Temperature::new_celsius(temp)) + } + 'f' => { + let temp = s[1..].parse::().map_err(|e| format!("{}", e))?; + Ok(Temperature::new_fahrenheit(temp)) + } + 'k' => { + let temp = s[1..].parse::().map_err(|e| format!("{}", e))?; + Ok(Temperature::new_kelvin(temp)) + } + _ => { + let temp = s.parse::().map_err(|e| format!("{}", e))?; + Ok(Temperature::new_celsius(temp)) + } + } + } +} diff --git a/extension/src/ballistics/zero.rs b/extension/src/ballistics/zero.rs new file mode 100644 index 00000000000..f02ef312801 --- /dev/null +++ b/extension/src/ballistics/zero.rs @@ -0,0 +1,102 @@ +use crate::common::Vector3; + +use super::{drag::calculate_retard, BallisticModel, GRAVITY}; + +pub fn replicate_vanilla_zero(zero_range: f64, muzzle_velocity: f64, air_friction: f64) -> f64 { + let max_delta_time = 0.5; + let mut time = 0.0; + let mut current_shot_position = Vector3::default(); + let mut current_shot_velocity = Vector3::new(muzzle_velocity, 0.0, 0.0); + + while time < 8.0 { + let dist_left = zero_range - current_shot_position.x(); + let traveled = current_shot_velocity.x() * max_delta_time; + if dist_left < traveled { + let delta_time = dist_left / current_shot_velocity.x(); + current_shot_velocity -= Vector3::new(0.0, GRAVITY * delta_time, 0.0); + current_shot_position += current_shot_velocity * delta_time; + break; + } else { + let delta_time = max_delta_time; + current_shot_position += current_shot_velocity * delta_time; + current_shot_velocity += current_shot_velocity + * (current_shot_velocity.magnitude() * air_friction * delta_time); + time += delta_time; + current_shot_velocity -= Vector3::new(0.0, GRAVITY * delta_time, 0.0); + } + } + (current_shot_position.y() / zero_range).atan() +} + +const SPEED_OF_SOUND_AT_15C: f64 = 340.275; + +pub fn calculate_zero( + zero_range: f64, + muzzle_velocity: f64, + bore_height: f64, + ballistic_model: BallisticModel, +) -> f64 { + let mut zero_angle = 0.0f64; + let delta_time = 1.0 / 100.0f64.max(zero_range); + + for _ in 0..10 { + let mut lx = 0.0; + let mut ly = 0.0; + + let mut px = 0.0; + let mut py = -bore_height / 100.0; + + let gx = zero_angle.sin() * -GRAVITY; + let gy = zero_angle.cos() * -GRAVITY; + + let mut vx = zero_angle.cos() * muzzle_velocity; + let mut vy = zero_angle.sin() * muzzle_velocity; + + let mut tof = 0.0f64; + + while tof < 8.0 && px < zero_range { + lx = px; + ly = py; + + let v = (vx * vx + vy * vy).sqrt(); + + let (ax, ay) = match &ballistic_model { + BallisticModel::Vanilla(air_friction) => { + ((vx * v * air_friction) + gx, (vy * v * air_friction) + gy) + } + BallisticModel::Advanced(advanced) => { + let retard = calculate_retard( + advanced.drag_function(), + super::atmosphere::calculate_atmospheric_correction( + advanced.ballistic_coefficient(), + advanced.temperature(), + advanced.pressure(), + advanced.relative_humidity(), + advanced.atmosphere_model(), + ), + v, + SPEED_OF_SOUND_AT_15C, + ); + ((vx / v * -retard) + gx, (vy / v * -retard) + gy) + } + }; + + px += vx * delta_time * 0.5; + py += vy * delta_time * 0.5; + vx += ax * delta_time; + vy += ay * delta_time; + px += vx * delta_time * 0.5; + py += vy * delta_time * 0.5; + + tof += delta_time; + } + let y = ly + (zero_range - lx) * (py - ly) / (px - lx); + let offset = -(y / zero_range).atan(); + zero_angle += offset; + + if offset.abs() < 0.00001 { + break; + } + } + zero_angle +} diff --git a/extension/src/clipboard.rs b/extension/src/clipboard.rs new file mode 100644 index 00000000000..592acb0cb90 --- /dev/null +++ b/extension/src/clipboard.rs @@ -0,0 +1,33 @@ +use arma_rs::Group; +use clipboard::{ClipboardContext, ClipboardProvider}; + +pub fn group() -> Group { + Group::new() + .command("clear", clear) + .command("append", append) + .command("complete", complete) +} + +static mut BUFFER: String = String::new(); + +pub fn clear() { + unsafe { + BUFFER.clear(); + } +} + +pub fn append(text: String) -> Result<(), String> { + unsafe { + BUFFER.push_str(&text); + } + Ok(()) +} + +pub fn complete() -> Result<(), String> { + let mut ctx = ClipboardContext::new().unwrap(); + ctx.set_contents(unsafe { BUFFER.clone() }).unwrap(); + unsafe { + BUFFER = String::new(); + } + Ok(()) +} diff --git a/extension/src/common/mod.rs b/extension/src/common/mod.rs new file mode 100644 index 00000000000..984703b298e --- /dev/null +++ b/extension/src/common/mod.rs @@ -0,0 +1,2 @@ +mod vector3; +pub use vector3::Vector3; diff --git a/extension/src/common/vector3.rs b/extension/src/common/vector3.rs new file mode 100644 index 00000000000..3e20b82820a --- /dev/null +++ b/extension/src/common/vector3.rs @@ -0,0 +1,164 @@ +use arma_rs::{FromArma, IntoArma}; + +#[derive(Debug, Clone, Copy, PartialEq, Default)] +pub struct Vector3 { + x: f64, + y: f64, + z: f64, +} + +impl Vector3 { + pub fn new(x: f64, y: f64, z: f64) -> Self { + Self { x, y, z } + } + + pub fn x(&self) -> f64 { + self.x + } + + pub fn y(&self) -> f64 { + self.y + } + + pub fn z(&self) -> f64 { + self.z + } + + pub fn magnitude(&self) -> f64 { + self.magnitude_squared().sqrt() + } + + pub fn magnitude_squared(&self) -> f64 { + self.x * self.x + self.y * self.y + self.z * self.z + } + + pub fn normalize(&self) -> Self { + let magnitude = self.magnitude(); + Self { + x: self.x / magnitude, + y: self.y / magnitude, + z: self.z / magnitude, + } + } +} + +impl FromArma for Vector3 { + fn from_arma(s: String) -> Result { + let data = <[f64; 3]>::from_arma(s)?; + Ok(Self { + x: data[0], + y: data[1], + z: data[2], + }) + } +} + +impl IntoArma for Vector3 { + fn to_arma(&self) -> arma_rs::Value { + arma_rs::Value::Array(vec![ + arma_rs::Value::Number(self.x), + arma_rs::Value::Number(self.y), + arma_rs::Value::Number(self.z), + ]) + } +} + +impl std::ops::Add for Vector3 { + type Output = Self; + + fn add(self, other: Self) -> Self { + Self { + x: self.x + other.x, + y: self.y + other.y, + z: self.z + other.z, + } + } +} + +impl std::ops::AddAssign for Vector3 { + fn add_assign(&mut self, other: Self) { + self.x += other.x; + self.y += other.y; + self.z += other.z; + } +} + +impl std::ops::Sub for Vector3 { + type Output = Self; + + fn sub(self, other: Self) -> Self { + Self { + x: self.x - other.x, + y: self.y - other.y, + z: self.z - other.z, + } + } +} + +impl std::ops::SubAssign for Vector3 { + fn sub_assign(&mut self, other: Self) { + self.x -= other.x; + self.y -= other.y; + self.z -= other.z; + } +} + +impl std::ops::Mul for Vector3 { + type Output = Self; + + fn mul(self, other: Self) -> Self { + Self { + x: self.x * other.x, + y: self.y * other.y, + z: self.z * other.z, + } + } +} + +impl std::ops::Mul for Vector3 { + type Output = Self; + + fn mul(self, other: f64) -> Self { + Self { + x: self.x * other, + y: self.y * other, + z: self.z * other, + } + } +} + +impl std::ops::MulAssign for Vector3 { + fn mul_assign(&mut self, other: Self) { + self.x *= other.x; + self.y *= other.y; + self.z *= other.z; + } +} + +impl std::ops::MulAssign for Vector3 { + fn mul_assign(&mut self, other: f64) { + self.x *= other; + self.y *= other; + self.z *= other; + } +} + +impl std::ops::Div for Vector3 { + type Output = Self; + + fn div(self, other: Self) -> Self { + Self { + x: self.x / other.x, + y: self.y / other.y, + z: self.z / other.z, + } + } +} + +impl std::ops::DivAssign for Vector3 { + fn div_assign(&mut self, other: Self) { + self.x /= other.x; + self.y /= other.y; + self.z /= other.z; + } +} diff --git a/extension/src/lib.rs b/extension/src/lib.rs new file mode 100644 index 00000000000..3fb94857459 --- /dev/null +++ b/extension/src/lib.rs @@ -0,0 +1,13 @@ +use arma_rs::{arma, Extension}; + +pub mod ballistics; +mod clipboard; +mod common; + +#[arma] +fn init() -> Extension { + Extension::build() + .group("ballistics", ballistics::group()) + .group("clipboard", clipboard::group()) + .finish() +} diff --git a/extensions/.clang-format b/extensions/.clang-format deleted file mode 100644 index 89eb4f46862..00000000000 --- a/extensions/.clang-format +++ /dev/null @@ -1,9 +0,0 @@ -BasedOnStyle: Google -IndentWidth: 4 -ColumnLimit: 160 -DerivePointerAlignment: false -PointerAlignment: Left -NamespaceIndentation: All -IncludeBlocks: Merge - -AllowShortBlocksOnASingleLine: true diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt deleted file mode 100644 index 727d499d0d3..00000000000 --- a/extensions/CMakeLists.txt +++ /dev/null @@ -1,166 +0,0 @@ -cmake_minimum_required (VERSION 3.14) -project (ACE) - -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - -if(WIN32) -add_definitions(/DWINVER=0x0600 /D_WIN32_WINNT=0x0600) -endif() - -if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX) - message(STATUS "No build type selected, default to Debug") - set(CMAKE_BUILD_TYPE "Debug") -endif() - -option(DEVEL "DEVEL" OFF) -option(USE_BULLET "USE_BULLET" OFF) -option(USE_DIRECTX "USE_DIRECTX" OFF) -option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF) -option(USE_STATIC_LINKING "USE_STATIC_LINKING" ON) - -if(CMAKE_GENERATOR_PLATFORM MATCHES "x64") - set(USE_64BIT_BUILD ON) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS "-std=c++11 -pedantic -pedantic-errors -march=i686 -m32 -O2 -s -fPIC -fpermissive") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") - set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++") -elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - message(ERROR "SUPPORT NOT COMPLETE") -elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - add_definitions(-D_CRT_SECURE_NO_WARNINGS) # Disable MSVC *_s function warnings - - if(USE_64BIT_BUILD) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /Qpar-report:2") # Default SSE2 - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /arch:SSE2 /Qpar-report:2") - endif() - - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /D _DEBUG /MTd /Zi /Ob0 /Od /RTC1") - set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} /MT /O1 /Ob1 /D NDEBUG") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2 /Ob2 /D NDEBUG") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} /MT /Zi /O2 /Ob1 /D NDEBUG") -endif() - -include_directories("common") - -if(USE_BULLET) - # Dependencies - # - set(BACKUP_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) - set(BACKUP_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - set(BACKUP_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - - add_definitions(-DUSE_DIRECTX) - add_subdirectory(lib/bullet3) - - set_target_properties(App_BasicExample PROPERTIES FOLDER Bullet3) - set_target_properties(App_HelloWorld PROPERTIES FOLDER Bullet3) - set_target_properties(App_ExampleBrowser PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet2FileLoader PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3Collision PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3Dynamics PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3Geometry PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3Common PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3OpenCL_clew PROPERTIES FOLDER Bullet3) - set_target_properties(BulletCollision PROPERTIES FOLDER Bullet3) - set_target_properties(BulletDynamics PROPERTIES FOLDER Bullet3) - set_target_properties(BulletFileLoader PROPERTIES FOLDER Bullet3) - set_target_properties(BulletSoftBody PROPERTIES FOLDER Bullet3) - - set_target_properties(BulletWorldImporter PROPERTIES FOLDER Bullet3) - set_target_properties(BulletXmlWorldImporter PROPERTIES FOLDER Bullet3) - set_target_properties(ConvexDecomposition PROPERTIES FOLDER Bullet3) - set_target_properties(GIMPACTUtils PROPERTIES FOLDER Bullet3) - set_target_properties(gtest PROPERTIES FOLDER Bullet3) - set_target_properties(gwen PROPERTIES FOLDER Bullet3) - set_target_properties(HACD PROPERTIES FOLDER Bullet3) - set_target_properties(OpenGLWindow PROPERTIES FOLDER Bullet3) - set_target_properties(LinearMath PROPERTIES FOLDER Bullet3) - - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BACKUP_ARCHIVE_OUTPUT_DIRECTORY}) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BACKUP_LIBRARY_OUTPUT_DIRECTORY}) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BACKUP_RUNTIME_OUTPUT_DIRECTORY}) - - include_directories(BEFORE "lib/bullet3/src") -endif() -if(USE_DIRECTX) - add_definitions(-DUSE_DIRECTX) - set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) - find_package (DirectX) - link_directories (BEFORE ${DirectX_D3DX11_LIBRARY}) - include_directories (BEFORE ${DirectX_D3DX11_INCLUDE_DIR} ) -endif() -if(DEVEL) - add_definitions(-DDEVEL) -endif() - - -string(TIMESTAMP ACE_BUILDSTAMP "%Y-%m-%dT%H:%M:%SZ") -# Get current version from addon -file(READ "../addons/main/script_version.hpp" script_version) -string(REGEX MATCH "#define MAJOR ([0-9]*)" "x" outputX ${script_version}) -set(ACE_VERSION_MAJOR ${CMAKE_MATCH_1}) -string(REGEX MATCH "#define MINOR ([0-9]*)" "x" outputX ${script_version}) -set(ACE_VERSION_MINOR ${CMAKE_MATCH_1}) -string(REGEX MATCH "#define PATCHLVL ([0-9]*)" outputX ${script_version}) -set(ACE_VERSION_REVISION ${CMAKE_MATCH_1}) -EXECUTE_PROCESS(COMMAND git rev-parse --verify HEAD - OUTPUT_VARIABLE T_ACE_VERSION_BUILD - OUTPUT_STRIP_TRAILING_WHITESPACE -) -string(SUBSTRING ${T_ACE_VERSION_BUILD} 0 7 ACE_VERSION_BUILD ) - -message("Setting ACE Version: " ${ACE_VERSION_MAJOR}.${ACE_VERSION_MINOR}.${ACE_VERSION_REVISION}-${ACE_VERSION_BUILD}) - -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version.hpp.in" - "${CMAKE_CURRENT_BINARY_DIR}/common/ace_version.hpp" - @ONLY) - -if(MSVC) - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version_win32.rc.in" - "${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc" - @ONLY) - set(GLOBAL_RC ${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc) -endif() - -include_directories(${CMAKE_CURRENT_BINARY_DIR}/common) -set(GLOBAL_SOURCES ${GLOBAL_RC}) - - -# Add extensions to build here -add_subdirectory(common) - -# Extensions - -add_subdirectory(fcs) -add_subdirectory(break_line) -add_subdirectory(clipboard) -add_subdirectory(advanced_ballistics) -#add_subdirectory(medical) # After medical re-write this extension is no longer used -add_subdirectory(artillerytables) - -# Test Extension for dynamically loading/unloading built extensions; does not build in release -if (DEVEL) - add_subdirectory(dynload) - add_subdirectory(tests) - if(USE_DIRECTX) - add_subdirectory(lib/directxtk) - endif() -endif() - - -# GTest -option(ENABLE_GTEST "ENABLE_GTEST" ON) -if (ENABLE_GTEST) - include(FetchContent) - FetchContent_Declare(googletest GIT_REPOSITORY https://github.com/google/googletest.git) - # For Windows: Prevent overriding the parent project's compiler/linker settings - set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - FetchContent_MakeAvailable(googletest) -endif() - -message("Build Type: ${CMAKE_BUILD_TYPE}") diff --git a/extensions/advanced_ballistics/AdvancedBallistics.cpp b/extensions/advanced_ballistics/AdvancedBallistics.cpp deleted file mode 100644 index bc6b374da64..00000000000 --- a/extensions/advanced_ballistics/AdvancedBallistics.cpp +++ /dev/null @@ -1,711 +0,0 @@ -#include "shared.hpp" - -#include -#include -#include -#include -#include -#include -#include - -#include "vector.hpp" - -#define DELTA_T 0.005 -#define GRAVITY 9.8066f -#define DEGREES(X) (X * 180 / M_PI) -#define ABSOLUTE_ZERO_IN_CELSIUS -273.15f -#define KELVIN(t) (t - ABSOLUTE_ZERO_IN_CELSIUS) -#define CELSIUS(t) (t + ABSOLUTE_ZERO_IN_CELSIUS) -#define EARTH_ANGULAR_SPEED 0.00007292f -#define UNIVERSAL_GAS_CONSTANT 8.314f -#define WATER_VAPOR_MOLAR_MASS 0.018016f -#define DRY_AIR_MOLAR_MASS 0.028964f -#define SPECIFIC_GAS_CONSTANT_DRY_AIR 287.058f -#define STD_AIR_DENSITY_ICAO 1.22498f -#define STD_AIR_DENSITY_ASM 1.20885f -#define BC_CONVERSION_FACTOR 0.00068418f -#define SPEED_OF_SOUND(t) (331.3 * std::sqrt(1 + t / 273.15f)) -#define SPEED_OF_SOUND_AT_15C 340.275 - -struct Bullet { - double airFriction; - double caliber; - double bulletLength; - double bulletMass; - std::vector ballisticCoefficients; - std::vector velocityBoundaries; - char* atmosphereModel; - int dragModel; - std::vector muzzleVelocities; - std::vector barrelLengths; - double stabilityFactor; - double twistDirection; - double transonicStabilityCoef; - ace::vector3 bulletVelocityPreviousFrame; - ace::vector3 origin; - double latitude; - double temperature; - double altitude; - double humidity; - double overcast; - double startTime; - double lastFrame; - unsigned randSeed; - std::default_random_engine randGenerator; -}; - -struct Map { - std::vector gridHeights; - std::vector gridBuildingNums; - std::vector gridSurfaceIsWater; - int mapSize; - int mapGrids; -}; - -std::vector bulletDatabase; -std::unordered_map mapDatabase; -std::string worldName = ""; -Map* map = &mapDatabase[""]; - -double calculateRoughnessLength(double posX, double posY) { - // Source: http://es.ucsc.edu/~jnoble/wind/extrap/index.html - double roughness_lengths[10] = {0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6}; - - int gridX = (int)floor(posX / 50); - int gridY = (int)floor(posY / 50); - int gridCell = gridX * map->mapGrids + gridY; - - if (gridCell >= 0 && (std::size_t)gridCell < map->gridHeights.size() && (std::size_t)gridCell < map->gridBuildingNums.size()) { - int nearBuildings = map->gridBuildingNums[gridCell]; - int surfaceIsWater = map->gridSurfaceIsWater[gridCell]; - - if (nearBuildings == 0 && surfaceIsWater == 1) { - return 0.0005; - } - - if (nearBuildings >= 10) { - return 1.6; - } - - return roughness_lengths[2 + std::min(nearBuildings, 6)]; - } - - return 0.0024; -} - -double calculateAirDensity(double temperature, double pressure, double relativeHumidity) { - pressure = pressure * 100; - - if (relativeHumidity > 0) { - // 610.78 gives pressure in Pa - https://en.wikipedia.org/wiki/Density_of_air - double _pSat = 610.78 * pow(10, ((7.5 * temperature) / (temperature + 237.3))); - double vaporPressure = relativeHumidity * _pSat; - double partialPressure = pressure - vaporPressure; - - return (partialPressure * DRY_AIR_MOLAR_MASS + vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(temperature)); - } else { - return pressure / (SPECIFIC_GAS_CONSTANT_DRY_AIR * KELVIN(temperature)); - } -} - -double calculateAtmosphericCorrection(double ballisticCoefficient, double temperature, double pressure, double relativeHumidity, const char *atmosphereModel) { - double airDensity = calculateAirDensity(temperature, pressure, relativeHumidity); - - if (!strcmp(atmosphereModel, "ICAO")) { - return (STD_AIR_DENSITY_ICAO / airDensity) * ballisticCoefficient; - } else { - return (STD_AIR_DENSITY_ASM / airDensity) * ballisticCoefficient; - } -} - -// Drag Functions from: http://www.jbmballistics.com/ballistics/downloads/text/ -const std::vector dragCoefficientsG1 = { 0.2629, 0.2558, 0.2487, 0.2413, 0.2344, 0.2278, 0.2214, 0.2155, 0.2104, 0.2061, 0.2032, 0.2020, 0.2034, 0.2165, 0.2230, 0.2313, 0.2417, 0.2546, 0.2706, 0.2901, 0.3136, 0.3415, 0.3734, 0.4084, 0.4448, 0.4805, 0.5136, 0.5427, 0.5677, 0.5883, 0.6053, 0.6191, 0.6393, 0.6518, 0.6589, 0.6621, 0.6625, 0.6607, 0.6573, 0.6528, 0.6474, 0.6413, 0.6347, 0.6280, 0.6210, 0.6141, 0.6072, 0.6003, 0.5934, 0.5867, 0.5804, 0.5743, 0.5685, 0.5630, 0.5577, 0.5527, 0.5481, 0.5438, 0.5397, 0.5325, 0.5264, 0.5211, 0.5168, 0.5133, 0.5105, 0.5084, 0.5067, 0.5054, 0.5040, 0.5030, 0.5022, 0.5016, 0.5010, 0.5006, 0.4998, 0.4995, 0.4992, 0.4990, 0.4988 }; -const std::vector machNumbersG1 = { 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.70, 0.725, 0.75, 0.775, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00 }; -const std::vector dragCoefficientsG2 = { 0.2303, 0.2298, 0.2287, 0.2271, 0.2251, 0.2227, 0.2196, 0.2156, 0.2107, 0.2048, 0.1980, 0.1905, 0.1828, 0.1758, 0.1702, 0.1669, 0.1664, 0.1667, 0.1682, 0.1711, 0.1761, 0.1831, 0.2004, 0.2589, 0.3492, 0.3983, 0.4075, 0.4103, 0.4114, 0.4106, 0.4089, 0.4068, 0.4046, 0.4021, 0.3966, 0.3904, 0.3835, 0.3759, 0.3678, 0.3594, 0.3512, 0.3432, 0.3356, 0.3282, 0.3213, 0.3149, 0.3089, 0.3033, 0.2982, 0.2933, 0.2889, 0.2846, 0.2806, 0.2768, 0.2731, 0.2696, 0.2663, 0.2632, 0.2602, 0.2572, 0.2543, 0.2515, 0.2487, 0.2460, 0.2433, 0.2408, 0.2382, 0.2357, 0.2333, 0.2309, 0.2262, 0.2217, 0.2173, 0.2132, 0.2091, 0.2052, 0.2014, 0.1978, 0.1944, 0.1912, 0.1851, 0.1794, 0.1741, 0.1693, 0.1648 }; -const std::vector machNumbersG2 = { 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.775, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.175, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.55, 2.60, 2.65, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00 }; -const std::vector dragCoefficientsG5 = { 0.1710, 0.1719, 0.1727, 0.1732, 0.1734, 0.1730, 0.1718, 0.1696, 0.1668, 0.1637, 0.1603, 0.1566, 0.1529, 0.1497, 0.1473, 0.1463, 0.1489, 0.1583, 0.1672, 0.1815, 0.2051, 0.2413, 0.2884, 0.3379, 0.3785, 0.4032, 0.4147, 0.4201, 0.4278, 0.4338, 0.4373, 0.4392, 0.4403, 0.4406, 0.4401, 0.4386, 0.4362, 0.4328, 0.4286, 0.4237, 0.4182, 0.4121, 0.4057, 0.3991, 0.3926, 0.3861, 0.3800, 0.3741, 0.3684, 0.3630, 0.3578, 0.3529, 0.3481, 0.3435, 0.3391, 0.3349, 0.3269, 0.3194, 0.3125, 0.3060, 0.2999, 0.2942, 0.2889, 0.2838, 0.2790, 0.2745, 0.2703, 0.2662, 0.2624, 0.2588, 0.2553, 0.2488, 0.2429, 0.2376, 0.2326, 0.2280 }; -const std::vector machNumbersG5 = { 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00 }; -const std::vector dragCoefficientsG6 = { 0.2617, 0.2553, 0.2491, 0.2432, 0.2376, 0.2324, 0.2278, 0.2238, 0.2205, 0.2177, 0.2155, 0.2138, 0.2126, 0.2121, 0.2122, 0.2132, 0.2154, 0.2194, 0.2229, 0.2297, 0.2449, 0.2732, 0.3141, 0.3597, 0.3994, 0.4261, 0.4402, 0.4465, 0.4490, 0.4497, 0.4494, 0.4482, 0.4464, 0.4441, 0.4390, 0.4336, 0.4279, 0.4221, 0.4162, 0.4102, 0.4042, 0.3981, 0.3919, 0.3855, 0.3788, 0.3721, 0.3652, 0.3583, 0.3515, 0.3447, 0.3381, 0.3314, 0.3249, 0.3185, 0.3122, 0.3060, 0.3000, 0.2941, 0.2883, 0.2772, 0.2668, 0.2574, 0.2487, 0.2407, 0.2333, 0.2265, 0.2202, 0.2144, 0.2089, 0.2039, 0.1991, 0.1947, 0.1905, 0.1866, 0.1794, 0.1730, 0.1673, 0.1621, 0.1574 }; -const std::vector machNumbersG6 = { 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.175, 1.20, 1.225, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00 }; -const std::vector dragCoefficientsG7 = { 0.1198, 0.1197, 0.1196, 0.1194, 0.1193, 0.1194, 0.1194, 0.1194, 0.1193, 0.1193, 0.1194, 0.1193, 0.1194, 0.1197, 0.1202, 0.1207, 0.1215, 0.1226, 0.1242, 0.1266, 0.1306, 0.1368, 0.1464, 0.1660, 0.2054, 0.2993, 0.3803, 0.4015, 0.4043, 0.4034, 0.4014, 0.3987, 0.3955, 0.3884, 0.3810, 0.3732, 0.3657, 0.3580, 0.3440, 0.3376, 0.3315, 0.3260, 0.3209, 0.3160, 0.3117, 0.3078, 0.3042, 0.3010, 0.2980, 0.2951, 0.2922, 0.2892, 0.2864, 0.2835, 0.2807, 0.2779, 0.2752, 0.2725, 0.2697, 0.2670, 0.2643, 0.2615, 0.2588, 0.2561, 0.2533, 0.2506, 0.2479, 0.2451, 0.2424, 0.2368, 0.2313, 0.2258, 0.2205, 0.2154, 0.2106, 0.2060, 0.2017, 0.1975, 0.1935, 0.1861, 0.1793, 0.1730, 0.1672, 0.1618 }; -const std::vector machNumbersG7 = { 0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.725, 0.75, 0.775, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.55, 2.60, 2.65, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00 }; -const std::vector dragCoefficientsG8 = { 0.2105, 0.2105, 0.2104, 0.2104, 0.2103, 0.2103, 0.2103, 0.2103, 0.2103, 0.2102, 0.2102, 0.2102, 0.2102, 0.2102, 0.2103, 0.2103, 0.2104, 0.2104, 0.2105, 0.2106, 0.2109, 0.2183, 0.2571, 0.3358, 0.4068, 0.4378, 0.4476, 0.4493, 0.4477, 0.4450, 0.4419, 0.4353, 0.4283, 0.4208, 0.4133, 0.4059, 0.3986, 0.3915, 0.3845, 0.3777, 0.3710, 0.3645, 0.3581, 0.3519, 0.3458, 0.3400, 0.3343, 0.3288, 0.3234, 0.3182, 0.3131, 0.3081, 0.3032, 0.2983, 0.2937, 0.2891, 0.2845, 0.2802, 0.2720, 0.2642, 0.2569, 0.2499, 0.2432, 0.2368, 0.2308, 0.2251, 0.2197, 0.2147, 0.2101, 0.2058, 0.2019, 0.1983, 0.1950, 0.1890, 0.1837, 0.1791, 0.1750, 0.1713 }; -const std::vector machNumbersG8 = { 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.825, 0.85, 0.875, 0.90, 0.925, 0.95, 0.975, 1.0, 1.025, 1.05, 1.075, 1.10, 1.125, 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.45, 1.50, 1.55, 1.60, 1.65, 1.70, 1.75, 1.80, 1.85, 1.90, 1.95, 2.00, 2.05, 2.10, 2.15, 2.20, 2.25, 2.30, 2.35, 2.40, 2.45, 2.50, 2.60, 2.70, 2.80, 2.90, 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 3.60, 3.70, 3.80, 3.90, 4.00, 4.20, 4.40, 4.60, 4.80, 5.00 }; - -const std::vector> dragCoefficients = { {}, dragCoefficientsG1, dragCoefficientsG2, {}, {}, dragCoefficientsG5, dragCoefficientsG6, dragCoefficientsG7, dragCoefficientsG8, {} }; -const std::vector> machNumbers = { {}, machNumbersG1, machNumbersG2, {},{}, machNumbersG5, machNumbersG6, machNumbersG7, machNumbersG8,{} }; - -double calculateRetard(int DragFunction, double DragCoefficient, double Velocity, double Mach) { - int idx = std::max(0, std::min(DragFunction, 9)); - double m = Velocity / Mach; - - for (int i = 0; i < (int)machNumbers[idx].size(); i++) { - if (machNumbers[idx][i] >= m) { - int previousIdx = std::max(0, i - 1); - double previousDragCoefficient = dragCoefficients[idx][previousIdx]; - double previousMachNumber = machNumbers[idx][previousIdx]; - double cd = previousDragCoefficient + (dragCoefficients[idx][i] - previousDragCoefficient) * (m - previousMachNumber) / (machNumbers[idx][i] - previousMachNumber); - return BC_CONVERSION_FACTOR * (cd / DragCoefficient) * std::pow(Velocity, 2); - } - } - - return 0.0; -} - -float replicateVanillaZero(float zeroRange, float muzzleVelocity, float airFriction) { - const float maxDeltaT = 0.05f; - float time = 0.0f; - ace::vector3 curShotPos = { 0, 0, 0 }; - ace::vector3 speed = { muzzleVelocity, 0, 0 }; - - while (time < 8.0f) { - float distLeft = zeroRange - curShotPos.x(); - float traveled = speed.x() * maxDeltaT; - if (distLeft < traveled) { - float deltaT = distLeft / speed.x(); - speed -= { 0, GRAVITY * deltaT, 0 }; - curShotPos += speed * deltaT; - time += deltaT; - break; - } else { - float deltaT = maxDeltaT; - curShotPos += speed * deltaT; - time += deltaT; - speed += speed * (speed.magnitude() * airFriction * deltaT); - speed -= { 0, GRAVITY * deltaT, 0 }; - } - } - return -std::atan(curShotPos.y() / zeroRange); -} - -double calculateVanillaZero(double zeroRange, double muzzleVelocity, double airFriction, double boreHeight) { - double zeroAngle = 0.0f; - double deltaT = 1.0 / std::max(100.0, zeroRange); - - for (int i = 0; i < 10; i++) { - double lx = 0.0f; - double ly = 0.0f; - - double px = 0.0f; - double py = -boreHeight / 100.0f; - - double gx = std::sin(zeroAngle) * -GRAVITY; - double gy = std::cos(zeroAngle) * -GRAVITY; - - double vx = std::cos(zeroAngle) * muzzleVelocity; - double vy = std::sin(zeroAngle) * muzzleVelocity; - - double tof = 0.0f; - double v = 0.0f; - - while (tof < 8.0f && px < zeroRange) { - lx = px; - ly = py; - - v = std::sqrt(vx*vx + vy*vy); - - double ax = vx * v * airFriction; - double ay = vy * v * airFriction; - ax += gx; - ay += gy; - - px += vx * deltaT * 0.5; - py += vy * deltaT * 0.5; - vx += ax * deltaT; - vy += ay * deltaT; - px += vx * deltaT * 0.5; - py += vy * deltaT * 0.5; - - tof += deltaT; - } - - double y = ly + (zeroRange - lx) * (py - ly) / (px - lx); - double offset = -std::atan(y / zeroRange); - zeroAngle += offset; - - if (std::abs(offset) < 0.00001f) { - break; - } - } - - return zeroAngle; -} - -double calculateAdvancedZero(double zeroRange, double muzzleVelocity, double boreHeight, double temperature, double pressure, double humidity, double ballisticCoefficient, int dragModel, char* atmosphereModel) { - double zeroAngle = 0.0f; - double deltaT = 1.0 / std::max(100.0, zeroRange); - - ballisticCoefficient = calculateAtmosphericCorrection(ballisticCoefficient, temperature, pressure, humidity, atmosphereModel); - - for (int i = 0; i < 10; i++) { - double lx = 0.0f; - double ly = 0.0f; - - double px = 0.0f; - double py = -boreHeight / 100.0f; - - double gx = std::sin(zeroAngle) * -GRAVITY; - double gy = std::cos(zeroAngle) * -GRAVITY; - - double vx = std::cos(zeroAngle) * muzzleVelocity; - double vy = std::sin(zeroAngle) * muzzleVelocity; - - double tof = 0.0f; - double v = 0.0f; - - while (tof < 8.0f && px < zeroRange) { - lx = px; - ly = py; - - v = std::sqrt(vx*vx + vy*vy); - - double retard = calculateRetard(dragModel, ballisticCoefficient, v, SPEED_OF_SOUND_AT_15C); - double ax = vx / v * -retard; - double ay = vy / v * -retard; - ax += gx; - ay += gy; - - px += vx * deltaT * 0.5; - py += vy * deltaT * 0.5; - vx += ax * deltaT; - vy += ay * deltaT; - px += vx * deltaT * 0.5; - py += vy * deltaT * 0.5; - - tof += deltaT; - } - - double y = ly + (zeroRange - lx) * (py - ly) / (px - lx); - double offset = -std::atan(y / zeroRange); - zeroAngle += offset; - - if (std::abs(offset) < 0.00001f) { - break; - } - } - - return zeroAngle; -} - -extern "C" -{ - EXPORT void __stdcall RVExtensionVersion(char *output, int outputSize); - EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); -} - -void __stdcall RVExtensionVersion(char *output, int outputSize) -{ - strncpy(output, ACE_FULL_VERSION_STR, outputSize - 1); -} - -void __stdcall RVExtension(char *output, int outputSize, const char *function) -{ - ZERO_OUTPUT(); - std::stringstream outputStr; - if (!strcmp(function, "version")) { - strncpy(output, ACE_FULL_VERSION_STR, outputSize - 1); - EXTENSION_RETURN(); - } - - char* input = _strdup(function); - char* token = NULL; - char* next_token = NULL; - char* mode = strtok_s(input, ":", &next_token); - - if (!strcmp(mode, "retard")) { - double ballisticCoefficient = 1.0; - int dragModel = 1; - double velocity = 0.0; - double temperature = 15.0; - double retard = 0.0; - - dragModel = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - ballisticCoefficient = strtod(strtok_s(NULL, ":", &next_token), NULL); - velocity = strtod(strtok_s(NULL, ":", &next_token), NULL); - temperature = strtod(strtok_s(NULL, ":", &next_token), NULL); - - retard = calculateRetard(dragModel, ballisticCoefficient, velocity, SPEED_OF_SOUND(temperature)); - // int n = sprintf(output, "%f", retard); - - outputStr << retard; - strncpy(output, outputStr.str().c_str(), outputSize - 1); - - EXTENSION_RETURN(); - } else if (!strcmp(mode, "atmosphericCorrection")) { - double ballisticCoefficient = 1.0; - double temperature = 15.0; - double pressure = 1013.25; - double humidity = 0.0; - char* atmosphereModel; - - ballisticCoefficient = strtod(strtok_s(NULL, ":", &next_token), NULL); - temperature = strtod(strtok_s(NULL, ":", &next_token), NULL); - pressure = strtod(strtok_s(NULL, ":", &next_token), NULL); - humidity = strtod(strtok_s(NULL, ":", &next_token), NULL); - atmosphereModel = strtok_s(NULL, ":", &next_token); - - ballisticCoefficient = calculateAtmosphericCorrection(ballisticCoefficient, temperature, pressure, humidity, atmosphereModel); - //int n = sprintf(output, "%f", ballisticCoefficient); - outputStr << ballisticCoefficient; - strncpy(output, outputStr.str().c_str(), outputSize - 1); - EXTENSION_RETURN(); - } else if (!strcmp(mode, "new")) { - unsigned int index = 0; - unsigned int ammoCount = 0; - double airFriction = 0.0; - char* ballisticCoefficientArray; - char* ballisticCoefficient; - std::vector ballisticCoefficients; - char* velocityBoundaryArray; - char* velocityBoundary; - std::vector velocityBoundaries; - char* atmosphereModel; - int dragModel = 1; - double stabilityFactor = 1.5; - int twistDirection = 1; - double transonicStabilityCoef = 1; - char* bulletVelocityArray; - char* bulletVelocityEntry; - std::vector bulletVelocity; - char* originArray; - char* originEntry; - std::vector origin; - double latitude = 0.0; - double temperature = 0.0; - double altitude = 0.0; - double humidity = 0.0; - double overcast = 0.0; - double tickTime = 0.0; - - index = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - ammoCount = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - airFriction = strtod(strtok_s(NULL, ":", &next_token), NULL); - ballisticCoefficientArray = strtok_s(NULL, ":", &next_token); - ballisticCoefficientArray++; - ballisticCoefficientArray[strlen(ballisticCoefficientArray) - 1] = 0; - ballisticCoefficient = strtok_s(ballisticCoefficientArray, ",", &token); - while (ballisticCoefficient != NULL) { - ballisticCoefficients.push_back(strtod(ballisticCoefficient, NULL)); - ballisticCoefficient = strtok_s(NULL, ",", &token); - } - velocityBoundaryArray = strtok_s(NULL, ":", &next_token); - velocityBoundaryArray++; - velocityBoundaryArray[strlen(velocityBoundaryArray) - 1] = 0; - velocityBoundary = strtok_s(velocityBoundaryArray, ",", &token); - while (velocityBoundary != NULL) { - velocityBoundaries.push_back(strtod(velocityBoundary, NULL)); - velocityBoundary = strtok_s(NULL, ",", &token); - } - atmosphereModel = strtok_s(NULL, ":", &next_token); - dragModel = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - stabilityFactor = strtod(strtok_s(NULL, ":", &next_token), NULL); - twistDirection = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - transonicStabilityCoef = strtod(strtok_s(NULL, ":", &next_token), NULL); - originArray = strtok_s(NULL, ":", &next_token); - originArray++; - originArray[strlen(originArray) - 1] = 0; - originEntry = strtok_s(originArray, ",", &token); - while (originEntry != NULL) { - origin.push_back(strtod(originEntry, NULL)); - originEntry = strtok_s(NULL, ",", &token); - } - bulletVelocityArray = strtok_s(NULL, ":", &next_token); - bulletVelocityArray++; - bulletVelocityArray[strlen(bulletVelocityArray) - 1] = 0; - bulletVelocityEntry = strtok_s(bulletVelocityArray, ",", &token); - while (bulletVelocityEntry != NULL) { - bulletVelocity.push_back(strtod(bulletVelocityEntry, NULL)); - bulletVelocityEntry = strtok_s(NULL, ",", &token); - } - latitude = strtod(strtok_s(NULL, ":", &next_token), NULL); - temperature = strtod(strtok_s(NULL, ":", &next_token), NULL); - altitude = strtod(strtok_s(NULL, ":", &next_token), NULL); - humidity = strtod(strtok_s(NULL, ":", &next_token), NULL); - overcast = strtod(strtok_s(NULL, ":", &next_token), NULL); - tickTime = strtod(strtok_s(NULL, ":", &next_token), NULL); - - while (index >= bulletDatabase.size()) { - Bullet bullet; - bulletDatabase.push_back(bullet); - } - - bulletDatabase[index].airFriction = airFriction; - bulletDatabase[index].ballisticCoefficients = ballisticCoefficients; - bulletDatabase[index].velocityBoundaries = velocityBoundaries; - bulletDatabase[index].atmosphereModel = atmosphereModel; - bulletDatabase[index].dragModel = dragModel; - bulletDatabase[index].stabilityFactor = stabilityFactor; - bulletDatabase[index].twistDirection = twistDirection; - bulletDatabase[index].transonicStabilityCoef = transonicStabilityCoef; - bulletDatabase[index].bulletVelocityPreviousFrame = { bulletVelocity[0], bulletVelocity[1], bulletVelocity[2] }; - bulletDatabase[index].origin = { origin[0], origin[1], origin[2] }; - bulletDatabase[index].latitude = latitude / 180 * M_PI; - bulletDatabase[index].temperature = temperature; - bulletDatabase[index].altitude = altitude; - bulletDatabase[index].humidity = humidity; - bulletDatabase[index].overcast = overcast; - bulletDatabase[index].startTime = tickTime; - bulletDatabase[index].lastFrame = tickTime; - if (transonicStabilityCoef < 1) { - unsigned int k1 = (unsigned)round(tickTime / 2); - unsigned int k2 = ammoCount; - bulletDatabase[index].randSeed = (unsigned int)(0.5 * (k1 + k2) * (k1 + k2 + 1) + k2); - bulletDatabase[index].randGenerator.seed(bulletDatabase[index].randSeed); - } - - strncpy(output, "", outputSize - 1); - EXTENSION_RETURN(); - } else if (!strcmp(mode, "simulate")) { - // simulate:0:[-0.109985,542.529,-3.98301]:[3751.57,5332.23,214.252]:[0.598153,2.38829,0]:28.6:0:0.481542:0:215.16 - unsigned int index = 0; - char* velocityArray; - double velocity[3] = { 0.0, 0.0, 0.0 }; - char* positionArray; - double position[3] = { 0.0, 0.0, 0.0 }; - char* windArray; - double wind[3]; - double heightAGL = 0.0; - double tickTime = 0.0; - - index = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - velocityArray = strtok_s(NULL, ":", &next_token); - velocityArray++; - velocityArray[strlen(velocityArray) - 1] = 0; - velocity[0] = strtod(strtok_s(velocityArray, ",", &token), NULL); - velocity[1] = strtod(strtok_s(NULL, ",", &token), NULL); - velocity[2] = strtod(strtok_s(NULL, ",", &token), NULL); - positionArray = strtok_s(NULL, ":", &next_token); - positionArray++; - positionArray[strlen(positionArray) - 1] = 0; - position[0] = strtod(strtok_s(positionArray, ",", &token), NULL); - position[1] = strtod(strtok_s(NULL, ",", &token), NULL); - position[2] = strtod(strtok_s(NULL, ",", &token), NULL); - windArray = strtok_s(NULL, ":", &next_token); - windArray++; - windArray[strlen(windArray) - 1] = 0; - wind[0] = strtod(strtok_s(windArray, ",", &token), NULL); - wind[1] = strtod(strtok_s(NULL, ",", &token), NULL); - wind[2] = strtod(strtok_s(NULL, ",", &token), NULL); - heightAGL = strtod(strtok_s(NULL, ":", &next_token), NULL); - tickTime = strtod(strtok_s(NULL, ":", &next_token), NULL); - - ace::vector3 bulletVelocityCurrentFrame = { velocity[0], velocity[1], velocity[2] }; - ace::vector3 bulletPosition = { position[0], position[1], position[2] }; - ace::vector3 windVelocity = { wind[0], wind[1], wind[2] }; - ace::vector3 gravityAccel = { 0, 0, -GRAVITY }; - double ballisticCoefficient = 1.0; - double dragRef = 0.0; - double drag = 0.0; - double TOF = tickTime - bulletDatabase[index].startTime; - double deltaT = tickTime - bulletDatabase[index].lastFrame; - ace::vector3 trueVelocity; - double temperature = bulletDatabase[index].temperature - 0.0065 * bulletPosition.z(); - double pressure = (1013.25 - 10 * bulletDatabase[index].overcast) * pow(1 - (0.0065 * (bulletDatabase[index].altitude + bulletPosition.z())) / (KELVIN(temperature) + 0.0065 * bulletDatabase[index].altitude), 5.255754495); - ace::vector3 velocityOffset; - - bulletDatabase[index].lastFrame = tickTime; - - if (windVelocity.magnitude() > 0.1) { - double windAttenuation = 1.0; - ace::vector3 windSourceTerrain; - - windSourceTerrain = bulletPosition - windVelocity.normalize() * 100; - - int gridX = (int)floor(windSourceTerrain.x() / 50); - int gridY = (int)floor(windSourceTerrain.y() / 50); - int gridCell = gridX * map->mapGrids + gridY; - - if (gridCell >= 0 && (std::size_t)gridCell < map->gridHeights.size() && (std::size_t)gridCell < map->gridBuildingNums.size()) { - double gridHeight = map->gridHeights[gridCell]; - - if (gridHeight > bulletPosition.z()) { - double angle = atan((gridHeight - bulletPosition.z()) / 100); - windAttenuation *= pow(abs(cos(angle)), 2); - } - } - - if (heightAGL > 0 && heightAGL < 20) { - ace::vector3 windSourceObstacles; - - windSourceObstacles = bulletPosition - windVelocity.normalize() * 25; - - double roughnessLength = calculateRoughnessLength(windSourceObstacles.x(), windSourceObstacles.y()); - windAttenuation *= std::max(0.0, log(heightAGL / roughnessLength) / log(20 / roughnessLength)); - } - - windVelocity = windVelocity * windAttenuation; - } - - ace::vector3 bulletVelocity = bulletDatabase[index].bulletVelocityPreviousFrame; - double time = 0.0; - - while (time < deltaT) { - double dt = std::min(deltaT - time, DELTA_T); - - dragRef = -bulletDatabase[index].airFriction * bulletVelocity.magnitude_squared(); - - ace::vector3 accelRef = bulletVelocity.normalize() * dragRef; - - velocityOffset += accelRef * dt; - bulletVelocity -= accelRef * dt; - bulletVelocity += gravityAccel * dt; - - time += dt; - } - - bulletVelocity = bulletDatabase[index].bulletVelocityPreviousFrame; - time = 0.0; - TOF -= deltaT; - - while (time < deltaT) { - double dt = std::min(deltaT - time, DELTA_T * 2); - - trueVelocity = bulletVelocity - windVelocity; - - if (bulletDatabase[index].transonicStabilityCoef < 1.0f && trueVelocity.magnitude() < 1.2 * SPEED_OF_SOUND(temperature) && trueVelocity.magnitude() > SPEED_OF_SOUND(temperature)) { - std::uniform_real_distribution distribution(-10.0, 10.0); - ace::vector3 offset(distribution(bulletDatabase[index].randGenerator), distribution(bulletDatabase[index].randGenerator), distribution(bulletDatabase[index].randGenerator)); - double coef = 1.0f - bulletDatabase[index].transonicStabilityCoef; - - double trueSpeed = trueVelocity.magnitude(); - trueVelocity += offset * coef; - trueVelocity = trueVelocity.normalize() * trueSpeed; - }; - - if (bulletDatabase[index].ballisticCoefficients.size() == bulletDatabase[index].velocityBoundaries.size() + 1) { - ballisticCoefficient = bulletDatabase[index].ballisticCoefficients[0]; - for (int i = (int)bulletDatabase[index].velocityBoundaries.size() - 1; i >= 0; i = i - 1) { - if (trueVelocity.magnitude() < bulletDatabase[index].velocityBoundaries[i]) { - ballisticCoefficient = bulletDatabase[index].ballisticCoefficients[i + 1]; - break; - } - } - - ballisticCoefficient = calculateAtmosphericCorrection(ballisticCoefficient, temperature, pressure, bulletDatabase[index].humidity, bulletDatabase[index].atmosphereModel); - - drag = calculateRetard(bulletDatabase[index].dragModel, ballisticCoefficient, trueVelocity.magnitude(), SPEED_OF_SOUND(temperature)); - } else { - double airDensity = calculateAirDensity(temperature, pressure, bulletDatabase[index].humidity); - double airFriction = bulletDatabase[index].airFriction * airDensity / STD_AIR_DENSITY_ICAO; - - drag = -airFriction * trueVelocity.magnitude_squared(); - } - - ace::vector3 accel = trueVelocity.normalize() * drag; - - velocityOffset -= accel * dt; - bulletVelocity -= accel * dt; - - if (TOF > 0) { - double bulletDir = atan2(bulletVelocity.x(), bulletVelocity.y()); - double driftAccel = bulletDatabase[index].twistDirection * (0.0482251 * (bulletDatabase[index].stabilityFactor + 1.2)) / pow(TOF, 0.17); - double driftVelocity = 0.0581025 *(bulletDatabase[index].stabilityFactor + 1.2) * pow(TOF, 0.83); - double dragCorrection = (driftVelocity / trueVelocity.magnitude()) * drag; - double magnitude = (driftAccel + dragCorrection) * dt; - ace::vector3 offset(sin(bulletDir + M_PI / 2) * magnitude, cos(bulletDir + M_PI / 2) * magnitude, 0); - velocityOffset += offset; - bulletVelocity += offset; - } - - double lat = bulletDatabase[index].latitude; - accel.x(2 * EARTH_ANGULAR_SPEED * +(bulletVelocity.y() * sin(lat) - bulletVelocity.z() * cos(lat))); - accel.y(2 * EARTH_ANGULAR_SPEED * -(bulletVelocity.x() * sin(lat))); - accel.z(2 * EARTH_ANGULAR_SPEED * +(bulletVelocity.x() * cos(lat))); - - velocityOffset += accel * dt; - bulletVelocity += accel * dt + gravityAccel * dt; - - TOF += dt; - time += dt; - } - - bulletDatabase[index].bulletVelocityPreviousFrame = bulletVelocityCurrentFrame + velocityOffset; - - outputStr << "[" << velocityOffset.x() << "," << velocityOffset.y() << "," << velocityOffset.z() << "]"; - strncpy(output, outputStr.str().c_str(), outputSize - 1); - EXTENSION_RETURN(); - } else if (!strcmp(mode, "set")) { - int height = 0; - int numObjects = 0; - int surfaceIsWater = 0; - - height = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - numObjects = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - surfaceIsWater = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - - map->gridHeights.push_back(height); - map->gridBuildingNums.push_back(numObjects); - map->gridSurfaceIsWater.push_back(surfaceIsWater); - - strncpy(output, outputStr.str().c_str(), outputSize - 1); - EXTENSION_RETURN(); - } else if (!strcmp(mode, "init")) { - int mapSize = 0; - int mapGrids = 0; - unsigned int gridCells = 0; - - worldName = strtok_s(NULL, ":", &next_token); - mapSize = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - - mapGrids = (int)ceil((double)mapSize / 50.0) + 1; - gridCells = mapGrids * mapGrids; - - map = &mapDatabase[worldName]; - if (map->gridHeights.size() == gridCells) { - outputStr << "Terrain already initialized"; - strncpy(output, outputStr.str().c_str(), outputSize - 1); - EXTENSION_RETURN(); - } - - map->mapSize = mapSize; - map->mapGrids = mapGrids; - map->gridHeights.clear(); - map->gridBuildingNums.clear(); - map->gridSurfaceIsWater.clear(); - map->gridHeights.reserve(gridCells); - map->gridBuildingNums.reserve(gridCells); - map->gridSurfaceIsWater.reserve(gridCells); - - strncpy(output, outputStr.str().c_str(), outputSize - 1); - EXTENSION_RETURN(); - } else if (!strcmp(mode, "replicateVanillaZero")) { - float zeroRange = strtof(strtok_s(NULL, ":", &next_token), NULL); - float initSpeed = strtof(strtok_s(NULL, ":", &next_token), NULL); - float airFriction = strtof(strtok_s(NULL, ":", &next_token), NULL); - - float zeroAngle = replicateVanillaZero(zeroRange, initSpeed, airFriction); - - outputStr << DEGREES(zeroAngle); - strncpy(output, outputStr.str().c_str(), outputSize - 1); - EXTENSION_RETURN(); - } else if (!strcmp(mode, "calcZero")) { - double zeroRange = strtod(strtok_s(NULL, ":", &next_token), NULL); - double initSpeed = strtod(strtok_s(NULL, ":", &next_token), NULL); - double airFriction = strtod(strtok_s(NULL, ":", &next_token), NULL); - double boreHeight = strtod(strtok_s(NULL, ":", &next_token), NULL); - - double zeroAngle = calculateVanillaZero(zeroRange, initSpeed, airFriction, boreHeight); - - outputStr << DEGREES(zeroAngle); - strncpy(output, outputStr.str().c_str(), outputSize - 1); - EXTENSION_RETURN(); - } else if (!strcmp(mode, "calcZeroAB")) { - double zeroRange = strtod(strtok_s(NULL, ":", &next_token), NULL); - double muzzleVelocity = strtod(strtok_s(NULL, ":", &next_token), NULL); - double boreHeight = strtod(strtok_s(NULL, ":", &next_token), NULL); - double temperature = strtod(strtok_s(NULL, ":", &next_token), NULL); - double pressure = strtod(strtok_s(NULL, ":", &next_token), NULL); - double humidity = strtod(strtok_s(NULL, ":", &next_token), NULL); - double ballisticCoefficient = strtod(strtok_s(NULL, ":", &next_token), NULL); - int dragModel = strtol(strtok_s(NULL, ":", &next_token), NULL, 10); - char* atmosphereModel = strtok_s(NULL, ":", &next_token); - - double zeroAngle = calculateAdvancedZero(zeroRange, muzzleVelocity, boreHeight, temperature, pressure, humidity, ballisticCoefficient, dragModel, atmosphereModel); - - outputStr << DEGREES(zeroAngle); - strncpy(output, outputStr.str().c_str(), outputSize - 1); - EXTENSION_RETURN(); - } - strncpy(output, outputStr.str().c_str(), outputSize - 1); - EXTENSION_RETURN(); -} diff --git a/extensions/advanced_ballistics/CMakeLists.txt b/extensions/advanced_ballistics/CMakeLists.txt deleted file mode 100644 index 9319d0bbd78..00000000000 --- a/extensions/advanced_ballistics/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(ACE_EXTENSION_NAME "ace_advanced_ballistics") - -file(GLOB SOURCES *.h *.hpp *.c *.cpp) -add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES}) -target_link_libraries(${ACE_EXTENSION_NAME} ace_common) -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions) - -if(CMAKE_COMPILER_IS_GNUCXX) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1) -endif() - -# Copy and rename DLL to root -if(USE_64BIT_BUILD) - set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}_x64.dll) -else() - set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}.dll) -endif() -add_custom_command(TARGET ${ACE_EXTENSION_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ ${PROJECT_SOURCE_DIR}/../${FINAL_DLL_NAME} -) diff --git a/extensions/artillerytables/CMakeLists.txt b/extensions/artillerytables/CMakeLists.txt deleted file mode 100644 index bd897c51035..00000000000 --- a/extensions/artillerytables/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -set(ACE_EXTENSION_NAME "ace_artillerytables") - -file(GLOB SOURCES *.h *.hpp *.c *.cpp) -add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES}) -target_link_libraries(${ACE_EXTENSION_NAME} ace_common) -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions) - -if(CMAKE_COMPILER_IS_GNUCXX) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1) -endif() - -# Copy and rename DLL to root -if(USE_64BIT_BUILD) - set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}_x64.dll) -else() - set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}.dll) -endif() -add_custom_command(TARGET ${ACE_EXTENSION_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ ${PROJECT_SOURCE_DIR}/../${FINAL_DLL_NAME} -) - -if (TARGET gtest_main) # Add Tests - enable_testing() - set(ACE_TEST_NAME ${ACE_EXTENSION_NAME}_test) - add_executable(${ACE_TEST_NAME} tests/tester.cpp ${SOURCES}) - target_link_libraries(${ACE_TEST_NAME} ace_common) - target_link_libraries(${ACE_TEST_NAME} ${ACE_EXTENSION_NAME}) - target_link_libraries(${ACE_TEST_NAME} gtest_main) - add_test(${ACE_TEST_NAME} ${ACE_TEST_NAME}) - set_target_properties(${ACE_TEST_NAME} PROPERTIES FOLDER Tests) -endif() diff --git a/extensions/artillerytables/artillerytables.cpp b/extensions/artillerytables/artillerytables.cpp deleted file mode 100644 index 9479e39f44c..00000000000 --- a/extensions/artillerytables/artillerytables.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* - * artillerytables.hpp - * Author: PabstMirror - */ - -#include -#include -#include - -#include "artillerytables.hpp" - - -// Constants -static const double timeStep = 1.0 / 60; -static const double rangeSearchErrorMax = 0.001; // ratio * distance -static const double rangeSearchAngleConvergance = 0.000025; -static const double gravityABS = 9.8066; -static const ace::vector3 gravityAccl(0, 0, -1 * gravityABS); - -// Globals: -std::vector> fWorkers; -unsigned int getLineIndex = 0; - -std::tuple simulateShot(const double _fireAngleRad, const double _muzzleVelocity, const double _heightOfTarget, const double _crossWind, const double _tailWind, const double _temperature, const double _airDensity, double _airFriction) { - // returns: dist traveled to the side (crosswind), dist traveled foward (headwind), time of flight - // note: if shot never reaches height of target, then results are undefined (use negative) - const double kCoefficient = -1.0 * _airDensity * _airFriction; - const double powderEffects = (_airFriction) ? ((_temperature + 273.13) / 288.13 - 1) / 40 + 1 : 1.0; - - double currentTime = 0; - ace::vector3 currentPosition(0, 0, 0); - ace::vector3 lastPosition(currentPosition); - ace::vector3 currentVelocity(0, powderEffects * _muzzleVelocity * cos(_fireAngleRad), powderEffects * _muzzleVelocity * sin(_fireAngleRad)); - const ace::vector3 wind(_crossWind, _tailWind, 0); - - while ((currentVelocity.z() > 0) || (currentPosition.z() >= _heightOfTarget)) { - lastPosition = currentPosition; - ace::vector3 apparentWind = wind - currentVelocity; - ace::vector3 changeInVelocity = gravityAccl + apparentWind * (kCoefficient * apparentWind.magnitude()); - currentVelocity += changeInVelocity * timeStep; - currentPosition += currentVelocity * timeStep; - currentTime += timeStep; - } - - const double lastCurrentRatio((_heightOfTarget - currentPosition.z()) / (lastPosition.z() - currentPosition.z())); - ace::vector3 finalPos = lastPosition.lerp(currentPosition, lastCurrentRatio); - - return { finalPos.x(), finalPos.y(), currentTime }; -} - -std::tuple findMaxAngle(const double _muzzleVelocity, const double _airFriction) { - // retrns: angle that goes the furthest, max distance traveled - if (_airFriction == 0) { - return { M_PI_4, _muzzleVelocity * _muzzleVelocity / gravityABS }; - } - // With air resitsnce, max distance angle won't be 45 degrees - double bestAngle = M_PI_4; - double bestDistance = -1; - double testResultDist; - for (double testAngle = M_PI_4; testAngle > 0; testAngle -= (M_PI_4 / 100.0)) { - std::tie(std::ignore, testResultDist, std::ignore) = simulateShot(testAngle, _muzzleVelocity, 0, 0, 0, 15, 1, _airFriction); - if (testResultDist > bestDistance) { - bestAngle = testAngle; - bestDistance = testResultDist; - } - } - return { bestAngle, bestDistance }; -} - -std::tuple simulateFindSolution(const double _rangeToHit, const double _heightToHit, const double _muzzleVelocity, const double _airFriction, const double _minElev, const double _maxElev, const bool _highArc) { - // returns: actual distance traveled, elevation, time of flight - double searchMin = _minElev; - double searchMax = _maxElev; - - if (!_airFriction) { - // can do trivial ballistics physics to get angle, could compute tof as well, but run through sim once to ensure consistancy (uses positive value of g) - double radicand = pow(_muzzleVelocity, 4) - gravityABS * (gravityABS * pow(_rangeToHit, 2) + 2 * _heightToHit * pow(_muzzleVelocity, 2)); - if ((!_rangeToHit) || (radicand < 0)) { // radican't - return { -1, -1, -1 }; - } - radicand = sqrt(radicand); - double angleRoot = atan((pow(_muzzleVelocity, 2) + radicand) / (gravityABS * _rangeToHit)); - if ((angleRoot > _maxElev) || (angleRoot < _minElev)) { - angleRoot = atan((pow(_muzzleVelocity, 2) - radicand) / (gravityABS * _rangeToHit)); - } - if ((angleRoot > _maxElev) || (angleRoot < _minElev)) { - return { -1, -1, -1 }; - }; - const double tof = _rangeToHit / (_muzzleVelocity * cos(angleRoot)); - return { _rangeToHit, angleRoot, tof }; - } - - - int numberOfAttempts = 0; - double resultDistance = -1; - double resultTime = -1; - double currentError = 9999; - double currentElevation = -1; - do { - if (numberOfAttempts++ > 50) break; // for safetey, min/max should converge long before - currentElevation = (searchMin + searchMax) / 2.0; - std::tie(std::ignore, resultDistance, resultTime) = simulateShot(currentElevation, _muzzleVelocity, _heightToHit, 0, 0, 15, 1, _airFriction); - currentError = _rangeToHit - resultDistance; - // printf("elev %f [%f, %f]range%f\n goes %f [%f]\n", currentElevation, searchMin, searchMax, (searchMax - searchMin), resultDistance, currentError); - if ((currentError > 0) ^ (!_highArc)) { - searchMax = currentElevation; - } else { - searchMin = currentElevation; - } - } while ((searchMax - searchMin) > rangeSearchAngleConvergance); - - // printf("[%f, %f] Actuall [%f] err [%f of %f]\n", _rangeToHit, _heightToHit, resultDistance, currentError, (_rangeToHit * rangeSearchErrorMax * (_highArc ? 1.0 : 2.0))); - // On some low angle shots, it will really struggle to converge because of precision issues - if ((abs(currentError) > (_rangeToHit * rangeSearchErrorMax * (_highArc ? 1.0 : 2.0)))) { - return { -1, -1, -1 }; - } - return { resultDistance, currentElevation, resultTime }; -} - -void writeNumber(std::stringstream & ss, double _num, const int _widthInt, const int _widthDec) { - if ((_num < 0) && (_num > -0.05)) { // hard coded fix -0.0 rounding errors - _num = 0; - } - if (_widthInt > 1) { - ss << std::setfill('0'); - } - ss << std::fixed << std::setw(_widthInt) << std::setprecision(_widthDec) << _num; -} - -std::string simulateCalcRangeTableLine(const double _rangeToHit, const double _muzzleVelocity, const double _airFriction, const double _minElev, const double _maxElev, const bool _highArc) { - double actualDistance, lineElevation, lineTimeOfFlight; - std::tie(actualDistance, lineElevation, lineTimeOfFlight) = simulateFindSolution(_rangeToHit, 0, _muzzleVelocity, _airFriction, _minElev, _maxElev, _highArc); - if (lineTimeOfFlight < 0) { - return ""; - } - double actualDistanceHeight, lineHeightElevation, lineHeightTimeOfFlight; - std::tie(actualDistanceHeight, lineHeightElevation, lineHeightTimeOfFlight) = simulateFindSolution(_rangeToHit, -100, _muzzleVelocity, _airFriction, _minElev, _maxElev, _highArc); - - - std::stringstream returnSS; - - returnSS << "[\""; - writeNumber(returnSS, _rangeToHit, 0, 0); - returnSS << "\",\""; - writeNumber(returnSS, lineElevation * 3200.0 / M_PI, 0, 0); - returnSS << "\",\""; - - if (lineHeightElevation > 0) { - const double drElevAdjust = lineHeightElevation - lineElevation; - const double drTofAdjust = lineHeightTimeOfFlight - lineTimeOfFlight; - writeNumber(returnSS, drElevAdjust * 3200.0 / M_PI, 0, 0); - returnSS << "\",\""; - writeNumber(returnSS, drTofAdjust, 0, 1); - } else { - // low angle shots won't be able to adjust down further - returnSS << "-\",\"-"; - } - returnSS << "\",\""; - writeNumber(returnSS, lineTimeOfFlight, 0, ((lineTimeOfFlight < 99.945) ? 1 : 0)); // round TOF when high - returnSS << "\",\""; - - if (_airFriction) { - // Calc corrections: - double xOffset, yOffset; - // Crosswind - std::tie(xOffset, std::ignore, std::ignore) = simulateShot(lineElevation, _muzzleVelocity, 0, 10, 0, 15, 1, _airFriction); - const double crosswindOffsetRad = atan2(xOffset, actualDistance) / 10; - // Headwind - std::tie(std::ignore, yOffset, std::ignore) = simulateShot(lineElevation, _muzzleVelocity, 0, 0, -10, 15, 1, _airFriction); - const double headwindOffset = (actualDistance - yOffset) / 10; - // Tailwind - std::tie(std::ignore, yOffset, std::ignore) = simulateShot(lineElevation, _muzzleVelocity, 0, 0, 10, 15, 1, _airFriction); - const double tailwindOffset = (actualDistance - yOffset) / 10; - // Air Temp Dec - std::tie(std::ignore, yOffset, std::ignore) = simulateShot(lineElevation, _muzzleVelocity, 0, 0, 0, 5, 1, _airFriction); - const double tempDecOffset = (actualDistance - yOffset) / 10; - // Air Temp Inc - std::tie(std::ignore, yOffset, std::ignore) = simulateShot(lineElevation, _muzzleVelocity, 0, 0, 0, 25, 1, _airFriction); - const double tempIncOffset = (actualDistance - yOffset) / 10; - // Air Density Dec - std::tie(std::ignore, yOffset, std::ignore) = simulateShot(lineElevation, _muzzleVelocity, 0, 0, 0, 15, 0.9, _airFriction); - const double airDensityDecOffset = (actualDistance - yOffset) / 10; - // Air Density Inc - std::tie(std::ignore, yOffset, std::ignore) = simulateShot(lineElevation, _muzzleVelocity, 0, 0, 0, 15, 1.1, _airFriction); - const double airDensityIncOffset = (actualDistance - yOffset) / 10; - - writeNumber(returnSS, crosswindOffsetRad * 3200.0 / M_PI, 1, 1); - returnSS << "\",\""; - writeNumber(returnSS, headwindOffset, 1, (abs(headwindOffset) > 9.949) ? 0 : 1); - returnSS << "\",\""; - writeNumber(returnSS, tailwindOffset, 1, (abs(tailwindOffset) > 9.949) ? 0 : 1); - returnSS << "\",\""; - writeNumber(returnSS, tempDecOffset, 1, (abs(tempDecOffset) > 9.949) ? 0 : 1); - returnSS << "\",\""; - writeNumber(returnSS, tempIncOffset, 1, (abs(tempIncOffset) > 9.949) ? 0 : 1); - returnSS << "\",\""; - writeNumber(returnSS, airDensityDecOffset, 1, (abs(airDensityDecOffset) > 9.949) ? 0 : 1); - returnSS << "\",\""; - writeNumber(returnSS, airDensityIncOffset, 1, (abs(airDensityIncOffset) > 9.949) ? 0 : 1); - returnSS << "\"]"; - } else { - returnSS << "-\",\"-\",\"-\",\"-\",\"-\",\"-\",\"-\"]"; // 7 dashes - } - return (returnSS.str()); -} - -void __stdcall RVExtensionVersion(char* output, int outputSize) { - strncpy(output, ACE_FULL_VERSION_STR, outputSize - 1); -} -void __stdcall RVExtension(char* output, int outputSize, const char* function) { - if (!strcmp(function, "version")) { - RVExtensionVersion(output, outputSize); - return; - } - strncpy(output, "error - use args version of callExtension", outputSize - 1); -} -int __stdcall RVExtensionArgs(char* output, int outputSize, const char* function, const char** args, int argsCnt) { - if (!strcmp(function, "version")) { - RVExtensionVersion(output, outputSize); - return 0; - } - - if (!strcmp(function, "start")) { - if (argsCnt != 5) { return -2; } // Error: not enough args - const double muzzleVelocity = strtod(args[0], NULL); - const double airFriction = strtod(args[1], NULL); - double minElev = (M_PI / 180.0) * strtod(args[2], NULL); - double maxElev = (M_PI / 180.0) * strtod(args[3], NULL); - const bool highArc = !strcmp(args[4], "true"); - - // Reset workers: - fWorkers.clear(); - getLineIndex = 0; - - double bestAngle, bestDistance; - std::tie(bestAngle, bestDistance) = findMaxAngle(muzzleVelocity, airFriction); - - minElev = std::max(minElev, 2 * (M_PI / 180.0)); // cap min to 2 degrees (negative elev might get messy) - maxElev = std::min(maxElev, 88 * (M_PI / 180.0)); // cap max to 88 degrees (mk6) - if (highArc) { - minElev = std::max(minElev, bestAngle); - } else { - maxElev = std::min(maxElev, bestAngle); - } - const double loopStart = (bestDistance < 4000) ? 50 : 100; - const double loopInc = (bestDistance < 5000) ? 50 : 100; // simplify when range gets high - const double loopMaxRange = std::min(bestDistance, 30000.0); // with no air resistance, max range could go higher than 60km - - if (maxElev > minElev) { // don't bother if we can't hit anything (e.g. mortar in low mode) - for (double range = loopStart; range < loopMaxRange; range += loopInc) { - fWorkers.emplace_back(std::async(&simulateCalcRangeTableLine, range, muzzleVelocity, airFriction, minElev, maxElev, highArc)); - } - } - - std::stringstream outputStr; // debug max distance and thead count - outputStr << "[" << bestDistance << "," << fWorkers.size() << "]"; - strncpy(output, outputStr.str().c_str(), outputSize - 1); - return 0; - } - - if (!strcmp(function, "getline")) { - // 1 = data on line, 2 - data not ready, 3 - done - std::string result = ""; - std::future_status workerStatus; - - while (result.empty()) { - if (getLineIndex >= fWorkers.size()) { - return 3; - } - workerStatus = fWorkers[getLineIndex].wait_for(std::chrono::seconds(0)); - if (workerStatus != std::future_status::ready) { - return 2; - } - result = fWorkers[getLineIndex].get(); - getLineIndex++; - } - strncpy(output, result.c_str(), outputSize - 1); - return 1; - } - - strncpy(output, "error - invalid function", outputSize - 1); - return RETURN_INVALID_FUNCTION; // Error: function not valid -} diff --git a/extensions/artillerytables/artillerytables.hpp b/extensions/artillerytables/artillerytables.hpp deleted file mode 100644 index bd7c7d35a2a..00000000000 --- a/extensions/artillerytables/artillerytables.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * artillerytables.hpp - * Author: PabstMirror - */ - -// ace libs: -#include "vector.hpp" -#include "shared.hpp" -#define RETURN_INVALID_FUNCTION -1001 -#define RETURN_WRONG_ARG_COUNT -1002 - -extern "C" { - EXPORT void __stdcall RVExtension(char* output, int outputSize, const char* function); - EXPORT int __stdcall RVExtensionArgs(char* output, int outputSize, const char* function, const char** argv, int argc); - EXPORT void __stdcall RVExtensionVersion(char* output, int outputSize); -} - -std::tuple simulateShot(const double _fireAngleRad, const double _muzzleVelocity, const double _heightOfTarget, const double _crossWind, const double _tailWind, const double _temperature, const double _airDensity, double _airFriction); -std::tuple findMaxAngle(const double _muzzleVelocity, const double _airFriction); -std::tuple simulateFindSolution(const double _rangeToHit, const double _heightToHit, const double _muzzleVelocity, const double _airFriction, const double _minElev, const double _maxElev, const bool _highArc); -void writeNumber(std::stringstream & ss, double _num, const int _widthInt, const int _widthDec); -std::string simulateCalcRangeTableLine(const double _rangeToHit, const double _muzzleVelocity, const double _airFriction, const double _minElev, const double _maxElev, const bool _highArc); diff --git a/extensions/artillerytables/tests/tester.cpp b/extensions/artillerytables/tests/tester.cpp deleted file mode 100644 index 2dfabe4566e..00000000000 --- a/extensions/artillerytables/tests/tester.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include -#include -#include "gtest/gtest.h" -#include "../artillerytables.hpp" - - -extern "C" { - __declspec(dllexport) void __stdcall RVExtension(char* output, int outputSize, const char* function); - __declspec(dllexport) int __stdcall RVExtensionArgs(char* output, int outputSize, const char* function, const char** argv, int argc); - __declspec(dllexport) void __stdcall RVExtensionVersion(char* output, int outputSize); -} - -namespace test_ace_artillerytables { - TEST(Extension, VersionOld) { - char output[256]; - char function[] = "version"; - RVExtension(output, 256, function); - std::cout << "VersionOld: " << output << "\n"; - ASSERT_STREQ(output, ACE_FULL_VERSION_STR); - } - TEST(Extension, VersionRVExtensionVersion) { - char output[256]; - RVExtensionVersion(output, 256); - std::cout << "VersionExtension: " << output << "\n"; - ASSERT_STREQ(output, ACE_FULL_VERSION_STR); - } - TEST(Extension, VersionArray) { - char output[256]; - char function[] = "version"; - int extReturn = RVExtensionArgs(output, 256, function, NULL, 0); - std::cout << "VersionNew: " << output << "\n"; - ASSERT_EQ(extReturn, 0); - ASSERT_STREQ(output, ACE_FULL_VERSION_STR); - } - TEST(Extension, InvalidFuncOld) { - char output[256]; - char function[] = "blah"; - RVExtension(output, 256, function); - ASSERT_STREQ(output, "error - use args version of callExtension"); - } - TEST(Extension, InvalidFuncArray) { - char output[256]; - char function[] = "blah"; - int extReturn = RVExtensionArgs(output, 256, function, nullptr, 0); - std::cout << "InvalidFunc: " << output << "\n"; - ASSERT_EQ(extReturn, RETURN_INVALID_FUNCTION); - ASSERT_STREQ(output, "error - invalid function"); - } - - - TEST(Extension, TestRun) { - // very basic test that it runs the correct number of lines - char output[256]; - - // Start: - char function1[] = "start"; - const char* args1[] = { "400", "-0.00005", "-5", "80", "true" }; - auto t1 = std::chrono::high_resolution_clock::now(); - int ret1 = RVExtensionArgs(output, 256, function1, args1, 5); - auto t2 = std::chrono::high_resolution_clock::now(); - std::printf("ret: %d - %s\n", ret1, output); - std::printf("func %s: %1.1f ms\n", function1, std::chrono::duration(t2 - t1).count()); - ASSERT_STREQ(output, "[10391.8,103]"); - ASSERT_EQ(ret1, 0); - - int lines = 0; - auto t3 = std::chrono::high_resolution_clock::now(); - char function2[] = "getline"; - int ret2 = 0; - while (ret2 != 3) { // dumb spin - ret2 = RVExtensionArgs(output, 256, function2, NULL, 0); - if (ret2 == 1) { - lines++; - // std::printf("ret: %d - %s\n", ret2, output); - } - } - auto t4 = std::chrono::high_resolution_clock::now(); - std::printf("func %s: %1.1f ms with %d lines\n", function2, std::chrono::duration(t3 - t2).count(), lines); - - std::printf("callExtensions finished in %1.1f ms\n", std::chrono::duration(t4 - t1).count()); - - ASSERT_EQ(lines, 69); - } -} - - -int main(int argc, char** argv) { - // Misc Testing code - // Determine realistic air firiction values - //double mv = 241; - //std::printf(" %f m/s\n", mv); - //double range; - //for (double ar = 0; ar > -0.00015; ar -= 0.00001) { - // std::tie(std::ignore, range) = findMaxAngle(mv, ar); - // printf("[%f] = %f\n", ar, range); - //} - ::testing::InitGoogleTest(&argc, argv); - std::cout << "Starting tests!\n"; - return RUN_ALL_TESTS(); -} diff --git a/extensions/break_line/CMakeLists.txt b/extensions/break_line/CMakeLists.txt deleted file mode 100644 index 320df7a1033..00000000000 --- a/extensions/break_line/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(ACE_EXTENSION_NAME "ace_break_line") - -file(GLOB SOURCES *.h *.hpp *.c *.cpp) -add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES}) -target_link_libraries(${ACE_EXTENSION_NAME} ace_common) -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions) - -if(CMAKE_COMPILER_IS_GNUCXX) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1) -endif() - -# Copy and rename DLL to root -if(USE_64BIT_BUILD) - set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}_x64.dll) -else() - set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}.dll) -endif() -add_custom_command(TARGET ${ACE_EXTENSION_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ ${PROJECT_SOURCE_DIR}/../${FINAL_DLL_NAME} -) diff --git a/extensions/break_line/ace_break_line.cpp b/extensions/break_line/ace_break_line.cpp deleted file mode 100644 index 3c169e6a883..00000000000 --- a/extensions/break_line/ace_break_line.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * ace_break_line.cpp - * - * Takes a string and insert as many line breaks as needed so it fits a given width - * - * Takes: - * Localized string as string - * Example: "Check weapon temperature" - * - * Returns: - * String with line breaks - */ - -#include "shared.hpp" - -#include -#include -#include -#include - -#define MAXCHARACTERS 14 - -extern "C" { - EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); - EXPORT void __stdcall RVExtensionVersion(char *output, int outputSize) { - strncpy(output, ACE_FULL_VERSION_STR, outputSize - 1); - } -} - -std::vector splitString(const std::string & input) { - std::istringstream ss(input); - std::string token; - - std::vector output; - while (std::getline(ss, token, ' ')) { - output.push_back(token); - } - - return output; -} - -std::string addLineBreaks(const std::vector &words) { - std::stringstream sstream; - size_t numChar = 0; - size_t i = 0; - - while (i < words.size()) { - if (numChar == 0) { - sstream << words[i]; - numChar += words[i].size(); - i++; - } else { - if (numChar + 1 + words[i].size() > MAXCHARACTERS) { - sstream << "
"; - numChar = 0; - } else { - sstream << " " << words[i]; - numChar += 1 + words[i].size(); - i++; - } - } - } - - return sstream.str(); -} - -void __stdcall RVExtension(char *output, int outputSize, const char *function) { - ZERO_OUTPUT(); - if (!strcmp(function, "version")) { - strncpy(output, ACE_FULL_VERSION_STR, outputSize - 1); - } else { - strncpy(output, addLineBreaks(splitString(function)).c_str(), outputSize - 1); - } - EXTENSION_RETURN(); -} diff --git a/extensions/clipboard/CMakeLists.txt b/extensions/clipboard/CMakeLists.txt deleted file mode 100644 index 6c5668bcdd2..00000000000 --- a/extensions/clipboard/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -set(ACE_EXTENSION_NAME "ace_clipboard") - -file(GLOB SOURCES *.h *.hpp *.c *.cpp) -add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES}) -target_link_libraries(${ACE_EXTENSION_NAME} ace_common) -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions) - -if(CMAKE_COMPILER_IS_GNUCXX) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1) -endif() - -# Copy and rename DLL to root -if(USE_64BIT_BUILD) - set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}_x64.dll) -else() - set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}.dll) -endif() -add_custom_command(TARGET ${ACE_EXTENSION_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ ${PROJECT_SOURCE_DIR}/../${FINAL_DLL_NAME} -) diff --git a/extensions/clipboard/ace_clipboard.cpp b/extensions/clipboard/ace_clipboard.cpp deleted file mode 100644 index d463a4634e0..00000000000 --- a/extensions/clipboard/ace_clipboard.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ace_clipboard.cpp - * - * Takes a string and copies it to the clipboard; bypasses arma 8k clippy limit. Windows only. - * - * Takes: - * Localized string as string - * - * Returns: - * None - */ - -#include "shared.hpp" - -#include -#include -#include - -extern "C" { - EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); - EXPORT void __stdcall RVExtensionVersion(char *output, int outputSize) { - strncpy(output, ACE_FULL_VERSION_STR, outputSize - 1); - } -} - -std::string gClipboardData; - -void __stdcall RVExtension(char *output, int outputSize, const char *function) { - std::string cur_input(function); - std::string result; - - ZERO_OUTPUT(); - - if (cur_input.length() < 1) { - EXTENSION_RETURN(); - } - - if (!strcmp(function, "version")) { - std::strncpy(output, ACE_FULL_VERSION_STR, outputSize - 1); - EXTENSION_RETURN(); - } - - #ifdef _WIN32 - - if (!strcmp(function, "--COMPLETE--")) { - if (OpenClipboard(NULL) == 0) { - result = "OpenClipboard() failed, GetLastError=" + GetLastError(); - } else { - if (EmptyClipboard() == 0) { - result = "EmptyClipboard() failed, GetLastError=" + GetLastError(); - } else { - // GPTR = GMEM_FIXED + GMEM_ZEROINIT, returns a ptr, no need for GlobalLock/GlobalUnlock - char *pClipboardData = (char *)GlobalAlloc(GPTR, gClipboardData.length()); - - if (pClipboardData == NULL) { - result = "GlobalAlloc() failed, GetLastError=" + GetLastError(); - EXTENSION_RETURN(); - } - strncpy(pClipboardData, gClipboardData.c_str(), gClipboardData.length()); - - // if success, system owns the memory, if fail, free it from the heap - if (SetClipboardData(CF_TEXT, pClipboardData) == NULL) { - result = "SetClipboardData() failed, GetLastError=" + GetLastError(); - GlobalFree(pClipboardData); - } else { - if (CloseClipboard() == 0) { - result = "CloseClipboard() failed, GetLastError=" + GetLastError(); - } - } - } - } - gClipboardData = ""; - } else { - gClipboardData = gClipboardData + cur_input; - } - - if (result.length() > 1) { - strncpy(output, result.c_str(), outputSize - 1); - } - - #endif - - EXTENSION_RETURN(); -} diff --git a/extensions/cmake/FindDirectX.cmake b/extensions/cmake/FindDirectX.cmake deleted file mode 100644 index b413b0b294c..00000000000 --- a/extensions/cmake/FindDirectX.cmake +++ /dev/null @@ -1,215 +0,0 @@ -# - try to find DirectX include directories and libraries -# -# Once done this will define: -# -# DirectX_XYZ_FOUND - system has the XYZ API -# DirectX_XYZ_INCLUDE_FOUND - system has the include for the XYZ API -# DirectX_XYZ_INCLUDE_DIR - include directory for the XYZ API -# DirectX_XYZ_LIBRARY - path/name for the XYZ library -# -# Where XYZ can be any of: -# -# DDRAW -# D3D -# D3DX -# D3D8 -# D3DX8 -# D3D9 -# D3DX9 -# D3D10 -# D3D10_1 -# D3DX10 -# D3D11 -# D3D11_1 -# D3D11_2 -# D3DX11 -# D2D1 -# - - -include (CheckIncludeFileCXX) -include (FindPackageMessage) - - -if (WIN32) - - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set (DirectX_ARCHITECTURE x64) - else () - set (DirectX_ARCHITECTURE x86) - endif () - - # Can't use "$ENV{ProgramFiles(x86)}" to avoid violating CMP0053. See - # http://public.kitware.com/pipermail/cmake-developers/2014-October/023190.html - set (ProgramFiles_x86 "ProgramFiles(x86)") - if ("$ENV{${ProgramFiles_x86}}") - set (ProgramFiles "$ENV{${ProgramFiles_x86}}") - else () - set (ProgramFiles "$ENV{ProgramFiles}") - endif () - - find_path (DirectX_ROOT_DIR - Include/d3d9.h - PATHS - "$ENV{DXSDK_DIR}" - "${ProgramFiles}/Microsoft DirectX SDK (June 2010)" - "${ProgramFiles}/Microsoft DirectX SDK (February 2010)" - "${ProgramFiles}/Microsoft DirectX SDK (March 2009)" - "${ProgramFiles}/Microsoft DirectX SDK (August 2008)" - "${ProgramFiles}/Microsoft DirectX SDK (June 2008)" - "${ProgramFiles}/Microsoft DirectX SDK (March 2008)" - "${ProgramFiles}/Microsoft DirectX SDK (November 2007)" - "${ProgramFiles}/Microsoft DirectX SDK (August 2007)" - "${ProgramFiles}/Microsoft DirectX SDK" - DOC "DirectX SDK root directory" - ) - if (DirectX_ROOT_DIR) - set (DirectX_INC_SEARCH_PATH "${DirectX_ROOT_DIR}/Include") - set (DirectX_LIB_SEARCH_PATH "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}") - set (DirectX_BIN_SEARCH_PATH "${DirectX_ROOT_DIR}/Utilities/bin/x86") - endif () - - # With VS 2011 and Windows 8 SDK, the DirectX SDK is included as part of - # the Windows SDK. - # - # See also: - # - http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275.aspx - if (DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) - set (USE_WINSDK_HEADERS TRUE) - endif () - - # Find a header in the DirectX SDK - macro (find_dxsdk_header var_name header) - set (include_dir_var "DirectX_${var_name}_INCLUDE_DIR") - set (include_found_var "DirectX_${var_name}_INCLUDE_FOUND") - find_path (${include_dir_var} ${header} - HINTS ${DirectX_INC_SEARCH_PATH} - DOC "The directory where ${header} resides" - CMAKE_FIND_ROOT_PATH_BOTH - ) - if (${include_dir_var}) - set (${include_found_var} TRUE) - find_package_message (${var_name}_INC "Found ${header} header: ${${include_dir_var}}/${header}" "[${${include_dir_var}}]") - endif () - mark_as_advanced (${include_found_var}) - endmacro () - - # Find a library in the DirectX SDK - macro (find_dxsdk_library var_name library) - # DirectX SDK - set (library_var "DirectX_${var_name}_LIBRARY") - find_library (${library_var} ${library} - HINTS ${DirectX_LIB_SEARCH_PATH} - DOC "The directory where ${library} resides" - CMAKE_FIND_ROOT_PATH_BOTH - ) - if (${library_var}) - find_package_message (${var_name}_LIB "Found ${library} library: ${${library_var}}" "[${${library_var}}]") - endif () - mark_as_advanced (${library_var}) - endmacro () - - # Find a header in the Windows SDK - macro (find_winsdk_header var_name header) - if (USE_WINSDK_HEADERS) - # Windows SDK - set (include_dir_var "DirectX_${var_name}_INCLUDE_DIR") - set (include_found_var "DirectX_${var_name}_INCLUDE_FOUND") - check_include_file_cxx (${header} ${include_found_var}) - set (${include_dir_var}) - mark_as_advanced (${include_found_var}) - else () - find_dxsdk_header (${var_name} ${header}) - endif () - endmacro () - - # Find a library in the Windows SDK - macro (find_winsdk_library var_name library) - if (USE_WINSDK_HEADERS) - # XXX: We currently just assume the library exists - set (library_var "DirectX_${var_name}_LIBRARY") - set (${library_var} ${library}) - mark_as_advanced (${library_var}) - else () - find_dxsdk_library (${var_name} ${library}) - endif () - endmacro () - - # Combine header and library variables into an API found variable - macro (find_combined var_name inc_var_name lib_var_name) - if (DirectX_${inc_var_name}_INCLUDE_FOUND AND DirectX_${lib_var_name}_LIBRARY) - set (DirectX_${var_name}_FOUND 1) - find_package_message (${var_name} "Found ${var_name} API" "[${DirectX_${lib_var_name}_LIBRARY}][${DirectX_${inc_var_name}_INCLUDE_DIR}]") - endif () - endmacro () - - find_winsdk_header (DDRAW ddraw.h) - find_winsdk_library (DDRAW ddraw) - find_combined (DDRAW DDRAW DDRAW) - - if (CMAKE_GENERATOR_TOOLSET MATCHES "_xp$") - # Windows 7 SDKs, used by XP toolset, do not include d3d.h - find_dxsdk_header (D3D d3d.h) - else () - find_winsdk_header (D3D d3d.h) - endif () - find_combined (D3D D3D DDRAW) - - find_dxsdk_header (D3DX d3dx.h) - find_combined (D3DX D3DX D3DX) - - find_dxsdk_header (D3D8 d3d8.h) - find_dxsdk_library (D3D8 d3d8) - find_combined (D3D8 D3D8 D3D8) - - find_dxsdk_header (D3DX8 d3dx8.h) - find_dxsdk_library (D3DX8 d3dx8) - find_combined (D3DX8 D3DX8 D3DX8) - - find_winsdk_header (D3D9 d3d9.h) - find_winsdk_library (D3D9 d3d9) - find_combined (D3D9 D3D9 D3D9) - - find_dxsdk_header (D3DX9 d3dx9.h) - find_dxsdk_library (D3DX9 d3dx9) - find_combined (D3DX9 D3DX9 D3DX9) - - find_winsdk_header (DXGI dxgi.h) - find_winsdk_header (DXGI1_2 dxgi1_2.h) - find_winsdk_header (DXGI1_3 dxgi1_3.h) - find_winsdk_library (DXGI dxgi) - - find_winsdk_header (D3D10 d3d10.h) - find_winsdk_library (D3D10 d3d10) - find_combined (D3D10 D3D10 D3D10) - - find_winsdk_header (D3D10_1 d3d10_1.h) - find_winsdk_library (D3D10_1 d3d10_1) - find_combined (D3D10_1 D3D10_1 D3D10_1) - - find_dxsdk_header (D3DX10 d3dx10.h) - find_dxsdk_library (D3DX10 d3dx10) - find_combined (D3DX10 D3DX10 D3DX10) - - find_winsdk_header (D3D11 d3d11.h) - find_winsdk_library (D3D11 d3d11) - find_combined (D3D11 D3D11 D3D11) - find_winsdk_header (D3D11_1 d3d11_1.h) - find_combined (D3D11_1 D3D11_1 D3D11) - find_winsdk_header (D3D11_2 d3d11_2.h) - find_combined (D3D11_2 D3D11_2 D3D11) - - find_dxsdk_header (D3DX11 d3dx11.h) - find_dxsdk_library (D3DX11 d3dx11) - find_combined (D3DX11 D3DX11 D3DX11) - - find_winsdk_header (D2D1 d2d1.h) - find_winsdk_library (D2D1 d2d1) - find_combined (D2D1 D2D1 D2D1) - - find_program (DirectX_FXC_EXECUTABLE fxc - HINTS ${DirectX_BIN_SEARCH_PATH} - DOC "Path to fxc.exe executable." - ) - -endif () \ No newline at end of file diff --git a/extensions/common/CMakeLists.txt b/extensions/common/CMakeLists.txt deleted file mode 100644 index 92abaa8f6bb..00000000000 --- a/extensions/common/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -file(GLOB_RECURSE ACE_COMMON_SOURCES *.h *.hpp *.c *.cpp) - - -file(GLOB ACE_BASE_COMMON_SOURCES *.h *.hpp *.c *.cpp) -#file(GLOB ACE_P3D_SOURCES p3d/*.h p3d/*.hpp p3d/*.c p3d/*.cpp) -#file(GLOB ACE_PBO_SOURCES pbo/*.h pbo/*.hpp pbo/*.c pbo/*.cpp) -#file(GLOB ACE_SIMULATION_SOURCES simulation/*.h simulation/*.hpp simulation/*.c simulation/*.cpp) -#file(GLOB ACE_DIRECTX_SOURCES directx/*.h directx/*.hpp directx/*.c directx/*.cpp) -#file(GLOB ACE_GLM_SOURCES glm/*.h glm/*.hpp glm/*.c glm/*.cpp) - -SOURCE_GROUP("common" FILES ${ACE_BASE_COMMON_SOURCES}) -#SOURCE_GROUP("p3d" FILES ${ACE_P3D_SOURCES}) -#SOURCE_GROUP("pbo" FILES ${ACE_PBO_SOURCES}) -#SOURCE_GROUP("simulation" FILES ${ACE_SIMULATION_SOURCES}) -#SOURCE_GROUP("directx" FILES ${ACE_DIRECTX_SOURCES}) -#SOURCE_GROUP("glm" FILES ${ACE_GLM_SOURCES}) - -add_library(ace_common STATIC ${ACE_GLM_SOURCES} ${ACE_BASE_COMMON_SOURCES} ${ACE_P3D_SOURCES} ${ACE_PBO_SOURCES} ${ACE_SIMULATION_SOURCES} ${ACE_DIRECTX_SOURCES}) diff --git a/extensions/common/ace_common.cpp b/extensions/common/ace_common.cpp deleted file mode 100644 index 2f887450f24..00000000000 --- a/extensions/common/ace_common.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -int test(int var) { - return var; -} \ No newline at end of file diff --git a/extensions/common/ace_common.h b/extensions/common/ace_common.h deleted file mode 100644 index 8da16d779a1..00000000000 --- a/extensions/common/ace_common.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -#include "targetver.h" -#include "ace_version.hpp" diff --git a/extensions/common/ace_version.hpp.in b/extensions/common/ace_version.hpp.in deleted file mode 100644 index 48ff6e75c19..00000000000 --- a/extensions/common/ace_version.hpp.in +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -#define ACE_VERSION_STR "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@" -#define ACE_FULL_VERSION_STR "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" \ No newline at end of file diff --git a/extensions/common/ace_version_win32.rc.in b/extensions/common/ace_version_win32.rc.in deleted file mode 100644 index 5bba006f9a3..00000000000 --- a/extensions/common/ace_version_win32.rc.in +++ /dev/null @@ -1,47 +0,0 @@ -#ifdef _WIN32 - - #include - - #ifndef DEBUG - #define VER_DEBUG 0 - #else - #define VER_DEBUG VS_FF_DEBUG - #endif - - VS_VERSION_INFO VERSIONINFO - FILEVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@ - PRODUCTVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@ - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS (VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE|VER_DEBUG) - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN - BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - BEGIN - VALUE "CompanyName", "ACE3 Team" - VALUE "FileDescription", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" - VALUE "FileVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" - VALUE "ProductName", "ACE3" - VALUE "ProductVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" - VALUE "Build Date", "@ACE_BUILDSTAMP@" - END - END - - BLOCK "VarFileInfo" - BEGIN - /* The following line should only be modified for localized versions. */ - /* It consists of any number of WORD,WORD pairs, with each pair */ - /* describing a language,codepage combination supported by the file. */ - /* */ - /* For example, a file might have values "0x409,1252" indicating that it */ - /* supports English language (0x409) in the Windows ANSI codepage (1252). */ - - VALUE "Translation", 0x409, 1252 - - END - END - -#endif \ No newline at end of file diff --git a/extensions/common/arguments.hpp b/extensions/common/arguments.hpp deleted file mode 100644 index 7869cc2998e..00000000000 --- a/extensions/common/arguments.hpp +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once - -#include "shared.hpp" -#include "vector.hpp" - -#include -#include - -namespace ace { - class argument_accessor { - public: - argument_accessor(const uint32_t index, const std::vector & ar) : _index(index), _args(ar) { } - - const std::string & as_string() const { return _args[_index]; } - operator const std::string &() const { return as_string(); } - - float as_float() const { return atof(_args[_index].c_str()); } - operator float() const { return as_float(); } - - int as_int() const { return atoi(_args[_index].c_str()); } - operator int() const { return as_int(); } - - int as_uint32() const { return (uint32_t)atoi(_args[_index].c_str()); } - operator uint32_t() const { return as_uint32(); } - - ace::vector3 as_vector() const { - std::vector t = ace::split(_args[_index], ';'); - return ace::vector3(atof(t[0].c_str()), - atof(t[1].c_str()), - atof(t[2].c_str())); - } - operator ace::vector3() const { return as_vector(); } - - protected: - const uint32_t _index; - const std::vector & _args; - }; - - class arguments { - public: - arguments(const std::string & str) : _original(str) { - _args = ace::split(str, ','); - for (int i = 0; i < _args.size(); i++) { - _args[i] = trim(_args[i]); - } - } - - size_t size() const { return _args.size(); } - - const argument_accessor operator[] (int index) const { return argument_accessor(index, _args); } - - const std::string & as_string(uint32_t _index) const { return _args[_index]; } - float as_float(uint32_t _index) const { return atof(_args[_index].c_str()); } - int as_int(uint32_t _index) const { return atoi(_args[_index].c_str()); } - int as_uint32(uint32_t _index) const { return (uint32_t)atoi(_args[_index].c_str()); } - ace::vector3 as_vector(uint32_t _index) const { - std::vector t = ace::split(_args[_index], ';'); - return ace::vector3(atof(t[0].c_str()), - atof(t[1].c_str()), - atof(t[2].c_str())); - } - - const std::string & get() const { - return _original; - } - - std::string create(const std::string & command) const { - std::stringstream ss; - ss << command << ":"; - - for (auto & v : _args) { - ss << v << ","; - } - - // Remove the trailing , - std::string result = ss.str(); - result.erase(result.length()); - - return result; - } - static std::string create(const std::string & command, const arguments & args) { - return args.create(command); - } - - - protected: - std::vector _args; - const std::string _original; - }; -} \ No newline at end of file diff --git a/extensions/common/directx/d3d_display.cpp b/extensions/common/directx/d3d_display.cpp deleted file mode 100644 index b434264b69a..00000000000 --- a/extensions/common/directx/d3d_display.cpp +++ /dev/null @@ -1,440 +0,0 @@ -#ifdef USE_DIRECTX - -#include "shared.hpp" -#include "d3d_display.hpp" - -#include - -#include - -using namespace DirectX; - -namespace ace { - namespace debug { - - DWORD GetMainThreadId() { - const std::shared_ptr hThreadSnapshot( - CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0), CloseHandle); - if (hThreadSnapshot.get() == INVALID_HANDLE_VALUE) { - throw std::runtime_error("GetMainThreadId failed"); - } - THREADENTRY32 tEntry; - tEntry.dwSize = sizeof(THREADENTRY32); - DWORD result = 0; - DWORD currentPID = GetCurrentProcessId(); - for (BOOL success = Thread32First(hThreadSnapshot.get(), &tEntry); - !result && success && GetLastError() != ERROR_NO_MORE_FILES; - success = Thread32Next(hThreadSnapshot.get(), &tEntry)) - { - if (tEntry.th32OwnerProcessID == currentPID) { - result = tEntry.th32ThreadID; - } - } - return result; - } - - d3d_display::d3d_display() : _fullscreen(false) {} - d3d_display::~d3d_display() {} - - bool d3d_display::render_thread(uint32_t w, uint32_t h, bool f) { - _render_thread = std::make_unique(this, d3d_display_worker_args(w, h, f) ); - return true; - } - - void d3d_display::render_worker(d3d_display_worker_args args) { - { - create(args.width, args.height, args.fullscreen); - init(); - } - run(); - } - - bool d3d_display::run() { - MSG msg = { 0 }; - - while (WM_QUIT != msg.message) { - if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } else { - render(); - } - } - - return true; - } - - bool d3d_display::init() { - - std::lock_guard _lock(_render_lock); - - HRESULT hr = S_OK; - RECT rc; - - GetClientRect(_hWnd, &rc); - UINT width = rc.right - rc.left; - UINT height = rc.bottom - rc.top; - UINT createDeviceFlags = 0; -#ifdef _DEBUG - createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; -#endif - - D3D_DRIVER_TYPE driverTypes[] = - { - D3D_DRIVER_TYPE_HARDWARE, - D3D_DRIVER_TYPE_WARP, - D3D_DRIVER_TYPE_REFERENCE, - }; - UINT numDriverTypes = ARRAYSIZE(driverTypes); - - D3D_FEATURE_LEVEL featureLevels[] = - { - D3D_FEATURE_LEVEL_11_0, - D3D_FEATURE_LEVEL_10_1, - D3D_FEATURE_LEVEL_10_0, - }; - UINT numFeatureLevels = ARRAYSIZE(featureLevels); - - DXGI_SWAP_CHAIN_DESC sd; - ZeroMemory(&sd, sizeof(sd)); - sd.BufferCount = 1; - sd.BufferDesc.Width = width; - sd.BufferDesc.Height = height; - sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - sd.BufferDesc.RefreshRate.Numerator = 60; - sd.BufferDesc.RefreshRate.Denominator = 1; - sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - sd.OutputWindow = _hWnd; - sd.SampleDesc.Count = 1; - sd.SampleDesc.Quality = 0; - sd.Windowed = _fullscreen ? FALSE : TRUE; - - for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++) - { - _driverType = driverTypes[driverTypeIndex]; - hr = D3D11CreateDeviceAndSwapChain(nullptr, _driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels, - D3D11_SDK_VERSION, &sd, &_pSwapChain, &_pd3dDevice, &_featureLevel, &_pImmediateContext); - if (SUCCEEDED(hr)) - break; - } - if (FAILED(hr)) - return false; - - // Create a render target view - ID3D11Texture2D* pBackBuffer = nullptr; - hr = _pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); - if (FAILED(hr)) - return false; - - hr = _pd3dDevice->CreateRenderTargetView(pBackBuffer, nullptr, &_pRenderTargetView); - pBackBuffer->Release(); - if (FAILED(hr)) - return false; - - // Create depth stencil texture - D3D11_TEXTURE2D_DESC descDepth; - ZeroMemory(&descDepth, sizeof(descDepth)); - descDepth.Width = width; - descDepth.Height = height; - descDepth.MipLevels = 1; - descDepth.ArraySize = 1; - descDepth.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; - descDepth.SampleDesc.Count = 1; - descDepth.SampleDesc.Quality = 0; - descDepth.Usage = D3D11_USAGE_DEFAULT; - descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; - descDepth.CPUAccessFlags = 0; - descDepth.MiscFlags = 0; - hr = _pd3dDevice->CreateTexture2D(&descDepth, nullptr, &_pDepthStencil); - if (FAILED(hr)) - return false; - - // Create the depth stencil view - D3D11_DEPTH_STENCIL_VIEW_DESC descDSV; - ZeroMemory(&descDSV, sizeof(descDSV)); - descDSV.Format = descDepth.Format; - descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; - descDSV.Texture2D.MipSlice = 0; - hr = _pd3dDevice->CreateDepthStencilView(_pDepthStencil, &descDSV, &_pDepthStencilView); - if (FAILED(hr)) - return false; - - _pImmediateContext->OMSetRenderTargets(1, &_pRenderTargetView, _pDepthStencilView); - - // Setup the viewport - D3D11_VIEWPORT vp; - vp.Width = (FLOAT)width; - vp.Height = (FLOAT)height; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - vp.TopLeftX = 0; - vp.TopLeftY = 0; - _pImmediateContext->RSSetViewports(1, &vp); - - XMStoreFloat4x4(&_World, XMMatrixIdentity()); - XMStoreFloat4x4(&_View, XMMatrixLookAtLH(XMLoadFloat4(&_camera.camPosition), XMLoadFloat4(&_camera.camTarget), XMLoadFloat4(&_camera.camUp))); - XMStoreFloat4x4(&_Projection, XMMatrixPerspectiveFovLH(XM_PIDIV4, width / (FLOAT)height, 0.01f, 100.0f)); - - init_input(); - - return true; - } - - bool d3d_display::init_input() { - RAWINPUTDEVICE Rid[2]; - - Rid[0].usUsagePage = 0x01; // magic numbers - Rid[0].usUsage = 0x02; // magically means mouse - Rid[0].dwFlags = 0; // (use this if you DO NOT WANT to capture mouse) - //Rid[0].dwFlags = RIDEV_CAPTUREMOUSE | RIDEV_NOLEGACY ; // (use this to CAPTURE MOUSE) - Rid[0].hwndTarget = _hWnd; - - Rid[1].usUsagePage = 0x01; // magic numbers - Rid[1].usUsage = 0x06; // magically means keyboard - Rid[1].dwFlags = 0; // use RIDEV_NOHOTKEYS for no winkey - Rid[1].hwndTarget = _hWnd; - - if (!RegisterRawInputDevices(Rid, 2, sizeof(Rid[0]))) { - LOG(ERROR) << "Could not register raw input devices. "; - exit(1); - } - return true; - } - - bool d3d_display::create(uint32_t width = 1024, uint32_t height = 768, bool fullscreen = false) { - std::lock_guard _lock(_render_lock); - - _fullscreen = fullscreen; - - WNDCLASSEXW wcex; - wcex.cbSize = sizeof(WNDCLASSEXW); - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = (WNDPROC)&ace::debug::d3d_display::wndproc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = (HINSTANCE)GetCurrentProcess(); - //wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SAMPLE1); - //wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wcex.lpszMenuName = nullptr; - wcex.lpszClassName = L"ACE3BaseDisplayClass"; - //wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SAMPLE1); - if (!RegisterClassExW(&wcex)) { - return false; - } - - // Create window - _hInst = (HINSTANCE)GetCurrentProcess(); - RECT rc = { 0, 0, width, height }; - AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE); - _hWnd = CreateWindowW(L"ACE3BaseDisplayClass", L"ACE3 D3D Render", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, _hInst, - nullptr); - - if (!_hWnd) { - return false; - } - - // Attach our input to the master input - //AttachThreadInput(GetCurrentThreadId(), GetMainThraedId()); - - SetWindowLongPtr(_hWnd, GWLP_USERDATA, (LONG)this); - - ShowWindow(_hWnd, 5); - - return true; - } - - bool d3d_display::destroy() { - if (_pImmediateContext) _pImmediateContext->ClearState(); - - if (_pBatchInputLayout) _pBatchInputLayout->Release(); - - if (_pTextureRV1) _pTextureRV1->Release(); - if (_pTextureRV2) _pTextureRV2->Release(); - - if (_pDepthStencilView) _pDepthStencilView->Release(); - if (_pDepthStencil) _pDepthStencil->Release(); - if (_pRenderTargetView) _pRenderTargetView->Release(); - if (_pSwapChain) _pSwapChain->Release(); - if (_pImmediateContext) _pImmediateContext->Release(); - if (_pd3dDevice) _pd3dDevice->Release(); - - return true; - } - - bool d3d_display::render() { - // Update our time - static float t = 0.0f; - static float dt = 0.f; - if (_driverType == D3D_DRIVER_TYPE_REFERENCE) { - t += (float)XM_PI * 0.0125f; - } else { - static uint64_t dwTimeStart = 0; - static uint64_t dwTimeLast = 0; - uint64_t dwTimeCur = GetTickCount64(); - if (dwTimeStart == 0) - dwTimeStart = dwTimeCur; - t = (dwTimeCur - dwTimeStart) / 1000.0f; - dt = (dwTimeCur - dwTimeLast) / 1000.0f; - dwTimeLast = dwTimeCur; - } - - { - std::lock_guard _lock(_render_lock); - - _pImmediateContext->ClearRenderTargetView(_pRenderTargetView, Colors::MidnightBlue); - _pImmediateContext->ClearDepthStencilView(_pDepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0); - - update_camera(); - step(); - - _pSwapChain->Present(0, 0); - } - - return true; - } - - bool d3d_display::step() { - return true; - } - - void d3d_display::_move_camera(ace::vector3 direction) { - - } - void d3d_display::_rotate_camera(ace::vector3 direction) { - - } - void d3d_display::update_camera() { - XMVECTOR DefaultForward, DefaultRight, camPosition; - - DefaultForward = XMLoadFloat4(&_camera.DefaultForward); - DefaultRight = XMLoadFloat4(&_camera.DefaultRight); - camPosition = XMLoadFloat4(&_camera.camPosition); - - XMMATRIX camRotationMatrix = XMMatrixRotationRollPitchYaw(_camera.camPitch, _camera.camYaw, 0); - XMVECTOR camTarget = XMVector3TransformCoord(DefaultForward, camRotationMatrix); - camTarget = XMVector3Normalize(camTarget); - - XMVECTOR camRight = XMVector3TransformCoord(DefaultRight, camRotationMatrix); - XMVECTOR camForward = XMVector3TransformCoord(DefaultForward, camRotationMatrix); - XMVECTOR camUp = XMVector3Cross(camForward, camRight); - - camPosition += _camera.moveLeftRight * camRight; - camPosition += _camera.moveBackForward * camForward; - XMStoreFloat4(&_camera.camPosition, camPosition); - - _camera.moveLeftRight = 0.0f; - _camera.moveBackForward = 0.0f; - - camTarget = camPosition + camTarget; - - XMStoreFloat4x4(&_View, XMMatrixLookAtLH(camPosition, camTarget, camUp)); - } - - LRESULT CALLBACK d3d_display::_wndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - PAINTSTRUCT ps; - HDC hdc; - - switch (message) { - case WM_INPUT: { - UINT dwSize; - if (GetActiveWindow() != _hWnd) { - return DefWindowProc(hWnd, message, wParam, lParam); - } - GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, - sizeof(RAWINPUTHEADER)); - LPBYTE lpb = new BYTE[dwSize]; - if (lpb == NULL) { - return 0; - } - - int readSize = GetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER)); - - if (readSize != dwSize) - break; - - RAWINPUT* raw = (RAWINPUT*)lpb; - - float speed = 0.5f; - - if (raw->header.dwType == RIM_TYPEKEYBOARD) { - switch (raw->data.keyboard.VKey) { - case VK_SPACE: { - XMStoreFloat4(&_camera.camPosition, XMVectorSet(0, 0, 0, 0)); - break; - } - // Camera Movement - case 0x57: case VK_NUMPAD8: - case VK_UP: { - _camera.moveBackForward += speed; - break; - } - case 0x53: case VK_NUMPAD2: - case VK_DOWN: { - _camera.moveBackForward -= speed; - break; - } - case 0x41: case VK_NUMPAD4: - case VK_LEFT: { - _camera.moveLeftRight -= speed; - break; - } - case 0x44: case VK_NUMPAD6: - case VK_RIGHT: { - _camera.moveLeftRight += speed; - break; - } - // Numpad Movement - case VK_NUMPAD5: { - XMStoreFloat4(&_camera.camPosition, XMVectorSet(0, 0, 0, 0)); - break; - } - } - } - else if (raw->header.dwType == RIM_TYPEMOUSE) { - RAWMOUSE mouseCurrState = raw->data.mouse; - - if ((mouseCurrState.lLastX != _last_mouse_state.lLastY) || (mouseCurrState.lLastX != _last_mouse_state.lLastY)) - { - _camera.camYaw += mouseCurrState.lLastX * 0.005f; - _camera.camPitch += mouseCurrState.lLastY * 0.005f; - _last_mouse_state = mouseCurrState; - } - - } - - delete[] lpb; - return 0; - } - - case WM_PAINT: - hdc = BeginPaint(hWnd, &ps); - EndPaint(hWnd, &ps); - break; - - case WM_DESTROY: - PostQuitMessage(0); - - break; - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - - return 0; - } - LRESULT CALLBACK d3d_display::wndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - LONG data; - data = GetWindowLongPtr(hWnd, GWLP_USERDATA); - if (data) { - return ((d3d_display*)data)->_wndproc(hWnd, message, wParam, lParam); - } else { - return DefWindowProc(hWnd, message, wParam, lParam); - } - } - }; - - -}; - -#endif \ No newline at end of file diff --git a/extensions/common/directx/d3d_display.hpp b/extensions/common/directx/d3d_display.hpp deleted file mode 100644 index c17eedf8ccc..00000000000 --- a/extensions/common/directx/d3d_display.hpp +++ /dev/null @@ -1,130 +0,0 @@ -#pragma once - -#ifdef USE_DIRECTX - -#include -#include -#include -#include - -#include -#include -#include - -#include "singleton.hpp" -#include "vector.hpp" - -#define IDI_ACE_DEBUG 666 - -namespace ace { - namespace debug { - - __declspec(align(16)) - struct camera_movement { - camera_movement() { - XMStoreFloat4(&DefaultForward, DirectX::XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f)); - XMStoreFloat4(&DefaultRight, DirectX::XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f)); - XMStoreFloat4(&camForward, DirectX::XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f)); - XMStoreFloat4(&camRight, DirectX::XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f)); - - camYaw = 0.0f; - camPitch = 0.0f; - - moveLeftRight = 0.0f; - moveBackForward = 0.0f; - - XMStoreFloat4(&camPosition, DirectX::XMVectorSet(0.0f, 12.0f, 6.0f, 0.0f)); - XMStoreFloat4(&camTarget, DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f)); - XMStoreFloat4(&camUp, DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f)); - } - - DirectX::XMFLOAT4 DefaultForward; - DirectX::XMFLOAT4 DefaultRight; - DirectX::XMFLOAT4 camForward; - DirectX::XMFLOAT4 camRight; - - DirectX::XMFLOAT4X4 camRotationMatrix; - DirectX::XMFLOAT4X4 groundWorld; - - float moveLeftRight; - float moveBackForward; - - float camYaw; - float camPitch; - - DirectX::XMFLOAT4 camPosition; - DirectX::XMFLOAT4 camTarget; - DirectX::XMFLOAT4 camUp; - }; - - struct d3d_display_worker; - struct d3d_display_worker_args; - __declspec(align(16)) - class d3d_display { - public: - d3d_display(); - ~d3d_display(); - - virtual bool run(); - virtual bool render(); - virtual bool render_thread(uint32_t, uint32_t, bool); - - virtual void update_camera(); - virtual bool step(); - - virtual bool create(uint32_t, uint32_t, bool); - virtual bool init(); - virtual bool init_input(); - - virtual bool destroy(); - - void render_worker(d3d_display_worker_args); - - static LRESULT CALLBACK wndproc(HWND, UINT, WPARAM, LPARAM); - LRESULT CALLBACK _wndproc(HWND, UINT, WPARAM, LPARAM); - protected: - void _move_camera(ace::vector3); - void _rotate_camera(ace::vector3); - - std::unique_ptr _render_thread; - std::mutex _render_lock; - - bool _fullscreen; - HINSTANCE _hInst = nullptr; - HWND _hWnd = nullptr; - D3D_DRIVER_TYPE _driverType = D3D_DRIVER_TYPE_NULL; - D3D_FEATURE_LEVEL _featureLevel = D3D_FEATURE_LEVEL_11_0; - ID3D11Device* _pd3dDevice = nullptr; - ID3D11DeviceContext* _pImmediateContext = nullptr; - IDXGISwapChain* _pSwapChain = nullptr; - ID3D11RenderTargetView* _pRenderTargetView = nullptr; - ID3D11Texture2D* _pDepthStencil = nullptr; - ID3D11DepthStencilView* _pDepthStencilView = nullptr; - - ID3D11ShaderResourceView* _pTextureRV1 = nullptr; - ID3D11ShaderResourceView* _pTextureRV2 = nullptr; - ID3D11InputLayout* _pBatchInputLayout = nullptr; - - DirectX::XMFLOAT4X4 _World; - DirectX::XMFLOAT4X4 _View; - DirectX::XMFLOAT4X4 _Projection; - - RAWMOUSE _last_mouse_state; - camera_movement _camera; - - }; - struct d3d_display_worker_args { - d3d_display_worker_args(uint32_t w, uint32_t h, bool f) : width(w), height(h), fullscreen(f) {} - uint32_t width; - uint32_t height; - bool fullscreen; - }; - struct d3d_display_worker { - d3d_display_worker(d3d_display * obj, d3d_display_worker_args args) : thread(&ace::debug::d3d_display::render_worker, obj, args) {} - ~d3d_display_worker() { thread.join(); } - std::thread thread; - }; - }; -}; - -#endif \ No newline at end of file diff --git a/extensions/common/dispatch.hpp b/extensions/common/dispatch.hpp deleted file mode 100644 index 5292336b850..00000000000 --- a/extensions/common/dispatch.hpp +++ /dev/null @@ -1,153 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "shared.hpp" -#include "arguments.hpp" -#include "singleton.hpp" - -namespace ace { - class dispatcher { - public: - dispatcher() : _ready(true) {} - - virtual bool call(const std::string & name_, const arguments & args_, std::string & result_) { - if (_methods.find(name_) == _methods.end()) { - // @TODO: Exceptions - return false; - } - return _methods[name_](args_, result_); - } - - bool add(const std::string & name_, std::function func_) { - if (_methods.find(name_) != _methods.end()) { - // @TODO: Exceptions - return false; - } - _methods[name_] = func_; - - return true; - } - - bool ready() const { return _ready; } - void ready(bool r) { _ready.exchange(r); } - protected: - std::unordered_map < std::string, std::function > _methods; - std::atomic_bool _ready; - }; - class dispatch : public dispatcher, public singleton { }; - - struct dispatch_message { - dispatch_message(const std::string & command_, const arguments & args_, const uint64_t id_) : command(command_), args(args_), id(id_) {} - std::string command; - arguments args; - uint64_t id; - }; - struct dispatch_result { - dispatch_result() {} - dispatch_result(const std::string &res, const uint64_t id_) : message(res), id(id_) {} - std::string message; - uint64_t id; - }; - - class threaded_dispatcher : public dispatcher { - public: - threaded_dispatcher() : _stop(false), _worker(&ace::threaded_dispatcher::monitor, this) { - - } - ~threaded_dispatcher() {} - - bool call(const std::string & name_, const arguments & args_, std::string & result_, bool threaded) { - if (_methods.find(name_) == _methods.end()) { - // @TODO: Exceptions - return false; - } - if (threaded) { - std::lock_guard lock(_messages_lock); - _messages.push(dispatch_message(name_, args_, _message_id)); - - // @TODO: We should provide an interface for this serialization. - std::stringstream ss; - ss << "[\"result_id\", \"" << _message_id << "\" ]"; - result_ = ss.str(); - - _message_id = _message_id + 1; - } else { -#ifdef _DEBUG - if (name_ != "fetch_result") { - LOG(TRACE) << "dispatch[immediate]:\t[" << name_ << "] { " << args_.get() << " }"; - } -#endif - return dispatcher::call(name_, args_, result_); - } - - return true; - } - bool call(const std::string & name_, const arguments & args_, std::string & result_) override { - return call(name_, args_, result_, false); - } - - void push_result(const dispatch_result & result) { - { - std::lock_guard lock(_results_lock); - _results.push(result); - } - } - void push_result(const std::string & result) { - push_result(dispatch_result(result, -1)); - } - void stop() { - std::lock_guard lock(_messages_lock); - _stop = true; - } - protected: - void monitor() { - _ready = false; - while (!_stop) { - { - std::lock_guard lock(_messages_lock); - while (!_messages.empty()) { - if (_ready) { - dispatch_result result; - dispatch_message _message = std::move(_messages.front()); - _messages.pop(); - - result.id = _message.id; - result.message.resize(4096); -#ifdef _DEBUG - if (_message.command != "fetch_result") { - LOG(TRACE) << "dispatch[threaded]:\t[" << _message.command << "]"; - if (_message.args.size() > 0) { - // LOG(TRACE) << "\t{ " << _messages.front().args.get() << " }"; - } - } -#endif - dispatcher::call(_message.command, _message.args, result.message); - { - std::lock_guard lock(_results_lock); - _results.push(result); - } - - - } - } - } - sleep(5); - } - } - std::atomic_bool _stop; - std::queue _results; - std::mutex _results_lock; - - std::queue _messages; - std::mutex _messages_lock; - - std::thread _worker; - - uint64_t _message_id; - }; - class threaded_dispatch : public threaded_dispatcher, public singleton { }; -}; \ No newline at end of file diff --git a/extensions/common/glm/CMakeLists.txt b/extensions/common/glm/CMakeLists.txt deleted file mode 100644 index aaeae6269e1..00000000000 --- a/extensions/common/glm/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -set(NAME glm_dummy) - -file(GLOB ROOT_SOURCE *.cpp) -file(GLOB ROOT_INLINE *.inl) -file(GLOB ROOT_HEADER *.hpp) -file(GLOB ROOT_TEXT ../*.txt) -file(GLOB ROOT_NAT ../util/glm.natvis) - -file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp) -file(GLOB_RECURSE CORE_INLINE ./detail/*.inl) -file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp) - -file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) -file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) -file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) - -file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) -file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) -file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) - -source_group("Text Files" FILES ${ROOT_TEXT}) -source_group("Core Files" FILES ${CORE_SOURCE}) -source_group("Core Files" FILES ${CORE_INLINE}) -source_group("Core Files" FILES ${CORE_HEADER}) -source_group("GTC Files" FILES ${GTC_SOURCE}) -source_group("GTC Files" FILES ${GTC_INLINE}) -source_group("GTC Files" FILES ${GTC_HEADER}) -source_group("GTX Files" FILES ${GTX_SOURCE}) -source_group("GTX Files" FILES ${GTX_INLINE}) -source_group("GTX Files" FILES ${GTX_HEADER}) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) - -if(GLM_TEST_ENABLE) - add_executable(${NAME} ${ROOT_TEXT} ${ROOT_NAT} - ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} - ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} - ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} - ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) -endif(GLM_TEST_ENABLE) - -#add_library(glm STATIC glm.cpp) -#add_library(glm_shared SHARED glm.cpp) diff --git a/extensions/common/glm/common.hpp b/extensions/common/glm/common.hpp deleted file mode 100644 index 9ee54256433..00000000000 --- a/extensions/common/glm/common.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/common.hpp -/// @date 2013-12-24 / 2013-12-24 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "detail/func_common.hpp" diff --git a/extensions/common/glm/detail/_features.hpp b/extensions/common/glm/detail/_features.hpp deleted file mode 100644 index 1e6089d2317..00000000000 --- a/extensions/common/glm/detail/_features.hpp +++ /dev/null @@ -1,428 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_features.hpp -/// @date 2013-02-20 / 2013-02-20 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// #define GLM_CXX98_EXCEPTIONS -// #define GLM_CXX98_RTTI - -// #define GLM_CXX11_RVALUE_REFERENCES -// Rvalue references - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html - -// GLM_CXX11_TRAILING_RETURN -// Rvalue references for *this - GCC not supported -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm - -// GLM_CXX11_NONSTATIC_MEMBER_INIT -// Initialization of class objects by rvalues - GCC any -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1610.html - -// GLM_CXX11_NONSTATIC_MEMBER_INIT -// Non-static data member initializers - GCC 4.7 -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2756.htm - -// #define GLM_CXX11_VARIADIC_TEMPLATE -// Variadic templates - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf - -// -// Extending variadic template template parameters - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf - -// #define GLM_CXX11_GENERALIZED_INITIALIZERS -// Initializer lists - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm - -// #define GLM_CXX11_STATIC_ASSERT -// Static assertions - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html - -// #define GLM_CXX11_AUTO_TYPE -// auto-typed variables - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf - -// #define GLM_CXX11_AUTO_TYPE -// Multi-declarator auto - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1737.pdf - -// #define GLM_CXX11_AUTO_TYPE -// Removal of auto as a storage-class specifier - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2546.htm - -// #define GLM_CXX11_AUTO_TYPE -// New function declarator syntax - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm - -// #define GLM_CXX11_LAMBDAS -// New wording for C++0x lambdas - GCC 4.5 -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf - -// #define GLM_CXX11_DECLTYPE -// Declared type of an expression - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf - -// -// Right angle brackets - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html - -// -// Default template arguments for function templates DR226 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226 - -// -// Solving the SFINAE problem for expressions DR339 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html - -// #define GLM_CXX11_ALIAS_TEMPLATE -// Template aliases N2258 GCC 4.7 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf - -// -// Extern templates N1987 Yes -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm - -// #define GLM_CXX11_NULLPTR -// Null pointer constant N2431 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf - -// #define GLM_CXX11_STRONG_ENUMS -// Strongly-typed enums N2347 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf - -// -// Forward declarations for enums N2764 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf - -// -// Generalized attributes N2761 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf - -// -// Generalized constant expressions N2235 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf - -// -// Alignment support N2341 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf - -// #define GLM_CXX11_DELEGATING_CONSTRUCTORS -// Delegating constructors N1986 GCC 4.7 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf - -// -// Inheriting constructors N2540 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm - -// #define GLM_CXX11_EXPLICIT_CONVERSIONS -// Explicit conversion operators N2437 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf - -// -// New character types N2249 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html - -// -// Unicode string literals N2442 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm - -// -// Raw string literals N2442 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm - -// -// Universal character name literals N2170 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html - -// #define GLM_CXX11_USER_LITERALS -// User-defined literals N2765 GCC 4.7 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf - -// -// Standard Layout Types N2342 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2342.htm - -// #define GLM_CXX11_DEFAULTED_FUNCTIONS -// #define GLM_CXX11_DELETED_FUNCTIONS -// Defaulted and deleted functions N2346 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm - -// -// Extended friend declarations N1791 GCC 4.7 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf - -// -// Extending sizeof N2253 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html - -// #define GLM_CXX11_INLINE_NAMESPACES -// Inline namespaces N2535 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm - -// #define GLM_CXX11_UNRESTRICTED_UNIONS -// Unrestricted unions N2544 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf - -// #define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS -// Local and unnamed types as template arguments N2657 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm - -// #define GLM_CXX11_RANGE_FOR -// Range-based for N2930 GCC 4.6 -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html - -// #define GLM_CXX11_OVERRIDE_CONTROL -// Explicit virtual overrides N2928 N3206 N3272 GCC 4.7 -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm - -// -// Minimal support for garbage collection and reachability-based leak detection N2670 No -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm - -// #define GLM_CXX11_NOEXCEPT -// Allowing move constructors to throw [noexcept] N3050 GCC 4.6 (core language only) -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html - -// -// Defining move special member functions N3053 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html - -// -// Sequence points N2239 Yes -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html - -// -// Atomic operations N2427 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html - -// -// Strong Compare and Exchange N2748 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html - -// -// Bidirectional Fences N2752 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm - -// -// Memory model N2429 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2429.htm - -// -// Data-dependency ordering: atomics and memory model N2664 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2664.htm - -// -// Propagating exceptions N2179 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html - -// -// Abandoning a process and at_quick_exit N2440 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2440.htm - -// -// Allow atomics use in signal handlers N2547 Yes -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2547.htm - -// -// Thread-local storage N2659 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm - -// -// Dynamic initialization and destruction with concurrency N2660 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm - -// -// __func__ predefined identifier N2340 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm - -// -// C99 preprocessor N1653 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm - -// -// long long N1811 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf - -// -// Extended integral types N1988 Yes -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1988.pdf - -#if(GLM_COMPILER & GLM_COMPILER_GCC) - -# if(GLM_COMPILER >= GLM_COMPILER_GCC43) -# define GLM_CXX11_STATIC_ASSERT -# endif - -#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) -# if(__has_feature(cxx_exceptions)) -# define GLM_CXX98_EXCEPTIONS -# endif - -# if(__has_feature(cxx_rtti)) -# define GLM_CXX98_RTTI -# endif - -# if(__has_feature(cxx_access_control_sfinae)) -# define GLM_CXX11_ACCESS_CONTROL_SFINAE -# endif - -# if(__has_feature(cxx_alias_templates)) -# define GLM_CXX11_ALIAS_TEMPLATE -# endif - -# if(__has_feature(cxx_alignas)) -# define GLM_CXX11_ALIGNAS -# endif - -# if(__has_feature(cxx_attributes)) -# define GLM_CXX11_ATTRIBUTES -# endif - -# if(__has_feature(cxx_constexpr)) -# define GLM_CXX11_CONSTEXPR -# endif - -# if(__has_feature(cxx_decltype)) -# define GLM_CXX11_DECLTYPE -# endif - -# if(__has_feature(cxx_default_function_template_args)) -# define GLM_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS -# endif - -# if(__has_feature(cxx_defaulted_functions)) -# define GLM_CXX11_DEFAULTED_FUNCTIONS -# endif - -# if(__has_feature(cxx_delegating_constructors)) -# define GLM_CXX11_DELEGATING_CONSTRUCTORS -# endif - -# if(__has_feature(cxx_deleted_functions)) -# define GLM_CXX11_DELETED_FUNCTIONS -# endif - -# if(__has_feature(cxx_explicit_conversions)) -# define GLM_CXX11_EXPLICIT_CONVERSIONS -# endif - -# if(__has_feature(cxx_generalized_initializers)) -# define GLM_CXX11_GENERALIZED_INITIALIZERS -# endif - -# if(__has_feature(cxx_implicit_moves)) -# define GLM_CXX11_IMPLICIT_MOVES -# endif - -# if(__has_feature(cxx_inheriting_constructors)) -# define GLM_CXX11_INHERITING_CONSTRUCTORS -# endif - -# if(__has_feature(cxx_inline_namespaces)) -# define GLM_CXX11_INLINE_NAMESPACES -# endif - -# if(__has_feature(cxx_lambdas)) -# define GLM_CXX11_LAMBDAS -# endif - -# if(__has_feature(cxx_local_type_template_args)) -# define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS -# endif - -# if(__has_feature(cxx_noexcept)) -# define GLM_CXX11_NOEXCEPT -# endif - -# if(__has_feature(cxx_nonstatic_member_init)) -# define GLM_CXX11_NONSTATIC_MEMBER_INIT -# endif - -# if(__has_feature(cxx_nullptr)) -# define GLM_CXX11_NULLPTR -# endif - -# if(__has_feature(cxx_override_control)) -# define GLM_CXX11_OVERRIDE_CONTROL -# endif - -# if(__has_feature(cxx_reference_qualified_functions)) -# define GLM_CXX11_REFERENCE_QUALIFIED_FUNCTIONS -# endif - -# if(__has_feature(cxx_range_for)) -# define GLM_CXX11_RANGE_FOR -# endif - -# if(__has_feature(cxx_raw_string_literals)) -# define GLM_CXX11_RAW_STRING_LITERALS -# endif - -# if(__has_feature(cxx_rvalue_references)) -# define GLM_CXX11_RVALUE_REFERENCES -# endif - -# if(__has_feature(cxx_static_assert)) -# define GLM_CXX11_STATIC_ASSERT -# endif - -# if(__has_feature(cxx_auto_type)) -# define GLM_CXX11_AUTO_TYPE -# endif - -# if(__has_feature(cxx_strong_enums)) -# define GLM_CXX11_STRONG_ENUMS -# endif - -# if(__has_feature(cxx_trailing_return)) -# define GLM_CXX11_TRAILING_RETURN -# endif - -# if(__has_feature(cxx_unicode_literals)) -# define GLM_CXX11_UNICODE_LITERALS -# endif - -# if(__has_feature(cxx_unrestricted_unions)) -# define GLM_CXX11_UNRESTRICTED_UNIONS -# endif - -# if(__has_feature(cxx_user_literals)) -# define GLM_CXX11_USER_LITERALS -# endif - -# if(__has_feature(cxx_variadic_templates)) -# define GLM_CXX11_VARIADIC_TEMPLATES -# endif - -#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) diff --git a/extensions/common/glm/detail/_fixes.hpp b/extensions/common/glm/detail/_fixes.hpp deleted file mode 100644 index ba7a34f0ec4..00000000000 --- a/extensions/common/glm/detail/_fixes.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_fixes.hpp -/// @date 2011-02-21 / 2011-11-22 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include - -//! Workaround for compatibility with other libraries -#ifdef max -#undef max -#endif - -//! Workaround for compatibility with other libraries -#ifdef min -#undef min -#endif - -//! Workaround for Android -#ifdef isnan -#undef isnan -#endif - -//! Workaround for Android -#ifdef isinf -#undef isinf -#endif - -//! Workaround for Chrone Native Client -#ifdef log2 -#undef log2 -#endif - diff --git a/extensions/common/glm/detail/_noise.hpp b/extensions/common/glm/detail/_noise.hpp deleted file mode 100644 index a51ac5ca33f..00000000000 --- a/extensions/common/glm/detail/_noise.hpp +++ /dev/null @@ -1,136 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_noise.hpp -/// @date 2013-12-24 / 2013-12-24 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "../vec2.hpp" -#include "../vec3.hpp" -#include "../vec4.hpp" -#include "../common.hpp" - -namespace glm{ -namespace detail -{ - template - GLM_FUNC_QUALIFIER T mod289(T const & x) - { - return x - floor(x * static_cast(1.0) / static_cast(289.0)) * static_cast(289.0); - } - - template - GLM_FUNC_QUALIFIER T permute(T const & x) - { - return mod289(((x * static_cast(34)) + static_cast(1)) * x); - } - - template - GLM_FUNC_QUALIFIER tvec2 permute(tvec2 const & x) - { - return mod289(((x * static_cast(34)) + static_cast(1)) * x); - } - - template - GLM_FUNC_QUALIFIER tvec3 permute(tvec3 const & x) - { - return mod289(((x * static_cast(34)) + static_cast(1)) * x); - } - - template - GLM_FUNC_QUALIFIER tvec4 permute(tvec4 const & x) - { - return mod289(((x * static_cast(34)) + static_cast(1)) * x); - } -/* - template class vecType> - GLM_FUNC_QUALIFIER vecType permute(vecType const & x) - { - return mod289(((x * T(34)) + T(1)) * x); - } -*/ - template - GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } - - template - GLM_FUNC_QUALIFIER tvec2 taylorInvSqrt(tvec2 const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } - - template - GLM_FUNC_QUALIFIER tvec3 taylorInvSqrt(tvec3 const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } - - template - GLM_FUNC_QUALIFIER tvec4 taylorInvSqrt(tvec4 const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } -/* - template class vecType> - GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } -*/ - - template - GLM_FUNC_QUALIFIER tvec2 fade(tvec2 const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } - - template - GLM_FUNC_QUALIFIER tvec3 fade(tvec3 const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } - - template - GLM_FUNC_QUALIFIER tvec4 fade(tvec4 const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } -/* - template class vecType> - GLM_FUNC_QUALIFIER vecType fade(vecType const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } -*/ -}//namespace detail -}//namespace glm - diff --git a/extensions/common/glm/detail/_swizzle.hpp b/extensions/common/glm/detail/_swizzle.hpp deleted file mode 100644 index 43ca2c61549..00000000000 --- a/extensions/common/glm/detail/_swizzle.hpp +++ /dev/null @@ -1,833 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_swizzle.hpp -/// @date 2006-04-20 / 2011-02-16 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -namespace glm{ -namespace detail -{ - // Internal class for implementing swizzle operators - template - struct _swizzle_base0 - { - typedef T value_type; - - protected: - GLM_FUNC_QUALIFIER value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } - GLM_FUNC_QUALIFIER const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } - - // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. - // The size 1 buffer is assumed to aligned to the actual members so that the - // elem() - char _buffer[1]; - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1)); } - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } - }; - - // Internal class for implementing swizzle operators - /* - Template parameters: - - ValueType = type of scalar values (e.g. float, double) - VecType = class the swizzle is applies to (e.g. tvec3) - N = number of components in the vector (e.g. 3) - E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec - - DUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles - containing duplicate elements so that they cannot be used as r-values). - */ - template - struct _swizzle_base2 : public _swizzle_base1 - { - typedef VecType vec_type; - typedef ValueType value_type; - - GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const ValueType& t) - { - for (int i = 0; i < N; ++i) - (*this)[i] = t; - return *this; - } - - GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e = t; } - }; - _apply_op(that, op()); - return *this; - } - - GLM_FUNC_QUALIFIER void operator -= (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e -= t; } - }; - _apply_op(that, op()); - } - - GLM_FUNC_QUALIFIER void operator += (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e += t; } - }; - _apply_op(that, op()); - } - - GLM_FUNC_QUALIFIER void operator *= (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e *= t; } - }; - _apply_op(that, op()); - } - - GLM_FUNC_QUALIFIER void operator /= (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e /= t; } - }; - _apply_op(that, op()); - } - - GLM_FUNC_QUALIFIER value_type& operator[] (size_t i) - { - const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const - { - const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - - protected: - template - GLM_FUNC_QUALIFIER void _apply_op(const VecType& that, T op) - { - // Make a copy of the data in this == &that. - // The copier should optimize out the copy in cases where the function is - // properly inlined and the copy is not necessary. - ValueType t[N]; - for (int i = 0; i < N; ++i) - t[i] = that[i]; - for (int i = 0; i < N; ++i) - op( (*this)[i], t[i] ); - } - }; - - // Specialization for swizzles containing duplicate elements. These cannot be modified. - template - struct _swizzle_base2 : public _swizzle_base1 - { - typedef VecType vec_type; - typedef ValueType value_type; - - struct Stub {}; - GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const &) { return *this; } - - GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const - { - const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - }; - - template - struct _swizzle : public _swizzle_base2 - { - typedef _swizzle_base2 base_type; - - using base_type::operator=; - - GLM_FUNC_QUALIFIER operator VecType () const { return (*this)(); } - }; - -// -// To prevent the C++ syntax from getting entirely overwhelming, define some alias macros -// -#define _GLM_SWIZZLE_TEMPLATE1 template -#define _GLM_SWIZZLE_TEMPLATE2 template -#define _GLM_SWIZZLE_TYPE1 _swizzle -#define _GLM_SWIZZLE_TYPE2 _swizzle - -// -// Wrapper for a binary operator (e.g. u.yy + v.zy) -// -#define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ - _GLM_SWIZZLE_TEMPLATE2 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ - { \ - return a() OPERAND b(); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ - { \ - return a() OPERAND b; \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return a OPERAND b(); \ - } - -// -// Wrapper for a operand between a swizzle and a binary (e.g. 1.0f - u.xyz) -// -#define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ - { \ - return a() OPERAND b; \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return a OPERAND b(); \ - } - -// -// Macro for wrapping a function taking one argument (e.g. abs()) -// -#define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ - { \ - return FUNCTION(a()); \ - } - -// -// Macro for wrapping a function taking two vector arguments (e.g. dot()). -// -#define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \ - _GLM_SWIZZLE_TEMPLATE2 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ - { \ - return FUNCTION(a(), b()); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return FUNCTION(a(), b()); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ - { \ - return FUNCTION(a(), b); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return FUNCTION(a, b()); \ - } - -// -// Macro for wrapping a function take 2 vec arguments followed by a scalar (e.g. mix()). -// -#define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \ - _GLM_SWIZZLE_TEMPLATE2 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ - { \ - return FUNCTION(a(), b(), c); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ - { \ - return FUNCTION(a(), b(), c); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ - { \ - return FUNCTION(a(), b, c); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ - { \ - return FUNCTION(a, b(), c); \ - } - -}//namespace detail -}//namespace glm - -namespace glm -{ - namespace detail - { - _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-) - _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/) - } - - // - // Swizzles are distinct types from the unswizzled type. The below macros will - // provide template specializations for the swizzle types for the given functions - // so that the compiler does not have any ambiguity to choosing how to handle - // the function. - // - // The alternative is to use the operator()() when calling the function in order - // to explicitly convert the swizzled type to the unswizzled type. - // - - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any); - - //_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot); - //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross); - //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step); - //_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix); -} - -#define _GLM_SWIZZLE2_2_MEMBERS(T, P, V, E0,E1) \ - struct { detail::_swizzle<2, T, P, V, 0,0,-1,-2> E0 ## E0; }; \ - struct { detail::_swizzle<2, T, P, V, 0,1,-1,-2> E0 ## E1; }; \ - struct { detail::_swizzle<2, T, P, V, 1,0,-1,-2> E1 ## E0; }; \ - struct { detail::_swizzle<2, T, P, V, 1,1,-1,-2> E1 ## E1; }; - -#define _GLM_SWIZZLE2_3_MEMBERS(T, P, V, E0,E1) \ - struct { detail::_swizzle<3,T, P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T, P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T, P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T, P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T, P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T, P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T, P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T, P, V, 1,1,1,-1> E1 ## E1 ## E1; }; - -#define _GLM_SWIZZLE2_4_MEMBERS(T, P, V, E0,E1) \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; - -#define _GLM_SWIZZLE3_2_MEMBERS(T, P, V, E0,E1,E2) \ - struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; - -#define _GLM_SWIZZLE3_3_MEMBERS(T, P, V ,E0,E1,E2) \ - struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; - -#define _GLM_SWIZZLE3_4_MEMBERS(T, P, V, E0,E1,E2) \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; - -#define _GLM_SWIZZLE4_2_MEMBERS(T, P, V, E0,E1,E2,E3) \ - struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 0,3,-1,-2> E0 ## E3; }; \ - struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 1,3,-1,-2> E1 ## E3; }; \ - struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 2,3,-1,-2> E2 ## E3; }; \ - struct { detail::_swizzle<2,T, P, V, 3,0,-1,-2> E3 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 3,1,-1,-2> E3 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 3,2,-1,-2> E3 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 3,3,-1,-2> E3 ## E3; }; - -#define _GLM_SWIZZLE4_3_MEMBERS(T,P, V, E0,E1,E2,E3) \ - struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,3,-1> E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,3,-1> E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,3,-1> E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 0,3,0,-1> E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,3,1,-1> E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,3,2,-1> E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,3,3,-1> E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,3,-1> E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,3,-1> E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,3,-1> E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 1,3,0,-1> E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,3,1,-1> E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,3,2,-1> E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,3,3,-1> E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,3,-1> E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,3,-1> E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,3,-1> E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 2,3,0,-1> E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,3,1,-1> E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,3,2,-1> E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,3,3,-1> E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 3,0,0,-1> E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 3,0,1,-1> E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 3,0,2,-1> E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 3,0,3,-1> E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 3,1,0,-1> E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 3,1,1,-1> E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 3,1,2,-1> E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 3,1,3,-1> E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 3,2,0,-1> E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 3,2,1,-1> E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 3,2,2,-1> E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 3,2,3,-1> E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 3,3,0,-1> E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 3,3,1,-1> E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 3,3,2,-1> E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 3,3,3,-1> E3 ## E3 ## E3; }; - -#define _GLM_SWIZZLE4_4_MEMBERS(T, P, V, E0,E1,E2,E3) \ - struct { detail::_swizzle<4, T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,0,3> E0 ## E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,1,3> E0 ## E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,2,3> E0 ## E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,3,0> E0 ## E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,3,1> E0 ## E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,3,2> E0 ## E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,3,3> E0 ## E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,0,3> E0 ## E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,1,3> E0 ## E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,2,3> E0 ## E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,3,0> E0 ## E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,3,1> E0 ## E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,3,2> E0 ## E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,3,3> E0 ## E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,0,3> E0 ## E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,1,3> E0 ## E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,2,3> E0 ## E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,3,0> E0 ## E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,0,3> E1 ## E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,1,3> E1 ## E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,2,3> E1 ## E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,3,0> E1 ## E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,3,1> E1 ## E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,3,2> E1 ## E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,3,3> E1 ## E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,0,3> E1 ## E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,1,3> E1 ## E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,2,3> E1 ## E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,3,0> E1 ## E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,3,1> E1 ## E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,3,2> E1 ## E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,3,3> E1 ## E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,0,3> E1 ## E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,1,3> E1 ## E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,2,3> E1 ## E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,3,0> E1 ## E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,3,1> E1 ## E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,3,2> E1 ## E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,3,3> E1 ## E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,0,0> E1 ## E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,0,1> E1 ## E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,0,2> E1 ## E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,0,3> E1 ## E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,1,0> E1 ## E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,1,1> E1 ## E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,1,2> E1 ## E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,1,3> E1 ## E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,2,0> E1 ## E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,2,1> E1 ## E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,2,2> E1 ## E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,2,3> E1 ## E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,3,0> E1 ## E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,3,1> E1 ## E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,3,2> E1 ## E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,3,3> E1 ## E3 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,0,3> E2 ## E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,1,3> E2 ## E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,2,3> E2 ## E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,3,0> E2 ## E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,3,1> E2 ## E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,3,2> E2 ## E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,3,3> E2 ## E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,0,3> E2 ## E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,1,3> E2 ## E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,2,3> E2 ## E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,3,0> E2 ## E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,3,1> E2 ## E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,3,2> E2 ## E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,3,3> E2 ## E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,0,3> E2 ## E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,1,3> E2 ## E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,2,3> E2 ## E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,3,0> E2 ## E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,3,1> E2 ## E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,3,2> E2 ## E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,3,3> E2 ## E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,0,0> E2 ## E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,0,1> E2 ## E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,0,2> E2 ## E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,0,3> E2 ## E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,1,0> E2 ## E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,1,1> E2 ## E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,1,2> E2 ## E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,1,3> E2 ## E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,2,0> E2 ## E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,2,1> E2 ## E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,2,2> E2 ## E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,2,3> E2 ## E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,3,0> E2 ## E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,3,1> E2 ## E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,3,2> E2 ## E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,3,3> E2 ## E3 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,0,0> E3 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,0,1> E3 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,0,2> E3 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,0,3> E3 ## E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,1,0> E3 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,1,1> E3 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,1,2> E3 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,1,3> E3 ## E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,2,0> E3 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,2,1> E3 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,2,2> E3 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,2,3> E3 ## E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,3,0> E3 ## E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,3,1> E3 ## E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,3,2> E3 ## E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,3,3> E3 ## E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,0,0> E3 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,0,1> E3 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,0,2> E3 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,0,3> E3 ## E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,1,0> E3 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,1,1> E3 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,1,2> E3 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,1,3> E3 ## E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,2,0> E3 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,2,1> E3 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,2,2> E3 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,2,3> E3 ## E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,3,0> E3 ## E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,3,1> E3 ## E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,3,2> E3 ## E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,3,3> E3 ## E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,0,0> E3 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,0,1> E3 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,0,2> E3 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,0,3> E3 ## E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,1,0> E3 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,1,1> E3 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,1,2> E3 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,1,3> E3 ## E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,2,0> E3 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,2,1> E3 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,2,2> E3 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,2,3> E3 ## E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,3,0> E3 ## E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,3,1> E3 ## E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,3,2> E3 ## E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,3,3> E3 ## E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,0,0> E3 ## E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,0,1> E3 ## E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,0,2> E3 ## E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,0,3> E3 ## E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,1,0> E3 ## E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,1,1> E3 ## E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,1,2> E3 ## E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,1,3> E3 ## E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,2,0> E3 ## E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,2,1> E3 ## E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,2,2> E3 ## E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,2,3> E3 ## E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,3,0> E3 ## E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; diff --git a/extensions/common/glm/detail/_swizzle_func.hpp b/extensions/common/glm/detail/_swizzle_func.hpp deleted file mode 100644 index 5601d910fe0..00000000000 --- a/extensions/common/glm/detail/_swizzle_func.hpp +++ /dev/null @@ -1,725 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_swizzle_func.hpp -/// @date 2011-10-16 / 2011-10-16 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ - SWIZZLED_TYPE A ## B() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B); \ - } - -#define GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ - SWIZZLED_TYPE A ## B ## C() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C); \ - } - -#define GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ - SWIZZLED_TYPE A ## B ## C ## D() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ - } - -#define GLM_SWIZZLE_GEN_VEC2_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ - template \ - SWIZZLED_TYPE CLASS_TYPE::A ## B() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B); \ - } - -#define GLM_SWIZZLE_GEN_VEC3_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ - template \ - SWIZZLED_TYPE CLASS_TYPE::A ## B ## C() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C); \ - } - -#define GLM_SWIZZLE_GEN_VEC4_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ - template \ - SWIZZLED_TYPE CLASS_TYPE::A ## B ## C ## D() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ - } - -#define GLM_MUTABLE - -#define GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC2(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, x, y) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, r, g) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, s, t) - -//GLM_SWIZZLE_GEN_REF_FROM_VEC2(valType, detail::vec2, detail::ref2) - -#define GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) - -#define GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B, A) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, x, y, z) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, r, g, b) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, s, t, p) - -//GLM_SWIZZLE_GEN_REF_FROM_VEC3(valType, detail::vec3, detail::ref2, detail::ref3) - -#define GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, C) - -#define GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B) - -#define GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C, A) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) - -//GLM_SWIZZLE_GEN_REF_FROM_VEC4(valType, detail::vec4, detail::ref2, detail::ref3, detail::ref4) - -#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) - -#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) - -#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t) - -//GLM_SWIZZLE_GEN_VEC_FROM_VEC2(valType, detail::vec2, detail::vec2, detail::vec3, detail::vec4) - -#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) - -#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) - -#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p) - -//GLM_SWIZZLE_GEN_VEC_FROM_VEC3(valType, detail::vec3, detail::vec2, detail::vec3, detail::vec4) - -#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D) - -#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D) - -#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, D) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) - -//GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4) diff --git a/extensions/common/glm/detail/_vectorize.hpp b/extensions/common/glm/detail/_vectorize.hpp deleted file mode 100644 index 3a8a4666891..00000000000 --- a/extensions/common/glm/detail/_vectorize.hpp +++ /dev/null @@ -1,160 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_vectorize.hpp -/// @date 2011-10-14 / 2011-10-14 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "type_vec1.hpp" -#include "type_vec2.hpp" -#include "type_vec3.hpp" -#include "type_vec4.hpp" - -namespace glm{ -namespace detail -{ - template class vecType> - struct functor1{}; - - template - struct functor1 - { - GLM_FUNC_QUALIFIER static tvec1 call(R (*Func) (T x), tvec1 const & v) - { - return tvec1(Func(v.x)); - } - }; - - template - struct functor1 - { - GLM_FUNC_QUALIFIER static tvec2 call(R (*Func) (T x), tvec2 const & v) - { - return tvec2(Func(v.x), Func(v.y)); - } - }; - - template - struct functor1 - { - GLM_FUNC_QUALIFIER static tvec3 call(R (*Func) (T x), tvec3 const & v) - { - return tvec3(Func(v.x), Func(v.y), Func(v.z)); - } - }; - - template - struct functor1 - { - GLM_FUNC_QUALIFIER static tvec4 call(R (*Func) (T x), tvec4 const & v) - { - return tvec4(Func(v.x), Func(v.y), Func(v.z), Func(v.w)); - } - }; - - template class vecType> - struct functor2{}; - - template - struct functor2 - { - GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, tvec1 const & b) - { - return tvec1(Func(a.x, b.x)); - } - }; - - template - struct functor2 - { - GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, tvec2 const & b) - { - return tvec2(Func(a.x, b.x), Func(a.y, b.y)); - } - }; - - template - struct functor2 - { - GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, tvec3 const & b) - { - return tvec3(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z)); - } - }; - - template - struct functor2 - { - GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, tvec4 const & b) - { - return tvec4(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w)); - } - }; - - template class vecType> - struct functor2_vec_sca{}; - - template - struct functor2_vec_sca - { - GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, T b) - { - return tvec1(Func(a.x, b)); - } - }; - - template - struct functor2_vec_sca - { - GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, T b) - { - return tvec2(Func(a.x, b), Func(a.y, b)); - } - }; - - template - struct functor2_vec_sca - { - GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, T b) - { - return tvec3(Func(a.x, b), Func(a.y, b), Func(a.z, b)); - } - }; - - template - struct functor2_vec_sca - { - GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, T b) - { - return tvec4(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b)); - } - }; -}//namespace detail -}//namespace glm diff --git a/extensions/common/glm/detail/dummy.cpp b/extensions/common/glm/detail/dummy.cpp deleted file mode 100644 index a64ce33075b..00000000000 --- a/extensions/common/glm/detail/dummy.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/dummy.cpp -/// @date 2011-01-19 / 2011-06-15 -/// @author Christophe Riccio -/// -/// GLM is a header only library. There is nothing to compile. -/// dummy.cpp exist only a wordaround for CMake file. -/////////////////////////////////////////////////////////////////////////////////// - -#define GLM_MESSAGES -#include -#include -#include - -struct material -{ - glm::vec4 emission; // Ecm - glm::vec4 ambient; // Acm - glm::vec4 diffuse; // Dcm - glm::vec4 specular; // Scm - float shininess; // Srm -}; - -struct light -{ - glm::vec4 ambient; // Acli - glm::vec4 diffuse; // Dcli - glm::vec4 specular; // Scli - glm::vec4 position; // Ppli - glm::vec4 halfVector; // Derived: Hi - glm::vec3 spotDirection; // Sdli - float spotExponent; // Srli - float spotCutoff; // Crli - // (range: [0.0,90.0], 180.0) - float spotCosCutoff; // Derived: cos(Crli) - // (range: [1.0,0.0],-1.0) - float constantAttenuation; // K0 - float linearAttenuation; // K1 - float quadraticAttenuation;// K2 -}; - - -// Sample 1 -#include // glm::vec3 -#include // glm::cross, glm::normalize - -glm::vec3 computeNormal -( - glm::vec3 const & a, - glm::vec3 const & b, - glm::vec3 const & c -) -{ - return glm::normalize(glm::cross(c - a, b - a)); -} - -typedef unsigned int GLuint; -#define GL_FALSE 0 -void glUniformMatrix4fv(GLuint, int, int, float*){} - -// Sample 2 -#include // glm::vec3 -#include // glm::vec4, glm::ivec4 -#include // glm::mat4 -#include // glm::translate, glm::rotate, glm::scale, glm::perspective -#include // glm::value_ptr -void func(GLuint LocationMVP, float Translate, glm::vec2 const & Rotate) -{ - glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f); - glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate)); - glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f)); - glm::mat4 View = glm::rotate(ViewRotateX, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f)); - glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f)); - glm::mat4 MVP = Projection * View * Model; - glUniformMatrix4fv(LocationMVP, 1, GL_FALSE, glm::value_ptr(MVP)); -} - -// Sample 3 -#include // glm::vec2 -#include // glm::packUnorm2x16 -#include // glm::uint -#include // glm::i8vec2, glm::i32vec2 -std::size_t const VertexCount = 4; -// Float quad geometry -std::size_t const PositionSizeF32 = VertexCount * sizeof(glm::vec2); -glm::vec2 const PositionDataF32[VertexCount] = -{ - glm::vec2(-1.0f,-1.0f), - glm::vec2( 1.0f,-1.0f), - glm::vec2( 1.0f, 1.0f), - glm::vec2(-1.0f, 1.0f) - }; -// Half-float quad geometry -std::size_t const PositionSizeF16 = VertexCount * sizeof(glm::uint); -glm::uint const PositionDataF16[VertexCount] = -{ - glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, -1.0f))), - glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, -1.0f))), - glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, 1.0f))), - glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, 1.0f))) -}; -// 8 bits signed integer quad geometry -std::size_t const PositionSizeI8 = VertexCount * sizeof(glm::i8vec2); -glm::i8vec2 const PositionDataI8[VertexCount] = -{ - glm::i8vec2(-1,-1), - glm::i8vec2( 1,-1), - glm::i8vec2( 1, 1), - glm::i8vec2(-1, 1) -}; -// 32 bits signed integer quad geometry -std::size_t const PositionSizeI32 = VertexCount * sizeof(glm::i32vec2); -glm::i32vec2 const PositionDataI32[VertexCount] = -{ - glm::i32vec2 (-1,-1), - glm::i32vec2 ( 1,-1), - glm::i32vec2 ( 1, 1), - glm::i32vec2 (-1, 1) -}; - -struct intersection -{ - glm::vec4 position; - glm::vec3 normal; -}; - -/* -// Sample 4 -#include // glm::vec3 -#include // glm::normalize, glm::dot, glm::reflect -#include // glm::pow -#include // glm::vecRand3 -glm::vec3 lighting -( - intersection const & Intersection, - material const & Material, - light const & Light, - glm::vec3 const & View -) -{ - glm::vec3 Color(0.0f); - glm::vec3 LightVertor(glm::normalize( - Light.position - Intersection.position + - glm::vecRand3(0.0f, Light.inaccuracy)); - - if(!shadow(Intersection.position, Light.position, LightVertor)) - { - float Diffuse = glm::dot(Intersection.normal, LightVector); - if(Diffuse <= 0.0f) - return Color; - if(Material.isDiffuse()) - Color += Light.color() * Material.diffuse * Diffuse; - if(Material.isSpecular()) - { - glm::vec3 Reflect(glm::reflect( - glm::normalize(-LightVector), - glm::normalize(Intersection.normal))); - float Dot = glm::dot(Reflect, View); - float Base = Dot > 0.0f ? Dot : 0.0f; - float Specular = glm::pow(Base, Material.exponent); - Color += Material.specular * Specular; - } - } - return Color; -} -*/ - - -template class vecType> -T normalizeDotA(vecType const & x, vecType const & y) -{ - return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); -} - -#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template class - -template -T normalizeDotB(vecType const & x, vecType const & y) -{ - return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); -} - -template -typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b) -{ - return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b)); -} - -int main() -{ - glm::vec1 o(1); - glm::vec2 a(1); - glm::vec3 b(1); - glm::vec4 c(1); - - glm::quat q; - glm::dualquat p; - - glm::mat4 m(1); - - float a0 = normalizeDotA(a, a); - float b0 = normalizeDotB(b, b); - float c0 = normalizeDotC(c, c); - - return 0; -} diff --git a/extensions/common/glm/detail/func_common.hpp b/extensions/common/glm/detail/func_common.hpp deleted file mode 100644 index a9d01bd0428..00000000000 --- a/extensions/common/glm/detail/func_common.hpp +++ /dev/null @@ -1,456 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/func_common.hpp -/// @date 2008-03-08 / 2010-01-26 -/// @author Christophe Riccio -/// -/// @see GLSL 4.20.8 specification, section 8.3 Common Functions -/// -/// @defgroup core_func_common Common functions -/// @ingroup core -/// -/// These all operate component-wise. The description is per component. -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "setup.hpp" -#include "precision.hpp" -#include "type_int.hpp" -#include "_fixes.hpp" - -namespace glm -{ - /// @addtogroup core_func_common - /// @{ - - /// Returns x if x >= 0; otherwise, it returns -x. - /// - /// @tparam genType floating-point or signed integer; scalar or vector types. - /// - /// @see GLSL abs man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType abs(genType x); - - template class vecType> - GLM_FUNC_DECL vecType abs(vecType const & x); - - /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. - /// - /// @tparam genType Floating-point or signed integer; scalar or vector types. - /// - /// @see GLSL sign man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType sign(vecType const & x); - - /// Returns a value equal to the nearest integer that is less then or equal to x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL floor man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType floor(vecType const & x); - - /// Returns a value equal to the nearest integer to x - /// whose absolute value is not larger than the absolute value of x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL trunc man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType trunc(vecType const & x); - - /// Returns a value equal to the nearest integer to x. - /// The fraction 0.5 will round in a direction chosen by the - /// implementation, presumably the direction that is fastest. - /// This includes the possibility that round(x) returns the - /// same value as roundEven(x) for all values of x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL round man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType round(vecType const & x); - - /// Returns a value equal to the nearest integer to x. - /// A fractional part of 0.5 will round toward the nearest even - /// integer. (Both 3.5 and 4.5 for x will return 4.0.) - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL roundEven man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - /// @see New round to even technique - template class vecType> - GLM_FUNC_DECL vecType roundEven(vecType const & x); - - /// Returns a value equal to the nearest integer - /// that is greater than or equal to x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL ceil man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType ceil(vecType const & x); - - /// Return x - floor(x). - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL fract man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType fract(genType x); - - template class vecType> - GLM_FUNC_DECL vecType fract(vecType const & x); - - /// Modulus. Returns x - y * floor(x / y) - /// for each component in x using the floating point value y. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL mod man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType mod(genType x, genType y); - - template class vecType> - GLM_FUNC_DECL vecType mod(vecType const & x, T y); - - template class vecType> - GLM_FUNC_DECL vecType mod(vecType const & x, vecType const & y); - - /// Returns the fractional part of x and sets i to the integer - /// part (as a whole number floating point value). Both the - /// return value and the output parameter will have the same - /// sign as x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL modf man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType modf(genType x, genType & i); - - /// Returns y if y < x; otherwise, it returns x. - /// - /// @tparam genType Floating-point or integer; scalar or vector types. - /// - /// @see GLSL min man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType min(genType x, genType y); - - template class vecType> - GLM_FUNC_DECL vecType min(vecType const & x, T y); - - template class vecType> - GLM_FUNC_DECL vecType min(vecType const & x, vecType const & y); - - /// Returns y if x < y; otherwise, it returns x. - /// - /// @tparam genType Floating-point or integer; scalar or vector types. - /// - /// @see GLSL max man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType max(genType x, genType y); - - template class vecType> - GLM_FUNC_DECL vecType max(vecType const & x, T y); - - template class vecType> - GLM_FUNC_DECL vecType max(vecType const & x, vecType const & y); - - /// Returns min(max(x, minVal), maxVal) for each component in x - /// using the floating-point values minVal and maxVal. - /// - /// @tparam genType Floating-point or integer; scalar or vector types. - /// - /// @see GLSL clamp man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal); - - template class vecType> - GLM_FUNC_DECL vecType clamp(vecType const & x, T minVal, T maxVal); - - template class vecType> - GLM_FUNC_DECL vecType clamp(vecType const & x, vecType const & minVal, vecType const & maxVal); - - /// If genTypeU is a floating scalar or vector: - /// Returns x * (1.0 - a) + y * a, i.e., the linear blend of - /// x and y using the floating-point value a. - /// The value for a is not restricted to the range [0, 1]. - /// - /// If genTypeU is a boolean scalar or vector: - /// Selects which vector each returned component comes - /// from. For a component of that is false, the - /// corresponding component of x is returned. For a - /// component of a that is true, the corresponding - /// component of y is returned. Components of x and y that - /// are not selected are allowed to be invalid floating point - /// values and will have no effect on the results. Thus, this - /// provides different functionality than - /// genType mix(genType x, genType y, genType(a)) - /// where a is a Boolean vector. - /// - /// @see GLSL mix man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - /// - /// @param[in] x Value to interpolate. - /// @param[in] y Value to interpolate. - /// @param[in] a Interpolant. - /// - /// @tparam genTypeT Floating point scalar or vector. - /// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT. - /// - /// @code - /// #include - /// ... - /// float a; - /// bool b; - /// glm::dvec3 e; - /// glm::dvec3 f; - /// glm::vec4 g; - /// glm::vec4 h; - /// ... - /// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors. - /// glm::vec4 s = glm::mix(g, h, b); // Teturns g or h; - /// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second. - /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter. - /// @endcode - template class vecType> - GLM_FUNC_DECL vecType mix(vecType const & x, vecType const & y, vecType const & a); - - template class vecType> - GLM_FUNC_DECL vecType mix(vecType const & x, vecType const & y, U a); - - template - GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a); - - /// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType. - /// - /// @see GLSL step man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType step(genType edge, genType x); - - /// Returns 0.0 if x < edge, otherwise it returns 1.0. - /// - /// @see GLSL step man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template