markaren / threepp

C++20 port of three.js (r129)
MIT License
581 stars 50 forks source link

changeable draw range for instanced mesh #246

Closed doubledong94 closed 3 months ago

doubledong94 commented 3 months ago

hello markaren

I'm working on a project that turn java code into graph, draw a node for each variable and draw a line for each assignment, something like that. And people can search code using regex, the result will be many lines in the graph.

The searching process is time consuming, so I have to draw from a stream of results generated by the searching thread.

So here is my problem: I'm using InstancedMesh + CircleGeometry to draw nodes, and I need to control how many instance is drawn on screen because I'm using a stream of results. I know I can set instanceCount in InstancedBufferGeometry, but InstancedMesh is just easier to use. I noticed there is instanceCount also in GLInfo::update, and don't know what that dose, so I decide to modify the class InstancedMesh.

What I did: split the role of the field InstancedMesh::count_ into capacity and drawInstanceCount

Hope you would think about this suggestion, Thanks!

markaren commented 3 months ago

Hi, I see now that the way this is done in three.js is simply changing the count property, and this is fine as long as the new count is lower than the one use for construction. I will adapt the code to make it possible in the same way.

doubledong94 commented 3 months ago

Thanks!

doubledong94 commented 3 months ago

I see that you have finished your change now, so I will close this one. Thanks for your work!