I would not use cos/sin. I would use tformpoint and a pivot. At least then, if sin/cos is being used for the trasnformation it's done as fast as possible in C.
It may also be possible to do the transforms by calculating three normals from the cameram, one for each of it's axes, and then figuring out how much to scale those by accoridng to how far away the quad is.
In other words, the camera's Z normal tells which direction the quad faces. You can probably throw that away.
The camera's X and Y normal can be scaled by some values, positive and negative, to calculate the corners of the quad, so they are aligned with the camera view. But then I suppose the quad would roll with the camera. So you might have to use a pivot that you somehow control the roll of to calculate these. And then you use the distance of the quad from the camera to calculate what to divide the size of the quad by so it changes with perspective.
Then again, I suppose since you would be actually positing the quad at it's location in space that you need not actually scale it by it's distance. That's good cause it saves you a divide and a square root.
So I guess what you'd do is:
1. Create your pivot which you align to the camera in some way depending on whether you want the quads to roll with the camera or not.
2. Use TformNormal twice, once with 1 in the X slot, and once with a 1 in the Y slot. That gives you the pivot's X and Y axis.
For each quad:
3. If your quad is 2 units in radius, multiply these normals by 2.
4. Then, using the center of the quad, calculate the positions of the four corners by addind and subtracting the normals from that location as appropriate.
5. Position your vertices and build your triangle.
6. To get the normal for each vertex if you want lit quads, then you can transform that pivot's Z axis too... though use -1 so it points towards the camera.
Yeah that should work. And no sin/cos except for one hidden int he tform function that you only do once per frame for all quads.
It may also be possible to do the transforms by calculating three normals from the cameram, one for each of it's axes, and then figuring out how much to scale those by accoridng to how far away the quad is.
In other words, the camera's Z normal tells which direction the quad faces. You can probably throw that away.
The camera's X and Y normal can be scaled by some values, positive and negative, to calculate the corners of the quad, so they are aligned with the camera view. But then I suppose the quad would roll with the camera. So you might have to use a pivot that you somehow control the roll of to calculate these. And then you use the distance of the quad from the camera to calculate what to divide the size of the quad by so it changes with perspective.
Then again, I suppose since you would be actually positing the quad at it's location in space that you need not actually scale it by it's distance. That's good cause it saves you a divide and a square root.
So I guess what you'd do is:
1. Create your pivot which you align to the camera in some way depending on whether you want the quads to roll with the camera or not.
2. Use TformNormal twice, once with 1 in the X slot, and once with a 1 in the Y slot. That gives you the pivot's X and Y axis.
For each quad:
3. If your quad is 2 units in radius, multiply these normals by 2.
4. Then, using the center of the quad, calculate the positions of the four corners by addind and subtracting the normals from that location as appropriate.
5. Position your vertices and build your triangle.
6. To get the normal for each vertex if you want lit quads, then you can transform that pivot's Z axis too... though use -1 so it points towards the camera.
Yeah that should work. And no sin/cos except for one hidden int he tform function that you only do once per frame for all quads.