1 /*
2  * Copyright (C) 2023 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 #ifndef OHOS_RENDER_3D_CUBE_H
17 #define OHOS_RENDER_3D_CUBE_H
18 
19 #include "geometry.h"
20 
21 namespace OHOS::Render3D {
22 class Cube : public Geometry {
23 public:
Cube(std::string name,float width,float height,float depth,Vec3 & position)24     Cube(std::string name, float width, float height, float depth, Vec3& position) : Geometry(name, position),
25         width_(width), height_(height), depth_(depth) {};
~Cube()26     virtual ~Cube() {};
27 
GetType()28     int32_t GetType() const override
29     {
30         return GeometryType::CUBE;
31     }
32 
GetWidth()33     float GetWidth() const
34     {
35         return width_;
36     }
37 
GetHeight()38     float GetHeight() const
39     {
40         return height_;
41     }
42 
GetDepth()43     float GetDepth() const
44     {
45         return depth_;
46     }
47 protected:
IsEqual(const Geometry & obj)48     bool IsEqual(const Geometry& obj) const override
49     {
50         const auto& m = reinterpret_cast<const Cube&>(obj);
51 
52         return GetWidth() == m.GetWidth()
53             && GetHeight() == m.GetHeight()
54             && GetDepth() == m.GetDepth();
55     }
56 private:
57     float width_ { 0.0f };
58     float height_ { 0.0f };
59     float depth_ { 0.0f };
60 };
61 } // namespace OHOS::Render3D
62 #endif // OHOS_RENDER_3D_CUBE_H
63