Add cloth painting tools to Editor

This commit is contained in:
Wojtek Figat
2023-07-13 23:30:37 +02:00
parent 3b90e75307
commit 24c03c0e4b
15 changed files with 873 additions and 43 deletions

View File

@@ -312,7 +312,7 @@ void Float3::FindBestAxisVectors(Float3& firstAxis, Float3& secondAxis) const
template<>
float Float3::TriangleArea(const Float3& v0, const Float3& v1, const Float3& v2)
{
return (v2 - v0 ^ v1 - v0).Length() * 0.5f;
return ((v2 - v0) ^ (v1 - v0)).Length() * 0.5f;
}
template<>
@@ -626,7 +626,7 @@ void Double3::FindBestAxisVectors(Double3& firstAxis, Double3& secondAxis) const
template<>
double Double3::TriangleArea(const Double3& v0, const Double3& v1, const Double3& v2)
{
return (v2 - v0 ^ v1 - v0).Length() * 0.5;
return ((v2 - v0) ^ (v1 - v0)).Length() * 0.5;
}
template<>

View File

@@ -115,6 +115,12 @@ inline Span<T> ToSpan(const T* ptr, int32 length)
return Span<T>(ptr, length);
}
template<typename T, typename U = T, typename AllocationType = HeapAllocation>
inline Span<U> ToSpan(const Array<T, AllocationType>& data)
{
return Span<U>((U*)data.Get(), data.Count());
}
template<typename T>
inline bool SpanContains(const Span<T> span, const T& value)
{