diff --git a/src/atta/graphics/apis/openGL/framebuffer.cpp b/src/atta/graphics/apis/openGL/framebuffer.cpp index 88fdafff..48340966 100644 --- a/src/atta/graphics/apis/openGL/framebuffer.cpp +++ b/src/atta/graphics/apis/openGL/framebuffer.cpp @@ -56,14 +56,14 @@ void Framebuffer::bindAttachments() { for (unsigned i = 0; i < _images.size(); i++) { std::shared_ptr image = std::dynamic_pointer_cast(_images[i]); - bool isColor = (i != _depthAttachmentIndex) && (i != _stencilAttachmentIndex); - if (i == _depthAttachmentIndex) { + bool isColor = ((int)i != _depthAttachmentIndex) && ((int)i != _stencilAttachmentIndex); + if ((int)i == _depthAttachmentIndex) { if (!image->isCubemap()) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, image->getHandle(), 0); else glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, image->getHandle(), 0); } - if (i == _stencilAttachmentIndex) { + if ((int)i == _stencilAttachmentIndex) { if (!image->isCubemap()) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, image->getHandle(), 0); else @@ -94,7 +94,7 @@ void Framebuffer::bind(bool clear) { GLint clearColor[4]; for (size_t i = 0; i < 4; i++) clearColor[i] = (GLint)std::round(_clearColor[i]); - glClearBufferiv(GL_COLOR, GL_COLOR_ATTACHMENT0, clearColor); + glClearBufferiv(GL_COLOR, 0, clearColor); } if (_depthAttachmentIndex != -1 && _stencilAttachmentIndex != -1) { diff --git a/src/atta/graphics/bufferLayout.cpp b/src/atta/graphics/bufferLayout.cpp index 94251feb..4ac1be48 100644 --- a/src/atta/graphics/bufferLayout.cpp +++ b/src/atta/graphics/bufferLayout.cpp @@ -14,7 +14,7 @@ namespace atta::graphics { std::vector toStr = {"?", "bool", "int", "uint", "float", "vec2", "vec3", "vec4", "ivec2", "ivec3", "ivec4", "mat3", "mat4", "sampler2D", "samplerCube"}; BufferLayout::Element::Type BufferLayout::Element::typeFromString(std::string type) { - for (int i = 0; i < toStr.size(); i++) + for (size_t i = 0; i < toStr.size(); i++) if (toStr[i] == type) return (Type)i; return Type::NONE; diff --git a/src/atta/io/bluetooth/linuxBluetooth.cpp b/src/atta/io/bluetooth/linuxBluetooth.cpp index 1612c364..bd42f3a8 100644 --- a/src/atta/io/bluetooth/linuxBluetooth.cpp +++ b/src/atta/io/bluetooth/linuxBluetooth.cpp @@ -789,13 +789,11 @@ bool LinuxBluetooth::notifyCharStart(const Char& ch, NotifyFunction func) { bool LinuxBluetooth::notifyCharStop(const Char& ch) { Char* cch = nullptr; LinuxChar* lch = nullptr; - LinuxDevice* lDev = nullptr; for (auto& llDev : _linuxDevices) for (auto& lServ : llDev.services) for (auto& llch : lServ.chars) if (llch.uuid == ch.uuid) { lch = &llch; - lDev = &llDev; } for (auto& llDev : _devices) for (auto& lServ : llDev.services) diff --git a/src/atta/io/http/jsonParse.cpp b/src/atta/io/http/jsonParse.cpp index 2ace69b1..6d536e56 100644 --- a/src/atta/io/http/jsonParse.cpp +++ b/src/atta/io/http/jsonParse.cpp @@ -46,7 +46,7 @@ void Json::parseAux(const std::string& str, unsigned& pos, bool& res) { // INT or FLOAT unsigned curr = pos; // Find first char that is not a digit or '-' - while (curr + 1 < str.size() && (str[curr] >= '0' && str[curr] <= '9' || str[curr] == '-')) + while (curr + 1 < str.size() && ((str[curr] >= '0' && str[curr] <= '9') || str[curr] == '-')) curr++; // Check if it is . diff --git a/src/atta/physics/engines/box2DEngine.cpp b/src/atta/physics/engines/box2DEngine.cpp index 35537ab1..10754b3f 100644 --- a/src/atta/physics/engines/box2DEngine.cpp +++ b/src/atta/physics/engines/box2DEngine.cpp @@ -234,7 +234,6 @@ void Box2DEngine::createRigidBody(component::EntityId entity) { component::Transform worldT = t->getWorldTransform(entity); vec3 position = worldT.position; quat orientation = worldT.orientation; - vec3 scale = worldT.scale; // Create box2d body definition b2BodyDef bodyDef; @@ -283,8 +282,6 @@ void Box2DEngine::createColliders(component::EntityId entity) { // Get world transform component::Transform worldT = t->getWorldTransform(entity); - vec3 position = worldT.position; - quat orientation = worldT.orientation; vec3 scale = worldT.scale; b2FixtureDef fixtureDef; diff --git a/src/atta/physics/engines/bulletEngine.cpp b/src/atta/physics/engines/bulletEngine.cpp index 668d69c9..ae11f3ab 100644 --- a/src/atta/physics/engines/bulletEngine.cpp +++ b/src/atta/physics/engines/bulletEngine.cpp @@ -82,7 +82,6 @@ void BulletEngine::step(float dt) { auto t = component::getComponent(eid); component::Transform worldT = t->getWorldTransform(eid); vec3 position = worldT.position; - vec3 scale = worldT.scale; quat orientation = worldT.orientation; // Get bullet transform @@ -142,7 +141,7 @@ void BulletEngine::step(float dt) { // TODO Should go through collisionObjects from the root down the relationship hierarchy, // strange simulations may happen otherwise because of wrong parent transform btCollisionObject* obj = _world->getCollisionObjectArray()[j]; - btRigidBody* body = btRigidBody::upcast(obj); + // btRigidBody* body = btRigidBody::upcast(obj); btTransform trans; trans = obj->getWorldTransform(); @@ -213,7 +212,7 @@ void BulletEngine::stop() { } // Delete collision shapes - for (size_t i = 0; i < _collisionShapes.size(); i++) { + for (int i = 0; i < _collisionShapes.size(); i++) { delete _collisionShapes[i]; _collisionShapes[i] = nullptr; } diff --git a/src/atta/resource/resources/image.cpp b/src/atta/resource/resources/image.cpp index 3359ea0e..06878140 100644 --- a/src/atta/resource/resources/image.cpp +++ b/src/atta/resource/resources/image.cpp @@ -58,7 +58,7 @@ Image::Image(const fs::path& filename, CreateInfo info) : Resource(filename) { } _data = new uint8_t[_width * _height * _channels * getBytesPerChannel(_format)]; - for (int i = 0; i < _width * _height * _channels * getBytesPerChannel(_format); i++) + for (size_t i = 0; i < _width * _height * _channels * getBytesPerChannel(_format); i++) _data[i] = 0; } @@ -143,7 +143,7 @@ void Image::load() { // Copy temp data to _data uint32_t size = _width * _height * _channels * getBytesPerChannel(_format); _data = new uint8_t[size]; - for (int i = 0; i < size; i++) + for (size_t i = 0; i < size; i++) _data[i] = data[i]; stbi_image_free(data); // LOG_INFO("resource::Image", "[w]$3[] -> w:$0, h:$1, c:$2", _width, _height, _channels, absolutePath); diff --git a/src/atta/ui/editor/tools/timeProfiler/components/flameGraph.cpp b/src/atta/ui/editor/tools/timeProfiler/components/flameGraph.cpp index 0f84aeb6..a2cb5a4d 100644 --- a/src/atta/ui/editor/tools/timeProfiler/components/flameGraph.cpp +++ b/src/atta/ui/editor/tools/timeProfiler/components/flameGraph.cpp @@ -12,8 +12,7 @@ namespace atta::ui { void FlameGraph::compute() { for (auto& [threadId, records] : Profiler::calcRecordsByThreadId(_lastRecordsSize)) { - for (int i = 0; i < records.size(); i++) { - + for (size_t i = 0; i < records.size(); i++) { } } _lastRecordsSize = Profiler::getRecords().size(); @@ -51,8 +50,7 @@ void FlameGraph::render() { ImVec2 rmin = ImPlot::PlotToPixels(ImPlotPoint(0.25f, 0.75f)); ImVec2 rmax = ImPlot::PlotToPixels(ImPlotPoint(0.75f, 0.25f)); ImPlot::PushPlotClipRect(); - if(_flameBar.name != StringId()) - { + if (_flameBar.name != StringId()) { ImPlot::GetPlotDrawList()->AddCircleFilled(cntr, 20, IM_COL32(255, 255, 0, 255), 20); ImPlot::GetPlotDrawList()->AddRect(rmin, rmax, IM_COL32(128, 0, 255, 255)); } diff --git a/src/atta/ui/editor/tools/timeProfiler/components/tearDown.cpp b/src/atta/ui/editor/tools/timeProfiler/components/tearDown.cpp index e894a405..a67b1597 100644 --- a/src/atta/ui/editor/tools/timeProfiler/components/tearDown.cpp +++ b/src/atta/ui/editor/tools/timeProfiler/components/tearDown.cpp @@ -29,14 +29,14 @@ void TearDown::compute() { for (auto& [threadId, records] : Profiler::calcRecordsByThreadId(_lastRecordsSize)) { std::vector& nestedTime = _nestedTime[threadId]; // For each record in this thread - for (int i = 0; i < records.size(); i++) { + for (size_t i = 0; i < records.size(); i++) { Profiler::Record r = records[i]; // Total time Profiler::Time time = r.end - r.begin; // Remove time of nested functions - for (int j = nestedTime.size() - 1; j >= 0; j--) { + for (int j = (int)nestedTime.size() - 1; j >= 0; j--) { if (nestedTime[j].end < r.begin) break; else { @@ -140,8 +140,8 @@ void TearDown::render() { // Name ImGui::TableNextColumn(); - std::string name = _funcTime[row].name.getString(); - if(cropName) + std::string name = _funcTime[row].name.getString(); + if (cropName) name = Profiler::cropFuncName(name); ImGui::Text(name.c_str()); @@ -170,9 +170,8 @@ void TearDown::render() { float barPerc = _funcTime[row].time / float(_maxTime); pMax.x = pMin.x + (pMax.x - pMin.x) * barPerc; - if (pMax.x > pMin.x) - { - uint8_t r,g,b; + if (pMax.x > pMin.x) { + uint8_t r, g, b; Profiler::getFuncColor(_funcTime[row].name, r, g, b); drawList->AddRectFilled(pMin, pMax, IM_COL32(r, g, b, 255)); } diff --git a/src/atta/ui/editor/tools/timeProfiler/components/timeline.cpp b/src/atta/ui/editor/tools/timeProfiler/components/timeline.cpp index d762deff..d7981a5c 100644 --- a/src/atta/ui/editor/tools/timeProfiler/components/timeline.cpp +++ b/src/atta/ui/editor/tools/timeProfiler/components/timeline.cpp @@ -13,12 +13,12 @@ namespace atta::ui { void Timeline::compute() { for (auto& [threadId, records] : Profiler::calcRecordsByThreadId(_lastRecordsSize)) { std::vector& sortedRecords = _sortedRecords[threadId]; - for (int i = 0; i < records.size(); i++) { + for (size_t i = 0; i < records.size(); i++) { // Add to back sortedRecords.push_back(records[i]); // Move back until correct position - for (int j = sortedRecords.size() - 2; j >= 0; j--) { + for (int j = (int)sortedRecords.size() - 2; j >= 0; j--) { if (sortedRecords[j].begin > sortedRecords[j + 1].begin) std::swap(sortedRecords[j], sortedRecords[j + 1]); else @@ -92,7 +92,6 @@ void Timeline::render() { float pixelTime = size.x / sizePixels.x; // Time interval of each pixel ImPlot::PushPlotClipRect(); - float nextDrawTime = 0; maxStackSize = 0; for (const Profiler::Record& record : records) { // Free stack @@ -125,24 +124,21 @@ void Timeline::render() { min.x = std::max(beginTime, float(limits.X.Min)); max.x = std::min(endTime, float(limits.X.Max)); // Calculate text size - ImPlotPoint textOrigin = ImPlot::PixelsToPlot(ImVec2(0,0)); + ImPlotPoint textOrigin = ImPlot::PixelsToPlot(ImVec2(0, 0)); ImPlotPoint textSize = ImPlot::PixelsToPlot(ImGui::CalcTextSize(name.c_str())); textSize.x = textSize.x - textOrigin.x; // If text too big, try funcName... if (textSize.x >= max.x - min.x) { // If can't render full name, try partial name std::string fullName = name; - for(int s = 5; s <= fullName.size()-3; s++) - { + for (size_t s = 5; s <= fullName.size() - 3; s++) { std::string subStr = fullName.substr(0, s) + "..."; ImPlotPoint subTextSize = ImPlot::PixelsToPlot(ImGui::CalcTextSize(subStr.c_str())); subTextSize.x = subTextSize.x - textOrigin.x; - if (subTextSize.x < max.x - min.x) - { + if (subTextSize.x < max.x - min.x) { name = subStr; textSize = subTextSize; - } - else + } else break; } } diff --git a/src/atta/ui/editor/windows/viewportWindows.cpp b/src/atta/ui/editor/windows/viewportWindows.cpp index a1ce3512..1fd864cc 100644 --- a/src/atta/ui/editor/windows/viewportWindows.cpp +++ b/src/atta/ui/editor/windows/viewportWindows.cpp @@ -32,10 +32,8 @@ void ViewportWindows::render() { static clock_t vpLastTime = std::clock(); const clock_t vpCurrTime = std::clock(); const float vpTimeDiff = float(vpCurrTime - vpLastTime) / CLOCKS_PER_SEC; - bool shouldRenderViewports = false; if (graphics::getViewportRendering() && (graphics::getViewportFPS() > 0 && (vpTimeDiff > 1 / graphics::getViewportFPS()))) { vpLastTime = vpCurrTime; - shouldRenderViewports = true; } int i = -1;