engineer-thesis-WUT/Engine/engine/draw.hpp

71 lines
2.1 KiB
C++
Raw Normal View History

2023-03-12 16:24:48 +01:00
// "Copyright [2023] <Krzysztof Rudnicki>"
2023-03-12 17:32:42 +01:00
#ifndef ENGINE_ENGINE_DRAW_HPP_
#define ENGINE_ENGINE_DRAW_HPP_
2022-09-05 20:17:25 +02:00
#include <glad/glad.h>
#include <GLFW/glfw3.h>
2022-11-20 23:14:59 +01:00
#include <string>
2023-03-12 17:32:42 +01:00
#include "./constants.hpp"
2022-09-05 20:17:25 +02:00
2023-01-27 21:29:04 +01:00
struct offsetsStruct {
offsetsStruct(): xOffset(0), yOffset(0), zOffset(0) { }
float xOffset, yOffset, zOffset;
};
2023-03-11 19:08:15 +01:00
struct drawFigureReturn {
2023-03-12 17:32:42 +01:00
drawFigureReturn(): success(-1), VAO(0), VBO(0), EBO(0) { }
2023-03-11 19:08:15 +01:00
int success;
unsigned int VAO;
unsigned int VBO;
unsigned int EBO;
};
drawFigureReturn drawFigure(const int whatToDraw);
2023-03-12 17:32:42 +01:00
drawFigureReturn drawSquare(
const float squareVertices[] = constants::SQUARE_VERTICES,
const size_t squareVerticesSize = constants::SQUARE_VERTICES_SIZE,
const unsigned int squareIndices[] = constants::SQUARE_INDICES,
const size_t squareIndicesSize = constants::SQUARE_INDICES_SIZE,
const char* vertexShaderSource = constants::VERTEX_SHADER_SOURCE,
const char* fragmentShaderSource = constants::FRAGMENT_SHADER_SOURCE,
const bool colorIncluded = false,
const bool textureIncluded = false,
const offsetsStruct offsets = offsetsStruct());
void doDrawElements(
const unsigned int shaderProgram,
const unsigned int vertexArrayObject,
const GLenum drawArrayMode,
const GLenum drawType,
const int numberOfElementsToDraw);
drawFigureReturn drawTriangleClass(
const float triangleVertices[],
const size_t triangleVerticesSize,
const char* vertexPath,
const char* fragmentPath,
const bool colorIncluded = false,
const bool textureIncluded = false,
const offsetsStruct offsets = offsetsStruct());
void updateUniformColor(
const unsigned int shaderProgram,
const GLchar* uniformName);
void doDrawArrays(
const unsigned int shaderProgram,
const unsigned int vertexArrayObject,
const GLenum drawArrayMode,
const int firstIndex,
const unsigned int numberOfIndicesToBeRendered);
drawFigureReturn drawDebilMode(
const char* vertexPath,
const char* fragmentPath,
const float vertices[],
const size_t verticesSize,
const unsigned int indices[],
const size_t indicesSize);
#endif // ENGINE_ENGINE_DRAW_HPP_