-
Notifications
You must be signed in to change notification settings - Fork 59
Refactor update octree for r78 #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
One more suggestion I would like to make is to reconsider the Another improvement could be to split the
Like that we can make 3 diffent raycast methods that are specific to the object. Now the method has to cover all three cases. Please tell me what you think about this... |
|
I added a test/example for raycasting on |
|
+1, can this get PR get some love? I need this functionality. I also have built functionality to support the faces mode on |
|
Not sure how I missed this PR. This is a huge amount of work and I apologize for not seeing it sooner. Honestly I haven't used THREEJS in too long and don't have the time to review your changes to make the call on whether this is safe to merge. I'll leave the PR open for now so others can use your changes as needed. |
|
Maybe to avoid confusion you can point people to the main repo? https://github.com/mrdoob/three.js/blob/dev/examples/js/Octree.js |
|
Done: https://github.com/collinhover/threeoctree/blob/master/README.md Thanks guys. |
|
Any news on this? That's just very sad that I don't have the knowledge yet to achieve this conversion. Thanks anyway :) |
Hej Collin Hover,
I found some time to more seriously work my way through your
threeoctree.jsI changed quite some things, but I hope you can agree on the changes i made in this PR. I think the code for raycasting/intersecting was simplified a bit by my changes. The advantage of this refactor is that there is no longer need for customizing the
THREE.Raycasterclass. I needed to borrow some code from the raycast method in theTHREE.Meshclass to optimize the raycasting for theuseFacescase. Sorting of objects is as a result now internally handled by the raycaster and no longer part of the octree code.I also updated the docs and added a new changelog for migration to r78.
And added
bower.jsonfor bower support.The examples are also updated and all seems to work fine.
The face count (numFaces) shows a bit of a different number, but that is because I did think that the the faces for objects that still need to be raycasted (the boxes) should be included in the count (that is a more fair comparison).
If you want any changes please leave a comment.
Here the changes:
THREE.RayCasterwith custom methodsraycastmethod onTHREE.Octreeraycastmethod onTHREE.OctreeObjectDataTHREE.Face4support and its corresponding methods (THREE.Face4was deprecated in r60)THREE.Octreeobject.boundRadius(was replaced in r66(?) byobject.geometry.boundingSphere.radius)this.verticesinsideTHREE.OctreeObjectDatatothis.vertex(it holds an instance ofTHREE.Vector3)this.facesinsideTHREE.OctreeObjectDatatothis.face(it holds an instance ofTHREE.Face3)getFace3BoundingRadiusback to previousgetFaceBoundingRadius(sinceTHREE.Face4support is removed)Next will be to check support for
THREE.BufferGeometryinstances...Note: I removed my
findClosestVertex. I realized the method was incomplete, it was only working for objects added withuseVertices. I will think about what to do with it. Maybe I will make another PR later, for now I think it would be better to make two octrees in such case. One specially for finding closest vertex where objects are added by vertices only...