Merge remote-tracking branch 'origin/master' into 1.13
# Conflicts: # Flax.flaxproj # Source/Engine/Level/Actors/StaticModel.cpp # Source/Engine/Level/Prefabs/Prefab.cpp # Source/Engine/Tools/ModelTool/ModelTool.cpp
This commit is contained in:
@@ -621,7 +621,7 @@ namespace FlaxEngine
|
||||
{
|
||||
ibData = dataPtr[IB];
|
||||
use16BitIndexBuffer = _formats[IB] == PixelFormat.R16_UInt;
|
||||
triangles = (uint)(_data[IB].Length / PixelFormatExtensions.SizeInBytes(_formats[IB]));
|
||||
triangles = (uint)(_data[IB].Length / (PixelFormatExtensions.SizeInBytes(_formats[IB]) * 3));
|
||||
}
|
||||
|
||||
if (mesh.Init(vertices, triangles, vbData, ibData, use16BitIndexBuffer, vbLayout))
|
||||
@@ -643,11 +643,16 @@ namespace FlaxEngine
|
||||
else
|
||||
{
|
||||
Float3 min = Float3.Maximum, max = Float3.Minimum;
|
||||
for (int i = 0; i < vertices; i++)
|
||||
PixelFormatSampler.Get(positionStream.Format, out var positionSampler);
|
||||
int positionStride = positionStream.Stride;
|
||||
fixed (byte* data = positionStream.Data)
|
||||
{
|
||||
Float3 pos = positionStream.GetFloat3(i);
|
||||
Float3.Min(ref min, ref pos, out min);
|
||||
Float3.Max(ref max, ref pos, out max);
|
||||
for (int i = 0; i < vertices; i++)
|
||||
{
|
||||
Float3 pos = new Float3(positionSampler.Read(data + i * positionStride));
|
||||
Float3.Min(ref min, ref pos, out min);
|
||||
Float3.Max(ref max, ref pos, out max);
|
||||
}
|
||||
}
|
||||
bounds = new BoundingBox(min, max);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,13 @@ bool ModelInstanceEntries::HasContentLoaded() const
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ModelInstanceEntries::ShouldSerialize(const void* otherObj) const
|
||||
{
|
||||
if (!otherObj)
|
||||
return true;
|
||||
return !(*this == *(const ModelInstanceEntries*)otherObj);
|
||||
}
|
||||
|
||||
void ModelInstanceEntries::Serialize(SerializeStream& stream, const void* otherObj)
|
||||
{
|
||||
SERIALIZE_GET_OTHER_OBJ(ModelInstanceEntries);
|
||||
@@ -43,12 +50,13 @@ void ModelInstanceEntries::Serialize(SerializeStream& stream, const void* otherO
|
||||
void ModelInstanceEntries::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
|
||||
{
|
||||
PROFILE_MEM(Graphics);
|
||||
const DeserializeStream& entries = stream["Entries"];
|
||||
ASSERT(entries.IsArray());
|
||||
Resize(entries.Size());
|
||||
for (rapidjson::SizeType i = 0; i < entries.Size(); i++)
|
||||
const DeserializeStream& entriesData = stream[rapidjson_flax::Value(rapidjson::StringRef("Entries", 7))];
|
||||
CHECK(entriesData.IsArray());
|
||||
Resize(entriesData.Size());
|
||||
ModelInstanceEntry* entries = Get();
|
||||
for (int32 i = 0; i < Count(); i++)
|
||||
{
|
||||
At(i).Deserialize((DeserializeStream&)entries[i], modifier);
|
||||
entries[i].Deserialize((DeserializeStream&)entriesData[i], modifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ public:
|
||||
|
||||
public:
|
||||
// [ISerializable]
|
||||
bool ShouldSerialize(const void* otherObj) const override;
|
||||
void Serialize(SerializeStream& stream, const void* otherObj) override;
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user