26 lines
661 B
C++
26 lines
661 B
C++
// Copyright (c) 2022 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#include "display/mesh/Mesh.hpp"
|
|
#include "display/mesh/TriangleMesh.hpp"
|
|
|
|
using namespace Dawn;
|
|
|
|
void TriangleMesh::createTriangleMesh(std::shared_ptr<Mesh> mesh) {
|
|
mesh->createBuffers(3, 3);
|
|
mesh->bufferPositions(0, std::array<glm::vec3, 3>{{
|
|
glm::vec3(-1, 0, 0),
|
|
glm::vec3(0, 1, 0),
|
|
glm::vec3(1, 0, 0)
|
|
}});
|
|
mesh->bufferCoordinates(0, std::array<glm::vec2, 3>{{
|
|
glm::vec2(0, 0),
|
|
glm::vec2(0, 1),
|
|
glm::vec2(1, 0)
|
|
}});
|
|
mesh->bufferIndices(0, std::array<meshindice_t,3>{{
|
|
0, 1, 2
|
|
}});
|
|
} |