Commit e6ffa549 authored by Stefan Pfeifer's avatar Stefan Pfeifer

Minor changes to the limb view buttons

parent d22f598c
resources/icons/limb-view/view-fit.png

738 Bytes | W: | H:

resources/icons/limb-view/view-fit.png

376 Bytes | W: | H:

resources/icons/limb-view/view-fit.png
resources/icons/limb-view/view-fit.png
resources/icons/limb-view/view-fit.png
resources/icons/limb-view/view-fit.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -14,9 +14,9 @@
viewBox="0 0 55.35762 55.357621"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="view-fit.svg"
inkscape:export-filename="/mnt/Daten/Projekte/Bow-Simulator/Repositories/bow-simulator/resources/icons/view-fit.png"
inkscape:export-filename="/home/stefan/Desktop/Repositories/bow-simulator/resources/icons/limb-view/view-fit.png"
inkscape:export-xdpi="78.03804"
inkscape:export-ydpi="78.03804">
<defs
......@@ -44,21 +44,25 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.9195959"
inkscape:cx="22.172211"
inkscape:cy="19.503179"
inkscape:zoom="11.2"
inkscape:cx="21.628694"
inkscape:cy="29.253121"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1013"
inkscape:window-height="1001"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid3724" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
......@@ -67,7 +71,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
......@@ -76,65 +80,29 @@
inkscape:groupmode="layer"
id="layer1"
transform="translate(-64.697271,-815.73534)">
<g
id="g4616"
transform="translate(14.000001,14.000001)">
<path
inkscape:connector-curvature="0"
id="path4136"
d="M 70.048421,821.10885 58.466254,809.52668"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5.00000048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4596"
d="m 57.289024,808.29299 0,11.42632 11.277276,-11.40148 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.11282372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
transform="matrix(0,1,-1,0,921.71879,765.06247)"
id="g4616-7">
<path
inkscape:connector-curvature="0"
id="path4136-5"
d="M 70.048421,821.10885 58.466254,809.52668"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5.00000048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4596-3"
d="m 57.289024,808.29299 0,11.42632 11.277276,-11.40148 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.11282372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
transform="matrix(0,-1,1,0,-737.03808,921.79145)"
id="g4616-5">
<path
inkscape:connector-curvature="0"
id="path4136-6"
d="M 70.048421,821.10885 58.466254,809.52668"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5.00000048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4596-2"
d="m 57.289024,808.29299 0,11.42632 11.277276,-11.40148 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.11282372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<g
transform="matrix(-1,0,0,-1,170.73665,1672.8236)"
id="g4616-9">
<path
inkscape:connector-curvature="0"
id="path4136-1"
d="M 70.048421,821.10885 58.466254,809.52668"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5.00000048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4596-27"
d="m 57.289024,808.29299 0,11.42632 11.277276,-11.40148 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.11282372px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
<path
style="fill:none;stroke:#000000;stroke-width:4.6875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 75.009771,848.59296 v 10.3125 h 10.312501"
id="path3726"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#000000;stroke-width:4.68749952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 85.322271,828.90546 h -10.3125 v 10.3125"
id="path3726-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#000000;stroke-width:4.68749952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 110.63477,839.21796 v -10.3125 h -10.3125"
id="path3726-3-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#000000;stroke-width:4.68749952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 100.32227,858.90546 h 10.3125 v -10.3125"
id="path3726-3-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
</g>
</svg>
resources/icons/limb-view/view-symmetric.png

484 Bytes | W: | H:

resources/icons/limb-view/view-symmetric.png

476 Bytes | W: | H:

resources/icons/limb-view/view-symmetric.png
resources/icons/limb-view/view-symmetric.png
resources/icons/limb-view/view-symmetric.png
resources/icons/limb-view/view-symmetric.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -14,9 +14,9 @@
viewBox="0 0 71.773902 71.7739"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="view-symmetric.svg"
inkscape:export-filename="/mnt/Daten/Projekte/Bow-Simulator/Repositories/bow-simulator/resources/icons/view-symmetric.png"
inkscape:export-filename="/home/stefan/Desktop/Repositories/bow-simulator/resources/icons/limb-view/view-symmetric.png"
inkscape:export-xdpi="60.189007"
inkscape:export-ydpi="60.189007">
<defs
......@@ -28,21 +28,25 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6"
inkscape:cx="33.635362"
inkscape:cy="33.403729"
inkscape:zoom="11.2"
inkscape:cx="39.541315"
inkscape:cy="39.629024"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1013"
inkscape:window-height="1001"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid843" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
......@@ -62,13 +66,7 @@
transform="translate(-56.604637,-807.62746)">
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.465052,808.96353 0,12.78474"
id="path4151"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.489835,826.83716 0,5.30577"
d="m 92.229639,828.77636 v 5.30577"
id="path4153"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
......@@ -86,20 +84,26 @@
sodipodi:nodetypes="cccc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.414309,854.65466 0,5.30577"
d="m 92.229639,853.15136 v 5.30577"
id="path4153-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.465051,836.76977 0,12.78474"
d="m 92.229639,837.71679 v 11.48259"
id="path4151-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.338783,865.30658 0,12.78474"
id="path4151-6-1"
d="m 92.229639,814.71386 0,10.3125"
id="path4151-6-3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 92.229639,861.58886 0,10.3125"
id="path4151-6-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
</g>
......
......@@ -30,19 +30,19 @@ LimbView::LimbView()
auto button2 = new QToolButton();
QObject::connect(button2, &QPushButton::clicked, this, &LimbView::view3D);
button2->setIcon(QIcon(":/icons/limb-view/view-3d"));
button2->setToolTip("3D view");
button2->setToolTip("Default view");
button2->setIconSize({32, 32});
auto button3 = new QToolButton();
QObject::connect(button3, &QPushButton::clicked, this, &LimbView::viewFit);
button3->setIcon(QIcon(":/icons/limb-view/view-fit"));
button3->setToolTip("Fit view");
button3->setToolTip("Reset zoom");
button3->setIconSize({32, 32});
auto button4 = new QToolButton();
QObject::connect(button4, &QToolButton::toggled, this, &LimbView::viewSymmetric);
button4->setIcon(QIcon(":/icons/limb-view/view-symmetric"));
button4->setToolTip("Show complete bow");
button4->setToolTip("Show second limb");
button4->setIconSize({32, 32});
button4->setCheckable(true);
......@@ -63,6 +63,7 @@ LimbView::LimbView()
vbox->addStretch();
vbox->addLayout(hbox);
// Initialize view parameters
viewSymmetric(false);
view3D();
}
......@@ -96,7 +97,7 @@ void LimbView::viewProfile()
void LimbView::viewTop()
{
rot_x = -90.0f;
rot_x = 90.0f;
rot_y = 0.0f;
viewFit();
}
......@@ -180,6 +181,7 @@ void LimbView::initializeGL()
initializeOpenGLFunctions();
glClearColor(0.2f, 0.3f, 0.4f, 1.0f);
glLineWidth(2.0f);
shader_program = new QOpenGLShaderProgram;
shader_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource);
......@@ -195,40 +197,16 @@ void LimbView::initializeGL()
loc_normalMatrix = shader_program->uniformLocation("normalMatrix");
loc_lightPosition = shader_program->uniformLocation("lightPosition");
// Create a vertex array object. In OpenGL ES 2.0 and OpenGL 2.x
// implementations this is optional and support may not be present
// at all. Nonetheless the below code works in all cases and makes
// sure there is a VAO when one is needed.
m_vao.create();
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vao);
// Setup vertex buffer object and vertex attributes for right limb
// Setup vertex buffer object for left limb
limb_mesh_left_vbo.create();
limb_mesh_left_vbo.bind();
limb_mesh_left_vbo.allocate(limb_mesh_left.vertexData().data(), limb_mesh_left.vertexData().size()*sizeof(GLfloat));
/*
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 9*sizeof(GLfloat), (void*)(0*sizeof(GLfloat)));
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 9*sizeof(GLfloat), (void*)(3*sizeof(GLfloat)));
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 9*sizeof(GLfloat), (void*)(6*sizeof(GLfloat)));
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
*/
limb_mesh_left_vbo.release();
// Setup vertex buffer object and vertex attributes for right limb
// Setup vertex buffer object for right limb
limb_mesh_right_vbo.create();
limb_mesh_right_vbo.bind();
limb_mesh_right_vbo.allocate(limb_mesh_right.vertexData().data(), limb_mesh_right.vertexData().size()*sizeof(GLfloat));
/*
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 9*sizeof(GLfloat), (void*)(0*sizeof(GLfloat)));
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 9*sizeof(GLfloat), (void*)(3*sizeof(GLfloat)));
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 9*sizeof(GLfloat), (void*)(6*sizeof(GLfloat)));
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
*/
limb_mesh_right_vbo.release();
// Set fixed light position
......@@ -255,7 +233,7 @@ void LimbView::paintGL()
m_world.scale(1.0f/content_bounds.diagonal());
m_world.translate(-content_bounds.center());
m_camera.setToIdentity();
m_camera.translate(0.0f, 0.0f, -1.0f);
m_camera.translate(0.0f, 0.0f, -1.5f);
float aspect_ratio = float(this->height())/this->width();
m_projection.setToIdentity();
......@@ -265,8 +243,6 @@ void LimbView::paintGL()
( 0.5f*zoom + shift_y)*aspect_ratio,
0.001f, 100.0f);
QOpenGLVertexArrayObject::Binder vaoBinder(&m_vao);
shader_program->bind();
shader_program->setUniformValue(loc_projectionMatrix, m_projection);
shader_program->setUniformValue(loc_modelViewMatrix, m_camera*m_world);
......
......@@ -16,8 +16,8 @@ QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram)
class LimbView: public QOpenGLWidget, protected QOpenGLFunctions
{
private:
const float DEFAULT_ROT_X = 20.0f; // Magic number
const float DEFAULT_ROT_Y = -30.0f; // Magic number
const float DEFAULT_ROT_X = 31.0f; // Trimetric view
const float DEFAULT_ROT_Y = -28.0f; // Trimetric view
const float DEFAULT_ZOOM = 1.1f; // Magic number
const float ZOOM_SPEED = 0.2f; // Magic number
const float ROT_SPEED = 0.15f; // Magic number
......@@ -46,7 +46,6 @@ private:
LayerLegend* legend;
LimbMesh limb_mesh_left;
LimbMesh limb_mesh_right;
QOpenGLVertexArrayObject m_vao;
QOpenGLBuffer limb_mesh_left_vbo;
QOpenGLBuffer limb_mesh_right_vbo;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment