STATE_polygon_shift_bitmap

 

 





  Moves the bitmap of the polygon
  If you intend to shift the bitmap of only one polygon you should use STATE_polygon_shift_bitmap_including_fractions() instead
  See note below.
  
   Parameters:
   -----------
  Delta_x: The desired change in the x coordinates of the bitmap. 0 means no change. numbers could also be negative.
  Delta_y: The desired change in the y coordinates of the bitmap. 0 means no change. numbers could also be negative.
  bitmap_number: 1 or 2. 1 for moving the primary bitmap. 2 for moving the secondary bitmap
  
   note that if delta_x or delta_y are assigned with an integer number it is as if it is assigned with 0.
   it is like rotating an object 0 degrees oo 360 degrees or -720 degrees. It will all give the same result.

   Examples:
   A)
  		   Shifting the x coordinates of the primary bitmap half way
  		STATE_polygon_shift_bitmap(poly, 0.5, 0, 1); 
  
   B)
  		   Shifting the y coordinates of the secondary bitmap one tenth in the oposit direction
  		STATE_polygon_shift_bitmap(poly, 0, -0.1, 2); 
  
   IMPORTANT NOTE: 
   If you intend to shift the bitmap of only one polygon you should use STATE_polygon_shift_bitmap_including_fractions()
   For example if you want to shift the bitmap on a polygon that is used as a sky
   If the sky are made of one polygon then use STATE_polygon_shift_bitmap_including_fractions() insted
   If the sky are made of several polygons (Works better to have the sky made from several triangles if you are using fog)
   you should continue reading the note below.
   When the world is loaded some of the polygons 
   are split into smaller fractions (as part of BSP Tree creation)
   so it could be that you will have to shift the bitmap of several polygons, not just the one you intended.
   For example lets assume that you put a very big polygon in the sky
   (to create clouds effect using LIGHT_SOURCE_GLASS, see STATE_polygon_set_translucent() ) now you want to shift the bitmap
   you do DWORD sky=STATE_polygon_get_handle_using_name() and you call STATE_polygon_shift_bitmap()
   Now it is very possible that you will notice that only a small part of your polygon shift its bitmap.
   Here is how to solve it:
   At the beginning of your program collect all the fractions that make your sky
   like that:
  	for(DWORD poly=STATE_polygon_get_first_polygon(); poly!=NULL; poly=STATE_polygon_get_next(poly)) {
  		char *name=STATE_polygon_get_name(poly);
  		if(strcmp(name, "My_Sky")==0) {
  			m_sky_polygons[m_number_of_sky_polygons]=poly;
  			m_number_of_sky_polygons++;
  
  		}
  
  	}
  
   Now to shift the bitmap do:
  	for(int i=0; i

 

 

Go to page 1      Select API

 

Copyright © 2007 3DSTATE Corporation. www.3dstate.com