Ejemplo n.º 1
0
void draw_line(
  texture *tx,
  vector *from,
  vector *to,
  pixel color
) {
  vector line, here;
  float t, length;
  size_t row, col;
  vcopy_as(&line, to);
  vsub_from(&line, from);
  line.z = 0;
  length = vmag(&line);
  for (t = 0; t < 1; t += LINE_DRAWING_RESOLUTION / length) {
    vlerp(from, to, t, &here);
    col = (size_t) here.x;
    row = (size_t) here.y;
    if (
      ((col % tx->width) == col)
    &&
      ((row % tx->height) == row)
    ) {
      tx_set_px(tx, color, col, row);
    }
  }
}
Ejemplo n.º 2
0
Vector3 func_1(Vector3 vParam0)
{
	float fVar0;
	float fVar1;
	
	fVar0 = vmag(vParam0);
	if (fVar0 != 0f)
	{
		fVar1 = 1f / fVar0;
		vParam0 = {vParam0 * Vector(fVar1, fVar1, fVar1)};
	}
	else
	{
		vParam0.x = 0f;
		vParam0.y = 0f;
		vParam0.z = 0f;
	}
	return vParam0;
}