1 /*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "utils/camera3d.h"
17
18 #include "engine_adapter/impl_factory.h"
19
20 namespace OHOS {
21 namespace Rosen {
22 namespace Drawing {
Camera3D()23 Camera3D::Camera3D() noexcept : impl_(ImplFactory::CreateCameraImpl()) {}
~Camera3D()24 Camera3D::~Camera3D() {}
25
Save()26 void Camera3D::Save()
27 {
28 impl_->Save();
29 }
30
Restore()31 void Camera3D::Restore()
32 {
33 impl_->Restore();
34 }
35
Translate(scalar x,scalar y,scalar z)36 void Camera3D::Translate(scalar x, scalar y, scalar z)
37 {
38 impl_->Translate(x, y, z);
39 }
40
RotateXDegrees(scalar deg)41 void Camera3D::RotateXDegrees(scalar deg)
42 {
43 impl_->RotateX(deg);
44 }
45
RotateYDegrees(scalar deg)46 void Camera3D::RotateYDegrees(scalar deg)
47 {
48 impl_->RotateY(deg);
49 }
50
RotateZDegrees(scalar deg)51 void Camera3D::RotateZDegrees(scalar deg)
52 {
53 impl_->RotateZ(deg);
54 }
55
SetCameraPos(scalar x,scalar y,scalar z)56 void Camera3D::SetCameraPos(scalar x, scalar y, scalar z)
57 {
58 impl_->SetCameraPos(x, y, z);
59 }
60
GetCameraPosX() const61 scalar Camera3D::GetCameraPosX() const
62 {
63 return impl_->GetCameraPosX();
64 }
65
GetCameraPosY() const66 scalar Camera3D::GetCameraPosY() const
67 {
68 return impl_->GetCameraPosY();
69 }
70
GetCameraPosZ() const71 scalar Camera3D::GetCameraPosZ() const
72 {
73 return impl_->GetCameraPosZ();
74 }
75
ApplyToMatrix(Matrix & m)76 void Camera3D::ApplyToMatrix(Matrix& m)
77 {
78 impl_->ApplyToMatrix(m);
79 }
80 } // namespace Drawing
81 } // namespace Rosen
82 } // namespace OHOS