small improvements, fixes
This commit is contained in:
@@ -259,6 +259,7 @@ namespace wi::physics
|
||||
SoftBodySharedSettings shared_settings;
|
||||
Array<Vec3> simulation_normals;
|
||||
Array<Vec3> position_offsets;
|
||||
wi::vector<XMFLOAT4> vertex_tangents_tmp;
|
||||
|
||||
~SoftBody()
|
||||
{
|
||||
@@ -517,7 +518,7 @@ namespace wi::physics
|
||||
settings.mFriction = physicscomponent.friction;
|
||||
settings.mRestitution = physicscomponent.restitution;
|
||||
settings.mUpdatePosition = false;
|
||||
settings.mAllowSleeping = false;
|
||||
settings.mAllowSleeping = !physicscomponent.IsDisableDeactivation();
|
||||
settings.mUserData = (uint64_t)&physicsobject;
|
||||
|
||||
BodyInterface& body_interface = physics_scene.physics_system.GetBodyInterface(); // locking version because this is called from job system!
|
||||
@@ -532,6 +533,7 @@ namespace wi::physics
|
||||
|
||||
physicsobject.simulation_normals.resize(physicsobject.shared_settings.mVertices.size());
|
||||
|
||||
physicsobject.vertex_tangents_tmp.resize(mesh.vertex_tangents.size());
|
||||
physicsobject.position_offsets.resize(mesh.vertex_positions.size());
|
||||
for (size_t i = 0; i < mesh.vertex_positions.size(); ++i)
|
||||
{
|
||||
@@ -1615,26 +1617,26 @@ namespace wi::physics
|
||||
XMFLOAT3 t;
|
||||
XMStoreFloat3(&t, tangent);
|
||||
|
||||
physicscomponent.vertex_tangents_tmp[i0].x += t.x;
|
||||
physicscomponent.vertex_tangents_tmp[i0].y += t.y;
|
||||
physicscomponent.vertex_tangents_tmp[i0].z += t.z;
|
||||
physicscomponent.vertex_tangents_tmp[i0].w = sign;
|
||||
physicsobject.vertex_tangents_tmp[i0].x += t.x;
|
||||
physicsobject.vertex_tangents_tmp[i0].y += t.y;
|
||||
physicsobject.vertex_tangents_tmp[i0].z += t.z;
|
||||
physicsobject.vertex_tangents_tmp[i0].w = sign;
|
||||
|
||||
physicscomponent.vertex_tangents_tmp[i1].x += t.x;
|
||||
physicscomponent.vertex_tangents_tmp[i1].y += t.y;
|
||||
physicscomponent.vertex_tangents_tmp[i1].z += t.z;
|
||||
physicscomponent.vertex_tangents_tmp[i1].w = sign;
|
||||
physicsobject.vertex_tangents_tmp[i1].x += t.x;
|
||||
physicsobject.vertex_tangents_tmp[i1].y += t.y;
|
||||
physicsobject.vertex_tangents_tmp[i1].z += t.z;
|
||||
physicsobject.vertex_tangents_tmp[i1].w = sign;
|
||||
|
||||
physicscomponent.vertex_tangents_tmp[i2].x += t.x;
|
||||
physicscomponent.vertex_tangents_tmp[i2].y += t.y;
|
||||
physicscomponent.vertex_tangents_tmp[i2].z += t.z;
|
||||
physicscomponent.vertex_tangents_tmp[i2].w = sign;
|
||||
physicsobject.vertex_tangents_tmp[i2].x += t.x;
|
||||
physicsobject.vertex_tangents_tmp[i2].y += t.y;
|
||||
physicsobject.vertex_tangents_tmp[i2].z += t.z;
|
||||
physicsobject.vertex_tangents_tmp[i2].w = sign;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < physicscomponent.vertex_tangents_simulation.size(); ++i)
|
||||
{
|
||||
physicscomponent.vertex_tangents_simulation[i].FromFULL(physicscomponent.vertex_tangents_tmp[i]);
|
||||
physicscomponent.vertex_tangents_simulation[i].FromFULL(physicsobject.vertex_tangents_tmp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1496,8 +1496,12 @@ namespace wi::scene
|
||||
}
|
||||
|
||||
// 3.) Find duplicated vertices by POSITION and UV0 and UV1 and ATLAS and SUBSET and remove them:
|
||||
for (auto& subset : subsets)
|
||||
uint32_t first_subset = 0;
|
||||
uint32_t last_subset = 0;
|
||||
GetLODSubsetRange(0, first_subset, last_subset);
|
||||
for (uint32_t subsetIndex = first_subset; subsetIndex < last_subset; ++subsetIndex)
|
||||
{
|
||||
const MeshComponent::MeshSubset& subset = subsets[subsetIndex];
|
||||
for (uint32_t i = 0; i < subset.indexCount - 1; i++)
|
||||
{
|
||||
uint32_t ind0 = indices[subset.indexOffset + (uint32_t)i];
|
||||
@@ -1980,7 +1984,6 @@ namespace wi::scene
|
||||
{
|
||||
vertex_positions_simulation.resize(mesh.vertex_positions.size());
|
||||
vertex_normals_simulation.resize(mesh.vertex_normals.size());
|
||||
vertex_tangents_tmp.resize(mesh.vertex_tangents.size());
|
||||
vertex_tangents_simulation.resize(mesh.vertex_tangents.size());
|
||||
|
||||
XMFLOAT3 _min = XMFLOAT3(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
|
||||
|
||||
@@ -983,7 +983,6 @@ namespace wi::scene
|
||||
XMFLOAT4X4 worldMatrix = wi::math::IDENTITY_MATRIX;
|
||||
wi::vector<MeshComponent::Vertex_POS32> vertex_positions_simulation; // graphics vertices after simulation (world space)
|
||||
wi::vector<MeshComponent::Vertex_NOR> vertex_normals_simulation;
|
||||
wi::vector<XMFLOAT4>vertex_tangents_tmp;
|
||||
wi::vector<MeshComponent::Vertex_TAN> vertex_tangents_simulation;
|
||||
wi::primitive::AABB aabb;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wi::version
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 71;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 496;
|
||||
const int revision = 497;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user