Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. dashed lines qtquickgeometry
Qt 6.11 is out! See what's new in the release blog

dashed lines qtquickgeometry

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 618 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hanzolem
    wrote on last edited by hanzolem
    #1

    So, guys. I'm developing 3d viewer app. I need to enable dashed lines view of model. How can I do this?

    Now I have this code for solid lines -

     if (lineTypeFlag == 0) {
            setPrimitiveType(QQuick3DGeometry::PrimitiveType::Lines);
            t.resize(line.over_mem * sizeof(Line));
            memcpy(t.data(), line.arr, line.over_mem * sizeof(Line));
        }
    
                Model {
                    id: bunny
                    position: Qt.vector3d(14, 0, 0)
                    geometry: model_context
    
                    y: -100
    //                scale: Qt.vector3d(15, 15, 15)
                    property variant material
                    property bool animate: true
    
                    materials: [ DefaultMaterial {
    //                          pointSize : 10 
                            diffuseColor: model_dialog.color
                            lighting: DefaultMaterial.NoLighting
                            cullMode: DefaultMaterial.NoCulling
    //                        diffuseMap: cbTexture.checked ? baseColorMap : null
                            specularAmount: 0.5
                        }
                    ]
                }
    
    

    photo_5337177106951553787_y.jpg photo_5337177106951553785_y.jpg

    H 1 Reply Last reply
    0
    • H hanzolem

      So, guys. I'm developing 3d viewer app. I need to enable dashed lines view of model. How can I do this?

      Now I have this code for solid lines -

       if (lineTypeFlag == 0) {
              setPrimitiveType(QQuick3DGeometry::PrimitiveType::Lines);
              t.resize(line.over_mem * sizeof(Line));
              memcpy(t.data(), line.arr, line.over_mem * sizeof(Line));
          }
      
                  Model {
                      id: bunny
                      position: Qt.vector3d(14, 0, 0)
                      geometry: model_context
      
                      y: -100
      //                scale: Qt.vector3d(15, 15, 15)
                      property variant material
                      property bool animate: true
      
                      materials: [ DefaultMaterial {
      //                          pointSize : 10 
                              diffuseColor: model_dialog.color
                              lighting: DefaultMaterial.NoLighting
                              cullMode: DefaultMaterial.NoCulling
      //                        diffuseMap: cbTexture.checked ? baseColorMap : null
                              specularAmount: 0.5
                          }
                      ]
                  }
      
      

      photo_5337177106951553787_y.jpg photo_5337177106951553785_y.jpg

      H Offline
      H Offline
      hanzolem
      wrote on last edited by
      #2

      and may be you can help me. When i display model as point cloud i can see points as a cubes(squares), but i want as a spheres(circles). How can I do this?
      photo_5337177106951553793_y.jpg photo_5337177106951553792_y.jpg

      1 Reply Last reply
      0
      • johngodJ Offline
        johngodJ Offline
        johngod
        wrote on last edited by
        #3

        Hi
        The easy solution for dashed lines is to apply a texture to your line, where the texture data has two colors, one being equal to the background color. I have done this, check here:
        https://bitbucket.org/joaodeusmorgado/techdrawstudio/src/master/qml/qmlEntities/Line_dashed.qml
        where the texture data is defined here https://bitbucket.org/joaodeusmorgado/techdrawstudio/src/master/entities/linetexture.cpp

        Other option is to play around with shaders and discard some pixels of the line, making a dashed pattern.

        Regardin the squares, maybe you can use their coordinates and display there a Model with geometry source set to #Sphere ?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved