Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Headers/System/Mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ namespace System {
Points
};
struct SubMeshDescriptor {
int indexStart;
int indexCount;
unsigned int indexStart;
unsigned int indexCount;
int baseVertex;
MeshTopology topology;
};
Expand All @@ -58,7 +58,7 @@ namespace System {

std::vector<System::Vector3> vertices;
std::vector<System::Vector3> normals;
std::vector<int> indices;
std::vector<unsigned int> indices;
System::Bounds bounds;
std::vector<SubMeshDescriptor> submeshes;
std::vector<Vector4> tangents;
Expand Down Expand Up @@ -251,10 +251,10 @@ namespace System {
m_bitFlags |= bitFlags::Modified;

}
void SetTriangles(const std::vector<int>& triangles, int submesh, bool calculateBounds = true, int baseVertex = 0) {
void SetTriangles(const std::vector<unsigned int>& triangles, int submesh, bool calculateBounds = true, int baseVertex = 0) {
SetIndices(triangles, MeshTopology::Triangles, submesh, calculateBounds, baseVertex);
}
void SetIndices(const std::vector<int>& newIndices, MeshTopology topology, int submesh, bool calculateBounds = true, int baseVertex = 0) {
void SetIndices(const std::vector<unsigned int>& newIndices, MeshTopology topology, int submesh, bool calculateBounds = true, int baseVertex = 0) {
m_bitFlags |= bitFlags::Modified;
if (submesh < 0) {
throw std::out_of_range("Submesh index is out of range.");
Expand All @@ -271,8 +271,8 @@ namespace System {
}
else { // It's an existing submesh that we are replacing
SubMeshDescriptor& desc = submeshes[submesh];
int oldIndexCount = desc.indexCount;
int newIndexCount = newIndices.size();
unsigned int oldIndexCount = desc.indexCount;
unsigned int newIndexCount = newIndices.size();
int diff = newIndexCount - oldIndexCount;

// Replace the indices
Expand All @@ -298,13 +298,13 @@ namespace System {
if (index < 0 || index >= submeshes.size()) throw std::out_of_range("Submesh index is out of range.");
return submeshes[index];
}
std::vector<int> GetIndices(int submesh) const {
std::vector<unsigned int> GetIndices(int submesh) const {
if (submesh < 0 || submesh >= submeshes.size()) {
throw std::out_of_range("Submesh index is out of range.");
}

const auto& desc = submeshes[submesh];
return std::vector<int>(indices.begin() + desc.indexStart, indices.begin() + desc.indexStart + desc.indexCount);
return std::vector<unsigned int>(indices.begin() + desc.indexStart, indices.begin() + desc.indexStart + desc.indexCount);
}
void Clear(bool keepVertexLayout = true) {
vertices.clear();
Expand Down
2 changes: 1 addition & 1 deletion Sources/System/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace System {
Vector3(-0.5f, 0.5f, 0.5f)
};

std::vector<int> triangles = {
std::vector<unsigned int> triangles = {
// Front face
0, 1, 2,
2, 3, 0,
Expand Down
Binary file added Tests/scene_render/scene_render_debug
Binary file not shown.