Skip to content

Commit

Permalink
update vertex format apis
Browse files Browse the repository at this point in the history
  • Loading branch information
T-rvw committed Feb 26, 2024
1 parent 7e71d15 commit b95d1b6
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 44 deletions.
10 changes: 5 additions & 5 deletions misc/MeshGenerteProducer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class MeshGenerteProducer final : public IProducer
cd::Sphere sphere(cd::Point(0.0f, 0.0f, 0.0f), 2.0f);
//cd::Box box(cd::Vec3f(-1.0f, -1.0f, -1.0f), cd::Vec3f(1.0f, 1.0f, 1.0f));
cd::VertexFormat vertexFormat;
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
vertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Point::ValueType>(), 3);
std::optional<cd::Mesh> optMesh = cd::MeshGenerator::Generate(sphere, 20, 20, vertexFormat);
if (!optMesh.has_value())
{
Expand Down
24 changes: 12 additions & 12 deletions private/Math/MeshGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ std::optional<Mesh> MeshGenerator::Generate(const Box& box, const VertexFormat&
mesh.AddPolygonGroup(cd::MoveTemp(polygonGroup));

cd::VertexFormat meshVertexFormat;
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), cd::Point::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), cd::Point::Size);

if (vertexFormat.Contains(VertexAttributeType::Normal))
{
mesh.ComputeVertexNormals();
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
}

if (vertexFormat.Contains(VertexAttributeType::UV))
Expand All @@ -121,15 +121,15 @@ std::optional<Mesh> MeshGenerator::Generate(const Box& box, const VertexFormat&
mesh.SetVertexUV(0U, vertexIndex, cd::UV(position.x(), position.z()));
}

meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::UV::ValueType>(), cd::UV::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::UV::ValueType>(), cd::UV::Size);
}


if (vertexFormat.Contains(VertexAttributeType::Tangent) || vertexFormat.Contains(VertexAttributeType::Bitangent))
{
mesh.ComputeVertexTangents();
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
}

// Use VertexColor0 to present braycentric coordinates.
Expand Down Expand Up @@ -160,7 +160,7 @@ std::optional<Mesh> MeshGenerator::Generate(const Box& box, const VertexFormat&
mesh.SetVertexColor(0U, 21U, cd::Vec4f(1.0f, 0.0f, 0.0f, 1.0f));
mesh.SetVertexColor(0U, 22U, cd::Vec4f(0.0f, 1.0f, 0.0f, 1.0f));
mesh.SetVertexColor(0U, 23U, cd::Vec4f(0.0f, 0.0f, 1.0f, 1.0f));
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Color, cd::GetAttributeValueType<cd::Vec4f::ValueType>(), cd::Vec4f::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Color, cd::GetAttributeValueType<cd::Vec4f::ValueType>(), cd::Vec4f::Size);
}

mesh.SetVertexFormat(MoveTemp(meshVertexFormat));
Expand All @@ -179,13 +179,13 @@ std::optional<Mesh> MeshGenerator::Generate(const Sphere& sphere, uint32_t numSt
mesh.Init(vertexCount);

cd::VertexFormat meshVertexFormat;
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), cd::Point::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), cd::Point::Size);

bool generateUV = vertexFormat.Contains(VertexAttributeType::UV);
if (generateUV)
{
mesh.SetVertexUVSetCount(1);
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::UV::ValueType>(), cd::UV::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::UV::ValueType>(), cd::UV::Size);
}

// Generate vertices
Expand Down Expand Up @@ -284,20 +284,20 @@ std::optional<Mesh> MeshGenerator::Generate(const Sphere& sphere, uint32_t numSt
}
}

meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
}

if (vertexFormat.Contains(VertexAttributeType::Tangent) || vertexFormat.Contains(VertexAttributeType::Bitangent))
{
mesh.ComputeVertexTangents();
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
}

if (vertexFormat.Contains(VertexAttributeType::Color))
{
mesh.SetVertexColorSetCount(1U);
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Color, cd::GetAttributeValueType<cd::Vec4f::ValueType>(), cd::Vec4f::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Color, cd::GetAttributeValueType<cd::Vec4f::ValueType>(), cd::Vec4f::Size);
}

mesh.SetVertexFormat(MoveTemp(meshVertexFormat));
Expand Down
12 changes: 6 additions & 6 deletions private/Producers/FbxProducer/FbxProducerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,28 +953,28 @@ cd::MeshID FbxProducerImpl::ImportMesh(const fbxsdk::FbxMesh* pFbxMesh, cd::Scen
cd::VertexFormat meshVertexFormat;
if (controlPointCount > 0U)
{
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), cd::Point::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), cd::Point::Size);
}

const fbxsdk::FbxLayerElementNormal* pLayerElementNormalData = pMeshBaseLayer->GetNormals();
if (pLayerElementNormalData)
{
mesh.SetVertexNormalCount(vertexInstanceCount);
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
}

const fbxsdk::FbxLayerElementTangent* pLayerElementTangentData = pMeshBaseLayer->GetTangents();
if (pLayerElementTangentData)
{
mesh.SetVertexTangentCount(vertexInstanceCount);
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
}

const fbxsdk::FbxLayerElementBinormal* pLayerElementBinormalData = pMeshBaseLayer->GetBinormals();
if (pLayerElementBinormalData)
{
mesh.SetVertexBiTangentCount(vertexInstanceCount);
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
}

const fbxsdk::FbxLayerElementVertexColor* pLayerElementColorData = pMeshBaseLayer->GetVertexColors();
Expand All @@ -983,7 +983,7 @@ cd::MeshID FbxProducerImpl::ImportMesh(const fbxsdk::FbxMesh* pFbxMesh, cd::Scen
// TODO : Multiple vertex color sets if necessary.
mesh.SetVertexColorSetCount(1U);
mesh.GetVertexColors(0U).resize(vertexInstanceCount);
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Color, cd::GetAttributeValueType<cd::Vec4f::ValueType>(), cd::Vec4f::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Color, cd::GetAttributeValueType<cd::Vec4f::ValueType>(), cd::Vec4f::Size);
}

std::vector<const fbxsdk::FbxLayerElementUV*> layerElementUVDatas;
Expand All @@ -1004,7 +1004,7 @@ cd::MeshID FbxProducerImpl::ImportMesh(const fbxsdk::FbxMesh* pFbxMesh, cd::Scen
{
mesh.GetVertexUVs(uvSetIndex).resize(vertexInstanceCount);
}
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::UV::ValueType>(), cd::UV::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::UV::ValueType>(), cd::UV::Size);
}
mesh.SetVertexFormat(cd::MoveTemp(meshVertexFormat));

Expand Down
12 changes: 6 additions & 6 deletions private/Producers/GenericProducer/GenericProducerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ cd::MeshID GenericProducerImpl::AddMesh(cd::SceneDatabase* pSceneDatabase, const
const aiVector3D& position = pSourceMesh->mVertices[vertexDataIndex];
mesh.SetVertexPosition(vertexIndex, cd::Point(position.x, position.y, position.z));
}
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), cd::Point::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Position, cd::GetAttributeValueType<cd::Point::ValueType>(), cd::Point::Size);

if (pSourceMesh->HasNormals())
{
Expand All @@ -233,7 +233,7 @@ cd::MeshID GenericProducerImpl::AddMesh(cd::SceneDatabase* pSceneDatabase, const
const aiVector3D& normal = pSourceMesh->mNormals[vertexDataIndex];
mesh.SetVertexNormal(vertexIndex, cd::Direction(normal.x, normal.y, normal.z));
}
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Normal, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);

if (pSourceMesh->HasTangentsAndBitangents())
{
Expand All @@ -243,7 +243,7 @@ cd::MeshID GenericProducerImpl::AddMesh(cd::SceneDatabase* pSceneDatabase, const
const aiVector3D& tangent = pSourceMesh->mTangents[vertexDataIndex];
mesh.SetVertexTangent(vertexIndex, cd::Direction(tangent.x, tangent.y, tangent.z));
}
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Tangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);


for (uint32_t vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex)
Expand All @@ -252,7 +252,7 @@ cd::MeshID GenericProducerImpl::AddMesh(cd::SceneDatabase* pSceneDatabase, const
const aiVector3D& biTangent = pSourceMesh->mBitangents[vertexDataIndex];
mesh.SetVertexBiTangent(vertexIndex, cd::Direction(biTangent.x, biTangent.y, biTangent.z));
}
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Bitangent, cd::GetAttributeValueType<cd::Direction::ValueType>(), cd::Direction::Size);
}
}

Expand All @@ -276,7 +276,7 @@ cd::MeshID GenericProducerImpl::AddMesh(cd::SceneDatabase* pSceneDatabase, const
const aiVector3D& uv = vertexUVArray[vertexDataIndex];
mesh.SetVertexUV(uvSetIndex, vertexIndex, cd::UV(uv.x, uv.y));
}
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::UV::ValueType>(), cd::UV::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::UV, cd::GetAttributeValueType<cd::UV::ValueType>(), cd::UV::Size);
}

uint32_t colorSetCount = pSourceMesh->GetNumColorChannels();
Expand All @@ -291,7 +291,7 @@ cd::MeshID GenericProducerImpl::AddMesh(cd::SceneDatabase* pSceneDatabase, const
const aiColor4D& color = vertexColorArray[vertexDataIndex];
mesh.SetVertexColor(colorSetIndex, vertexIndex, cd::Color(color.r, color.g, color.b, color.a));
}
meshVertexFormat.AddAttributeLayout(cd::VertexAttributeType::Color, cd::GetAttributeValueType<cd::Color::ValueType>(), cd::Color::Size);
meshVertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Color, cd::GetAttributeValueType<cd::Color::ValueType>(), cd::Color::Size);
}

mesh.SetVertexFormat(cd::MoveTemp(meshVertexFormat));
Expand Down
4 changes: 2 additions & 2 deletions private/Producers/TerrainProducer/TerrainProducerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ Mesh TerrainProducerImpl::GenerateSectorAt(uint32_t sector_x, uint32_t sector_z,
}
// Set vertex attribute
VertexFormat meshVertexFormat;
meshVertexFormat.AddAttributeLayout(VertexAttributeType::Position, GetAttributeValueType<Point::ValueType>(), Point::Size);
meshVertexFormat.AddAttributeLayout(VertexAttributeType::UV, GetAttributeValueType<UV::ValueType>(), UV::Size);
meshVertexFormat.AddVertexAttributeLayout(VertexAttributeType::Position, GetAttributeValueType<Point::ValueType>(), Point::Size);
meshVertexFormat.AddVertexAttributeLayout(VertexAttributeType::UV, GetAttributeValueType<UV::ValueType>(), UV::Size);
terrain.SetVertexFormat(cd::MoveTemp(meshVertexFormat));

// Set aabb
Expand Down
2 changes: 1 addition & 1 deletion private/ProgressiveMesh/ProgressiveMeshImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ cd::Mesh ProgressiveMeshImpl::GenerateLodMesh(uint32_t targetFaceCount, const cd
}
else
{
mesh.GetVertexFormat().AddAttributeLayout(cd::VertexAttributeType::Position, cd::AttributeValueType::Float, 3);
mesh.GetVertexFormat().AddVertexAttributeLayout(cd::VertexAttributeType::Position, cd::AttributeValueType::Float, 3);
}

const auto& vertexFormat = mesh.GetVertexFormat();
Expand Down
18 changes: 14 additions & 4 deletions private/Scene/VertexFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,24 @@ VertexFormat::~VertexFormat()
}
}

void VertexFormat::AddAttributeLayout(VertexAttributeType attributeType, AttributeValueType valueType, uint8_t count)
void VertexFormat::AddVertexAttributeLayout(VertexAttributeType attributeType, AttributeValueType valueType, uint8_t count)
{
m_pVertexFormatImpl->AddAttributeLayout(attributeType, valueType, count);
m_pVertexFormatImpl->AddVertexAttributeLayout(attributeType, valueType, count);
}

const std::vector<VertexAttributeLayout>& VertexFormat::GetVertexLayout() const
void VertexFormat::AddVertexAttributeLayout(VertexAttributeLayout vertexLayout)
{
return m_pVertexFormatImpl->GetVertexLayout();
m_pVertexFormatImpl->AddVertexAttributeLayout(cd::MoveTemp(vertexLayout));
}

const VertexAttributeLayout* VertexFormat::GetVertexAttributeLayout(VertexAttributeType attributeType) const
{
return m_pVertexFormatImpl->GetVertexAttributeLayout(attributeType);
}

const std::vector<VertexAttributeLayout>& VertexFormat::GetVertexAttributeLayouts() const
{
return m_pVertexFormatImpl->GetVertexAttributeLayouts();
}

bool VertexFormat::Contains(VertexAttributeType attributeType) const
Expand Down
23 changes: 19 additions & 4 deletions private/Scene/VertexFormatImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,43 @@ VertexFormatImpl& VertexFormatImpl::operator=(const VertexFormatImpl& rhs)
return *this;
}

void VertexFormatImpl::AddAttributeLayout(VertexAttributeType attributeType, AttributeValueType valueType, uint8_t count)
void VertexFormatImpl::AddVertexAttributeLayout(VertexAttributeType attributeType, AttributeValueType valueType, uint8_t count)
{
m_vertexLayouts.push_back(VertexAttributeLayout{ .vertexAttributeType = attributeType,
.attributeValueType = valueType,
.attributeCount = count });
}

bool VertexFormatImpl::Contains(VertexAttributeType attributeType) const
void VertexFormatImpl::AddVertexAttributeLayout(VertexAttributeLayout vertexLayout)
{
m_vertexLayouts.emplace_back(cd::MoveTemp(vertexLayout));
}

const VertexAttributeLayout* VertexFormatImpl::GetVertexAttributeLayout(VertexAttributeType attributeType) const
{
for (const auto& vertexLayout : m_vertexLayouts)
{
if (attributeType == vertexLayout.vertexAttributeType)
{
return true;
return &vertexLayout;
}
}

return false;
return nullptr;
}

bool VertexFormatImpl::Contains(VertexAttributeType attributeType) const
{
return GetVertexAttributeLayout(attributeType) != nullptr;
}

bool VertexFormatImpl::IsCompatiableTo(const VertexFormatImpl& other) const
{
if (other.m_vertexLayouts.empty())
{
return m_vertexLayouts.empty();
}

for (const auto& vertexLayout : other.m_vertexLayouts)
{
if (!Contains(vertexLayout.vertexAttributeType))
Expand Down
6 changes: 4 additions & 2 deletions private/Scene/VertexFormatImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ class VertexFormatImpl
VertexFormatImpl& operator=(VertexFormatImpl&&) = default;
~VertexFormatImpl() = default;

void AddAttributeLayout(VertexAttributeType attributeType, AttributeValueType valueType, uint8_t count);
const std::vector<VertexAttributeLayout>& GetVertexLayout() const { return m_vertexLayouts; }
void AddVertexAttributeLayout(VertexAttributeType attributeType, AttributeValueType valueType, uint8_t count);
void AddVertexAttributeLayout(VertexAttributeLayout vertexLayout);
const VertexAttributeLayout* GetVertexAttributeLayout(VertexAttributeType attributeType) const;
const std::vector<VertexAttributeLayout>& GetVertexAttributeLayouts() const { return m_vertexLayouts; }

// Returns if vertex format contains vertex attribute type.
bool Contains(VertexAttributeType attributeType) const;
Expand Down
6 changes: 4 additions & 2 deletions public/Scene/VertexFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class CORE_API VertexFormat final
VertexFormat& operator=(VertexFormat&&);
~VertexFormat();

void AddAttributeLayout(VertexAttributeType attributeType, AttributeValueType valueType, uint8_t count);
const std::vector<VertexAttributeLayout>& GetVertexLayout() const;
void AddVertexAttributeLayout(VertexAttributeType attributeType, AttributeValueType valueType, uint8_t count);
void AddVertexAttributeLayout(VertexAttributeLayout vertexLayout);
const VertexAttributeLayout* GetVertexAttributeLayout(VertexAttributeType attributeType) const;
const std::vector<VertexAttributeLayout>& GetVertexAttributeLayouts() const;

// Returns if vertex format contains vertex attribute type.
bool Contains(VertexAttributeType attributeType) const;
Expand Down

0 comments on commit b95d1b6

Please sign in to comment.