Skip to content
  • Robert Bragg's avatar
    clutter-stage: Allow a wider range of visible z values · 34600949
    Robert Bragg authored
    Since eef9078f the translation of the camera away from the z=zero
    plane was hardcoded at 50 which is approximately half way between the
    default z_near and z_far values. This ended up with quite a small
    distance in user-space coordinates to the far plane with the default
    stage size and this was causing test-texture-quality to clip the actor
    early.
    
    This patch makes it try to calculate a reasonable value for the
    position of the z=0 plane as well as a value for z_far so we maximize
    the space in between the z=0 plane and the near plane and we have a
    predictable amount of space behind the stage before hitting the far
    clipping plane, while considering the trade off of loosing depth
    precision by pushing the far plane too far back relative to the near
    plane.
    
    With the default fov of 60° it's not possible to use the stage size to
    define the gap in-front of the stage plane; only ~87% of the stage size
    is possible as an upper limit. We make 85% of the stage_height available
    assuming you have a fov of 60°. We consistently provide 10 times the
    stage height of space behind the stage regardless of the fov.
    
    It seems worth noting here that we went around in circles a few times
    over how to calculate the gaps since there are a number of trade offs to
    consider and they also affect the complexity of the solution. In the end
    we went for simplicity but commented the issues well enough hopefully so
    we can develop a more elaborate solution if we ever have a use-case.
    
    http://bugzilla.clutter-project.org/show_bug.cgi?id=2625
    34600949