suppress some warnings

This commit is contained in:
ohyzha
2025-03-05 13:34:48 +02:00
parent efcee95158
commit c5a0c52530
21 changed files with 34 additions and 36 deletions

View File

@@ -63,7 +63,7 @@ namespace
mesh.mTextureCoords[0] = new aiVector3D[geometry->vertexCount];
}
for (int i = 0; i < geometry->vertexCount; ++i)
for (uint32_t i = 0; i < geometry->vertexCount; ++i)
{
const OpenVulkano::Vertex& vertex = geometry->vertices[i];
mesh.mVertices[i] = aiVector3D(vertex.position.x, vertex.position.y, vertex.position.z) * scaling;
@@ -78,7 +78,7 @@ namespace
mesh.mFaces = new aiFace[mesh.mNumFaces];
indices = std::make_unique<unsigned int[]>(geometry->indexCount);
for (unsigned int i = 0; i < geometry->indexCount; ++i)
for (uint32_t i = 0; i < geometry->indexCount; ++i)
{
indices[i] = geometry->GetIndex(i);
}

View File

@@ -38,25 +38,25 @@ map_Kd texture.png
objContent.write("\n", 1);
}
for (int i = 0; i < geometry->vertexCount; ++i)
for (uint32_t i = 0; i < geometry->vertexCount; ++i)
{
const auto& v = geometry->vertices[i];
const std::string content = fmt::format("v {} {} {}\n", v.position.x, v.position.y, v.position.z);
objContent.write(content.data(), content.size());
}
for (int i = 0; i < geometry->vertexCount; ++i)
for (uint32_t i = 0; i < geometry->vertexCount; ++i)
{
const auto& v = geometry->vertices[i];
const std::string content = fmt::format("vn {} {} {}\n", v.normal.x, v.normal.y, v.normal.z);
objContent.write(content.data(), content.size());
}
for (int i = 0; i < geometry->vertexCount; ++i)
for (uint32_t i = 0; i < geometry->vertexCount; ++i)
{
const auto& v = geometry->vertices[i];
const std::string content = fmt::format("vt {} {}\n", v.textureCoordinates.x, v.textureCoordinates.y);
objContent.write(content.data(), content.size());
}
for (int i = 0; i < geometry->indexCount; i += 3)
for (uint32_t i = 0; i < geometry->indexCount; i += 3)
{
uint32_t i0 = geometry->GetIndex(i + 0) + 1;
uint32_t i1 = geometry->GetIndex(i + 1) + 1;

View File

@@ -89,7 +89,7 @@ namespace OpenVulkano::Scene
{
return;
}
for (int i = 0; i < vertexCount; i++)
for (uint32_t i = 0; i < vertexCount; i++)
{
aabb.Grow(vertices[i].position);
}

View File

@@ -308,10 +308,10 @@ namespace OpenVulkano::Scene
return result;
}
Geometry GeometryFactory::MakeArchStrip(float radius, float width, float endRadius, int segments, const Math::Vector4f& color, float endVCoord, bool indexBuffer)
Geometry GeometryFactory::MakeArchStrip(float radius, float width, float endRadius, uint32_t segments, const Math::Vector4f& color, float endVCoord, bool indexBuffer)
{
Geometry result;
segments = std::max(2, segments);
segments = std::max(2u, segments);
result.Init(2 * segments, indexBuffer ? 6 * segments : 0);
const float segmentAngle = endRadius / static_cast<float>(segments - 1);
width /= 2;

View File

@@ -20,6 +20,6 @@ namespace OpenVulkano::Scene
static Geometry MakeTriangle(const Math::Vector3f& p1, const Math::Vector3f& p2, const Math::Vector3f& p3, const Math::Vector4f& color = Math::Vector4f(1));
static Geometry MakeCylinder(float radius, float height, uint32_t segments, const Math::Vector4f& color = Math::Vector4f(1));
static Geometry MakePyramid(float baseLength = 1, float height = 1, const Math::Vector4f& color = Math::Vector4f(1));
static Geometry MakeArchStrip(float radius = 1, float width = 0.2, float endRadius = std::numbers::pi, int segments = 16, const Math::Vector4f& color = Math::Vector4f(1), float endVCoord = 1, bool indexBuffer = true);
static Geometry MakeArchStrip(float radius = 1, float width = 0.2, float endRadius = std::numbers::pi, uint32_t segments = 16, const Math::Vector4f& color = Math::Vector4f(1), float endVCoord = 1, bool indexBuffer = true);
};
}

View File

@@ -65,7 +65,7 @@ namespace OpenVulkano::Scene
Shader* GetTextShader(const FontAtlasType type, const bool billboard)
{
return &TEXT_SHADERS[static_cast<int>(type) << 1 | billboard];
return &TEXT_SHADERS[(static_cast<int>(type) << 1) + billboard];
}
}

View File

@@ -52,7 +52,7 @@ namespace OpenVulkano::Scene
if (m_mesh->indexCount != 0)
{
assert(m_mesh->indexCount % 3 == 0 && "Topology is TRIANGLE_LIST but index count is not divisible by 3");
for (int i = 0; i < m_mesh->indexCount; i += 3)
for (uint32_t i = 0; i < m_mesh->indexCount; i += 3)
{
if (m_mesh->indexType == VertexIndexType::UINT16)
{
@@ -79,7 +79,7 @@ namespace OpenVulkano::Scene
else
{
assert(m_mesh->indexCount % 3 == 0 && "Topology is TRIANGLE_LIST but vertex count is not divisible by 3");
for (int i = 0; i < m_mesh->vertexCount; i += 3)
for (uint32_t i = 0; i < m_mesh->vertexCount; i += 3)
{
if (auto hit = ray.IntersectTriangle(m_mesh->vertices[i].position,
m_mesh->vertices[i + 1].position,

View File

@@ -148,7 +148,7 @@ namespace OpenVulkano::Scene
{
char* baseAddress = static_cast<char*>(m_atlasData->GetTexture()->textureBuffer)
+ glyph.firstGlyphByteInAtlas;
for (int row = 0; row < slot->bitmap.rows; row++)
for (unsigned int row = 0; row < slot->bitmap.rows; row++)
{
std::memcpy(baseAddress - row * m_atlasData->GetTexture()->resolution.x,
&slot->bitmap.buffer[row * slot->bitmap.pitch], slot->bitmap.width);
@@ -181,9 +181,9 @@ namespace OpenVulkano::Scene
{
// RGB RGB RGB
assert(bitmap.width % 3 == 0);
for (int row = 0; row < bitmap.rows; row++)
for (unsigned int row = 0; row < bitmap.rows; row++)
{
for (int col = 0, atlasPos = 0; col < bitmap.width; col += 3, atlasPos += 4)
for (unsigned int col = 0, atlasPos = 0; col < bitmap.width; col += 3, atlasPos += 4)
{
const size_t bitmapPos = row * bitmap.pitch + col;
const size_t texturePos = (glyph.firstGlyphByteInAtlas - row * tex->resolution.x * m_channelsCount) + atlasPos;
@@ -200,9 +200,9 @@ namespace OpenVulkano::Scene
// GGG
// BBB
assert(bitmap.rows % 3 == 0);
for (int row = 0; row < bitmap.rows; row += 3)
for (unsigned int row = 0; row < bitmap.rows; row += 3)
{
for (int col = 0; col < bitmap.width; col++)
for (unsigned int col = 0; col < bitmap.width; col++)
{
const size_t bitmapPos = col + (bitmap.pitch * row);
const size_t texturePos = (glyph.firstGlyphByteInAtlas + col * m_channelsCount)

View File

@@ -124,7 +124,7 @@ namespace OpenVulkano::Scene
// store RGB as RGBA
const msdfgen::BitmapConstRef<msdfgen::byte, 3> storage = generator.atlasStorage();
msdfgen::byte* data = static_cast<msdfgen::byte*>(m_atlasData->GetTexture()->textureBuffer);
for (size_t srcPos = 0, dstPos = 0; srcPos < width * height * 3; srcPos += 3, dstPos += 4)
for (size_t srcPos = 0, dstPos = 0; srcPos < static_cast<size_t>(width * height * 3); srcPos += 3, dstPos += 4)
{
data[dstPos] = storage.pixels[srcPos];
data[dstPos + 1] = storage.pixels[srcPos + 1];

View File

@@ -35,7 +35,7 @@ namespace OpenVulkano::Scene::UI
m_frames.m_values.push_back(newFrameTime);
while(m_frames.m_values.size() > m_windowSize)
while(static_cast<int>(m_frames.m_values.size()) > m_windowSize)
{
float poppedFrameTime = m_frames.m_values.front();
m_frames.m_values.pop_front();
@@ -51,7 +51,7 @@ namespace OpenVulkano::Scene::UI
}
m_ramUsed.m_values.push_back(static_cast<float>(SystemInfo::GetAppRamUsed()));
while(m_ramUsed.m_values.size() > m_windowSize)
while(static_cast<int>(m_ramUsed.m_values.size()) > m_windowSize)
m_ramUsed.m_values.pop_front();
m_ramUsed.m_maxValue = SystemInfo::GetAppRamMax();