Fix Cloth with models that use compressed vertex buffer

#4017
This commit is contained in:
Wojtek Figat
2026-03-24 22:59:21 +01:00
parent a63e05d444
commit 29abfbcdc9
9 changed files with 186 additions and 116 deletions

View File

@@ -39,51 +39,61 @@ public:
FORCE_INLINE int32 GetInt(int32 index) const
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
return (int32)_sampler.Read(_data.Get() + index * _stride).X;
}
FORCE_INLINE float GetFloat(int32 index) const
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
return _sampler.Read(_data.Get() + index * _stride).X;
}
FORCE_INLINE Float2 GetFloat2(int32 index) const
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
return Float2(_sampler.Read(_data.Get() + index * _stride));
}
FORCE_INLINE Float3 GetFloat3(int32 index) const
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
return Float3(_sampler.Read(_data.Get() + index * _stride));
}
FORCE_INLINE Float4 GetFloat4(int32 index) const
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
return _sampler.Read(_data.Get() + index * _stride);
}
FORCE_INLINE void SetInt(int32 index, const int32 value)
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
_sampler.Write(_data.Get() + index * _stride, Float4((float)value));
}
FORCE_INLINE void SetFloat(int32 index, const float value)
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
_sampler.Write(_data.Get() + index * _stride, Float4(value));
}
FORCE_INLINE void SetFloat2(int32 index, const Float2& value)
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
_sampler.Write(_data.Get() + index * _stride, Float4(value));
}
FORCE_INLINE void SetFloat3(int32 index, const Float3& value)
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
_sampler.Write(_data.Get() + index * _stride, Float4(value));
}
FORCE_INLINE void SetFloat4(int32 index, const Float4& value)
{
ASSERT_LOW_LAYER(index * _stride < _data.Length());
_sampler.Write(_data.Get() + index * _stride, value);
}
@@ -94,11 +104,22 @@ public:
void Set(Span<Float2> src);
void Set(Span<Float3> src);
void Set(Span<Color> src);
template<typename T>
void Set(const Array<T>& dst) const
{
Set(Span<T>(dst.Get(), dst.Count()));
}
// Copies the contents of this stream into a destination data span.
void CopyTo(Span<Float2> dst) const;
void CopyTo(Span<Float3> dst) const;
void CopyTo(Span<Color> dst) const;
template<typename T>
void CopyTo(Array<T>& dst) const
{
dst.Resize(GetCount());
CopyTo(Span<T>(dst.Get(), dst.Count()));
}
};
private: