Merge remote-tracking branch 'origin/master' into 1.5

This commit is contained in:
Wojciech Figat
2022-12-01 12:10:41 +01:00
5 changed files with 60 additions and 27 deletions

View File

@@ -621,7 +621,11 @@ DragDropEffect WindowsWindow::DoDragDrop(const StringView& data)
// Fix hanging mouse state (Windows doesn't send WM_LBUTTONUP when we end the drag and drop)
if (Input::GetMouseButton(MouseButton::Left))
Input::Mouse->OnMouseUp(Input::Mouse->GetPosition(), MouseButton::Left, this);
{
::POINT point;
::GetCursorPos(&point);
Input::Mouse->OnMouseUp(Float2((float)point.x, (float)point.y), MouseButton::Left, this);
}
return SUCCEEDED(result) ? dropEffectFromOleEnum(dwEffect) : DragDropEffect::None;
}

View File

@@ -248,18 +248,6 @@ bool ProcessMesh(ImportedModelData& result, AssimpImporterData& data, const aiMe
}
}
// Normals
if (aMesh->mNormals)
{
mesh.Normals.Set((const Float3*)aMesh->mNormals, aMesh->mNumVertices);
}
// Tangents
if (aMesh->mTangents)
{
mesh.Tangents.Set((const Float3*)aMesh->mTangents, aMesh->mNumVertices);
}
// Indices
const int32 indicesCount = aMesh->mNumFaces * 3;
mesh.Indices.Resize(indicesCount, false);
@@ -277,6 +265,27 @@ bool ProcessMesh(ImportedModelData& result, AssimpImporterData& data, const aiMe
mesh.Indices[i++] = face->mIndices[2];
}
// Normals
if (data.Options.CalculateNormals || !aMesh->mNormals)
{
// Support generation of normals when using assimp.
if (mesh.GenerateNormals(data.Options.SmoothingNormalsAngle))
{
errorMsg = TEXT("Failed to generate normals.");
return true;
}
}
else if (aMesh->mNormals)
{
mesh.Normals.Set((const Float3*)aMesh->mNormals, aMesh->mNumVertices);
}
// Tangents
if (aMesh->mTangents)
{
mesh.Tangents.Set((const Float3*)aMesh->mTangents, aMesh->mNumVertices);
}
// Lightmap UVs
if (data.Options.LightmapUVsSource == ModelLightmapUVsSource::Disable)
{