[Interest] [Qt3D] Cylinder Mesh Mod Problem

Andy asmaloney at gmail.com
Tue Jan 26 18:15:32 CET 2016


As I was looking into this, I noticed that in
CylinderVertexDataFunctor::operator() (in qcylindergeometry.cpp), we have
this:

        const int verticesCount  = (m_slices + 1) * m_rings + 2 * (m_slices
+ 1) + 2;

which is used to create the vertex data for the sides + end discs.

But in QCylinderGeometryPrivate::init() when we calculate the number of
verts to pass to the various QAttributes, we have this:

    const int nVerts = (m_slices + 1) * (m_rings + 1);

This seems to ignore (most of) the "disc" verts from either end.

Is this intentional/correct?

(FWIW one of the things I did in my own geometry class is set up an
internal data class which includes methods to return all these calculations
- numVerts(), numFaces(), etc - so we know they are consistent throughout.
Also reduces duplication of fields in the functor classes and reduces the
number of arguments being passed around.  I have a bunch of fields used in
my calculations, so the number of arguments and amount of duplication was
getting large...)



---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney <https://twitter.com/asmaloney>


On Mon, Jan 25, 2016 at 1:40 PM, Sean Harmer <sean.harmer at kdab.com> wrote:

> Hi,
>
> thanks for finding that. Are you able to push a fix to Qt's gerrit code
> review system please so that it can be reviewed and merged?
>
> Many thanks,
>
> Sean
>
>
> On 25/01/2016 18:16, Andy wrote:
>
> > Subject: [Interest] [Qt3D] Cylinder Mesh Mod Problem
> > I am trying to work with and understand the Qt3D geometry and mesh
> system.
> >
> > Based on Paul's answer to my earlier question I thought I'd start with
> something simple: a cylinder without the end caps (QCylinderMesh always
> includes them).
> >
> > I started by taking the QCylinderGeometry/QCylinderMesh code and making
> it build outside of the Qt5 build system.  Next I removed the code for
> adding the caps (called discs in the code).
> >
> > The cylinder looks good, but there seems to be an extra vert at (0.0,
> 0.0, 0.0) and faces created between it and the top ring.  I can't for the
> life of me figure out where the extra vert is coming from or where those
> faces are created.
> >
> > I put some example code and a couple of images here:
> >
> >    https://github.com/asmaloney/Qt3D-mesh-problem
> >
> > I am using the latest Qt 5.6 git from 22 Jan (SHA
> 1fcdb6cafcf7621fdea84e28a95934a4a04ea1b7) which uses Qt3D from 21 Jan (SHA
> 44c743c90cf51eddbf5b0bb3cf957c58fa0ef94f).
> >
> > Any ideas what I'm doing wrong or suggestions on how to figure it out?
> >
> > Thank you for any help/suggestions!
> >
> > - Andy
>
> I've discovered the problem.  There is a bug in QCylinderGeometry's
> calculation of the cylinder's side indices.  You can see it if you move the
> camera "inside" a cylinder.  I put an example image here:
>
>   https://github.com/asmaloney/Qt3D-mesh-problem
>
> I fixed the example code in the repo.  Two small changes in
> CylinderIndexDataFunctor::operator () and createSidesIndices() which should
> be applied to Qt3D's QCylinderGeometry.
>
> - Andy
>
>
> _______________________________________________
> Interest mailing listInterest at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/interest
>
>
>
> --
> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> KDAB (UK) Ltd, a KDAB Group company
> Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> Mobile: +44 (0)7545 140604
> KDAB - Qt Experts
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160126/c3158fec/attachment.html>


More information about the Interest mailing list