rust/lib-hedgewars-engine/src/render/camera.rs
changeset 14739 5915a199cb81
parent 14730 65c971417780
child 15141 febccab419b1
equal deleted inserted replaced
14738:16024046d458 14739:5915a199cb81
    32             self.position.x + half_width,
    32             self.position.x + half_width,
    33             self.position.y - half_height,
    33             self.position.y - half_height,
    34             self.position.y + half_height,
    34             self.position.y + half_height,
    35         )
    35         )
    36     }
    36     }
       
    37 
       
    38     pub fn projection(&self) -> [f32; 16] {
       
    39         let viewport = self.viewport();
       
    40         let left = viewport.left() as f32;
       
    41         let width = viewport.width() as f32;
       
    42         let height = viewport.height() as f32;
       
    43         let top = viewport.top() as f32;
       
    44 
       
    45         [
       
    46             2f32 / width,
       
    47             0f32,
       
    48             0f32,
       
    49             0f32,
       
    50             0f32,
       
    51             2f32 / -height,
       
    52             0f32,
       
    53             0f32,
       
    54             0f32,
       
    55             0f32,
       
    56             0.5f32,
       
    57             0f32,
       
    58             -(2.0 * left + width) / width,
       
    59             (2.0 * top + height) / height,
       
    60             0.5f32,
       
    61             1f32,
       
    62         ]
       
    63     }
    37 }
    64 }