{"action":"created","comment":{"url":"https://api.github.com/repos/highfidelity/hifi/pulls/comments/38242856","id":38242856,"diff_hunk":"@@ -500,159 +368,572 @@ bool RenderablePolyVoxEntityItem::findDetailedRayIntersection(const glm::vec3& o\n }\n \n \n-// compress the data in _volData and save the results.  The compressed form is used during\n-// saves to disk and for transmission over the wire\n-void RenderablePolyVoxEntityItem::compressVolumeData() {\n-    #ifdef WANT_DEBUG\n-    auto startTime = usecTimestampNow();\n-    #endif\n-\n-    quint16 voxelXSize = _voxelVolumeSize.x;\n-    quint16 voxelYSize = _voxelVolumeSize.y;\n-    quint16 voxelZSize = _voxelVolumeSize.z;\n-    int rawSize = voxelXSize * voxelYSize * voxelZSize;\n-\n-    QByteArray uncompressedData = QByteArray(rawSize, '\\0');\n-\n-    for (int z = 0; z < voxelZSize; z++) {\n-        for (int y = 0; y < voxelYSize; y++) {\n-            for (int x = 0; x < voxelXSize; x++) {\n-                uint8_t uVoxelValue = getVoxel(x, y, z);\n-                int uncompressedIndex =\n-                    z * voxelYSize * voxelXSize +\n-                    y * voxelXSize +\n-                    x;\n-                uncompressedData[uncompressedIndex] = uVoxelValue;\n-            }\n-        }\n-    }\n+PolyVox::RaycastResult RenderablePolyVoxEntityItem::doRayCast(glm::vec4 originInVoxel,\n+                                                              glm::vec4 farInVoxel,\n+                                                              glm::vec4& result) const {\n+    PolyVox::Vector3DFloat startPoint(originInVoxel.x, originInVoxel.y, originInVoxel.z);\n+    PolyVox::Vector3DFloat endPoint(farInVoxel.x, farInVoxel.y, farInVoxel.z);\n \n-    QByteArray newVoxelData;\n-    QDataStream writer(&newVoxelData, QIODevice::WriteOnly | QIODevice::Truncate);\n+    _volDataLock.lockForRead();\n+    RaycastFunctor callback(_volData);\n+    PolyVox::RaycastResult raycastResult = PolyVox::raycastWithEndpoints(_volData, startPoint, endPoint, callback);\n+    _volDataLock.unlock();\n \n-    #ifdef WANT_DEBUG\n-    qDebug() << \"compressing voxel data of size:\" << voxelXSize << voxelYSize << voxelZSize;\n-    #endif\n+    // result is in voxel-space coordinates.\n+    result = callback._result - glm::vec4(0.5f, 0.5f, 0.5f, 0.0f);\n+    return raycastResult;\n+}\n \n-    writer << voxelXSize << voxelYSize << voxelZSize;\n \n-    QByteArray compressedData = qCompress(uncompressedData, 9);\n-    writer << compressedData;\n+// virtual\n+ShapeType RenderablePolyVoxEntityItem::getShapeType() const {\n+    return SHAPE_TYPE_COMPOUND;\n+}\n \n-    // make sure the compressed data can be sent over the wire-protocol\n-    if (newVoxelData.size() < 1150) {\n-        _voxelData = newVoxelData;\n-        #ifdef WANT_DEBUG\n-        qDebug() << \"-------------- voxel compresss --------------\";\n-        qDebug() << \"raw-size =\" << rawSize << \"   compressed-size =\" << newVoxelData.size();\n-        #endif\n-    } else {\n-        // HACK -- until we have a way to allow for properties larger than MTU, don't update.\n-        #ifdef WANT_DEBUG\n-        qDebug() << \"voxel data too large, reverting change.\";\n-        #endif\n-        // revert the active voxel-space to the last version that fit.\n-        decompressVolumeData();\n+bool RenderablePolyVoxEntityItem::isReadyToComputeShape() {\n+    _meshLock.lockForRead();\n+    if (_meshDirty) {\n+        _meshLock.unlock();\n+        computeShapeInfoWorker();\n+        return false;\n     }\n-\n-    _dirtyFlags |= EntityItem::DIRTY_SHAPE | EntityItem::DIRTY_MASS;\n-    _needsModelReload = true;\n-\n-    #ifdef WANT_DEBUG\n-    qDebug() << \"RenderablePolyVoxEntityItem::compressVolumeData\" << (usecTimestampNow() - startTime) << getName();\n-    #endif\n+    _meshLock.unlock();\n+    return true;\n }","path":"libraries/entities-renderer/src/RenderablePolyVoxEntityItem.cpp","position":494,"original_position":494,"commit_id":"7614cababb950c87199a67762f7fd933733604e8","original_commit_id":"752c787f0b61ee2021ef15c14dd16abea53b02b3","user":{"login":"sethalves","id":1137072,"avatar_url":"https://avatars.githubusercontent.com/u/1137072?v=3","gravatar_id":"","url":"https://api.github.com/users/sethalves","html_url":"https://github.com/sethalves","followers_url":"https://api.github.com/users/sethalves/followers","following_url":"https://api.github.com/users/sethalves/following{/other_user}","gists_url":"https://api.github.com/users/sethalves/gists{/gist_id}","starred_url":"https://api.github.com/users/sethalves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethalves/subscriptions","organizations_url":"https://api.github.com/users/sethalves/orgs","repos_url":"https://api.github.com/users/sethalves/repos","events_url":"https://api.github.com/users/sethalves/events{/privacy}","received_events_url":"https://api.github.com/users/sethalves/received_events","type":"User","site_admin":false},"body":"they do queue up... or, rather, because the semaphore is of size 1, when the 2nd thread tries to start, it blocks.  I had attempted to allow more than one side-thread, but the code got a lot more complicated.  It seems that for the use case I'm trying to fix, one side-thread is enough to keep the mouse from momentarily freezing.\r\n\r\nThis should probably be revisited, but what's there now is a big improvement in usability.","created_at":"2015-08-28T20:50:11Z","updated_at":"2015-08-28T20:50:11Z","html_url":"https://github.com/highfidelity/hifi/pull/5660#discussion_r38242856","pull_request_url":"https://api.github.com/repos/highfidelity/hifi/pulls/5660","_links":{"self":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/comments/38242856"},"html":{"href":"https://github.com/highfidelity/hifi/pull/5660#discussion_r38242856"},"pull_request":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/5660"}}},"pull_request":{"url":"https://api.github.com/repos/highfidelity/hifi/pulls/5660","id":43363535,"html_url":"https://github.com/highfidelity/hifi/pull/5660","diff_url":"https://github.com/highfidelity/hifi/pull/5660.diff","patch_url":"https://github.com/highfidelity/hifi/pull/5660.patch","issue_url":"https://api.github.com/repos/highfidelity/hifi/issues/5660","number":5660,"state":"open","locked":false,"title":"Polyvox improvements","user":{"login":"sethalves","id":1137072,"avatar_url":"https://avatars.githubusercontent.com/u/1137072?v=3","gravatar_id":"","url":"https://api.github.com/users/sethalves","html_url":"https://github.com/sethalves","followers_url":"https://api.github.com/users/sethalves/followers","following_url":"https://api.github.com/users/sethalves/following{/other_user}","gists_url":"https://api.github.com/users/sethalves/gists{/gist_id}","starred_url":"https://api.github.com/users/sethalves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethalves/subscriptions","organizations_url":"https://api.github.com/users/sethalves/orgs","repos_url":"https://api.github.com/users/sethalves/repos","events_url":"https://api.github.com/users/sethalves/events{/privacy}","received_events_url":"https://api.github.com/users/sethalves/received_events","type":"User","site_admin":false},"body":"- When edit.js creates a polyvox entity, turn on some of the voxel so the user can see it.\r\n- voxel.js has a toolbar.\r\n- Editing a polyvox entity is less likely to cause interface to \"hiccup\".\r\n- By default polyvox entities now have the less confusing \"edged-cubic\" surface style.\r\n","created_at":"2015-08-26T04:40:26Z","updated_at":"2015-08-28T20:50:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"64ac99f2799ca327291b28f3fca0c532f627ca69","assignee":{"login":"AndrewMeadows","id":2186405,"avatar_url":"https://avatars.githubusercontent.com/u/2186405?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewMeadows","html_url":"https://github.com/AndrewMeadows","followers_url":"https://api.github.com/users/AndrewMeadows/followers","following_url":"https://api.github.com/users/AndrewMeadows/following{/other_user}","gists_url":"https://api.github.com/users/AndrewMeadows/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewMeadows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewMeadows/subscriptions","organizations_url":"https://api.github.com/users/AndrewMeadows/orgs","repos_url":"https://api.github.com/users/AndrewMeadows/repos","events_url":"https://api.github.com/users/AndrewMeadows/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewMeadows/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/highfidelity/hifi/pulls/5660/commits","review_comments_url":"https://api.github.com/repos/highfidelity/hifi/pulls/5660/comments","review_comment_url":"https://api.github.com/repos/highfidelity/hifi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/highfidelity/hifi/issues/5660/comments","statuses_url":"https://api.github.com/repos/highfidelity/hifi/statuses/7614cababb950c87199a67762f7fd933733604e8","head":{"label":"sethalves:polyvox","ref":"polyvox","sha":"7614cababb950c87199a67762f7fd933733604e8","user":{"login":"sethalves","id":1137072,"avatar_url":"https://avatars.githubusercontent.com/u/1137072?v=3","gravatar_id":"","url":"https://api.github.com/users/sethalves","html_url":"https://github.com/sethalves","followers_url":"https://api.github.com/users/sethalves/followers","following_url":"https://api.github.com/users/sethalves/following{/other_user}","gists_url":"https://api.github.com/users/sethalves/gists{/gist_id}","starred_url":"https://api.github.com/users/sethalves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethalves/subscriptions","organizations_url":"https://api.github.com/users/sethalves/orgs","repos_url":"https://api.github.com/users/sethalves/repos","events_url":"https://api.github.com/users/sethalves/events{/privacy}","received_events_url":"https://api.github.com/users/sethalves/received_events","type":"User","site_admin":false},"repo":{"id":30046830,"name":"hifi","full_name":"sethalves/hifi","owner":{"login":"sethalves","id":1137072,"avatar_url":"https://avatars.githubusercontent.com/u/1137072?v=3","gravatar_id":"","url":"https://api.github.com/users/sethalves","html_url":"https://github.com/sethalves","followers_url":"https://api.github.com/users/sethalves/followers","following_url":"https://api.github.com/users/sethalves/following{/other_user}","gists_url":"https://api.github.com/users/sethalves/gists{/gist_id}","starred_url":"https://api.github.com/users/sethalves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethalves/subscriptions","organizations_url":"https://api.github.com/users/sethalves/orgs","repos_url":"https://api.github.com/users/sethalves/repos","events_url":"https://api.github.com/users/sethalves/events{/privacy}","received_events_url":"https://api.github.com/users/sethalves/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sethalves/hifi","description":"Open, decentralized virtual worlds using sensors to control avatars and dynamically assigned devices as servers.  San Francisco based startup, we are hiring: http://highfidelity.io/jobs  Documentation at http://docs.highfidelity.io  Contribute by reporting bugs & doing jobs on http://worklist.net","fork":true,"url":"https://api.github.com/repos/sethalves/hifi","forks_url":"https://api.github.com/repos/sethalves/hifi/forks","keys_url":"https://api.github.com/repos/sethalves/hifi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sethalves/hifi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sethalves/hifi/teams","hooks_url":"https://api.github.com/repos/sethalves/hifi/hooks","issue_events_url":"https://api.github.com/repos/sethalves/hifi/issues/events{/number}","events_url":"https://api.github.com/repos/sethalves/hifi/events","assignees_url":"https://api.github.com/repos/sethalves/hifi/assignees{/user}","branches_url":"https://api.github.com/repos/sethalves/hifi/branches{/branch}","tags_url":"https://api.github.com/repos/sethalves/hifi/tags","blobs_url":"https://api.github.com/repos/sethalves/hifi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sethalves/hifi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sethalves/hifi/git/refs{/sha}","trees_url":"https://api.github.com/repos/sethalves/hifi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sethalves/hifi/statuses/{sha}","languages_url":"https://api.github.com/repos/sethalves/hifi/languages","stargazers_url":"https://api.github.com/repos/sethalves/hifi/stargazers","contributors_url":"https://api.github.com/repos/sethalves/hifi/contributors","subscribers_url":"https://api.github.com/repos/sethalves/hifi/subscribers","subscription_url":"https://api.github.com/repos/sethalves/hifi/subscription","commits_url":"https://api.github.com/repos/sethalves/hifi/commits{/sha}","git_commits_url":"https://api.github.com/repos/sethalves/hifi/git/commits{/sha}","comments_url":"https://api.github.com/repos/sethalves/hifi/comments{/number}","issue_comment_url":"https://api.github.com/repos/sethalves/hifi/issues/comments{/number}","contents_url":"https://api.github.com/repos/sethalves/hifi/contents/{+path}","compare_url":"https://api.github.com/repos/sethalves/hifi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sethalves/hifi/merges","archive_url":"https://api.github.com/repos/sethalves/hifi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sethalves/hifi/downloads","issues_url":"https://api.github.com/repos/sethalves/hifi/issues{/number}","pulls_url":"https://api.github.com/repos/sethalves/hifi/pulls{/number}","milestones_url":"https://api.github.com/repos/sethalves/hifi/milestones{/number}","notifications_url":"https://api.github.com/repos/sethalves/hifi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sethalves/hifi/labels{/name}","releases_url":"https://api.github.com/repos/sethalves/hifi/releases{/id}","created_at":"2015-01-29T23:37:31Z","updated_at":"2015-05-07T23:30:44Z","pushed_at":"2015-08-28T20:21:36Z","git_url":"git://github.com/sethalves/hifi.git","ssh_url":"git@github.com:sethalves/hifi.git","clone_url":"https://github.com/sethalves/hifi.git","svn_url":"https://github.com/sethalves/hifi","homepage":"","size":175146,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"highfidelity:master","ref":"master","sha":"0ca9b60be56c78911db78fe7cea3ec041bfa5d2f","user":{"login":"highfidelity","id":1565370,"avatar_url":"https://avatars.githubusercontent.com/u/1565370?v=3","gravatar_id":"","url":"https://api.github.com/users/highfidelity","html_url":"https://github.com/highfidelity","followers_url":"https://api.github.com/users/highfidelity/followers","following_url":"https://api.github.com/users/highfidelity/following{/other_user}","gists_url":"https://api.github.com/users/highfidelity/gists{/gist_id}","starred_url":"https://api.github.com/users/highfidelity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/highfidelity/subscriptions","organizations_url":"https://api.github.com/users/highfidelity/orgs","repos_url":"https://api.github.com/users/highfidelity/repos","events_url":"https://api.github.com/users/highfidelity/events{/privacy}","received_events_url":"https://api.github.com/users/highfidelity/received_events","type":"Organization","site_admin":false},"repo":{"id":5372872,"name":"hifi","full_name":"highfidelity/hifi","owner":{"login":"highfidelity","id":1565370,"avatar_url":"https://avatars.githubusercontent.com/u/1565370?v=3","gravatar_id":"","url":"https://api.github.com/users/highfidelity","html_url":"https://github.com/highfidelity","followers_url":"https://api.github.com/users/highfidelity/followers","following_url":"https://api.github.com/users/highfidelity/following{/other_user}","gists_url":"https://api.github.com/users/highfidelity/gists{/gist_id}","starred_url":"https://api.github.com/users/highfidelity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/highfidelity/subscriptions","organizations_url":"https://api.github.com/users/highfidelity/orgs","repos_url":"https://api.github.com/users/highfidelity/repos","events_url":"https://api.github.com/users/highfidelity/events{/privacy}","received_events_url":"https://api.github.com/users/highfidelity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/highfidelity/hifi","description":"Open source software for shared virtual worlds using HMDs and dynamically assigned devices as servers.  San Francisco based startup, we are hiring: http://highfidelity.com/jobs  Documentation at http://docs.highfidelity.com  Contribute by reporting bugs & doing jobs on http://worklist.net","fork":false,"url":"https://api.github.com/repos/highfidelity/hifi","forks_url":"https://api.github.com/repos/highfidelity/hifi/forks","keys_url":"https://api.github.com/repos/highfidelity/hifi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/highfidelity/hifi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/highfidelity/hifi/teams","hooks_url":"https://api.github.com/repos/highfidelity/hifi/hooks","issue_events_url":"https://api.github.com/repos/highfidelity/hifi/issues/events{/number}","events_url":"https://api.github.com/repos/highfidelity/hifi/events","assignees_url":"https://api.github.com/repos/highfidelity/hifi/assignees{/user}","branches_url":"https://api.github.com/repos/highfidelity/hifi/branches{/branch}","tags_url":"https://api.github.com/repos/highfidelity/hifi/tags","blobs_url":"https://api.github.com/repos/highfidelity/hifi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/highfidelity/hifi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/highfidelity/hifi/git/refs{/sha}","trees_url":"https://api.github.com/repos/highfidelity/hifi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/highfidelity/hifi/statuses/{sha}","languages_url":"https://api.github.com/repos/highfidelity/hifi/languages","stargazers_url":"https://api.github.com/repos/highfidelity/hifi/stargazers","contributors_url":"https://api.github.com/repos/highfidelity/hifi/contributors","subscribers_url":"https://api.github.com/repos/highfidelity/hifi/subscribers","subscription_url":"https://api.github.com/repos/highfidelity/hifi/subscription","commits_url":"https://api.github.com/repos/highfidelity/hifi/commits{/sha}","git_commits_url":"https://api.github.com/repos/highfidelity/hifi/git/commits{/sha}","comments_url":"https://api.github.com/repos/highfidelity/hifi/comments{/number}","issue_comment_url":"https://api.github.com/repos/highfidelity/hifi/issues/comments{/number}","contents_url":"https://api.github.com/repos/highfidelity/hifi/contents/{+path}","compare_url":"https://api.github.com/repos/highfidelity/hifi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/highfidelity/hifi/merges","archive_url":"https://api.github.com/repos/highfidelity/hifi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/highfidelity/hifi/downloads","issues_url":"https://api.github.com/repos/highfidelity/hifi/issues{/number}","pulls_url":"https://api.github.com/repos/highfidelity/hifi/pulls{/number}","milestones_url":"https://api.github.com/repos/highfidelity/hifi/milestones{/number}","notifications_url":"https://api.github.com/repos/highfidelity/hifi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/highfidelity/hifi/labels{/name}","releases_url":"https://api.github.com/repos/highfidelity/hifi/releases{/id}","created_at":"2012-08-10T18:26:22Z","updated_at":"2015-08-26T18:03:16Z","pushed_at":"2015-08-28T20:43:14Z","git_url":"git://github.com/highfidelity/hifi.git","ssh_url":"git@github.com:highfidelity/hifi.git","clone_url":"https://github.com/highfidelity/hifi.git","svn_url":"https://github.com/highfidelity/hifi","homepage":"","size":231103,"stargazers_count":300,"watchers_count":300,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":169,"mirror_url":null,"open_issues_count":59,"forks":169,"open_issues":59,"watchers":300,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/5660"},"html":{"href":"https://github.com/highfidelity/hifi/pull/5660"},"issue":{"href":"https://api.github.com/repos/highfidelity/hifi/issues/5660"},"comments":{"href":"https://api.github.com/repos/highfidelity/hifi/issues/5660/comments"},"review_comments":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/5660/comments"},"review_comment":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/highfidelity/hifi/pulls/5660/commits"},"statuses":{"href":"https://api.github.com/repos/highfidelity/hifi/statuses/7614cababb950c87199a67762f7fd933733604e8"}}}}