Started fixing texture tool (incomplete)
This commit is contained in:
@ -9,5 +9,6 @@ target_sources(${DAWN_TARGET_NAME}
|
||||
MeshRenderer.cpp
|
||||
CubeMeshHost.cpp
|
||||
CapsuleMeshHost.cpp
|
||||
QuadMeshHost.cpp
|
||||
MeshHost.cpp
|
||||
)
|
30
src/dawn/scene/components/display/mesh/QuadMeshHost.cpp
Normal file
30
src/dawn/scene/components/display/mesh/QuadMeshHost.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
// 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(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 })();
|
||||
}
|
25
src/dawn/scene/components/display/mesh/QuadMeshHost.hpp
Normal file
25
src/dawn/scene/components/display/mesh/QuadMeshHost.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "MeshHost.hpp"
|
||||
#include "display/mesh/QuadMesh.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class QuadMeshHost : public MeshHost {
|
||||
public:
|
||||
// @optional
|
||||
StateProperty<glm::vec2> xy0;
|
||||
// @optional
|
||||
StateProperty<glm::vec2> xy1;
|
||||
// @optional
|
||||
StateProperty<glm::vec2> uv0;
|
||||
// @optional
|
||||
StateProperty<glm::vec2> uv1;
|
||||
|
||||
QuadMeshHost(SceneItem *item);
|
||||
void onStart() override;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user