30 lines
729 B
C++
30 lines
729 B
C++
// Copyright (c) 2023 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#include "QuadMeshHost.hpp"
|
|
|
|
using namespace Dawn;
|
|
|
|
QuadMeshHost::QuadMeshHost(std::weak_ptr<SceneItem> item) :
|
|
xy0(glm::vec2(-0.5f, -0.5f)), xy1(glm::vec2(0.5f, 0.5f)),
|
|
uv0(glm::vec2(0, 0)), uv1(glm::vec2(1, 1)),
|
|
MeshHost(item)
|
|
{
|
|
}
|
|
|
|
void QuadMeshHost::onStart() {
|
|
this->mesh.createBuffers(QUAD_VERTICE_COUNT, QUAD_INDICE_COUNT);
|
|
|
|
useEffect([&]{
|
|
QuadMesh::bufferQuadMesh(
|
|
this->mesh,
|
|
glm::vec2(this->xy0),
|
|
glm::vec2(this->uv0),
|
|
glm::vec2(this->xy1),
|
|
glm::vec2(this->uv1),
|
|
0, 0
|
|
);
|
|
}, { &this->xy0, &this->xy1, &this->uv0, &this->uv1 })();
|
|
} |