| 168 | } |
| 169 | |
| 170 | void RenderView::SetProjector(float nearPlane, float farPlane, const Float3& position, const Float3& direction, const Float3& up, float angle) |
| 171 | { |
| 172 | // Copy data |
| 173 | Near = nearPlane; |
| 174 | Far = farPlane; |
| 175 | Position = position; |
| 176 | |
| 177 | // Create projection matrix |
| 178 | Matrix::PerspectiveFov(angle * DegreesToRadians, 1.0f, nearPlane, farPlane, Projection); |
| 179 | NonJitteredProjection = Projection; |
| 180 | Matrix::Invert(Projection, IP); |
| 181 | |
| 182 | // Create view matrix |
| 183 | Direction = direction; |
| 184 | Matrix::LookAt(Position, Position + Direction, up, View); |
| 185 | Matrix::Invert(View, IV); |
| 186 | |
| 187 | // Compute frustum matrix |
| 188 | Frustum.SetMatrix(View, Projection); |
| 189 | Matrix::Invert(ViewProjection(), IVP); |
| 190 | CullingFrustum = Frustum; |
| 191 | } |
| 192 | |
| 193 | void RenderView::CopyFrom(const Camera* camera, const Viewport* viewport) |
| 194 | { |
no test coverage detected