Polyline.setLineLength?

Started by AGP, September 23, 2017, 01:12:44 AM

Previous topic - Next topic

AGP

I'm writing the following for my son (sorry about the captured frame-rate). The thing about Polyline.update(...) is that it's expensive to always create a new array (I suppose that I could store it, then edit it but that's quirky), and it's inconvenient. Also, the following is the code that increases the length of my laser (deltaTime*10f breaks the numbers by being making them too large):


SimpleVector pos = bridge.getTransformedCenter();
pos.y -= 160f;
SimpleVector forward = bridge.getZAxis();
laserLength *= (1f+(deltaTime*6f));
laser.update(new SimpleVector[]{pos, pos.calcAdd(new SimpleVector(forward.x*laserLength, forward.y*laserLength, forward.z*laserLength))});


https://www.youtube.com/watch?v=ui6R1ZDcEqI

EgonOlsen

Polyline represents a set of lines, not just one. I don't see how you could apply to anything but a Polyline with just one line. It's just not compatible with the way in which the are rendered of better: What they are. Creating these arrays in desktop Java is cheap. On Android, I would simply reuse the array and the vectors inside.

AGP

That's true. What about a getPoints() method so at least we don't have to hold the array ourselves.

And the lwjgl thing? Obviously, 2.9x won't work forever so there has to be a plan forward lest jpct's hardware renderer die. I'm just asking you what your plan is.

EgonOlsen

Wait until it's inevitable to upgrade. I just don't like way in which LWJGL went...from a simple API to a behemoth that tries to cover everything.

getPoints() doesn't make much sense, because the array is just a container. It gets converted internally anway, I don't store it.