clang warnings fix

This commit is contained in:
MihailRis
2024-02-02 20:42:49 +03:00
parent 4a22e8d57b
commit f25677d6d2
20 changed files with 37 additions and 45 deletions
+4 -5
View File
@@ -11,17 +11,17 @@ using glm::vec2;
using glm::vec3;
using glm::vec4;
Batch2D::Batch2D(size_t capacity) : capacity(capacity), offset(0), color(1.0f, 1.0f, 1.0f, 1.0f){
Batch2D::Batch2D(size_t capacity) : capacity(capacity), color(1.0f){
const vattr attrs[] = {
{2}, {2}, {4}, {0}
};
buffer = new float[capacity * B2D_VERTEX_SIZE];
mesh = new Mesh(buffer, 0, attrs);
mesh = std::make_unique<Mesh>(buffer, 0, attrs);
index = 0;
unsigned char pixels[] = {
255, 255, 255, 255,
ubyte pixels[] = {
0xFF, 0xFF, 0xFF, 0xFF
};
blank = new Texture(pixels, 1, 1, GL_RGBA);
_texture = nullptr;
@@ -30,7 +30,6 @@ Batch2D::Batch2D(size_t capacity) : capacity(capacity), offset(0), color(1.0f, 1
Batch2D::~Batch2D(){
delete blank;
delete[] buffer;
delete mesh;
}
void Batch2D::begin(){
+2 -2
View File
@@ -1,6 +1,7 @@
#ifndef SRC_GRAPHICS_BATCH2D_H_
#define SRC_GRAPHICS_BATCH2D_H_
#include <memory>
#include <stdlib.h>
#include <glm/glm.hpp>
@@ -13,8 +14,7 @@ class Sprite;
class Batch2D {
float* buffer;
size_t capacity;
size_t offset;
Mesh* mesh;
std::unique_ptr<Mesh> mesh;
size_t index;
Texture* blank;
+1 -2
View File
@@ -13,8 +13,7 @@ using glm::vec3;
using glm::vec4;
Batch3D::Batch3D(size_t capacity)
: capacity(capacity),
offset(0) {
: capacity(capacity) {
const vattr attrs[] = {
{3}, {2}, {4}, {0}
};
-1
View File
@@ -12,7 +12,6 @@ class Texture;
class Batch3D {
float* buffer;
size_t capacity;
size_t offset;
Mesh* mesh;
size_t index;
+10 -4
View File
@@ -8,17 +8,23 @@ const uint LB_VERTEX_SIZE = (3+4);
LineBatch::LineBatch(size_t capacity) : capacity(capacity) {
const vattr attrs[] = { {3},{4}, {0} };
buffer = new float[capacity * LB_VERTEX_SIZE * 2];
mesh = new Mesh(buffer, 0, attrs);
mesh = std::make_unique<Mesh>(buffer, 0, attrs);
index = 0;
}
LineBatch::~LineBatch(){
delete[] buffer;
delete mesh;
}
void LineBatch::line(float x1, float y1, float z1, float x2, float y2, float z2,
float r, float g, float b, float a) {
void LineBatch::line(
float x1, float y1,
float z1, float x2,
float y2, float z2,
float r, float g, float b, float a
) {
if (index + LB_VERTEX_SIZE * 2 >= capacity) {
render();
}
buffer[index] = x1;
buffer[index+1] = y1;
buffer[index+2] = z1;
+2 -1
View File
@@ -1,13 +1,14 @@
#ifndef GRAPHICS_LINEBATCH_H_
#define GRAPHICS_LINEBATCH_H_
#include <memory>
#include <stdlib.h>
#include <glm/glm.hpp>
class Mesh;
class LineBatch {
Mesh* mesh;
std::unique_ptr<Mesh> mesh;
float* buffer;
size_t index;
size_t capacity;