From ec154633be7c1159dbadde0f8629b6e340998818 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Sun, 1 Apr 2018 22:21:47 +0800 Subject: [PATCH] Add logo. Jezzasoft Font family: Myriad Pro Bold Font size: 32px Dust3D Font family: Klavika Bold Font size: 48px GIMP: Font color: black Adjust brightness and Contrast Contrast: -50 --- dust3d_jezzasoft.xcf | Bin 0 -> 4104 bytes resources.qrc | 1 + resources/dust3d_jezzasoft.png | Bin 0 -> 2087 bytes src/mainwindow.cpp | 13 +++++++++++++ src/mesh.cpp | 16 ++++++++++------ src/skeletoneditgraphicsview.cpp | 8 ++++++-- src/skeletonsnapshot.cpp | 7 +++++++ src/skeletontomesh.cpp | 15 ++++++++------- src/theme.cpp | 9 +++++---- src/theme.h | 1 + src/unionmesh.cpp | 3 +++ 11 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 dust3d_jezzasoft.xcf create mode 100644 resources/dust3d_jezzasoft.png diff --git a/dust3d_jezzasoft.xcf b/dust3d_jezzasoft.xcf new file mode 100644 index 0000000000000000000000000000000000000000..c92d2f589d2d87f91f397cd7a17beaa27e94c122 GIT binary patch literal 4104 zcmeHKeQ;D)6~FIe-+ts{^Bst`z6n!Ei<`jErdpFX1zH0rAB|}PAt`Ql-!2RL5q3A2 zM5R(b3fiI>M#dV)DrzO9MN5@hMVvZNz!1P0p(!SmSPHZ@DJdb@-S^&J&w0B`H-)Ny zIpYj>=Is5w-#zEt`|dsWoVRX|uSINgxI~x7D-&o_L4pXN<$^E_{N#g}=6#P46let? zJctpbD2Y+85cF%H&vJuXnbE+@w>&@skwk`zZIF}Y^{DzSoHWEtK|^d2VAa@9KNwYw7!{2Fq2Jj zACisPmqO6vcCQ7&9kncyJ38#4fJ@(F78q;-2p$dvF(ol-o0Awi^64~eNy8awI5Q1r zrC}>z^vi+ZTo?p6AGTCr;1~wO3g{Cj9G2U{Hm|*1)`JUAxVp?|53X%(5lgEQK&paG z^oy>5KV02dy0|^)u{*_O!GJg~;B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7mvX8)IGrmUlb z4?dpv*p{{x4be=S3$&*iHsNG5rxKM5jGNo3s;MpnrSQM zn8CXs&d2#Bf9t(KBmGB@Gsl(Q0}v}l5;Lr${WXvT$GGVY55pHB%kvDekg<%rip|72 z-@fvJY`F6i%%b754P?Da8LDl_1jC3yro$_z9>NPhHV24NQ;-hKo%c39bSz4j^N@~4 zjV<)8`t|g3^<$UlR}IMU4m#0$hW@tbkxR6m2P^HN>);`>kpw=B&u4+SmbZCCQC_>B zY>JJ{fJ-u#^ZCUKrt?IsU7iU!2ojN*XuR1Zm^3rKfNHd#KP{YA&)4FVnz@wresources/rotate.svg resources/zoomin.svg resources/zoomout.svg + resources/dust3d_jezzasoft.png \ No newline at end of file diff --git a/resources/dust3d_jezzasoft.png b/resources/dust3d_jezzasoft.png new file mode 100644 index 0000000000000000000000000000000000000000..0e5d3fb85355f5a3c52e3aa013ac81eabf96bf3d GIT binary patch literal 2087 zcmV+?2-x?DP)P0043b1^@s6rrLV?00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru;sgN>4J9s6R*V1u03B&m zSad^gZEa<4bN~PV002XBWnpw>WFU8GbZ8()Nlj2>E@cM*00)anL_t(&-tC%sjAT_6 z#(%G>dYPqX254r0L23j$h#3`SUp#1Vl*pp2Za|EQA*gXo6e2_vF~lX~!e2%SE-VQN z5|*HX5nGN-f(U~!(1^e=4{*fU5W1%~YVnWyUcA24@?Q7r#F)8BC0$jo-?{fJ-}jyK z3ihtOYoS&&-y4`&KX4i_?(U;zb{sI`?l&jbROV?Q0zM6_2PVvH3^)#W1SrM`umqTt zM@qmT@N3{_;YIT`@-g60;3vQYa3io7s26Eu2XM7+It`pIBYyy{O)e_W$3h&(&s3|` z9lG(~fqwzpfXCuE9!st(%{RN;{U+c_8CWJ`zYDJ^6_CPZWz>nl^S}wfmkTu_myZB{ z1AYiR0lcGVBX0n|0ZsxQ20jAZQfS2oZd(f+4s3PzM~jA)3UC%M1gr!u0W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g}0`$`wqc7-$ zs5GasM7m}H3AkcK_$l+vfV`_|mpn@ zl+=MST2FfRbU=(cuwB%jZPB zQ5#RJQ2|D3H%82CM|hf22Shzef6oFpsiIFwzuf(JTE8gRr0W+;RP^k$qCm_|0QU=3 z>mB0pq+0BE@t+@(-6Nj>&%BQhGov}WFsZ75M!nb|=am~|T24$Y@OSpj?(xTZ%M z4|QupDm~m)QZu@IJ_TOs;DT|1VLc~;42hC^8mVbOwz3N#c3J~U=Q{tF>)#(VLPr4X RbbbH;002ovPDHLkV1g2~+)Dre literal 0 HcmV?d00001 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 440ccaa7..e87da7e6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "mainwindow.h" #include "skeletonwidget.h" @@ -93,10 +94,22 @@ MainWindow::MainWindow() modelRightLayout->addStretch(); + QLabel *dust3dJezzasoftLabel = new QLabel; + QImage dust3dJezzasoftImage; + dust3dJezzasoftImage.load(":/resources/dust3d_jezzasoft.png"); + dust3dJezzasoftLabel->setPixmap(QPixmap::fromImage(dust3dJezzasoftImage)); + + QVBoxLayout *mainLeftLayout = new QVBoxLayout; + mainLeftLayout->addStretch(); + mainLeftLayout->addWidget(dust3dJezzasoftLabel); + mainLeftLayout->setSpacing(0); + mainLeftLayout->setContentsMargins(0, 0, 0, 0); + SkeletonWidget *skeletonWidget = new SkeletonWidget(this); m_skeletonWidget = skeletonWidget; QHBoxLayout *modelPageLayout = new QHBoxLayout; + modelPageLayout->addLayout(mainLeftLayout); modelPageLayout->addWidget(skeletonWidget); //modelPageLayout->addLayout(modelRightLayout); diff --git a/src/mesh.cpp b/src/mesh.cpp index 68d9ce7b..8367d520 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -1,5 +1,6 @@ #include "mesh.h" #include "meshlite.h" +#include "theme.h" #include #define MAX_VERTICES_PER_FACE 100 @@ -60,9 +61,9 @@ Mesh::Mesh(void *meshlite, int meshId) : v->normX = edgeNormals[firstIndex + 0]; v->normY = edgeNormals[firstIndex + 1]; v->normZ = edgeNormals[firstIndex + 2]; - v->colorR = 0; - v->colorG = 0; - v->colorB = 0; + v->colorR = 0.0; + v->colorG = 0.0; + v->colorB = 0.0; } } @@ -78,6 +79,9 @@ Mesh::Mesh(void *meshlite, int meshId) : GLfloat *triangleNormals = new GLfloat[triangleCount * 3]; int loadedTriangleNormalItemCount = meshlite_get_triangle_normal_array(meshlite, triangleMesh, triangleNormals, triangleCount * 3); + float modelR = Theme::white.redF(); + float modelG = Theme::white.greenF(); + float modelB = Theme::white.blueF(); m_triangleVertexCount = triangleCount * 3; m_triangleVertices = new Vertex[m_triangleVertexCount * 3]; for (int i = 0; i < triangleCount; i++) { @@ -94,9 +98,9 @@ Mesh::Mesh(void *meshlite, int meshId) : v->normX = triangleNormals[firstIndex + 0]; v->normY = triangleNormals[firstIndex + 1]; v->normZ = triangleNormals[firstIndex + 2]; - v->colorR = 1.0; - v->colorG = 1.0; - v->colorB = 1.0; + v->colorR = modelR; + v->colorG = modelG; + v->colorB = modelB; } } diff --git a/src/skeletoneditgraphicsview.cpp b/src/skeletoneditgraphicsview.cpp index 92903dc9..97287f49 100644 --- a/src/skeletoneditgraphicsview.cpp +++ b/src/skeletoneditgraphicsview.cpp @@ -27,7 +27,7 @@ SkeletonEditGraphicsView::SkeletonEditGraphicsView(QWidget *parent) : m_backgroundLoaded(false), m_modelWidget(NULL), m_modelWidgetProxy(NULL), - m_combineEnabled(false), + m_combineEnabled(true), m_unionEnabled(true), m_subdivEnabled(false) { @@ -230,7 +230,10 @@ bool SkeletonEditGraphicsView::keyPress(QKeyEvent *event, const QPointF &scenePo } else if (event->key() == Qt::Key_S) { m_subdivEnabled = !m_subdivEnabled; emit nodesChanged(); - } else if (event->key() == Qt::Key_Delete || event->key() ==Qt::Key_Backspace) { + } else if (event->key() == Qt::Key_Tab) { + if (m_nextStartNodeItem) + setNextStartNodeItem(m_nextStartNodeItem->nextSidePair()); + } else if (event->key() == Qt::Key_Delete || event->key() ==Qt::Key_Backspace) { removeSelectedItems(); processed = true; } @@ -457,6 +460,7 @@ bool SkeletonEditGraphicsView::wheel(QWheelEvent *event, const QPointF &scenePos AddItemRadius(m_pendingNodeItem, delta); if (!m_inAddNodeMode && m_lastHoverNodeItem) { AddItemRadius(m_lastHoverNodeItem, delta); + AddItemRadius(m_lastHoverNodeItem->nextSidePair(), delta); processed = true; emit nodesChanged(); } diff --git a/src/skeletonsnapshot.cpp b/src/skeletonsnapshot.cpp index 5357d403..c829b64e 100644 --- a/src/skeletonsnapshot.cpp +++ b/src/skeletonsnapshot.cpp @@ -272,4 +272,11 @@ void SkeletonSnapshot::resolveRootNode() if (m_rootNode.isEmpty()) m_rootNode = findMaxNeighborNumberNode(); + + if (m_rootNode.isEmpty()) { + nodeIterator = nodes.begin(); + if (nodeIterator != nodes.end()) { + m_rootNode = nodeIterator->first; + } + } } diff --git a/src/skeletontomesh.cpp b/src/skeletontomesh.cpp index 463d7899..f8ae1567 100644 --- a/src/skeletontomesh.cpp +++ b/src/skeletontomesh.cpp @@ -83,9 +83,8 @@ void SkeletonToMesh::process() float y = (nodeIterator->second["y"].toFloat() - frontMiddleY) / canvasHeight; float z = (nextSidePair->second["x"].toFloat() - sideMiddleX) / canvasHeight; float r = nodeIterator->second["radius"].toFloat() / canvasHeight; - float t = nextSidePair->second["radius"].toFloat() / canvasHeight; - int bmeshNodeId = meshlite_bmesh_add_node(meshliteContext, bmeshId, x, y, z, r, t); - printf("meshlite_bmesh_add_node x:%f y:%f z:%f r:%f t:%f nodeName:%s bmeshNodeId:%d\n", x, y, z, r, t, nodeIterator->first.toUtf8().constData(), bmeshNodeId); + int bmeshNodeId = meshlite_bmesh_add_node(meshliteContext, bmeshId, x, y, z, r); + printf("meshlite_bmesh_add_node x:%f y:%f z:%f r:%f nodeName:%s bmeshNodeId:%d\n", x, y, z, r, nodeIterator->first.toUtf8().constData(), bmeshNodeId); bmeshNodeMap[nodeIterator->first] = bmeshNodeId; } @@ -116,15 +115,17 @@ void SkeletonToMesh::process() } else { mergedMeshId = mergeMeshs(meshliteContext, meshIds); } - if (subdivEnabled) { + if (combineEnabled) { if (mergedMeshId > 0) { + mergedMeshId = meshlite_combine_coplanar_faces(meshliteContext, mergedMeshId); + } + } + if (subdivEnabled) { + if (mergedMeshId > 0 && meshlite_is_triangulated_manifold(meshliteContext, mergedMeshId)) { mergedMeshId = meshlite_subdivide(meshliteContext, mergedMeshId); } } if (mergedMeshId > 0) { - if (combineEnabled) { - mergedMeshId = meshlite_combine_adj_faces(meshliteContext, mergedMeshId); - } m_mesh = new Mesh(meshliteContext, mergedMeshId); } } diff --git a/src/theme.cpp b/src/theme.cpp index 79685aef..2590a3e9 100644 --- a/src/theme.cpp +++ b/src/theme.cpp @@ -14,16 +14,17 @@ // White // 0xf7, 0xd9, 0xc8 -QColor Theme::red = QColor(0xff, 0xff, 0xff); -QColor Theme::green = QColor(0xff, 0xff, 0xff); +QColor Theme::red = QColor(0xfc, 0x66, 0x21); +QColor Theme::green = QColor(0xaa, 0xeb, 0xc4); QColor Theme::blue = QColor(0x2a, 0x5a, 0xac); +QColor Theme::white = QColor(0xf7, 0xd9, 0xc8); float Theme::normalAlpha = 96.0 / 255; float Theme::branchAlpha = 64.0 / 255; float Theme::checkedAlpha = 1.0; float Theme::edgeAlpha = 1.0; float Theme::fillAlpha = 50.0 / 255; -int Theme::skeletonNodeBorderSize = 2; -int Theme::skeletonEdgeWidth = 2; +int Theme::skeletonNodeBorderSize = 0; +int Theme::skeletonEdgeWidth = 0; std::map createSideColorNameMap() { std::map map; diff --git a/src/theme.h b/src/theme.h index 19e0229c..8bc81764 100644 --- a/src/theme.h +++ b/src/theme.h @@ -10,6 +10,7 @@ public: static QColor red; static QColor green; static QColor blue; + static QColor white; static float normalAlpha; static float checkedAlpha; static float branchAlpha; diff --git a/src/unionmesh.cpp b/src/unionmesh.cpp index 1444be05..37b265b3 100644 --- a/src/unionmesh.cpp +++ b/src/unionmesh.cpp @@ -22,12 +22,14 @@ // https://doc.cgal.org/latest/Polygon_mesh_processing/Polygon_mesh_processing_2corefinement_mesh_union_8cpp-example.html#a2 // https://doc.cgal.org/latest/Polygon_mesh_processing/Polygon_mesh_processing_2triangulate_faces_example_8cpp-example.html // https://github.com/CGAL/cgal/issues/2875 +// https://doc.cgal.org/latest/Polygon_mesh_processing/Polygon_mesh_processing_2hausdorff_distance_remeshing_example_8cpp-example.html#a3 #include #include #include #include #include #include +#include typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef CGAL::Surface_mesh CgalMesh; @@ -120,6 +122,7 @@ CgalMesh *unionCgalMeshs(CgalMesh *first, CgalMesh *second) delete mesh; return NULL; } + //CGAL::Polygon_mesh_processing::isotropic_remeshing(mesh->faces(), 0.4, *mesh); } catch (...) { delete mesh; return NULL;