0

I wanna add a obj file(wavefront format) as a point(by a position) in surface3d in qml but i dont know how i do it!

i found some solutions but they have some problems, for example i just want use qml , but they use c++ and QCustomItem .

i tried to use it in sactter3d with new mesh (just training with that) but it couldnt work:

    mesh:Abstract3DSeries.MeshUserDefined
    userDefinedMesh:Mesh{
        source: "wfObj.obj"
    }

it was just a training , my main queston is adding waveFront to surface3d qml.

thx for helping .

H.M
  • 425
  • 2
  • 16
  • If you are using Qt3D, then `SceneLoader` is what you need to load .obj/.mtl files and render them with Qt3D: https://doc.qt.io/qt-5/qml-qt3d-render-sceneloader.html – pinebitter Jun 25 '20 at 13:45
  • No im not using qt3d , as i said i use surface3d , i just want use surface3d and add a custome waveform as a point in surface3d qml type – H.M Jun 25 '20 at 19:09

1 Answers1

0

finally i added my CustomItem in qml. at first i created a Custom3DItem :

Custom3DItem
{
    id:c3i
    meshFile: qsTr(":/Items/oilrig.obj")
    position: Qt.vector3d(35,150,35)
    textureFile: qsTr(":/Items/redPng.png")
    visible: true
    scaling: Qt.vector3d( 0.25 , 0.25 , 0.25 )
}

then i wanted add it to my Surface3d(id:mySurface) , for doing it i needed add it by a method ,so i used an Item and component.onCompleted:

Component.onCompleted: mySurface.addCustomItem(c3i);
H.M
  • 425
  • 2
  • 16