41 lines
880 B
C++
41 lines
880 B
C++
#pragma once
|
|
#include "rtt.h"
|
|
#include "texture.h"
|
|
#include "shader.h"
|
|
#include "shape.h"
|
|
#include "brush.h"
|
|
|
|
NS_START
|
|
|
|
class Canvas
|
|
{
|
|
Stroke* m_current_stroke = nullptr;
|
|
Plane m_plane;
|
|
BrushMesh m_mesh;
|
|
int m_current_layer_idx = 0;
|
|
public:
|
|
int m_width;
|
|
int m_height;
|
|
bool m_use_instanced = false;
|
|
bool m_show_tmp = false;
|
|
std::vector<Layer> m_layers;
|
|
std::vector<Stroke> m_strokes;
|
|
RTT m_tmp;
|
|
RTT m_fb;
|
|
Texture2D m_tex;
|
|
Sampler m_sampler;
|
|
Sampler m_sampler_bg;
|
|
|
|
bool create(int width, int height);
|
|
void resize(int width, int height);
|
|
void layer_add(std::string name);
|
|
void stroke_start(glm::vec2 point, float pressure, const ui::Brush& brush);
|
|
void stroke_update(glm::vec2 point, float pressure);
|
|
void stroke_draw();
|
|
void stroke_end();
|
|
void stroke_commit();
|
|
void clear();
|
|
};
|
|
|
|
NS_END
|