Suggested change to TriangleMesh API

Richard Bair richard.bair at
Wed Apr 10 21:24:04 PDT 2013

> I don't have much experience with 3D, but do they need to have list-like interface at all? Could they be just properties that hold an array of primitives?  If you want to change the length you have to set the whole array again, but manipulating the existing coordinates is just an array access.  You may need some sort of call to inform the TriangleMesh that the contents have changed, but that sort of call can also be deferred until you have tweaked all the entries you want.  The bulk of the array manipulation can then be done outside of the TriangleMesh API.

I'm not sure accessing the array directly really buys much in terms of performance (any JIT anyway will inline through the setters, I would guess). Some benefits to hiding them behind a facade is that you can intercept the gets & sets and do things such as (in the future?) check thread access, or in this case, provide observable arrays. Because they are observable you can add listeners and use them in bindings and so forth. Not sure of the use cases to have these be observable (other than tooling, which shouldn't be discounted), but I have no doubt people will find use cases where they will wish we had done so :-)


More information about the openjfx-dev mailing list