Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,19 @@ target_link_options(Edyn
)

if(MSVC)
target_compile_options(Edyn PRIVATE /W4 /bigobj)
target_compile_options(Edyn PRIVATE
/W4 /bigobj
# Suppress common MSVC warnings that don't affect functionality
/wd4244 # conversion from 'type1' to 'type2', possible loss of data
/wd4100 # unreferenced formal parameter
/wd4996 # function was declared deprecated
/wd4701 # potentially uninitialized local variable used
/wd4305 # truncation from 'type1' to 'type2'
/wd4267 # conversion from 'size_t' to 'type', possible loss of data
/wd4127 # conditional expression is constant
/wd4456 # declaration hides previous local declaration
/wd4458 # declaration hides class member
)
else()
target_compile_options(Edyn PRIVATE -Wall -Wno-reorder -Wno-long-long -Wimplicit-fallthrough)
endif()
Expand Down
24 changes: 12 additions & 12 deletions include/edyn/collision/collide.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ void collide(const sphere_shape &shA, const sphere_shape &shB,

// Plane-Plane
inline
void collide(const plane_shape &shA, const plane_shape &shB,
const collision_context &ctx, collision_result &result) {
void collide(const plane_shape &, const plane_shape &,
const collision_context &, collision_result &) {
// collision between infinite planes is undefined here.
}

Expand Down Expand Up @@ -132,15 +132,15 @@ void collide(const cylinder_shape &shA, const capsule_shape &shB,

// Mesh-Mesh
inline
void collide(const mesh_shape &shA, const mesh_shape &shB,
const collision_context &ctx, collision_result &result) {
void collide(const mesh_shape &, const mesh_shape &,
const collision_context &, collision_result &) {
// collision between triangle meshes still undefined.
}

// Plane-Mesh
inline
void collide(const plane_shape &shA, const mesh_shape &shB,
const collision_context &ctx, collision_result &result) {
void collide(const plane_shape &, const mesh_shape &,
const collision_context &, collision_result &) {
// collision between triangle meshes and planes still undefined.
}

Expand Down Expand Up @@ -189,15 +189,15 @@ void collide(const box_shape &shA, const cylinder_shape &shB,

// Paged Mesh-Paged Mesh
inline
void collide(const paged_mesh_shape &shA, const paged_mesh_shape &shB,
const collision_context &ctx, collision_result &result) {
void collide(const paged_mesh_shape &, const paged_mesh_shape &,
const collision_context &, collision_result &) {
// collision between paged triangle meshes is undefined.
}

// Plane-Paged Mesh
inline
void collide(const plane_shape &shA, const paged_mesh_shape &shB,
const collision_context &ctx, collision_result &result) {
void collide(const plane_shape &, const paged_mesh_shape &,
const collision_context &, collision_result &) {
// collision between paged triangle meshes and planes is undefined.
}

Expand All @@ -210,8 +210,8 @@ void collide(const paged_mesh_shape &shA, const plane_shape &shB,

// Mesh-Paged Mesh
inline
void collide(const mesh_shape &shA, const paged_mesh_shape &shB,
const collision_context &ctx, collision_result &result) {
void collide(const mesh_shape &, const paged_mesh_shape &,
const collision_context &, collision_result &) {
// collision between triangle meshes is undefined.
}

Expand Down
2 changes: 1 addition & 1 deletion include/edyn/collision/raycast_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class raycast_service {
raycast_service(entt::registry &registry);

void add_ray(vector3 p0, vector3 p1, unsigned id, const std::vector<entt::entity> &ignore_entities) {
m_broad_ctx.push_back(broadphase_context{id, p0, p1, ignore_entities});
m_broad_ctx.push_back(broadphase_context{id, p0, p1, ignore_entities, {}});
}

void update(bool mt);
Expand Down
6 changes: 3 additions & 3 deletions include/edyn/collision/static_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ constexpr uint32_t EDYN_NULL_NODE = UINT32_MAX;

namespace detail {
template<typename Iterator_AABB, typename Iterator_ids>
Iterator_ids aabb_set_partition(Iterator_AABB aabb_begin, Iterator_AABB aabb_end,
Iterator_ids aabb_set_partition(Iterator_AABB aabb_begin, Iterator_AABB,
Iterator_ids ids_begin, Iterator_ids ids_end,
const AABB &set_aabb) {
auto aabb_size = set_aabb.max - set_aabb.min;
Expand Down Expand Up @@ -118,8 +118,8 @@ class static_tree {
auto child1 = m_nodes.size();
auto child2 = m_nodes.size() + 1;

node.child1 = child1;
node.child2 = child2;
node.child1 = static_cast<uint32_t>(child1);
node.child2 = static_cast<uint32_t>(child2);

m_nodes.emplace_back();
m_nodes.emplace_back();
Expand Down
2 changes: 1 addition & 1 deletion include/edyn/dynamics/position_solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class position_solver {
scalar inv_mA, inv_mB;
inertia_world_inv *inv_IA, *inv_IB;
inertia_inv *inv_IA_local, *inv_IB_local;
scalar error_correction_rate {0.2};
scalar error_correction_rate {0.2f};
scalar max_error {};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct exporter_modified_components {
// Note that `i` isn't incremented in this case.
entry[i] = entry[--count];
} else {
entry[i].remaining -= elapsed_ms;
entry[i].remaining = static_cast<uint16_t>(entry[i].remaining - elapsed_ms);
++i;
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/edyn/networking/packet/registry_snapshot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace edyn::internal {
});

if (pool == pools.end()) {
pools.push_back(pool_snapshot{component_index});
pools.push_back(pool_snapshot{component_index, {}});
pool = pools.end();
std::advance(pool, -1);
pool->ptr.reset(new pool_snapshot_data_t);
Expand Down
8 changes: 4 additions & 4 deletions include/edyn/networking/packet/server_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ struct server_settings {
server_settings(settings &settings, bool allow_full_ownership)
: fixed_dt(settings.fixed_dt)
, gravity(settings.gravity)
, num_solver_velocity_iterations(settings.num_solver_velocity_iterations)
, num_solver_position_iterations(settings.num_solver_position_iterations)
, num_restitution_iterations(settings.num_restitution_iterations)
, num_individual_restitution_iterations(settings.num_individual_restitution_iterations)
, num_solver_velocity_iterations(static_cast<uint8_t>(settings.num_solver_velocity_iterations))
, num_solver_position_iterations(static_cast<uint8_t>(settings.num_solver_position_iterations))
, num_restitution_iterations(static_cast<uint8_t>(settings.num_restitution_iterations))
, num_individual_restitution_iterations(static_cast<uint8_t>(settings.num_individual_restitution_iterations))
, allow_full_ownership(allow_full_ownership)
{}
};
Expand Down
2 changes: 1 addition & 1 deletion include/edyn/networking/util/client_snapshot_exporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class client_snapshot_exporter_impl : public client_snapshot_exporter {
void export_all(packet::registry_snapshot &snap, It first, It last) const {
for (; first != last; ++first) {
auto entity = *first;
unsigned i = 0;
component_index_type i = 0;
(((m_registry->all_of<Components>(entity) ?
internal::snapshot_insert_entity<Components>(*m_registry, entity, snap, i) : void(0)), ++i), ...);
}
Expand Down
4 changes: 2 additions & 2 deletions include/edyn/networking/util/pool_snapshot_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ struct pool_snapshot_data_impl : public pool_snapshot_data {
index_type idx;

if (found_it != pool_entities.end()) {
idx = std::distance(pool_entities.begin(), found_it);
idx = static_cast<index_type>(std::distance(pool_entities.begin(), found_it));
} else {
idx = pool_entities.size();
idx = static_cast<index_type>(pool_entities.size());
pool_entities.push_back(entity);
}

Expand Down
2 changes: 1 addition & 1 deletion include/edyn/networking/util/server_snapshot_exporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class server_snapshot_exporter_impl : public server_snapshot_exporter {
auto entity = *first;

if (m_registry->all_of<Component>(entity)) {
internal::snapshot_insert_entity<Component>(*m_registry, entity, snap, index);
internal::snapshot_insert_entity<Component>(*m_registry, entity, snap, static_cast<component_index_type>(index));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions include/edyn/replication/registry_operation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct operation_create : public operation_base {
}
}

void execute(entt::registry &registry) const override {}
void execute(entt::registry &) const override {}

void remap(const entity_map &emap) override {
entity = emap.at(entity);
Expand Down Expand Up @@ -120,7 +120,7 @@ struct operation_map_entity : public operation_base {
}
}

void execute(entt::registry &registry) const override {}
void execute(entt::registry &) const override {}

void remap(const entity_map &emap) override {
entity = emap.at(entity);
Expand Down Expand Up @@ -352,7 +352,7 @@ class registry_operation final {
auto s = 0u;

for (auto &block : data_blocks) {
s += block.size();
s += static_cast<unsigned int>(block.size());
}

return s;
Expand Down
6 changes: 3 additions & 3 deletions include/edyn/replication/registry_operation_observer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ class registry_operation_observer {
template<typename... Components>
class registry_operation_observer_impl : public registry_operation_observer {
template<typename Component>
void on_construct(entt::registry &registry, entt::entity entity) {
void on_construct(entt::registry &, entt::entity entity) {
if (m_active && m_observed_entities.contains(entity)) {
m_builder->emplace<Component>(entity);
}
}

template<typename Component>
void on_update(entt::registry &registry, entt::entity entity) {
void on_update(entt::registry &, entt::entity entity) {
if (m_active && m_observed_entities.contains(entity)) {
m_builder->replace<Component>(entity);
}
}

template<typename Component>
void on_destroy(entt::registry &registry, entt::entity entity) {
void on_destroy(entt::registry &, entt::entity entity) {
if (m_active && m_observed_entities.contains(entity)) {
m_builder->remove<Component>(entity);
}
Expand Down
8 changes: 4 additions & 4 deletions include/edyn/serialization/std_s11n.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace edyn {
template<typename Archive>
void serialize(Archive &archive, std::string& str) {
using size_type = uint16_t;
size_type size = std::min(str.size(), static_cast<size_t>(std::numeric_limits<size_type>::max()));
size_type size = static_cast<size_type>(std::min(str.size(), static_cast<size_t>(std::numeric_limits<size_type>::max())));
archive(size);
str.resize(size);

Expand All @@ -31,7 +31,7 @@ void serialize(Archive &archive, std::string& str) {
template<typename Archive, typename T>
void serialize(Archive &archive, std::vector<T> &vector) {
using size_type = uint16_t;
size_type size = std::min(vector.size(), static_cast<size_t>(std::numeric_limits<size_type>::max()));
size_type size = static_cast<size_type>(std::min(vector.size(), static_cast<size_t>(std::numeric_limits<size_type>::max())));
archive(size);
vector.resize(size);

Expand All @@ -43,7 +43,7 @@ void serialize(Archive &archive, std::vector<T> &vector) {
template<typename Archive>
void serialize(Archive &archive, std::vector<bool> &vector) {
using size_type = uint16_t;
size_type size = std::min(vector.size(), static_cast<size_t>(std::numeric_limits<size_type>::max()));
size_type size = static_cast<size_type>(std::min(vector.size(), static_cast<size_t>(std::numeric_limits<size_type>::max())));
archive(size);
vector.resize(size);

Expand Down Expand Up @@ -188,7 +188,7 @@ size_t serialization_sizeof(const std::optional<T> &opt) {
template<typename Archive, typename K, typename V>
void serialize(Archive &archive, std::map<K, V> &map) {
using size_type = uint16_t;
size_type size = std::min(map.size(), static_cast<size_t>(std::numeric_limits<size_type>::max()));
size_type size = static_cast<size_type>(std::min(map.size(), static_cast<size_t>(std::numeric_limits<size_type>::max())));
archive(size);

if constexpr(Archive::is_input::value) {
Expand Down
2 changes: 1 addition & 1 deletion include/edyn/shapes/shapes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void visit_shape(entt::registry &registry, entt::entity entity, VisitorType visi
* direction.
*/
template<typename ShapeType>
constexpr vector3 shape_rolling_direction(const ShapeType &shape) {
constexpr vector3 shape_rolling_direction(const ShapeType &) {
return vector3_zero;
}

Expand Down
2 changes: 1 addition & 1 deletion include/edyn/util/collision_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void process_collision(entt::registry &registry, entt::entity manifold_entity,
contact_point_for_each(cp_view, manifold_state.contact_entity, [&](entt::entity contact_entity) {
if (points_removed.contains(contact_entity)) return;
auto [cp, cp_geom] = cp_view.template get<contact_point, contact_point_geometry>(contact_entity);
local_points[pt_idx].point = {cp.pivotA, cp.pivotB, cp.normal, cp_geom.distance};
local_points[pt_idx].point = {cp.pivotA, cp.pivotB, cp.normal, cp_geom.distance, {}, {}, {}};
local_points[pt_idx].contact_entity = contact_entity;
++pt_idx;
});
Expand Down
2 changes: 1 addition & 1 deletion src/edyn/collision/broadphase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void broadphase::collide_parallel() {
m_pair_results.resize(aabb_proc_size);

auto task = task_delegate_t(entt::connect_arg_t<&broadphase::collide_parallel_task>{}, *this);
enqueue_task_wait(*m_registry, task, aabb_proc_size);
enqueue_task_wait(*m_registry, task, static_cast<unsigned int>(aabb_proc_size));
}

void broadphase::finish_collide() {
Expand Down
10 changes: 5 additions & 5 deletions src/edyn/collision/collide/collide_box_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ void collide(const box_shape &shA, const box_shape &shB,
return;
}

box_feature featureA, featureB;
size_t feature_indexA, feature_indexB;
scalar projectionA, projectionB;
box_feature featureA {}, featureB {};
size_t feature_indexA {0}, feature_indexB {0};
scalar projectionA {0}, projectionB {0};

shA.support_feature(posA, ornA, vector3_zero, -sep_axis,
featureA, feature_indexA, projectionA,
Expand All @@ -116,8 +116,8 @@ void collide(const box_shape &shA, const box_shape &shB,
collision_result::collision_point point;
point.normal = sep_axis;
point.distance = distance;
point.featureA = {featureA, feature_indexA};
point.featureB = {featureB, feature_indexB};
point.featureA = {featureA, feature_indexA, 0};
point.featureB = {featureB, feature_indexB, 0};

if (featureA == box_feature::face && featureB == box_feature::face) {
// Face-Face.
Expand Down
4 changes: 2 additions & 2 deletions src/edyn/collision/collide/collide_box_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ static void collide_box_triangle(
collision_result::collision_point point;
point.normal = sep_axis;
point.distance = distance;
point.featureA = {box_feature, box_feature_index};
point.featureB = {tri_feature};
point.featureA = {box_feature, box_feature_index, 0};
point.featureB = {tri_feature, 0, 0};
point.featureB->index = get_triangle_mesh_feature_index(mesh, tri_idx, tri_feature, tri_feature_index);

if (box_feature == box_feature::face && tri_feature == triangle_feature::face) {
Expand Down
2 changes: 1 addition & 1 deletion src/edyn/collision/collide/collide_box_plane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void collide(const box_shape &shA, const plane_shape &shB,
collision_result::collision_point point;
point.normal = shB.normal;
point.distance = distance;
point.featureA = {featureA, feature_indexA};
point.featureA = {featureA, feature_indexA, 0};
point.normal_attachment = contact_normal_attachment::normal_on_B;

for (size_t i = 0; i < num_vertices; ++i) {
Expand Down
12 changes: 6 additions & 6 deletions src/edyn/collision/collide/collide_capsule_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void collide(const capsule_shape &shA, const box_shape &shB,
// Box edges vs capsule edge.
for (size_t i = 0; i < get_box_num_features(box_feature::edge); ++i) {
auto [vertexA0, vertexA1] = shB.get_edge(i, posB, ornB);
scalar s, t;
scalar s {0}, t {0};
vector3 closestA, closestB;
closest_point_segment_segment(vertexA0, vertexA1,
capsule_vertices[0], capsule_vertices[1],
Expand Down Expand Up @@ -100,18 +100,18 @@ void collide(const capsule_shape &shA, const box_shape &shB,
}

auto contact_origin_box = sep_axis * projection_box;
scalar feature_distanceB;
box_feature featureB;
size_t feature_indexB;
scalar feature_distanceB {0};
box_feature featureB {};
size_t feature_indexB {0};
shB.support_feature(posB, ornB, contact_origin_box, sep_axis,
featureB, feature_indexB,
feature_distanceB, support_feature_tolerance);

collision_result::collision_point point;
point.normal = sep_axis;
point.distance = distance;
point.featureA = {featureA, feature_indexA};
point.featureB = {featureB, feature_indexB};
point.featureA = {featureA, feature_indexA, 0};
point.featureB = {featureB, feature_indexB, 0};

switch (featureB) {
case box_feature::face: {
Expand Down
Loading