implement basic paint canvas
This commit is contained in:
58
engine/brush.h
Normal file
58
engine/brush.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
#include "rtt.h"
|
||||
|
||||
NS_START
|
||||
|
||||
class Brush
|
||||
{
|
||||
public:
|
||||
int id;
|
||||
std::string m_name;
|
||||
uint16_t m_tex_id;
|
||||
glm::vec4 m_tip_color;
|
||||
float m_tip_size;
|
||||
float m_tip_spacing;
|
||||
float m_tip_flow;
|
||||
float m_tip_angle;
|
||||
float m_jitter_scale;
|
||||
float m_jitter_angle;
|
||||
float m_jitter_spread;
|
||||
float m_jitter_flow;
|
||||
};
|
||||
|
||||
class Stroke
|
||||
{
|
||||
public:
|
||||
struct Keypoint
|
||||
{
|
||||
glm::vec2 pos;
|
||||
float pressure;
|
||||
};
|
||||
int m_layer;
|
||||
float m_dist;
|
||||
ui::Brush m_brush;
|
||||
std::vector<Keypoint> m_keypoints;
|
||||
void add_point(glm::vec2 pos, float pressure)
|
||||
{
|
||||
m_keypoints.emplace_back();
|
||||
m_keypoints.back().pos = pos;
|
||||
m_keypoints.back().pressure = pressure;
|
||||
}
|
||||
};
|
||||
|
||||
class Layer
|
||||
{
|
||||
public:
|
||||
RTT m_rtt;
|
||||
bool m_visible = true;
|
||||
bool m_locked = false;
|
||||
float m_alpha = 1.f;
|
||||
std::string m_name;
|
||||
bool create(int width, int height, std::string name)
|
||||
{
|
||||
m_rtt.create(width, height);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
NS_END
|
||||
Reference in New Issue
Block a user