src/viewport.cpp
changeset 7579 b7c5cc93fb3f
parent 7578 d0b783a8a3e2
child 7580 fc9a8300f34e
equal deleted inserted replaced
7578:d0b783a8a3e2 7579:b7c5cc93fb3f
  1145 				if (ps2->comparaison_done) continue;
  1145 				if (ps2->comparaison_done) continue;
  1146 
  1146 
  1147 				/* Decide which comparator to use, based on whether the bounding
  1147 				/* Decide which comparator to use, based on whether the bounding
  1148 				 * boxes overlap
  1148 				 * boxes overlap
  1149 				 */
  1149 				 */
  1150 				if (ps->xmax > ps2->xmin && ps->xmin < ps2->xmax && // overlap in X?
  1150 				if (ps->xmax >= ps2->xmin && ps->xmin <= ps2->xmax && // overlap in X?
  1151 						ps->ymax > ps2->ymin && ps->ymin < ps2->ymax && // overlap in Y?
  1151 						ps->ymax >= ps2->ymin && ps->ymin <= ps2->ymax && // overlap in Y?
  1152 						ps->zmax > ps2->zmin && ps->zmin < ps2->zmax) { // overlap in Z?
  1152 						ps->zmax >= ps2->zmin && ps->zmin <= ps2->zmax) { // overlap in Z?
  1153 					/* Use X+Y+Z as the sorting order, so sprites closer to the bottom of
  1153 					/* Use X+Y+Z as the sorting order, so sprites closer to the bottom of
  1154 					 * the screen and with higher Z elevation, are drawn in front.
  1154 					 * the screen and with higher Z elevation, are drawn in front.
  1155 					 * Here X,Y,Z are the coordinates of the "center of mass" of the sprite,
  1155 					 * Here X,Y,Z are the coordinates of the "center of mass" of the sprite,
  1156 					 * i.e. X=(left+right)/2, etc.
  1156 					 * i.e. X=(left+right)/2, etc.
  1157 					 * However, since we only care about order, don't actually divide / 2
  1157 					 * However, since we only care about order, don't actually divide / 2