|
*** useful
Returns the x,y bitmap coordination of a pixel according to a point X,Y,Z on the polygon
Similar to STATE_polygon_get_bitmap_pixel_rgba() only here we get the x,y bitmap coordinate of the pixel
The big advantage here, is that we can take these coordinate and use them with STATE_bitmap_set_pixel()
This function is very useful when we want to change bitmaps according to events hapenning in the world
for example if we shoot on something and now we want to add a mark there.
we can use STATE_engine_is_movement_possible() to calculate where our bullet has hit
Then we can take the hitting point X,Y,Z and get the relevant bitmap coordination
then by using STATE_bitmap_set_pixel() we can modify the pixel and the pixel next to it
to reflect a bullet hole. (note that a different technique is using poygon patches. See STATE_polygon_add_patch_easy() )
Parameters:
XYZ_on_polygon [in]:
a point on the polygon.
This point can be obtained by STATE_engine_is_movement_possible(), STATE_engine_2D_point_to_3D()
or other way.
XYZ_on_polygon[0] the x coord
XYZ_on_polygon[1] the y coord
XYZ_on_polygon[2] the z coord
bitmap_index [in]:
0 or 1. 0 for the primary bitmap. 1 for the secondary bitmap
x,y [out]
The return bitmap coordination
Example:
double XYZ[3]={100, 0, 0}; assuming this point is on the polygon
int x,y;
STATE_polygon_get_bitmap_pixel_xy(my_poly, XYZ, 0, &x, &y);
|