dashed lines qtquickgeometry
-
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 } ] }
-
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.cppOther 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 ?