jPCT - a 3d engine for Java > Support

Painting a Mouse Cursor-Selected Polygon

(1/4) > >>

AGP:
I'm trying to paint an area of my 3d plane as a cursor is moved (think area selection for building in a strategy game). The furthest (farthest?) I got was:

--- Code: ---VisList visList = theWorld.getVisibilityList();
int polyID = Interact2D.getPolygonID(Interact2D.pickPolygon(visList, Interact2D.reproject2D3D(theCamera, buffer, x, y)));

--- End code ---
I assume that camera-space is all I need here, since the docs suggest reproject2D3D and not reproject2D3DWS. Even if this is right, how can I now get something useful out of it (like, say, the vertices of the returned polygon)?

EgonOlsen:
You can get the (transformed) vertices from the PolygonManager by the polygon's ID. Not sure if that really helps here though. If you need the actual raw data for manipulating the polygons in a VertexController or something like that, you have create a kind of mapping between them. However, once they are compiled, your options to fiddle around with the polygons/vertices are limited anyway.

AGP:
I'm using the software renderer, so I can use the vertices. What about the surrounding triangles?

EgonOlsen:
You could guess them by matching coordinates and such....not sure if that's a great approach though.

AGP:
What would you suggest instead?

Navigation

[0] Message Index

[#] Next page

Go to full version