add alias for AZStd::vector<u8> before potential change

This commit is contained in:
hultonha
2021-04-12 11:03:46 +01:00
parent 038540c922
commit 5fc4aeaf09
7 changed files with 22 additions and 17 deletions
@@ -102,6 +102,9 @@ namespace WhiteBox
//! Alias for a collection of faces.
using Faces = AZStd::vector<Face>;
//! Underlying representation of the White Box mesh (serialized halfedge data).
using WhiteBoxMeshStream = AZStd::vector<AZ::u8>;
//! Represents the vertex handles to be used to form a new face.
struct FaceVertHandles
{
@@ -729,7 +732,7 @@ namespace WhiteBox
//! Take an input stream of bytes and create a white box mesh from the deserialized data.
//! @return Will return false if any error was encountered during deserialization, true otherwise.
//! @note A white box mesh must have been created first.
bool ReadMesh(WhiteBoxMesh& whiteBox, const AZStd::vector<AZ::u8>& input);
bool ReadMesh(WhiteBoxMesh& whiteBox, const WhiteBoxMeshStream& input);
//! Take an input stream and create a white box mesh from the deserialized data.
//! @return Will return false if any error was encountered during deserialization, true otherwise.
@@ -738,7 +741,7 @@ namespace WhiteBox
//! Take a white box mesh and write it out to a stream of bytes.
//! @return Will return false if any error was encountered during serialization, true otherwise.
bool WriteMesh(const WhiteBoxMesh& whiteBox, AZStd::vector<AZ::u8>& output);
bool WriteMesh(const WhiteBoxMesh& whiteBox, WhiteBoxMeshStream& output);
//! Clones the white box mesh object into a new mesh.
//! @return Will return null if any error was encountered during serialization, otherwise the cloned mesh.
@@ -51,12 +51,12 @@ namespace WhiteBox
return AZStd::move(m_mesh);
}
void SetWhiteBoxData(AZStd::vector<AZ::u8> whiteBoxData)
void SetWhiteBoxData(Api::WhiteBoxMeshStream whiteBoxData)
{
m_whiteBoxData = AZStd::move(whiteBoxData);
}
const AZStd::vector<AZ::u8>& GetWhiteBoxData() const
const Api::WhiteBoxMeshStream& GetWhiteBoxData() const
{
return m_whiteBoxData;
}
@@ -73,7 +73,7 @@ namespace WhiteBox
}
Api::WhiteBoxMeshPtr m_mesh;
AZStd::vector<AZ::u8> m_whiteBoxData; //! Data used for creating undo commands.
Api::WhiteBoxMeshStream m_whiteBoxData; //! Data used for creating undo commands.
};
} // namespace Pipeline
} // namespace WhiteBox
@@ -112,7 +112,9 @@ namespace WhiteBox
const auto size = stream->GetLength();
AZStd::vector<AZ::u8> whiteBoxData(size);
Api::WhiteBoxMeshStream whiteBoxData;
whiteBoxData.reserve(size);
stream->Read(size, whiteBoxData.data());
auto whiteBoxMesh = WhiteBox::Api::CreateWhiteBoxMesh();
@@ -29,12 +29,12 @@ namespace WhiteBox
m_asset = asset;
}
void WhiteBoxMeshAssetUndoCommand::SetUndoState(const AZStd::vector<AZ::u8>& undoState)
void WhiteBoxMeshAssetUndoCommand::SetUndoState(const Api::WhiteBoxMeshStream& undoState)
{
m_undoState = undoState;
}
void WhiteBoxMeshAssetUndoCommand::SetRedoState(const AZStd::vector<AZ::u8>& redoState)
void WhiteBoxMeshAssetUndoCommand::SetRedoState(const Api::WhiteBoxMeshStream& redoState)
{
m_redoState = redoState;
}
@@ -34,8 +34,8 @@ namespace WhiteBox
~WhiteBoxMeshAssetUndoCommand() override = default;
void SetAsset(AZ::Data::Asset<Pipeline::WhiteBoxMeshAsset> asset);
void SetUndoState(const AZStd::vector<AZ::u8>& undoState);
void SetRedoState(const AZStd::vector<AZ::u8>& redoState);
void SetUndoState(const Api::WhiteBoxMeshStream& undoState);
void SetRedoState(const Api::WhiteBoxMeshStream& redoState);
// AzToolsFramework::UndoSystem::URSequencePoint ...
void Undo() override;
@@ -44,7 +44,7 @@ namespace WhiteBox
protected:
AZ::Data::Asset<Pipeline::WhiteBoxMeshAsset> m_asset;
AZStd::vector<AZ::u8> m_undoState;
AZStd::vector<AZ::u8> m_redoState;
Api::WhiteBoxMeshStream m_undoState;
Api::WhiteBoxMeshStream m_redoState;
};
} // namespace WhiteBox
@@ -3379,7 +3379,7 @@ namespace WhiteBox
CalculatePlanarUVs(whiteBox);
}
bool WriteMesh(const WhiteBoxMesh& whiteBox, AZStd::vector<AZ::u8>& output)
bool WriteMesh(const WhiteBoxMesh& whiteBox, WhiteBoxMeshStream& output)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
@@ -3403,7 +3403,7 @@ namespace WhiteBox
return false;
}
bool ReadMesh(WhiteBoxMesh& whiteBox, const AZStd::vector<AZ::u8>& input)
bool ReadMesh(WhiteBoxMesh& whiteBox, const WhiteBoxMeshStream& input)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
@@ -3437,7 +3437,7 @@ namespace WhiteBox
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
AZStd::vector<AZ::u8> clonedData;
WhiteBoxMeshStream clonedData;
if (!WriteMesh(whiteBox, clonedData))
{
return nullptr;
@@ -3461,7 +3461,7 @@ namespace WhiteBox
bool SaveToWbm(const WhiteBoxMesh& whiteBox, AZ::IO::GenericStream& stream)
{
AZStd::vector<AZ::u8> buffer;
WhiteBoxMeshStream buffer;
const bool success = WhiteBox::Api::WriteMesh(whiteBox, buffer);
const auto bytesWritten = stream.Write(buffer.size(), buffer.data());
@@ -124,7 +124,7 @@ namespace WhiteBox
AZStd::optional<AZStd::unique_ptr<RenderMeshInterface>>
m_renderMesh; //!< The render mesh to use for the White Box mesh data.
AZ::Transform m_worldFromLocal = AZ::Transform::CreateIdentity(); //!< Cached world transform of Entity.
AZStd::vector<AZ::u8> m_whiteBoxData; //!< Serialized White Box mesh data.
Api::WhiteBoxMeshStream m_whiteBoxData; //!< Serialized White Box mesh data.
//! Holds a reference to an optional WhiteBoxMeshAsset and manages the lifecycle of adding/removing an asset.
EditorWhiteBoxMeshAsset* m_editorMeshAsset = nullptr;
AZStd::optional<AZ::Aabb> m_worldAabb; //!< Cached world aabb (used for selection/view determination).