added sample for a mesh class used for rendering an object (maybe more like a mesh component?)
This commit is contained in:
parent
82649e7648
commit
6aa1460068
|
@ -153,6 +153,7 @@
|
||||||
<ClInclude Include="Exceptions\IOException.h" />
|
<ClInclude Include="Exceptions\IOException.h" />
|
||||||
<ClInclude Include="Exceptions\Shaders\CreateProgramException.h" />
|
<ClInclude Include="Exceptions\Shaders\CreateProgramException.h" />
|
||||||
<ClInclude Include="Exceptions\Shaders\ShaderCompileException.h" />
|
<ClInclude Include="Exceptions\Shaders\ShaderCompileException.h" />
|
||||||
|
<ClInclude Include="mesh\mesh.h" />
|
||||||
<ClInclude Include="Shaders\Enums.h" />
|
<ClInclude Include="Shaders\Enums.h" />
|
||||||
<ClInclude Include="Shaders\Shader.h" />
|
<ClInclude Include="Shaders\Shader.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -41,6 +41,9 @@
|
||||||
<ClInclude Include="Exceptions\Shaders\CreateProgramException.h">
|
<ClInclude Include="Exceptions\Shaders\CreateProgramException.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="mesh\mesh.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CopyFileToFolders Include="Shaders\default\default.frag" />
|
<CopyFileToFolders Include="Shaders\default\default.frag" />
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "shaders/Shader.h"
|
#include "shaders/Shader.h"
|
||||||
|
|
||||||
// Continue: https://learnopengl.com/Getting-started/Shaders
|
// Continue: https://learnopengl.com/Getting-started/Textures
|
||||||
// Chapter: Not yet started
|
// Chapter: Not yet started
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -74,6 +74,8 @@ int main()
|
||||||
1, 2, 3
|
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;
|
GLuint vertexBufferObject, elementBufferObject, vertexArrayObject;
|
||||||
glGenVertexArrays(1, &vertexArrayObject);
|
glGenVertexArrays(1, &vertexArrayObject);
|
||||||
glGenBuffers(1, &vertexBufferObject);
|
glGenBuffers(1, &vertexBufferObject);
|
||||||
|
|
21
src/Engine/mesh/mesh.h
Normal file
21
src/Engine/mesh/mesh.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#pragma once
|
||||||
|
#include <vector>
|
||||||
|
#include "../shaders/Shader.h"
|
||||||
|
|
||||||
|
namespace Nebulix {
|
||||||
|
class Mesh
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new mesh using the default shader
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vertices">The list of vertices of this mesh</param>
|
||||||
|
/// <param name="faces">A list of faces, where each face contains the 3 indices of the given vertices used for constructing a triangle</param>
|
||||||
|
Mesh(const std::vector<GLfloat> &vertices, const std::vector<GLfloat[3]> &faces);
|
||||||
|
Mesh(const std::vector<GLfloat> &vertices, const std::vector<GLfloat[3]> &faces, Shader shader);
|
||||||
|
~Mesh();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user