Files
panopainter/src/canvas_layer.h

52 lines
1.4 KiB
C++

#pragma once
#include "rtt.h"
#include "log.h"
#include "texture.h"
class LayerFrame
{
};
class Layer
{
static uint32_t s_count;
public:
Layer() { id = s_count++; }
Layer(const Layer&) = delete;
~Layer() { LOG("LAYER AUTO DESTROY"); destroy(); }
uint32_t id;
RTT m_rtt[6];
std::array<glm::vec4, 6> m_dirty_box = SIXPLETTE(glm::vec4(0));
std::array<bool, 6> m_dirty_face = SIXPLETTE(false);
bool m_visible = true;
bool m_alpha_locked = false;
float m_opacity = 1.f;
bool m_hightlight = false;
int m_blend_mode = 0;
std::string m_name;
int w = 0;
int h = 0;
struct Snapshot
{
std::unique_ptr<uint8_t[]> image[6] = SIXPLETTE(0);
std::array<glm::vec4, 6> m_dirty_box = SIXPLETTE(glm::vec4(0));
std::array<bool, 6> m_dirty_face = SIXPLETTE(false);
int width = 0;
int height = 0;
void create(int w, int h);
void clear();
void optimize();
int memsize() const;
};
void resize(int width, int height);
bool create(int width, int height, std::string name);
void clear(const glm::vec4& c);
Snapshot snapshot(std::array<glm::vec4, 6>* dirty_box = nullptr, std::array<bool, 6>* dirty_face = nullptr);
TextureCube gen_cube();
Texture2D gen_equirect();
void restore(const Snapshot& snap);
void destroy();
void optimize();
};