+void Scene::SurfaceRotated(float width, float height, int orientation)
+{
+ mSurfaceOrientation = orientation;
+ ChangedSurface(width, height, orientation);
+}
+
+int Scene::GetSurfaceOrientation()
+{
+ return mSurfaceOrientation;
+}
+
+void Scene::ChangedSurface(float width, float height, int orientation)
+{
+ Rect<int32_t> newSize(0, 0, static_cast<int32_t>(width), static_cast<int32_t>(height)); // truncated
+
+ mSize.width = width;
+ mSize.height = height;
+
+ // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
+ mDefaultCamera->SetPerspectiveProjection(mSize);
+ // Set the surface orientation to Default camera for window/screen rotation
+ mDefaultCamera->RotateProjection(orientation);
+
+ mRootLayer->SetSize(width, height);
+
+ ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
+ SceneGraph::UpdateManager& updateManager = tls->GetUpdateManager();
+ SetDefaultSurfaceRectMessage(updateManager, newSize);
+
+ // Send the surface orientation to render manager for calculating glViewport/Scissor
+ SetDefaultSurfaceOrientationMessage(updateManager, orientation);
+
+ // set default render-task viewport parameters
+ RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask(0u);
+ defaultRenderTask->SetViewport(newSize);
+}
+