38 lines
956 B
C++
38 lines
956 B
C++
// Copyright (c) 2022 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#include "QuadMesh.hpp"
|
|
|
|
using namespace Dawn;
|
|
|
|
void QuadMesh::bufferQuadMeshWithZ(
|
|
Mesh &mesh,
|
|
glm::vec2 xy0, glm::vec2 uv0,
|
|
glm::vec2 xy1, glm::vec2 uv1,
|
|
float_t z, int32_t verticeStart, int32_t indiceStart
|
|
) {
|
|
mesh.bufferPositions(
|
|
verticeStart, std::array<glm::vec3, QUAD_VERTICE_COUNT>{{
|
|
glm::vec3(xy0, z),
|
|
glm::vec3(xy1.x, xy0.y, z),
|
|
glm::vec3(xy0.x, xy1.y, z),
|
|
glm::vec3(xy1, z)
|
|
}}
|
|
);
|
|
|
|
mesh.bufferCoordinates(
|
|
verticeStart, std::array<glm::vec2, QUAD_VERTICE_COUNT>{{
|
|
uv0, glm::vec2(uv1.x, uv0.y),
|
|
glm::vec2(uv0.x, uv1.y), uv1
|
|
}}
|
|
);
|
|
|
|
mesh.bufferIndices(
|
|
indiceStart, std::array<meshindice_t, QUAD_INDICE_COUNT>{{
|
|
verticeStart, verticeStart + 1, verticeStart + 2,
|
|
verticeStart + 1, verticeStart + 2, verticeStart + 3
|
|
}}
|
|
);
|
|
} |