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. WorkerScript for heavy canvas3d application
QtWS25 Last Chance

WorkerScript for heavy canvas3d application

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
canvas3dworkerscriptqtquickqmljavascript
1 Posts 1 Posters 759 Views
  • 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.
  • W Offline
    W Offline
    Wiech_RV
    wrote on 3 May 2016, 06:19 last edited by
    #1

    I have a qt quick application (buttons etc.) for user control and a canvas3d animation in the middle of the screen. However loading the javascript files with JSON.loader for the cad model takes a lot of time and my application freezes for some time. I was trying to run extra thread for the animation with WorkerScript in QML.

    The problem is that i cannot give the canvas3d object (QObject) ot the workerscript. Any idea how to solve that problem?

    Canvas3D  {
    id: canvas3d
    anchors.fill: parent
    anchors.verticalCenter: parent.verticalCenter
    anchors.horizontalCenter: parent.horizontalCenter
    focus: true
    
    WorkerScript {
        id: myWorker
        source: 'workerscript.js'
        onMessage: console.log(message.reply)
    }
    onInitializeGL: {
        //GLCode.init(canvas3d)
        myWorker.sendMessage(canvas3d)
    }
    WorkerScript.onMessage = function(message)
    {  
    initScene();
    initCamera(message.canvas)
    initMeshObjects();
    initRenderer(message.canvas);
    WorkerScript.sendMessage({'reply': 'WorkerScript done!'});
     }
    
    function initMeshObjects() {
        // ![1]
        var loader1 = new THREE.JSONLoader();
    
        loader1.load('/rightBack/chrome11.js', function(geometry, materials) {
        var material = new THREE.MeshBasicMaterial({color: 0xCBDAD5,
                                                       ambient: 0x00000000,
                                                       shading: THREE.SmoothShading});
        chrome11 = new THREE.Mesh(geometry, material);
        scene.add(chrome11);
    });
    }
    
    1 Reply Last reply
    0

    1/1

    3 May 2016, 06:19

    • Login

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