From 6aa1460068047369ce789a74f866c2dca3f76d89 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 24 Jul 2023 14:46:06 +0200 Subject: [PATCH] added sample for a mesh class used for rendering an object (maybe more like a mesh component?) --- src/Engine/Engine.vcxproj | 1 + src/Engine/Engine.vcxproj.filters | 3 +++ src/Engine/main.cpp | 4 +++- src/Engine/mesh/mesh.h | 21 +++++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/Engine/mesh/mesh.h diff --git a/src/Engine/Engine.vcxproj b/src/Engine/Engine.vcxproj index 5f15786..139897c 100644 --- a/src/Engine/Engine.vcxproj +++ b/src/Engine/Engine.vcxproj @@ -153,6 +153,7 @@ + diff --git a/src/Engine/Engine.vcxproj.filters b/src/Engine/Engine.vcxproj.filters index dda6039..96dc523 100644 --- a/src/Engine/Engine.vcxproj.filters +++ b/src/Engine/Engine.vcxproj.filters @@ -41,6 +41,9 @@ Header Files + + Header Files + diff --git a/src/Engine/main.cpp b/src/Engine/main.cpp index 69f6161..4b5d823 100644 --- a/src/Engine/main.cpp +++ b/src/Engine/main.cpp @@ -6,7 +6,7 @@ #include "shaders/Shader.h" -// Continue: https://learnopengl.com/Getting-started/Shaders +// Continue: https://learnopengl.com/Getting-started/Textures // Chapter: Not yet started // @@ -74,6 +74,8 @@ int main() 1, 2, 3 }; + // VBO == all verticies; EBO == connection of vertices (faces) and is optional although it is a bit more efficient than using VBOs; + // VAO == collection of VBOs/EBOs used for rendering GLuint vertexBufferObject, elementBufferObject, vertexArrayObject; glGenVertexArrays(1, &vertexArrayObject); glGenBuffers(1, &vertexBufferObject); diff --git a/src/Engine/mesh/mesh.h b/src/Engine/mesh/mesh.h new file mode 100644 index 0000000..a11b15b --- /dev/null +++ b/src/Engine/mesh/mesh.h @@ -0,0 +1,21 @@ +#pragma once +#include +#include "../shaders/Shader.h" + +namespace Nebulix { + class Mesh + { + public: + /// + /// Creates a new mesh using the default shader + /// + /// The list of vertices of this mesh + /// A list of faces, where each face contains the 3 indices of the given vertices used for constructing a triangle + Mesh(const std::vector &vertices, const std::vector &faces); + Mesh(const std::vector &vertices, const std::vector &faces, Shader shader); + ~Mesh(); + + private: + + }; +}