mixer brush wip

This commit is contained in:
2018-08-01 10:48:04 +02:00
parent 5c2264ba8b
commit 57e2fa1abd
9 changed files with 84 additions and 14 deletions

View File

@@ -2,6 +2,7 @@
#include "app.h"
#include "log.h"
#include "node_canvas.h"
#include "node_image_texture.h"
Node* NodeCanvas::clone_instantiate() const
{
@@ -14,6 +15,7 @@ void NodeCanvas::init()
m_canvas = std::make_unique<ui::Canvas>();
m_canvas->create(CANVAS_RES, CANVAS_RES);
m_canvas->m_unsaved = false;
m_canvas->m_node = this;
m_sampler.create(GL_NEAREST);
m_sampler_linear.create(GL_LINEAR);
m_sampler_stencil.create(GL_LINEAR, GL_REPEAT);
@@ -73,6 +75,7 @@ void NodeCanvas::draw()
m_canvas->m_mv = camera;
m_canvas->m_proj = proj;
m_canvas->m_box = box;
m_canvas->m_vp = c;
// auto plane_mvp = proj * camera * transform *
// glm::scale(glm::vec3(sz, 1));
@@ -267,6 +270,9 @@ void NodeCanvas::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
{
if (new_size.x > m_canvas->m_width)
{
m_canvas->m_mixer.create((int)new_size.x, (int)new_size.y);
if (auto img = root()->find<NodeImageTexture>("tex-debug"))
img->tex.assign(m_canvas->m_mixer.getTextureID());
// m_canvas->resize((int)new_size.x, (int)new_size.y);
// m_canvas->clear();
}