diff --git a/.gitmodules b/.gitmodules index 4613c87..6d2a66e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,12 @@ [submodule "libs/base64"] path = libs/base64 url = https://github.com/tkislan/base64 +[submodule "libs/bugtrap"] + path = libs/bugtrap + url = https://github.com/bchavez/BugTrap.git +[submodule "libs/bugtrap-client"] + path = libs/bugtrap-client + url = https://omigamedev@bitbucket.org/omigamedev/bugtrap-client-x64.git +[submodule "libs/curl-win"] + path = libs/curl-win + url = https://omigamedev@bitbucket.org/omigamedev/curl-win64.git diff --git a/engine.vcxproj b/engine.vcxproj index 906243b..9428af5 100644 --- a/engine.vcxproj +++ b/engine.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -22,19 +22,19 @@ {6D5028CE-4D76-4B6A-A7C2-DE5A3268D433} Win32Proj engine - 8.1 + 10.0.16299.0 Application true - v140 + v141 Unicode Application false - v140 + v141 true Unicode @@ -76,8 +76,8 @@ true - libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\source\Client;libs\poly2tri\poly2tri;libs\base64;$(IncludePath) - libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\bin;$(LibraryPath) + libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;libs\bugtrap-client\include;libs\poly2tri\poly2tri;libs\base64;$(IncludePath) + libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);libs\bugtrap-client\lib;$(LibraryPath) false @@ -86,8 +86,8 @@ false - libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\source\Client;libs\poly2tri\poly2tri;libs\base64;$(IncludePath) - libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);C:\Users\omar\Downloads\BugTrap-master\BugTrap-master\bin;$(LibraryPath) + libs\glm;libs\glew-2.0.0\include;libs\stb;libs\tinyxml2;libs\yoga;libs\curl-win\include;libs\jpeg;libs\wacom;libs\bugtrap-client\include;libs\poly2tri\poly2tri;libs\base64;$(IncludePath) + libs\curl-win\lib\dll-$(Configuration)-$(PlatformShortName);libs\glew-2.0.0\lib\Release\$(Platform);libs\bugtrap-client\lib;$(LibraryPath) @@ -275,14 +275,10 @@ Use - NotUsing - NotUsing NotUsing NotUsing - NotUsing - NotUsing NotUsing NotUsing @@ -354,6 +350,9 @@ + + + diff --git a/engine.vcxproj.filters b/engine.vcxproj.filters index 92f98e7..6b5e266 100644 --- a/engine.vcxproj.filters +++ b/engine.vcxproj.filters @@ -19,24 +19,27 @@ {2c3e7ce5-d3f4-4731-b05f-5e288c7e6e63} - + {6d64b115-02d1-43e0-86c8-c8212f51162d} - + {dc178d53-6a6d-4a18-a93c-d4994340515f} - + {54dc9f46-d2e0-466c-90d2-eb5d72d5799d} - + {a4a12057-835e-47ff-be4d-ce58b36cecf5} - + {6fe315aa-e2b9-4f01-8291-683a5fda123b} - + {bda6fa93-a186-41ca-9bd9-49b7e0fd1ca4} + + {e631ac80-1b9b-424f-8adf-e2bab71a566d} + @@ -178,25 +181,19 @@ Source Files - Source Files\libs\jpeg + libs\jpeg - Source Files\libs\jpeg - - - Source Files\libs\yoga - - - Source Files\libs\yoga + libs\jpeg - Source Files\libs\tinyxml2 + libs\tinyxml2 Source Files - Source Files\libs\WinTab + libs\WinTab Source Files\ui @@ -205,19 +202,19 @@ Source Files - Source Files\libs\poly2tri + libs\poly2tri - Source Files\libs\poly2tri + libs\poly2tri - Source Files\libs\poly2tri + libs\poly2tri - Source Files\libs\poly2tri + libs\poly2tri - Source Files\libs\poly2tri + libs\poly2tri Source Files\ui @@ -243,6 +240,12 @@ Source Files\ui + + libs\yoga + + + libs\yoga + @@ -372,40 +375,28 @@ Header Files\ui - Source Files\libs\jpeg + libs\jpeg - Source Files\libs\jpeg - - - Source Files\libs\yoga - - - Source Files\libs\yoga - - - Source Files\libs\yoga - - - Source Files\libs\yoga + libs\jpeg - Source Files\libs\tinyxml2 + libs\tinyxml2 Header Files - Source Files\libs\WinTab + libs\WinTab - Source Files\libs\WinTab + libs\WinTab - Source Files\libs\WinTab + libs\WinTab - Source Files\libs\WinTab + libs\WinTab Header Files\ui @@ -431,10 +422,27 @@ Header Files\ui + + libs\yoga + + + libs\yoga + + + libs\yoga + + + libs\yoga + Resource Files + + + extras + + \ No newline at end of file diff --git a/engine/brush.h b/engine/brush.h index b2dcc24..c7a9e92 100644 --- a/engine/brush.h +++ b/engine/brush.h @@ -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& 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 m_curve_angles; diff --git a/engine/canvas.cpp b/engine/canvas.cpp index d9ea426..ef30858 100644 --- a/engine/canvas.cpp +++ b/engine/canvas.cpp @@ -580,7 +580,8 @@ void ui::Canvas::stroke_start(glm::vec2 point, float pressure, const ui::Brush& } m_current_stroke = std::make_unique(); - 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); diff --git a/engine/canvas.h b/engine/canvas.h index ccc429e..0156143 100644 --- a/engine/canvas.h +++ b/engine/canvas.h @@ -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 image[6]; - glm::vec4 m_dirty_box[6]; - bool m_dirty_face[6]; + std::unique_ptr 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 m_current_stroke; bool m_show_tmp = false; std::vector m_layers; std::vector 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 m_pick_data[6]; + std::unique_ptr 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; diff --git a/engine/font.cpp b/engine/font.cpp index 0e3afdc..b1f4a47 100644 --- a/engine/font.cpp +++ b/engine/font.cpp @@ -67,8 +67,8 @@ void TextMesh::update(kFont id, const char* text) float y = 0; std::vector v; std::vector 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; diff --git a/engine/font.h b/engine/font.h index eaccdb6..a34b2be 100644 --- a/engine/font.h +++ b/engine/font.h @@ -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(); diff --git a/engine/node.cpp b/engine/node.cpp index ef1ac11..31253e5 100644 --- a/engine/node.cpp +++ b/engine/node.cpp @@ -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 diff --git a/engine/node.h b/engine/node.h index fa47b58..c6e3097 100644 --- a/engine/node.h +++ b/engine/node.h @@ -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); diff --git a/engine/pch.h b/engine/pch.h index 1a6380a..8e46cf1 100644 --- a/engine/pch.h +++ b/engine/pch.h @@ -72,6 +72,7 @@ #define NS_START namespace ui { #define NS_END } +#define SIXPLETTE(I) {I, I, I, I, I, I} #ifdef __cplusplus #include diff --git a/engine/rtt.h b/engine/rtt.h index 01cb89a..b73b0c6 100644 --- a/engine/rtt.h +++ b/engine/rtt.h @@ -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(); diff --git a/engine/shape.h b/engine/shape.h index e39bbed..731d1e8 100644 --- a/engine/shape.h +++ b/engine/shape.h @@ -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; }; diff --git a/engine/texture.h b/engine/texture.h index 82b4547..e0ada03 100644 --- a/engine/texture.h +++ b/engine/texture.h @@ -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); diff --git a/engine/util.h b/engine/util.h index 3234666..f68d324 100644 --- a/engine/util.h +++ b/engine/util.h @@ -32,9 +32,9 @@ inline glm::vec2 xy(const glm::vec3& v) { return glm::vec2(v.x, v.y); } template 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; diff --git a/engine/wacom.cpp b/engine/wacom.cpp index 3a32526..a5a8b51 100644 --- a/engine/wacom.cpp +++ b/engine/wacom.cpp @@ -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)