fix debug build with vs2017

This commit is contained in:
2018-02-10 18:53:56 +01:00
parent 0d7217af7b
commit 72603d5df8
16 changed files with 176 additions and 115 deletions

View File

@@ -31,11 +31,11 @@ public:
struct StrokeSample
{
glm::vec2 pos;
glm::vec2 origin;
float size;
float flow;
float angle;
glm::vec2 pos = { 0, 0 };
glm::vec2 origin = { 0,0 };
float size = 0;
float flow = 0;
float angle = 0;
};
class BrushMesh
@@ -45,8 +45,8 @@ public:
GLuint vao{ 0 };
struct vertex_t { glm::vec4 pos; glm::vec2 uvs; };
struct instance_t { glm::mat4 mvp; float flow; };
int loc_flow;
int loc_mvp;
int loc_flow = 0;
int loc_mvp = 0;
bool create();
void draw(const std::vector<StrokeSample>& samples, const glm::mat4& proj);
@@ -57,19 +57,19 @@ class Stroke
public:
struct Keypoint
{
glm::vec2 pos;
float pressure;
float dist;
glm::vec2 pos = { 0, 0 };
float pressure = 0;
float dist = 0;
};
struct Camera
{
glm::vec2 rot;
float fov;
glm::vec2 rot = { 0, 0 };
float fov = 0;
};
int m_layer;
float m_curve;
float m_dist;
float m_step;
int m_layer = 0;
float m_curve = 0;
float m_dist = 0;
float m_step = 0;
Camera m_camera;
ui::Brush m_brush;
cbuffer<float, 3> m_curve_angles;

View File

@@ -580,7 +580,8 @@ void ui::Canvas::stroke_start(glm::vec2 point, float pressure, const ui::Brush&
}
m_current_stroke = std::make_unique<Stroke>();
m_current_stroke->m_camera = { m_cam_rot, m_cam_fov };
m_current_stroke->m_camera.rot = m_cam_rot;
m_current_stroke->m_camera.fov = m_cam_fov;
m_current_stroke->start(brush);
m_current_stroke->add_point(point, pressure);

View File

@@ -15,19 +15,20 @@ class Layer
{
public:
RTT m_rtt[6];
glm::vec4 m_dirty_box[6];
bool m_dirty_face[6];
glm::vec4 m_dirty_box[6] = SIXPLETTE(glm::vec4(0));
bool m_dirty_face[6] = SIXPLETTE(false);
bool m_visible = true;
bool m_alpha_locked = false;
float m_opacity = 1.f;
bool m_hightlight = false;
std::string m_name;
int w, h;
int w = 0;
int h = 0;
struct Snapshot
{
std::unique_ptr<uint8_t[]> image[6];
glm::vec4 m_dirty_box[6];
bool m_dirty_face[6];
std::unique_ptr<uint8_t[]> image[6] = SIXPLETTE(0);
glm::vec4 m_dirty_box[6] = SIXPLETTE(glm::vec4(0));
bool m_dirty_face[6] = SIXPLETTE(false);
void create(int w, int h)
{
for (int i = 0; i < 6; i++)
@@ -53,20 +54,20 @@ public:
static Canvas* I;
bool m_alpha_lock = false;
bool m_touch_lock = true;
glm::mat4 m_mv;
glm::mat4 m_proj;
glm::vec4 m_box;
glm::vec2 m_pan;
int m_width;
int m_height;
glm::mat4 m_mv{ 1 };
glm::mat4 m_proj{ 1 };
glm::vec4 m_box{ 0 };
glm::vec2 m_pan{ 0 };
int m_width = 0;
int m_height = 0;
bool m_use_instanced = false;
int m_current_layer_idx = 0;
std::unique_ptr<Stroke> m_current_stroke;
bool m_show_tmp = false;
std::vector<Layer> m_layers;
std::vector<int> m_order;
glm::vec4 m_dirty_box[6];
bool m_dirty_face[6];
glm::vec4 m_dirty_box[6] = SIXPLETTE(glm::vec4(0));
bool m_dirty_face[6] = SIXPLETTE(false);
Layer m_smask; // selection mask
bool m_smask_active = false;
RTT m_tmp[6];
@@ -74,7 +75,7 @@ public:
Texture2D m_tex[6];
Texture2D m_tex2[6];
bool m_pick_ready[6];
std::unique_ptr<glm::u8vec4[]> m_pick_data[6];
std::unique_ptr<glm::u8vec4[]> m_pick_data[6] = SIXPLETTE(nullptr);
static glm::vec3 m_plane_origin[6];
static glm::vec3 m_plane_normal[6];
static glm::vec3 m_plane_tangent[6];
@@ -84,8 +85,8 @@ public:
Sampler m_sampler_bg;
Sampler m_sampler_mask;
Sampler m_sampler_stencil;
glm::vec2 m_cam_rot;
glm::vec3 m_cam_pos;
glm::vec2 m_cam_rot{ 0 };
glm::vec3 m_cam_pos{ 0 };
float m_cam_fov = 85;
Brush m_current_brush;

View File

@@ -67,8 +67,8 @@ void TextMesh::update(kFont id, const char* text)
float y = 0;
std::vector<glm::vec4> v;
std::vector<GLushort> idx;
glm::vec2 bbmin;
glm::vec2 bbmax;
glm::vec2 bbmin(FLT_MAX);
glm::vec2 bbmax(-FLT_MAX);
for (int i = 0; i < len; i++)
{
int c = text[i] - f.start_char;

View File

@@ -41,7 +41,7 @@ public:
int font_array_count = 0;
GLuint font_buffers[2] = {0, 0};
kFont font_id;
glm::vec2 bb;
glm::vec2 bb = { 0, 0 };
bool create();
void update(kFont id, const char* text);
void draw();

View File

@@ -371,6 +371,26 @@ Node::Node(Node&& o)
m_mouse_ignore = o.m_mouse_ignore;
o.y_node = nullptr;
o.parent = nullptr;
m_manager = o.m_manager;
current_mouse_capture = o.current_mouse_capture;
current_key_capture = o.current_key_capture;
m_mouse_captured = o.m_mouse_captured;
m_key_captured = o.m_key_captured;
m_proj = o.m_proj;
m_mvp = o.m_mvp;
m_mouse_inside = o.m_mouse_inside;
m_flood_events = o.m_flood_events;
m_capture_children = o.m_capture_children;
m_destroyed = o.m_destroyed;
m_scale = o.m_scale;
m_pos_origin = o.m_pos_origin;
m_pos_offset = o.m_pos_offset;
m_pos_offset_childred = o.m_pos_offset_childred;
m_clip_uncut = o.m_clip_uncut;
}
Node::~Node()
@@ -886,6 +906,24 @@ void Node::clone_copy(Node* dest) const
dest->m_size = m_size;
dest->m_clip = m_clip;
dest->m_flood_events = m_flood_events;
dest->m_manager = m_manager;
dest->current_mouse_capture = current_mouse_capture;
dest->current_key_capture = current_key_capture;
dest->m_mouse_captured = m_mouse_captured;
dest->m_key_captured = m_key_captured;
dest->m_proj = m_proj;
dest->m_mvp = m_mvp;
dest->m_mouse_inside = m_mouse_inside;
dest->m_capture_children = m_capture_children;
dest->m_destroyed = m_destroyed;
dest->m_scale = m_scale;
dest->m_pos_origin = m_pos_origin;
dest->m_pos_offset = m_pos_offset;
dest->m_pos_offset_childred = m_pos_offset_childred;
dest->m_clip_uncut = m_clip_uncut;
}
void Node::clone_children(Node* dest) const

View File

@@ -104,16 +104,17 @@ public:
bool m_mouse_ignore = true;
float m_zoom = 1.f;
glm::vec2 m_scale{ 1.f };
glm::vec2 m_pos;
glm::vec2 m_pos_origin; // original layout position without offset
glm::vec2 m_pos_offset; // artificial position offset for scrolling
glm::vec2 m_pos_offset_childred; // artificial position offset for scrolling
glm::vec2 m_size;
glm::vec4 m_clip;
glm::vec4 m_clip_uncut;
glm::vec2 m_scale{ 1, 1 };
glm::vec2 m_pos{ 0, 0 };
glm::vec2 m_pos_origin{ 0, 0 }; // original layout position without offset
glm::vec2 m_pos_offset{ 0, 0 }; // artificial position offset for scrolling
glm::vec2 m_pos_offset_childred{ 0, 0 }; // artificial position offset for scrolling
glm::vec2 m_size{ 0, 0 };
glm::vec4 m_clip{ 0, 0, 0, 0 };
glm::vec4 m_clip_uncut{ 0, 0, 0, 0 };
std::string m_name;
bool m_display = true;
Node(const Node&) = delete;
Node& operator=(const Node&) = delete;
Node&& operator=(Node&& o);

View File

@@ -72,6 +72,7 @@
#define NS_START namespace ui {
#define NS_END }
#define SIXPLETTE(I) {I, I, I, I, I, I}
#ifdef __cplusplus
#include <map>

View File

@@ -7,8 +7,8 @@ class RTT
GLuint fboID = 0;
GLuint rboID = 0;
GLuint texID = 0;
int w;
int h;
int w = 0;
int h = 0;
public:
RTT();

View File

@@ -13,10 +13,10 @@ namespace ui {
class Shape
{
protected:
GLuint buffers[2]{ 0 };
GLuint arrays[2]{ 0 };
GLuint count[2]{ 0 };
GLvoid* ioff[2]{ 0 };
GLuint buffers[2]{ 0, 0 };
GLuint arrays[2]{ 0, 0 };
GLuint count[2]{ 0, 0 };
GLvoid* ioff[2]{ 0, 0 };
bool use_idx = true;
public:
struct vertex_t { glm::vec4 pos; glm::vec2 uvs; };

View File

@@ -3,11 +3,11 @@
class Texture2D
{
GLuint m_tex;
int m_width;
int m_height;
GLint m_format;
GLint m_iformat;
GLuint m_tex = 0;
int m_width = 0;
int m_height = 0;
GLint m_format = 0;
GLint m_iformat = 0;
public:
bool create(int width, int height, GLint internal_format = GL_RGBA8, GLint format = GL_RGBA, const uint8_t* data = nullptr);
bool create(const ui::Image& img);
@@ -25,8 +25,8 @@ public:
class Sampler
{
GLuint id;
GLint current_unit;
GLuint id = 0;
GLint current_unit = 0;
public:
bool create(GLint filter = GL_LINEAR, GLint wrap = GL_CLAMP_TO_EDGE);
void set(GLint filter = GL_LINEAR, GLint wrap = GL_CLAMP_TO_EDGE);

View File

@@ -32,9 +32,9 @@ inline glm::vec2 xy(const glm::vec3& v) { return glm::vec2(v.x, v.y); }
template<typename T, int N> struct cbuffer
{
T m_vec[N];
int m_capacity;
int m_count;
int m_index;
int m_capacity = 0;
int m_count = 0;
int m_index = 0;
cbuffer()
{
m_capacity = N;

View File

@@ -153,8 +153,11 @@ bool WacomTablet::init(HWND hWnd)
void WacomTablet::terminate()
{
gpWTClose(g_hCtx);
UnloadWintab();
if (gpWTClose)
{
gpWTClose(g_hCtx);
UnloadWintab();
}
}
void WacomTablet::handle_message(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)